Update of Particle Editor to standardize it up and utilize inspectors rather than adhoc guis

This commit is contained in:
JeffR 2025-12-21 16:39:19 -06:00
parent 1f5a4267ac
commit 12ebebff46
31 changed files with 5091 additions and 6095 deletions

View file

@ -0,0 +1,119 @@
//--- OBJECT WRITE BEGIN ---
$guiContent = new GuiControl(ContextedDropdownListGui) {
extent = "1280 720";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
isContainer = "1";
canSaveDynamicFields = "0";
horizSizing = "width";
vertSizing = "height";
new GuiMouseEventCtrl(ContextedDropdownListDecoy) {
extent = "1280 720";
minExtent = "8 8";
horizSizing = "width";
vertSizing = "height";
profile = "ToolsGuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
};
new GuiContainer(ContextedDropdownList) {
position = "472 151";
extent = "300 450";
profile = "ToolsGuiDefaultNonModalProfile";
tooltipProfile = "GuiToolTipProfile";
canSaveDynamicFields = "0";
minExtent = "300 350";
new GuiContainer() {
position = "25 25";
extent = "250 400";
profile = "IconDropdownProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "window";
horizSizing = "width";
vertSizing = "height";
new GuiTextCtrl() {
position = "0 3";
extent = "250 16";
horizSizing = "width";
profile = "ToolsGuiTextCenterProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "titleText";
};
new GuiContainer() {
position = "0 22";
extent = "250 20";
horizSizing = "width";
profile = "GuiDefaultProfile";
tooltipProfile = "GuiToolTipProfile";
new GuiTextEditCtrl() {
position = "3 0";
extent = "223 20";
horizSizing = "width";
profile = "ToolsGuiTextEditProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "textFilter";
validate = "ContextedDropdownListGui.updateFilterText();";
};
new GuiIconButtonCtrl() {
BitmapAsset = "ToolsModule:cross_image";
BitmapFile = "tools/gui/images/stencilIcons/cross.png";
sizeIconToButton = "1";
position = "227 0";
extent = "20 20";
horizSizing = "left";
profile = "ToolsGuiIconButtonSmallProfile";
tooltipProfile = "GuiToolTipProfile";
command = "ContextedDropdownListGui.clearFilterText();";
};
};
new GuiScrollCtrl() {
hScrollBar = "dynamic";
vScrollBar = "dynamic";
position = "7 44";
extent = "236 326";
horizSizing = "width";
vertSizing = "height";
profile = "ToolsGuiScrollProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "scroll";
new GuiTreeViewCtrl() {
itemHeight = "21";
position = "1 1";
extent = "220 2";
profile = "ToolsGuiTreeViewProfile";
tooltipProfile = "GuiToolTipProfile";
internalName = "tree";
showObjectIds = "0";
showClassNames = "0";
showTypeHints = "0";
showRoot = "0";
};
};
new GuiButtonCtrl() {
Text = "Select";
position = "6 376";
extent = "118 20";
vertSizing = "top";
profile = "ToolsGuiButtonProfile";
tooltipProfile = "GuiToolTipProfile";
Command = "ContextedDropdownListGui.select();";
};
new GuiButtonCtrl() {
Text = "Cancel";
position = "126 376";
extent = "117 20";
horizSizing = "left";
vertSizing = "top";
profile = "ToolsGuiButtonProfile";
tooltipProfile = "GuiToolTipProfile";
Command = "ContextedDropdownListGui.toggle();";
};
};
};
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,127 @@
if(!isObject( ContextedDropdownListActionMap ) )
{
new ActionMap(ContextedDropdownListActionMap){};
BaseUIActionMap.bindCmd( keyboard, Escape, "", "ContextedDropdownListGui.toggle();");
}
function ContextedDropdownListGui::onWake(%this)
{
%this.clearFilterText();
}
function ContextedDropdownListGui::show(%this, %listObject, %titleText, %selectCallback, %callerObject)
{
%this-->tree.open(%listObject, false);
%this-->tree.expandItem(1, true);
//Epxand any sub-categories as appropriate
foreach(%child in %listObject)
{
%childId = %this-->tree.findItemByObjectId(%child);
%this-->tree.expandItem(%childId, true);
}
%this.callback = %selectCallback;
%this-->titleText.setText(%titleText);
Canvas.pushDialog(ContextedDropdownListGui);
if(isObject(%callerObject))
{
%canvasExt = Canvas.getExtent();
%contextListExt = ContextedDropdownList.extent;
%callerGlobalPos = %callerObject.getGlobalPosition();
%decoyPad = ContextedDropdownList-->window.position;
%width = %callerObject.extent.x + %decoyPad;
if(%width < ContextedDropdownList.minExtent.x)
%width = ContextedDropdownList.minExtent.x;
%callerGlobalPos.x -= ContextedDropdownList-->window.position.x;
%callerGlobalPos.y -= ContextedDropdownList-->window.position.y - %callerObject.extent.y;
//bump us to fit to the screen if needbe
%xOvershoot = %callerGlobalPos.x + %contextListExt.x;
if(%xOvershoot > %canvasExt.x)
%callerGlobalPos.x -= %xOvershoot - %canvasExt.x;
//If we would go off the bottom of the screen, flip is to be above the callera object's position
%yOvershoot = %callerGlobalPos.y + %contextListExt.y;
if(%yOvershoot > %canvasExt.y)
{
%callerGlobalPos.y = %callerGlobalPos.y - %callerObject.extent.y - ContextedDropdownList.extent.y - %decoyPad.y;
}
ContextedDropdownList.resize(%callerGlobalPos.x, %callerGlobalPos.y, %width, ContextedDropdownList.extent.y);
}
%this-->scroll.scrollToTop();
%this-->Tree.clearSelection();
}
function ContextedDropdownListGui::seekText(%this, %text)
{
%itemId = %this-->Tree.findItemByName(%text);
%this-->Tree.scrollVisible(%itemId);
%this-->Tree.clearSelection();
%this-->Tree.addSelection(%itemId);
}
function ContextedDropdownListGui::seekItemObject(%this, %obj)
{
%itemId = %this-->Tree.findItemByObjectId(%obj.getId());
%this-->Tree.scrollVisible(%itemId);
%this-->Tree.clearSelection();
%this-->Tree.addSelection(%itemId);
}
function ContextedDropdownListGui::toggle(%this)
{
if ( ContextedDropdownListGui.isAwake() )
{
Canvas.popDialog(ContextedDropdownListGui);
}
else
{
Canvas.pushDialog(ContextedDropdownListGui);
}
}
function ContextedDropdownListDecoy::onMouseUp()
{
ContextedDropdownListGui.toggle();
}
function ContextedDropdownListDecoy::onRightMouseUp()
{
ContextedDropdownListGui.toggle();
}
function ContextedDropdownListGui::updateFilterText(%this)
{
%filterText = %this-->textFilter.getText();
%this-->tree.setFilterText(%filterText);
}
function ContextedDropdownListGui::clearFilterText(%this)
{
%this-->textFilter.setText("");
%this-->tree.setFilterText("");
}
function ContextedDropdownListGui::select(%this)
{
%obj = %this-->tree.getSelectedObject(0);
%command = %this.callback @ "(" @ %obj @ ");";
echo("SELECT COMMAND: " @ %command);
eval(%command);
ContextedDropdownListGui.toggle();
}
function ContextedDropdownListInputHandler::onInputEvent(%this)
{
ContextedDropdownListGui.toggle();
}