diff options
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 105 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_header.c | 88 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/space_node/space_node.c | 2 |
5 files changed, 0 insertions, 199 deletions
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index 3803f899ccc..ed37a4c97c7 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -47,7 +47,6 @@ set(SRC node_draw.c node_edit.c node_group.c - node_header.c node_ops.c node_relationships.c node_select.c diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index cd3de834e78..b78ddc1d946 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -77,108 +77,6 @@ #include "NOD_shader.h" #include "NOD_texture.h" -/* ****************** MENU FUNCTIONS ***************** */ - -static void node_add_menu_class(bContext *C, uiLayout *layout, void *arg_nodeclass) -{ - Scene *scene = CTX_data_scene(C); - SpaceNode *snode = CTX_wm_space_node(C); - bNodeTree *ntree; - int nodeclass = GET_INT_FROM_POINTER(arg_nodeclass); - int event, compatibility = 0; - - ntree = snode->nodetree; - - if (!ntree) { - uiItemS(layout); - return; - } - - if (ntree->type == NTREE_SHADER) { - if (BKE_scene_use_new_shading_nodes(scene)) - compatibility = NODE_NEW_SHADING; - else - compatibility = NODE_OLD_SHADING; - } - - if (nodeclass == NODE_CLASS_GROUP) { - Main *bmain = CTX_data_main(C); - bNodeTree *ngroup; - const char *ngroup_type, *node_type; - PointerRNA ptr; - - NODE_TYPES_BEGIN(ntype) - if (ntype->nclass != nodeclass || !ntype->ui_name) - continue; - if (!ntype->poll(ntype, ntree)) - continue; - - switch (ntree->type) { - case NTREE_COMPOSIT: - ngroup_type = "CompositorNodeTree"; - node_type = "CompositorNodeGroup"; - break; - case NTREE_SHADER: - ngroup_type = "ShaderNodeTree"; - node_type = "ShaderNodeGroup"; - break; - case NTREE_TEXTURE: - ngroup_type = "TextureNodeTree"; - node_type = "TextureNodeGroup"; - break; - } - - ptr = uiItemFullO(layout, "NODE_OT_group_make", "New Group", ntype->ui_icon, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); - RNA_string_set(&ptr, "node_type", node_type); - - uiItemS(layout); - - for (ngroup = bmain->nodetree.first, event = 0; ngroup; ngroup = ngroup->id.next, ++event) { - /* only use group trees of the right type */ - if (STRNEQ(ngroup->idname, ngroup_type)) - continue; - if (!nodeGroupPoll(ntree, ngroup)) - continue; - - ptr = uiItemFullO(layout, "NODE_OT_add_group_node", ngroup->id.name + 2, ntype->ui_icon, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); - RNA_string_set(&ptr, "type", ntype->idname); - RNA_string_set(&ptr, "grouptree", ngroup->id.name + 2); - } - NODE_TYPES_END - } - else if (nodeclass == NODE_DYNAMIC) { - /* disabled */ - } - else { - PointerRNA ptr; - - NODE_TYPES_BEGIN(ntype) - if (ntype->nclass != nodeclass || !ntype->ui_name) - continue; - if (!ntype->poll(ntype, ntree)) - continue; - if (compatibility && (ntype->compatibility & compatibility) == 0) - continue; - - ptr = uiItemFullO(layout, "NODE_OT_add_node", IFACE_(ntype->ui_name), ntype->ui_icon, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS); - RNA_string_set(&ptr, "type", ntype->idname); - NODE_TYPES_END - } -} - -static void node_add_menu_foreach_class_cb(void *calldata, int nclass, const char *name) -{ - uiLayout *layout = calldata; - uiItemMenuF(layout, IFACE_(name), 0, node_add_menu_class, SET_INT_IN_POINTER(nclass)); -} - -static void node_add_menu_default(const bContext *C, uiLayout *layout, bNodeTree *ntree) -{ - Scene *scene = CTX_data_scene(C); - - if (ntree->typeinfo->foreach_nodeclass) - ntree->typeinfo->foreach_nodeclass(scene, layout, node_add_menu_foreach_class_cb); -} /* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */ @@ -2784,11 +2682,8 @@ void ED_node_init_butfuncs(void) /* tree type icons */ ntreeType_Composite->ui_icon = ICON_RENDERLAYERS; - ntreeType_Composite->draw_add_menu = node_add_menu_default; ntreeType_Shader->ui_icon = ICON_MATERIAL; - ntreeType_Shader->draw_add_menu = node_add_menu_default; ntreeType_Texture->ui_icon = ICON_TEXTURE; - ntreeType_Texture->draw_add_menu = node_add_menu_default; } void ED_init_custom_node_type(bNodeType *ntype) diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c deleted file mode 100644 index 8de2daf9e42..00000000000 --- a/source/blender/editors/space_node/node_header.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2008 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): Blender Foundation - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file blender/editors/space_node/node_header.c - * \ingroup spnode - */ - -#include <string.h> - -#include "DNA_space_types.h" -#include "DNA_node_types.h" -#include "DNA_screen_types.h" - -#include "MEM_guardedalloc.h" - -#include "BLI_blenlib.h" -#include "BLI_utildefines.h" - -#include "BLF_translation.h" - -#include "BKE_blender.h" -#include "BKE_context.h" -#include "BKE_global.h" -#include "BKE_main.h" -#include "BKE_node.h" -#include "BKE_scene.h" -#include "BKE_screen.h" - -#include "WM_api.h" -#include "WM_types.h" - -#include "UI_view2d.h" - -#include "node_intern.h" /* own include */ - -/* ************************ add menu *********************** */ - -static void node_menu_add(const bContext *C, Menu *menu) -{ - SpaceNode *snode = CTX_wm_space_node(C); - uiLayout *layout = menu->layout; - bNodeTree *ntree = snode->edittree; - - if (!ntree || !ntree->typeinfo || !ntree->typeinfo->draw_add_menu) { - uiLayoutSetActive(layout, FALSE); - return; - } - - uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); - uiItemO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Search ..."), 0, "NODE_OT_add_search"); - - ntree->typeinfo->draw_add_menu(C, layout, ntree); -} - -void node_menus_register(void) -{ - MenuType *mt; - - mt = MEM_callocN(sizeof(MenuType), "spacetype node menu add"); - strcpy(mt->idname, "NODE_MT_add"); - strcpy(mt->label, N_("Add")); - strcpy(mt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); - mt->draw = node_menu_add; - WM_menutype_add(mt); -} diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index b45ca8b228f..4b31f22b172 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -68,9 +68,6 @@ ARegion *node_has_tools_region(ScrArea *sa); void snode_group_offset(struct SpaceNode *snode, float *x, float *y); /* transform between View2Ds in the tree path */ -/* node_header.c */ -void node_menus_register(void); - /* node_draw.c */ int node_get_colorid(struct bNode *node); void node_socket_circle_draw(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node, diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 2075cc055e1..86cf9d98e78 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -784,8 +784,6 @@ void ED_spacetype_node(void) BLI_addhead(&st->regiontypes, art); - node_menus_register(); - /* regions: listview/buttons */ art = MEM_callocN(sizeof(ARegionType), "spacetype node region"); art->regionid = RGN_TYPE_UI; |