getName() 공개 메소드

public getName ( ) : string
리턴 string
        public void flagDatablockAsDirty(SimObject datablock, bool dirty)
        {
            GuiTreeViewCtrl tree = "DatablockEditorTree";

            int id = tree.findItemByValue(datablock.getId().AsString());

            if (id == 0)
            {
                return;
            }

            // Tag the item caption and sync the persistence manager.

            if (dirty)
            {
                tree.editItem(id, datablock.getName() + " *", datablock.getId().AsString());
                this.PM.setDirty(datablock);
            }
            else
            {
                tree.editItem(id, datablock.getName(), datablock.getId().AsString());
                this.PM.removeDirty(datablock);
            }

            // Sync the inspector dirty state.

            this.flagInspectorAsDirty(this.PM.hasDirty());
        }
        public static string GE_ScanGroupForGuis(string group, string text)
        {
            int count = ((SimSet)group).getCount();

            for (uint i = 0; i < count; i++)
            {
                SimObject obj = ((SimSet)group).getObject(i);
                if (obj.getClassName() == "GuiCanvas")
                {
                    text = text + GE_ScanGroupForGuis(obj, text);
                }
                else
                {
                    string name = "";
                    if (obj.getName() == "")
                    {
                        name = "(unnamed) - " + obj;
                    }
                    else
                    {
                        name = obj.getName() + " - " + obj;
                    }

                    text = text + "<a:gamelink:" + obj + ">" + name + "</a><br>";
                }
            }

            return(text);
        }
예제 #3
0
        public void scanGroup(SimSet group)
        {
            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";
            for (uint i = 0; i < group.getCount(); i++)
            {
                SimObject obj = group.getObject(i);
                if (obj.isMemberOfClass("GuiControl"))
                {
                    if (obj.getClassName() == "GuiCanvas")
                    {
                        this.scanGroup((GuiCanvas)obj);
                    }
                    else
                    {
                        string name;
                        if (obj.getName() == "")
                        {
                            name = "(unnamed) - " + obj;
                        }
                        else
                        {
                            name = obj.getName() + " - " + obj;
                        }

                        bool skip = false;

                        foreach (string guiEntry in sGlobal["$GuiEditor::GuiFilterList"].Split('\t'))
                        {
                            if (obj.getName() == guiEntry)
                            {
                                skip = true;
                                break;
                            }
                        }

                        if (!skip)
                        {
                            this.add(name, obj);
                        }
                    }
                }
                else if (obj.isMemberOfClass("SimGroup")
                         &&
                         (                                               //(%obj.internalName !$= "EditorGuiGroup" /* Copyright (C) 2013 WinterLeaf Entertainment LLC. */&& %obj.internalName !$= "IngameGuiGroup" )   // Don't put our editor's GUIs in the list
                           /*||*/ GuiEditor["showEditorGuis"].AsBool())) // except if explicitly requested.
                {
                    // Scan nested SimGroups for GuiControls.

                    this.scanGroup((SimGroup)obj);
                }
            }
        }
예제 #4
0
            public void addShapeIcon(SimObject datablock)
            {
                GuiIconButtonCtrl ctrl = this.createIcon();

                string name      = datablock.getName();
                string className = datablock.getClassName();
                string cmd       = className + "::create(" + name + ");";

                string shapePath = (datablock["shapeFile"] != "") ? datablock["shapeFile"] : datablock["shapeName"];

                string createCmd = "EWCreatorWindow.createObject( \\\"" + cmd + "\\\" );";

                ctrl.altCommand = "ColladaImportDlg.showDialog( \"" + shapePath + "\", \"" + createCmd + "\" );";

                ctrl.iconBitmap = console.Call_Classname("EditorIconRegistry", "findIconByClassName",
                                                         new string[] { className });
                ctrl.text = name;
                //ctrl["class"] = "CreatorShapeIconBtn";
                ctrl.tooltip = name;

                ctrl.buttonType = "RadioButton";
                ctrl.groupNum   = -1;

                this.contentCtrl.addGuiControl(ctrl);
            }
예제 #5
0
            public void saveEmitter(SimObject emitter)
            {
                PEE_EmitterSelector_Control PEE_EmitterSelector_Control      = "PEE_EmitterSelector_Control";
                ParticleEmitterData         PE_EmitterEditor_NotDirtyEmitter = "PE_EmitterEditor_NotDirtyEmitter";
                PersistenceManager          PE_EmitterSaver = "PE_EmitterSaver";
                ParticleEditor ParticleEditor = "ParticleEditor";

                GuiTextEditCtrl TextEdit = PEE_EmitterSelector_Control.FOT("TextEdit");

                string newName;

                if (emitter == "")
                {
                    newName = TextEdit.getText();
                }
                else
                {
                    newName = emitter.getName();
                }

                this.currEmitter.setName(newName);
                PE_EmitterEditor_NotDirtyEmitter.assignFieldsFrom(emitter);
                PE_EmitterEditor_NotDirtyEmitter["originalName"] = newName;

                PE_EmitterSaver.saveDirty();

                this.currEmitter = newName.getID();
                this.setEmitterNotDirty();

                ParticleEditor.createParticleList();
            }
            public void onInspectorPreFieldModification(string fieldName, string arrayIndex)
            {
                GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";

                Util.pushInstantGroup();
                //UndoManager undoManager = GuiEditor.getUndoManager();

                SimObject objectx = this.getInspectObject();

                string nameOrClass = objectx.getName();

                if (nameOrClass == "")
                {
                    nameOrClass = objectx.getClassName();
                }

                ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction");

                oc["actionName"] = nameOrClass + "." + fieldName + " Change";

                oc["objectId"]   = objectx.getId();
                oc["fieldName"]  = fieldName;
                oc["fieldValue"] = objectx.getFieldValue(fieldName, arrayIndex == "(null)" ? -1 : arrayIndex.AsInt());
                oc["arrayIndex"] = arrayIndex;

                oc["inspectorGui"] = this;

                InspectorFieldUndoAction action = oc.Create();

                this.currentFieldEditAction = action;
                Util.popInstantGroup();
            }
