EditorScenePostImport

package
v0.0.0-...-e9402f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package EditorScenePostImport provides methods for working with EditorScenePostImport object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsEditorScenePostImport() Instance
}

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.EditorScenePostImport

Imported scenes can be automatically modified right after import by setting their [b]Custom Script[/b] Import property to a [code]tool[/code] script that inherits from this class. The [method _post_import] callback receives the imported scene's root node and returns the modified version of the scene. Usage example: [codeblocks] [gdscript] @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)

[/gdscript] [csharp] using Godot;

// This sample changes all node names. // Called right after the scene is imported and gets the root node. [Tool] public partial class NodeRenamer : EditorScenePostImport

{
    public override GodotObject _PostImport(Node scene)
    {
        // Change all node names to "modified_[oldnodename]"
        Iterate(scene);
        return scene; // Remember to return the imported scene
    }

    public void Iterate(Node node)
    {
        if (node != null)
        {
            node.Name = $"modified_{node.Name}";
            foreach (Node child in node.GetChildren())
            {
                Iterate(child);
            }
        }
    }
}

[/csharp] [/codeblocks]

See [Interface] for methods that can be overridden by a [Class] that extends it.

%!(EXTRA string=EditorScenePostImport)

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsEditorScenePostImport

func (self Instance) AsEditorScenePostImport() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) GetSourceFile

func (self Instance) GetSourceFile() string

Returns the source file path which got imported (e.g. [code]res://scene.dae[/code]).

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	//Called after the scene was imported. This method must return the modified version of the scene.
	PostImport(scene [1]gdclass.Node) Object.Instance
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL