I add a bool property in inputs node#99
Conversation
Whether the object is created at the world origin,at the cursor by default.
Whether the object is created at the world origin,at the cursor by default.
aachman98
left a comment
There was a problem hiding this comment.
Instead of adding the same property in all the child classes, you can add it once in the parent class "ScInputNode" (see .../sorcar/nodes/_base/node_input.py)
Since this affects all the input nodes, add the socket in pre_execute() method of the parent class as well.
I have no idea in pre_execute()
HuiProject
left a comment
There was a problem hiding this comment.
I have no idea in pre_execute() in thit night
version3 Meybe I got it!
|
|
||
| class ScInputNode(ScNode): | ||
| in_name: StringProperty(default="Object", update=ScNode.update_value) | ||
| in_WorldOrigin: BoolProperty(default=False, update=ScNode.update_value) |
There was a problem hiding this comment.
in_world_origin
(Just for consistency in variable names)
| self.node_executable = True | ||
| super().init(context) | ||
| self.inputs.new("ScNodeSocketString", "Name").init("in_name") | ||
| self.inputs.new("ScNodeSocketBool", "World Origin").init("in_WorldOrigin",True) |
There was a problem hiding this comment.
Keep this property hidden by default because each input node has its own set of sockets visible by default (just to slightly increase UX)
|
Just a general remark. For such parameters, I'd suggest to use EnumProperty instead of BoolProperty, just for better UX. If you do this as a checkbox / toggle button named "Create blablabla", it will not be obvious to user what will it do if the checkbox is disabled. With EnumProperty, you can create a property named "Create object" with two possible values: "at origin", "at cursor". |
yeah,I‘m learning dynamic enum property |
|
This won’t require dynamic EnumProperty though. We only need 2 options in the drop down at the moment. It will also be easier to add more later. |
|
@portnov Or name can be more clear like |

Whether the object is created at the world origin,at the cursor by default.