mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-04 20:15:16 +00:00
Adds creator callback integration to pair with the base UI module having shortcut creator entries in the GUIEditor for creating stuff like the UINavigation containers, or MenuList controls with the namespace hooks already established.
This commit is contained in:
parent
07b3e2789e
commit
5f871763fb
4 changed files with 81 additions and 1 deletions
|
|
@ -85,6 +85,9 @@ function UI::initClient(%this)
|
|||
%this.queueExec("./scripts/help");
|
||||
%this.queueExec("./scripts/cursors");
|
||||
%this.queueExec("./scripts/utility");
|
||||
|
||||
if(isToolBuild())
|
||||
%this.queueExec("./tools/creator.tscript");
|
||||
}
|
||||
|
||||
function UI::onCreateClientConnection(%this){}
|
||||
|
|
|
|||
61
Templates/BaseGame/game/data/UI/tools/creator.tscript
Normal file
61
Templates/BaseGame/game/data/UI/tools/creator.tscript
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
function UI::loadModuleCreatorClasses(%this)
|
||||
{
|
||||
AssetBrowser.beginCreatorGroup( "BaseUI", "GuiEditor" );
|
||||
AssetBrowser.addCreatorClass("GuiContainer", "UINavigation Container", "UINavContainer" );
|
||||
AssetBrowser.addCreatorClass("GuiContainer", "Menu List", "GUIMenuList" );
|
||||
AssetBrowser.addCreatorClass("GuiStackControl", "Stack Menu List", "GuiStackMenuList" );
|
||||
AssetBrowser.addCreatorClass("GuiContainer", "Menu Input Button Handler", "MenuInputBtnHandler" );
|
||||
AssetBrowser.addCreatorClass("GuiIconButtonCtrl", "Menu Input Button", "MenuInputBtn" );
|
||||
AssetBrowser.endCreatorGroup();
|
||||
}
|
||||
|
||||
|
||||
function ObjectBuilderGui::buildUINavContainer(%this)
|
||||
{
|
||||
%ctrl = new GuiContainer()
|
||||
{
|
||||
superClass = "UINavigation";
|
||||
};
|
||||
|
||||
return %ctrl;
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::buildGUIMenuList(%this)
|
||||
{
|
||||
%ctrl = new GuiContainer()
|
||||
{
|
||||
superClass = "MenuList";
|
||||
};
|
||||
|
||||
return %ctrl;
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::builduiStackMenuList(%this)
|
||||
{
|
||||
%ctrl = new GuiStackControl()
|
||||
{
|
||||
superClass = "MenuList";
|
||||
};
|
||||
|
||||
return %ctrl;
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::buildMenuInputBtnHandler(%this)
|
||||
{
|
||||
%ctrl = new GuiContainer()
|
||||
{
|
||||
class = "MenuInputButtonContainer";
|
||||
};
|
||||
|
||||
return %ctrl;
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::buildMenuInputBtn(%this)
|
||||
{
|
||||
%ctrl = new GuiIconButtonCtrl()
|
||||
{
|
||||
class = "MenuInputButton";
|
||||
};
|
||||
|
||||
return %ctrl;
|
||||
}
|
||||
|
|
@ -2517,7 +2517,14 @@ function GuiEditor::onControlDropped(%this, %payload, %position)
|
|||
else
|
||||
{
|
||||
%className = %payload.assetName;
|
||||
if(%payload.altCommand !$= "")
|
||||
{
|
||||
%cmd = %payload.altCommand;
|
||||
}
|
||||
else
|
||||
{
|
||||
%cmd = "return new " @ %className @ "();";
|
||||
}
|
||||
%ctrl = eval( %cmd );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@ function AssetBrowser::loadCreatorClasses(%this)
|
|||
%this.creatorClassArray.sort(true);
|
||||
|
||||
%guiClasses.delete();
|
||||
|
||||
callOnModules("loadModuleCreatorClasses");
|
||||
}
|
||||
|
||||
function AssetBrowser::beginCreatorGroup(%this, %group, %editor)
|
||||
|
|
@ -185,7 +187,14 @@ function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc)
|
|||
%cmd = "ObjectBuilderGui.build" @ %buildfunc @ "();";
|
||||
}
|
||||
|
||||
%buildfunc = "ObjectBuilderGui.newObjectCallback = \"AssetBrowser.onFinishCreateObject\"; ObjectCreator.createObject( \"" @ %cmd @ "\" );";
|
||||
if(GuiEditorIsActive())
|
||||
{
|
||||
%buildfunc = "return " @ %cmd;
|
||||
}
|
||||
else
|
||||
{
|
||||
%buildfunc = "ObjectBuilderGui.newObjectCallback = \"AssetBrowser.onFinishCreateObject\"; ObjectCreator.createObject( \"" @ %cmd @ "\" );";
|
||||
}
|
||||
|
||||
%args = new ScriptObject();
|
||||
%args.val[0] = %class;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue