Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@

node_modules/
android/
/.idea/.gitignore
/.idea/aws.xml
/.idea/editor.xml
/.idea/GodotJSExample.iml
/.idea/modules.xml
/.idea/prettier.xml
/.idea/vcs.xml
43 changes: 27 additions & 16 deletions addons/my_example_plugin/my_example_plugin.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
import { Control, EditorPlugin, is_instance_valid, Node, PackedScene, ResourceLoader } from "godot";
import { tool } from "godot.annotations";
import {
Control,
EditorPlugin,
is_instance_valid,
PackedScene,
ResourceLoader,
} from "godot";
import { createClassBinder } from "godot.annotations";

@tool()
const bind = createClassBinder();

@bind()
@bind.tool()
export default class MyExamplePlugin extends EditorPlugin {
private dock!: Control;
private dock!: Control;

_enter_tree(): void {
console.log("MyExamplePlugin enter_tree");
let scene = <PackedScene> ResourceLoader.load("res://addons/my_example_plugin/my_example_dock.tscn");
this.dock = <Control> scene.instantiate();
this.add_control_to_bottom_panel(this.dock, "My Example Plugin (TS)");
}
_enter_tree(): void {
console.log("MyExamplePlugin enter_tree");
let scene = <PackedScene>(
ResourceLoader.load("res://addons/my_example_plugin/my_example_dock.tscn")
);
this.dock = <Control>scene.instantiate();
this.add_control_to_bottom_panel(this.dock, "My Example Plugin (TS)");
}

_exit_tree(): void {
console.log("MyExamplePlugin exit_tree");
this.remove_control_from_bottom_panel(this.dock);
this.dock.free();
console.assert(!is_instance_valid(this.dock));
}
_exit_tree(): void {
console.log("MyExamplePlugin exit_tree");
this.remove_control_from_bottom_panel(this.dock);
this.dock.free();
console.assert(!is_instance_valid(this.dock));
}
}
Loading