예제 #7
0
        public override void onInspectorFieldModified(string objectx, string fieldName, string arrayIndex, string oldValue, string newValue)
        {
            SimObject obj    = objectx;
            editor    Editor = "Editor";

            // The instant group will try to add our
            // UndoAction if we don't disable it.
            Util.pushInstantGroup();

            string nameOrClass = obj.getName();

            if (nameOrClass == "")
            {
                nameOrClass = obj.getClassName();
            }

            ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction");

            oc["actionName"]   = nameOrClass + "." + fieldName + " Change";
            oc["objectId"]     = obj.getId();
            oc["fieldName"]    = fieldName;
            oc["fieldValue"]   = oldValue;
            oc["arrayIndex"]   = arrayIndex;
            oc["inspectorGui"] = this;
            InspectorFieldUndoAction action = oc.Create();

            // If it's a datablock, initiate a retransmit.  Don't do so
            // immediately so as the actual field value will only be set
            // by the inspector code after this method has returned.

            if (obj.isMemberOfClass("SimDataBlock"))
            {
                obj.schedule("1", "reloadOnLocalClient");
            }

            // Restore the instant group.
            Util.popInstantGroup();

            action.addToManager(Editor.getUndoManager());

            EWorldEditor EWorldEditor = "EWorldEditor";

            EWorldEditor.isDirty = true;

            // Update the selection
            if (EWorldEditor.getSelectionSize() > 0 &&
                (fieldName == "position" || fieldName == "rotation" || fieldName == "scale"))
            {
                EWorldEditor.invalidateSelectionCentroid();
            }
        }
예제 #8
0
        public void onInspectorPreFieldModification(string fieldName, string arrayIndex)
        {
            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";

            Util.pushInstantGroup();
            UndoManager undoManager = GuiEditor.getUndoManager();

            string action     = "";
            int    numObjects = this.getNumInspectObjects();

            if (numObjects > 1)
            {
                action = undoManager.pushCompound("Multiple Field Edit");
            }

            for (uint i = 0; i < numObjects; i++)
            {
                SimObject obj = this.getInspectObject(i);

                string nameOrClass = obj.getName();
                if (nameOrClass == "")
                {
                    nameOrClass = obj.getClassName();
                }

                ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction");
                oc["actionName"] = nameOrClass + "." + fieldName + " Change";

                oc["objectId"]   = obj.getId();
                oc["fieldName"]  = fieldName;
                oc["fieldValue"] = obj.getFieldValue(fieldName, arrayIndex == "(null)" ? -1 : arrayIndex.AsInt());
                oc["arrayIndex"] = arrayIndex;

                oc["inspectorGui"] = this;

                InspectorFieldUndoAction undo = oc.Create();

                if (numObjects > 1)
                {
                    undo.addToManager(undoManager);
                }
                else
                {
                    action = undo;
                    break;
                }
            }

            this.currentFieldEditAction = action;
            Util.popInstantGroup();
        }
예제 #9
0
        public void createDatablock()
        {
            GuiTreeViewCtrl DatablockEditorTypeTree     = "DatablockEditorTypeTree";
            GuiControl      DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt";

            string className = DatablockEditorTypeTree.getItemText(DatablockEditorTypeTree.getSelectedItem());

            if (className != "")
            {
                // Need to prompt for a name.

                ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true))
                .setText("Name");
                ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true))
                .selectAllText();

                // Populate the copy source dropdown.

                GuiPopUpMenuCtrl list = DatablockEditorCreatePrompt.findObjectByInternalName("CopySourceDropdown",
                                                                                             true);
                list.clear();
                list.add("", 0);

                SimSet set   = "DataBlockSet";
                int    count = set.getCount();
                for (uint i = 0; i < count; i++)
                {
                    SimObject datablock      = set.getObject(i);
                    string    datablockClass = datablock.getClassName();

                    if (!Util.isMemberOfClass(datablockClass, className))
                    {
                        continue;
                    }

                    list.add(datablock.getName(), ((int)i + 1));
                }

                // Set up state of client-side checkbox.

                GuiCheckBoxCtrl clientSideCheckBox =
                    DatablockEditorCreatePrompt.findObjectByInternalName("ClientSideCheckBox", true);
                bool canBeClientSide = this.canBeClientSideDatablock(className);
                clientSideCheckBox.setStateOn(canBeClientSide);
                clientSideCheckBox.setActive(canBeClientSide);

                // Show the dialog.

                ((GuiCanvas)"canvas").pushDialog(DatablockEditorCreatePrompt, 0, true);
            }
        }
            public override void onInspectorFieldModified(string objectx, string fieldName, string arrayIndex, string oldValue, string newValue)
            {
                SimObject obj = objectx;

                GuiEditorGui.GuiEditor        GuiEditor                     = "GuiEditor";
                GuiEditorProfilesTree         GuiEditorProfilesTree         = "GuiEditorProfilesTree";
                GuiEditorProfileChangeManager GuiEditorProfileChangeManager = "GuiEditorProfileChangeManager";
                ProfilePane ProfilePane = "ProfilePane";

                GuiEditor.setProfileDirty(obj, true, false);

                // If it's the name field, make sure to sync up the treeview.

                if (fieldName == "name")
                {
                    GuiEditorProfilesTree.onProfileRenamed(obj, newValue);
                }

                // Add change record.

                //GuiEditorProfileChangeManager.registerEdit(obj, fieldName, oldValue);
                GuiEditorProfileChangeManager.registerEdit(obj, fieldName, arrayIndex, oldValue);

                // Add undo.

                Util.pushInstantGroup();

                string nameOrClass = obj.getName();

                if (nameOrClass == "")
                {
                    nameOrClass = obj.getClassName();
                }

                ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction");

                oc["actionName"] = nameOrClass + "." + fieldName + " Change";

                oc["objectId"]   = obj.getId();
                oc["fieldName"]  = fieldName;
                oc["fieldValue"] = oldValue;
                oc["arrayIndex"] = arrayIndex;

                oc["inspectorGui"] = this;

                InspectorFieldUndoAction action = oc.Create();

                Util.popInstantGroup();
                action.addToManager(ProfilePane.getUndoManager());
                //GuiEditor.updateUndoMenu();
            }
예제 #11
0
        public void inspect(SimObject obj)
        {
            string name = "";

            if (obj.isObject())
            {
                name = obj.getName();
            }
            else
            {
                ((GuiMLTextCtrl)"FieldInfoControl").setText("");
            }

            base.inspect(obj);
        }
예제 #12
0
            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 void saveParticle(SimObject particle)
            {
                GuiPopUpMenuCtrl   PEP_ParticleSelector = "PEP_ParticleSelector";
                ParticleData       PE_ParticleEditor_NotDirtyParticle = "PE_ParticleEditor_NotDirtyParticle";
                PersistenceManager PE_ParticleSaver = "PE_ParticleSaver";
                ParticleEditor     ParticleEditor   = "ParticleEditor";

                particle.setName(PEP_ParticleSelector.getText());

                PE_ParticleEditor_NotDirtyParticle.assignFieldsFrom(particle);
                PE_ParticleEditor_NotDirtyParticle["originalName"] = particle.getName();

                PE_ParticleSaver.saveDirty();
                this.setParticleNotDirty();

                ParticleEditor.createParticleList();
            }
예제 #14
0
        public static string CallScriptMethod(string className, string classNamespace, SimObject objectWrapper, string methodName, object[] args, out bool found)
        {
            if (methodName.Equals("pushDialog"))
            {
                methodName = methodName;
            }
            Type   type;
            string objectName = objectWrapper.getName();

            if (objectName != null && ClassTypeDictionary.ContainsKey(objectName))
            {
                type = ClassTypeDictionary[objectName];
            }
            else if (classNamespace != null && ClassTypeDictionary.ContainsKey(classNamespace))
            {
                type = ClassTypeDictionary[classNamespace];
            }
            else if (ClassTypeDictionary.ContainsKey(className))
            {
                type = ClassTypeDictionary[className];
            }
            else if (SimDictionary.Find(objectWrapper.Name) != null)
            {
                type = SimDictionary.Find(objectWrapper.Name).GetType();
            }
            else if (SimDictionary.Find(objectWrapper.getId()) != null)
            {
                type = SimDictionary.Find(objectWrapper.getId()).GetType();
            }
            else
            {
                if (ClassTypeDictionary.ContainsKey(objectWrapper.GetType().Name))
                {
                    type = ClassTypeDictionary[objectWrapper.GetType().Name];
                }
                else
                {
                    found = false;
                    return(null);
                }
            }
            return(CallNamespaceMethod(type, objectWrapper, methodName, args, out found));
        }
        public int addExistingItem(SimObject datablock, bool dontSort)
        {
            GuiTreeViewCtrl tree = "DatablockEditorTree";

            // Look up class at root level.  Create if needed.

            string className = datablock.getClassName();
            int    parentID  = tree.findItemByName(className);

            if (parentID == 0)
            {
                parentID = tree.insertItem(0, className, "", "", 0, 0);
            }

            // If the datablock is already there, don't
            // do anything.

            if (tree.findItemByValue(datablock.getId().AsString()).AsBool())
            {
                return(0);
            }

            // It doesn't exist so add it.

            string name = datablock.getName();

            if (this.PM.isDirty(datablock))
            {
                name = name + " *";
            }

            int id = tree.insertItem(parentID, name, datablock.getId().AsString(), "", 0, 0);

            if (!dontSort)
            {
                tree.sort(parentID, false, false, false);
            }

            return(id);
        }
예제 #16
0
        public static void Inspect(SimObject obj)
        {
            GuiInspector    InspectFields             = "InspectFields";
            GuiTextEditCtrl InspectObjectName         = "InspectObjectName";
            GuiTextEditCtrl InspectObjectInternalName = "InspectObjectInternalName";
            GuiTextCtrl     InspectObjectSimID        = "InspectObjectSimID";

            // Don't inspect the root group.
            if (obj == -1)
            {
                return;
            }

            InspectFields.inspect(obj);

            // Update selected object properties
            InspectObjectName.setValue(obj.getName());
            InspectObjectInternalName.setValue(obj.getInternalName());
            InspectObjectSimID.setValue(obj.getId().AsString());

            // Store Object Reference
            InspectObjectName["refObj"] = obj;
        }
예제 #17
0
        public override void onInspectorFieldModified(string objectx, string fieldName, string arrayIndex, string oldValue, string newValue)
        {
            SimObject obj = objectx;

            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";

            // The instant group will try to add our
            // UndoAction if we don't disable it.
            Util.pushInstantGroup();

            string nameOrClass = obj.getName();

            if (nameOrClass == "")
            {
                nameOrClass = obj.getClassName();
            }

            ObjectCreator oc = new ObjectCreator("InspectorFieldUndoAction");

            oc["actionName"] = nameOrClass + "." + fieldName + " Change";

            oc["objectId"]   = obj.getId();
            oc["fieldName"]  = fieldName;
            oc["fieldValue"] = oldValue;
            oc["arrayIndex"] = arrayIndex;

            oc["inspectorGui"] = this;

            InspectorFieldUndoAction action = oc.Create();

            // Restore the instant group.
            Util.popInstantGroup();

            action.addToManager(GuiEditor.getUndoManager());

            GuiEditor.updateUndoMenu();
        }
            public void loadNewParticle(SimObject particle)
            {
                GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector";
                ParticleData     PE_ParticleEditor_NotDirtyParticle = "PE_ParticleEditor_NotDirtyParticle";

                if (particle.isObject())
                {
                    particle = particle.getId().AsString();
                }
                else
                {
                    particle = PEP_ParticleSelector.getSelected().AsString();
                }

                this.currParticle = particle;

                particle.call("reload");

                PE_ParticleEditor_NotDirtyParticle.assignFieldsFrom(particle);
                PE_ParticleEditor_NotDirtyParticle["originalName"] = particle.getName();

                this.guiSync();
                this.setParticleNotDirty();
            }
            public void init()
            {
                GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";
                SimSet GuiDataGroup = "GuiDataGroup";

                this.clear();

                int defaultGroup = this.insertItem(0, "Default", "-1", "", 1, 1);
                int otherGroup   = this.insertItem(0, sGlobal["$GUI_EDITOR_DEFAULT_PROFILE_CATEGORY"], "-1", "", 1, 1);

                for (uint i = 0; i < GuiDataGroup.getCount(); i++)
                {
                    SimObject obj = GuiDataGroup.getObject(i);
                    if (!obj.isMemberOfClass("GuiControlProfile"))
                    {
                        continue;
                    }

                    // If it's an Editor profile, skip if showing them is not enabled.

                    if (obj["category"] == "Editor" && !GuiEditor["showEditorProfiles"].AsBool())
                    {
                        continue;
                    }

                    // Create a visible name.

                    string name = obj.getName();
                    if (name == "")
                    {
                        name = "<Unnamed>";
                    }
                    string text = name + " (" + obj.getId() + ")";

                    // Find which group to put the control in.

                    bool isDefaultProfile = GuiEditor.isDefaultProfile(name);

                    int group;
                    if (isDefaultProfile)
                    {
                        group = defaultGroup;
                    }
                    else if (obj["category"] != "")
                    {
                        group = this.findChildItemByName(0, obj["category"]);
                        if (group == 0)
                        {
                            group = this.insertItem(0, obj["category"], "", "", 1, 1);
                        }
                    }
                    else
                    {
                        group = otherGroup;
                    }

                    // Insert the item.

                    this.insertItem(group, text, obj.getId().AsString(), "", 1, 1);
                }

                this.sort(0, true, true, false);
            }
        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();
        }
	//-----------  SELECTED OBJECT STUFF.

	public void selectObject(SimObject obj) {

		if (obj != null) {
			//do the generic stuff.

			hudView.setObjectName(obj.getName());
			hudView.setObjectDescription(obj.getDesc());


			hud.setSelectedObject(obj);



			//get other object set up stuff.
			if (obj.GetType() == typeof(PlugLoadController)) {
				PlugLoadController pl = (PlugLoadController)obj;

				hudView.plugLoad_setListOfEnergyUsingObjects(pl.getEuoList(), pl);

			}
			else if (obj.GetType() == typeof(EnergyUsingObject)) {
				EnergyUsingObject euo = (EnergyUsingObject)obj;
				hudView.setListOfSelectablePlugLoads(euo);
			}

		}

	}
