UI upgrade - compact nodes.
Created by: ly29
It has become more and more annoying that our nodes are large and behave in a non standard way when it comes to show socket info. Now I found a way to expose our properties like a standard blender node does without making a big class system.
What is needed for the Radius property in Circle node:
rad_ = bpy.props.FloatProperty(name = 'Radius', description='Radius', default=1.0, options={'ANIMATABLE'}, update=updateNode)
def init(self, context):
self.inputs.new('StringsSocket', "Radius").prop_name='rad_'
This also means we don't have set anything for Radius in draw_buttons
def draw_buttons(self, context, layout):
layout.prop(self,"mode_", text="Mode")
New code in node_s
class StringsSocket(NodeSocketStandard):
'''String any type - one string'''
bl_idname = "StringsSocket"
bl_label = "Strings Socket"
prop_name = StringProperty(default='')
def draw(self, context, layout, node, text):
if not self.is_output and not self.is_linked and self.prop_name:
layout.prop(node,self.prop_name)
elif self.is_linked:
layout.label(text + '. ' + SvGetSocketInfo(self))
else:
layout.label(text)
def draw_color(self, context, node):
return(0.6,1.0,0.6,1.0)
Issues
- Doesn't work with º characters for some reason.
- If you specify ANGLE option you get value in radians, test while converting nodes.
I want to do some more testing before we commit this and start upgrading nodes.
Comments?