Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

GMC Breaking Change: Script inherits from native type 'Control'

95 views
Skip to first unread message

Anthony van Winkle

unread,
Jan 10, 2025, 7:16:07 PMJan 10
to MPF Users
I've just pushed a breaking change to the GMC main branch, and it will impact the upcoming version 0.1.3 in the AssetLib in Godot. If you have a GMC project, this affects you!

I've been working on better support for Themes so that text (and other elements) can be styled in a theme and propagated to child nodes without having to manually define font size, color, etc on every single Label and MPFVariable. Hurray!

The bad news is that I learned that Godot Theme propagation only applies through an unbroken hierarchy of Control nodes. Any non-Control node (e.g. Node2D) in the tree will break the propagation and children of the non-Control node will not inherit the theme of any Control-based ancestors.

While many GMC classes already use Control-based nodes as their base, unfortunately there are a few that are derived from Node2D—which means they (and their children) will not inherit a theme. Dang it!

So I've converted the following nodes to derive from Control: 
  • MPFCarousel
  • MPFChildPool
  • MPFConditional
  • MPFConditionalChildren
  • MPFEventHandler
If you have any of these nodes in a scene, IT WILL BREAK and you'll get a crash with the error "Script inherits from native type 'Control', so it can't be assigned to an object of type: 'Node2D'"

Fortunately the fix for this is easy. Go to the offending scene and select the impacted node. Right-click and select "Change Type..." and then re-select the same type of MPF node it already is (e.g. if it's MPFCarousel, select MPFCarousel).

You'll know whether a node is updated or not if you select it and look in the Inspector panel. Below the MPF-specific properties are the parent node properties, and it will either be Control or Node2D. If it's Node2D, re-set its type.

My apologies for the inconvenience of this breaking change, I didn't realize that Themes required an unbroken Control ancestry and I think supporting theme inheritance is worth this one-time hassle. 

Please let me know if you encounter any issues, and thanks for using GMC!
Reply all
Reply to author
Forward
0 new messages