private void ReloadEditors(BxlytHeader activeLayout) { if (!isLoaded) { return; } if (LayoutProperties != null) { LayoutProperties.Reset(); } if (LayoutHierarchy != null) { LayoutHierarchy.LoadLayout(activeLayout, ObjectSelected); } if (LayoutTextureList != null) { LayoutTextureList.LoadTextures(this, activeLayout, Textures); } if (TextConverter != null) { if (ActiveLayout.FileInfo is BFLYT) { TextConverter.LoadLayout((BFLYT)ActiveLayout.FileInfo); } } }
public void LoadLayout(BxlytHeader bxlyt, EventHandler onPropertySelected) { isLoaded = false; OnProperySelected = onPropertySelected; ActiveLayout = bxlyt; treeView1.BeginUpdate(); treeView1.Nodes.Clear(); CreateQuickAccess(bxlyt); treeView1.Nodes.Add(new TreeNode("File Settings") { Tag = bxlyt }); LoadTextures(bxlyt.Textures); LoadFonts(bxlyt.Fonts); LoadMaterials(bxlyt.GetMaterials()); LoadPane(bxlyt.RootGroup); LoadPane(bxlyt.RootPane); treeView1.EndUpdate(); isLoaded = true; }
public void SearchAnimations(BxlytHeader bxlyt) { isLoaded = false; var layoutFile = bxlyt.FileInfo; var parentArchive = layoutFile.IFileInfo.ArchiveParent; if (parentArchive == null) { return; } listView1.BeginUpdate(); foreach (var file in parentArchive.Files) { if (Utils.GetExtension(file.FileName) == ".brlan" || Utils.GetExtension(file.FileName) == ".bclan" || Utils.GetExtension(file.FileName) == ".bflan") { LoadAnimation(file); } } listView1.Sort(); listView1.EndUpdate(); isLoaded = true; }
public override void Write(FileWriter writer, BxlytHeader header) { writer.Write(DrawFromCenter); writer.Seek(3); writer.Write(Width); writer.Write(Height); }
public virtual void Write(FileWriter writer, BxlytHeader header) { if (Data != null) { writer.Write(Data); } }
public void AddLayout(BxlytHeader header) { if (!PartLayouts.ContainsKey(header.FileName)) { PartLayouts.Add(header.FileName, header); } }
private void dockPanel1_ActiveDocumentChanged(object sender, EventArgs e) { var dockContent = dockPanel1.ActiveDocument as DockContent; if (dockContent == null) { return; } LayoutViewer viewer = null; foreach (var control in dockContent.Controls) { if (control is LayoutViewer) { viewer = control as LayoutViewer; } } if (viewer != null) { var file = viewer.LayoutFile; ActiveLayout = file; ReloadEditors(file); ActiveViewport = viewer; UpdateUndo(); viewer.UpdateViewport(); Console.WriteLine("changed " + ActiveLayout.FileName); } }
public void LoadAnim(BxlanHeader bxlan, BxlytHeader parentLayout = null) { ParentLayout = parentLayout; LoadAnimations(bxlan, new TreeNode(bxlan.FileName) { Tag = bxlan }); }
public void LoadTextures(LayoutEditor parentEditor, BxlytHeader header, Dictionary <string, STGenericTexture> textureList) { ParentEditor = parentEditor; TextureList = textureList; ActiveLayout = header; listViewCustom1.Items.Clear(); imgListSmall.Images.Clear(); imgListSmall.Images.Add(FirstPlugin.Properties.Resources.MissingTexture); imgListBig.Images.Clear(); imgListBig.Images.Add(FirstPlugin.Properties.Resources.MissingTexture); listViewCustom1.LargeImageList = imgListBig; listViewCustom1.SmallImageList = imgListSmall; listViewCustom1.BeginUpdate(); foreach (var texture in header.Textures) { ListViewItem item = new ListViewItem(); item.Text = texture; item.ImageIndex = 0; listViewCustom1.Items.Add(item); } //Load textures after on a seperate thread if (Thread != null && Thread.IsAlive) { Thread.Abort(); } Thread = new Thread((ThreadStart)(() => { int index = 0; foreach (var texture in header.Textures) { if (textureList.ContainsKey(texture)) { if (header is BCLYT.Header) { //Skip certain formats like bcn ones if (STGenericTexture.IsCompressed(textureList[texture].Format)) { continue; } } LoadTextureIcon(index, textureList[texture]); } index++; } })); Thread.Start(); listViewCustom1.EndUpdate(); isLoaded = true; }
public ProjectionTexGenParam(FileReader reader, BxlytHeader header) { PosX = reader.ReadSingle(); PosY = reader.ReadSingle(); ScaleX = reader.ReadSingle(); ScaleY = reader.ReadSingle(); flags = reader.ReadByte(); reader.Seek(3); }
public UndoActionPaneDelete(List <BasePane> panes, BxlytHeader header) { layoutFile = header; GetTopMostPanes(panes, topMostPanes, header.RootPane); for (int i = 0; i < panes.Count; i++) { targetPanes.Add(new PaneInfo(panes[i], panes[i].Parent)); } }
public override void Write(FileWriter writer, BxlytHeader header) { base.Write(writer, header); writer.Write(ColorTopLeft.ToBytes()); writer.Write(ColorTopRight.ToBytes()); writer.Write(ColorBottomLeft.ToBytes()); writer.Write(ColorBottomRight.ToBytes()); writer.Write(MaterialIndex); writer.Write(TexCoords != null ? TexCoords.Length : 0); }
public override void Write(FileWriter writer, BxlytHeader header) { writer.WriteString(Name, 24); writer.Write((ushort)Panes.Count); writer.Seek(2); for (int i = 0; i < Panes.Count; i++) { writer.WriteString(Panes[i], 24); } }
public AddAnimGroupDialog(BxlanPAI1 bxlanPai, BxlytHeader parentLayout) { InitializeComponent(); CanResize = false; AnimInfo = bxlanPai; ParentLayout = parentLayout; typeCB.LoadEnum(typeof(AnimationTarget)); typeCB.SelectedIndex = 0; }
public override void Write(FileWriter writer, BxlytHeader header) { writer.Write(_flags1); writer.Write(Alpha); writer.Write(PaneMagFlags); writer.WriteString(Name, 0x18); writer.Write(Translate); writer.Write(Rotate); writer.Write(Scale); writer.Write(Width); writer.Write(Height); }
private void OnTextCompiled(object sender, EventArgs e) { var layout = TextConverter.GetLayout(); ActiveLayout = layout.header; ReloadEditors(layout.header); if (ActiveViewport != null) { ActiveViewport.ResetLayout(ActiveLayout); } }
public override void Write(FileWriter writer, BxlytHeader header) { writer.Write((ushort)Textures.Count); writer.Seek(2); //Fill empty spaces for offsets later long pos = writer.Position; writer.Write(new uint[Textures.Count]); //Save offsets and strings for (int i = 0; i < Textures.Count; i++) { writer.WriteUint32Offset(pos + (i * 4), pos); writer.WriteString(Textures[i]); } }
public void LoadTextures(BxlytHeader header) { listViewCustom1.Items.Clear(); imgList.Images.Clear(); imgList.Images.Add(new Bitmap(30, 30)); listViewCustom1.LargeImageList = imgList; listViewCustom1.SmallImageList = imgList; var textureList = header.GetTextures; listViewCustom1.BeginUpdate(); foreach (var texture in header.Textures) { ListViewItem item = new ListViewItem(); item.Text = texture; item.ImageIndex = 0; listViewCustom1.Items.Add(item); } //Load textures after on a seperate thread if (Thread != null && Thread.IsAlive) { Thread.Abort(); } Thread = new Thread((ThreadStart)(() => { int index = 0; foreach (var texture in header.Textures) { if (textureList.ContainsKey(texture)) { LoadTextureIcon(index, textureList[texture]); } index++; } })); Thread.Start(); listViewCustom1.EndUpdate(); isLoaded = true; }
public LayoutViewer(BxlytHeader bxlyt, Dictionary <string, STGenericTexture> textures) { InitializeComponent(); LayoutFile = bxlyt; Text = bxlyt.FileName; Textures = textures; if (bxlyt.Textures.Count > 0) { if (bxlyt.FileInfo is BFLYT) { Textures = ((BFLYT)bxlyt.FileInfo).GetTextures(); } else if (bxlyt.FileInfo is BCLYT) { Textures = ((BCLYT)bxlyt.FileInfo).GetTextures(); } } }
public override void Write(FileWriter writer, BxlytHeader header) { if (header.Version >= 0x05020000) { writer.WriteString(Name, 34); writer.Write((ushort)Panes.Count); } else { writer.WriteString(Name, 24); writer.Write((ushort)Panes.Count); writer.Seek(2); } for (int i = 0; i < Panes.Count; i++) { writer.WriteString(Panes[i], 24); } }
public void LoadBxlyt(BxlytHeader header, string fileName) { LayoutFiles.Add(header); ActiveLayout = header; LayoutViewer Viewport = new LayoutViewer(header, Textures); Viewport.Dock = DockStyle.Fill; Viewport.Show(dockPanel1, DockState.Document); Viewport.DockHandler.AllowEndUserDocking = false; Viewports.Add(Viewport); ActiveViewport = Viewport; ActiveViewport.UseOrtho = orthographicViewToolStripMenuItem.Checked; if (!isLoaded) { InitializeDockPanels(); } isLoaded = true; }
public LytAnimation(BxlanHeader header, BxlytHeader layout) { parentLayout = layout; BxlanAnimation = header; Name = header.FileName; FrameCount = (uint)header.AnimationTag.EndFrame; StartFrame = (uint)header.AnimationTag.StartFrame; Textures.Clear(); AnimGroups.Clear(); foreach (var tex in header.AnimationInfo.Textures) { Textures.Add(tex); } foreach (var tag in header.AnimationInfo.Entries) { AnimGroups.Add(new LytAnimGroup(tag)); } }
public void LoadTextures(Dictionary <string, STGenericTexture> textures, string originalText, BxlytHeader header) { textureList = textures; ActiveLayout = header; foreach (var tex in textures.Values) { AddItem(tex); } //Try selecting original texture if possible if (listViewCustom1.Items.ContainsKey(originalText)) { listViewCustom1.Items[originalText].Selected = true; listViewCustom1.Select(); } else if (listViewCustom1.Items.Count > 0) //If not in the list use the first texture { listViewCustom1.Items[0].Selected = true; listViewCustom1.Select(); } }
public LytAnimation(BxlanHeader header, BxlytHeader layout) { parentLayout = layout; BxlanAnimation = header; Name = header.FileName; FrameCount = (uint)header.AnimationTag.EndFrame; StartFrame = (uint)header.AnimationTag.StartFrame; if (StartFrame == 0 && FrameCount == 0) { foreach (var tag in header.AnimationInfo.Entries) { foreach (var tagEntry in tag.Tags) { foreach (var subEntry in tagEntry.Entries) { StartFrame = Math.Min(FrameCount, subEntry.KeyFrames.Min(x => x.Frame)); FrameCount = Math.Max(FrameCount, subEntry.KeyFrames.Max(x => x.Frame)); } } } } Console.WriteLine($"FrameSize {BxlanAnimation.AnimationInfo.FrameSize}"); Console.WriteLine($"FrameCount {FrameCount}"); Textures.Clear(); AnimGroups.Clear(); foreach (var tex in header.AnimationInfo.Textures) { Textures.Add(tex); } foreach (var tag in header.AnimationInfo.Entries) { AnimGroups.Add(new LytAnimGroup(tag)); } }
public override void Write(FileWriter writer, BxlytHeader header) { long pos = writer.Position; base.Write(writer, header); writer.Write(TextLength); writer.Write(MaxTextLength); writer.Write(MaterialIndex); writer.Write(FontIndex); writer.Write(TextAlignment); writer.Write(LineAlignment, false); writer.Write(_flags); writer.Seek(1); writer.Write(ItalicTilt); long _ofsTextPos = writer.Position; writer.Write(0); //text offset writer.Write(FontForeColor.ToBytes()); writer.Write(FontBackColor.ToBytes()); writer.Write(FontSize); writer.Write(CharacterSpace); writer.Write(LineSpace); writer.Write(ShadowXY); writer.Write(ShadowXYSize); writer.Write(ShadowForeColor.ToBytes()); writer.Write(ShadowBackColor.ToBytes()); writer.Write(ShadowItalic); writer.WriteUint32Offset(_ofsTextPos, pos); if (RestrictedTextLengthEnabled) { writer.WriteString(Text, MaxTextLength); } else { writer.WriteString(Text, TextLength); } }
private void CreateQuickAccess(BxlytHeader bxlyt) { var panes = new List <BasePane>(); var groupPanes = new List <BasePane>(); GetPanes(bxlyt.RootPane, ref panes); GetGroupPanes(bxlyt.RootGroup, ref groupPanes); TreeNode node = new TreeNode("Quick Access"); node.ImageKey = "QuickAcess"; node.SelectedImageKey = "QuickAcess"; treeView1.Nodes.Add(node); TreeNode nullFolder = new TreeNode("Null Panes"); TreeNode textFolder = new TreeNode("Text Boxes"); TreeNode windowFolder = new TreeNode("Window Panes"); TreeNode pictureFolder = new TreeNode("Picture Panes"); TreeNode boundryFolder = new TreeNode("Boundry Panes"); TreeNode partsFolder = new TreeNode("Part Panes"); TreeNode groupFolder = new TreeNode("Groups"); node.Nodes.Add(nullFolder); node.Nodes.Add(textFolder); node.Nodes.Add(windowFolder); node.Nodes.Add(pictureFolder); node.Nodes.Add(boundryFolder); node.Nodes.Add(partsFolder); node.Nodes.Add(groupFolder); for (int i = 0; i < panes.Count; i++) { var paneNode = CreatePaneWrapper(panes[i]); if (panes[i] is BFLYT.WND1) { windowFolder.Nodes.Add(paneNode); } else if (panes[i] is BCLYT.WND1) { windowFolder.Nodes.Add(paneNode); } else if (panes[i] is BRLYT.WND1) { windowFolder.Nodes.Add(paneNode); } else if (panes[i] is BFLYT.PIC1) { pictureFolder.Nodes.Add(paneNode); } else if (panes[i] is BCLYT.PIC1) { pictureFolder.Nodes.Add(paneNode); } else if (panes[i] is BRLYT.PIC1) { pictureFolder.Nodes.Add(paneNode); } else if (panes[i] is BFLYT.BND1) { boundryFolder.Nodes.Add(paneNode); } else if (panes[i] is BCLYT.BND1) { boundryFolder.Nodes.Add(paneNode); } else if (panes[i] is BRLYT.BND1) { boundryFolder.Nodes.Add(paneNode); } else if (panes[i] is BCLYT.PRT1) { partsFolder.Nodes.Add(paneNode); } else if (panes[i] is BFLYT.PRT1) { partsFolder.Nodes.Add(paneNode); } else if (panes[i] is BRLYT.PRT1) { partsFolder.Nodes.Add(paneNode); } else if (panes[i] is BRLYT.TXT1) { textFolder.Nodes.Add(paneNode); } else if (panes[i] is BCLYT.TXT1) { textFolder.Nodes.Add(paneNode); } else if (panes[i] is BFLYT.TXT1) { textFolder.Nodes.Add(paneNode); } else { nullFolder.Nodes.Add(paneNode); } } for (int i = 0; i < groupPanes.Count; i++) { var paneNode = CreatePaneWrapper(groupPanes[i]); groupFolder.Nodes.Add(paneNode); } }
public FontShadowParameter(FileReader reader, BxlytHeader header) { BlackColor = reader.ReadColor8RGBA(); WhiteColor = reader.ReadColor8RGBA(); }
public IndirectParameter(FileReader reader, BxlytHeader header) { Rotation = reader.ReadSingle(); ScaleX = reader.ReadSingle(); ScaleY = reader.ReadSingle(); }
public override void Write(FileWriter writer, BxlytHeader header) { }
public AnimInfoWrapper(string text, BxlytHeader parentLayout) { Text = text; ParentLayout = parentLayout; }