Exemple #1
0
        public override void apply(List <VertIndexWeight> verts, float intensity, bool alternate)
        {
            if (verts.Count == 0)
            {
                return;
            }

            BTileBoundingBox vertexTouchedExtends = new BTileBoundingBox();

            // Go through points and adjust accordingly.
            for (int i = 0; i < verts.Count; i++)
            {
                int   index  = verts[i].index;
                float weight = verts[i].weight;

                int z = (int)(index / TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumXPoints());
                int x = (int)(index % TerrainGlobals.getEditor().getSimRep().getHeightRep().getNumZPoints());

                SimTileData.eTileTypeOverrideVal passV = TerrainGlobals.getEditor().getSimRep().getDataTiles().getTileTypeBrushState();
                if (passV == SimTileData.eTileTypeOverrideVal.cTileType_None || alternate)
                {
                    TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedTileType(x - 1, z - 1, 0);
                }
                else
                {
                    {
                        //find the override index, and set it to the type.
                        int idx = SimTerrainType.getTileTypeIndexByName(TerrainGlobals.getEditor().getSimRep().getDataTiles().getTileTypeOverrideSelection());
                        TerrainGlobals.getEditor().getSimRep().getDataTiles().setJaggedTileType(x - 1, z - 1, idx);
                    }
                }
                vertexTouchedExtends.addPoint(x, z);
            }
            TerrainGlobals.getEditor().getSimRep().updateAfterPainted(vertexTouchedExtends.minX, vertexTouchedExtends.minZ, vertexTouchedExtends.maxX, vertexTouchedExtends.maxZ);
        }
Exemple #2
0
        public void init()
        {
            mTextureButtons.Clear();
            Items.Clear();

            Items.Add(mSelectedButton);

            for (int i = 0; i < SimTerrainType.mActiveWorkingSet.Count; i++)
            {
                TerrainTextureDef d      = SimTerrainType.getFromNumber(SimTerrainType.mActiveWorkingSet[i]);
                TextureButton     button = new TextureButton(i, this, d.TypeName);
                button.TextureName = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + d.Theme + @"\" + d.TextureName + ".tga";
                Items.Add(button);
                mTextureButtons.Add(button);
            }
            mSelectedButton.Image = mTextureButtons[0].Image;

            if (mLoadPaletteButton == null)
            {
                mLoadPaletteButton        = new ToolStripButton();
                mLoadPaletteButton.Text   = "Load Palette";
                mLoadPaletteButton.Click += new EventHandler(mLoadPaletteButton_Click);
            }


            if (mSavePaletteButton == null)
            {
                mSavePaletteButton        = new ToolStripButton();
                mSavePaletteButton.Text   = "Save Palette";
                mSavePaletteButton.Click += new EventHandler(mSavePaletteButton_Click);
            }

            Items.Add(mLoadPaletteButton);
            Items.Add(mSavePaletteButton);
        }
Exemple #3
0
            protected override void OnDoubleClick(EventArgs e)
            {
                mParent.mSelectedDef = SimTerrainType.getFromTypeName(typename);

                mParent.DialogResult = DialogResult.OK;
                mParent.Close();
            }
Exemple #4
0
        private void initGridControl()
        {
            SimTerrainType.loadTerrainTileTypes();

            gridControl1.DataRows.Clear();
            //setup our control grid
            gridControl1.DataSource      = mTypesList;
            gridControl1.SingleClickEdit = true;
            //  AddComboEditor(gridControl1.Columns, getColumWithName("TerrainGroup"), SimEditor.SimTerrainType.mValidGroupings.ToArray());

            int count = SimTerrainType.mTerrainTileTypes.mTypes.Count;

            string[] values = new string[count];
            for (int i = 0; i < count; i++)
            {
                values[i] = SimTerrainType.mTerrainTileTypes.mTypes[i].Name;
            }
            AddComboEditor(gridControl1.Columns, getColumWithName("TileType"), values);

            //load our thumbnail images
            gridControl1.Columns["Preview"].Width = thumnailRes;
            for (int i = 0; i < mTypesList.Count; i++)
            {
                string             pureName = SimTerrainType.getpureFileNameNoExt(mTypesList[i].TextureName);
                string             texName  = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + mTypesList[i].Theme + @"\" + pureName + "_df.tga";
                Xceed.Grid.DataRow row      = gridControl1.DataRows[i];
                row.Cells["Preview"].BackgroundImage = TextureManager.loadTextureToThumbnail(texName, thumnailRes);
                row.Height = thumnailRes;
            }
        }
