public void setEmitterDirty() { PersistenceManager PE_EmitterSaver = "PE_EmitterSaver"; this.text = "Emitter *"; this.dirty = true; SimObject emitter = this.currEmitter; if (emitter.getFilename() == "" || emitter.getFilename() == "tools/particleEditor/particleEmitterEditor.ed.cs") { PE_EmitterSaver.setDirty(emitter, sGlobal["$PE_EMITTEREDITOR_DEFAULT_FILENAME"]); } else { PE_EmitterSaver.setDirty(emitter); } }
public void setParticleDirty() { PersistenceManager PE_ParticleSaver = "PE_ParticleSaver"; this["text"] = "Particle *"; this.dirty = true; SimObject particle = this.currParticle; if (particle.getFilename() == "" || particle.getFilename() == "tools/particleEditor/particleParticleEditor.ed.cs") { PE_ParticleSaver.setDirty(particle, sGlobal["$PE_PARTICLEEDITOR_DEFAULT_FILENAME"]); } else { PE_ParticleSaver.setDirty(particle); } }
public void selectDatablock(SimObject datablock, bool add = false, bool dontSyncTree = false) { GuiTreeViewCtrl DatablockEditorTree = "DatablockEditorTree"; GuiInspector DatablockEditorInspector = "DatablockEditorInspector"; GuiWindowCollapseCtrl DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow"; EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar"; if (add) { DatablockEditorInspector.addInspect(datablock); } else { DatablockEditorInspector.inspect(datablock); } if (!dontSyncTree) { int id = DatablockEditorTree.findItemByValue(datablock); if (!add) { DatablockEditorTree.clearSelection(); } DatablockEditorTree.selectItem(id, true); DatablockEditorTree.scrollVisible(id); } this.syncDirtyState(); // Update the filename text field. int numSelected = this.getNumSelectedDatablocks(); GuiTextEditCtrl fileNameField = DatablockEditorInspectorWindow.findObjectByInternalName("DatablockFile", true); if (numSelected == 1) { string fileName = datablock.getFilename(); fileNameField.setText(fileName != "" ? fileName : omni.sGlobal["$DATABLOCK_EDITOR_DEFAULT_FILENAME"]); } else { fileNameField.setText(""); } EditorGuiStatusBar.setSelection(this.getNumSelectedDatablocks() + " Datablocks Selected"); }
public void deleteEmitter() { ParticleEditor ParticleEditor = "ParticleEditor"; SimObject emitter = this.currEmitter; // Create undo. ParticleEditorUndo.ActionDeleteEmitter action = ParticleEditor.createUndo <ParticleEditorUndo.ActionDeleteEmitter>("Delete Emitter"); action["emitter"] = emitter; action["emitterFname"] = emitter.getFilename(); ParticleEditor.submitUndo(action); // Execute action. action.redo(); }
public string getFullFilePath(GuiInspectorField field) { string fileName = field.getData(); GuiInspector inspector = field.getInspector(); SimObject objectx = inspector.getInspectObject(); if (objectx.isMemberOfClass("Material")) { // Image filenames in materials are relative to the material's file. string objectPath = Util.filePath(Util.makeFullPath(objectx.getFilename(), Util.getMainDotCsDir())); return(Util.makeFullPath(fileName, objectPath)); } else { return(Util.makeFullPath(fileName, Util.getMainDotCsDir())); } }
public void saveNewFileFinish(string newFileName) { GuiWindowCollapseCtrl DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow"; // Clear the first responder to capture any inspector changes GuiControl ctrl = ((GuiCanvas)"canvas").getFirstResponder(); if (ctrl.isObject()) { ctrl.clearFirstResponder(false); } GuiTreeViewCtrl tree = "DatablockEditorTree"; int count = tree.getSelectedItemsCount(); string selected = tree.getSelectedItemList(); foreach (string id in selected.Split(' ')) { //TODO SimObject db = tree.getItemValue(id.AsInt()); //db = this.getSelectedDatablock(); // Remove from current file. string oldFileName = db.getFilename(); if (oldFileName != "") { this.PM.removeObjectFromFile(db, oldFileName); } // Save to new file. this.PM.setDirty(db, newFileName); if (this.PM.saveDirtyObject(db)) { // Clear dirty state. this.flagDatablockAsDirty(db, false); } } ((GuiTextEditCtrl)DatablockEditorInspectorWindow.findObjectByInternalName("DatablockFile", true)).setText (newFileName); }
public void revert() { GuiControl GuiEditorContent = "GuiEditorContent"; if (GuiEditorContent.getCount() == 0) { return; } SimObject gui = GuiEditorContent.getObject(0); string filename = gui.getFilename(); if (filename == "") { return; } if (Util.messageBox("Revert Gui", "Really revert the current Gui? This cannot be undone.", "OkCancel", "Question") == iGlobal["$MROk"]) { this.load(filename); } }
public void deleteDatablock() { GuiTreeViewCtrl tree = "DatablockEditorTree"; editor Editor = "Editor"; // If we have more than single datablock selected, // turn our undos into a compound undo. int numSelected = tree.getSelectedItemsCount(); if (numSelected > 1) { Editor.getUndoManager().pushCompound("Delete Multiple Datablocks"); } for (int i = 0; i < numSelected; i++) { int id = tree.getSelectedItem(i); SimObject db = tree.getItemValue(id); string fileName = db.getFilename(); // Remove the datablock from the tree. tree.removeItem(id); // Create undo. UndoScriptAction action = this.createUndo <DatablockEditorUndo.ActionDeleteDatablock>("Delete Datablock"); action["db"] = db; action["dbName"] = db.getName(); action["fname"] = fileName; this.submitUndo(action); // Kill the datablock in the file. if (fileName != "") { this.PM.removeObjectFromFile(db); } ((SimSet)"UnlistedDatablocks").add(db); // Show some confirmation. if (numSelected == 1) { messageBox.MessageBoxOK("Datablock Deleted", "The datablock (" + db.getName() + ") has been removed from " + "it's file (" + db.getFilename() + ") and upon restart will cease to exist"); } } // Close compound, if we were deleting multiple datablocks. if (numSelected > 1) { Editor.getUndoManager().popCompound(); } // Show confirmation for multiple datablocks. if (numSelected > 1) { messageBox.MessageBoxOK("Datablocks Deleted", "The datablocks have been deleted and upon restart will cease to exist."); } // Clear selection. this.resetSelectedDatablock(); }