Пример #1
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);
        }
Пример #2
0
        public void removeMaterial(string matInternalName)
        {
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            int selIndex = ETerrainEditor.paintIndex - 1;

            // Remove the material from the terrain.

            int index = ETerrainEditor.getMaterialIndex(matInternalName);

            if (index != -1)
            {
                ETerrainEditor.removeMaterial(index);
            }

            this.updateLayers(selIndex.AsString());
        }
Пример #3
0
        public void dialogApply()
        {
            SimGroup           TerrainMaterialDlgNewGroup    = "TerrainMaterialDlgNewGroup";
            SimGroup           TerrainMaterialDlgDeleteGroup = "TerrainMaterialDlgDeleteGroup";
            PersistenceManager ETerrainMaterialPersistMan    = "ETerrainMaterialPersistMan";
            TerrainPainter     TerrainPainter = "TerrainPainter";
            SimGroup           RootGroup      = "RootGroup";
            TerrainEditor      ETerrainEditor = "ETerrainEditor";

            // Move all new materials we have created to the root group.
            int newCount = TerrainMaterialDlgNewGroup.getCount();

            for (uint i = 0; i < newCount; i++)
            {
                RootGroup.add(TerrainMaterialDlgNewGroup.getObject(i));
            }

            // Finalize deletion of all removed materials.
            int deletedCount = TerrainMaterialDlgDeleteGroup.getCount();

            for (uint i = 0; i < deletedCount; i++)
            {
                SimObject mat = TerrainMaterialDlgDeleteGroup.getObject(i);
                ETerrainMaterialPersistMan.removeObjectFromFile(mat);

                int _matIndex = ETerrainEditor.getMaterialIndex(mat.internalName);
                if (_matIndex != -1)
                {
                    ETerrainEditor.removeMaterial(matIndex);
                    TerrainPainter.updateLayers("");
                }
                mat.delete();
            }
            // Make sure we save any changes to the current selection.
            saveDirtyMaterial(this["activeMat"]);
            // Save all changes.
            ETerrainMaterialPersistMan.saveDirty();

            // Delete the snapshot.
            "TerrainMaterialDlgSnapshot".delete();

            ((GuiCanvas)"Canvas").popDialog(this);

            Util._call(onApplyCallback, this["activeMat"], this.matIndex.AsString());
        }