void displayFoliageSet(string foliageSetName) { string fullFileName = CoreGlobals.getWorkPaths().mFoliagePath + "\\" + foliageSetName; FoliageSet fs = null; int setIndex = FoliageManager.newSet(fullFileName); fs = FoliageManager.giveSet(setIndex); //load our image for display if (!File.Exists(fullFileName + "_df.ddx")) { MessageBox.Show(fullFileName + "_df.ddx Not found for this foliage set. Please ensure it exists."); return; } Texture tex = TextureLoader.FromFile(BRenderDevice.getDevice(), fullFileName + "_df.tga"); Image img = Image.FromStream(TextureLoader.SaveToStream(ImageFileFormat.Bmp, tex)); tex.Dispose(); tex = null; Bitmap mainImage = new Bitmap(img); //now, split us into X sub images to display. int numsections = fs.mNumBlades; List <Image> images = splitImg(mainImage, numsections, fs);// splitImgHorizontally(mainImage, numsections); for (int i = 0; i < numsections; i++) { flowLayoutPanel1.Controls.Add(new FoliageBladeButton(images[i].Width, images[i].Height, images[i], fullFileName, i, this)); } }
//------------------------------------------- //public void exportPTH(string filename, ref Export360.ExportResults results) //{ // DateTime n = DateTime.Now; // filename = Path.ChangeExtension(filename, ".PTH"); // XSD_NavMesh nm = new XSD_NavMesh(); // nm.generateNavMesh(TerrainGlobals.getEditor().getSimRep().getNavMeshQuantizationDist(),512); // nm.exportNavMeshToPTH(filename); // nm = null; // TimeSpan ts = DateTime.Now - n; // results.terrainPTHTime = ts.TotalMinutes; //} //--------------------------------- public bool CreateLRP(string filename) { try { //genPTH -terrainFile <*.XSD> -lrpTreeFile <*.LRP> if (File.Exists(CoreGlobals.getWorkPaths().mLRPToolPath) == false) { MessageBox.Show("Can't find: " + CoreGlobals.getWorkPaths().mLRPToolPath, "Error exporting " + filename); return(false); } string xsdFile = filename.Substring(0, filename.LastIndexOf('.'));// Path.ChangeExtension(filename, ""); string lrpFile = Path.ChangeExtension(filename, "LRP"); if (File.Exists(lrpFile)) { File.Delete(lrpFile); } string arguments = ""; arguments = arguments + " -terrainFile \"" + xsdFile + "\""; arguments = arguments + " -lrpTreeFile \"" + lrpFile + "\""; System.Diagnostics.Process pthUtility; pthUtility = new System.Diagnostics.Process(); pthUtility = System.Diagnostics.Process.Start(CoreGlobals.getWorkPaths().mLRPToolPath, arguments); pthUtility.WaitForExit(); pthUtility.Close(); } catch (System.Exception ex) { CoreGlobals.getErrorManager().OnException(ex); } return(true); }
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); }
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; } }
//---------------------------- //---------------------------- #region AO Section Export private void exportAOFileList() { String batchExportLog = outputLog; if (batchExportLog == null) { batchExportLog = Path.Combine(CoreGlobals.getWorkPaths().mLogsDirectory, "batchExportLog." + System.DateTime.Now.ToFileTimeUtc() + ".txt"); } mExportLogStream = new StreamWriter(batchExportLog, true); //export settings Export360.ExportSettings settings = null; if (mUseCustomExportSettings == -1 || mUseCustomExportSettings == 0) { settings = null; } 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(); 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 okExported = TEDIO.TEDtoAOSection(terrainName, scenarioName, outputDir, mAoNumSections, mAoSectionIndex, settings); } if (createOwnDevice) { BRenderDevice.destroyDevice(); } mExportLogStream.Close(); if (mStatusResult == 0) { File.Delete(batchExportLog); } clearList(); }
private void RefreshButton_Click(object sender, EventArgs e) { LoadClipArt(); this.subfolderPicker1.RootFolder = CoreGlobals.getWorkPaths().mClipArt; CoreGlobals.getEditorMain().mIGUI.SetClientFocus(); }
override public void save_file() { String filepath = CoreGlobals.getWorkPaths().mGameArtDirectory + "\\" + mEffect.Name; SaveParticleSystem(filepath); SetTabName(mEffect.Name); }
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(); }
private void RemovePallete_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you'd like to delete this palette?", "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { string fname = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + palleteListBox.SelectedItem.ToString() + SimTerrainType.mTextureSetExtention; SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(fname); if (status.InPerforce == true) { if (status.CheckedOut == false) { MessageBox.Show("You must check this file out from perforce before you delete it"); return; } else if (status.CheckedOutOtherUser == true) { MessageBox.Show("This file is checked out by " + status.ActionOwner + " you cannot delete it."); return; } } if (File.Exists(fname)) { File.Delete(fname); palleteListBox.Items.Remove(palleteListBox.SelectedItem); } } }
private void SaveQuickUpdateFile() { string scenerioPath = CoreGlobals.getWorkPaths().mGameScenarioDirectory; string fileName = scenerioPath + @"\quickview\quickview.gls"; saveXML(fileName); }
public ArrayList GetMenuButtons(ArrayList commands, object bindingContext) { Type classType = bindingContext.GetType(); ArrayList buttons = new ArrayList(); //ArrayList commands = GetCommandsByType(classType); foreach (SomeCommand c in commands) { ToolStripMenuItem b = new ToolStripMenuItem(); if (c.mSettings.Icon != null) { string iconFileName = Path.Combine(CoreGlobals.getWorkPaths().mAppIconDir, c.mSettings.Icon + ".bmp"); if (File.Exists(iconFileName)) { //b.ImageScaling = ToolStripItemImageScaling.None; b.Image = new System.Drawing.Bitmap(iconFileName); b.ToolTipText = c.GetName(); b.Text = c.GetName(); } } else { b.Text = c.GetName(); } if (c.mSettings.ButtonType == eControlType.cCheck) { b.CheckOnClick = true; } b.Width += (int)(b.Width * 1.5); c.BindClick(b, bindingContext); buttons.Add(b); } return(buttons); }
static void generateFileList(string fName) { using (PerfSection p3 = new PerfSection("generateFileList")) { if (!Directory.Exists("cache")) { Directory.CreateDirectory("cache"); } string scenerioPath = CoreGlobals.getWorkPaths().mGameScenarioDirectory; string scenarioName = scenerioPath + @"\" + fName + @"\" + fName + ".scn"; string arguments = " -quiet"; arguments = arguments + @" -scriptfile " + CoreGlobals.getWorkPaths().mBaseDirectory + @"\settings\MemEst_createScenarioFileList.xml"; arguments = arguments + @" /define scenariofilename=" + scenarioName; string argGenPath = CoreGlobals.getWorkPaths().mToolsDirectory + @"\arcGen\arcGen.exe"; System.Diagnostics.Process arcgenUtility = new System.Diagnostics.Process(); arcgenUtility.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; //arcgenUtility.StartInfo.CreateNoWindow = true; arcgenUtility.StartInfo.Arguments = arguments; arcgenUtility.StartInfo.FileName = argGenPath; arcgenUtility.Start(); arcgenUtility.WaitForExit(); if (arcgenUtility.ExitCode != 0) { //!!!!! // CoreGlobals.ShowMessage("Error calculating memory estimates for : " + scenarioName + "\n Please send a screenshot of this message to the editor programmers."); } arcgenUtility.Close(); } }
public QuickStartPage() { InitializeComponent(); //OpenItems(CoreGlobals.getWorkPaths().mGameScenarioDirectory); try { TreeNode root = new TreeNode("scenario"); BuildTree(root, CoreGlobals.getWorkPaths().mGameScenarioDirectory); ScenarioTreeView.Nodes.Add(root); root.Expand(); string background = Path.Combine(CoreGlobals.getWorkPaths().mAppIconDir, "startpage.jpg"); if (File.Exists(background)) { this.panel1.BackgroundImage = Image.FromFile(background); this.panel1.BackgroundImageLayout = ImageLayout.Center; } string buildnotefile = Path.Combine(CoreGlobals.getWorkPaths().mBaseDirectory, "buildnotes.txt"); if (File.Exists(buildnotefile)) { this.textBox1.Text = File.ReadAllText(buildnotefile); } this.textBox1.ScrollBars = ScrollBars.Both; } catch (System.Exception ex) { ex.ToString(); } }
private void AutoAddButton_Click(object sender, EventArgs e) { try { string[] subDirs = Directory.GetDirectories(CoreGlobals.getWorkPaths().mGameScenarioDirectory); foreach (string dir in subDirs) { string[] files = Directory.GetFiles(dir, "*.scn"); foreach (string scenfile in files) { if (SearchForFile(scenfile) == false) { ScenarioInfoXml scenInfo = new ScenarioInfoXml(); scenInfo.File = scenfile.Replace(CoreGlobals.getWorkPaths().mGameScenarioDirectory + "\\", ""); //scenInfo.Name = Path.GetFileNameWithoutExtension(scenfile); mScenarioDescriptions.ScenarioInfoList.Add(scenInfo); } } } //basicTypedSuperList1.BatchSuspend(); //this.basicTypedSuperList1.ObjectList = mScenarioDescriptions.ScenarioInfoList; basicTypedSuperList1.UpdateData(); //basicTypedSuperList1.BatchResume(); } catch (System.Exception ex) { CoreGlobals.getErrorManager().OnException(ex); } }
private void mBtnSaveOnly_Click(object sender, EventArgs e) { string strTablePath = Path.Combine(CoreGlobals.getWorkPaths().mGameDataDirectory, mStringTableFilename); string strTableXsdPath = Path.Combine(CoreGlobals.getWorkPaths().mGameDataDirectory, "stringtable.xsd"); if (!makeWriteable(strTablePath)) { MessageBox.Show("The stringtable file could not be made writeable"); return; } // Save out the data set /* * SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(strTablePath); * if (status.CheckedOutThisUser != true) * { * MessageBox.Show(this, "You do not have the stringtable.xml file checked out", "Error", MessageBoxButtons.OK); * return; * } */ if (!SaveStringTableToFileWithBackup(strTablePath, mDoc)) { return; } MessageBox.Show(this, "The stringtable was saved to: \n\n" + strTablePath, "", MessageBoxButtons.OK); }
public LocStringPickerCompact() { InitializeComponent(); SearchButton.Image = SharedResources.GetImage(Path.Combine(CoreGlobals.getWorkPaths().mAppIconDir, "Search.bmp")); IDTextBox.TextChanged += new EventHandler(IDTextBox_TextChanged); }
public RefSetPanel() { InitializeComponent(); this.SetRefButton.Image = SharedResources.GetImage(Path.Combine(CoreGlobals.getWorkPaths().mAppIconDir, "VisualEditor_Refresh.png")); this.ClearRefButton.Image = SharedResources.GetImage(Path.Combine(CoreGlobals.getWorkPaths().mAppIconDir, "DeleteHS.png")); }
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(); }
private void SaveAsTemplate() { try { SaveFileDialog d = new SaveFileDialog(); d.Filter = "Templates (*.xml)|*.xml"; d.InitialDirectory = CoreGlobals.getWorkPaths().mTemplateRoot; if (d.ShowDialog() == DialogResult.OK) { XmlSerializer s = new XmlSerializer(typeof(TriggerTemplateDefinition), new Type[] { }); Stream st = File.Open(d.FileName, FileMode.Create); s.Serialize(st, TemplateDefinition); st.Close(); this.Parent.Text = Path.GetFileName(d.FileName); saveAsName = d.FileName; triggerHostArea1.Scan(true); //Not used by game, no xmb needed } } catch (System.Exception ex) { CoreGlobals.getErrorManager().OnException(ex); } }
public unsafe bool writeToFile(string filename) { try { if (File.Exists(CoreGlobals.getWorkPaths().mTAGToolPath) == false) { MessageBox.Show("Can't find: " + CoreGlobals.getWorkPaths().mXMBToolPath, "Error generating " + filename); return(false); } string arguments = ""; arguments = arguments + " -create"; arguments = arguments + " -outFile \"" + filename + "\""; foreach (string output in mFilesToBeTagged) { arguments = arguments + " -file \"" + output + "\""; } System.Diagnostics.Process process; process = new System.Diagnostics.Process(); process = System.Diagnostics.Process.Start(CoreGlobals.getWorkPaths().mTAGToolPath, arguments); process.WaitForExit(); process.Close(); } catch (System.Exception ex) { CoreGlobals.getErrorManager().OnException(ex); return(false); } return(true); }
public void LoadClipArt() { mMinVertValue = int.MaxValue; mMaxVertValue = int.MinValue; mClipData.Clear(); LoadDirectory(CoreGlobals.getWorkPaths().mClipArt, mbRecursive); LoadControls(); if (mMinVertValue < 0 || mMinVertValue == int.MaxValue) { mMinVertValue = 0; } if (mMaxVertValue < 0) { mMaxVertValue = 1; } if (mMaxVertValue == mMinVertValue) { mMaxVertValue++; } mSizeRange = (int)((mMaxVertValue - mMinVertValue) / mRangeLevels); sizeFiltertrackBar.Minimum = mMinVertValue / mValueScale; sizeFiltertrackBar.Maximum = mMaxVertValue / mValueScale; }
public ClipArtPicker() { InitializeComponent(); LoadClipArt(); this.subfolderPicker1.RootFolder = CoreGlobals.getWorkPaths().mClipArt; subfolderPicker1.FolderSelected += new EventHandler(subfolderPicker1_FolderSelected); InitTreeHandlers(smartTreeView1); RotationSliderControl.Setup(-90, 480, true); RotationSliderControl.ValueChanged += new EventHandler(RotationSliderControl_ValueChanged); this.ScaleXSliderControl.Logrithmic = true; ScaleXSliderControl.Setup(0, 5, true); ScaleXSliderControl.ValueChanged += new EventHandler(ScaleSliderControl_ValueChanged); this.ScaleYSliderControl.Logrithmic = true; ScaleYSliderControl.Setup(0, 5, true); ScaleYSliderControl.ValueChanged += new EventHandler(ScaleYSliderControl_ValueChanged); this.ScaleZSliderControl.Logrithmic = true; ScaleZSliderControl.Setup(0, 5, true); ScaleZSliderControl.ValueChanged += new EventHandler(ScaleZSliderControl_ValueChanged); HeightSliderControl.Setup(-100, 100, true); HeightSliderControl.ValueChanged += new EventHandler(HeightSliderControl_ValueChanged); SetDefaults(); mUpdateTimer.Interval = 300; mUpdateTimer.Tick += new EventHandler(mUpdateTimer_Tick); mUpdateTimer.Start(); }
private void ImportButton_Click(object sender, EventArgs e) { if (MessageBox.Show("This will erase the existing triggers.", "Warning!", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } try { OpenFileDialog d = new OpenFileDialog(); d.Filter = "Script (*" + CoreGlobals.getWorkPaths().mScriptExtention + ")|*" + CoreGlobals.getWorkPaths().mScriptExtention; d.InitialDirectory = CoreGlobals.getWorkPaths().mScriptTriggerDirectory; if (d.ShowDialog() == DialogResult.OK) { XmlSerializer s = new XmlSerializer(typeof(TriggerRoot), new Type[] { }); Stream st = File.OpenRead(d.FileName); TriggerData = (TriggerRoot)s.Deserialize(st); st.Close(); } } catch (System.Exception ex) { CoreGlobals.getErrorManager().OnException(ex); } }
public void Load() { mObjectTypeList.Clear(); mDocument = new XmlDocument(); mDocument.Load(CoreGlobals.getWorkPaths().mGameDataDirectory + "\\objects.xml"); mDocument2 = new XmlDocument(); mDocument2.Load(CoreGlobals.getWorkPaths().mGameDataDirectory + "\\objecttypes.xml"); //Conditions XmlNodeList objectNames = mDocument.SelectNodes("//Object/@name"); List <string> objects = new List <string>(); List <string> types = new List <string>(); foreach (XmlNode n in objectNames) { objects.Add(n.Value); } XmlNodeList objectTypeNames = mDocument2.SelectNodes("//ObjectType"); foreach (XmlNode t in objectTypeNames) { types.Add(t.InnerText); } objects.Sort(); types.Sort(); mBasicObjectTypes.AddRange(types); mObjectTypeList.AddRange(types); mObjectTypeList.AddRange(objects); }
static public void loadTerrainTileTypes() { if (mTerrainTileTypes != null) { return; } //load the XML file string fileName = CoreGlobals.getWorkPaths().mGameDataDirectory + @"\" + mTerrainTileTypeFileName; if (!File.Exists(fileName)) { CoreGlobals.getErrorManager().OnSimpleWarning("Error loading terrain tile types. Can't find " + fileName); return; } XmlSerializer s = new XmlSerializer(typeof(TerrainTileTypes), new Type[] { typeof(TerrainTileType) }); Stream st = File.OpenRead(fileName); mTerrainTileTypes = (TerrainTileTypes)s.Deserialize(st); if (mTerrainTileTypes == null) { CoreGlobals.getErrorManager().OnSimpleWarning("No terrain tile types loaded check " + fileName); } }
static public List <string> getTerrainTextures() { List <string> tex = new List <string>(); string[] texThemes = Directory.GetDirectories(CoreGlobals.getWorkPaths().mTerrainTexturesPath); for (int themes = 0; themes < texThemes.Length; themes++) { string mainFolder = texThemes[themes].Substring(texThemes[themes].LastIndexOf("\\") + 1); string[] textureNames = Directory.GetFiles(CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + mainFolder, "*.ddx", SearchOption.TopDirectoryOnly); for (int i = 0; i < textureNames.Length; i++) { //get our path relative to the theme and name string dir = Path.GetDirectoryName(textureNames[i]); string Theme = dir.Substring(dir.LastIndexOf("\\") + 1); // if (Theme == "terrain") // continue; string fname = Theme + @"\" + Path.GetFileNameWithoutExtension(textureNames[i]); if (fname.Contains("_df") && !fname.Contains("_dcl_")) { tex.Add(getpureFileNameNoExt(fname)); } } } return(tex); }
public HintDatabasePage() { InitializeComponent(); //load db mFilename = CoreGlobals.getWorkPaths().mGameDataDirectory + "\\concepts.xml"; if (File.Exists(mFilename)) { mDatabase = BaseLoader <ProtoConceptDatabase> .Load(mFilename); } mConceptEditor = propertyList1; //set metadata //mConceptEditor.SetTypeEditor("ProtoConcept", "MessageStringID", typeof(LocStringIDProperty)); //mConceptEditor.AddMetaDataForProps("ProtoConcept", new string[] { "MessageStringID" }, "Compact", true); mConceptEditor.SetTypeEditor("ProtoConcept", "Prerequisites", typeof(TriggerPropConceptList2)); mConceptEditor.AddMetaDataForProp("ProtoConcept", "Prerequisites", "StringIntSource", GetConceptEnumeration()); mConceptEditor.AddMetaDataForProp("ProtoConcept", "Prerequisites", "AllowRepeats", false); mConceptEditor.AddMetaDataForProp("ProtoConcept", "Prerequisites", "AutoSort", true); mConceptEditor.AnyPropertyChanged += new ObjectEditorControl.PropertyChanged(mConceptEditor_AnyPropertyChanged); LoadUI(); }
bool Load(string texFilename) { string ext = Path.GetExtension(texFilename); string fullFileName = texFilename; Bitmap bitmap = null; if (ext != @".bmp")//for masks { fullFileName = CoreGlobals.getWorkPaths().getWorkingTexName(texFilename); if (File.Exists(fullFileName)) { Texture tex = TextureLoader.FromFile(BRenderDevice.getDevice(), fullFileName); Image img = Image.FromStream(TextureLoader.SaveToStream(ImageFileFormat.Bmp, tex)); bitmap = new Bitmap(img); if (mPalette.mbRestrictTextureSize && (bitmap.Height != 512 || bitmap.Width != 512 || (bitmap.PixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppArgb))) { MessageBox.Show(String.Format("Texture Format must be Format32bppRgb or Format24bppRgb RGB\n {0} is {1} by {2} by {3}", fullFileName, bitmap.Height, bitmap.Width, bitmap.PixelFormat.ToString())); return(false); } else if (bitmap.Height != 512 || bitmap.Width != 512) { this.DisplayStyle = ToolStripItemDisplayStyle.Image; DropDown.Items.Clear(); return(false); } } else { Texture tex = TextureLoader.FromFile(BRenderDevice.getDevice(), EditorCore.CoreGlobals.getWorkPaths().mBlankTextureName); Image img = Image.FromStream(TextureLoader.SaveToStream(ImageFileFormat.Bmp, tex)); bitmap = new Bitmap(img); } } else //OUR BMP MASKS { if (File.Exists(fullFileName)) { bitmap = new Bitmap(fullFileName); } else { Texture tex = TextureLoader.FromFile(BRenderDevice.getDevice(), EditorCore.CoreGlobals.getWorkPaths().mBlankTextureName); Image img = Image.FromStream(TextureLoader.SaveToStream(ImageFileFormat.Bmp, tex)); bitmap = new Bitmap(img); } } Image myThumbnail = bitmap.GetThumbnailImage(mPalette.mButtonSize, mPalette.mButtonSize, mPalette.myCallback, IntPtr.Zero); ImageScaling = ToolStripItemImageScaling.None; Image = myThumbnail; ToolTipText = texFilename; return(true); }
public SaveProject() { InitializeComponent(); PopulateFolderView(); //this.label1.Text = CoreGlobals.getWorkPaths().mGameScenarioDirectory; mBaseDir = CoreGlobals.getWorkPaths().mGameScenarioDirectory; }
public WorldObjectList() { InitializeComponent(); TypeComboBox.SelectedIndex = 0; listView1.MouseDown += new MouseEventHandler(listView1_MouseDown); listView1.MouseUp += new MouseEventHandler(listView1_MouseUp); this.betterPropertyGrid1.AddMetaDataForProps("LightXML", new string[] { "Position", "Rotation", "Direction" }, "Ignore", true); this.betterPropertyGrid1.AddMetaDataForProps("SimObjectData", new string[] { "Position", "Rotation" }, "Ignore", true); this.betterPropertyGrid1.AddMetaDataForProps("PlayerPositionXML", new string[] { "Position", "Rotation", "Forward" }, "Ignore", true); this.betterPropertyGrid1.AddMetaDataForProps("HelperAreaObject", new string[] { "Position", "Direction", "Color" }, "Ignore", true); this.betterPropertyGrid1.AddMetaDataForProps("HelperAreaBoxObject", new string[] { "Position", "Direction", "Color" }, "Ignore", true); this.betterPropertyGrid1.AddMetaDataForProps("GameDesignValueSphere", new string[] { "Position", "XMLColor" }, "Ignore", true); this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "ID", "ReadOnly", true); this.betterPropertyGrid1.AddMetaDataForProp("HelperAreaObject", "ID", "ReadOnly", true); this.betterPropertyGrid1.AddMetaDataForProp("HelperAreaBoxObject", "ID", "ReadOnly", true); this.betterPropertyGrid1.SetTypeEditor("SimObjectData", "Group", typeof(EnumeratedProperty)); this.betterPropertyGrid1.SetTypeEditor("HelperAreaObject", "Group", typeof(EnumeratedProperty)); this.betterPropertyGrid1.SetTypeEditor("HelperAreaBoxObject", "Group", typeof(EnumeratedProperty)); this.betterPropertyGrid1.SetTypeEditor("GameDesignValueSphere", "Group", typeof(EnumeratedProperty)); this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "Department", "ReadOnly", true); this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "Department", "StringIntEnumeration", EnumUtils.EnumToPairList(typeof(eDepartment))); this.betterPropertyGrid1.SetTypeEditor("SimObjectData", "Department", typeof(EnumeratedProperty)); //this.betterPropertyGrid1.AddMetaDataForProp("GameDesignValueSphere", "ID", "ReadOnly", true); //this.betterPropertyGrid1.AddMetaDataForProp("GameDesignValueSphere", "DesignerData", "Ignore", true); this.betterPropertyGrid1.SetTypeEditor("GameDesignValueSphere", "DesignerData", typeof(DesignerDataEditorProperty)); this.betterPropertyGrid1.AddMetaDataForProp("GameDesignValueSphere", "ID", "ReadOnly", true); this.betterPropertyGrid1.SetTypeEditor("GameDesignLine", "DesignerData", typeof(DesignerDataEditorProperty)); this.betterPropertyGrid1.AddMetaDataForProp("GameDesignLine", "ID", "ReadOnly", true); this.betterPropertyGrid1.SetTypeEditor("GameDesignValuePoint", "DesignerData", typeof(DesignerDataEditorProperty)); this.betterPropertyGrid1.AddMetaDataForProp("GameDesignValuePoint", "ID", "ReadOnly", true); this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "TintValue", "Min", 0.0f); this.betterPropertyGrid1.AddMetaDataForProp("SimObjectData", "TintValue", "Max", 1.0f); //this.betterPropertyGrid1 betterPropertyGrid1.AnyPropertyChanged += new ObjectEditorControl.PropertyChanged(betterPropertyGrid1_AnyPropertyChanged); try { FileStream f = new FileStream(CoreGlobals.getWorkPaths().mEditorSettings + "\\LocalLightUISettings.xml", FileMode.Open, FileAccess.Read); this.betterPropertyGrid1.LoadSettingsFromStream(f); } catch (System.Exception ex) { CoreGlobals.getErrorManager().SendToErrorWarningViewer(ex.ToString()); } }