Пример #1
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());
        }
Пример #2
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());
        }