예제 #22
0
            public void onNewEmitter()
            {
                GuiPopUpMenuCtrl PEE_EmitterSelector = "PEE_EmitterSelector";

                ParticleParticleEditor.PE_ParticleEditor PE_ParticleEditor = "PE_ParticleEditor";

                if (this.currEmitter.isObject() && this.currEmitter == PEE_EmitterSelector.getSelected())
                {
                    return;
                }

                //FIXME: disregards particle tab dirty state

                if (this.dirty)
                {
                    if (PE_ParticleEditor.dirty)
                    {
                        messageBox.MessageBoxYesNo("Save Existing Particle?", "Do you want to save changes to <br><br>" + PE_ParticleEditor.currParticle.getName(), "PE_ParticleEditor.saveParticle(" + PE_ParticleEditor.currParticle + ");");
                    }

                    SimObject savedEmitter = this.currEmitter;
                    messageBox.MessageBoxYesNoCancel("Save Existing Emitter?", "Do you want to save changes to <br><br>" + savedEmitter.getName(), "PE_EmitterEditor.saveEmitter(" + savedEmitter + "); PE_EmitterEditor.loadNewEmitter();", "PE_EmitterEditor.saveEmitterDialogDontSave(" + savedEmitter + "); PE_EmitterEditor.loadNewEmitter();");
                }
                else
                {
                    this.loadNewEmitter("");
                }
            }
예제 #23
0
        public virtual bool objectMatchesCriteria(SimObject obj)
        {
            if (this["namePattern"] != "" && !Util.strIsMatchExpr(this["NamePattern"], obj.getName(), false))
            {
                return(false);
            }
            // Check class.

            if (!isClassEnabled(obj.getClassName()))
            {
                return(false);
            }

            return(true);
        }
