mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Fixed SceneGroup onInspect call to call up through parent
Adds utility methods and SimGroup onInspect injection to add a select button in inspector to select objects under simgroup
This commit is contained in:
parent
4bb26bf96c
commit
6ff92f61bb
2 changed files with 76 additions and 0 deletions
|
|
@ -116,6 +116,8 @@ void SceneGroup::inspectPostApply()
|
||||||
|
|
||||||
void SceneGroup::onInspect(GuiInspector* inspector)
|
void SceneGroup::onInspect(GuiInspector* inspector)
|
||||||
{
|
{
|
||||||
|
Parent::onInspect(inspector);
|
||||||
|
|
||||||
//Put the SubScene group before everything that'd be SubScene-effecting, for orginazational purposes
|
//Put the SubScene group before everything that'd be SubScene-effecting, for orginazational purposes
|
||||||
GuiInspectorGroup* sceneGroupGrp = inspector->findExistentGroup(StringTable->insert("SceneGroup"));
|
GuiInspectorGroup* sceneGroupGrp = inspector->findExistentGroup(StringTable->insert("SceneGroup"));
|
||||||
if (!sceneGroupGrp)
|
if (!sceneGroupGrp)
|
||||||
|
|
|
||||||
|
|
@ -554,3 +554,77 @@ function simGroup::onInspectPostApply(%this)
|
||||||
%this.callOnChildren("setHidden",%this.hidden);
|
%this.callOnChildren("setHidden",%this.hidden);
|
||||||
%this.callOnChildren("setLocked",%this.locked);
|
%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);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue