don-tnowe / godot-resources-as-sheets-plugin

I needed to edit many Resource files, so figured someone would too.
MIT License
484 stars 20 forks source link

Error when opening folder with different resource types #24

Closed clemens-tolboom closed 1 year ago

clemens-tolboom commented 1 year ago

When selecting a directory with different resource types: say custom theme and belt I get

  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'name' (on base: 'Theme').
  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'description' (on base: 'Theme').
  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'max_stack_count' (on base: 'Theme').
  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'in_inventory_width' (on base: 'Theme').
  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'in_inventory_height' (on base: 'Theme').
  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'texture' (on base: 'Theme').
  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'mesh' (on base: 'Theme').
  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'slot_flags' (on base: 'Theme').
  res://addons/resources_spreadsheet_view/typed_cells/cell_editor_enum.gd:9 - Invalid get index '<null>' (on base: 'PackedStringArray').
  res://addons/resources_spreadsheet_view/import_export/formats_edit/edit_tres.gd:8 - Invalid get index 'default_properties' (on base: 'Theme').

I guess the user must organize its resources by type just like the examples do.

don-tnowe commented 1 year ago

Hmm. I thought I fixed it with f31466fb8062ca9fb5dc29fc733deebcd8755438 a while back, but I guess not.

Is it still usable after, or just a spam of errors?

clemens-tolboom commented 1 year ago

TBH it confused me for long. It looks like the first (by name) resource is used to build the grid.

But my own resource is complex same as the theme.tres ... I'll try another time with a reduced version of my own resource and debug a little.

vmedea commented 1 year ago

TBH it confused me for long. It looks like the first (by name) resource is used to build the grid.

I've noticed that it does this. If you have more kinds of resources in a directory, it will use the first to determine which columns to show, and filter on that type only: https://github.com/don-tnowe/godot-resources-as-sheets-plugin/blob/master/addons/resources_speadsheet_view/import_export/formats_edit/edit_tres.gd#L76

Aside, I sometimes wish it was a bit less picky and would handle polymorphism, eg types deriving from a single superclass.

In any case, as it only looks at the script property, if you have two kinds of resources without a script in a directory I can see how the logic would fail to detect that.

don-tnowe commented 1 year ago

Resources without scripts should now be handled fine, choosing which type the folder has the most of. On editing different types together, I opened a discussion in #38 .

don-tnowe commented 8 months ago

This is now fully implemented, and I'd like improvement suggestions and bug reports.

It's not on AssetLib yet, but accessible on the https://github.com/don-tnowe/godot-resources-as-sheets-plugin/tree/Godot-4 branch.