Esempio n. 1
0
        public static void onActivateBasicLM()
        {
            // If HDR is enabled... enable the special format token.
            if ((omni.sGlobal["$platform"] == "macos") || ((PostEffect)"HDRPostFx").isEnabledX())
            {
                ((RenderFormatToken)"AL_FormatToken").enable();
            }
            // Create render pass for projected shadow.

            RenderPassManager BL_ProjectedShadowRPM =
                new ObjectCreator("RenderPassManager", "BL_ProjectedShadowRPM").Create();

            // Create the mesh bin and add it to the manager.

            RenderMeshMgr meshbin = new ObjectCreator("RenderMeshMgr").Create();

            BL_ProjectedShadowRPM.addManager(meshbin);
            // Add both to the root group so that it doesn't
            // end up in the MissionCleanup instant group.

            SimSet rootGroup = "RootGroup";

            rootGroup.pushToBack(BL_ProjectedShadowRPM);
            rootGroup.pushToBack(meshbin);
        }
        public void update()
        {
            GuiControl GuiEditorContent = "GuiEditorContent";

            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";

            SimObject obj = GuiEditorContent.getObject(0);

            if (!obj.isObject())
            {
                this.clear();
            }
            else
            {
                // Open inspector tree.

                this.open(obj);

                // Sync selection with GuiEditor.

                this.clearSelection();

                SimSet selection = GuiEditor.getSelection();
                int    count     = selection.getCount();

                for (uint i = 0; i < count; i++)
                {
                    this.addSelection(selection.getObject(i).AsInt(), false);
                }
            }
        }
Esempio n. 3
0
        public virtual void FollowPath(SimSet path, int node)
        {
            stopThread(0);

            if (!path.isObject() || !isObject())
            {
                this["path"] = "";
                return;
            }

            if (node > path.getCount() - 1)
            {
                this["targetNode"] = (path.getCount() - 1).AsString();
            }
            else
            {
                this["targetNode"] = node.AsString();
            }

            if ((this["path"]) == path)
            {
                MoveToNode(this["currentNode"].AsUint());
            }

            else
            {
                this["path"] = path;
                MoveToNode(0);
            }
        }
Esempio n. 4
0
        /// Pauses the playback of active sound sources.
        ///
        /// @param %channels    An optional word list of channel indices or an empty
        /// string to pause sources on all channels.
        /// @param %pauseSet    An optional SimSet which is filled with the paused
        /// sources.  If not specified the global SFXPausedSet
        /// is used.
        ///
        /// @deprecated
        public static void sfxPause(List <int> channels = null, SimSet pauseSet = null)
        {
            // Did we get a set to populate?
            if (pauseSet == null)
            {
                pauseSet = SFXPausedSet;
            }

            SimSet SFXSourceSet = Sim.FindObjectByName <SimSet>("SFXSourceSet");

            int count = SFXSourceSet.getCount();

            for (uint i = 0; i < count; i++)
            {
                SFXSource source = SFXSourceSet.getObject(i).As <SFXSource>();

                int channel = sfxGroupToOldChannel(source.getGroup());
                if (channels != null && !channels.Contains(channel))
                {
                    continue;
                }

                source.pause();
                pauseSet.add(source);
            }
        }
Esempio n. 5
0
        public void initFilterList(string selectFilter)
        {
            GuiPopUpMenuCtrl SFXParameterFilter = this.FOT("SFXParameterFilter");
            SimSet           SFXParameterGroup  = "SFXParameterGroup";

            GuiPopUpMenuCtrl filterList = SFXParameterFilter;

            filterList.clear();
            filterList.add("", 0);

            for (uint i = 0; i < SFXParameterGroup.getCount(); i++)
            {
                SimObject obj = SFXParameterGroup.getObject(i);
                if (!Util.isMemberOfClass(obj.getClassName(), "SFXParameter"))
                {
                    continue;
                }

                for (int idx = 0; obj["categories[" + idx + "]"] != ""; idx++)
                {
                    string category = obj["categories[" + idx + "]"];
                    if (filterList.findText(category) == -1)
                    {
                        filterList.add(category, filterList.size());
                    }
                }
            }

            // Sort the filters.

            filterList.sort();
            filterList.setSelected(filterList.findText(selectFilter), false);
        }
