WIP: MaterialX addon #104594
@ -133,6 +133,8 @@ def generate_property_code(mx_param, category):
|
||||
if mx_type == 'filename' and category in ("texture2d", "texture3d"):
|
||||
prop_attr_strings.insert(0, "type=bpy.types.Image")
|
||||
|
||||
prop_attr_strings.append('update=MxNode.update_prop')
|
||||
|
||||
return f"{prop_type}({', '.join(prop_attr_strings)})"
|
||||
|
||||
|
||||
|
@ -78,6 +78,9 @@ class MxNode(bpy.types.ShaderNode):
|
||||
_ui_folders = () # list of ui folders mentioned in nodedef
|
||||
category = ""
|
||||
|
||||
def update_prop(self, context):
|
||||
self.socket_value_update(context)
|
||||
|
||||
@classmethod
|
||||
def get_nodedef(cls, data_type):
|
||||
if not cls._data_types[data_type]['nd']:
|
||||
@ -120,6 +123,7 @@ class MxNode(bpy.types.ShaderNode):
|
||||
|
||||
def update(self):
|
||||
bpy.app.timers.register(self.mark_invalid_links)
|
||||
self.socket_value_update(bpy.context)
|
||||
|
||||
def mark_invalid_links(self):
|
||||
if not is_mx_node_valid(self):
|
||||
@ -150,6 +154,8 @@ class MxNode(bpy.types.ShaderNode):
|
||||
for i, nd_output in enumerate(nodedef.getActiveOutputs()):
|
||||
self.outputs[i].name = nd_output.getName()
|
||||
|
||||
self.update_prop(context)
|
||||
|
||||
def init(self, context):
|
||||
nodedef = self.nodedef
|
||||
|
||||
@ -368,6 +374,9 @@ class MxNode(bpy.types.ShaderNode):
|
||||
if f:
|
||||
self.inputs[i].hide = not getattr(self, self._folder_prop_name(f))
|
||||
|
||||
if context:
|
||||
self.update_prop(context)
|
||||
|
||||
def check_ui_folders(self):
|
||||
if not self._ui_folders:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user