BlockCanvas: Implement drag & drop the node's property from Inspector#296
BlockCanvas: Implement drag & drop the node's property from Inspector#296
Conversation
a529d11 to
00d4842
Compare
|
Here is the demo of how to drag & drop the node's property from Inspector |
| . new( | ||
| &"%s_get_%s" % [obj_name, prop_name], | ||
| obj_name, | ||
| "The %s property" % prop_name, |
There was a problem hiding this comment.
BTW a few weeks ago I looked into whether it was possible to look up the documentation for a property from a gdscript addon. Sadly, it's not.
| var block_definition = ( | ||
| BlockDefinition | ||
| . new( | ||
| &"%s_get_%s" % [obj_name, prop_name], |
There was a problem hiding this comment.
I loosely remember Orchestrator (or was Godot 3 visual scripting?) using a modifier key while dropping to generate a setter. I don't remember if Shift or Ctrl.
There was a problem hiding this comment.
Maybe we could add the property get & setter to the Variables section of the picker when it has been dragged from the inspector?
There was a problem hiding this comment.
Maybe we could add the property get & setter to the Variables section of the picker when it has been dragged from the inspector?
This is worth a new feature ticket.
There was a problem hiding this comment.
Both:
I loosely remember Orchestrator (or was Godot 3 visual scripting?) using a modifier key while dropping to generate a setter. I don't remember if Shift or Ctrl.
and
Maybe we could add the property get & setter to the Variables section of the picker when it has been dragged from the inspector?
acknowledge #296 (comment)!
There was a problem hiding this comment.
After think twice, using a modifier key while dropping to generate a setter mentioned in #296 (comment) is a good, simple and quick implementation for now.
00d4842 to
4f31622
Compare
|
Here is the demo including both set and get blocks of the property dragged from Inspector. |
manuq
left a comment
There was a problem hiding this comment.
Only a couple nits requested. I notice that the property names in the catalog have regressed, so I will open an issue and a separate PR for them. This follows what's in the catalog, so it's OK.
|
@starnight this is the regression I was talking about: #303 . It is explained in the issue. If you agree, please adjust this PR accordingly. |
Extract dropping nodes codes as function _drop_node from _drop_data, if the type is "nodes". So, other types such as "obj_property" can be added later. https://phabricator.endlessm.com/T35649
4f31622 to
3fb6ed1
Compare
Dragging the node's property from Inspector shows the object's type as "obj_property". So, allow the "obj_property" type in _can_drop_data() and handle it in _drop_data(). Then, implement getting the property's value as a Variable block with _drop_obj_property() in detail. https://phabricator.endlessm.com/T35649
… if CTRL is pressed Drag & drop the node's set property block from Inspector if the modifier key CTRL is pressed. To detect pressing CTRL key, hook the input event and set the _modifier_ctrl flag with the CTRL key's pressed state. If the _modifier_ctrl is true, then drop a set Variable block. Otherwise, it should be a get Variable block of the property. https://phabricator.endlessm.com/T35649
3fb6ed1 to
c6ef1c1
Compare
manuq
left a comment
There was a problem hiding this comment.
Looks good now! Please note that the Ctrl shortcut to obtain a setter is a bit hidden.
Add how to drag & drop node's property as getter & setter blocks from the Inspector dock. This follows #296.
Add how to drag & drop node's property as getter & setter blocks from the Inspector dock. This follows #296. https://phabricator.endlessm.com/T35649
Dragging the node's property from Inspector shows the object's type as "obj_property". So, allow the "obj_property" type in _can_drop_data() and handle it in _drop_data(). Then, implement getting the property's value as a Variable block with _drop_obj_property() in detail.
And, if the modifier CTRL key is pressed, then drop a setting the property's value block.
https://phabricator.endlessm.com/T35649