[Bf-committers] Small pynodes API change (after 2.67 release)

Lukas Tönne lukas.toenne at gmail.com
Wed May 8 18:13:16 CEST 2013


Note: r56584 and r56585 add two changes to socket draw functions:

* For hiding the socket input value you now need to check the connection
state inside the draw function. This provides some flexibility for
displaying other buttons for connected sockets as well if needed.

* Socket draw function now takes an explicit "text" parameter (usually the
socket name), which allows drawing just the socket value in specific cases
(e.g. node view template).

For post-2.67 versions (!) change your socket draw callbacks like this:

= old =
class MySocket(bpy.types.NodeSocket):
    def draw(self, context, layout, node):
        layout.prop(self, "my_input_value", text=self.name)

= new =
class MySocket(bpy.types.NodeSocket):
    def draw(self, context, layout, node, text):
        if self.is_linked:
            layout.label(text)
        else:
            layout.prop(self, "my_input_value", text=text)


More information about the Bf-committers mailing list