Easy VisualScriptPropertySelector Plugins
Describe the project you are working on
General Visual Script improvements
Describe the problem or limitation you are having in your project
There is no easy way to try to improve VisualScriptPropertySelector. (It is like fuzzy finder or the autocomplete feature for VisualScript) The current one is designed so beginners cant make mistakes. This leads to frustrations for advanced users and users coming from GdScript where that was never a consideration.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Create an EditorVisualScriptPropertySelectorPlugin class including multiple subclasses for the different stages.
- GuessDataOrSequence # It seems obvious but here also there are improvements possible.
- GuessPropertyInfo # needs the VisualScript and current dragging port For example to accurately guess that multiplying int and Vector3 results in Vector3. You need to know the output data of a and b input connections. (the math node itself changes to the last connected type)
- GuessFilters # By default .vs provides functions from base classes while for example, InputEvent will definitely need all the functions of the inherited classes
- CreateVSitem # To continue on InputEvent It will need to drop 2 nodes Typecast and the function.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
No real design is done check feature steps
If this enhancement will not be used often, can it be worked around with a few lines of script?
There is no workaround.
Is there a reason why this should be core and not an add-on in the asset library?
It is to make workarounds and assets easier.
FYI Today I was experimenting with current plugin/tool options using GDScript. So this code lets me find what ports data and sequence are coming from.
func get_sequence_connection_list(visual_script:VisualScript, function:String) -> Array:
var r = []
for f in visual_script.data.functions:
if f.name == function:
r = f.sequence_connections
return r
func get_data_connection_list(visual_script:VisualScript, function:String) -> Array:
var r = []
for f in visual_script.data.functions:
if f.name == function:
r = f.data_connections
return r
func connection_list_to_list_of_connections(connections:Array) -> Array:
# connections [start_node,start_idx, end_node,end_idx]
var r := []
var i := 0
while i < connections.size():
r.push_front(connections.slice(i, i+ 3))
i+=4
return r
func get_connection_sources(list_of_connections:Array, node_id:int, port_id:int) -> Array:
var r := []
for connection in list_of_connections:
if connection[2] == node_id and connection[3] == port_id:
r.append([connection[0], connection[1]])
return r
func get_connection_destinations(list_of_connections:Array, node_id:int, port_id:int) -> Array:
var r := []
for connection in list_of_connections:
if connection[0] == node_id and connection[1] == port_id:
r.append([connection[2], connection[3]])
return r
I did not find a way to get the port data. We will need to expose Dictionary get_output_value_port_info(idx) to VisualScriptNode for this. That node we can get var vsn :VisualScriptNode =get_visual_script().get_node("_ready", 7)