Esempio n. 6
0
        public void init()
        {
            SimSet GuiGroup = "GuiGroup";

            this.clear();
            this.scanGroup(GuiGroup);
        }
Esempio n. 7
0
        public void deleteMat()
        {
            SimSet        TerrainMaterialSet            = "TerrainMaterialSet";
            SimGroup      TerrainMaterialDlgDeleteGroup = "TerrainMaterialDlgDeleteGroup";
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            if (!this["activeMat"].isObject())
            {
                return;
            }

            // Cannot delete this material if it is the only one left on the Terrain
            if ((ETerrainEditor.getMaterialCount() == 1) && ETerrainEditor.getMaterialIndex(((SimObject)this["activeMat"]).internalName) != -1)
            {
                messageBox.MessageBoxOK("Error", "Cannot delete this Material, it is the only Material still in use by the active Terrain.");
                return;
            }
            TerrainMaterialSet.remove(this["activeMat"]);
            TerrainMaterialDlgDeleteGroup.add(this["activeMat"]);
            GuiTreeViewCtrl matLibTree = this.findObjectByInternalName("matLibTree", true);

            buildTree();
            //matLibTree.open("TerrainMaterialSet", false);
            //matLibTree.selectItem(1);
        }
Esempio n. 8
0
        public override void onAction()
        {
            // NOTE: Though this is a GuiControl which exists on the client-side
            // we access and modify the server-side TimeOfDay object. This is acceptible
            // because this is a "tools" gui which is not intended for a real-game
            // or multiplayer situation.

            if (!this["tod"].isObject())
            {
                if ("MissionGroup".isObject())
                {
                    SimSet MissionGroup = "MissionGroup";
                    for (uint i = 0; i < MissionGroup.getCount(); i++)
                    {
                        SimObject obj = MissionGroup.getObject(i);
                        if (obj.getClassName() == "TimeOfDay")
                        {
                            this["tod"] = obj;
                            break;
                        }
                    }
                }
            }
            if (!this["tod"].isObject())
            {
                return;
            }

            TimeOfDay tod = this["tod"];

            tod.time = this.getValue();
        }
Esempio n. 9
0
        public override void onEditMenuSelect(string editMenu)
        {
            SimSet          ForestTools     = "ForestTools";
            ForestEditorGui ForestEditorGui = "ForestEditorGui";

            ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool");

            bool hasSelection = false;

            ForestSelectionTool selTool = SelectionTool;

            if (ForestEditorGui.getActiveTool() == selTool._iID)
            {
                if (selTool.getSelectionCount() > 0)
                {
                    hasSelection = true;
                }
            }

            ((PopupMenu)editMenu).enableItem(3, hasSelection);  // Cut
            ((PopupMenu)editMenu).enableItem(4, hasSelection);  // Copy
            ((PopupMenu)editMenu).enableItem(5, hasSelection);  // Paste
            ((PopupMenu)editMenu).enableItem(6, hasSelection);  // Delete
            ((PopupMenu)editMenu).enableItem(8, hasSelection);  // Deselect
        }
Esempio n. 10
0
        public override void handleDeselect()
        {
            SimSet ForestTools = "ForestTools";

            ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool");

            SelectionTool.clearSelection();
        }
Esempio n. 11
0
        public override void handleCopy()
        {
            SimSet ForestTools = "ForestTools";

            ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool");

            SelectionTool.copySelection();
        }
Esempio n. 12
0
        public override void handlePaste()
        {
            SimSet ForestTools = "ForestTools";

            ForestSelectionTool SelectionTool = ForestTools.FOF("SelectionTool");

            SelectionTool.pasteSelection();
        }
Esempio n. 13
0
        public static void sfxSetChannelVolume(SimSet channel, float volume)
        {
            SFXSource obj = sfxOldChannelToGroup(channel);

            if (obj.isObject())
            {
                obj.setVolume(volume);
            }
        }
