don-tnowe / godot-inspector-extender

Using just comments, add specialized inspectors for your Godot 4 scripts.
MIT License
97 stars 8 forks source link

Fix bugs #9

Closed luisacarrion closed 5 months ago

luisacarrion commented 5 months ago

Fix get_suffix when the variable name is just 1 letter long

When the variable name was just 1 letter long, get_suffix would return an empty string, so the attributes wouldn't work for that variable. Now 1 letter long variable names work correctly.

Fix error when editing an object that doesn't have a script attached

If you edited an object without a script attached, it would give the error:

"Invalid get index 'property_name' ".

This happened because it was trying to access that property in an object that was previously handled by the plugin.

This was fixed by resetting the state of the variables on the _can_handle method and making a null check in _on_edited_object_changed, so it doesn't try to update a variable on an object that the plugin is not currently handling.

Fix error “Another resource is loaded from path” when opening a .tres file

When you opened a .tres file, it would give the error:

"Another resource is loaded from path 'res://path/my_file.tres' (possible cyclic resource inclusion)."

This happened because during create_editable_copy, the resource_path property would be assigned to the new object. This failed, as stated in the documentation:

Setting this property manually may fail if a resource with the same path has already been previously loaded.

It was fixed by skipping the resource_path property when assigning the property values.

don-tnowe commented 5 months ago

Looks good to me, rather clean. Thank you!