Exemple #5
0
        public void addSelectTexture(TerrainTextureButton but)
        {
            if (mSelectedButton != null)
            {
                mSelectedButton.Invalidate();
            }

            mSelectedButton = but;
            mSelectedButton.Invalidate();


            if (but is TerrainTextureSplatButton)
            {
                SelectedDef = SimTerrainType.getFromTypeName(but.typename);

                if (!isActiveSetSelected())
                {
                    TerrainGlobals.getTexturing().addActiveTexture(SimTerrainType.getWorkingTexName(mSelectedDef));
                }
            }
            else if (but is TerrainTextureDecalButton)
            {
                if (!isActiveSetSelected())
                {
                    TerrainGlobals.getTexturing().addActiveDecal(((TerrainTextureDecalButton)but).mFullFilename);
                }
                TerrainGlobals.getTerrainFrontEnd().SelectedDecalIndex = TerrainGlobals.getTexturing().getActiveDecalIndex(((TerrainTextureDecalButton)but).mFullFilename);
                if (TerrainGlobals.getEditor().getRenderMode() == BTerrainEditor.eEditorRenderMode.cRenderTextureSelectRender)
                {
                    TerrainGlobals.getTexturing().reloadCachedVisuals();
                }
            }
        }
Exemple #6
0
            void OnLoad(object sender, EventArgs e)
            {
                UIManager.Pause();

                if (mPalette.mIsMaskPalette)
                {
                    OpenFileDialog d = new OpenFileDialog();
                    d.Filter           = "Terrain Texture Masks (*.bmp)|*.bmp";
                    d.InitialDirectory = CoreGlobals.getWorkPaths().mBrushMasks;
                    if (d.ShowDialog() == DialogResult.OK)
                    {
                        TextureName = (d.FileName);
                    }
                }
                else
                {
                    if (mPalette.tpv.ShowDialog() == DialogResult.OK)
                    {
                        TextureName = SimTerrainType.getWorkingTexName(mPalette.tpv.mSelectedDef);
                    }
                }


                UIManager.UnPause();
            }
Exemple #7
0
        private void TexturingPanelFull_Load(object sender, EventArgs e)
        {
            comboBox1.Items.Clear();
            comboBox1.Items.Add("Active Set");

            //populate our texture themes
            string[] texThemes = Directory.GetDirectories(CoreGlobals.getWorkPaths().mTerrainTexturesPath);
            for (int i = 0; i < texThemes.Length; i++)
            {
                comboBox1.Items.Add(texThemes[i].Substring(texThemes[i].LastIndexOf("\\") + 1) + "_FULL");
            }

            mNumThemes = texThemes.Length;

            List <string> setNames = SimTerrainType.loadTerrainPalettes();

            for (int i = 0; i < setNames.Count; i++)
            {
                comboBox1.Items.Add(setNames[i]);
            }

            comboBox1.SelectedIndex = 0;

            comboBox2.SelectedIndex = 1;


            InitToolBars();
        }
Exemple #8
0
 public void writeTerrainTypesGrid()
 {
     if (mTypesList.Count == 0)
     {
         return;
     }
     SimTerrainType.mergeFilteredDefs(mTypesList);
     SimTerrainType.writeTerrainTypes();
 }
