/// A helper for submitting a creation undo action.
        public static void submit(SimObject undoObject)
        {
            editor Editor = "Editor";

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

            // Create the undo action.
            ObjectCreator actionCreator = new ObjectCreator("MECreateUndoAction");

            actionCreator["actionName"] = "Create " + undoObject.getClassName();

            MECreateUndoAction action = actionCreator.Create();

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

            // Set the object to undo.
            action.addObject(undoObject);

            // Submit it.
            action.addToManager(Editor.getUndoManager());
        }
示例#2
0
        public bool isValidDragTarget(int id, SimObject obj)
        {
            EWorldEditor EWorldEditor = "EWorldEditor";

            if (obj.isMemberOfClass("Path"))
                return EWorldEditor.areAllSelectedObjectsOfType("Marker");
            if (obj.name == "CameraBookmarks")
                return EWorldEditor.areAllSelectedObjectsOfType("CameraBookmark");
            else
                return (obj.getClassName() == "SimGroup");
        }
            public void inspect(SimObject obj)
            {
                string className = "";
                if (obj.isObject())
                    className = obj.getClassName();

                this["showObjectName"] = false.AsString();
                this["showCustomFields"] = false.AsString();

                switch (className)
                    {
                        case "ForestBrush":
                            this["groupFilters"] = "+NOTHING,-Ungrouped";
                            break;

                        case "ForestBrushElement":
                            this["groupFilters"] = "+ForestBrushElement,-Ungrouped";
                            break;

                        case "TSForestItemData":
                            this["groupFilters"] = "+Media,+Wind";
                            break;

                        default:
                            this["groupFilters"] = "";
                            break;
                    }

                base.inspect(obj);
            }
            public override bool handleRenameObject(string name, SimObject obj)
            {
                SimGroup ForestBrushGroup = "ForestBrushGroup";
                EWorldEditor EWorldEditor = "EWorldEditor";
                editor Editor = "Editor";

                if (name != "")
                    {
                    string found = ForestBrushGroup.findObjectByInternalName(name, false);
                    if (found.isObject() && found.getID() != obj.getId())
                        {
                        messageBox.MessageBoxOK("Error", "Brush or Element with that name already exists.", "");

                        // true as in, we handled it, don't rename the object.      
                        return true;
                        }
                    }
                // Since we aren't showing any groups whens inspecting a ForestBrushGroup
                // we can't push this event off to the inspector to handle.

                //return GuiTreeViewCtrl::handleRenameObject( this, name, obj );      

                // 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 actionCreator = new ObjectCreator("InspectorFieldUndoAction");
                actionCreator["actionName"] = nameOrClass + "." + "internalName" + " Change";
                actionCreator["objectId"] = obj.getId().AsString();
                actionCreator["fieldName"] = "internalName";
                actionCreator["fieldValue"] = obj["internalName"];
                actionCreator["arrayIndex"] = "0";

                actionCreator["inspectorGui"] = "";

                InspectorFieldUndoAction action = actionCreator.Create();

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

                action.addToManager(Editor.getUndoManager());
                EWorldEditor.isDirty = true;

                return false;
            }
        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;
        }
        /// A helper for submitting a creation undo action.
        public static void submit(SimObject undoObject)
        {
            editor Editor = "Editor";

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

            // Create the undo action.     
            ObjectCreator actionCreator = new ObjectCreator("MECreateUndoAction");
            actionCreator["actionName"] = "Create " + undoObject.getClassName();

            MECreateUndoAction action = actionCreator.Create();

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

            // Set the object to undo.
            action.addObject(undoObject);

            // Submit it.
            action.addToManager(Editor.getUndoManager());
        }
示例#7
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);
            }