MarkusMannil / WaveFunctionCollapse3DPlugin

MIT License
13 stars 3 forks source link

Installing Problem #2

Open n0ahwint3r opened 3 months ago

n0ahwint3r commented 3 months ago

When I trx to enable the addon I get a failure notification:

Extending script on the following path wasn't found: ‚res://addons/Wave_Function_Collapse/plugin_loader.gd‘. It seems to be a mistake in its source code. The extension ‚res://addons/Wave_Function_Collapse/plugin.cfg‘ gets deactivated to prevent further failure.

n0ahwint3r commented 3 months ago

Here is how I fixed it, enabling works just fine now, got to test though if everything else works accordingly:

Intial issue was with the missing "@" before tool in line 1. After that was fixed Godot took issue with the collect function in lines 26-28, appearently in Godot 4 Callables are required for this function...

@tool extends EditorPlugin

const wfc_main_control = preload("res://addons/Wave_Function_Collapse/Plugin_controll/Main_controll/Plugin_main_tab.tscn")

var docked_scene : Control var editor_interface_selection var already_exists : bool = false

signal WFC_node_selected signal other_node_selected signal show_icon

func _enter_tree(): docked_scene = wfc_main_control.instance() editor_interface_selection = get_editor_interface().get_selection() editor_interface_selection.connect("selection_changed", Callable(self, "_on_selection_changed"))

connect("WFC_node_selected", Callable(docked_scene, "WFC_node_selected"))
connect("other_node_selected", Callable(docked_scene, "other_node_selected"))
connect("show_icon", Callable(docked_scene, "add_icons"))

func _exit_tree(): remove_control_from_bottom_panel(docked_scene) docked_scene.free()

func _on_selection_changed(): var selected = editor_interface_selection.get_selected_nodes() if not selected.empty(): if selected[0].has_method("wave_function_collapse"): emit_signal("WFC_node_selected", selected[0]) if not already_exists: var button = add_control_to_bottom_panel(docked_scene, "Wave Function Collapse") emit_signal("show_icon") button.pressed = true already_exists = true else: emit_signal("other_node_selected") remove_control_from_bottom_panel(docked_scene) already_exists = false