GodotSharpEditor
Editor export plugins are automatically activated whenever the user exports the project. Their most common use is to determine what files are being included in the exported project. For each plugin, is called at the beginning of the export process and then is called for each exported file.
Virtual method to be overridden by the user. It is called when the export starts and provides all information about the export. features is the list of features for the export, is_debug is true for debug builds, path is the target path for the exported project. flags is only used when running a runnable profile, e.g. when using native run on Android.
Virtual method to be overridden by the user. Called when the export is finished.
Virtual method to be overridden by the user. Called for each exported file, providing arguments that can be used to identify the file. path is the path of the file, type is the represented by the file (e.g. ) and features is the list of features for the export.
Calling inside this callback will make the file not included in the export.
Adds a shared object with the given tags and destination path.
Adds a static lib from the given path to the iOS project.
Adds a custom file to be exported. path is the virtual path that can be used to load the file, file is the binary data of the file. If remap is true, file will not be exported, but instead remapped to the given path.
Adds a static library (*.a) or dynamic library (*.dylib, *.framework) to Linking Phase in iOS's Xcode project.
Adds a dynamic library (*.dylib, *.framework) to Linking Phase in iOS's Xcode project and embeds it into resulting binary.
Note: For static libraries (*.a) works in same way as .
This method should not be used for System libraries as they are already present on the device.
Adds content for iOS Property List files.
Adds linker flags for the iOS export.
Adds an iOS bundle file from the given path to the exported project.
Adds a C++ code to the iOS export. The final code is created from the code appended by each active export plugin.
To be called inside . Skips the current file, so it's not included in the export.
An editor feature profile can be used to disable specific features of the Godot editor. When disabled, the features won't appear in the editor, which makes the editor less cluttered. This is useful in education settings to reduce confusion or when working in a team. For example, artists and level designers could use a feature profile that disables the script editor to avoid accidentally making changes to files they aren't supposed to edit.
To manage editor feature profiles visually, use Editor > Manage Feature Profiles... at the top of the editor window.
The 3D editor. If this feature is disabled, the 3D editor won't display but 3D nodes will still display in the Create New Node dialog.
The Script tab, which contains the script editor and class reference browser. If this feature is disabled, the Script tab won't display.
The AssetLib tab. If this feature is disabled, the AssetLib tab won't display.
Scene tree editing. If this feature is disabled, the Scene tree dock will still be visible but will be read-only.
The Node dock. If this feature is disabled, signals and groups won't be visible and modifiable from the editor.
The FileSystem dock. If this feature is disabled, the FileSystem dock won't be visible.
The Import dock. If this feature is disabled, the Import dock won't be visible.
Represents the size of the enum.
If disable is true, disables the class specified by class_name. When disabled, the class won't appear in the Create New Node dialog.
Returns true if the class specified by class_name is disabled. When disabled, the class won't appear in the Create New Node dialog.
If disable is true, disables editing for the class specified by class_name. When disabled, the class will still appear in the Create New Node dialog but the inspector will be read-only when selecting a node that extends the class.
Returns true if editing for the class specified by class_name is disabled. When disabled, the class will still appear in the Create New Node dialog but the inspector will be read-only when selecting a node that extends the class.
If disable is true, disables editing for property in the class specified by class_name. When a property is disabled, it won't appear in the inspector when selecting a node that extends the class specified by class_name.
Returns true if property is disabled in the class specified by class_name. When a property is disabled, it won't appear in the inspector when selecting a node that extends the class specified by class_name.
If disable is true, disables the editor feature specified in feature. When a feature is disabled, it will disappear from the editor entirely.
Returns true if the feature is disabled. When a feature is disabled, it will disappear from the editor entirely.
Returns the specified feature's human-readable name.
Saves the editor feature profile to a file in JSON format. It can then be imported using the feature profile manager's Import button or the button.
Loads an editor feature profile from a file. The file must follow the JSON format obtained by using the feature profile manager's Export button or the method.
The displays resources as thumbnails.
The displays resources as a list of filenames.
The can select only one file. Accepting the window will open the file.
The can select multiple files. Accepting the window will open all files.
The can select only one directory. Accepting the window will open the directory.
The can select a file or directory. Accepting the window will open it.
The can select only one file. Accepting the window will save the file.
The can only view res:// directory contents.
The can only view user:// directory contents.
The can view the entire local file system.
The location from which the user may select a file, including res://, user://, and the local file system.
The view format in which the displays resources to the user.
The purpose of the , which defines the allowed behaviors.
The currently occupied directory.
The currently selected file.
The file system path in the address bar.
If true, hidden files and directories will be visible in the .
If true, the will not warn the user before overwriting files.
Removes all filters except for "All Files (*)".
Adds a comma-delimited file extension filter option to the with an optional semi-colon-delimited label.
For example, "*.tscn, *.scn; Scenes" results in filter text "Scenes (*.tscn, *.scn)".
Returns the VBoxContainer used to display the file system.
Notify the that its view of the data is no longer accurate. Updates the view contents on next view update.
This object holds information of all resources in the filesystem, their types, etc.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using .
Gets the root directory object.
Returns true of the filesystem is being scanned.
Returns the scan progress for 0 to 1 if the FS is being scanned.
Scan the filesystem for changes.
Check if the source of any imported resource changed.
Update a file information. Call this if an external program (not Godot) modified the file.
Returns a view into the filesystem at path.
Gets the type of the file, given the full path.
Scans the script files and updates the list of custom class names.
A more generalized, low-level variation of the directory concept.
Returns the number of subdirectories in this directory.
Returns the subdirectory at index idx.
Returns the number of files in this directory.
Returns the name of the file at index idx.
Returns the path to the file at index idx.
Returns the file extension of the file at index idx.
Returns the name of the script class defined in the file at index idx. If the file doesn't define a script class using the class_name syntax, this will return an empty string.
Returns the base class of the script class defined in the file at index idx. If the file doesn't define a script class using the class_name syntax, this will return an empty string.
Returns true if the file at index idx imported properly.
Returns the name of this directory.
Returns the path to this directory.
Returns the parent directory for this directory or null if called on a directory at res:// or user://.
Returns the index of the file with name name or -1 if not found.
Returns the index of the directory with name name or -1 if not found.
EditorImportPlugins provide a way to extend the editor's resource import functionality. Use them to import resources from custom files or to provide alternatives to the editor's existing importers. Register your with .
EditorImportPlugins work by associating with specific file extensions and a resource type. See and . They may optionally specify some import presets that affect the import process. EditorImportPlugins are responsible for creating the resources and saving them in the .import directory.
Below is an example EditorImportPlugin that imports a from a file with the extension ".special" or ".spec":
tool
extends EditorImportPlugin
func get_importer_name():
return "my.special.plugin"
func get_visible_name():
return "Special Mesh"
func get_recognized_extensions():
return ["special", "spec"]
func get_save_extension():
return "mesh"
func get_resource_type():
return "Mesh"
func get_preset_count():
return 1
func get_preset_name(i):
return "Default"
func get_import_options(i):
return [{"name": "my_option", "default_value": false}]
func import(source_file, save_path, options, platform_variants, gen_files):
var file = File.new()
if file.open(source_file, File.READ) != OK:
return FAILED
var mesh = Mesh.new()
# Fill the Mesh with data read in "file", left as an exercise to the reader
var filename = save_path + "." + get_save_extension()
return ResourceSaver.save(filename, mesh)
Gets the options and default values for the preset at this index. Returns an Array of Dictionaries with the following keys: name, default_value, property_hint (optional), hint_string (optional), usage (optional).
Gets the order of this importer to be run when importing resources. Higher values will be called later. Use this to ensure the importer runs after the dependencies are already imported.
Gets the unique name of the importer.
This method can be overridden to hide specific import options if conditions are met. This is mainly useful for hiding options that depend on others if one of them is disabled. For example:
func get_option_visibility(option, options):
# Only show the lossy quality setting if the compression mode is set to "Lossy".
if option == "compress/lossy_quality" and options.has("compress/mode"):
return int(options["compress/mode"]) == COMPRESS_LOSSY
return true
Return true to make all options always visible.
Gets the number of initial presets defined by the plugin. Use to get the default options for the preset and to get the name of the preset.
Gets the name of the options preset at this index.
Gets the priority of this plugin for the recognized extension. Higher priority plugins will be preferred. The default priority is 1.0.
Gets the list of file extensions to associate with this loader (case-insensitive). e.g. ["obj"].
Gets the Godot resource type associated with this loader. e.g. "Mesh" or "Animation".
Gets the extension used to save this resource in the .import directory.
Gets the name to display in the import window. You should choose this name as a continuation to "Import as", e.g. "Import as Special Mesh".
Imports source_file into save_path with the import options specified. The platform_variants and gen_files arrays will be modified by this function.
This method must be overridden to do the actual importing work. See this class' description for an example of overriding this method.
The editor inspector is by default located on the right-hand side of the editor. It's used to edit the properties of the selected node. For example, you can select a node such as then edit its transform through the inspector tool. The editor inspector is an essential tool in the game development workflow.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using .
Refreshes the inspector.
Note: To save on CPU resources, calling this method will do nothing if the time specified in docks/property_editor/auto_refresh_interval editor setting hasn't passed yet since this method was last called. (By default, this interval is set to 0.3 seconds.)
These plugins allow adding custom property editors to .
Plugins are registered via .
When an object is edited, the function is called and must return true if the object type is supported.
If supported, the function will be called, allowing to place custom controls at the beginning of the class.
Subsequently, the and are called for every category and property. They offer the ability to add custom controls to the inspector too.
Finally, will be called.
On each of these calls, the "add" functions can be called.
Returns true if this object can be handled by this plugin.
Called to allow adding controls at the beginning of the list.
Called to allow adding controls at the beginning of the category.
Called to allow adding controls at the end of the list.
Called to allow adding property specific editors to the inspector. Usually these inherit . Returning true removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one.
Adds a custom control, not necessarily a property editor.
Adds a property editor, this must inherit .
Adds an editor that allows modifying multiple properties, this must inherit .
EditorInterface gives you control over Godot editor's window. It allows customizing the window, saving and (re-)loading scenes, rendering mesh previews, inspecting and editing resources and objects, and provides access to , , , , the editor viewport, and information about scenes.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using .
If true, enables distraction-free mode which hides side docks to increase the space available for the main view.
Shows the given property on the given object in the editor's Inspector dock. If inspector_only is true, plugins will not attempt to edit object.
Returns the editor's instance.
Returns the editor's instance.
Returns the editor's instance.
Returns the main container of Godot editor's window. For example, you can use it to retrieve the size of the container and place your controls accordingly.
Returns the actual scale of the editor UI (1.0 being 100% scale). This can be used to adjust position and dimensions of the UI added by plugins.
Note: This value is set via the interface/editor/display_scale and interface/editor/custom_display_scale editor settings. Editor must be restarted for changes to be properly applied.
Edits the given .
Edits the given . The node will be also selected if it's inside the scene tree.
Opens the scene at the given path.
Reloads the scene at the given path.
Plays the main scene.
Plays the currently active scene.
Plays the scene specified by its filepath.
Stops the scene that is currently playing.
Returns true if a scene is currently being played, false otherwise. Paused scenes are considered as being played.
Returns the name of the scene that is being played. If no scene is currently being played, returns an empty string.
Returns an with the file paths of the currently opened scenes.
Returns the edited (current) scene's root .
Returns the editor's instance.
Returns the editor's instance.
Returns the main editor control. Use this as a parent for main screens.
Note: This returns the main editor control containing the whole editor, not the 2D or 3D viewports specifically.
Returns mesh previews rendered at the given size as an of s.
Selects the file, with the path provided by file, in the FileSystem dock.
Returns the path of the directory currently selected in the . If a file is selected, its base directory will be returned using String.get_base_dir instead.
Returns the current path being viewed in the .
Returns the editor's instance.
Sets the enabled status of a plugin. The plugin name is the same as its directory name.
Returns true if the specified plugin is enabled. The plugin name is the same as its directory name.
Returns the editor's instance.
Saves the scene. Returns either OK or ERR_CANT_CREATE (see @GlobalScope constants).
Saves the scene as a file at path.
Sets the editor's current main screen to the one specified in name. name must match the text of the tab in question exactly (2D, 3D, Script, AssetLib).
Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins. See also to add functions to the editor.
Represents the size of the enum.
This method is called when the editor is about to save the project, switch to another tab, etc. It asks the plugin to apply any pending state changes to ensure consistency.
This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object.
This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs.
This method must return a boolean. If this method returns false, the project will not run. The run is aborted immediately, so this also prevents all other plugins' methods from running.
Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene.
Called by the engine when the user disables the in the Plugin tab of the project settings window.
This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
Called by the engine when the user enables the in the Plugin tab of the project settings window.
Called by the engine when the 2D editor's viewport is updated. Use the overlay for drawing. You can update the viewport manually by calling .
func forward_canvas_draw_over_viewport(overlay):
# Draw a circle at cursor position.
overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.white)
func forward_canvas_gui_input(event):
if event is InputEventMouseMotion:
# Redraw viewport when cursor is moved.
update_overlays()
return true
return false
This method is the same as , except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
You need to enable calling of this method by using .
Called when there is a root node in the current edited scene, is implemented and an happens in the 2D viewport. Intercepts the , if return true consumes the event, otherwise forwards event to other Editor classes. Example:
# Prevents the InputEvent to reach other Editor classes
func forward_canvas_gui_input(event):
var forward = true
return forward
Must return false in order to forward the to other Editor classes. Example:
# Consumes InputEventMouseMotion and forwards other InputEvent types
func forward_canvas_gui_input(event):
var forward = false
if event is InputEventMouseMotion:
forward = true
return forward
Called by the engine when the 3D editor's viewport is updated. Use the overlay for drawing. You can update the viewport manually by calling .
func forward_spatial_draw_over_viewport(overlay):
# Draw a circle at cursor position.
overlay.draw_circle(overlay.get_local_mouse_position(), 64)
func forward_spatial_gui_input(camera, event):
if event is InputEventMouseMotion:
# Redraw viewport when cursor is moved.
update_overlays()
return true
return false
This method is the same as , except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
You need to enable calling of this method by using .
Called when there is a root node in the current edited scene, is implemented and an happens in the 3D viewport. Intercepts the , if return true consumes the event, otherwise forwards event to other Editor classes. Example:
# Prevents the InputEvent to reach other Editor classes
func forward_spatial_gui_input(camera, event):
var forward = true
return forward
Must return false in order to forward the to other Editor classes. Example:
# Consumes InputEventMouseMotion and forwards other InputEvent types
func forward_spatial_gui_input(camera, event):
var forward = false
if event is InputEventMouseMotion:
forward = true
return forward
This is for editors that edit script-based objects. You can return a list of breakpoints in the format (script:line), for example: res://path_to_script.gd:25.
Override this method in your plugin to return a in order to give it an icon.
For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons.
Ideally, the plugin icon should be white with a transparent background and 16x16 pixels in size.
func get_plugin_icon():
# You can use a custom icon:
return preload("res://addons/my_plugin/my_plugin_icon.svg")
# Or use a built-in icon:
return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
Override this method in your plugin to provide the name of the plugin when displayed in the Godot editor.
For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", and "AssetLib" buttons.
Gets the state of your plugin editor. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns).
Gets the GUI layout of the plugin. This is used to save the project's editor layout when is called or the editor layout was changed(For example changing the position of a dock).
Implement this function if your plugin edits a specific type of object (Resource or Node). If you return true, then you will get the functions and called when the editor requests them. If you have declared the methods and these will be called too.
Returns true if this is a main screen editor plugin (it goes in the workspace selector together with 2D, 3D, Script and AssetLib).
This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.
Remember that you have to manage the visibility of all your editor controls manually.
This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources.
Restore the state saved by .
Restore the plugin GUI layout saved by .
Adds a custom control to a container (see ). There are many locations where custom controls can be added in the editor UI.
Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
When your plugin is deactivated, make sure to remove your custom control with and free it with .
Adds a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with and free it with .
Adds the control to a specific dock slot (see for options).
If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
When your plugin is deactivated, make sure to remove your custom control with and free it with .
Removes the control from the dock. You have to manually the control.
Removes the control from the bottom panel. You have to manually the control.
Removes the control from the specified container. You have to manually the control.
Adds a custom menu item to Project > Tools as name that calls callback on an instance of handler with a parameter ud when user activates it.
Adds a custom submenu under Project > Tools > name. submenu should be an object of class . This submenu should be cleaned up using remove_tool_menu_item(name).
Removes a menu name from Project > Tools.
Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
When given node or resource is selected, the base type will be instanced (ie, "Spatial", "Control", "Resource"), then the script will be loaded and set to this object.
You can use the virtual method to check if your custom object is being edited by checking the script or using the is keyword.
During run-time, this will be a simple object with a script so this function does not need to be called then.
Removes a custom type added by .
Adds a script at path to the Autoload list as name.
Removes an Autoload name from the list.
Updates the overlays of the 2D and 3D editor viewport. Causes methods , , and to be called.
Gets the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it.
Queue save the project's editor layout.
Registers a new export plugin. Export plugins are used when the project is being exported. See for more information.
Use this method if you always want to receive inputs from 3D view screen inside . It might be especially usable if your plugin will want to use raycast in the scene.
Enables calling of for the 2D editor and for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin.
Returns the object that gives you control over Godot editor's window and its functionalities.
Gets the Editor's dialogue used for making scripts.
Note: Users can configure it before use.
This control allows property editing for one or multiple properties into . It is added via .
Set this property to change the label (if you want to show one).
Used by the inspector, set to true when the property is read-only.
Used by the inspector, set to true when the property is checkable.
Used by the inspector, set to true when the property is checked.
Used by the inspector, set to true when the property must draw with error color. This is used for editable children's properties.
Used by the inspector, set to true when the property can add keys for animation.
When this virtual function is called, you must update your editor.
Gets the edited property. If your editor is for a single property (added via ), then this will return the property.
Gets the edited object.
Override if you want to allow a custom tooltip over your property.
If any of the controls added can gain keyboard focus, add it here. This ensures that focus will be restored if the inspector is refreshed.
Adds controls with this function if you want them on the bottom (below the label).
If one or several properties have changed, this must be called. field is used in case your editor can modify fields separately (as an example, Vector3.x). The changing argument avoids the editor requesting this property to be refreshed (leave as false if unsure).
This object is used to generate previews for resources of files.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using .
Queue a resource file for preview (using a path). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texture (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything.
Queue a resource being edited for preview (using an instance). Once the preview is ready, your receiver.receiver_func will be called either containing the preview texture or an empty texture (if no preview was possible). Callback must have the format: (path,texture,userdata). Userdata can be anything.
Create an own, custom preview generator.
Removes a custom preview generator.
Check if the resource changed, if so, it will be invalidated and the corresponding signal emitted.
Custom code to generate previews. Please check file_dialog/thumbnail_size in to find out the right size to do previews at.
If this function returns true, the generator will call or for small previews as well.
By default, it returns false.
Generate a preview from a given resource with the specified size. This must always be implemented.
Returning an empty texture is an OK way to fail and let another generator take care.
Care must be taken because this function is always called from a thread (not the main thread).
Generate a preview directly from a path with the specified size. Implementing this is optional, as default code will load and call .
Returning an empty texture is an OK way to fail and let another generator take care.
Care must be taken because this function is always called from a thread (not the main thread).
If this function returns true, the generator will automatically generate the small previews from the normal preview texture generated by the methods or .
By default, it returns false.
Returns true if your generator supports the resource of type type.
This is an FBX 3D asset importer with full support for most FBX features.
If exporting a FBX scene from Autodesk Maya, use these FBX export settings:
- Smoothing Groups
- Smooth Mesh
- Triangluate (for meshes with blend shapes)
- Bake Animation
- Resample All
- Deformed Models
- Skins
- Blend Shapes
- Curve Filters
- Constant Key Reducer
- Auto Tangents Only
- *Do not check* Constraints (as it will break the file)
- Can check Embed Media (embeds textures into the exported FBX file)
- Note that when importing embedded media, the texture and mesh will be a single immutable file.
- You will have to re-export then re-import the FBX if the texture has changed.
- Units: Centimeters
- Up Axis: Y
- Binary format in FBX 2017
Imported scenes can be automatically modified right after import by setting their Custom Script Import property to a tool script that inherits from this class.
The callback receives the imported scene's root node and returns the modified version of the scene. Usage example:
tool # Needed so it runs in editor
extends EditorScenePostImport
# This sample changes all node names
# Called right after the scene is imported and gets the root node
func post_import(scene):
# Change all node names to "modified_[oldnodename]"
iterate(scene)
return scene # Remember to return the imported scene
func iterate(node):
if node != null:
node.name = "modified_" + node.name
for child in node.get_children():
iterate(child)
Called after the scene was imported. This method must return the modified version of the scene.
Returns the resource folder the imported scene file is located in.
Returns the source file path which got imported (e.g. res://scene.dae).
Scripts extending this class and implementing its method can be executed from the Script Editor's File > Run menu option (or by pressing Ctrl+Shift+X) while the editor is running. This is useful for adding custom in-editor functionality to Godot. For more complex additions, consider using s instead.
Note: Extending scripts need to have tool mode enabled.
Example script:
tool
extends EditorScript
func _run():
print("Hello from the Godot Editor!")
Note: The script is run in the Editor context, which means the output is visible in the console window started with the Editor (stdout) instead of the usual Godot Output dock.
This method is executed by the Editor when File > Run is used.
Adds node as a child of the root node in the editor context.
Warning: The implementation of this method is currently disabled.
Returns the Editor's currently active scene.
Returns the singleton instance.
This object manages the SceneTree selection in the editor.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using .
Clear the selection.
Adds a node to the selection.
Note: The newly selected node will not be automatically edited in the inspector. If you want to edit a node, use .
Removes a node from the selection.
Gets the list of selected nodes.
Gets the list of selected nodes, optimized for transform operations (i.e. moving them, rotating, etc). This list avoids situations where a node is selected and also child/grandchild.
Object that holds the project-independent editor settings. These settings are generally visible in the Editor > Editor Settings menu.
Property names use slash delimiters to distinguish sections. Setting values can be of any Variant type. It's recommended to use snake_case for editor settings to be consistent with the Godot editor itself.
Accessing the settings can be done using the following methods, such as:
# `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
settings.set_setting("some/property",value)
# `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
settings.get_setting("some/property")
var list_of_settings = settings.get_property_list()
Note: This class shouldn't be instantiated directly. Instead, access the singleton using .
Emitted after any editor setting has changed. It's used by various editor plugins to update their visuals on theme changes or logic on configuration changes.
Returns true if the setting specified by name exists, false otherwise.
Sets the value of the setting specified by name. This is equivalent to using on the EditorSettings instance.
Returns the value of the setting specified by name. This is equivalent to using on the EditorSettings instance.
Erases the setting whose name is specified by property.
Sets the initial value of the setting specified by name to value. This is used to provide a value for the Revert button in the Editor Settings. If update_current is true, the current value of the setting will be set to value as well.
Returns true if the setting specified by name can have its value reverted to the default value, false otherwise. When this method returns true, a Revert button will display next to the setting in the Editor Settings.
Returns the default value of the setting specified by name. This is the value that would be applied when clicking the Revert button in the Editor Settings.
Adds a custom property info to a property. The dictionary must contain:
- name: (the name of the property)
- type: (see )
- optionally hint: (see ) and hint_string:
Example:
editor_settings.set("category/property_name", 0)
var property_info = {
"name": "category/property_name",
"type": TYPE_INT,
"hint": PROPERTY_HINT_ENUM,
"hint_string": "one,two,three"
}
editor_settings.add_property_info(property_info)
Gets the global settings path for the engine. Inside this path, you can find some standard paths such as:
settings/tmp - Used for temporary storage of files
settings/templates - Where export templates are located
Returns the project-specific settings path. Projects all have a unique subdirectory inside the settings path where project-specific settings are saved.
Sets project-specific metadata with the section, key and data specified. This metadata is stored outside the project folder and therefore won't be checked into version control. See also .
Returns project-specific metadata for the section and key specified. If the metadata doesn't exist, default will be returned instead. See also .
Sets the list of favorite files and directories for this project.
Returns the list of favorite files and directories for this project.
Sets the list of recently visited folders in the file dialog for this project.
Returns the list of recently visited folders in the file dialog for this project.
Custom gizmo that is used for providing custom visualization and editing (handles) for 3D Spatial objects. See for more information.
Commit a handle being edited (handles must have been previously added by ).
If the cancel parameter is true, an option to restore the edited value to the original is provided.
Gets the name of an edited handle (handles must have been previously added by ).
Handles can be named for reference to the user when editing.
Gets actual value of a handle. This value can be anything and used for eventually undoing the motion when calling .
Returns true if the handle at index index is highlighted by being hovered with the mouse.
This function is called when the this gizmo refers to changes (the is called).
This function is used when the user drags a gizmo handle (previously added with ) in screen coordinates.
The is also provided so screen coordinates can be converted to raycasts.
Adds lines to the gizmo (as sets of 2 points), with a given material. The lines are used for visualizing the gizmo. Call this function during .
If the parameter is null, then the default value is new Color(1, 1, 1, 1)
Adds a mesh to the gizmo with the specified billboard state, skeleton and material. If billboard is true, the mesh will rotate to always face the camera. Call this function during .
Adds the specified segments to the gizmo's collision shape for picking. Call this function during .
Adds collision triangles to the gizmo for picking. A can be generated from a regular too. Call this function during .
Adds an unscaled billboard for visualization. Call this function during .
If the parameter is null, then the default value is new Color(1, 1, 1, 1)
Adds a list of handles (points) which can be used to deform the object being edited.
There are virtual functions which will be called upon editing of these handles. Call this function during .
Sets the reference node for the gizmo. node must inherit from .
Returns the Spatial node associated with this gizmo.
Returns the that owns this gizmo. It's useful to retrieve materials using .
Removes everything in the gizmo including meshes, collisions and handles.
Sets the gizmo's hidden state. If true, the gizmo will be hidden. If false, it will be shown.
EditorSpatialGizmoPlugin allows you to define a new type of Gizmo. There are two main ways to do so: extending for the simpler gizmos, or creating a new type. See the tutorial in the documentation for more info.
Override this method to define whether the gizmo can be hidden or not. Returns true if not overridden.
Override this method to commit gizmo handles. Called for this plugin's active gizmos.
Override this method to return a custom for the spatial nodes of your choice, return null for the rest of nodes. See also .
Override this method to provide gizmo's handle names. Called for this plugin's active gizmos.
Gets actual value of a handle from gizmo. Called for this plugin's active gizmos.
Override this method to provide the name that will appear in the gizmo visibility menu.
Override this method to set the gizmo's priority. Higher values correspond to higher priority. If a gizmo with higher priority conflicts with another gizmo, only the gizmo with higher priority will be used.
All built-in editor gizmos return a priority of -1. If not overridden, this method will return 0, which means custom gizmos will automatically override built-in gizmos.
Override this method to define which Spatial nodes have a gizmo from this plugin. Whenever a node is added to a scene this method is called, if it returns true the node gets a generic assigned and is added to this plugin's list of active gizmos.
Gets whether a handle is highlighted or not. Called for this plugin's active gizmos.
Override this method to define whether a Spatial with this gizmo should be selectable even when the gizmo is hidden.
Callback to redraw the provided gizmo. Called for this plugin's active gizmos.
Update the value of a handle after it has been updated. Called for this plugin's active gizmos.
Creates an unshaded material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with and used in and . Should not be overridden.
Creates an icon material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with and used in . Should not be overridden.
If the parameter is null, then the default value is new Color(1, 1, 1, 1)
Creates a handle material with its variants (selected and/or editable) and adds them to the internal material list. They can then be accessed with and used in . Should not be overridden.
Adds a new material to the internal material list for the plugin. It can then be accessed with . Should not be overridden.
Gets material from the internal list of materials. If an is provided, it will try to get the corresponding variant (selected and/or editable).
Used by the editor to display VCS extracted information in the editor. The implementation of this API is included in VCS addons, which are essentially GDNative plugins that need to be put into the project folder. These VCS addons are scripts which are attached (on demand) to the object instance of EditorVCSInterface. All the functions listed below, instead of performing the task themselves, they call the internally defined functions in the VCS addons to provide a plug-n-play experience.
Returns true if the addon is ready to respond to function calls, else returns false.
Initializes the VCS addon if not already. Uses the argument value as the path to the working directory of the project. Creates the initial commit if required. Returns true if no failure occurs, else returns false.
Returns true if the VCS addon has been initialized, else returns false.
Returns a containing the path of the detected file change mapped to an integer signifying what kind of change the corresponding file has experienced.
The following integer values are being used to signify that the detected file is:
- 0: New to the VCS working directory
- 1: Modified
- 2: Renamed
- 3: Deleted
- 4: Typechanged
Stages the file which should be committed when is called. Argument should contain the absolute path.
Unstages the file which was staged previously to be committed, so that it is no longer committed when is called. Argument should contain the absolute path.
Creates a version commit if the addon is initialized, else returns without doing anything. Uses the files which have been staged previously, with the commit message set to a value as provided as in the argument.
Returns an of objects containing the diff output from the VCS in use, if a VCS addon is initialized, else returns an empty object. The diff contents also consist of some contextual lines which provide context to the observed line change in the file.
Each object has the line diff contents under the keys:
- "content" to store a containing the line contents
- "status" to store a which contains "+" in case the content is a line addition but it stores a "-" in case of deletion and an empty string in the case the line content is neither an addition nor a deletion.
- "new_line_number" to store an integer containing the new line number of the line content.
- "line_count" to store an integer containing the number of lines in the line content.
- "old_line_number" to store an integer containing the old line number of the line content.
- "offset" to store the offset of the line change since the first contextual line content.
Shuts down the VCS addon to allow cleanup code to run on call. Returns true is no failure occurs, else returns false.
Returns the project name of the VCS working directory.
Returns the name of the VCS if the VCS has been initialized, else return an empty string.
The 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 methods.
func _ready():
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()
Prefills required fields to configure the ScriptCreateDialog for use.
Note: This class shouldn't be instantiated directly. Instead, access the singleton using .
Goes to the specified line in the current script.
Returns a that is currently active in editor.
Returns an array with all objects which are currently open in editor.
Opens the script create dialog. The script will extend base_name. The file extension can be omitted from base_path. It will be added based on the selected scripting language.
Add a custom Visual Script node to the editor. It'll be placed under "Custom Nodes" with the category as the parameter.
Remove a custom Visual Script node from the editor. Custom nodes already placed on scripts won't be removed.