Esempio n. 14
0
        public static void messageAll(string msgType, string msgString, params string[] args)
        {
            SimSet ClientGroup = Sim.FindObject <SimSet>("ClientGroup");

            for (uint i = 0; i < ClientGroup.getCount(); i++)
            {
                GameConnectionToClient client = ClientGroup.getObject(i).As <GameConnectionToClient>();
                messageClient(client, msgType, msgString, args);
            }
        }
Esempio n. 15
0
        public static void ServerPlay3D(SFXProfile profile, TransformF transform)
        {
            SimSet ClientGroup = Sim.FindObject <SimSet>("ClientGroup");

            // Play the given sound profile at the given position on every client
            // The sound will be transmitted as an event, not attached to any object.
            for (uint i = 0; i < ClientGroup.getCount(); i++)
            {
                ClientGroup.getObject(i).As <GameConnectionToClient>().play3D(profile, transform);
            }
        }
Esempio n. 16
0
        public override void onWorldEditorStartup()
        {
            ForestEditorGui.ForestEditBrushTree ForestEditBrushTree = "ForestEditBrushTree";
            SimSet ForestItemDataSet = "ForestItemDataSet";

            ForestEditorGui.ForestEditMeshTree ForestEditMeshTree = "ForestEditMeshTree";
            EditorGui EditorGui = "EditorGui";

            ForestEditorGui.ForestEditTabBook            ForestEditTabBook            = "ForestEditTabBook";
            ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            ForestEditorGui.ForestEditorPalleteWindow    ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";

            new ObjectCreator("PersistenceManager", "ForestDataManager").Create();

            const string brushPath = "art/forest/brushes.cs";

            if (!Util.isFile(brushPath))
            {
                Util.createPath(brushPath);
            }

            // This creates the ForestBrushGroup, all brushes, and elements.
            Util.exec(brushPath, false, false);

            SimGroup ForestBrushGroup = "ForestBrushGroup";

            if (!ForestBrushGroup.isObject())
            {
                ForestBrushGroup  = new ObjectCreator("SimGroup", "ForestBrushGroup").Create();
                this["showError"] = true.AsString();
            }

            ForestEditBrushTree.open(ForestBrushGroup);

            if (!ForestItemDataSet.isObject())
            {
                ForestItemDataSet = new ObjectCreator("SimSet", "ForestItemDataSet").Create();
            }

            ForestEditMeshTree.open(ForestItemDataSet);

            // Add ourselves to the window menu.
            string accel = EditorGui.addToEditorsMenu("Forest Editor", "", this);

            // Add ourselves to the tools menu.
            string tooltip = "Forest Editor (" + accel + ")";

            EditorGui.addToToolsToolbar("ForestEditorPlugin", "ForestEditorPalette",
                                        Util._expandFilename("tools/forestEditor/images/forest-editor-btn"), tooltip);

            //connect editor windows
            ForestEditorPalleteWindow.attachTo(ForestEditorPropertiesWindow);
            ForestEditTabBook.selectPage(0);
        }
        public void create()
        {
            GuiTextEditCtrl MeshName          = FOT("MeshName");
            GuiCheckBoxCtrl MeshMissionBounds = FOT("MeshMissionBounds");
            string          name = MeshName.getText();

            if (name == "" || Util.nameToID(name) > 0)
            {
                messageBox.MessageBoxOK("Error", "A NavMesh must have a unique name!");
                return;
            }

            NavMesh mesh = "0";

            SimSet MissionGroup = "MissionGroup";

            if (MeshMissionBounds.isStateOn())
            {
                if (!Util.isObject(MissionGroup))
                {
                    messageBox.MessageBoxOK("Error", "You must have a MissionGroup to use the mission bounds function.");
                    return;
                }
                // Get maximum extents of all objects.
                string  box   = MissionBoundsExtents(MissionGroup);
                Point3F pos   = Util.getBoxCenter(box.AsBox3F());
                string  scale = (Util.getWord(box, 3).AsInt() - Util.getWord(box, 0).AsInt()) / 2 + 5
                                + " " + (Util.getWord(box, 4).AsInt() - Util.getWord(box, 1).AsInt()) / 2 + 5
                                + " " + (Util.getWord(box, 5).AsInt() - Util.getWord(box, 2).AsInt()) / 2 + 5;

                var oc = new ObjectCreator("NavMesh", name);
                oc["position"] = pos;
                oc["scale"]    = scale;
                mesh           = oc.Create();
            }
            else
            {
                GuiTextEditCtrl MeshPosition = FOT("MeshPosition");
                GuiTextEditCtrl MeshScale    = FOT("MeshScale");

                var oc = new ObjectCreator("NavMesh", name);
                oc["position"] = MeshPosition.getText();
                oc["scale"]    = MeshScale.getText();
                mesh           = oc.Create();
            }
            MissionGroup.add(mesh);
            NavEditorGui NavEditorGui = "NavEditorGui";
            canvas       Canvas       = "Canvas";

            NavEditorGui.selectObject(mesh);

            Canvas.popDialog(this);
        }
