add a generic fallback for gamebaseObject spawning via the "add" menu that fills in a generalized datablkock dropdown popup based on class name if a specified one does not exist

This commit is contained in:
AzaezelX 2023-11-09 11:51:58 -06:00
parent fbcfe02098
commit 373508f622
2 changed files with 16 additions and 3 deletions

View file

@ -1079,6 +1079,14 @@ function ObjectBuilderGui::buildObject(%this, %className)
%this.process();
}
function ObjectBuilderGui::buildGameBaseObject(%this, %className)
{
%this.objectClassName = %className;
//assumes we fgollow the pattern of class is instance, classData is datablock
%this.addField("dataBlock", "TypeDataBlock", "Data block", %className @"Data");
%this.process();
}
//------------------------------------------------------------------------------
// Environment
//------------------------------------------------------------------------------

View file

@ -507,10 +507,15 @@ function EditorGui::buildMenus(%this)
%class = %class;
%method = "build" @ %buildfunc;
if( !ObjectBuilderGui.isMethod( %method ) )
%method = "build" @ %class;
%method = "build" @ %class;
if( !ObjectBuilderGui.isMethod( %method ) )
%cmd = "return new " @ %class @ "();";
{
if (isMemberOfClass(%class,"gameBase"))
%cmd = "ObjectBuilderGui.buildGameBaseObject("@ %class @");";
else
%cmd = "return new " @ %class @ "();";
}
else
%cmd = "ObjectBuilderGui." @ %method @ "();";