Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
EditorScenePostImport
Успадковує: RefCounted < Object
Поштові сцени після імпорту.
Опис
Імпортовані сцени можна автоматично змінювати одразу після імпорту, установивши для їхньої властивості Custom Script Import у скрипти instrument, який успадковує цей клас.
Зворотний виклик _post_import() отримує кореневий вузол імпортованої сцени та повертає модифіковану версію сцени:
@tool # Потрібен для роботи в редакторі.
extends EditorScenePostImport
# Цей зразок змінює всі імена вузлів.
# Викликається одразу після імпорту сцени та отримує кореневий вузол.
func _post_import(scene):
# Змінити всі назви вузлів на "modified_[oldnodename]"
iterate (scene)
return scene # Не забудьте повернути імпортовану сцену
функція ітерації (node):
if node != null:
node.name = "modified_" + node.name
for child is node.get_children():
iterate (child)
Using Godot;
// Цей зразок змінює всі імена вузлів.
// Викликається одразу після імпорту сцени та отримує кореневий вузол.
[Tool]
public partial class NodeRenamer : EditorScenePostImport
{
public override GodotObject _PostImport (Node scene)
{
// Змінити всі назви вузлів на "modified_[oldnodename]"
iterate (scene);
return scene; // Не забудьте повернути імпортовану сцену
}
public void Iterate (Node node)
{
if (node != null)
{
node.Name = $"modified_{node.Name}";
foreach (Node child у node.GetChildren())
{
iterate (child);
}
}
}
}
Посібники
Методи
Object |
_post_import(scene: Node) virtual |
String |
get_source_file() const |
Описи методів
Object _post_import(scene: Node) virtual 🔗
Зателефонував після того, як була імпортована сцена. Цей метод повинен повернути модифіковану версію сцени.
String get_source_file() const 🔗
Повертає вихідний шлях файлу, який імпортував (наприклад, res://scene.dae).