Esempio n. 18
0
        public override void onMoveStuck(AIPlayer obj)
        {
            SimSet     path       = this["path"];
            uint       targetnode = this["targetNode"].AsUint();
            Marker     node       = path.getObject(targetnode);
            TransformF t          = node.getTransform();

            t.mPositionZ += r.Next(10, 100);
            t.mPositionX += r.Next(10, 30);
            t.mPositionY += r.Next(10, 30);
            this.setTransform(t);
        }
Esempio n. 19
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);
                }
            }
        }
        public static string MissionBoundsExtents(SimSet group)
        {
            string box   = "0 0 0 0 0 0";
            int    count = group.getCount();

            for (uint i = 0; i < count; i++)
            {
                // Skip LevelInfos. Need a way to detect other non-SceneObjects.
                // Also skip GroundPlanes. They're too big.
                SimObject obj = group.getObject(i);
                //var cls = obj.getClassName();
                var cls = obj.GetType().Name;
                if (cls == "LevelInfo" || cls == "GroundPlane" || cls == "GroundCover")
                {
                    continue;
                }

                // Get world box - might have to recurse into nested SimGroups.
                string wbox = "0 0 0 0 0 0";
                if (cls == "SimGroup" || cls == "SimSet" || cls == "Path")
                {
                    wbox = MissionBoundsExtents((SimSet)obj);
                }
                else if (obj.GetType() == typeof(SceneObject) && ((SceneObject)obj).getType() == omni.iGlobal["$TypeMasks::StaticObjectType"] &&
                         !(((SceneObject)obj).getType() == omni.iGlobal["$TypeMasks::EnvironmentObjectType"]))
                {
                    wbox = ((SceneObject)obj).getWorldBox().AsString();
                }
                else
                {
                    continue;
                }

                // Update min point.
                for (int j = 0; j < 3; j++)
                {
                    if (omni.Util.getWord(box, j).AsInt() > omni.Util.getWord(wbox, j).AsInt())
                    {
                        box = omni.Util.setWord(box, j, omni.Util.getWord(wbox, j));
                    }
                }
                // Update max point.
                for (int j = 3; j < 6; j++)
                {
                    if (omni.Util.getWord(box, j).AsInt() < omni.Util.getWord(wbox, j).AsInt())
                    {
                        box = omni.Util.setWord(box, j, omni.Util.getWord(wbox, j));
                    }
                }
            }
            return(box);
        }
Esempio n. 21
0
        /// <summary>
        /// Spawns a AI on a passed path.
        /// </summary>
        /// <param name="ainame"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public static DemoPlayer SpawnOnPath(string ainame, SimSet path)
        {
            if (!omni.console.isObject(path))
            {
                return(null);
            }

            Marker node = path.getObject((uint)r.Next(0, path.getCount() - 1));

            TransformF transform = node.getTransform();

            return(Spawn(ainame, transform));
        }
Esempio n. 22
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);
            }
        }
