Files
godot-docs/classes/class_scriptcreatedialog.rst
2022-02-01 16:35:13 +01:00

84 lines
4.1 KiB
ReStructuredText

:github_url: hide
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the ScriptCreateDialog.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_ScriptCreateDialog:
ScriptCreateDialog
==================
**Inherits:** :ref:`ConfirmationDialog<class_ConfirmationDialog>` **<** :ref:`AcceptDialog<class_AcceptDialog>` **<** :ref:`Window<class_Window>` **<** :ref:`Viewport<class_Viewport>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
The Editor's popup dialog for creating new :ref:`Script<class_Script>` files.
Description
-----------
The ``ScriptCreateDialog`` creates script files according to a given template for a given scripting language. The standard use is to configure its fields prior to calling one of the :ref:`Window.popup<class_Window_method_popup>` methods.
.. tabs::
.. code-tab:: gdscript
func _ready():
var dialog = ScriptCreateDialog.new();
dialog.config("Node", "res://new_node.gd") # For in-engine types.
dialog.config("\"res://base_node.gd\"", "res://derived_node.gd") # For script types.
dialog.popup_centered()
.. code-tab:: csharp
public override void _Ready()
{
var dialog = new ScriptCreateDialog();
dialog.Config("Node", "res://NewNode.cs"); // For in-engine types.
dialog.Config("\"res://BaseNode.cs\"", "res://DerivedNode.cs"); // For script types.
dialog.PopupCentered();
}
Properties
----------
+-----------------------------+-------------------+------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | dialog_hide_on_ok | ``false`` (overrides :ref:`AcceptDialog<class_AcceptDialog_property_dialog_hide_on_ok>`) |
+-----------------------------+-------------------+------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | title | ``"Attach Node Script"`` (overrides :ref:`Window<class_Window_property_title>`) |
+-----------------------------+-------------------+------------------------------------------------------------------------------------------+
Methods
-------
+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`config<class_ScriptCreateDialog_method_config>` **(** :ref:`String<class_String>` inherits, :ref:`String<class_String>` path, :ref:`bool<class_bool>` built_in_enabled=true, :ref:`bool<class_bool>` load_enabled=true **)** |
+------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Signals
-------
.. _class_ScriptCreateDialog_signal_script_created:
- **script_created** **(** :ref:`Script<class_Script>` script **)**
Emitted when the user clicks the OK button.
Method Descriptions
-------------------
.. _class_ScriptCreateDialog_method_config:
- void **config** **(** :ref:`String<class_String>` inherits, :ref:`String<class_String>` path, :ref:`bool<class_bool>` built_in_enabled=true, :ref:`bool<class_bool>` load_enabled=true **)**
Prefills required fields to configure the ScriptCreateDialog for use.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`