Merging r48794 through r48802 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin
2012-07-10 13:24:29 +00:00
9 changed files with 75 additions and 17 deletions

View File

@@ -299,6 +299,19 @@ extern "C" {
*/
void COM_execute(RenderData* rd, bNodeTree *editingtree, int rendering);
/**
* @brief Return a list of highlighted bnodes pointers.
* @return
*/
void COM_startReadHighlights(void);
/**
* @brief check if a bnode is highlighted
* @param bnode
* @return
*/
int COM_isHighlightedbNode(bNode* bnode);
#ifdef __cplusplus
}
#endif

View File

@@ -28,11 +28,11 @@ class MemoryBuffer;
#include "COM_ExecutionGroup.h"
#include "BLI_rect.h"
#include "COM_MemoryProxy.h"
#include "BLI_math.h"
//extern "C" {
// #include "BLI_threads.h"
//}
extern "C" {
//#include "BLI_threads.h"
#include "BLI_math.h"
}
//#include <vector>
/**

View File

@@ -66,6 +66,12 @@ static bool g_openclActive = false;
#endif
#endif
#define MAX_HIGHLIGHT 8
extern "C" {
int g_highlightIndex;
void ** g_highlightedNodes;
void ** g_highlightedNodesRead;
#define HIGHLIGHT(wp) \
{ \
ExecutionGroup* group = wp->getExecutionGroup(); \
@@ -77,14 +83,38 @@ static bool g_openclActive = false;
bNode *node = complexOperation->getbNode(); \
if (node) { \
if (node->original) { \
node->original->highlight = 1;\
} else {\
node->highlight = 1; \
node = node->original;\
}\
if (g_highlightIndex < MAX_HIGHLIGHT) {\
g_highlightedNodes[g_highlightIndex++] = node;\
}\
} \
} \
} \
}
void COM_startReadHighlights() {
if (g_highlightedNodesRead) {
delete g_highlightedNodesRead;
}
g_highlightedNodesRead = g_highlightedNodes;
g_highlightedNodes = new void*[MAX_HIGHLIGHT];
g_highlightIndex = 0;
for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
g_highlightedNodes[i] = 0;
}
}
int COM_isHighlightedbNode(bNode* bnode) {
if (!g_highlightedNodesRead) return false;
for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
void* p = g_highlightedNodesRead[i];
if (!p) return false;
if (p == bnode) return true;
}
return false;
}
} // end extern "C"
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
void *WorkScheduler::thread_execute_cpu(void *data)
@@ -219,6 +249,9 @@ extern void clContextError(const char *errinfo, const void *private_info, size_t
void WorkScheduler::initialize()
{
g_highlightedNodesRead = 0;
g_highlightedNodes = 0;
COM_startReadHighlights();
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
int numberOfCPUThreads = BLI_system_thread_count();
@@ -313,3 +346,4 @@ void WorkScheduler::deinitialize()
#endif
#endif
}

View File

@@ -31,6 +31,7 @@ set(INC
../../nodes
../../render/extern/include
../../windowmanager
../../compositor
../../../../intern/guardedalloc
../../../../intern/opennl/extern
)

View File

@@ -4,7 +4,7 @@ Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
incs += ' ../../nodes ../../render/extern/include ../../blenloader ../../gpu'
incs += ' ../../nodes ../../render/extern/include ../../blenloader ../../gpu ../../compositor'
incs += ' ../../windowmanager #intern/guardedalloc #extern/glew/include'
defs = []
cf = []

View File

@@ -80,6 +80,7 @@
#include "intern/node_util.h"
#include "node_intern.h"
#include "COM_compositor.h"
/* width of socket columns in group display */
#define NODE_GROUP_FRAME 120
@@ -726,9 +727,8 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) {
if (node->highlight) {
if (COM_isHighlightedbNode(node)) {
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
node->highlight = 0;
}
}
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
@@ -893,9 +893,8 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) {
if (node->highlight) {
if (COM_isHighlightedbNode(node)) {
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
node->highlight = 0;
}
}
@@ -1131,6 +1130,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
if (snode->nodetree) {
bNode *node;
/* void** highlights = 0; */ /* UNUSED */
node_uiblocks_init(C, snode->nodetree);
@@ -1143,6 +1143,9 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
}
node_update_nodetree(C, snode->nodetree, 0.0f, 0.0f);
if (snode->nodetree->type == NTREE_COMPOSIT) {
COM_startReadHighlights();
}
node_draw_nodetree(C, ar, snode, snode->nodetree);
#if 0

View File

@@ -1157,6 +1157,9 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
BLI_remlink(&wgroup->nodes, node);
BLI_addtail(&ntree->nodes, node);
/* ensure unique node name in the nodee tree */
nodeUniqueName(ntree, node);
node->locx += gnode->locx;
node->locy += gnode->locy;
@@ -1370,6 +1373,9 @@ static int node_group_separate_selected(bNodeTree *ntree, bNode *gnode, int make
BLI_remlink(&ngroup->nodes, newnode);
BLI_addtail(&ntree->nodes, newnode);
/* ensure unique node name in the node tree */
nodeUniqueName(ntree, newnode);
newnode->locx += gnode->locx;
newnode->locy += gnode->locy;
}
@@ -3710,11 +3716,14 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
BLI_remlink(&ntree->nodes, node);
BLI_addtail(&ngroup->nodes, node);
/* ensure unique node name in the ngroup */
nodeUniqueName(ngroup, node);
node->locx -= 0.5f * (min[0] + max[0]);
node->locy -= 0.5f * (min[1] + max[1]);
}
}
/* move animation data over */
if (ntree->adt) {
LinkData *ld, *ldn = NULL;

View File

@@ -178,9 +178,7 @@ typedef struct bNode {
char label[64]; /* custom user-defined label, MAX_NAME */
short custom1, custom2; /* to be abused for buttons */
float custom3, custom4;
int highlight; /* 0 = not highlighted, 1-N = highlighted*/
int pad;
short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
void *threaddata; /* optional extra storage for use in thread (read only then!) */
rctf totr; /* entire boundbox */

View File

@@ -61,7 +61,7 @@
#include "node_composite_util.h"
#ifdef WITH_COMPOSITOR
# include "COM_compositor.h"
#include "COM_compositor.h"
#endif
static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)