oamldev/oamlGodotModule

Making the oamlGodotModule Inherit from Node?

Andrettin opened this issue · 2 comments

Have you considered making the oamlGodotModule inherit from the Godot Node class, instead of from Reference? If so, were there any issues with doing so? Making it inherit from the Node class would make OAML slightly simpler to use it within Godot.

At present, OAML can only be used in Godot by instancing a variable within a script. Making it inherit from Node would have the following advantages:

  1. It would allow Godot scripts to "extend" the oamlGodotModule class, making it possible for it to be a singleton. At present to make an OAML singleton in Godot, it is necessary to e.g. create a script extending the Node base class itself, and having OAML there as a member variable.

  2. Scenes could instance OAML directly as nodes.

If you approve of the idea, I can make a pull request with the necessary changes.

Sounds fine to me.

In case this helps you, on my project I load OAML as follows:

oamlLoader.gd, a file with only:

func oamlNew():
	return oamlGodotModule.new()

loader.gd, this is my main loader script that includes this code:

	if (type_exists("oamlGodotModule")):
		music = load("scripts/oamlLoader.gd").new()
		oaml = music.oamlNew()
		oaml.init("oaml.defs")

Closed as the pull request has been merged.