public void previewSelected(SimObject preview) { GuiTextListCtrl CL_levelList = "CL_levelList"; if (preview.isObject() && preview["levelIndex"] != "") CL_levelList.setSelectedRow(preview["levelIndex"].AsInt()); else CL_levelList.setSelectedRow(-1); // Set the large preview image if (preview.isObject() && preview["bitmap"] != "") ((GuiBitmapCtrl) this.findObjectByInternalName("CurrentPreview", false)).setBitmapX(preview["bitmap"]); else ((GuiBitmapCtrl) this.findObjectByInternalName("CurrentPreview", false)).setBitmapX("art/gui/no-preview"); // Set the current level name if (preview.isObject() && preview["levelName"] != "") ((GuiTextCtrl) this.findObjectByInternalName("LevelName", false)).setText(preview["levelName"]); else ((GuiTextCtrl) this.findObjectByInternalName("LevelName", false)).setText("Level"); // Set the current level description if (preview.isObject() && preview["levelDesc"] != "") ((GuiMLTextCtrl) this.findObjectByInternalName("LevelDescription", false)).setText(preview["levelDesc"]); else ((GuiMLTextCtrl) this.findObjectByInternalName("LevelDescription", false)).setText("A Torque Level"); }
public void onSelect(SimObject obj) { EditorTree EditorTree = "EditorTree"; EditorTree.addSelection(obj, true); Util.setShadowVizLight(obj); if (obj.isObject() && obj.isMethod("onEditorSelect")) obj.call("onEditorSelect", getSelectionSize().AsString()); EditorGui EditorGui = "EditorGui"; EditorGui.currentEditor.onObjectSelected(obj); // Inform the camera console.commandToServer("EditorOrbitCameraSelectChange", new string[] {getSelectionSize().AsString(), getSelectionCentroid().AsString()}); EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar"; EditorGuiStatusBar.setSelectionObjectsByCount(getSelectionSize().AsString()); // Update the materialEditorList iGlobal["$Tools::materialEditorList"] = obj.getId(); // Used to help the Material Editor( the M.E doesn't utilize its own TS control ) // so this dirty extension is used to fake it, just like the women I use to date... GuiWindowCollapseCtrl womanIUseToDate = "MaterialEditorPreviewWindow"; GuiControl theOtherTramp = "MaterialEditorGui"; if (womanIUseToDate.isVisible()) theOtherTramp.call("prepareActiveObject"); // Update the Transform Selection window ETransformSelection ETransformSelection = "ETransformSelection"; ETransformSelection.onSelectionChanged(); }
public void add(SimObject objectx, string oldParent, string newParent) { int index = this.numObjects; this["objects[" + index + "]"] = objectx; this["oldParents[" + index + "]"] = oldParent; this["newParents[" + index + "]"] = newParent; this.numObjects = this.numObjects + 1; }
public override bool handleRenameObject(string newName, SimObject xobject) { GuiInspector inspector = console.Call_Classname("GuiInspector", "findByObject", new string[] {xobject}); if (inspector.isObject()) { string field = (this["renameInternal"].AsBool()) ? "internalName" : "name"; inspector.setObjectField(field, newName); return true; } return false; }
public static int alphaIconCompare(SimObject a, SimObject b) { if (a["class"] == "CreatorFolderIconBtn") { if (b["class"] != "CreatorFolderIconBtn") return -1; } if (b["class"] == "CreatorFolderIconBtn") { if (a["class"] != "CreatorFolderIconBtn") return 1; } int result = omni.Util.stricmp(a["text"], b["text"]); return result; }
public override bool onDeleteObject(SimObject objectx) { Creator.EWCreatorWindow EWCreatorWindow = "EWCreatorWindow"; SimGroup MissionGroup = "MissionGroup"; // Don't delete locked objects if (objectx["locked"].AsBool()) return true; if (objectx == EWCreatorWindow["objectGroup"]) EWCreatorWindow.setNewObjectGroup(MissionGroup); // Append it to our list. this.undoDeleteList = this.undoDeleteList + '\t' + objectx; // We're gonna delete this ourselves in the // completion callback. return true; }
public virtual void onDblClick(SimObject obj) { }
public void onUnSelect(SimObject obj) { EditorGui EditorGui = "EditorGui"; Inspector Inspector = "Inspector"; EditorTree EditorTree = "EditorTree"; EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar"; ETransformSelection ETransformSelection = "ETransformSelection"; if (obj.isObject() && obj.isMethod("onEditorUnselect")) obj.call("onEditorUnselect"); EditorGui.currentEditor.onObjectDeselected(obj); Inspector.removeInspect(obj); EditorTree.removeSelection(obj); // Inform the camera console.commandToServer("EditorOrbitCameraSelectChange", new string[] {getSelectionSize().AsString(), getSelectionCentroid().AsString()}); EditorGuiStatusBar.setSelectionObjectsByCount(getSelectionSize().AsString()); // Update the Transform Selection window ETransformSelection.onSelectionChanged(); }
public string GetTooltipParticleEmitterNode(SimObject obj) { string text = "Datablock: " + obj["dataBlock"]; text = text + '\n' + "Emitter: " + obj["emitter"]; return text; }
public void inspect(SimObject obj) { string name = ""; if (obj.isObject()) name = obj.getName(); else ((GuiMLTextCtrl) "RoadFieldInfoControl").setText(""); //RoadInspectorNameEdit.setValue( %name ); base.inspect(obj); }
public string GetTooltipSFXEmitter(SimObject obj) { if (obj["fileName"] == "") return "Track: " + obj["track"]; else return "File: " + obj["fileName"]; }
public string GetTooltipWorldEditorSelection(SimObject obj) { string text = "Objects: " + obj.call("getCount"); if (!obj.getCanSave()) text = text + '\n' + "Persistent: No"; else text = text + '\n' + "Persistent: Yes"; return text; }
public virtual void onAddSelected(SimObject obj) { ((EditorTree) "EditorTree").addSelection(obj, true); }
public string getLastTagField(SimObject material) { string tagField = ""; for (int i = 0; material.getFieldValue("materialTag" + i, -1) != ""; i++) tagField = "materialTag" + i; return tagField; }
public string getLastValidTagField(SimObject material, string invalidTag) { string tag, tagField = ""; for (int i = 0; material.getFieldValue("materialTag" + i, -1) != ""; i++) { tag = material.getFieldValue("materialTag" + i, -1); // Can't equal our invalid tag if (tag == invalidTag) continue; // Set our last found tag tagField = "materialTag" + i; } return tagField; }
public string getTagField(SimObject material, string tag) { string tagField = ""; for (int i = 0; material.getFieldValue("materialTag" + i, -1) != ""; i++) { string loopTag = material.getFieldValue("materialTag" + i, -1); if (tag == loopTag) { tagField = "materialTag" + i; break; } } return tagField; }
public void deleteMaterial(SimObject materialName, ArrayObject secondFilter, string secondFilterName) { ArrayObject MaterialFilterAllArray = "MaterialFilterAllArray"; ArrayObject UnlistedMaterials = "UnlistedMaterials"; PersistenceManager MaterialSelectorPerMan = "MaterialSelectorPerMan"; GuiCheckBoxCtrl MaterialFilterAllArrayCheckbox = "MaterialFilterAllArrayCheckbox"; GuiDynamicCtrlArrayControl filterArray = this.FOT("filterArray"); if (!materialName.isObject()) return; for (int i = 0; i <= MaterialFilterAllArray.countValue(materialName); i++) { int index = MaterialFilterAllArray.getIndexFromValue(materialName); MaterialFilterAllArray.erase(index); } MaterialFilterAllArrayCheckbox.setText("All ( " + (MaterialFilterAllArray.count() - 1) + " ) "); GuiCheckBoxCtrl checkbox = secondFilter + "Checkbox"; for (int k = 0; k <= secondFilter.countValue(materialName); k++) { int index = secondFilter.getIndexFromValue(materialName); secondFilter.erase(index); } checkbox.setText(secondFilterName + " ( " + (secondFilter.count() - 1) + " ) "); for (int i = 0; materialName.getFieldValue("materialTag" + i, -1) != ""; i++) { string materialTag = materialName.getFieldValue("materialTag" + i, -1); for (uint j = (uint) this.staticFilterObjects; j < filterArray.getCount(); j++) { if (materialTag == ((SimObject) ((SimSet) filterArray.getObject(j)).getObject(0))["filter"]) { int count = Util.getWord(((GuiCheckBoxCtrl) ((SimSet) filterArray.getObject(j)).getObject(0)).getText(), 2).AsInt(); count--; ((GuiCheckBoxCtrl) ((SimSet) filterArray.getObject(j)).getObject(0)).setText(materialTag + " ( " + count + " )"); } } } UnlistedMaterials.add("unlistedMaterials", materialName); if (materialName.getFilename() != "" && materialName.getFilename() != "tools/gui/MaterialSelector.ed.gui" && materialName.getFilename() != "tools/materialEditor/scripts/materialEditor.ed.cs") { MaterialSelectorPerMan.removeObjectFromFile(materialName); MaterialSelectorPerMan.saveDirty(); } this.preloadFilter(); //MaterialSelector.selectMaterial( "WarningMaterial" ); }
public void updateSelection(SimObject material, string previewImagePath) { GuiDynamicCtrlArrayControl filterArray = this.FOT("filterArray"); GuiDynamicCtrlArrayControl materialCategories = this.FOT("materialCategories"); GuiTextCtrl previewSelectionText = this.FOT("previewSelectionText"); GuiBitmapCtrl previewSelection = this.FOT("previewSelection"); // the material selector will visually update per material information // after we move away from the material. eg: if we remove a field from the material, // the empty checkbox will still be there until you move fro and to the material again bool isMaterialBorder = false; isMaterialBorder = this.FOT(material + "Border").isObject(); if (isMaterialBorder) ((GuiButtonCtrl) this.FOT(material + "Border")).setStateOn(true); bool isMaterialBorderPrevious = false; isMaterialBorderPrevious = this.FOT(sGlobal["$prevSelectedMaterialHL"] + "Border").isObject(); if (isMaterialBorderPrevious) ((GuiButtonCtrl) this.FOT(sGlobal["$prevSelectedMaterialHL"] + "Border")).setStateOn(false); materialCategories.deleteAllObjects(); this.selectedMaterial = material; this.selectedPreviewImagePath = previewImagePath; previewSelectionText.setText(material.name); previewSelection.setBitmapX(previewImagePath); // running through the existing list of categorynames in the left, so yes // some might exist on the left only temporary if not given a home for (uint i = (uint) this.staticFilterObjects; i < filterArray.getCount(); i++) { string filter = ((SimObject) ((SimSet) filterArray.getObject(i)).getObject(0))["filter"]; #region GuiCheckBoxCtrl () oc_Newobject72 ObjectCreator oc_Newobject72 = new ObjectCreator("GuiCheckBoxCtrl", ""); oc_Newobject72["materialName"] = material.name; oc_Newobject72["Profile"] = "ToolsGuiCheckBoxListProfile"; oc_Newobject72["position"] = "5 2"; oc_Newobject72["Extent"] = "118 18"; oc_Newobject72["Command"] = "MaterialSelector.updateMaterialTags( $ThisControl.materialName, $ThisControl.getText(), $ThisControl.getValue() );"; oc_Newobject72["text"] = filter; #endregion GuiCheckBoxCtrl checkbox = oc_Newobject72.Create(); materialCategories.add(checkbox); // crawl through material for categories in order to check or not bool filterFound = false; for (int j = 0; material.getFieldValue("materialTag" + j, -1) != ""; j++) { string tag = material.getFieldValue("materialTag" + j, -1); if (tag == filter) { filterFound = true; break; } } if (filterFound) checkbox.setStateOn(true); else checkbox.setStateOn(false); } sGlobal["$prevSelectedMaterialHL"] = material; }
public virtual void onClick(SimObject obj) { Inspector Inspector = "Inspector"; Inspector.inspect(obj); }
public void inspect(SimObject obj) { GuiMLTextCtrl MissionAreaFieldInfoControl = "MissionAreaFieldInfoControl"; string name = ""; if (obj.isObject()) name = obj.getName(); else MissionAreaFieldInfoControl.setText(""); //RiverInspectorNameEdit.setValue( %name ); base.inspect(obj); }
public virtual void onEndDrag(SimObject obj) { Inspector Inspector = "Inspector"; Inspector.inspect(obj); Inspector.apply(); }
public virtual void onObjectRemoved(SimObject objectx){}
public virtual bool onDeleteObject(SimObject objectx){return "0".AsBool();}
public static void SafeDeleteCallback(SimObject obj) { obj.delete(); AI.aiscreated--; }
public static void EditorOpenDeclarationInTorsion(SimObject xobject) { string fileName = xobject.getFilename(); if (fileName == "") return; EditorOpenFileInTorsion(omni.Util.makeFullPath(fileName, "'"), xobject.getDeclarationLine().AsString()); }
public virtual void onRightMouseUp(int itemId, string mousePos, SimObject objectx){}
public virtual void onObjectAdded(SimObject objectx){}
public virtual bool canRenameObject(SimObject objectx){return "0".AsBool();}
public void revertEdits(SimObject profile) { for (uint i = 0; i < this.getCount(); i ++) { SimObject obj = this.getObject(i); if (obj["profile"] != profile) continue; profile.setFieldValue(obj["fieldName"], obj["oldValue"], obj["arrayIndex"].AsInt()); obj.delete(); i --; } }
public virtual bool handleRenameObject(string newName, SimObject objectx){return "0".AsBool();}