[Feature Request] Custom Properties for GUIs and GUI controls

Started by vga256, Wed 20/07/2022 19:46:41

Previous topic - Next topic

vga256

I'm not sure if this is a reasonable or easily implementable request, so this is more of an RFC for the time being: would it be possible to add Custom Properties for GUIs and GUI controls in the editor? I'm working on a game that is extremely GUI-heavy, and one of the pain points is being unable to assign custom properties to GUIs and controls that would allow me to customize behaviour for each control.

For example, I have the "Expandable" property which applies to window GUIs. This allows a window to be maximized, minimized, and returned to a standard size. Right now, I keep track of this via a huge struct array that I have to manually populate in script like this:

Code: ags

  Windows[gDottedWindow.ID].Vertical = new WindowExpansion;
  Windows[gDottedWindow.ID].guiID = gDottedWindow.ID;
  Windows[gDottedWindow.ID].Panel = RightPanel;
  Windows[gDottedWindow.ID].Vertical.ExpandedSize = gDottedWindow.Height;
  Windows[gDottedWindow.ID].Vertical.CollapsedSize = WINDOW_TITLEBAR_HEIGHT;
  gDottedWindow.AddToStack();


Ideally, I'd love to be able to do something like this instead:
Via the editor, create "IsExpandable" and "ExpansionState" boolean custom properties to all GUIs.

Then in code I could call it like this:

Code: ags

if (currentGUISelected.GetProperty("IsExpandable"))
{
    ExpandGUI(currentGUISelected);
    currentGUISelected.GetProperty("ExpansionState") = true;
}


I would no longer have to keep track of each GUIs properties via an array of struct, and this would make GUIs more consistent with how Rooms are designed.

Welcoming any thoughts on this idea.

Crimson Wizard

I guess it's pretty much okay to add Custom Properties to all remaining object types (including GUI, Regions, walkable areas, and whatnot).

I should only note that for "AGS 4" we had an idea of creating a full object hierarchy, where everything goes from same parent type(s), similar to how every gui control inherits GUIControl base type. In that case Get/SetProperty functions might be added to the parent and become available for all at once.

vga256

Thanks for the feedback CW.

Hearing no objections to the idea, please consider this as a feature request for a future release of 3.6.x! :)

Crimson Wizard

Quote from: vga256 on Sun 24/07/2022 16:03:32
Hearing no objections to the idea, please consider this as a feature request for a future release of 3.6.x! :)

I think our current thought is to shift to developing "AGS 4" and only keep 3.* branch for perfomance improvements. This is way long overdue.

vga256

Quote from: Crimson Wizard on Sun 24/07/2022 17:01:04
I think our current thought is to shift to developing "AGS 4" and only keep 3.* branch for perfomance improvements. This is way long overdue.

Gotcha.

SMF spam blocked by CleanTalk