Open coffandro opened 2 months ago
I've got a button in the interface working now, can't figure out how to move it to the left of the other buttons nor how to to connect it though plugin.gd:
tool
extends EditorPlugin
var importer
var button
func _enter_tree():
importer = preload("./importer.gd").new()
add_import_plugin(importer)
# Create the button
button = Button.new()
button.text = "Reload Blend Files"
# Set a fixed size for the button
button.rect_min_size = Vector2(30, 30)
# Connect the button's pressed signal to a function
button.connect("pressed", self, "_on_button_pressed")
# Add the button to the toolbar, it will appear before other icons
add_control_to_container(CONTAINER_TOOLBAR, button)
func _exit_tree():
remove_import_plugin(importer)
importer = null
# Remove the button when the plugin is disabled
remove_control_from_container(CONTAINER_TOOLBAR, button)
button.queue_free()
func _on_button_pressed():
print("Hello")
I don't plan to maintain this plugin. If possible upgrade to Godot 4.x for native Blender support or use another plugin.
Import Plugins use an options system to interact with the engine.
# importer.gd
...
# add import option
func get_import_options(preset):
match preset:
Preset.Default:
return [{
"name": "apply_modifiers",
"default_value": true,
}, {
"name": "pause_reimport",
"default_value": false,
}]
_:
return []
# skip import if paused
func import(source_file, save_path, options, platform_variants, gen_files):
if options["pause_reimport"]:
push_warning("Reimport is paused.")
return null
var temp_path = source_file.replace(".blend", ".glb")
...
If you change importer.gd
you must disable and reenable the plugin to load the change.
A lot of people don't have the best PC's and personally I just don't like things re importing without it being important so I think it'd be nice to have a button at a position like here that does it? idfk