Exemple #9
0
        public void fillTerrainTypesGrid(string texDir)
        {
            SimTerrainType.mergeFilteredDefs(mTypesList);

            mTypesList.Clear();

            mTypesList = SimTerrainType.getFilteredDefs(texDir);
            initGridControl();
        }
Exemple #10
0
        private void TexturePaletteViewer_Load(object sender, EventArgs e)
        {
            paletteComboBox.Items.Clear();
            List <string> setNames = SimTerrainType.loadTerrainPalettes();

            for (int i = 0; i < setNames.Count; i++)
            {
                paletteComboBox.Items.Add(setNames[i]);
            }
        }
Exemple #11
0
        public void fillSetComboBox()
        {
            palleteListBox.Items.Clear();
            List <string> setNames = SimTerrainType.loadTerrainPalettes();

            for (int i = 0; i < setNames.Count; i++)
            {
                palleteListBox.Items.Add(setNames[i]);
            }
        }
Exemple #12
0
        public void SelectButton(TerrainTypeButton but)
        {
            if (mSelectedButton != null)
            {
                mSelectedButton.Invalidate();
            }

            mSelectedButton = but;
            mSelectedButton.Invalidate();
            mSelectedDef = SimTerrainType.getFromTypeName(mSelectedButton.typename);
        }
Exemple #13
0
        public void swapSelectTexture(TerrainTextureButton but)
        {
            if (mSelectedButton != but)
            {
                TerrainTextureDef newDef  = null;
                TerrainTextureDef origDef = mSelectedDef;
                bool activeSel            = isActiveSetSelected();
                if (activeSel)
                {
                    newDef = SimTerrainType.getFromTypeName(but.typename);
                }
                else
                {
                    addSelectTexture(but);
                    newDef = mSelectedDef;
                }

                //replace across the board
                if (mSelectSwap)
                {
                    TerrainGlobals.getTexturing().swapActiveTextures(SimTerrainType.getActiveSetIndex(origDef), SimTerrainType.getActiveSetIndex(newDef));
                    SimTerrainType.swapActiveSetDef(SimTerrainType.getActiveSetIndex(origDef), SimTerrainType.getActiveSetIndex(newDef));
                }
                else if (mSelectReplace)
                {
                    if (SimTerrainType.getActiveSetIndex(newDef) == 0)
                    {
                        MessageBox.Show("You can not replace with the base texture");
                    }
                    else
                    {
                        TerrainGlobals.getTexturing().replaceActiveTexture(SimTerrainType.getActiveSetIndex(origDef), SimTerrainType.getActiveSetIndex(newDef));
                        SimTerrainType.removeActiveSetDef(origDef);
                    }
                }

                if (!activeSel)
                {
                    //now select our new texture
                    addSelectTexture(but);
                }
            }
            mSelectSwap     = false;
            mSelectReplace  = false;
            alertLabel.Text = "";

            TerrainGlobals.getTexturing().freeAllCaches();
            selectActiveSet();
            redrawPreviewList(0);
            SelectButton(but);

            //TerrainGlobals.getTexturing().reloadActiveTextures(true);
        }
Exemple #14
0
        public void fillSetList(string setName)
        {
            setList.Items.Clear();

            string fname = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + setName + SimTerrainType.mTextureSetExtention;

            List <TerrainSetTexture> texSet = SimTerrainType.loadTerrainPalette(fname);

            foreach (TerrainSetTexture obj in texSet)
            {
                setList.Items.Add(obj.mTypeName);
            }
        }
Exemple #15
0
        private void showSelectedPallete_Click(object sender, EventArgs e)
        {
            if (setList.Items.Count <= 0)
            {
                return;
            }

            mTypesList.Clear();
            for (int i = 0; i < setList.Items.Count; i++)
            {
                string item = setList.Items[i].ToString();
                mTypesList.Add(SimTerrainType.getDefFromDat(item));
            }
            initGridControl();
        }
Exemple #16
0
        public void apply()
        {
            string fName     = Path.GetFileNameWithoutExtension(mData.Texture);
            string dir       = Path.GetDirectoryName(mData.Texture);
            string themeName = dir.Substring(dir.LastIndexOf("\\") + 1);

            TerrainTextureDef SelectedDef = SimTerrainType.getFromTypeName(themeName + "_" + fName);

            TerrainGlobals.getTexturing().addActiveTexture(SimTerrainType.getWorkingTexName(SelectedDef));
            SimTerrainType.addActiveSetDef(SelectedDef);
            TerrainGlobals.getTerrainFrontEnd().SelectedTextureIndex = SimTerrainType.getActiveSetIndex(SelectedDef);


            TerrainGlobals.getEditor().applyTextureToMask();
        }
Exemple #17
0
        public void createTexturesFromSimDefs()
        {
            mActiveTextures.Clear();

            List <TerrainTextureDef> activeTexDefs = SimTerrainType.getDefsOfActiveSet();

            for (int i = 0; i < activeTexDefs.Count; i++)
            {
                if (BRenderDevice.getDevice() != null)
                {
                    string fullFileName = SimTerrainType.getWorkingTexName(activeTexDefs[i]);
                    addActiveTexture(fullFileName);
                }
            }
        }
Exemple #18
0
        public void writeSetList(string setName)
        {
            List <string> texSet = new List <string>();

            for (int i = 0; i < setList.Items.Count; i++)
            {
                texSet.Add(setList.Items[i].ToString());
            }


            SimTerrainType.writeTerrainPalette(setName, texSet);

            //reload our set listing
            fillSetComboBox();
            palleteListBox.SelectedIndex = -1;
        }
Exemple #19
0
        public override void Activate()
        {
            mTypesList.Clear();
            gridControl1.DataRows.Clear();
            themeSelectBox.Items.Clear();

            SimTerrainType.loadTerrainTypes();

            //populate our texture themes
            string[] texThemes = Directory.GetDirectories(CoreGlobals.getWorkPaths().mTerrainTexturesPath);
            for (int i = 0; i < texThemes.Length; i++)
            {
                themeSelectBox.Items.Add(texThemes[i].Substring(texThemes[i].LastIndexOf("\\") + 1));
            }

            fillSetComboBox();
        }
Exemple #20
0
        void mLoadPaletteButton_Click(object sender, EventArgs e)
        {
            mDontDoInvokeCallback = true;

            OpenFileDialog d = new OpenFileDialog();

            d.Filter           = "Terrain Texture Palette (*" + SimTerrainType.mTextureSetExtention + ")|*" + SimTerrainType.mTextureSetExtention;
            d.InitialDirectory = CoreGlobals.getWorkPaths().mTerrainTexturesPath;
            if (d.ShowDialog() == DialogResult.OK)
            {
                SimTerrainType.loadActiveSetFromPalette(d.FileName);
                init();
                // TerrainGlobals.getTexturing().reloadActiveTextures(true);
            }

            mDontDoInvokeCallback = false;
        }
Exemple #21
0
        public void LoadResouces()
        {
            //mStringTable.Load();
            mTechData.Load();
            mProtoObjectData.Load();
            mObjectTypeData.Load();
            mProtoSquadData.Load();
            mGameData.Load();
            mLeaders.Load();
            mPowers.Load();
            mExposedScripts.Load();
            mIconData.Load();
            mPlacementRuleData.Load();
            SimTerrainType.loadTerrainTileTypes();

            mHintConcepts.Load();
        }
Exemple #22
0
        void mSavePaletteButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog d = new SaveFileDialog();

            d.Filter           = "Terrain Texture Set (*" + SimTerrainType.mTextureSetExtention + ")|*" + SimTerrainType.mTextureSetExtention;
            d.InitialDirectory = CoreGlobals.getWorkPaths().mTerrainTexturesPath;
            if (d.ShowDialog() == DialogResult.OK)
            {
                string fname = d.FileName;
                if (!Path.HasExtension(fname))
                {
                    fname += SimTerrainType.mTextureSetExtention;
                }

                List <string> texSet = SimTerrainType.getTypeNamesOfActiveSet();
                SimTerrainType.writeTerrainPalette(fname, texSet);
            }
        }
Exemple #23
0
        private void paletteComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            flowLayoutPanel1.Controls.Clear();

            string setName = paletteComboBox.SelectedItem.ToString();
            string fname   = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + setName + SimTerrainType.mTextureSetExtention;
            List <TerrainSetTexture> texSet = SimTerrainType.loadTerrainPalette(fname);

            foreach (TerrainSetTexture obj in texSet)
            {
                TerrainTextureDef def = SimTerrainType.getFromTypeName(obj.mTypeName);
                if (def == null)
                {
                    def = new TerrainTextureDef();
                    def.ObstructLand = false;
                    def.TextureName  = EditorCore.CoreGlobals.getWorkPaths().mBlankTextureName;
                }
                flowLayoutPanel1.Controls.Add(new TerrainTypeButton(obj.mTypeName, TextureManager.loadTextureToThumbnail(SimTerrainType.getWorkingTexName(def), 16), this));
            }
        }
Exemple #24
0
        public void removeSelectedTexture()
        {
            if (mSelectedButton is TerrainTextureSplatButton)
            {
                if (TerrainGlobals.getTerrainFrontEnd().SelectedTextureIndex == 0)
                {
                    return;
                }

                if (SimTerrainType.mActiveWorkingSet.Count - 1 <= 0)
                {
                    return;
                }

                TerrainGlobals.getTexturing().removeActiveTexture(SimTerrainType.getActiveSetIndex(mSelectedDef));

                SimTerrainType.removeActiveSetDef(mSelectedDef);

                flowLayoutPanel1.Controls.Remove(mSelectedButton);
                SelectedDef = SimTerrainType.getDefsOfActiveSet()[0];
            }
            else
            {
                //   if (TerrainGlobals.getTerrainFrontEnd().SelectedTextureIndex == 0)
                //      return;

                int index = TerrainGlobals.getTexturing().getActiveDecalIndex(((TerrainTextureDecalButton)mSelectedButton).mFullFilename);
                TerrainGlobals.getTexturing().removeActiveDecal(index);


                flowLayoutPanel1.Controls.Remove(mSelectedButton);
                SelectedDef = SimTerrainType.getDefsOfActiveSet()[0];
            }
            redrawPreviewList(0);
            mSelectedButton = (TerrainTextureButton)flowLayoutPanel1.Controls[firstSplatIndex()];
        }
Exemple #25
0
        //------------------------------------------------



        public void filterGrid(string theme, string group)
        {
            mTypesList.Clear();

            mTypesList = SimTerrainType.getFilteredDefs(theme);
        }
