Parcourir la source

small edits after the previous patch

this is basically just formatting
and it is only necessary because the contributor was following my example
and Mantis had some confusing variable names at the time the fork was made
etc etc

anyhow really great contribution and very much appreciated
Joseph Brandenburg il y a 3 mois
Parent
commit
81cbd7f96f
3 fichiers modifiés avec 19 ajouts et 25 suppressions
  1. 1 1
      __init__.py
  2. 17 20
      link_nodes_ui.py
  3. 1 4
      link_socket_templates.py

+ 1 - 1
__init__.py

@@ -95,6 +95,7 @@ link_transform_category = [
         NodeItem("LinkLimitRotation"),
         NodeItem("LinkLimitRotation"),
         NodeItem("LinkLimitDistance"),
         NodeItem("LinkLimitDistance"),
         NodeItem("LinkTransformation"),
         NodeItem("LinkTransformation"),
+        NodeItem("LinkGeometryAttribute"),
         NodeItem("LinkFloor"),
         NodeItem("LinkFloor"),
     ]
     ]
 link_tracking_category = [
 link_tracking_category = [
@@ -110,7 +111,6 @@ link_relationship_category = [
         NodeItem("linkInherit"),
         NodeItem("linkInherit"),
         NodeItem("LinkInheritConstraint"),
         NodeItem("LinkInheritConstraint"),
         NodeItem("LinkArmature"),
         NodeItem("LinkArmature"),
-        NodeItem("LinkGeometryAttribute"),
     ]
     ]
 deformer_category=[NodeItem(cls.bl_idname) for cls in deformer_nodes_ui.TellClasses()]
 deformer_category=[NodeItem(cls.bl_idname) for cls in deformer_nodes_ui.TellClasses()]
 xForm_category = [
 xForm_category = [

+ 17 - 20
link_nodes_ui.py

@@ -36,7 +36,7 @@ def TellClasses():
 
 
 from mathutils import Color # these colors were sampled from Blender's UI
 from mathutils import Color # these colors were sampled from Blender's UI
 # TODO: maybe read the relevant colors from the Theme
 # TODO: maybe read the relevant colors from the Theme
-linkColor = Color((0.028034, 0.093164, 0.070379)).from_scene_linear_to_srgb()
+linkTransformColor = Color((0.028034, 0.093164, 0.070379)).from_scene_linear_to_srgb()
 inheritColor = Color((0.083213, 0.131242, 0.116497)).from_scene_linear_to_srgb()
 inheritColor = Color((0.083213, 0.131242, 0.116497)).from_scene_linear_to_srgb()
 trackingColor = Color((0.033114, 0.049013, 0.131248)).from_scene_linear_to_srgb()
 trackingColor = Color((0.033114, 0.049013, 0.131248)).from_scene_linear_to_srgb()
 ikColor = Color((0.131117, 0.131248, 0.006971)).from_scene_linear_to_srgb()
 ikColor = Color((0.131117, 0.131248, 0.006971)).from_scene_linear_to_srgb()
@@ -117,7 +117,7 @@ class LinkCopyLocationNode(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkCopyLocationSockets)
         self.init_sockets(LinkCopyLocationSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
 
 
@@ -132,7 +132,7 @@ class LinkCopyRotationNode(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkCopyRotationSockets)
         self.init_sockets(LinkCopyRotationSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
 
 
@@ -148,7 +148,7 @@ class LinkCopyScaleNode(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkCopyScaleSockets)
         self.init_sockets(LinkCopyScaleSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
 
 
@@ -184,7 +184,7 @@ class LinkCopyTransformNode(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkCopyTransformsSockets)
         self.init_sockets(LinkCopyTransformsSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
 
 
@@ -257,7 +257,7 @@ class LinkLimitLocationNode(Node, LinkNode):
         self.init_sockets(LinkLimitLocationScaleSockets)
         self.init_sockets(LinkLimitLocationScaleSockets)
         self.initialized = True
         self.initialized = True
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
 
 
 class LinkLimitScaleNode(Node, LinkNode):
 class LinkLimitScaleNode(Node, LinkNode):
     '''A node representing Limit Scale'''
     '''A node representing Limit Scale'''
@@ -271,7 +271,7 @@ class LinkLimitScaleNode(Node, LinkNode):
         self.init_sockets(LinkLimitLocationScaleSockets)
         self.init_sockets(LinkLimitLocationScaleSockets)
         self.initialized = True
         self.initialized = True
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
 
 
 class LinkLimitRotationNode(Node, LinkNode):
 class LinkLimitRotationNode(Node, LinkNode):
     '''A node representing Limit Rotation'''
     '''A node representing Limit Rotation'''
@@ -286,7 +286,7 @@ class LinkLimitRotationNode(Node, LinkNode):
         self.initialized = True
         self.initialized = True
         # color
         # color
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
 
 
 class LinkLimitDistanceNode(Node, LinkNode):
 class LinkLimitDistanceNode(Node, LinkNode):
     '''A node representing Limit Distance'''
     '''A node representing Limit Distance'''
@@ -299,7 +299,7 @@ class LinkLimitDistanceNode(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkLimitDistanceSockets)
         self.init_sockets(LinkLimitDistanceSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
 
 
@@ -314,7 +314,7 @@ class LinkTransformationNode(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkTransformationSockets)
         self.init_sockets(LinkTransformationSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
     def display_update(self, parsed_tree, context):
     def display_update(self, parsed_tree, context):
@@ -388,7 +388,7 @@ class LinkFloorNode(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkFloorSockets)
         self.init_sockets(LinkFloorSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
 class LinkShrinkWrapNode(Node, LinkNode):
 class LinkShrinkWrapNode(Node, LinkNode):
@@ -446,19 +446,16 @@ class LinkGeometryAttribute(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkGeometryAttributeSockets)
         self.init_sockets(LinkGeometryAttributeSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = trackingColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
     def display_update(self, parsed_tree, context):
     def display_update(self, parsed_tree, context):
-        pass
-        # vast majority of the time user doesn't link this.
         data_type = self.inputs['Data Type'].default_value
         data_type = self.inputs['Data Type'].default_value
-        if self.inputs['Data Type'].is_linked:# 1% or less of cases
+        if self.inputs['Data Type'].is_linked:
             node_tree = context.space_data.path[0].node_tree
             node_tree = context.space_data.path[0].node_tree
-            nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
-            if nc:
-                data_type = nc.evaluate_input("Data Type")
-        not_matrix_mode = data_type != 'FLOAT4X4'
+            mantis_node = parsed_tree.get(get_signature_from_edited_tree(self, context))
+            if mantis_node: data_type = mantis_node.evaluate_input("Data Type")
+        not_matrix_mode = (data_type != 'FLOAT4X4')
         self.inputs['Enabled Location'].hide=not_matrix_mode
         self.inputs['Enabled Location'].hide=not_matrix_mode
         self.inputs['Enabled Rotation'].hide=not_matrix_mode
         self.inputs['Enabled Rotation'].hide=not_matrix_mode
         self.inputs['Enabled Scale'].hide=not_matrix_mode
         self.inputs['Enabled Scale'].hide=not_matrix_mode
@@ -475,7 +472,7 @@ class LinkDrivenParameterNode(Node, LinkNode):
     def init(self, context):
     def init(self, context):
         self.init_sockets(LinkDrivenParameterSockets)
         self.init_sockets(LinkDrivenParameterSockets)
         self.use_custom_color = True
         self.use_custom_color = True
-        self.color = linkColor
+        self.color = linkTransformColor
         self.initialized = True
         self.initialized = True
 
 
 # Set up the class property that ties the UI classes to the Mantis classes.
 # Set up the class property that ties the UI classes to the Mantis classes.

+ 1 - 4
link_socket_templates.py

@@ -465,10 +465,7 @@ LinkShrinkWrapSockets = [
 
 
 LinkGeometryAttributeSockets = [
 LinkGeometryAttributeSockets = [
     InputRelationshipTemplate,
     InputRelationshipTemplate,
-    TargetTemplate, # IMPORTANT TO DO: targets should be an array
-    # and the constraints are made  ONLY if the target is valid...
-    # for BONE targets, maybe auto-magically build a mesh for the user.
-    # this is a little bit too hard to do for now. Users can just make a schema.
+    TargetTemplate,
     OffsetTargetTransformTemplate:= SockTemplate(name="Offset target transform", is_input=True,
     OffsetTargetTransformTemplate:= SockTemplate(name="Offset target transform", is_input=True,
             bl_idname="BooleanSocket", blender_property='apply_target_transform'),
             bl_idname="BooleanSocket", blender_property='apply_target_transform'),
     AttributeTemplate:= SockTemplate(name="Attribute", bl_idname="ParameterStringSocket", is_input=True,
     AttributeTemplate:= SockTemplate(name="Attribute", bl_idname="ParameterStringSocket", is_input=True,