Esempio n. 23
0
        public override void onWake()
        {
            /*
             * %this-->theName.setText( "" );
             *
             * %matList = %this-->theMaterialList;
             * %matList.clear();
             * %count = TerrainMaterialSet.getCount();
             * for ( %i=0; %i < %count; %i++ )
             * %matList.add( TerrainMaterialSet.getObject( %i ).internalName, %i );
             * %matList.setSelected( 0 );
             *
             * %rezList = %this-->theRezList;
             * %rezList.clear();
             * %rezList.add( "256", 256 );
             * %rezList.add( "512", 512 );
             * %rezList.add( "1024", 1024 );
             * %rezList.add( "2048", 2048 );
             * //%rezList.add( "4096", 4096 );
             * %rezList.setSelected( 256 );
             *
             * %this-->flatRadio.setStateOn( true );
             */
            ((GuiTextEditCtrl)this.findObjectByInternalName("theName", true)).setText("");
            GuiPopUpMenuCtrl matList = this.findObjectByInternalName("theMaterialList", true);

            matList.clear();
            SimSet TerrainMaterialSet = "TerrainMaterialSet";
            int    count = TerrainMaterialSet.getCount();

            for (uint i = 0; i < count; i++)
            {
                matList.add(
                    ((SimObject)TerrainMaterialSet.getObject(i)).internalName,
                    (int)i);
            }
            matList.setSelected(0);

            GuiPopUpMenuCtrl rezList = this.findObjectByInternalName("theRezList", true);

            rezList.clear();
            rezList.add("256", 256);
            rezList.add("512", 512);
            rezList.add("1024", 1024);
            rezList.add("2048", 2048);

            rezList.setSelected(256);

            ((GuiRadioCtrl)this.findObjectByInternalName("flatRadio", true)).setStateOn(true);
        }
Esempio n. 24
0
        public static void messageAllExcept(GameConnectionToClient client, string msgType, string msgString, params string[] args)
        {
            //can exclude a client, a team or both. A -1 value in either field will ignore that exclusion, so
            //messageAllExcept(-1, -1, $Mesblah, 'Blah!'); will message everyone (since there shouldn't be a client -1 or client on team -1).
            SimSet ClientGroup = Sim.FindObject <SimSet>("ClientGroup");

            for (uint i = 0; i < ClientGroup.getCount(); i++)
            {
                GameConnectionToClient recipient = ClientGroup.getObject(i).As <GameConnectionToClient>();
                if (recipient.getId() != client.getId())
                {
                    messageClient(recipient, msgType, msgString, args);
                }
            }
        }
Esempio n. 25
0
        public static void sfxStopAll(SimSet channel)
        {
            channel = sfxOldChannelToGroup(channel);

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

            for (uint i = 0; i < channel.getCount(); i++)
            {
                ((SFXSource)channel.getObject(i)).stop(-1);
            }
            //SFXSource.stop(channel.getObject(i), -1);
        }
Esempio n. 26
0
        public static void ClearCenterPrintAll()
        {
            SimSet ClientGroup = "ClientGroup";
            int    count       = ClientGroup.getCount();

            for (uint i = 0; i < count; i++)
            {
                GameConnection cl = ClientGroup.getObject(i);
                if (!cl.isAIControlled())
                {
                    t3d.console.commandToClient(cl, "ClearCenterPrint");
                }
            }
            //foreach (uint client in t3d.ClientGroup.Cast<GameConnection>().Where(client => !client.isAIControlled()))
            //   t3d.console.commandToClient(client.AsString(), "ClearCenterPrint");
        }
Esempio n. 27
0
        public void initList(string filter)
        {
            GuiStackControl SFXParametersStack = this.FOT("SFXParametersStack");
            SimSet          SFXParameterGroup  = "SFXParameterGroup";

            // Clear the current lists.

            SFXParametersStack.clear();

            // Add each SFXParameter in SFXParameterGroup.

            for (uint i = 0; i < SFXParameterGroup.getCount(); i++)
            {
                SimObject obj = SFXParameterGroup.getObject(i);
                if (!Util.isMemberOfClass(obj.getClassName(), "SFXParameter"))
                {
                    continue;
                }

                // If we have a filter, search for it in the parameter's
                // categories.

                bool matchesFilter = true;
                if (filter != "")
                {
                    matchesFilter = false;

                    for (int idx = 0; obj["categories[" + idx + "]"] != ""; idx++)
                    {
                        if (obj["categories[" + idx + "]"] == filter)
                        {
                            matchesFilter = true;
                            break;
                        }
                    }
                }

                if (matchesFilter)
                {
                    this.addParameter((SFXParameter)obj);
                }
            }

            // Init the filters.

            this.initFilterList(filter);
        }
