Exemplo n.º 1
0
        public static void _setShadowVizLight(string light, bool force)
        {
            GuiControl AL_ShadowVizOverlayCtrl = "AL_ShadowVizOverlayCtrl";


            if (!AL_ShadowVizOverlayCtrl.isAwake())
            {
                return;
            }
            if (AL_ShadowVizOverlayCtrl["isLocked"].AsBool() && !force)
            {
                return;
            }

            string sizeAndAspect = "";

            if (light.isObject())
            {
                //todo Got a bug here I think, don't know enough about lighting to debug it at the moment.  the sizeAndAspect is always blank.
                string clientLight = client.serverToClientObject(light.AsInt()).AsString();
                //console.Call("serverToClientObject", new string[] { light });
                sizeAndAspect = omni.Util.setShadowVizLight(clientLight);
            }

            omni.console.Call(AL_ShadowVizOverlayCtrl.findObjectByInternalName("MatCtrl", true), "setMaterial",
                              new[] { "AL_ShadowVisualizeMaterial" });
            string text = "ShadowViz";

            if (light.isObject() && sizeAndAspect != "")
            {
                text = text + ":" + sizeAndAspect.Split(' ')[0] + " x " + sizeAndAspect.Split(' ')[1];
            }

            omni.console.SetVar(AL_ShadowVizOverlayCtrl.findObjectByInternalName("WindowCtrl", true), text);
        }
