diff --git a/Engine/source/T3D/SceneGroup.cpp b/Engine/source/T3D/SceneGroup.cpp index 3efa80d7a..5dc0e6fec 100644 --- a/Engine/source/T3D/SceneGroup.cpp +++ b/Engine/source/T3D/SceneGroup.cpp @@ -116,6 +116,8 @@ void SceneGroup::inspectPostApply() void SceneGroup::onInspect(GuiInspector* inspector) { + Parent::onInspect(inspector); + //Put the SubScene group before everything that'd be SubScene-effecting, for orginazational purposes GuiInspectorGroup* sceneGroupGrp = inspector->findExistentGroup(StringTable->insert("SceneGroup")); if (!sceneGroupGrp) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/worldEditor.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/worldEditor.ed.tscript index 817a29e14..69678c833 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/worldEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/worldEditor.ed.tscript @@ -554,3 +554,77 @@ function simGroup::onInspectPostApply(%this) %this.callOnChildren("setHidden",%this.hidden); %this.callOnChildren("setLocked",%this.locked); } + +function simGroup::SelectFiteredObjects(%this, %min, %max) +{ + EWorldEditor.clearSelection(); + %this.callOnChildren("filteredSelect", %min, %max ); +} + +function SceneObject::filteredSelect(%this, %min, %max) +{ + %box = %this.getWorldBox(); + %xlength = mAbs(getWord(%box,0) - getWord(%box,3)); + %ylength = mAbs(getWord(%box,1) - getWord(%box,4)); + %Zlength = mAbs(getWord(%box,2) - getWord(%box,5)); + %diagSq = mPow(%xlength,2)+mPow(%ylength,2)+mPow(%Zlength,2); + if (%diagSq > mPow(%min,2) && %diagSq < mPow(%max,2)) + { + EWorldEditor.selectObject(%this); + } +} + +function simGroup::onInspect(%obj, %inspector) +{ + //Find the 'Editing' group in the inspector + %group = %inspector.findExistentGroup("Editing"); + if(isObject(%group)) + { + //We add a field of the type 'SimGroupSelectionButton'. This isn't a 'real' type, so when the inspector group tries to add it + //it will route down through GuiInspectorGroup(the namespace of %group) and call onConstructField in an attemp to see if there's any + //script defined functions that can build a field of that type. + //We happen to define the required 'build @ @ Field()' function below, allowing us to build out the custom field type + %group.addField("minSize", "F32", "min diagonal size of objects"); + %group.addField("maxSize", "F32", "max diagonal size of objects"); + %group.addField("select", "SimGroupSelectionButton", "Select filtered objects"); + } +} + +function GuiInspectorGroup::buildSimGroupSelectionButtonField(%this, %fieldName, %fieldLabel, %fieldDesc, + %fieldDefaultVal, %fieldDataVals, %callback, %ownerObj) +{ + %container = new GuiControl() { + canSaveDynamicFields = "0"; + Profile = "EditorContainerProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "0 0"; + Extent = "300 18"; + MinExtent = "8 2"; + canSave = "0"; + Visible = "1"; + hovertime = "100"; + tooltip = "";// %tooltip; + tooltipProfile = "EditorToolTipProfile"; + + new GuiButtonCtrl() { + canSaveDynamicFields = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "16 3"; + Extent = "300 18"; + MinExtent = "8 2"; + canSave = "0"; + Visible = "1"; + hovertime = "100"; + tooltip = ""; //%tooltip; + tooltipProfile = "EditorToolTipProfile"; + text = %fieldName; + maxLength = "1024"; + command = %ownerObj @ ".SelectFiteredObjects("@ %ownerObj.minSize @","@ %ownerObj.maxSize @");"; + }; + }; + + %this-->stack.add(%container); +}