112 lines
4.2 KiB
ReStructuredText
112 lines
4.2 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/EditorScenePostImport.xml.
|
|
|
|
.. _class_EditorScenePostImport:
|
|
|
|
EditorScenePostImport
|
|
=====================
|
|
|
|
**Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
|
|
|
|
Post-processes scenes after import.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
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 :ref:`post_import<class_EditorScenePostImport_method_post_import>` 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)
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Tutorials
|
|
---------
|
|
|
|
- `#custom-script <../tutorials/assets_pipeline/importing_scenes.html#custom-script>`__ in :doc:`../tutorials/assets_pipeline/importing_scenes`
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`get_source_file<class_EditorScenePostImport_method_get_source_file>` **(** **)** |const| |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`get_source_folder<class_EditorScenePostImport_method_get_source_folder>` **(** **)** |const| |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Object<class_Object>` | :ref:`post_import<class_EditorScenePostImport_method_post_import>` **(** :ref:`Object<class_Object>` scene **)** |virtual| |
|
|
+-----------------------------+----------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_EditorScenePostImport_method_get_source_file:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`String<class_String>` **get_source_file** **(** **)** |const|
|
|
|
|
Returns the source file path which got imported (e.g. ``res://scene.dae``).
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorScenePostImport_method_get_source_folder:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`String<class_String>` **get_source_folder** **(** **)** |const|
|
|
|
|
Returns the resource folder the imported scene file is located in.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorScenePostImport_method_post_import:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Object<class_Object>` **post_import** **(** :ref:`Object<class_Object>` scene **)** |virtual|
|
|
|
|
Called after the scene was imported. This method must return the modified version of the scene.
|
|
|
|
.. |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.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|