summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-15 21:07:42 +0200
committerGitHub <noreply@github.com>2022-06-15 21:07:42 +0200
commitd82c227e2b5914cb4042c11411c7e21ed403896c (patch)
tree6e9f647c01941eb539092da96887f0a8aada77b5
parenteeb91cec4658aef3a0cd0d6c51c4262706d03d45 (diff)
parent912d8e23ca4d01e242eda386e420175329113d5b (diff)
Merge pull request #61486 from jtnicholl/import_script_templates
Add script templates for EditorScenePostImport
-rw-r--r--modules/gdscript/editor/script_templates/EditorScenePostImport/basic_import_script.gd11
-rw-r--r--modules/gdscript/editor/script_templates/EditorScenePostImport/no_comments.gd7
-rw-r--r--modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs18
-rw-r--r--modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs15
4 files changed, 51 insertions, 0 deletions
diff --git a/modules/gdscript/editor/script_templates/EditorScenePostImport/basic_import_script.gd b/modules/gdscript/editor/script_templates/EditorScenePostImport/basic_import_script.gd
new file mode 100644
index 0000000000..b4b2305b8c
--- /dev/null
+++ b/modules/gdscript/editor/script_templates/EditorScenePostImport/basic_import_script.gd
@@ -0,0 +1,11 @@
+# meta-description: Basic import script template
+@tool
+extends EditorScenePostImport
+
+
+# Called by the editor when a scene has this script set as the import script in the import tab.
+func _post_import(scene: Node) -> Object:
+ # Modify the contents of the scene upon import. For example, setting up LODs:
+# (scene.get_node(^"HighPolyMesh") as MeshInstance3D).draw_distance_end = 5.0
+# (scene.get_node(^"LowPolyMesh") as MeshInstance3D).draw_distance_begin = 5.0
+ return scene # Return the modified root node when you're done.
diff --git a/modules/gdscript/editor/script_templates/EditorScenePostImport/no_comments.gd b/modules/gdscript/editor/script_templates/EditorScenePostImport/no_comments.gd
new file mode 100644
index 0000000000..875afb4fc0
--- /dev/null
+++ b/modules/gdscript/editor/script_templates/EditorScenePostImport/no_comments.gd
@@ -0,0 +1,7 @@
+# meta-description: Basic import script template (no comments)
+@tool
+extends EditorScenePostImport
+
+
+func _post_import(scene: Node) -> Object:
+ return scene
diff --git a/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs b/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs
new file mode 100644
index 0000000000..0690205d01
--- /dev/null
+++ b/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs
@@ -0,0 +1,18 @@
+// meta-description: Basic import script template
+
+#if TOOLS
+using _BINDINGS_NAMESPACE_;
+using System;
+
+[Tool]
+public partial class _CLASS_ : _BASE_
+{
+ public override Object _PostImport(Node scene)
+ {
+ // Modify the contents of the scene upon import. For example, setting up LODs:
+// scene.GetNode<MeshInstance3D>("HighPolyMesh").DrawDistanceEnd = 5.0
+// scene.GetNode<MeshInstance3D>("LowPolyMesh").DrawDistanceBegin = 5.0
+ return scene // Return the modified root node when you're done.
+ }
+}
+#endif
diff --git a/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs b/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs
new file mode 100644
index 0000000000..4e2d9b7088
--- /dev/null
+++ b/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs
@@ -0,0 +1,15 @@
+// meta-description: Basic import script template (no comments)
+
+#if TOOLS
+using _BINDINGS_NAMESPACE_;
+using System;
+
+[Tool]
+public partial class _CLASS_ : _BASE_
+{
+ public override Object _PostImport(Node scene)
+ {
+ return scene
+ }
+}
+#endif