diff --git a/about/list_of_features.rst b/about/list_of_features.rst index 364d74959b00..321ea47fe64a 100644 --- a/about/list_of_features.rst +++ b/about/list_of_features.rst @@ -413,12 +413,6 @@ Scripting - Supports all platforms. - Using an external editor is recommended to benefit from IDE functionality. -:ref:`VisualScript: ` - -- :ref:`Graph-based visual scripting language `. -- Works best when used for specific purposes (such as level-specific logic) - rather than as a language to create entire projects. - **GDNative (C, C++, Rust, D, ...):** - When you need it, link to native libraries for higher performance and third-party integrations. diff --git a/community/contributing/bug_triage_guidelines.rst b/community/contributing/bug_triage_guidelines.rst index 48c0c1803b3f..57ed5094761f 100644 --- a/community/contributing/bug_triage_guidelines.rst +++ b/community/contributing/bug_triage_guidelines.rst @@ -129,7 +129,6 @@ feature request, or one that is not precise enough to be worked on. - *Shaders*: relates to the Godot shader language or visual shaders. - *Tests*: relates to unit tests. - *Thirdparty*: relates to third-party libraries used in Godot. -- *VisualScript*: relates to issues with the visual scripting language (*not* visual shaders). - *XR*: relates to Augmented Reality or Virtual Reality. Issues would typically correspond to only one topic, though it's not diff --git a/tutorials/scripting/index.rst b/tutorials/scripting/index.rst index be2a5e3e29a5..dda8f05216c4 100644 --- a/tutorials/scripting/index.rst +++ b/tutorials/scripting/index.rst @@ -19,7 +19,6 @@ case, an interface that works with multiple languages. :name: toc-learn-scripting gdscript/index - visual_script/index c_sharp/index gdnative/index diff --git a/tutorials/scripting/visual_script/custom_visualscript_nodes.rst b/tutorials/scripting/visual_script/custom_visualscript_nodes.rst deleted file mode 100644 index 668bdd45574c..000000000000 --- a/tutorials/scripting/visual_script/custom_visualscript_nodes.rst +++ /dev/null @@ -1,102 +0,0 @@ -.. _doc_custom_visualscript_nodes: - -Custom VisualScript nodes -========================= - -Custom nodes are written in GDScript and can then be used in VisualScript. -This is useful for offloading complex code to GDScript and reusing it. - -Creating a custom node ----------------------- - -Create a new script that extends :ref:`class_VisualScriptCustomNode` and put a ``tool`` keyword at the top. This is needed for the script to run in the editor. - -There are some functions that can be implemented to set parameters of the custom node. -Only add functions that are needed, a ``_has_input_sequence_port`` function is not necessary if it should return ``false`` for example. - -The most important part of a custom node is the ``_step`` function. The logic of the node is defined there. - -The ``inputs`` parameter holds the value of the input ports. - -The ``outputs`` parameter is an array where the indices represent the output port ids. It can be modified to set the values of the output ports. - -``start_mode`` can be checked to see if it is the first time ``_step`` is called. - -``working_mem`` is persistent each ``_step`` call. It can be used to store information. - -If you want to throw an error, for example if the input types are incorrect, you can return the error message as a string. -When everything goes right, return the id of the sequence port which should be called next. If your custom node doesn't have any, just return 0. - - -Example: - -:: - - tool - extends VisualScriptCustomNode - - # The name of the custom node as it appears in the search. - func _get_caption(): - return "Get Input Direction 2D" - - func _get_category(): - return "Input" - - # The text displayed after the input port / sequence arrow. - func _get_text(): - return "" - - func _get_input_value_port_count(): - return 0 - - # The types of the inputs per index starting from 0. - func _get_input_value_port_type(idx): - return TYPE_OBJECT - - func _get_output_value_port_count(): - return 1 - - # The types of outputs per index starting from 0. - func _get_output_value_port_type(idx): - return TYPE_VECTOR2 - - # The text displayed before each output node per index. - func _get_output_value_port_name(idx): - return "Direction" - - func _has_input_sequence_port(): - return true - - # The number of output sequence ports to use - # (has to be at least one if you have an input sequence port). - func _get_output_sequence_port_count(): - return 1 - - func _step(inputs, outputs, start_mode, working_mem): - # start_mode can be checked to see if it is the first time _step is called. - # This is useful if you only want to do an operation once. - - # working_memory is persistent between _step calls. - - # The inputs array contains the value of the input ports. - - var x = int(Input.is_action_pressed("ui_right")) - int(Input.is_action_pressed("ui_left")) - var y = int(Input.is_action_pressed("ui_down")) - int(Input.is_action_pressed("ui_up")) - - # The outputs array is used to set the data of the output ports. - - outputs[0] = Vector2(x, y) - - # Return the error string if an error occurred, else the id of the next sequence port. - return 0 - -Using a custom node -------------------- - -To use the script, add a ``CustomNode``, select it and drag your custom node script into the ``script`` property shown in the inspector. - -.. image:: img/visual_script_custom_node_set_script.png - -Result: - -.. image:: img/visual_script_custom_node_result.png diff --git a/tutorials/scripting/visual_script/getting_started.rst b/tutorials/scripting/visual_script/getting_started.rst deleted file mode 100644 index 93b23e89375f..000000000000 --- a/tutorials/scripting/visual_script/getting_started.rst +++ /dev/null @@ -1,131 +0,0 @@ -.. _doc_getting_started_visual_script: - -Getting started with Visual Scripting -===================================== - -As with everything in Godot, we prioritize a good experience over copying or integrating third party solutions -which might not fit nicely in the current workflow. This led us to write our own version of how we believe -this feature would work best with the engine. - -In Godot, a Visual Script fits smoothly together with regular scripts in the Editor tab - -.. image:: img/visual_script1.png - - -In fact, Visual Scripting integrates so well to Godot that it's hard to believe it was added only -in version 3.0. This is because, when editing, the rest of Godot panels and docks act like a -palette from where you can drag and drop all sorts of information to the script canvas: - -.. image:: img/visual_script2.png - - -Creating a script ------------------ - -Creating scripts works the same as with other scripting languages: Select any node in the scene -and push the "New Script" button at the top right corner of the Scene Tree dock: - -.. image:: img/visual_script3.png - - -Once it opens, the script type "Visual Script" must be selected from the drop down list. The script extension -must be ".vs" (for Visual Script!). - -.. image:: img/visual_script4.png - - -Finally, the Script Editor will open, allowing you to start editing the visual script: - -.. image:: img/visual_script5.png - - -Adding a function ------------------ - -Unlike other visual scripting implementations, Visual Scripting in Godot is heavily based on functions. -This happens because it uses the same interface to communicate with the engine as other scripting engines. -In Godot, the scripting interface is universal and all implementations conform to it. - -A function is an individual canvas with nodes connected. - -A single script can contain many functions, each of which will have a canvas of its own, allowing for more organization. - -There are three main ways to add functions in a script: - -Overriding a virtual function -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Most types of nodes and other types of objects in Godot contain virtual functions. These are functions that -will be called (run your code) when something happens and can be looked up in the reference. Virtual functions -are listed when pressing the "Override" icon in the member panel: - -.. image:: img/visual_script6.png - - -In the following example, a function will be executed when the node is loaded and added to the running scene. -For this, the _ready() virtual method will be overridden: - -.. image:: img/visual_script7.png - - -Finally, a canvas appears for this function, showing the override: - -.. image:: img/visual_script8.png - - -As some functions expect you to return a value, they will also add a return node where such value is supposed to be -provided: - -.. image:: img/visual_script9.png - - -Connecting a signal to a function -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Nodes in a tree emit signals when something happens. Godot uses signals for all sorts of things. -A typical example would be a button that emits a "pressed" signal when actually pressed. - -For this, a node must be selected and the Node tab opened. This will allow inspecting the signals. -Once they are displayed, connect the "pressed" signal: - -.. image:: img/visual_script10.png - - -This will open the connection dialog. In this dialog, you must select the node where the signal will be -connected to, and the function that will receive the signal: - -.. image:: img/visual_script11.png - - -If this is done right, a new function will be created in our script and a signal will automatically be -connected to it: - -.. image:: img/visual_script12.png - - -Creating a function manually -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The last way to create functions is to do it manually. In general, this is not as common unless you -really need it. Custom functions work when another (or the same) script calls them manually. -The main use cases for this are breaking a larger function up into several manageable chunks and reusing your visual code. - -To create a function manually, push the big "Plus" button, and a new function will be added -with a default name: - -.. image:: img/visual_script13.png - - -This will add a new function, which can be renamed by simply double clicking its name: - - -.. image:: img/visual_script14.png - - -To edit the "arguments" this function can get (the values you pass to it when you call this function), -simply click the Function node and check the inspector: - -.. image:: img/visual_script15.png - - -More on that will be explained later in this document. diff --git a/tutorials/scripting/visual_script/img/visual_script1.png b/tutorials/scripting/visual_script/img/visual_script1.png deleted file mode 100644 index 148f1ff36152..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script1.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script10.png b/tutorials/scripting/visual_script/img/visual_script10.png deleted file mode 100644 index 13ef5003d244..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script10.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script11.png b/tutorials/scripting/visual_script/img/visual_script11.png deleted file mode 100644 index c8c25b390028..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script11.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script12.png b/tutorials/scripting/visual_script/img/visual_script12.png deleted file mode 100644 index 13dc25b9b750..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script12.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script13.png b/tutorials/scripting/visual_script/img/visual_script13.png deleted file mode 100644 index fadbc7febb81..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script13.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script14.png b/tutorials/scripting/visual_script/img/visual_script14.png deleted file mode 100644 index cfcd3ced802f..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script14.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script15.png b/tutorials/scripting/visual_script/img/visual_script15.png deleted file mode 100644 index d2e913c43bf6..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script15.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script16.png b/tutorials/scripting/visual_script/img/visual_script16.png deleted file mode 100644 index 530dd97c094c..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script16.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script17.png b/tutorials/scripting/visual_script/img/visual_script17.png deleted file mode 100644 index 94ebc3dc1cfa..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script17.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script18.png b/tutorials/scripting/visual_script/img/visual_script18.png deleted file mode 100644 index 071f33174815..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script18.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script19.png b/tutorials/scripting/visual_script/img/visual_script19.png deleted file mode 100644 index 327d23d425ec..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script19.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script2.png b/tutorials/scripting/visual_script/img/visual_script2.png deleted file mode 100644 index 839eedae5a06..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script2.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script20.png b/tutorials/scripting/visual_script/img/visual_script20.png deleted file mode 100644 index a4e9ede70183..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script20.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script21.png b/tutorials/scripting/visual_script/img/visual_script21.png deleted file mode 100644 index 766aab728972..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script21.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script22.png b/tutorials/scripting/visual_script/img/visual_script22.png deleted file mode 100644 index 31e701785edf..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script22.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script23.png b/tutorials/scripting/visual_script/img/visual_script23.png deleted file mode 100644 index d1b3d45cef62..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script23.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script24.png b/tutorials/scripting/visual_script/img/visual_script24.png deleted file mode 100644 index 294b81fc32de..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script24.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script25.png b/tutorials/scripting/visual_script/img/visual_script25.png deleted file mode 100644 index 3c7113bd971c..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script25.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script26.png b/tutorials/scripting/visual_script/img/visual_script26.png deleted file mode 100644 index 64474777a1bb..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script26.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script27.png b/tutorials/scripting/visual_script/img/visual_script27.png deleted file mode 100644 index c4c53808a8e8..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script27.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script28.png b/tutorials/scripting/visual_script/img/visual_script28.png deleted file mode 100644 index e076ac0efff8..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script28.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script29.png b/tutorials/scripting/visual_script/img/visual_script29.png deleted file mode 100644 index 829a9c10e412..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script29.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script3.png b/tutorials/scripting/visual_script/img/visual_script3.png deleted file mode 100644 index d455ae5326c7..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script3.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script30.png b/tutorials/scripting/visual_script/img/visual_script30.png deleted file mode 100644 index 35496ae0210f..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script30.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script31.png b/tutorials/scripting/visual_script/img/visual_script31.png deleted file mode 100644 index 79390ffd81e6..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script31.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script32.png b/tutorials/scripting/visual_script/img/visual_script32.png deleted file mode 100644 index fadc069b1d2a..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script32.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script33.png b/tutorials/scripting/visual_script/img/visual_script33.png deleted file mode 100644 index 1e0c69d276c4..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script33.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script34.png b/tutorials/scripting/visual_script/img/visual_script34.png deleted file mode 100644 index afab3f08c540..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script34.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script36.png b/tutorials/scripting/visual_script/img/visual_script36.png deleted file mode 100644 index dc6f62b317d1..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script36.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script37.png b/tutorials/scripting/visual_script/img/visual_script37.png deleted file mode 100644 index 491cdefa0d75..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script37.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script38.png b/tutorials/scripting/visual_script/img/visual_script38.png deleted file mode 100644 index d01bee9c66d7..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script38.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script39.png b/tutorials/scripting/visual_script/img/visual_script39.png deleted file mode 100644 index a7c0338f729e..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script39.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script4.png b/tutorials/scripting/visual_script/img/visual_script4.png deleted file mode 100644 index c69e80484cfe..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script4.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script40.png b/tutorials/scripting/visual_script/img/visual_script40.png deleted file mode 100644 index 60f4c7a3f270..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script40.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script41.png b/tutorials/scripting/visual_script/img/visual_script41.png deleted file mode 100644 index 646a1fdb6f62..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script41.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script42.png b/tutorials/scripting/visual_script/img/visual_script42.png deleted file mode 100644 index 468d38c6141f..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script42.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script43.png b/tutorials/scripting/visual_script/img/visual_script43.png deleted file mode 100644 index cbb841f3d976..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script43.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script44.png b/tutorials/scripting/visual_script/img/visual_script44.png deleted file mode 100644 index a43f56ce9ecf..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script44.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script45.png b/tutorials/scripting/visual_script/img/visual_script45.png deleted file mode 100644 index 803ea05e416c..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script45.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script46.png b/tutorials/scripting/visual_script/img/visual_script46.png deleted file mode 100644 index 4119a4eb1cd8..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script46.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script47.png b/tutorials/scripting/visual_script/img/visual_script47.png deleted file mode 100644 index 36c8872b07ba..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script47.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script48.png b/tutorials/scripting/visual_script/img/visual_script48.png deleted file mode 100644 index 95e1328ba40e..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script48.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script49.png b/tutorials/scripting/visual_script/img/visual_script49.png deleted file mode 100644 index 4b4d9efaff64..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script49.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script5.png b/tutorials/scripting/visual_script/img/visual_script5.png deleted file mode 100644 index b5f54aff860b..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script5.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script50.png b/tutorials/scripting/visual_script/img/visual_script50.png deleted file mode 100644 index 429a671d228a..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script50.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script51.png b/tutorials/scripting/visual_script/img/visual_script51.png deleted file mode 100644 index 69bec66eefe6..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script51.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script52.png b/tutorials/scripting/visual_script/img/visual_script52.png deleted file mode 100644 index 16e8b672cd0f..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script52.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script53.png b/tutorials/scripting/visual_script/img/visual_script53.png deleted file mode 100644 index cd89c183c10a..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script53.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script54.png b/tutorials/scripting/visual_script/img/visual_script54.png deleted file mode 100644 index aff1b162de9a..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script54.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script55.png b/tutorials/scripting/visual_script/img/visual_script55.png deleted file mode 100644 index bad944c9ba72..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script55.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script6.png b/tutorials/scripting/visual_script/img/visual_script6.png deleted file mode 100644 index e03d310579cc..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script6.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script7.png b/tutorials/scripting/visual_script/img/visual_script7.png deleted file mode 100644 index 67425f9d7f29..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script7.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script8.png b/tutorials/scripting/visual_script/img/visual_script8.png deleted file mode 100644 index c0a0e7d9e9c2..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script8.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script9.png b/tutorials/scripting/visual_script/img/visual_script9.png deleted file mode 100644 index 142e15efd3e4..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script9.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script_connect.gif b/tutorials/scripting/visual_script/img/visual_script_connect.gif deleted file mode 100644 index 2dff93eefcf3..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script_connect.gif and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script_custom_node_result.png b/tutorials/scripting/visual_script/img/visual_script_custom_node_result.png deleted file mode 100644 index 9b8003527236..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script_custom_node_result.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script_custom_node_set_script.png b/tutorials/scripting/visual_script/img/visual_script_custom_node_set_script.png deleted file mode 100644 index 97d4700a05d9..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script_custom_node_set_script.png and /dev/null differ diff --git a/tutorials/scripting/visual_script/img/visual_script_disconnect.gif b/tutorials/scripting/visual_script/img/visual_script_disconnect.gif deleted file mode 100644 index 08f9e799f897..000000000000 Binary files a/tutorials/scripting/visual_script/img/visual_script_disconnect.gif and /dev/null differ diff --git a/tutorials/scripting/visual_script/index.rst b/tutorials/scripting/visual_script/index.rst deleted file mode 100644 index 86e0f926aff3..000000000000 --- a/tutorials/scripting/visual_script/index.rst +++ /dev/null @@ -1,11 +0,0 @@ -VisualScript -============ - -.. toctree:: - :maxdepth: 3 - :name: toc-learn-scripting-visual_script - - what_is_visual_scripting - getting_started - nodes_purposes - custom_visualscript_nodes diff --git a/tutorials/scripting/visual_script/nodes_purposes.rst b/tutorials/scripting/visual_script/nodes_purposes.rst deleted file mode 100644 index a4f6d59abbee..000000000000 --- a/tutorials/scripting/visual_script/nodes_purposes.rst +++ /dev/null @@ -1,510 +0,0 @@ -.. _doc_nodes_purposes_visual_script: - -Nodes and terminology -===================== - -Before continuing, it must be noted that the *Node* terminology needs to be used with care. -When referring to *Visual Script Nodes* (or generally *Nodes*) this text will refer to the little boxes you connect with lines, which are part of a graph. -When referring to *Scene Nodes*, it is implied that the elements that make up a Scene are being referred, which are part of a tree. Their naming is similar but their function is different. -When referring to *Node* here, it will be implied that a *Visual Script Node* is referred to unless indicated otherwise. - -.. image:: img/visual_script16.png - - -Node properties ---------------- - -Like in most visual scripting implementations, each node has editable properties. In Godot, though, we try to avoid -bloating the nodes with editable controls for the sake of readability. - -Nodes still display the required information as text, but editing is done via the *Inspector*. To edit them, -select any node and edit its properties in the *Inspector*. - - -Ports and connections ---------------------- - -Programming in Godot Visual Scripting is done via *Nodes* and *Port Connections* inside each function. - - -Ports -~~~~~ - -Nodes in Godot Visual Scripting have *Ports*. These are endpoints that appear to the -left and right of nodes and which can be used to make *Connections*: -There are two types of *Ports*: *Sequence* and *Data*. - -.. image:: img/visual_script17.png - - -*Sequence Ports* indicate the order in which operations are executed. -Typically when a *Node* is done processing, it will go to the next node from one of the ports at the right. -If nothing is connected, the function may end, or another output *Sequence Port* might be tried (this depends on the node). -Thanks to this, you can follow the logic flow within a function by following the white lines. -Not every *Node* has *Sequence Ports*. In fact, most do not. - -*Data Ports* ports contain typed values. Types can be any regular Godot types, -such as a boolean, an integer, a string, a Vector3, an array, any Object or Scene Node, etc. -A *Data Port* on the right side of a node is considered an output, while, -a port on the left side is an input. Connecting them allows information to flow to the next node. - -Not all *Data Port* types are compatible and will allow connections, though. -Pay special attention to colors and icons, as each type has a different representation: - -.. image:: img/visual_script18.png - - -Connections -~~~~~~~~~~~ - -To make a connection, drag an *Output Port* towards an *Input Port*. - -.. image:: img/visual_script_connect.gif - - -Disconnecting takes a bit more practice. Disconnecting in *Data Ports* happens by -dragging the *Input* away, while for *Sequence Ports*, this happens by dragging the *Output* away. - -.. image:: img/visual_script_disconnect.gif - - -This may seem strange at first, but it happens because *Data Ports* are 1:N -(A single output port can connect to many inputs), while *Sequence Ports* are N:1 -(Many sequence outputs can be connected to a single input). - -Connecting to empty space (drag to connect but unpress over empty space) is also context sensitive, it will supply -a list of most common operations. For sequences, it will be conditional nodes: - -.. image:: img/visual_script52.png - - -While, for data, a contextual set/get/call menu will open: - -.. image:: img/visual_script53.png - - -Adding nodes ------------- - -Finally! We got to the fun part! But, before explaining in more detail what each type of node does, -let's take a short look at how nodes are most commonly added and dealt with. - - -Accessing scene nodes -~~~~~~~~~~~~~~~~~~~~~ - -One of the most common tasks is accessing Scene Tree Nodes (again, not to mistake with *Visual Script Nodes*). -Dragging from the Scene Tree and dropping into the canvas will ask you to *call a method* (sometimes referred to as *member function*) on this node. - -.. image:: img/visual_script19.png - - -While accessing properties is desired in most cases (more on that below), sometimes *calling methods* can be useful too. -Methods execute specific actions on objects. In the above case, the mouse pointer can be warped to a position in local -coordinates to the control. Another common use case is queueing a node for deletion, which is done with the *queue_free* method. - -.. image:: img/visual_script20.png - - -Care must be taken that this only works if the scene being edited contains your *Visual Script* in one of the nodes! Otherwise, a warning will be shown. - - -Accessing scene node properties -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This is the most common way to edit *Scene Nodes* in Visual Scripting. Select a *Scene Node* from the *Scene Tree*, go to the Inspector, find *the Name* of the property you want to edit (hint, *not* the value!) and drag it to the canvas: - -.. image:: img/visual_script21.png - - -The result is that this value can be changed from your script by writing to a *Data Port*. - -If instead reading this value is desired, drag the node again but hold :kbd:`Ctrl` (or :kbd:`Cmd` on macOS). This will create a getter: - -.. image:: img/visual_script22.png - - -In this case, the value can be read from a *Data Port*. - - -Variables -~~~~~~~~~ - -Variables are memory containers local to the script which can hold a value. This value can be read from any of the functions of the script or from other scripts via the method described in the previous step. - -To add a Variable, push the "+" button on the *Variables* section of the Members panel. Double-click the new variable to rename it: - -.. image:: img/visual_script23.png - - -Right-clicking the variable allows you to configure its properties: - -.. image:: img/visual_script24.png - -.. image:: img/visual_script25.png - - -As it can be seen above, the type and initial value of the variable can be changed, as well as some property hints. -Ticking the "Export" option makes the variable visible in the Inspector when selecting the node. This also makes it available to other scripts via the method described in the previous step. - -.. image:: img/visual_script28.png - - -To use the variable in the script, simply drag it to the canvas to create a getter: - -.. image:: img/visual_script26.png - - -Likewise, hold :kbd:`Ctrl` (or :kbd:`Cmd` on macOS) to drop a setter: - -.. image:: img/visual_script27.png - - -Signals -~~~~~~~ - -It is also possible to create your own signals in a script and use them. For this, do the same steps you did for variables in the previous step, except for *Signals*: - -.. image:: img/visual_script29.png - - -A signal can also be edited via the right-click menu to customize its arguments: - -.. image:: img/visual_script30.png - - -The signal you have created will appear in the Inspector, along with the built-in node signals. This allows you to connect it from another script from another *Scene Node*: - -.. image:: img/visual_script31.png - - -Finally, to emit the signal, simply drag it to the canvas: - -.. image:: img/visual_script32.png - - -Remember that emitting a signal is a sequenced operation, so it must come from a Sequence port. - - -Adding more nodes ------------------ - -Now that the basics are covered, let's discuss the large amount of utility nodes available for your canvas! -Below the member panel, exists the list of all available node types: - -.. image:: img/visual_script33.png - - -Pressing :kbd:`Ctrl + F` (or :kbd:`Cmd + F` on macOS) allows you to search the list. - -Any of them can be dragged to the scene. Unlike nodes (e.g. dragging a property -from the Inspector sets the context to the node being edited automatically), these are added without any "contextual" information, so this has to be done manually. - -.. image:: img/visual_script34.png - - -Remember that you can check the class reference for what each node does, as they are documented there. That mentioned, -a brief overview of node types follows: - - -Constants -~~~~~~~~~ - -Constant nodes are nodes that provide values that, while not changing over time, can be useful as reference values. -Most of the time they are integer or float. - -.. image:: img/visual_script36.png - - -The first one is "Constant", which allows you to select any value of any type as constant, from an integer (42) to a String ("Hello!"). In general, this node is not used that often because of default input values in *Data Ports*, but it's good to know it exists. - -The second is the GlobalConstant node, which contains a long list of constants for global types in Godot. In there -you can find some useful constants to refer to key names, joystick or mouse buttons, etc. - -The third one is MathConstant, which provides typical mathematical constants, such as PI, E, etc. - - -Data -~~~~ - -Data nodes deal with all sorts of access to information. Any information in Godot is accessed via these nodes, so -they are some of the most important ones to use and pretty diverse. - -.. image:: img/visual_script37.png - - -There are many types of nodes of interest here, so a short attempt to describe them will follow: - - -Action -^^^^^^ - -Action nodes are vital when dealing with input from a device. You can read more about actions in the (@TODO ACTION TUTE LINK). -In the following example below, the control is moved to the right when the "move_right" action is pressed. - -.. image:: img/visual_script38.png - - -Engine Singleton -^^^^^^^^^^^^^^^^ - -Engine singletons are global interfaces (meaning they can be accessed without a reference; unlike Scene Nodes, they are always available). -They have several purposes, but in general, they are useful for low-level access or OS-related access. - -.. image:: img/visual_script39.png - - -Remember that dragging a connection to empty space will help you call functions or set/get properties on these: - -.. image:: img/visual_script40.png - - -Local Variables -^^^^^^^^^^^^^^^ - -These are nodes you can use as temporary storage for your graphs. Make sure they all have the same name and type when using them and they will reference the same piece of memory. - -.. image:: img/visual_script41.png - - -As you can see above, there are two nodes available: a simple getter, and a sequenced setter (setting requires a sequence port). - - -Scene Node -^^^^^^^^^^ - -This is just a reference to a node in the tree, but it's easier to use this node by dragging the actual node -from the scene tree to the canvas (this will create it and configure it). - - -Self -^^^^ - -In some rare occasions, it may be desired to pass this Scene Node as argument. -It can be used to call functions and set/get properties, or drag nodes (or event the node itself that has the script) from the Scene Tree to the canvas for this. - - -SceneTree -^^^^^^^^^ - -This node is similar to the Singleton node because it references the SceneTree, which contains the active scene. -SceneTree, however, only works when the node is sitting in the scene and active, otherwise accessing it will -return an error. - -SceneTree allows for many low-level things, like setting stretch options, calling groups, make timers, or even -load another scene. It's a good class to get familiar with. - - -Preload -^^^^^^^ - -This does the same function as preload() in GDScript. It maintains this resource loaded and ready to use. Rather than -instancing the node, it's simpler to drag the desired resource from the filesystem dock to the canvas. - - -Resource Path -^^^^^^^^^^^^^ - -This node is a helper to get a string with a path to a resource you can pick. It's useful in functions that -load things from disk. - - -Comment -^^^^^^^ - -A Comment node works as a node you can resize to put around other nodes. It will not try to get focus or be brought -to top when selecting it. It can also be used to write text on it. - -.. image:: img/visual_script42.png - - -Flow Control -~~~~~~~~~~~~ - -Flow control nodes allow the execution to take different branches, usually depending on a -given condition. - -.. image:: img/visual_script43.png - - -Condition -^^^^^^^^^ - -This is a node that checks a boolean port. If ``true``, it will go via the "true" sequence port. If ``false``, -the second. After going for either of them, it goes via the "done" port. Leaving sequence -ports disconnected is fine if not all of them are used. - - -Iterator -^^^^^^^^ - -Some data types in Godot (ie, arrays, dictionaries) are iterable. This means that a bit of code can run -for each element that it has. - -The Iterator node goes through all elements and, for each of them, it goes via the "each" sequence port, -making the element available in the "elem" data port. - -When done, it goes via the "exit" sequence port. - - -Return -^^^^^^ - -Some functions can return values. In general for virtual ones, Godot will add the Return node for you. -A return node forces the function to end. - - -Sequence -^^^^^^^^ - -This node is useful mostly for organizing your graph. It calls its sequence ports in order. - - -TypeCast -^^^^^^^^ - -This is a useful and commonly used node. You can use it to cast arguments or other objects -to the type you desire. Afterwards, you can even drag the object output to get full completion. - -.. image:: img/visual_script55.png - - -It is also possible to cast to a script, which will allow complete script properties and functions: - -.. image:: img/visual_script54.png - - -Switch -^^^^^^ - -The Switch node is similar to the Condition node, but it matches many values at the same time. - - -While -^^^^^ - -This is a more primitive form of iteration. "repeat" sequence output will be called as long as -the condition in the "cond" data port is met. - - -Functions -~~~~~~~~~ - -Functions are helpers, most of the time deterministic. They take some arguments as -input and return an output. They are almost never sequenced. - - -Built-In -^^^^^^^^ - -There is a list of built-in helpers. The list is almost identical to the one from :ref:`GDScript`. Most of them are mathematical functions, but others can be useful helpers. Make sure to take a look at the list -at some point. - -By Type -^^^^^^^ - -Those are the methods available to basic types. For example, if you want a dot-product, you can search for "dot" instead of the Vector3 category. -In most cases just search the list of nodes, it should be faster. - - -Call -^^^^ - -This is the generic calling node. It is rarely used directly but by dragging to empty space on an already configured node. - - -Constructors -^^^^^^^^^^^^ - -These are all the functions needed to create Godot basic datatypes. For example, If you need to create a Vector3 out of 3 floats, a constructor must be used. - -.. image:: img/visual_script44.png - - -Destructor -^^^^^^^^^^ - -This is the opposite to Constructor, it allows to separate any basic type (ie, Vector3) into its sub-elements. - -.. image:: img/visual_script45.png - - -Emit Signal -^^^^^^^^^^^ - -Emits signals from any object. In general it's not that useful, as dragging a signal to the canvas works better. - - -Get/Set -^^^^^^^ - -Generic Getter/Setter node. Dragging properties from the Inspector works better, as they appear properly configured on drop. - - -Wait -^^^^ - -The Wait nodes will suspend execution of the function until something happens (many frames can pass until resuming, in fact). -Default nodes allow you to wait for a frame to pass, a fixed frame or a given amount of time until execution is resumed. - - -Yield -^^^^^ - -This node completely suspends the execution of the script, and it will make the function return a value that can be used to resume execution. - - -Yield Signal -^^^^^^^^^^^^ - -Same as Yield, but will wait until a given signal is emitted. - - -Index -~~~~~ - -Generic indexing operator, not often used but it's good that it exists just in case. - - -Operators -~~~~~~~~~ - -These are mostly generic operators, such as addition, multiplication, comparison, etc. -By default, these mostly accept any datatype (and will throw an error at run-time if the types -fed do not match those expected by the operator). It is always recommended to set the right -type for operators to catch errors faster and make the graph easier to read. - -.. image:: img/visual_script46.png - - -Expression Node -^^^^^^^^^^^^^^^ - -Among the operators, the *Expression* node is the most powerful. If well used, it allows you to enormously simplify -visual scripts that are math or logic heavy. Type any expression on it and it will be executed in real-time. - -Expression nodes can: - -- Perform math and logic expressions based on custom inputs (eg: "a*5+b", where a and b are custom inputs): - -.. image:: img/visual_script47.png - - -- Access local variables or properties: - -.. image:: img/visual_script48.png - - -- Use most of the existing built-in functions that are available to GDScript, such as ``sin()``, ``cos()``, ``print()``, as well as constructors, such as ``Vector3(x, y, z)``, ``Rect2(...)``, etc.: - -.. image:: img/visual_script49.png - - -- Call API functions: - -.. image:: img/visual_script50.png - - -- Use sequenced mode, which makes more sense in case of respecting the processing order: - -.. image:: img/visual_script51.png diff --git a/tutorials/scripting/visual_script/what_is_visual_scripting.rst b/tutorials/scripting/visual_script/what_is_visual_scripting.rst deleted file mode 100644 index c645642918f8..000000000000 --- a/tutorials/scripting/visual_script/what_is_visual_scripting.rst +++ /dev/null @@ -1,24 +0,0 @@ -.. _doc_what_is_visual_script: - -What is Visual Scripting -======================== - -Visual Scripting is a tool designed to make the entry barrier to programming -much lower. As code is more visual, it needs less abstract thinking to be -understood. Any artist, animator, game designer, etc. can look at it and quickly -grasp the flow of logic. - -The reason it does not make existing programming obsolete is, simply, that it does not scale as well. -It takes considerably more time to create code with it, and it's often more difficult -to modify than just writing a few characters. - -With the misunderstanding cleared up, the question that remains is what are the practical -uses for Visual Scripting. - -The most common use cases are as follows: - -* Game development beginners who want to learn an engine but have no programming experience yet. -* Artists and Game Designers who have no experience in programming and want to create quick prototypes or simple games. -* Programmers working in a team that want to make part of the game logic available to Artists or Game Designers in order to offload some of their work. - -These scenarios are far more common than one might think, so this is why Godot has added this feature.