New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Parent Relative" option to location nodes #2242
Conversation
@@ -10,5 +17,6 @@ class GetLocationNode(ArmLogicTreeNode): | |||
def init(self, context): | |||
super(GetLocationNode, self).init(context) | |||
self.add_input('ArmNodeSocketObject', 'Object') | |||
self.add_input('NodeSocketBool', 'Parent Relative') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, nice work! I think you might need to add a node replacement routine so that this input is automatically added to older nodes. The same holds for the other changed nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, i didn't know about that! Any example of how to do so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can probably just use this:
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.arm_version not in (0, 1):
raise LookupError()
return NodeReplacement.Identity(self)
This will update the node but keep all socket connections the same as there is only a new socket but nothing else has changed. Don't forget to also increment the arm_version
attribute of the node.
You can try the changes by creating a file without the changes in this PR, then apply the changes again and then you can execute the "Replace Nodes" operator in the F3 search menu to test if the replacement works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Thanks. Also fixed many typos i left and removed the subtract option i've added. Now the World Vec To Local node works as it should by default to avoid confusion. I didn't incremented its arm version because it is more a bug fix, but if you think i should increment then no problem :)
Also i've concluded that i could remove the input length verification from the nodes. Any case you can tell me what is better to do!
Proposal fix for #2241