diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-06 19:31:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-06 19:31:25 +0400 |
commit | 8d54982f37cf48d510fa2de0b2b45c635164a7f3 (patch) | |
tree | c356e1304bf02a2714cde79ea51ce46340a26c58 /source/blender/editors/space_node/node_select.c | |
parent | 86307b58c0991472b25bd0c24ba8d2cdbf332bc3 (diff) |
Material buttons now view the active node material shading settings.
Selecting a material in the node tree sets this as the active material and the buttons view redraws.
Added rna prop material.active_node_material
Currently its not clear what settings are used by the node material and the base material (needs some tedious research) so I made most panels use the node material with the exceptions of volumetrics, physics and halo settings.
We'll probably need to split the panels up to do this properly.
Diffstat (limited to 'source/blender/editors/space_node/node_select.c')
-rw-r--r-- | source/blender/editors/space_node/node_select.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 5e482758c9d..ecbd46b720f 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -38,6 +38,7 @@ #include "BKE_context.h" #include "BKE_node.h" #include "BKE_global.h" +#include "BKE_utildefines.h" #include "BLI_rect.h" @@ -55,7 +56,7 @@ #include "node_intern.h" -static void node_mouse_select(SpaceNode *snode, ARegion *ar, short *mval, short extend) +static bNode *node_mouse_select(SpaceNode *snode, ARegion *ar, short *mval, short extend) { bNode *node; float mx, my; @@ -101,7 +102,10 @@ static void node_mouse_select(SpaceNode *snode, ARegion *ar, short *mval, short ;// node_link_viewer(snode, node); //std_rmouse_transform(node_transform_ext); /* does undo push for select */ + } + + return node; } static int node_select_exec(bContext *C, wmOperator *op) @@ -112,6 +116,7 @@ static int node_select_exec(bContext *C, wmOperator *op) int select_type; short mval[2]; short extend; + bNode *node= NULL; select_type = RNA_enum_get(op->ptr, "select_type"); @@ -120,12 +125,20 @@ static int node_select_exec(bContext *C, wmOperator *op) mval[0] = RNA_int_get(op->ptr, "mouse_x"); mval[1] = RNA_int_get(op->ptr, "mouse_y"); extend = RNA_boolean_get(op->ptr, "extend"); - node_mouse_select(snode, ar, mval, extend); + node= node_mouse_select(snode, ar, mval, extend); break; } /* need refresh/a notifier vs compo notifier */ // XXX WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL); /* Do we need to pass the scene? */ + + /* WATCH THIS, there are a few other ways to change the active material */ + if(node) { + if (node->id && GS(node->id->name)== ID_MA) { + WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, node->id); + } + } + ED_region_tag_redraw(ar); /* allow tweak event to work too */ |