Esempio n. 28
0
        /// Resumes the playback of paused sound sources.
        ///
        /// @param %pauseSet    An optional SimSet which contains the paused sound
        /// sources to be resumed.  If not specified the global
        /// SFXPausedSet is used.
        /// @deprecated
        public static void sfxResume(SimSet pauseSet = null)
        {
            if (pauseSet == null)
            {
                pauseSet = SFXPausedSet;
            }

            int count = pauseSet.getCount();

            for (uint i = 0; i < count; i++)
            {
                SFXSource source = pauseSet.getObject(i).As <SFXSource>();
                source.play();
            }

            // Clear our pause set... the caller is left
            // to clear his own if he passed one.
            pauseSet.clear();
        }
Esempio n. 29
0
        public void snapshotMaterials()
        {
            if (!"TerrainMaterialDlgSnapshot".isObject())
            {
                new ObjectCreator("SimGroup", "TerrainMaterialDlgSnapshot").Create();
            }

            SimGroup group = "TerrainMaterialDlgSnapshot";
            SimSet   TerrainMaterialSet = "TerrainMaterialSet";

            group.clear();

            int matCount = TerrainMaterialSet.getCount();

            for (uint i = 0; i < matCount; i++)
            {
                TerrainMaterial mat = TerrainMaterialSet.getObject(i);
                if (!mat.isMemberOfClass("TerrainMaterial"))
                {
                    continue;
                }

                ObjectCreator oc = new ObjectCreator("ScriptObject");
                oc["parentGroup"]       = group.ID;
                oc["material"]          = mat;
                oc["internalName"]      = mat["internalName"];
                oc["diffuseMap"]        = mat["diffuseMap"];
                oc["normalMap"]         = mat["normalMap"];
                oc["detailMap"]         = mat["detailMap"];
                oc["macroMap"]          = mat["macroMap"];
                oc["detailSize"]        = mat["detailSize"];
                oc["diffuseSize"]       = mat["diffuseSize"];
                oc["detailStrength"]    = mat["detailStrength"];
                oc["detailDistance"]    = mat["detailDistance"];
                oc["macroSize"]         = mat["macroSize"];
                oc["macroStrength"]     = mat["macroStrength"];
                oc["macroDistance"]     = mat["macroDistance"];
                oc["useSideProjection"] = mat["useSideProjection"];
                oc["parallaxScale"]     = mat["parallaxScale"];
                oc.Create();
            }
        }
Esempio n. 30
0
        public void buildTree()
        {
            // Refresh the material list.
            GuiTreeViewCtrl matLibTree = FOT("matLibTree");

            matLibTree.clear();

            int root = matLibTree.insertItem(0, "RootMaterial", "RootMaterial", "");

            //TerrainPainterAddition
            SimSet TerrainMaterialSet = "TerrainMaterialSet";

            for (uint i = 0; i < TerrainMaterialSet.getCount(); i++)
            {
                TerrainMaterial mat = TerrainMaterialSet.getObject(i);
                if (!mat.isObject())
                {
                    continue;
                }

                string terrainFolderName = mat["terrainFolder"];
                if (terrainFolderName == "")
                {
                    terrainFolderName = "Unused";
                }

                int folder = matLibTree.findItemByName(terrainFolderName);
                if (folder == 0)
                {
                    folder = matLibTree.insertItem(root, terrainFolderName, terrainFolderName, "");
                }

                if (matLibTree.getParentItem(folder) == root)
                {
                    matLibTree.insertObject(folder, mat, true);
                }
            }
        }