|
@@ -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 @ <fieldTypeName> @ 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);
|
|
|
+}
|