Revision: 60661 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60661 Author: lukastoenne Date: 2013-10-10 12:58:35 +0000 (Thu, 10 Oct 2013) Log Message: ----------- Change to node output socket drawing: Instead of always drawing only the socket label for outputs, leave this check up to the socket type draw function. This gives custom node scripts more flexibility in how to draw socket values by allowing buttons on output sockets as well.
http://wiki.blender.org/index.php/Extensions:2.6/Py/API_Changes#Python_Node_Output_Drawing Modified Paths: -------------- trunk/blender/release/scripts/templates_py/custom_nodes.py trunk/blender/source/blender/editors/space_node/drawnode.c Modified: trunk/blender/release/scripts/templates_py/custom_nodes.py =================================================================== --- trunk/blender/release/scripts/templates_py/custom_nodes.py 2013-10-10 12:58:33 UTC (rev 60660) +++ trunk/blender/release/scripts/templates_py/custom_nodes.py 2013-10-10 12:58:35 UTC (rev 60661) @@ -40,7 +40,7 @@ # Optional function for drawing the socket input value def draw(self, context, layout, node, text): - if self.is_linked: + if self.is_output or self.is_linked: layout.label(text) else: layout.prop(self, "myEnumProperty", text=text) Modified: trunk/blender/source/blender/editors/space_node/drawnode.c =================================================================== --- trunk/blender/source/blender/editors/space_node/drawnode.c 2013-10-10 12:58:33 UTC (rev 60660) +++ trunk/blender/source/blender/editors/space_node/drawnode.c 2013-10-10 12:58:35 UTC (rev 60661) @@ -86,19 +86,13 @@ uiItemL(layout, text, 0); } -static void node_draw_input_default(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr) +static void node_draw_socket_default(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr) { bNodeSocket *sock = (bNodeSocket *)ptr->data; sock->typeinfo->draw(C, layout, ptr, node_ptr, IFACE_(sock->name)); } -static void node_draw_output_default(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr) -{ - bNodeSocket *sock = ptr->data; - node_socket_button_label(C, layout, ptr, node_ptr, IFACE_(sock->name)); -} - /* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */ #if 0 /* UNUSED */ @@ -2752,8 +2746,8 @@ NodeTypeUndefined.tweak_area_func = node_tweak_area_default; NodeTypeUndefined.draw_buttons = NULL; NodeTypeUndefined.draw_buttons_ex = NULL; - NodeTypeUndefined.draw_input = node_draw_input_default; - NodeTypeUndefined.draw_output = node_draw_output_default; + NodeTypeUndefined.draw_input = node_draw_socket_default; + NodeTypeUndefined.draw_output = node_draw_socket_default; NodeTypeUndefined.resize_area_func = node_resize_area_default; NodeSocketTypeUndefined.draw = node_socket_undefined_draw; @@ -2770,8 +2764,8 @@ ntype->tweak_area_func = node_tweak_area_default; ntype->draw_buttons = NULL; ntype->draw_buttons_ex = NULL; - ntype->draw_input = node_draw_input_default; - ntype->draw_output = node_draw_output_default; + ntype->draw_input = node_draw_socket_default; + ntype->draw_output = node_draw_socket_default; ntype->resize_area_func = node_resize_area_default; node_common_set_butfunc(ntype); @@ -2795,8 +2789,8 @@ /* default ui functions */ ntype->draw_nodetype = node_draw_default; ntype->draw_nodetype_prepare = node_update_default; - ntype->draw_input = node_draw_input_default; - ntype->draw_output = node_draw_output_default; + ntype->draw_input = node_draw_socket_default; + ntype->draw_output = node_draw_socket_default; ntype->resize_area_func = node_resize_area_default; ntype->select_area_func = node_select_area_default; ntype->tweak_area_func = node_tweak_area_default; @@ -2840,7 +2834,7 @@ int type = sock->typeinfo->type; /*int subtype = sock->typeinfo->subtype;*/ - if ((sock->flag & SOCK_IN_USE) || (sock->flag & SOCK_HIDE_VALUE)) { + if ((sock->in_out == SOCK_OUT) || (sock->flag & SOCK_IN_USE) || (sock->flag & SOCK_HIDE_VALUE)) { node_socket_button_label(C, layout, ptr, node_ptr, text); return; } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs