Beispiel #1
0
        public void export()
        {
            GuiListBoxCtrl TerrainSelectListBox = "TerrainSelectListBox";
            int            itemId     = TerrainSelectListBox.getSelectedItem();
            TerrainBlock   terrainObj = TerrainSelectListBox.getItemObject(itemId);

            if (!terrainObj.isObject())
            {
                messageBox.MessageBoxOK("Export failed", "Could not find the selected TerrainBlock!");
                return;
            }
            string filePath    = ((GuiTextEditCtrl)"SelectFolderTextEdit").getText();
            string terrainName = terrainObj.getName();

            if (terrainName == "")
            {
                terrainName = "Unnamed";
            }

            string fileName   = terrainName + "_heightmap.png";
            string filePrefix = terrainName + "_layerMap";

            string ret = terrainObj.call("exportHeightMap", new string[] { filePath + "/" + fileName, "png" });

            if (ret.AsBool())
            {
                ret = terrainObj.call("exportLayerMaps", new string[] { filePath + "/" + filePrefix, "png" });
            }

            if (ret.AsBool())
            {
                close();
            }
        }
Beispiel #2
0
        public void findAllTerrains()
        {
            GuiListBoxCtrl TerrainSelectListBox = "TerrainSelectListBox";

            TerrainSelectListBox.clearItems();

            if ("MegaTerrain".isObject())
            {
                TerrainSelectListBox.addItem("MegaTerrain", "");
            }
            // Find all of the terrain files

            Util.initContainerTypeSearch((uint)SceneObjectTypesAsUint.TerrainObjectType, false);

            string terrainObject = Util.containerSearchNext(false);

            while (terrainObject != "0")
            {
                uint   terrainID   = terrainObject.getUID();
                string terrainName = terrainObject.getName();
                if (terrainName == "")
                {
                    terrainName = "Unnamed (" + terrainID + ")";
                }
                TerrainSelectListBox.addItem(terrainName, terrainID.AsString());
            }
        }