From 1f96dd2e0bb7440002b24c98e4c9d7daa44f2ebd Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 15 May 2017 13:47:48 +0200 Subject: Fix T51348: Node highlighting is broken This feature was disabled in the code but not in the interface. Removing the code, since it needs full re-implementation anyway. --- source/blender/compositor/COM_compositor.h | 13 --- .../compositor/intern/COM_WorkScheduler.cpp | 105 --------------------- source/blender/editors/space_node/node_draw.c | 28 +----- source/blender/makesdna/DNA_space_types.h | 2 +- source/blender/makesrna/intern/rna_space.c | 5 - 5 files changed, 3 insertions(+), 150 deletions(-) (limited to 'source') diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h index a5d7704a708..3b24f9c69a2 100644 --- a/source/blender/compositor/COM_compositor.h +++ b/source/blender/compositor/COM_compositor.h @@ -331,19 +331,6 @@ void COM_deinitialize(void); */ // void COM_clearCaches(void); // NOT YET WRITTEN -/** - * @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 diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index 39147f3ab84..68f934008a4 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -75,82 +75,6 @@ static bool g_openclInitialized = false; #endif #endif -#define MAX_HIGHLIGHT 8 -static bool g_highlightInitialized = false; -extern "C" { -static int g_highlightIndex; -static void **g_highlightedNodes; -static void **g_highlightedNodesRead; - -/* XXX highlighting disabled for now - * This requires pointers back to DNA data (bNodeTree/bNode) in operations, which is bad! - * Instead IF we want to keep this feature it should use a weak reference such as bNodeInstanceKey - */ -#if 0 -#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE -#define HIGHLIGHT(wp) \ -{ \ - ExecutionGroup *group = wp->getExecutionGroup(); \ - if (group->isComplex()) { \ - NodeOperation *operation = group->getOutputOperation(); \ - if (operation->isWriteBufferOperation()) { \ - WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation; \ - NodeOperation *complexOperation = writeOperation->getInput(); \ - bNode *node = complexOperation->getbNode(); \ - if (node) { \ - if (node->original) { \ - node = node->original; \ - } \ - if (g_highlightInitialized && g_highlightedNodes) { \ - if (g_highlightIndex < MAX_HIGHLIGHT) { \ - g_highlightedNodes[g_highlightIndex++] = node; \ - } \ - } \ - } \ - } \ - } \ -} -#endif /* COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE */ -#else -# if COM_CURRENT_THREADING_MODEL != COM_TM_NOTHREAD -#define HIGHLIGHT(wp) {} -# endif -#endif - -void COM_startReadHighlights() -{ - if (!g_highlightInitialized) { - return; - } - - if (g_highlightedNodesRead) { - MEM_freeN(g_highlightedNodesRead); - } - - g_highlightedNodesRead = g_highlightedNodes; - g_highlightedNodes = (void **)MEM_callocN(sizeof(void *) * MAX_HIGHLIGHT, __func__); - g_highlightIndex = 0; -} - -int COM_isHighlightedbNode(bNode *bnode) -{ - if (!g_highlightInitialized) { - return false; - } - - 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) { @@ -158,7 +82,6 @@ void *WorkScheduler::thread_execute_cpu(void *data) WorkPackage *work; BLI_thread_local_set(g_thread_device, device); while ((work = (WorkPackage *)BLI_thread_queue_pop(g_cpuqueue))) { - HIGHLIGHT(work); device->execute(work); delete work; } @@ -172,7 +95,6 @@ void *WorkScheduler::thread_execute_gpu(void *data) WorkPackage *work; while ((work = (WorkPackage *)BLI_thread_queue_pop(g_gpuqueue))) { - HIGHLIGHT(work); device->execute(work); delete work; } @@ -289,19 +211,6 @@ static void CL_CALLBACK clContextError(const char *errinfo, void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) { - /* initialize highlighting */ - if (!g_highlightInitialized) { - if (g_highlightedNodesRead) MEM_freeN(g_highlightedNodesRead); - if (g_highlightedNodes) MEM_freeN(g_highlightedNodes); - - g_highlightedNodesRead = NULL; - g_highlightedNodes = NULL; - - COM_startReadHighlights(); - - g_highlightInitialized = true; - } - #if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE /* deinitialize if number of threads doesn't match */ if (g_cpudevices.size() != num_cpu_threads) { @@ -439,20 +348,6 @@ void WorkScheduler::deinitialize() } #endif #endif - - /* deinitialize highlighting */ - if (g_highlightInitialized) { - g_highlightInitialized = false; - if (g_highlightedNodes) { - MEM_freeN(g_highlightedNodes); - g_highlightedNodes = NULL; - } - - if (g_highlightedNodesRead) { - MEM_freeN(g_highlightedNodesRead); - g_highlightedNodesRead = NULL; - } - } } int WorkScheduler::current_thread_id() diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index ab40c55b59d..6e25c87d274 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -820,14 +820,6 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); -#ifdef WITH_COMPOSITOR - if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) { - if (COM_isHighlightedbNode(node)) { - UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f); - } - } -#endif - glLineWidth(1.0f); UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); @@ -989,16 +981,6 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b if (node->flag & NODE_MUTED) UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); -#ifdef WITH_COMPOSITOR - if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) { - if (COM_isHighlightedbNode(node)) { - UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f); - } - } -#else - (void)ntree; -#endif - UI_draw_roundbox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); /* outline active and selected emphasis */ @@ -1253,15 +1235,9 @@ static void snode_setup_v2d(SpaceNode *snode, ARegion *ar, const float center[2] static void draw_nodetree(const bContext *C, ARegion *ar, bNodeTree *ntree, bNodeInstanceKey parent_key) { SpaceNode *snode = CTX_wm_space_node(C); - + node_uiblocks_init(C, ntree); - -#ifdef WITH_COMPOSITOR - if (ntree->type == NTREE_COMPOSIT) { - COM_startReadHighlights(); - } -#endif - + node_update_nodetree(C, ntree); node_draw_nodetree(C, ar, snode, ntree, parent_key); } diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 5e015544dc9..0e5d9bd33e6 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -1151,7 +1151,7 @@ typedef enum eSpaceNode_Flag { SNODE_SHOW_G = (1 << 8), SNODE_SHOW_B = (1 << 9), SNODE_AUTO_RENDER = (1 << 5), - SNODE_SHOW_HIGHLIGHT = (1 << 6), +// SNODE_SHOW_HIGHLIGHT = (1 << 6), DNA_DEPRECATED // SNODE_USE_HIDDEN_PREVIEW = (1 << 10), DNA_DEPRECATED December2013 SNODE_NEW_SHADERS = (1 << 11), SNODE_PIN = (1 << 12), diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 7bb17adbc5a..c71af054c02 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -4410,11 +4410,6 @@ static void rna_def_space_node(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL); - prop = RNA_def_property(srna, "show_highlight", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_SHOW_HIGHLIGHT); - RNA_def_property_ui_text(prop, "Highlight", "Highlight nodes that are being calculated"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL); - /* the mx/my "cursor" in the node editor is used only by operators to store the mouse position */ prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(prop, 2); -- cgit v1.2.3