예제 #24
0
            public void navigate(string address)
            {
                GuiDynamicCtrlArrayControl CreatorIconArray = "CreatorIconArray";
                CreatorPopupMenu           CreatorPopupMenu = "CreatorPopupMenu";

                CreatorIconArray.frozen = true;
                CreatorIconArray.clear();
                CreatorPopupMenu.clear();

                if (this.tab.ToLower() == "Scripted".ToLower())
                {
                    string category  = Util.getWord(address, 1);
                    SimSet dataGroup = "DataBlockGroup";

                    for (uint i = 0; i < dataGroup.getCount(); i++)
                    {
                        SimObject obj = dataGroup.getObject(i);
                        // echo ("Obj: " + obj.getName() + " - " + obj.category );

                        if (obj["category"] == "" && obj["category"].AsInt() == 0)
                        {
                            continue;
                        }

                        // Add category to popup menu if not there already
                        if (CreatorPopupMenu.findText(obj["category"]) == -1)
                        {
                            CreatorPopupMenu.add(obj["category"]);
                        }

                        if (address == "")
                        {
                            string ctrl = this.findIconCtrl(obj["category"]);
                            if (ctrl == "-1")
                            {
                                this.addFolderIcon(obj["category"]);
                            }
                        }
                        else if (address.ToLower() == obj["category"].ToLower())
                        {
                            string ctrl = this.findIconCtrl(obj.getName());
                            if (ctrl == "-1")
                            {
                                this.addShapeIcon(obj);
                            }
                        }
                    }
                }

                if (this.tab.ToLower() == "Meshes".ToLower())
                {
                    string fullPath =
                        Util.findFirstFileMultiExpr("*.dts" + '\t' + "*.dae" + '\t' + "*.kmz" + '\t' + "*.dif", true);

                    while (fullPath != "")
                    {
                        if (Util.strstr(fullPath, "cached.dts") != -1)
                        {
                            fullPath =
                                Util.findNextFileMultiExpr("*.dts" + '\t' + "*.dae" + '\t' + "*.kmz" + '\t' + "*.dif");
                            continue;
                        }

                        fullPath = Util.makeRelativePath(fullPath, Util.getMainDotCsDir());
                        string splitPath = Util.strreplace(fullPath, "/", " ");
                        if (Util.getWord(splitPath, 0) == "tools")
                        {
                            fullPath =
                                Util.findNextFileMultiExpr("*.dts" + '\t' + "*.dae" + '\t' + "*.kmz" + '\t' + "*.dif");
                            continue;
                        }

                        int dirCount = Util.getWordCount(splitPath) - 1;

                        string pathFolders = Util.getWords(splitPath, 0, dirCount - 1);

                        // Add this file's path (parent folders) to the
                        // popup menu if it isn't there yet.
                        string temp = Util.strreplace(pathFolders, " ", "/");
                        int    re   = CreatorPopupMenu.findText(temp);
                        if (re == -1)
                        {
                            CreatorPopupMenu.add(temp);
                        }

                        // Is this file in the current folder?
                        if (Util.stricmp(pathFolders, address) == 0)
                        {
                            this.addStaticIcon(fullPath);
                        }
                        // Then is this file in a subfolder we need to add
                        // a folder icon for?
                        else
                        {
                            int  wordIdx = 0;
                            bool add     = false;

                            if (address == "")
                            {
                                add     = true;
                                wordIdx = 0;
                            }
                            else
                            {
                                for (; wordIdx < dirCount; wordIdx++)
                                {
                                    temp = Util.getWords(splitPath, 0, wordIdx);
                                    if (Util.stricmp(temp, address) == 0)
                                    {
                                        add = true;
                                        wordIdx++;
                                        break;
                                    }
                                }
                            }

                            if (add == true)
                            {
                                string folder = Util.getWord(splitPath, wordIdx);

                                SimObject ctrl = this.findIconCtrl(folder);
                                if (ctrl == 0)
                                {
                                    this.addFolderIcon(folder);
                                }
                            }
                        }

                        fullPath = Util.findNextFileMultiExpr("*.dts" + '\t' + "*.dae" + '\t' + "*.kmz" + '\t' + "*.dif");
                    }
                }

                if (this.tab.ToLower() == "Level".ToLower())
                {
                    // Add groups to popup menu
                    array = this.array;
                    array.sortk(false);

                    int count = array.count();

                    if (count > 0)
                    {
                        string lastGroup = "";

                        for (int i = 0; i < count; i++)
                        {
                            string group = array.getKey(i);

                            if (group != lastGroup)
                            {
                                CreatorPopupMenu.add(group);

                                if (address == "")
                                {
                                    this.addFolderIcon(group);
                                }
                            }

                            if (address.ToLower() == group.ToLower())
                            {
                                ScriptObject args      = array.getValue(i);
                                string       className = args["val[0]"];
                                string       name      = args["val[1]"];
                                string       func      = args["val[2]"];

                                this.addMissionObjectIcon(className, name, func);
                            }

                            lastGroup = group;
                        }
                    }
                }

                if (this.tab.ToLower() == "Prefabs".ToLower())
                {
                    string expr     = "*.prefab";
                    string fullPath = Util.findFirstFile(expr);

                    while (fullPath != "")
                    {
                        fullPath = Util.makeRelativePath(fullPath, Util.getMainDotCsDir());
                        string splitPath = Util.strreplace(fullPath, "/", " ");
                        if (Util.getWord(splitPath, 0) == "tools")
                        {
                            fullPath = Util.findNextFile(expr);
                            continue;
                        }

                        int dirCount = Util.getWordCount(splitPath) - 1;

                        string pathFolders = Util.getWords(splitPath, 0, dirCount - 1);

                        // Add this file's path (parent folders) to the
                        // popup menu if it isn't there yet.
                        string temp = Util.strreplace(pathFolders, " ", "/");
                        int    re   = CreatorPopupMenu.findText(temp);
                        if (re == -1)
                        {
                            CreatorPopupMenu.add(temp);
                        }

                        // Is this file in the current folder?
                        if (Util.stricmp(pathFolders, address) == 0)
                        {
                            this.addPrefabIcon(fullPath);
                        }
                        // Then is this file in a subfolder we need to add
                        // a folder icon for?
                        else
                        {
                            int  wordIdx = 0;
                            bool add     = false;

                            if (address == "")
                            {
                                add     = true;
                                wordIdx = 0;
                            }
                            else
                            {
                                for (; wordIdx < dirCount; wordIdx++)
                                {
                                    temp = Util.getWords(splitPath, 0, wordIdx);
                                    if (Util.stricmp(temp, address) == 0)
                                    {
                                        add = true;
                                        wordIdx++;
                                        break;
                                    }
                                }
                            }

                            if (add == true)
                            {
                                string folder = Util.getWord(splitPath, wordIdx);

                                SimObject ctrl = this.findIconCtrl(folder);
                                if (ctrl == 0)
                                {
                                    this.addFolderIcon(folder);
                                }
                            }
                        }

                        fullPath = Util.findNextFile(expr);
                    }
                }

                CreatorIconArray.sort("alphaIconCompare");

                for (uint i = 0; i < CreatorIconArray.getCount(); i++)
                {
                    ((SimObject)CreatorIconArray.getObject(i))["autoSize"] = false.AsString();
                }

                CreatorIconArray.frozen = false;
                CreatorIconArray.refresh();

                // Recalculate the array for the parent guiScrollCtrl
                CreatorIconArray.getParent().call("computeSizes");

                this.address = address;

                CreatorPopupMenu.sort();

                string str = Util.strreplace(address, " ", "/");

                if (str != "")
                {
                    int r = CreatorPopupMenu.findText(str);
                    if (r != -1)
                    {
                        CreatorPopupMenu.setSelected(r, false);
                    }
                    else
                    {
                        CreatorPopupMenu.setText(str);
                    }
                }
                else
                {
                    CreatorPopupMenu.setText("");
                }
                CreatorPopupMenu.tooltip = str;
            }
	//-----------  SELECTED OBJECT STUFF.

	public void selectObject(SimObject obj) {

		if (obj != null) {
			//do the generic stuff.

			hudView.setObjectName(obj.getName());
			hudView.setObjectDescription(obj.getDesc());


			hud.setSelectedObject(obj);
		}

	}
            public void guiSync()
            {
                GuiPopUpMenuCtrl PEP_ParticleSelector = "PEP_ParticleSelector";

                ParticleEmitterEditor.PE_EmitterEditor PE_EmitterEditor = "PE_EmitterEditor";
                MaterialEditor.gui.CodeBehind.MaterialEditor.MaterialEditorGui MaterialEditorGui = "MaterialEditorGui";
                GuiSwatchButtonCtrl PE_ColorTintSwatch0 = "PE_ColorTintSwatch0";
                GuiSwatchButtonCtrl PE_ColorTintSwatch1 = "PE_ColorTintSwatch1";
                GuiSwatchButtonCtrl PE_ColorTintSwatch2 = "PE_ColorTintSwatch2";
                GuiSwatchButtonCtrl PE_ColorTintSwatch3 = "PE_ColorTintSwatch3";

                GuiBitmapButtonCtrl PEP_previewImage                  = this.FOT("PEP_previewImage");
                GuiTextEditCtrl     PEP_previewImageName              = this.FOT("PEP_previewImageName");
                GuiTextEditCtrl     PEP_lifetimeMS_textEdit           = this.FOT("PEP_lifetimeMS_textEdit");
                GuiTextEditCtrl     PEP_lifetimeVarianceMS_textEdit   = this.FOT("PEP_lifetimeVarianceMS_textEdit");
                GuiTextEditCtrl     PEP_inheritedVelFactor_textEdit   = this.FOT("PEP_inheritedVelFactor_textEdit");
                GuiTextEditCtrl     PEP_constantAcceleration_textEdit = this.FOT("PEP_constantAcceleration_textEdit");
                GuiTextEditCtrl     PEP_gravityCoefficient_textEdit   = this.FOT("PEP_gravityCoefficient_textEdit");
                GuiTextEditCtrl     PEP_dragCoefficient_textEdit      = this.FOT("PEP_dragCoefficient_textEdit");
                GuiTextEditCtrl     PEP_spinRandomMin_textEdit        = this.FOT("PEP_spinRandomMin_textEdit");
                GuiTextEditCtrl     PEP_spinRandomMax_textEdit        = this.FOT("PEP_spinRandomMax_textEdit");
                GuiTextEditCtrl     PEP_spinSpeed_textEdit            = this.FOT("PEP_spinSpeed_textEdit");
                GuiTextEditCtrl     PEP_pointSize_textEdit0           = this.FOT("PEP_pointSize_textEdit0");
                GuiTextEditCtrl     PEP_pointSize_textEdit1           = this.FOT("PEP_pointSize_textEdit1");
                GuiTextEditCtrl     PEP_pointSize_textEdit2           = this.FOT("PEP_pointSize_textEdit2");
                GuiTextEditCtrl     PEP_pointSize_textEdit3           = this.FOT("PEP_pointSize_textEdit3");
                GuiTextEditCtrl     PEP_pointTime_textEdit0           = this.FOT("PEP_pointTime_textEdit0");
                GuiTextEditCtrl     PEP_pointTime_textEdit1           = this.FOT("PEP_pointTime_textEdit1");
                GuiTextEditCtrl     PEP_pointTime_textEdit2           = this.FOT("PEP_pointTime_textEdit2");
                GuiTextEditCtrl     PEP_pointTime_textEdit3           = this.FOT("PEP_pointTime_textEdit3");
                GuiCheckBoxCtrl     PEP_inverseAlpha                  = this.FOT("PEP_inverseAlpha");
                GuiSliderCtrl       PEP_lifetimeMS_slider             = this.FOT("PEP_lifetimeMS_slider");
                GuiSliderCtrl       PEP_lifetimeVarianceMS_slider     = this.FOT("PEP_lifetimeVarianceMS_slider");
                GuiSliderCtrl       PEP_inheritedVelFactor_slider     = this.FOT("PEP_inheritedVelFactor_slider");
                GuiSliderCtrl       PEP_constantAcceleration_slider   = this.FOT("PEP_constantAcceleration_slider");
                GuiSliderCtrl       PEP_gravityCoefficient_slider     = this.FOT("PEP_gravityCoefficient_slider");
                GuiSliderCtrl       PEP_dragCoefficient_slider        = this.FOT("PEP_dragCoefficient_slider");
                GuiSliderCtrl       PEP_spinRandomMin_slider          = this.FOT("PEP_spinRandomMin_slider");
                GuiSliderCtrl       PEP_spinRandomMax_slider          = this.FOT("PEP_spinRandomMax_slider");
                GuiSliderCtrl       PEP_spinSpeed_slider              = this.FOT("PEP_spinSpeed_slider");
                GuiSliderCtrl       PEP_pointSize_slider0             = this.FOT("PEP_pointSize_slider0");
                GuiSliderCtrl       PEP_pointSize_slider1             = this.FOT("PEP_pointSize_slider1");
                GuiSliderCtrl       PEP_pointSize_slider2             = this.FOT("PEP_pointSize_slider2");
                GuiSliderCtrl       PEP_pointSize_slider3             = this.FOT("PEP_pointSize_slider3");
                GuiSliderCtrl       PEP_pointTime_slider0             = this.FOT("PEP_pointTime_slider0");
                GuiSliderCtrl       PEP_pointTime_slider1             = this.FOT("PEP_pointTime_slider1");
                GuiSliderCtrl       PEP_pointTime_slider2             = this.FOT("PEP_pointTime_slider2");
                GuiSliderCtrl       PEP_pointTime_slider3             = this.FOT("PEP_pointTime_slider3");

                // Populate the selector with the particles assigned
                // to the current emitter.

                bool             containsCurrParticle = false;
                GuiPopUpMenuCtrl popup = PEP_ParticleSelector;

                popup.clear();

                foreach (SimObject particle in PE_EmitterEditor.currEmitter["particles"].Split(' '))
                {
                    if (particle.getId() == this.currParticle)
                    {
                        containsCurrParticle = true;
                    }

                    popup.add(particle.getName(), particle.getId());
                }

                // Just in case the particle doesn't exist, fallback gracefully

                if (!containsCurrParticle)
                {
                    this.currParticle = Util.getWord(PE_EmitterEditor.currEmitter["particles"], 0).getID();
                }

                SimObject data = this.currParticle;

                popup.sort();
                popup.setSelected(data);

                string bitmap = MaterialEditorGui.searchForTexture(data.getName(), data["textureName"]);


                if (bitmap != "")
                {
                    PEP_previewImage.setBitmap(bitmap);
                    PEP_previewImageName.setText(bitmap);
                    PEP_previewImageName.tooltip = bitmap;
                }
                else
                {
                    PEP_previewImage.setBitmap("");
                    PEP_previewImageName.setText("None");
                    PEP_previewImageName.tooltip = "None";
                }

                PEP_inverseAlpha.setValue(data["useInvAlpha"]);

                PEP_lifetimeMS_slider.setValue(data["lifetimeMS"]);
                PEP_lifetimeMS_textEdit.setText(data["lifetimeMS"]);

                PEP_lifetimeVarianceMS_slider.setValue(data["lifetimeVarianceMS"]);
                PEP_lifetimeVarianceMS_textEdit.setText(data["lifetimeVarianceMS"]);

                PEP_inheritedVelFactor_slider.setValue(data["inheritedVelFactor"]);
                PEP_inheritedVelFactor_textEdit.setText(data["inheritedVelFactor"]);

                PEP_constantAcceleration_slider.setValue(data["constantAcceleration"]);
                PEP_constantAcceleration_textEdit.setText(data["constantAcceleration"]);

                PEP_gravityCoefficient_slider.setValue(data["gravityCoefficient"]);
                PEP_gravityCoefficient_textEdit.setText(data["gravityCoefficient"]);

                PEP_dragCoefficient_slider.setValue(data["dragCoefficient"]);
                PEP_dragCoefficient_textEdit.setText(data["dragCoefficient"]);

                PEP_spinRandomMin_slider.setValue(data["spinRandomMin"]);
                PEP_spinRandomMin_textEdit.setText(data["spinRandomMin"]);

                PEP_spinRandomMax_slider.setValue(data["spinRandomMax"]);
                PEP_spinRandomMax_textEdit.setText(data["spinRandomMax"]);

                PEP_spinRandomMax_slider.setValue(data["spinRandomMax"]);
                PEP_spinRandomMax_textEdit.setText(data["spinRandomMax"]);

                PEP_spinSpeed_slider.setValue(data["spinSpeed"]);
                PEP_spinSpeed_textEdit.setText(data["spinSpeed"]);

                PE_ColorTintSwatch0["color"] = data["colors[0]"];
                PE_ColorTintSwatch1["color"] = data["colors[1]"];
                PE_ColorTintSwatch2["color"] = data["colors[2]"];
                PE_ColorTintSwatch3["color"] = data["colors[3]"];

                PEP_pointSize_slider0.setValue(data["sizes[0]"]);
                PEP_pointSize_textEdit0.setText(data["sizes[0]"]);

                PEP_pointSize_slider1.setValue(data["sizes[1]"]);
                PEP_pointSize_textEdit1.setText(data["sizes[1]"]);

                PEP_pointSize_slider2.setValue(data["sizes[2]"]);
                PEP_pointSize_textEdit2.setText(data["sizes[2]"]);

                PEP_pointSize_slider3.setValue(data["sizes[3]"]);
                PEP_pointSize_textEdit3.setText(data["sizes[3]"]);

                PEP_pointTime_slider0.setValue(data["times[0]"]);
                PEP_pointTime_textEdit0.setText(data["times[0]"]);

                PEP_pointTime_slider1.setValue(data["times[1]"]);
                PEP_pointTime_textEdit1.setText(data["times[1]"]);

                PEP_pointTime_slider2.setValue(data["times[2]"]);
                PEP_pointTime_textEdit2.setText(data["times[2]"]);

                PEP_pointTime_slider3.setValue(data["times[3]"]);
                PEP_pointTime_textEdit3.setText(data["times[3]"]);
            }