Exemple #26
0
        private int writeTileType()
        {
            ECF.ECFChunkHolder chunkHolder = new ECF.ECFChunkHolder();
            chunkHolder.mDataMemStream = new MemoryStream();
            BinaryWriter binWriter = new BinaryWriter(chunkHolder.mDataMemStream);

            BTerrainSimRep simRep = TerrainGlobals.getEditor().getSimRep();


            // Write tile types
            int numTiles             = simRep.getNumXTiles();
            int obstructionArraySize = numTiles * numTiles;

            SimTerrainType.loadTerrainTileTypes();
            int tileTypeArraySize = obstructionArraySize;

            byte[] tileTypeArray = new byte[tileTypeArraySize];
            for (int x = 0; x < numTiles; x++)
            {
                for (int z = 0; z < numTiles; z++)
                {
                    int index = (x * numTiles + z);

                    //if we have a tile type override, use it
                    int typeOverride = TerrainGlobals.getEditor().getSimRep().getDataTiles().getJaggedTileType(z, x);
                    if (typeOverride > 0)
                    {
                        tileTypeArray[index] = (byte)typeOverride;
                    }
                    else
                    {
                        // Get each tile's dominant texture index
                        int dominantTextureIndex = TerrainGlobals.getEditor().giveDominantTextureAtTile(x, z, simRep);

                        tileTypeArray[index] = 0;
                        if (dominantTextureIndex != -1)
                        {
                            byte   numTypes            = (byte)SimTerrainType.mTerrainTileTypes.mTypes.Count;
                            string dominantTextureType = SimTerrainType.mTextureList[dominantTextureIndex].TileType;
                            // Find the dominant texture's type
                            for (byte typeIndex = 0; typeIndex < numTypes; typeIndex++)
                            {
                                if (SimTerrainType.mTerrainTileTypes.mTypes[typeIndex].Name == dominantTextureType)
                                {
                                    tileTypeArray[index] = typeIndex;
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            binWriter.Write(tileTypeArray);

            ExportTo360.mECF.addChunk((int)eXSD_ChunkID.cXSD_TileTypes, chunkHolder, binWriter.BaseStream.Length);
            binWriter.Close();
            binWriter = null;
            chunkHolder.Close();
            chunkHolder = null;

            return(tileTypeArray.Length);
        }
Exemple #27
0
        public void redrawPreviewList(int paletteIndex)
        {
            //try
            //{

            flowLayoutPanel1.Controls.Clear();
            flowLayoutPanel1.Controls.Add(new TerrainTitleButton("SplatTextures", this));
            string setName = "";

            if (paletteIndex == 0)
            {
                List <TerrainTextureDef> activeTexDefs = SimTerrainType.getDefsOfActiveSet();

                if (activeTexDefs.Count == 0)
                {
                    MessageBox.Show("An error has occured with the active texture defnitions. Please send this scenario to the editor people.");
                    return;
                }

                for (int i = 0; i < activeTexDefs.Count; i++)
                {
                    flowLayoutPanel1.Controls.Add(new TerrainTextureSplatButton(activeTexDefs[i].TypeName,
                                                                                SimTerrainType.getWorkingTexName(activeTexDefs[i]),
                                                                                TextureManager.loadTextureToThumbnail(SimTerrainType.getWorkingTexName(activeTexDefs[i]), mThumbnailSize),
                                                                                this));
                }
                //visually identify our base texture
                flowLayoutPanel1.Controls[firstSplatIndex()].BackColor = Color.FromArgb(96, 0, 0, 0);
            }
            else if (paletteIndex <= mNumThemes)
            {
                setName = comboBox1.Items[paletteIndex].ToString();
                setName = setName.Remove(setName.LastIndexOf("_FULL"));

                List <TerrainTextureDef> tList = SimTerrainType.getFilteredDefs(setName);
                setName = comboBox1.Items[paletteIndex].ToString();
                for (int i = 0; i < tList.Count; i++)
                {
                    flowLayoutPanel1.Controls.Add(new TerrainTextureSplatButton(tList[i].TypeName,
                                                                                SimTerrainType.getWorkingTexName(tList[i]),
                                                                                TextureManager.loadTextureToThumbnail(SimTerrainType.getWorkingTexName(tList[i]), mThumbnailSize),
                                                                                this));
                }
            }
            else
            {
                setName = comboBox1.Items[paletteIndex].ToString();

                string fname = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + setName + SimTerrainType.mTextureSetExtention;
                List <TerrainSetTexture> texSet = SimTerrainType.loadTerrainPalette(fname);

                for (int i = 0; i < texSet.Count; i++)
                {
                    TerrainSetTexture obj = texSet[i];
                    {
                        TerrainTextureDef def = SimTerrainType.getFromTypeName(obj.mTypeName);
                        if (def == null)
                        {
                            def = new TerrainTextureDef();
                            def.ObstructLand = false;
                            def.TextureName  = EditorCore.CoreGlobals.getWorkPaths().mBlankTextureName;
                        }
                        flowLayoutPanel1.Controls.Add(new TerrainTextureSplatButton(obj.mTypeName,
                                                                                    SimTerrainType.getWorkingTexName(def),
                                                                                    TextureManager.loadTextureToThumbnail(SimTerrainType.getWorkingTexName(def), mThumbnailSize),
                                                                                    this));
                    }
                }
            }

            flowLayoutPanel1.Controls.Add(new TerrainTitleButton("DecalTextures", this));
            int decalIndex = firstDecalIndex();

            //now add our decals
            if (paletteIndex == 0)
            {
                for (int i = 0; i < TerrainGlobals.getTexturing().getActiveDecalCount(); i++)
                {
                    string displName = Path.GetFileNameWithoutExtension(TerrainGlobals.getTexturing().getActiveDecal(i).mFilename);
                    displName = displName.Remove(displName.LastIndexOf("_"));

                    flowLayoutPanel1.Controls.Add(new TerrainTextureDecalButton(displName,
                                                                                TerrainGlobals.getTexturing().getActiveDecal(i).mFilename,
                                                                                TextureManager.loadTextureToThumbnail(TerrainGlobals.getTexturing().getActiveDecal(i).mFilename, mThumbnailSize),
                                                                                this));
                }
            }
            else if (paletteIndex <= mNumThemes)
            {
                setName = comboBox1.Items[paletteIndex].ToString();
                setName = setName.Remove(setName.LastIndexOf("_FULL"));

                string[] textureNames = Directory.GetFiles(CoreGlobals.getWorkPaths().mTerrainTexturesPath + "\\" + setName, "*_dcl_*.ddx", SearchOption.AllDirectories);

                for (int i = 0; i < textureNames.Length; i++)
                {
                    if (!textureNames[i].Contains("_df"))
                    {
                        continue;
                    }

                    String ext = Path.GetExtension(textureNames[i]);
                    if (!File.Exists(textureNames[i].Substring(0, textureNames[i].LastIndexOf("_df")) + "_op" + ext))
                    {
                        continue;
                    }


                    string displName = Path.GetFileNameWithoutExtension(textureNames[i]);
                    displName = displName.Remove(displName.LastIndexOf("_"));
                    flowLayoutPanel1.Controls.Add(new TerrainTextureDecalButton(displName,
                                                                                Path.ChangeExtension(textureNames[i], ".tga"),
                                                                                TextureManager.loadTextureToThumbnail(Path.ChangeExtension(textureNames[i], ".tga"), mThumbnailSize),
                                                                                this));
                }
            }
            else
            {
                //not supported yet...
            }

            //}
            //catch (System.Exception ex)
            //{
            //   if (mbPostTEDLoadRecovery)
            //   {
            //      CoreGlobals.getErrorManager().OnException(ex);
            //   }

            //}
        }
Exemple #28
0
        public uint getTileTypeColor(int tileTypeIndex)
        {
            TerrainTileType type = SimTerrainType.getTileTypeByIndex(tileTypeIndex);

            return(Convert.ToUInt32(type.EditorColor, 16));;
        }
Exemple #29
0
 private void ApplyTexturePropFrm_Load(object sender, EventArgs e)
 {
     textureComboList.Items.Clear();
     textureComboList.Items.AddRange(SimTerrainType.getTerrainTextures().ToArray());
 }
Exemple #30
0
        //----------------------------
        private void exportFileList()
        {
            String batchExportLog = outputLog;

            if (batchExportLog == null)
            {
                batchExportLog = Path.Combine(CoreGlobals.getWorkPaths().mLogsDirectory, "batchExportLog." + System.DateTime.Now.ToFileTimeUtc() + ".txt");
            }
            mExportLogStream = new StreamWriter(batchExportLog, true);
            listBox1.Items.Clear();


            DateTime start = DateTime.Now;

            SimTerrainType.loadTerrainTypes();


            Exportbutton.Enabled = false;
            progressBar1.Value   = 0;
            progressBar1.Maximum = mScenarioFilesToExport.Count;// ToExportListBox.SelectedItems.Count;



            //export settings
            Export360.ExportSettings settings = null;
            if (mUseCustomExportSettings == -1)
            {
                settings = null;
            }
            else if (mUseCustomExportSettings == 0)
            {
                ExportDialog mExportDialog = new ExportDialog();
                mExportDialog.mExportSettings = new Export360.ExportSettings();
                mExportDialog.mExportSettings.SettingsQuick();
                mExportDialog.mIsQuickExport = true;
                if (mExportDialog.ShowDialog() == DialogResult.OK)
                {
                    settings = mExportDialog.mExportSettings;
                }
            }
            else if (mUseCustomExportSettings == 1)
            {
                settings = new Export360.ExportSettings();
                settings.SettingsQuick();
            }
            else if (mUseCustomExportSettings == 2)
            {
                settings = new Export360.ExportSettings();
                settings.SettingsFinal();
            }



            bool createOwnDevice = BRenderDevice.getDevice() == null;

            if (createOwnDevice)
            {
                BRenderDevice.createDevice(this, 640, 480, false);
            }

            GrannyManager2.init();

            saveCheckOptions();

            for (int fileCount = 0; fileCount < mScenarioFilesToExport.Count; fileCount++)// (string file in ToExportListBox.SelectedItems)
            {
                string scenarioName = mScenarioFilesToExport[fileCount].mFilename;
                string terrainName  = mTerrainFilesToExport[mScenarioFilesToExport[fileCount].mTerrainFileIndex].mFilename;

                bool terrainAlreadyExported = hasBeenExported(fileCount);

                //if our owner terrain has already been exported, and we're not generating XSD files, bail.
                if (terrainAlreadyExported && !doXSD.Checked)
                {
                    continue;
                }

                bool canEdit = mIgnorePerforce ? true : P4CanEdit(scenarioName, terrainName, mCheckoutFromPerforce);

                if (canEdit)
                {
                    //toggle our check boxes for already exported terrain files
                    doXTD.Checked &= !terrainAlreadyExported;
                    doXTT.Checked &= !terrainAlreadyExported;
                    doXTH.Checked &= !terrainAlreadyExported;

                    bool okExported = TEDIO.TEDto360(terrainName, scenarioName,
                                                     outputDir,
                                                     settings,
                                                     doXTD.Checked,
                                                     doXTT.Checked,
                                                     doXTH.Checked,
                                                     doXSD.Checked,
                                                     doLRP.Checked,
                                                     doDEP.Checked,
                                                     doTAG.Checked,
                                                     doXMB.Checked);



                    if (okExported)
                    {
                        outputMessage(Path.GetFileNameWithoutExtension(scenarioName) + ": EXPORT SUCCEEDED!--------------------");
                    }
                    else
                    {
                        mStatusResult = 2;
                        outputMessage(Path.GetFileNameWithoutExtension(scenarioName) + ": ABORTED! There was a problem exporting the files");
                        P4RevertAllNeededFiles(scenarioName, terrainName);
                    }
                }

                progressBar1.Invoke(updateProgress);
                restoreCheckOptions();
                markScenarioExported(fileCount);
            }



            if (createOwnDevice)
            {
                BRenderDevice.destroyDevice();
            }

            if (!mIgnorePerforce && mCheckinWhenFinished)
            {
                outputMessage("Checking in files");
                P4SubmitChangelist();
            }


            Exportbutton.Enabled = true;

            TimeSpan ts = DateTime.Now - start;

            outputMessage("====Time : " + ts.TotalMinutes + " Minutes");
            outputMessage("====Export Finished====");

            //   GrannyManager2.deinit();

            mExportLogStream.Close();

            if (mStatusResult == 0)
            {
                File.Delete(batchExportLog);
            }

            clearList();
        }