Exemplo n.º 2
0
        public void createPromptNameCheck()
        {
            GuiControl       DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt";
            editor           Editor             = "Editor";
            GuiPopUpMenuCtrl copySourceDropdown =
                DatablockEditorCreatePrompt.findObjectByInternalName("copySourceDropdown", true);

            string name =
                ((GuiTextEditCtrl)DatablockEditorCreatePrompt.findObjectByInternalName("CreateDatablockName", true))
                .getText();

            if (!Editor.validateObjectName(name, true))
            {
                return;
            }

            // Fetch the copy source and clear the list.

            string copySource = copySourceDropdown.getText();

            copySourceDropdown.clear();

            // Remove the dialog and create the datablock.

            ((GuiCanvas)"canvas").popDialog(DatablockEditorCreatePrompt);
            this.createDatablockFinish(name, copySource);
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        public void syncBrushInfo()
        {
            GuiControl    TerrainBrushSizeTextEditContainer     = "TerrainBrushSizeTextEditContainer";
            GuiControl    TerrainBrushPressureTextEditContainer = "TerrainBrushPressureTextEditContainer";
            GuiControl    TerrainBrushSoftnessTextEditContainer = "TerrainBrushSoftnessTextEditContainer";
            GuiControl    TerrainSetHeightTextEditContainer     = "TerrainSetHeightTextEditContainer";
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            GuiTextEditCtrl tTerrainBrushSizeTextEditContainer =
                TerrainBrushSizeTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainBrushPressureTextEditContainer =
                TerrainBrushPressureTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainBrushSoftnessTextEditContainer =
                TerrainBrushSoftnessTextEditContainer.findObjectByInternalName("textEdit", true);

            GuiTextEditCtrl tTerrainSetHeightTextEditContainer =
                TerrainSetHeightTextEditContainer.findObjectByInternalName("textEdit", true);

            tTerrainBrushSizeTextEditContainer.text     = Util.getWord(ETerrainEditor.getBrushSize(), 0);
            tTerrainBrushPressureTextEditContainer.text = (ETerrainEditor.getBrushPressure() * 100).AsString();
            tTerrainBrushSoftnessTextEditContainer.text = (ETerrainEditor.getBrushSoftness() * 100).AsString();
            tTerrainSetHeightTextEditContainer.text     = (ETerrainEditor.setHeightVal.AsString());

            string brushType = ETerrainEditor.getBrushType();

            Util.eval("EWTerrainEditToolbar-->" + brushType + ".setStateOn(1);");
        }
Exemplo n.º 5
0
        public void syncBrushInfo()
        {
            // Update gui brush info
            GuiControl    PaintBrushSizeTextEditContainer     = "PaintBrushSizeTextEditContainer";
            GuiControl    PaintBrushSlopeControl              = "PaintBrushSlopeControl";
            GuiControl    PaintBrushPressureTextEditContainer = "PaintBrushPressureTextEditContainer";
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            ((GuiTextEditCtrl)PaintBrushSizeTextEditContainer.findObjectByInternalName("textEdit", true)).text     = Util.getWord(ETerrainEditor.getBrushSize(), 0);
            ((GuiTextEditCtrl)PaintBrushSlopeControl.findObjectByInternalName("SlopeMinAngle", true)).text         = ETerrainEditor.getSlopeLimitMinAngle().AsString();
            ((GuiTextEditCtrl)PaintBrushSlopeControl.findObjectByInternalName("SlopeMaxAngle", true)).text         = ETerrainEditor.getSlopeLimitMaxAngle().AsString();
            ((GuiTextEditCtrl)PaintBrushPressureTextEditContainer.findObjectByInternalName("textEdit", true)).text = (ETerrainEditor.getBrushPressure() * 100).AsString();

            string brushType = ETerrainEditor.getBrushType();

            Util.eval("EWTerrainPainterToolbar-->" + brushType + ".setStateOn(1);");
        }
Exemplo n.º 6
0
        public static void _setShadowVizLight(string light, string force = "false")
        {
            if (!Global.isObject("AL_ShadowVizOverlayCtrl"))
            {
                return;
            }
            GuiControl AL_ShadowVizOverlayCtrl = Sim.FindObject <GuiControl>("AL_ShadowVizOverlayCtrl");

            bool _force = GenericMarshal.StringToBool(force);

            if (!AL_ShadowVizOverlayCtrl.isAwake())
            {
                return;
            }
            if (!GenericMarshal.StringToBool(AL_ShadowVizOverlayCtrl.getFieldValue("isLocked")) && !_force)
            {
                return;
            }

            string sizeAndAspect = null;

            // Resolve the object to the client side.
            if (Global.isObject("light"))
            {
                SimObject obj         = Sim.FindObject <SimObject>(light);
                int       clientLight = HelperFunctions.serverToClientObject(obj);
                sizeAndAspect = Global.setShadowVizLight(clientLight.ToString());
            }

            AL_ShadowVizOverlayCtrl.findObjectByInternalName("MatCtrl", true)
            .call("setMaterial", "AL_ShadowVisualizeMaterial");

            string text = "ShadowViz";

            if (Global.isObject(light))
            {
                text += " : " + Global.getWord(sizeAndAspect, 0) + " x " + Global.getWord(sizeAndAspect, 1);
            }

            AL_ShadowVizOverlayCtrl.findObjectByInternalName("WindowCtrl").As <GuiWindowCtrl>().Text = text;
        }
Exemplo n.º 7
0
        public void createDatablockFinish(string name, string copySource)
        {
            GuiTreeViewCtrl DatablockEditorTypeTree     = "DatablockEditorTypeTree";
            GuiControl      DatablockEditorCreatePrompt = "DatablockEditorCreatePrompt";

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

            if (className != "")
            {
                UndoScriptAction action = this.createUndo <DatablockEditorUndo.ActionCreateDatablock>("Create New Datablock");
                string           dbType;

                if (
                    ((GuiCheckBoxCtrl)
                     DatablockEditorCreatePrompt.findObjectByInternalName("ClientSideCheckBox", true)).isStateOn())
                {
                    dbType = "singleton ";
                }
                else
                {
                    dbType = "datablock ";
                }

                string eval;
                if (copySource != "")
                {
                    eval = dbType + className + "(" + name + " : " + copySource + ") { canSaveDynamicFields = \"1\"; };";
                }
                else
                {
                    eval = dbType + className + "(" + name + ") { canSaveDynamicFields = \"1\"; };";
                }

                string res = omni.Util.eval(eval);

                action["db"]     = name.getID().AsString();
                action["dbName"] = name;
                action["fname"]  = omni.sGlobal["$DATABLOCK_EDITOR_DEFAULT_FILENAME"];

                this.submitUndo(action);

                action.redo();
            }
        }
Exemplo n.º 8
0
        public static void clientCmdSetDamageDirection(string direction)
        {
            GuiControl DamageHUD = "DamageHUD";

            if (!DamageHUD.isObject())
            {
                return;
            }
            GuiBitmapCtrl ctrl = DamageHUD.findObjectByInternalName("damage_" + direction, true);

            if (!ctrl.isObject())
            {
                return;
            }

            omni.Util.cancelAll(ctrl);
            ctrl.setVisible(true);
            ctrl.schedule("500", "setVisible", "false");
        }
Exemplo n.º 9
0
        public override void onActivated()
        {
            EditorGui     EditorGui      = "EditorGui";
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            GuiWindowCollapseCtrl TerrainPainterPreview   = "TerrainPainterPreview";
            GuiControl            EWTerrainPainterToolbar = "EWTerrainPainterToolbar";

            EditorGui.EditorGuiStatusBar EditorGuiStatusBar = "EditorGuiStatusBar";
            TerrainPainter TerrainPainter = "TerrainPainter";

            base.onActivated();
            isActive = true;

            EditorGui.readTerrainEditorSettings();
            GuiControl EWTerrainPainterToolbarBrushType = "EWTerrainPainterToolbarBrushType";

            ((GuiBitmapButtonCtrl)EWTerrainPainterToolbarBrushType.findObjectByInternalName("ellipse", true))
            .performClick();
            map.push();

            EditorGui.bringToFront(ETerrainEditor);
            ETerrainEditor.setVisible(true);
            ETerrainEditor.attachTerrain();
            ETerrainEditor.makeFirstResponder(true);

            //Copyright Winterleaf Entertainment L.L.C. 2013
            TerrainPainter.setVisible(true);
            TerrainPainterPreview.setVisible(true);
            //Copyright Winterleaf Entertainment L.L.C. 2013
            EWTerrainPainterToolbar.setVisible(true);
            ETerrainEditor.onBrushChanged();
            //Copyright Winterleaf Entertainment L.L.C. 2013
            TerrainPainter.setup(0);
            //Copyright Winterleaf Entertainment L.L.C. 2013
            syncBrushInfo();

            EditorGuiStatusBar.setSelection("");
        }