public static void EditorOpenDeclarationInTorsion(SimObject xobject) { string fileName = xobject.getFilename(); if (fileName == "") return; EditorOpenFileInTorsion(omni.Util.makeFullPath(fileName, "'"), xobject.getDeclarationLine().AsString()); }
public void setProfileDirty(SimObject profile, bool value, bool noCheck) { PersistenceManager GuiEditorProfilesPM = "GuiEditorProfilesPM"; GuiEditorProfiles.GuiEditorProfilesTree GuiEditorProfilesTree = "GuiEditorProfilesTree"; GuiEditorProfiles.GuiEditorProfileChangeManager GuiEditorProfileChangeManager = "GuiEditorProfileChangeManager"; if (!GuiEditorProfilesPM.isObject()) GuiEditorProfilesPM = new ObjectCreator("PersistenceManager", "GuiEditorProfilesPM").Create(); if (value) { if (!GuiEditorProfilesPM.isDirty(profile) || noCheck) { // If the profile hasn't yet been associated with a file, // put it in the default file. if (profile.getFilename() == "") profile.setFilename(sGlobal["$GUI_EDITOR_DEFAULT_PROFILE_FILENAME"]); // Add the profile to the dirty set. GuiEditorProfilesPM.setDirty(profile); // Show the item as dirty in the tree. int id = GuiEditorProfilesTree.findItemByValue(profile.getId().AsString()); GuiEditorProfilesTree.editItem(id, GuiEditorProfilesTree.getItemText(id) + ' ' + "*", profile.getId().AsString()); // Count the number of unsaved profiles. If this is // the first one, indicate in the window title that // we have unsaved profiles. this.increaseNumDirtyProfiles(); } } else { if (GuiEditorProfilesPM.isDirty(profile) || noCheck) { // Remove from dirty list. GuiEditorProfilesPM.removeDirty(profile); // Clear the dirty marker in the tree. int id = GuiEditorProfilesTree.findItemByValue(profile.getId().AsString()); string text = GuiEditorProfilesTree.getItemText(id); GuiEditorProfilesTree.editItem(id, Util.getSubStr(text, 0, Util.strlen(text) - 2), profile.getId().AsString()); // Count saved profiles. If this was the last unsaved profile, // remove the unsaved changes indicator from the window title. this.decreaseNumDirtyProfiles(); // Remove saved edits from the change manager. GuiEditorProfileChangeManager.clearEdits(profile); } } }
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 saveProfile(SimObject profile, string fileName) { PersistenceManager GuiEditorProfilesPM = "GuiEditorProfilesPM"; if (!GuiEditorProfilesPM.isObject()) GuiEditorProfilesPM = new ObjectCreator("PersistenceManager", "GuiEditorProfilesPM").Create(); if (!GuiEditorProfilesPM.isDirty(profile) && (fileName == "" || fileName == profile.getFilename())) return; // Update the filename, if requested. if (fileName != "") { profile.setFilename(fileName); GuiEditorProfilesPM.setDirty(profile, fileName); } // Save the object. GuiEditorProfilesPM.saveDirtyObject(profile); // Clear its dirty state. this.setProfileDirty(profile, false, true); }