The plugin registers the ModPlayer node twice (uses both `class_name` and `add_custom_type`)

Issue #7 resolved
Rémi Verschelde created an issue

The plugin registers the ModPlayer node under the GodotModPlayer name:

func _enter_tree( ):
    self.add_custom_type( "GodotModPlayer", "Node", preload("ModPlayer.gd"), preload("icon.png") )

func _exit_tree( ):
    self.remove_custom_type( "GodotModPlayer" )

But ModPlayer.gd also registers itself globally already with class_name ModPlayer.

This means that both names are registered in the Create New Node dialog:

You could remove the add_custom_type / remove_custom_type and only rely on class_name (+ @icon for the icon).

That seems to be the approach you’re using for the Godot 3 plugin.

The GMP.gd plugin file then because pretty much empty, but it seems to still work to make enabling the global class name ModPlayer conditional to having enabled the plugin, I guess Godot has some special logic for that.

Comments (1)

  1. きのもと結衣 repo owner

    Remove plugin boilerplate, only class_name is needed

    The has_main_screen would cause a "Godot Mod Player" tab to be added to the editor, but with no contents.

    And the add_custom_type call would register a GodotModPlayer type when we already have ModPlayer as global via class_name.

    Fixes #7.

    → <<cset 1f12b5b3c07d>>

  2. Log in to comment