scatter icon indicating copy to clipboard operation
scatter copied to clipboard

Scatter is not working with Godot 3.5

Open felixscheffer opened this issue 3 years ago • 8 comments

Godot has recently released version 3.5 beta 3 and unfortunatly it seems to break Scatter.

When enabling Scatter in the plugins tab, I get:

 res://addons/scatter/plugin.gd:141 - Invalid call. Nonexistent function 'add_child' in base 'Nil'.
 res://addons/scatter/src/tools/path_gizmo/gizmo_options.gd:56 - Invalid get index 'color' (on base: 'Nil').
 res://addons/scatter/src/tools/path_gizmo/scatter_path_gizmo_plugin.gd:380 - Invalid type in function 'create_custom_material' in base 'EditorSpatialGizmoPlugin (scatter_path_gizmo_plugin.gd)'. Cannot convert argument 2 from Nil to Color.

and when switching to showcase.tscn:

 Script inherits from native type 'Reference', so it can't be instanced in object of type 'Node'.
 Script inherits from native type 'Reference', so it can't be instanced in object of type 'Node'.
 res://addons/scatter/src/tools/path_gizmo/gizmo_options.gd:66 - Invalid set index 'pressed' (on base: 'Nil') with value of type 'bool'.
 res://addons/scatter/src/modifiers/exclude_along_path.gd:48 - Invalid get index 'Util' (on base: 'Node').
 res://addons/scatter/src/modifiers/exclude_along_path.gd:48 - Invalid get index 'Util' (on base: 'Node').
 res://addons/scatter/src/modifiers/exclude_around_point.gd:62 - Invalid get index 'Point' (on base: 'Node').
 res://addons/scatter/src/modifiers/exclude_around_point.gd:72 - Invalid call. Nonexistent function 'size' in base 'Nil'.
 res://addons/scatter/src/modifiers/exclude_around_point.gd:39 - Invalid get index 'Util' (on base: 'Node').
 res://addons/scatter/src/tools/path_gizmo/gizmo_options.gd:66 - Invalid set index 'pressed' (on base: 'Nil') with value of type 'bool'.

felixscheffer avatar Apr 02 '22 23:04 felixscheffer

I believe those errors when switching to showcase.tscn are caused by Godot itself, but the rest should be fixed with #73

addmix avatar Apr 08 '22 20:04 addmix

This is tricky. Some of these errors are also there in 3.4, these mostly come from the 2.8.2 release trying to fix the orphan nodes issues. Not only the issue wasn't completely fixed, it also unintentionally broke compatibility with existing projects. At this point, I'm wondering if I shouldn't just scrap all the releases since 2.8.2 and do a proper 3.0 release that breaks compatibility.

HungryProton avatar Apr 10 '22 08:04 HungryProton

  1. Zylann's Heightmap plugin uses Engine.get_version_info() to create backward compatibility. Maybe that's something Scatter could use too.
var v = Engine.get_version_info()
return v.major == 3 and v.minor >= 2 and v.minor <= 5
  1. My feeling is that Util.get_node_by_class_path() is a bit of a hack. Maybe we should ask the Godot team to provide an API method to get the control. It might be something that other plugins could use as well.

felixscheffer avatar Apr 10 '22 22:04 felixscheffer

Util.get_node_by_class_path() is absolutely a hack. I only managed to find the difference in the old class path, and the new class path, by finding the SpatialEditor node (which is unique) and navigating up from there. Godot having an API to navigate the editor tree, and attach to common points would help plugin development greatly, but is also overshadowed by 4.0 having multi window support. In the meantime, before 4.0, I think we might as well just find the SpatialEditor node directly, and avoid the class path altogether.

addmix avatar Apr 11 '22 02:04 addmix

These are actually two issues, the first issue with the errors when enabling scatter is caused by a change in the editor, there is a second HSplitContainer in the path. I didn't track down what was causing the second set of errors from opening showcase.tscn, as it seems to be completely unrelated to the 3.5 editor changes.

addmix avatar Apr 11 '22 03:04 addmix

Some of these errors are also there in 3.4, these mostly come from the 2.8.2 release trying to fix the orphan nodes issues. Not only the issue wasn't completely fixed, it also unintentionally broke compatibility with existing projects. I may have a fix for these, I'll try to push a release with addmix PR if everything goes well.

HungryProton avatar Apr 20 '22 08:04 HungryProton

#73 Has been fixed to preserve compatibility. I've tested and it works with 3.4 and 3.5, and it should work with pre-3.4 as there weren't any editor changes (to my knowledge)

addmix avatar May 18 '22 18:05 addmix

I tested with Godot 3.5 RC 6 and Scatter master and no longer get any error messages. :+1: Thanks everybody!

felixscheffer avatar Jul 21 '22 12:07 felixscheffer