예제 #27
0
        public override void onRightMouseUp(int itemId, string mousePos, SimObject obj)
        {
            MenuBuilder popup;
            GuiCanvas   Canvas = "Canvas";

            bool haveObjectEntries      = false;
            bool haveLockAndHideEntries = true;

            // Handle multi-selection.
            if (this.getSelectedItemsCount() > 1)
            {
                popup = "ETMultiSelectionContextPopup";
                if (!popup.isObject())
                {
                    ObjectCreator popCreator = new ObjectCreator("PopupMenu", "ETMultiSelectionContextPopup", typeof(MenuBuilder));
                    popCreator["isPopup"] = true.AsString();

                    popCreator["item[0]"] = "Delete" + '\t' + "" + '\t' + "EditorMenuEditDelete();";
                    popCreator["item[1]"] = "Group" + '\t' + "" + '\t' + "EWorldEditor.addSimGroup( true );";

                    popup = popCreator.Create();
                }
            }

            // Open context menu if this is a CameraBookmark
            else if (obj.isMemberOfClass("CameraBookmark"))
            {
                popup = "ETCameraBookmarkContextPopup";
                if (!popup.isObject())
                {
                    ObjectCreator popupCreator = new ObjectCreator("PopupMenu", "ETCameraBookmarkContextPopup", typeof(MenuBuilder));
                    popupCreator["isPopup"] = true.AsString();

                    popupCreator["item[0]"] = "Go To Bookmark" + '\t' + "" + '\t' + "EditorGui.jumpToBookmark( this.bookmark.getInternalName() );";

                    popupCreator["bookmark"] = "-1";

                    popup = popupCreator.Create();
                }

                ((MenuBuilder)"ETCameraBookmarkContextPopup")["bookmark"] = obj;
            }

            // Open context menu if this is set CameraBookmarks group.
            else if (obj.name == "CameraBookmarks")
            {
                popup = "ETCameraBookmarksGroupContextPopup";
                if (!popup.isObject())
                {
                    popup         = new ObjectCreator("PopupMenu", "ETCameraBookmarksGroupContextPopup", typeof(MenuBuilder)).Create();
                    popup.isPopup = true;

                    popup.addItem("0", "Add Camera Bookmark" + '\t' + "" + '\t' + "EditorGui.addCameraBookmarkByGui();");
                }
            }

            // Open context menu if this is a SimGroup
            else if (obj.isMemberOfClass("SimGroup"))
            {
                popup = "ETSimGroupContextPopup";
                if (!popup.isObject())
                {
                    ObjectCreator popupCreator = new ObjectCreator("PopupMenu", "ETSimGroupContextPopup", typeof(MenuBuilder));
                    popupCreator["isPopup"] = true.AsString();

                    popupCreator["item[0]"]  = "Rename" + '\t' + "" + '\t' + "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( ETSimGroupContextPopup.object ) );";
                    popupCreator["item[1]"]  = "Delete" + '\t' + "" + '\t' + "EWorldEditor.deleteMissionObject( ETSimGroupContextPopup.object );";
                    popupCreator["item[2]"]  = "Inspect" + '\t' + "" + '\t' + "inspectObject( ETSimGroupContextPopup.object );";
                    popupCreator["item[3]"]  = "-";
                    popupCreator["item[4]"]  = "Toggle Lock Children" + '\t' + "" + '\t' + "EWorldEditor.toggleLockChildren( ETSimGroupContextPopup.object );";
                    popupCreator["item[5]"]  = "Toggle Hide Children" + '\t' + "" + '\t' + "EWorldEditor.toggleHideChildren( ETSimGroupContextPopup.object );";
                    popupCreator["item[6]"]  = "-";
                    popupCreator["item[7]"]  = "Group" + '\t' + "" + '\t' + "EWorldEditor.addSimGroup( true );";
                    popupCreator["item[8]"]  = "-";
                    popupCreator["item[9]"]  = "Add New Objects Here" + '\t' + "" + '\t' + "EWCreatorWindow.setNewObjectGroup( ETSimGroupContextPopup.object );";
                    popupCreator["item[10]"] = "Add Children to Selection" + '\t' + "" + '\t' + "EWorldEditor.selectAllObjectsInSet( ETSimGroupContextPopup.object, false );";
                    popupCreator["item[11]"] = "Remove Children from Selection" + '\t' + "" + '\t' + "EWorldEditor.selectAllObjectsInSet( ETSimGroupContextPopup.object, true );";

                    popupCreator["object"] = "-1";

                    popup = popupCreator.Create();
                }

                popup["object"] = obj;

                bool hasChildren = ((SimGroup)obj).getCount() > 0;
                popup.enableItem(10, hasChildren);
                popup.enableItem(11, hasChildren);

                haveObjectEntries      = true;
                haveLockAndHideEntries = false;
            }

            // Open generic context menu.
            else
            {
                popup = "ETContextPopup";
                if (!popup.isObject())
                {
                    ObjectCreator popCreator = new ObjectCreator("PopupMenu", "ETContextPopup", typeof(MenuBuilder));
                    popCreator["isPopup"] = true.AsString();

                    popCreator["item[0]"] = "Rename" + '\t' + "" + '\t' + "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( ETContextPopup.object ) );";
                    popCreator["item[1]"] = "Delete" + '\t' + "" + '\t' + "EWorldEditor.deleteMissionObject( ETContextPopup.object );";
                    popCreator["item[2]"] = "Inspect" + '\t' + "" + '\t' + "inspectObject( ETContextPopup.object );";
                    popCreator["item[3]"] = "-";
                    popCreator["item[4]"] = "Locked" + '\t' + "" + '\t' + "ETContextPopup.object.setLocked( !ETContextPopup.object.locked ); EWorldEditor.syncGui();";
                    popCreator["item[5]"] = "Hidden" + '\t' + "" + '\t' + "EWorldEditor.hideObject( ETContextPopup.object, !ETContextPopup.object.hidden ); EWorldEditor.syncGui();";
                    popCreator["item[6]"] = "-";
                    popCreator["item[7]"] = "Group" + '\t' + "" + '\t' + "EWorldEditor.addSimGroup( true );";

                    popCreator["object"] = "-1";

                    popup = popCreator.Create();
                }

                // Specialized version for ConvexShapes.
                if (obj.isMemberOfClass("ConvexShape"))
                {
                    popup = "ETConvexShapeContextPopup";
                    if (!popup.isObject())
                    {
                        ObjectCreator popCreator = new ObjectCreator("PopupMenu", "ETConvexShapeContextPopup", typeof(MenuBuilder));
                        popCreator["isPopup"] = true.AsString();

                        popCreator["item[8]"]  = "-";
                        popCreator["item[9]"]  = "Convert to Zone" + '\t' + "" + '\t' + "EWorldEditor.convertSelectionToPolyhedralObjects( \\\"Zone\\\" );";
                        popCreator["item[10]"] = "Convert to Portal" + '\t' + "" + '\t' + "EWorldEditor.convertSelectionToPolyhedralObjects( \\\"Portal\\\" );";
                        popCreator["item[11]"] = "Convert to Occluder" + '\t' + "" + '\t' + "EWorldEditor.convertSelectionToPolyhedralObjects( \\\"OcclusionVolume\\\" );";
                        popCreator["item[12]"] = "Convert to Sound Space" + '\t' + "" + '\t' + "EWorldEditor.convertSelectionToPolyhedralObjects( \\\"SFXSpace\\\" );";

                        popup = popCreator.Create();
                    }
                }

                // Specialized version for polyhedral objects.
                else if (obj.isMemberOfClass("Zone") || obj.isMemberOfClass("Portal") || obj.isMemberOfClass("OcclusionVolume") || obj.isMemberOfClass("SFXSpace"))
                {
                    popup = "ETPolyObjectContextPopup";
                    if (!popup.isObject())
                    {
                        ObjectCreator popCreator = new ObjectCreator("PopupMenu", "ETPolyObjectContextPopup", typeof(MenuBuilder));
                        popCreator["isPopup"] = true.AsString();

                        popCreator["item[8]"] = "-";
                        popCreator["item[9]"] = "Convert to ConvexShape" + '\t' + "" + '\t' + "EWorldEditor.convertSelectionToConvexShape();";

                        popup = popCreator.Create();
                    }
                }

                popup["object"]   = obj;
                haveObjectEntries = true;
            }

            if (haveObjectEntries)
            {
                popup.enableItem(0, (obj.isNameChangeAllowed() && obj.getName() != "MissionGroup"));
                popup.enableItem(1, (obj.getName() != "MissionGroup"));
                if (haveLockAndHideEntries)
                {
                    popup.checkItem(4, obj["locked"].AsBool());
                    popup.checkItem(5, obj.hidden);
                }
                popup.enableItem(7, this.isItemSelected(itemId));
            }

            popup.showPopup(Canvas);
        }