godotengine / godot-visual-script

VisualScript as a Godot Engine c++ module
MIT License
121 stars 29 forks source link

setters and getters for visual script #39

Open kubecz3k opened 5 years ago

kubecz3k commented 5 years ago

Godot version: 3.1.1

OS/device including version: Ubuntu 18.04

Issue description: It would be nice to have ability to use setters and getters in visual script. My use case: I'm working in a team with an artist that's slowly increasing it's capabilities in using Godot as an editor. The main tool this artist is currently using to create some small 'custom logics' is actually an AnimationPlayer. In some scenes I'm giving simple way to run some logic from AnimationPlayer by changing variable value in inspector (for example, export var up_position:bool value of elevator). Recently I wanted to introduce this artist to VisualScript, for the start to give her ability to create functions that are calling different animations from models she is providing... It was quite natural for her that she would like to expose such 'animation' to the inspector so she could use it from AnimationPlayer that's in parent scene

kubecz3k commented 5 years ago

cc @swarnimarun

fire commented 5 years ago

This is a work in progress for the next version, but is this what you mean?

Screen Shot 2019-07-18 at 11 46 33 PM

kubecz3k commented 5 years ago

Not exactly, this feature request was for visual script equivalent of setget keyword. So in this case there is one custom variable ball_dir. I would like to have ability to link it to 'set' and 'get' functions that would be called when variable value is changed from outside of this class.

swarnimarun commented 5 years ago

@kubecz3k I had gotten it working on my local branch, still haven't created the PR focusing on other tasks at the moment but I will push the changes soon enough... :)

kubecz3k commented 5 years ago

very cool, thank you!