BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
BrawlCrate.UI.MainForm Class Reference
Inheritance diagram for BrawlCrate.UI.MainForm:

Public Member Functions

void Reset ()
 
void UpdateName ()
 
void TargetResource (ResourceNode n)
 
unsafe void resourceTree_SelectionChanged (object sender, EventArgs e)
 
bool RenderSelected (ResourceNode node)
 
void RenderSelected (ResourceNode node, bool firstRun, out float? minX, out float? minY, out float? minZ, out float? maxX, out float? maxY, out float? maxZ)
 
void RenderARC (ARCNode arcNode, out float? minX, out float? minY, out float? minZ, out float? maxX, out float? maxY, out float? maxZ)
 
void RenderBRRES (BRRESNode brresNode, out float? minX, out float? minY, out float? minZ, out float? maxX, out float? maxY, out float? maxZ)
 
void reloadPluginsToolStripMenuItem_Click (object sender, EventArgs e)
 

Static Public Member Functions

static void UpdateDiscordRPC (object sender, EventArgs e)
 
static List< FileInfo > GetScripts (string path)
 

Public Attributes

readonly RecentFileHandler RecentFilesHandler
 
Control _currentControl
 
ResourceTree resourceTree
 
MenuStrip menuStrip1
 
PropertyGrid propertyGrid1
 
ModelPanel modelPanel1
 
ToolStripMenuItem editToolStripMenuItem
 
ToolStripMenuItem checkForUpdatesToolStripMenuItem
 

Protected Member Functions

override void OnShown (EventArgs e)
 
override void OnClosing (CancelEventArgs e)
 
override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Properties

static MainForm Instance [get]
 
static string BuildPath [get]
 
BaseWrapper RootNode [get]
 
APISubscriptionManager ApiSubManager [get]
 
InterpolationForm InterpolationForm [get]
 
bool DisplayPropertyDescriptionsWhenAvailable [get, set]
 
bool CheckUpdatesOnStartup [get, set]
 
bool GetDocumentationUpdates [get, set]
 
bool AutoCompressPCS [get, set]
 
bool AutoDecompressFighterPAC [get, set]
 
bool AutoCompressStages [get, set]
 
bool AutoCompressModules [get, set]
 
bool AutoPlayAudio [get, set]
 
bool UpdateAutomatically [get, set]
 
bool ShowHex [get, set]
 
bool CompatibilityMode [get, set]
 
bool ShowFullPath [get, set]
 
bool ShowBRRESPreviews [get, set]
 
bool ShowARCPreviews [get, set]
 

Member Function Documentation

◆ Dispose()

override void BrawlCrate.UI.MainForm.Dispose ( bool  disposing)
inlineprotected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.
1548 {
1549 if (disposing)
1550 {
1551 components?.Dispose();
1552 }
1553
1554 base.Dispose(disposing);
1555 }

◆ GetScripts()

static List< FileInfo > BrawlCrate.UI.MainForm.GetScripts ( string  path)
inlinestatic
1464 {
1465 DirectoryInfo dir = Directory.CreateDirectory(path);
1466 List<FileInfo> scripts = new List<FileInfo>();
1467
1468 foreach (DirectoryInfo d in dir.GetDirectories())
1469 {
1470 ToolStripMenuItem folder = new ToolStripMenuItem();
1471 folder.Name = folder.Text = d.Name;
1472 scripts.AddRange(GetScripts(d.FullName));
1473 }
1474
1475 foreach (FileInfo script in dir.GetFiles().Where(f =>
1476 f.Extension.Equals(".py", StringComparison.OrdinalIgnoreCase) ||
1477 f.Extension.Equals(".fsx", StringComparison.OrdinalIgnoreCase)))
1478 {
1479 scripts.Add(script);
1480 }
1481
1482 return scripts;
1483 }
static List< FileInfo > GetScripts(string path)
Definition: MainForm.cs:1463

◆ OnClosing()

override void BrawlCrate.UI.MainForm.OnClosing ( CancelEventArgs  e)
inlineprotected
1200 {
1201 if (!Program.Close())
1202 {
1203 e.Cancel = true;
1204 }
1205
1206 base.OnClosing(e);
1207 }

◆ OnShown()

override void BrawlCrate.UI.MainForm.OnShown ( EventArgs  e)
inlineprotected
1186 {
1187 Focus();
1188 base.OnShown(e);
1189#if (!DEBUG && !CANARY)
1190 if (BrawlCrate.Properties.Settings.Default.UpdateAutomatically && Program.FirstBoot)
1191 {
1192 MessageBox.Show(Program.UpdateMessage);
1193 }
1194#endif
1195 UpdateDiscordRPC(null, null);
1197 }
unsafe void resourceTree_SelectionChanged(object sender, EventArgs e)
Definition: MainForm.cs:533
static void UpdateDiscordRPC(object sender, EventArgs e)
Definition: MainForm.cs:1157
Definition: BrawlAPIInternal.cs:21

◆ reloadPluginsToolStripMenuItem_Click()

void BrawlCrate.UI.MainForm.reloadPluginsToolStripMenuItem_Click ( object  sender,
EventArgs  e 
)
inline
1456 {
1457 BrawlAPIInternal.Plugins.Clear();
1458 pluginToolStripMenuItem.DropDown.Items.Clear();
1459 AddPlugins(pluginToolStripMenuItem, Program.ApiPluginPath);
1460 pluginToolStripMenuItem.Enabled = pluginToolStripMenuItem.HasDropDownItems;
1461 }

◆ RenderARC()

void BrawlCrate.UI.MainForm.RenderARC ( ARCNode  arcNode,
out float?  minX,
out float?  minY,
out float?  minZ,
out float?  maxX,
out float?  maxY,
out float?  maxZ 
)
inline
978 {
979 minX = null;
980 minY = null;
981 minZ = null;
982 maxX = null;
983 maxY = null;
984 maxZ = null;
985 MDL0Node stagePosition = null;
986 foreach (ResourceNode resource in arcNode.Children)
987 {
988 if (resource is BRRESNode brresNode)
989 {
990 if (brresNode.NumTriangles > 0)
991 {
992 RenderBRRES(brresNode, out float? bMinX, out float? bMinY, out float? bMinZ, out float? bMaxX,
993 out float? bMaxY, out float? bMaxZ);
994 if (minX == null || bMinX < minX)
995 {
996 minX = bMinX;
997 }
998
999 if (minY == null || bMinY < minY)
1000 {
1001 minY = bMinY;
1002 }
1003
1004 if (minZ == null || bMinZ < minZ)
1005 {
1006 minZ = bMinZ;
1007 }
1008
1009 if (maxX == null || bMaxX > maxX)
1010 {
1011 maxX = bMaxX;
1012 }
1013
1014 if (maxY == null || bMaxY > maxY)
1015 {
1016 maxY = bMaxY;
1017 }
1018
1019 if (maxZ == null || bMaxZ > maxZ)
1020 {
1021 maxZ = bMaxZ;
1022 }
1023 }
1024 else if (stagePosition == null && brresNode.NumModels == 1 && brresNode.NumTriangles == 0)
1025 {
1026 try
1027 {
1028 MDL0Node check = brresNode.GetFolder<MDL0Node>().Children[0] as MDL0Node;
1029 if (check.Name.Equals("stgposition", StringComparison.OrdinalIgnoreCase) ||
1030 check.Name.Equals("stageposition", StringComparison.OrdinalIgnoreCase))
1031 {
1032 stagePosition = check;
1033 }
1034 }
1035 catch
1036 {
1037 // ignored
1038 }
1039 }
1040 }
1041 else if (resource is ARCNode subArcNode && subArcNode.NumTriangles > 0)
1042 {
1043 RenderARC(subArcNode, out float? aMinX, out float? aMinY, out float? aMinZ, out float? aMaxX,
1044 out float? aMaxY, out float? aMaxZ);
1045 if (minX == null || aMinX < minX)
1046 {
1047 minX = aMinX;
1048 }
1049
1050 if (minY == null || aMinY < minY)
1051 {
1052 minY = aMinY;
1053 }
1054
1055 if (minZ == null || aMinZ < minZ)
1056 {
1057 minZ = aMinZ;
1058 }
1059
1060 if (maxX == null || aMaxX > maxX)
1061 {
1062 maxX = aMaxX;
1063 }
1064
1065 if (maxY == null || aMaxY > maxY)
1066 {
1067 maxY = aMaxY;
1068 }
1069
1070 if (maxZ == null || aMaxZ > maxZ)
1071 {
1072 maxZ = aMaxZ;
1073 }
1074 }
1075 else if (resource is CollisionNode collNode)
1076 {
1077 modelPanel1.AddTarget(collNode, false);
1078 }
1079 }
1080
1081 // Use stage position to determine boundaries programatically
1082 if (stagePosition != null)
1083 {
1084 MDL0BoneNode cam0N = stagePosition.FindBone("CamLimit0N");
1085 MDL0BoneNode cam1N = stagePosition.FindBone("CamLimit1N");
1086 if (cam0N != null && cam1N != null)
1087 {
1088 minX = cam0N.Translation._x;
1089 minY = cam0N.Translation._y;
1090 minZ = 0;
1091 maxX = cam1N.Translation._x;
1092 maxY = cam1N.Translation._y;
1093 maxZ = 0;
1094 }
1095 }
1096 }
ModelPanel modelPanel1
Definition: MainForm.cs:2456
void RenderBRRES(BRRESNode brresNode, out float? minX, out float? minY, out float? minZ, out float? maxX, out float? maxY, out float? maxZ)
Definition: MainForm.cs:1098
void RenderARC(ARCNode arcNode, out float? minX, out float? minY, out float? minZ, out float? maxX, out float? maxY, out float? maxZ)
Definition: MainForm.cs:975
void AddTarget(IRenderedObject target)
Definition: ModelPanel.cs:134
Definition: ARCNode.cs:16
int NumTriangles
Definition: ARCNode.cs:282
Definition: BRRESNode.cs:19
Definition: CollisionNode.cs:15
Definition: MDL0BoneNode.cs:17
Vector3 Translation
Definition: MDL0BoneNode.cs:508
Definition: MDL0Node.cs:24
MDL0BoneNode FindBone(string name)
Definition: MDL0Node.cs:752
Definition: ResourceNode.cs:129
virtual string Name
Definition: ResourceNode.cs:223
List< ResourceNode > Children
Definition: ResourceNode.cs:262
float _y
Definition: Vector3.cs:41
float _x
Definition: Vector3.cs:41

◆ RenderBRRES()

void BrawlCrate.UI.MainForm.RenderBRRES ( BRRESNode  brresNode,
out float?  minX,
out float?  minY,
out float?  minZ,
out float?  maxX,
out float?  maxY,
out float?  maxZ 
)
inline
1101 {
1102 minX = null;
1103 minY = null;
1104 minZ = null;
1105 maxX = null;
1106 maxY = null;
1107 maxZ = null;
1108 BRESGroupNode modelGroup = brresNode.GetFolder<MDL0Node>();
1109 if (modelGroup == null)
1110 return;
1111 foreach (MDL0Node model in modelGroup.Children)
1112 {
1113 if (model._children == null)
1114 {
1115 model.Populate(0);
1116 }
1117
1118 model.ResetToBindState();
1119
1120 modelPanel1.AddTarget(model, false);
1121 Box b = model.GetBox();
1122
1123 if (minX == null || b.Min._x < minX)
1124 {
1125 minX = b.Min._x;
1126 }
1127
1128 if (minY == null || b.Min._y < minY)
1129 {
1130 minY = b.Min._y;
1131 }
1132
1133 if (minZ == null || b.Min._z < minZ)
1134 {
1135 minZ = b.Min._z;
1136 }
1137
1138 if (maxX == null || b.Max._x > maxX)
1139 {
1140 maxX = b.Max._x;
1141 }
1142
1143 if (maxY == null || b.Max._y > maxY)
1144 {
1145 maxY = b.Max._y;
1146 }
1147
1148 if (maxZ == null || b.Max._z > maxZ)
1149 {
1150 maxZ = b.Max._z;
1151 }
1152 }
1153 }
Definition: BRRESNode.cs:777
Box GetBox()
Call ApplyCHR0 before calling this
Definition: MDL0Node.cs:376
void ResetToBindState()
Definition: MDL0Node.cs:3195
List< ResourceNode > _children
Definition: ResourceNode.cs:143
void Populate(int levels=-1)
Definition: ResourceNode.cs:613
Definition: Box.cs:6
Vector3 Min
Definition: Box.cs:12
Vector3 Max
Definition: Box.cs:18
float _z
Definition: Vector3.cs:41

◆ RenderSelected() [1/2]

bool BrawlCrate.UI.MainForm.RenderSelected ( ResourceNode  node)
inline
879 {
880 if (node == null)
881 {
882 return false;
883 }
884 RenderSelected(node, true, out float? f1, out _, out _, out _, out _, out _);
885 return f1.HasValue;
886 }
bool RenderSelected(ResourceNode node)
Definition: MainForm.cs:878

◆ RenderSelected() [2/2]

void BrawlCrate.UI.MainForm.RenderSelected ( ResourceNode  node,
bool  firstRun,
out float?  minX,
out float?  minY,
out float?  minZ,
out float?  maxX,
out float?  maxY,
out float?  maxZ 
)
inline
889 {
890 minX = null;
891 minY = null;
892 minZ = null;
893 maxX = null;
894 maxY = null;
895 maxZ = null;
896 if (node == null)
897 return;
898 if (firstRun)
900 switch (node)
901 {
902 case CollisionNode collNode:
903 if(firstRun)
905 modelPanel1.AddTarget(collNode, false);
906 collNode.CalculateCamBoundaries(out minX, out minY, out maxX, out maxY);
907 break;
908 case CollisionObject collObj:
909 CollisionNode collNodeTemp = new CollisionNode();
910 collNodeTemp.Children.Add(collObj);
911 if(firstRun)
913 modelPanel1.AddTarget(collNodeTemp, false);
914 collNodeTemp.CalculateCamBoundaries(out minX, out minY, out maxX, out maxY);
915 break;
916 case ARCNode arcNode:
917 if (ShowARCPreviews)
918 RenderARC(arcNode, out minX, out minY, out minZ, out maxX, out maxY, out maxZ);
919 break;
920 case BRRESNode brresNode:
922 RenderBRRES(brresNode, out minX, out minY, out minZ, out maxX, out maxY, out maxZ);
923 break;
924 case ARCEntryNode arcEntryNode:
925 if (arcEntryNode.RedirectNode != null && arcEntryNode.RedirectIndex != arcEntryNode.Index)
926 RenderSelected(arcEntryNode.RedirectNode, false, out minX, out minY, out minZ, out maxX, out maxY, out maxZ);
927 break;
928 case IRenderedObject o:
929 //Model panel has to be loaded first to display model correctly
930 if (node._children == null)
931 {
932 node.Populate(0);
933 }
934
935 if (o is IModel m && ModelEditControl.Instances.Count == 0)
936 {
937 m.ResetToBindState();
938 }
939
940 modelPanel1.AddTarget(o, false);
941 Box b = o.GetBox();
943 minX = b.Min._x;
944 minY = b.Min._y;
945 minZ = b.Min._z;
946 maxX = b.Max._x;
947 maxY = b.Max._y;
948 maxZ = b.Max._z;
949 return;
950 case IRenderedLink l:
951 foreach (var obj in l.RenderTargets)
952 {
953 RenderSelected(obj, false, out float? newMinX, out float? newMinY, out float? newMinZ, out float? newMaxX, out float? newMaxY, out float? newMaxZ);
954 if (newMinX.HasValue && (!minX.HasValue || minX > newMinX))
955 minX = newMinX;
956 if (newMinY.HasValue && (!minY.HasValue || minY > newMinY))
957 minY = newMinY;
958 if (newMinZ.HasValue && (!minZ.HasValue || minZ > newMinZ))
959 minZ = newMinZ;
960 if (newMaxX.HasValue && (!maxX.HasValue || maxX < newMaxX))
961 maxX = newMaxX;
962 if (newMaxY.HasValue && (!maxY.HasValue || maxY < newMaxY))
963 maxY = newMaxY;
964 if (newMaxZ.HasValue && (!maxZ.HasValue || maxZ < newMaxZ))
965 maxZ = newMaxZ;
966 }
967
968 break;
969 }
970
971 if(firstRun)
972 modelPanel1.SetCamWithBox(new Vector3(minX ?? 0, minY ?? 0, minZ ?? 0), new Vector3(maxX ?? 0, maxY ?? 0, maxZ ?? 0));
973 }
bool ShowBRRESPreviews
Definition: MainForm.cs:418
bool ShowARCPreviews
Definition: MainForm.cs:433
static List< ModelEditControl > Instances
Definition: Designer.cs:2093
void SetCamWithBox(Box value)
Definition: ModelPanel.cs:60
new ModelPanelViewport CurrentViewport
Definition: ModelPanel.cs:108
void SetProjectionType(ViewportProjection type)
Definition: GLViewport.cs:206
Definition: ARCNode.cs:872
void CalculateCamBoundaries(out float? minX, out float? minY, out float? maxX, out float? maxY)
Definition: CollisionNode.cs:69
Definition: CollisionNode.cs:300
Definition: IModel.cs:12
Definition: IRenderedObject.cs:40
ViewportProjection
Definition: GLViewport.cs:418
Definition: Vector3.cs:40

◆ Reset()

void BrawlCrate.UI.MainForm.Reset ( )
inline
472 {
473 RootNode = null;
474 resourceTree.SelectedNode = null;
476
477 if (Program.RootNode != null)
478 {
479 RootNode = BaseWrapper.Wrap(this, Program.RootNode);
480 resourceTree.BeginUpdate();
481 resourceTree.Nodes.Add((TreeNode) RootNode);
482 resourceTree.SelectedNode = RootNode;
483 RootNode.Expand();
484 resourceTree.EndUpdate();
485
486 closeToolStripMenuItem.Enabled = true;
487 saveAsToolStripMenuItem.Enabled = true;
488 saveToolStripMenuItem.Enabled = true;
489
490 Program.RootNode._mainForm = this;
491 }
492 else
493 {
494 closeToolStripMenuItem.Enabled = false;
495 saveAsToolStripMenuItem.Enabled = false;
496 saveToolStripMenuItem.Enabled = false;
497 }
498
500
501 UpdateName();
502 UpdateDiscordRPC(null, null);
503 }
Definition: BaseWrapper.cs:71
static BaseWrapper Wrap(ResourceNode node)
Definition: BaseWrapper.cs:400
BaseWrapper RootNode
Definition: MainForm.cs:40
void UpdateName()
Definition: MainForm.cs:506
ResourceTree resourceTree
Definition: MainForm.cs:2418
void Clear()
Definition: ResourceTree.cs:170

◆ resourceTree_SelectionChanged()

unsafe void BrawlCrate.UI.MainForm.resourceTree_SelectionChanged ( object  sender,
EventArgs  e 
)
inline
534 {
535 audioPlaybackPanel1.TargetSource = null;
536 animEditControl.TargetSequence = null;
537 texAnimEditControl.TargetSequence = null;
538 shpAnimEditControl.TargetSequence = null;
539 attributeGrid1.Clear();
540 articleAttributeGrid.TargetNode = null;
541 offsetEditor1.TargetNode = null;
542 msBinEditor1.CurrentNode = null;
543 //soundPackControl1.TargetNode = null;
544 movesetEditor1.TargetNode = null;
545 attributeControl.TargetNode = null;
546 clrControl.ColorSource = null;
547 visEditor.TargetNode = null;
548 scN0CameraEditControl1.TargetSequence = null;
549 scN0LightEditControl1.TargetSequence = null;
550 scN0FogEditControl1.TargetSequence = null;
551 texCoordControl1.TargetNode = null;
552 ppcDisassembler1.SetTarget(null, 0, null);
554 mdL0ObjectControl1.SetTarget(null);
555 hexBox1.Visible = false;
556 ((DynamicFileByteProvider) hexBox1.ByteProvider)?.Dispose();
557
558 Control newControl = null;
559 Control newControl2 = null;
560
561 BaseWrapper w;
562 ResourceNode node = null;
563 bool disable2nd = false;
564 if (!(sender?.ToString().Equals("Saving File") ?? false) &&
566 (node = (w = b).Resource) != null)
567 {
568 Action setScrollOffset = null;
569 if (selectedType == resourceTree.SelectedNode.GetType())
570 {
571 foreach (Control c in propertyGrid1.Controls)
572 {
573 if (c.GetType().Name == "PropertyGridView")
574 {
575 object scrollOffset = c.GetType().GetMethod("GetScrollOffset").Invoke(c, null);
576 setScrollOffset = () =>
577 c.GetType().GetMethod("SetScrollOffset").Invoke(c, new[] {scrollOffset});
578 break;
579 }
580 }
581 }
582 else
583 {
584 foreach (Control c in propertyGrid1.Controls)
585 {
586 if (c.GetType().Name == "PropertyGridView")
587 {
588 setScrollOffset = () =>
589 c.GetType().GetMethod("SetScrollOffset").Invoke(c, new object[] {0});
590 setScrollOffset?.Invoke();
591 break;
592 }
593 }
594 }
595
596 propertyGrid1.SelectedObject = node;
597 setScrollOffset?.Invoke();
598
599 if (ShowHex && node is IBufferNode d)
600 {
601 if (d.IsValid())
602 {
603 hexBox1.ByteProvider = new DynamicFileByteProvider(new UnmanagedMemoryStream(
604 (byte*) d.GetAddress(),
605 d.GetLength(),
606 d.GetLength(),
607 FileAccess.ReadWrite))
608 {_supportsInsDel = false};
609 newControl = hexBox1;
610 }
611 }
612#if DEBUG
613 else if (ShowHex && !(node is RELEntryNode || node is RELNode) && node.WorkingUncompressed.Length > 0)
614 {
615 hexBox1.ByteProvider = new DynamicFileByteProvider(new UnmanagedMemoryStream(
616 (byte*) node.WorkingUncompressed.Address,
619 FileAccess.ReadWrite))
620 {_supportsInsDel = false};
621 newControl = hexBox1;
622 }
623#endif
624 else if (node is RSARGroupNode groupNode)
625 {
626 rsarGroupEditor.LoadGroup(groupNode);
627 newControl = rsarGroupEditor;
628 }
629 else if (node is RELMethodNode methodNode)
630 {
631 ppcDisassembler1.SetTarget(methodNode);
632 newControl = ppcDisassembler1;
633 }
634 else if (node is IVideo video)
635 {
636 videoPlaybackPanel1.TargetSource = video;
637 newControl = videoPlaybackPanel1;
638 }
639 else if (node is MDL0MaterialRefNode)
640 {
641 newControl = texCoordControl1;
642 }
643 else if (node is MDL0ObjectNode)
644 {
645 newControl = mdL0ObjectControl1;
646 }
647 else if (node is MSBinNode binNode)
648 {
649 msBinEditor1.CurrentNode = binNode;
650 newControl = msBinEditor1;
651 }
652 else if (node is CHR0EntryNode chr0EntryNode)
653 {
654 animEditControl.TargetSequence = chr0EntryNode;
655 newControl = animEditControl;
656 }
657 else if (node is SRT0TextureNode textureNode)
658 {
659 texAnimEditControl.TargetSequence = textureNode;
660 newControl = texAnimEditControl;
661 }
662 else if (node is SHP0VertexSetNode setNode)
663 {
664 shpAnimEditControl.TargetSequence = setNode;
665 newControl = shpAnimEditControl;
666 }
667 else if (node is RSARNode rsarNode)
668 {
669 soundPackControl1.TargetNode = rsarNode;
670 newControl = soundPackControl1;
671 }
672 else if (node is VIS0EntryNode entryNode)
673 {
674 visEditor.TargetNode = entryNode;
675 newControl = visEditor;
676 }
677 else if (node is MoveDefActionNode actionNode)
678 {
679 movesetEditor1.TargetNode = actionNode;
680 newControl = movesetEditor1;
681 }
682 else if (node is MoveDefEventOffsetNode offsetNode)
683 {
684 offsetEditor1.TargetNode = offsetNode;
685 newControl = offsetEditor1;
686 }
687 else if (node is MoveDefEventNode eventNode)
688 {
689 //if (node.Parent is MoveDefLookupEntry1Node)
690 // eventDescription1.SetTarget((node as MoveDefLookupEntry1Node).EventInfo, -1);
691 //else
692 eventDescription1.SetTarget(eventNode.EventInfo, -1);
693 newControl = eventDescription1;
694 }
695 else if (node is MoveDefEventParameterNode)
696 {
697 //if (node.Parent is MoveDefLookupEntry1Node)
698 // eventDescription1.SetTarget((node.Parent as MoveDefLookupEntry1Node).EventInfo, node.Index == -1 ? -2 : node.Index);
699 //else
700 eventDescription1.SetTarget((node.Parent as MoveDefEventNode).EventInfo,
701 node.Index == -1 ? -2 : node.Index);
702 newControl = eventDescription1;
703 }
704 else if (node is MoveDefAttributeNode attributeNode)
705 {
706 attributeControl.TargetNode = attributeNode;
707 newControl = attributeControl;
708 }
709 else if (node is MoveDefSectionParamNode paramNode)
710 {
711 articleAttributeGrid.TargetNode = paramNode;
712 newControl = articleAttributeGrid;
713 }
714 else if (node is SCN0CameraNode cameraNode)
715 {
716 scN0CameraEditControl1.TargetSequence = cameraNode;
717 newControl = scN0CameraEditControl1;
718 }
719 else if (node is SCN0LightNode lightNode)
720 {
721 scN0LightEditControl1.TargetSequence = lightNode;
722 newControl = scN0LightEditControl1;
723 disable2nd = true;
724 }
725 else if (node is SCN0FogNode fogNode)
726 {
727 scN0FogEditControl1.TargetSequence = fogNode;
728 newControl = scN0FogEditControl1;
729 disable2nd = true;
730 }
731 else if (node is IAudioSource audioSource)
732 {
733 audioPlaybackPanel1.TargetSource = audioSource;
734 IAudioStream[] sources = audioPlaybackPanel1.TargetSource.CreateStreams();
735 if (sources != null && sources.Length > 0 && sources[0] != null)
736 {
737 newControl = audioPlaybackPanel1;
738 }
739 }
740 else if (node is MultipleInterpretationIAttributeList table && table.NumEntries > 0)
741 {
742 attributeGrid1.AddRange(table.GetPossibleInterpretations());
743 attributeGrid1.TargetNode = table;
744 newControl = attributeGrid1;
745 }
746 else if (node is ASLSEntryNode aslsEntry)
747 {
748 aslIndicator1.TargetNode = aslsEntry;
749 newControl = aslIndicator1;
750 }
751 else if (node is CollisionNode || node is CollisionObject || !CompatibilityMode &&
752 (node is IRenderedObject io && io.DrawCalls.Count > 0 ||
753 ShowARCPreviews && node is ARCNode arcNode && arcNode.NumTriangles > 0 ||
754 ShowBRRESPreviews && node is BRRESNode brresNode && brresNode.NumTriangles > 0 ||
755 node is IRenderedLink || node is ARCEntryNode n && n.RedirectNode != null))
756 {
757 newControl = modelPanel1;
758 if (!RenderSelected(node))
759 newControl = null;
760 }
761 if (newControl == null && node is IImageSource i && i.ImageCount > 0) {
762 previewPanel2.RenderingTarget = i;
763 newControl = previewPanel2;
764 }
765
766 if (node is IColorSource source && !disable2nd)
767 {
768 clrControl.ColorSource = source;
769 if (source.ColorCount(0) > 0)
770 {
771 if (newControl != null)
772 {
773 newControl2 = clrControl;
774 }
775 else
776 {
777 newControl = clrControl;
778 }
779 }
780 }
781#if DEBUG
782 if (newControl == null && !(node is RELEntryNode || node is RELNode))
783#else
784 if (newControl == null && ShowHex && !(node is RELEntryNode || node is RELNode))
785#endif
786 {
787 if (node.WorkingUncompressed.Length > 0)
788 {
789 hexBox1.ByteProvider = new DynamicFileByteProvider(new UnmanagedMemoryStream(
790 (byte*) node.WorkingUncompressed.Address,
793 FileAccess.ReadWrite))
794 {_supportsInsDel = false};
795 newControl = hexBox1;
796 }
797 }
798
799 _enableEditMenu(this, null);
800 }
801 else
802 {
803 propertyGrid1.SelectedObject = null;
804 try
805 {
806 editToolStripMenuItem.DropDown = null;
807 }
808 catch
809 {
810 // ignored
811 }
812
813 editToolStripMenuItem.Enabled = false;
814 }
815
816 if (_secondaryControl != newControl2)
817 {
818 if (_secondaryControl != null)
819 {
820 _secondaryControl.Dock = DockStyle.Fill;
821 _secondaryControl.Visible = false;
822 }
823
824 _secondaryControl = newControl2;
825 if (_secondaryControl != null)
826 {
827 _secondaryControl.Dock = DockStyle.Right;
828 _secondaryControl.Visible = true;
829 _secondaryControl.Width = 340;
830 }
831 }
832
833 if (_currentControl != newControl)
834 {
835 if (_currentControl != null)
836 {
837 _currentControl.Visible = false;
838 }
839
840 _currentControl = newControl;
841 if (_currentControl != null)
842 {
843 _currentControl.Visible = true;
844 }
845 }
846 else if (_currentControl != null && !_currentControl.Visible)
847 {
848 _currentControl.Visible = true;
849 }
850
851 if (_currentControl != null)
852 {
853 if (_secondaryControl != null)
854 {
855 _currentControl.Width = splitContainer2.Panel2.Width - _secondaryControl.Width;
856 }
857
858 _currentControl.Dock = DockStyle.Fill;
859 }
860
862 {
863 if (!mdL0ObjectControl1.SetTarget(node as MDL0ObjectNode))
864 {
865 _currentControl = null;
866 }
867 }
869 {
870 texCoordControl1.TargetNode = (MDL0MaterialRefNode) node;
871 }
872
873 selectedType = resourceTree.SelectedNode?.GetType();
874 }
bool ShowHex
Definition: MainForm.cs:372
PropertyGrid propertyGrid1
Definition: MainForm.cs:2433
bool CompatibilityMode
Definition: MainForm.cs:387
Control _currentControl
Definition: MainForm.cs:529
new TreeNode SelectedNode
Definition: ResourceTree.cs:43
IAudioSource TargetSource
Definition: AudioPlaybackPanel.cs:227
Implements a fully editable byte provider for file data of any size.
Definition: DynamicFileByteProvider.cs:14
IByteProvider ByteProvider
Gets or sets the ByteProvider.
Definition: HexBox.cs:4264
Definition: MDL0ObjectControl.cs:11
bool SetTarget(MDL0ObjectNode o)
Definition: MDL0ObjectControl.cs:38
void ClearAll()
Definition: ModelPanel.cs:122
void Clear()
Definition: MultipleInterpretationAttributeGrid.cs:86
void AddRange(IEnumerable< AttributeInterpretation > arrs)
Definition: MultipleInterpretationAttributeGrid.cs:69
void SetTarget(RELMethodNode node)
Definition: PowerPcDisassembler.cs:20
void SetTarget(ActionEventInfo info, int i)
Definition: EventDescription.cs:63
void LoadGroup(RSARGroupNode group)
Definition: RSARGroupEditor.cs:18
Definition: TexCoordControl.cs:10
ResourceNode RedirectNode
Definition: ARCNode.cs:1026
int NumTriangles
Definition: BRRESNode.cs:129
Definition: CHR0Node.cs:909
Definition: MDL0MaterialRefNode.cs:17
Definition: MDL0ObjectNode.cs:21
Definition: MSBinNode.cs:9
Definition: MoveDefActionNode.cs:59
Definition: DataAttributeNode.cs:8
Definition: ActionEventNode.cs:11
Definition: EventParameterNodes.cs:474
Definition: EventParameterNodes.cs:12
Definition: SectionParamsNode.cs:9
Definition: ASLSNode.cs:78
Definition: RELMiscNodes.cs:12
Definition: RELMethodNode.cs:8
Definition: RELNode.cs:17
Definition: RSARGroupNode.cs:9
Definition: RSARNode.cs:15
ResourceNode Parent
Definition: ResourceNode.cs:245
int Index
Definition: ResourceNode.cs:301
DataSource WorkingUncompressed
Definition: ResourceNode.cs:183
Definition: SCN0CameraNode.cs:12
Definition: SCN0FogNode.cs:13
Definition: SCN0LightNode.cs:14
Definition: VIS0Node.cs:431
Definition: IColorSource.cs:4
Definition: IImageSource.cs:7
int ImageCount
Definition: IImageSource.cs:8
Definition: IImageSource.cs:13
Definition: IAudioSource.cs:4
Definition: IAudioStream.cs:6
List< DrawCallBase > DrawCalls
Definition: IRenderedObject.cs:43
int NumEntries
The number of (four-byte) entries - i.e. the length in bytes divided by four.
Definition: IAttributeList.cs:12
Definition: RawDataNode.cs:9
int Length
Definition: ResourceNode.cs:32
VoidPtr Address
Definition: ResourceNode.cs:31

◆ TargetResource()

void BrawlCrate.UI.MainForm.TargetResource ( ResourceNode  n)
inline
522 {
523 if (RootNode != null)
524 {
525 resourceTree.SelectedNode = RootNode.FindResource(n, true);
526 }
527 }

◆ UpdateDiscordRPC()

static void BrawlCrate.UI.MainForm.UpdateDiscordRPC ( object  sender,
EventArgs  e 
)
inlinestatic
1158 {
1159 try
1160 {
1161 if (Program.CanRunDiscordRPC)
1162 {
1163 if (Discord.DiscordSettings.DiscordControllerSet)
1164 {
1165 Discord.DiscordSettings.Update();
1166 }
1167 else
1168 {
1169 Process[] px = Process.GetProcessesByName("BrawlCrate");
1170 if (px.Length == 1)
1171 {
1172 Discord.DiscordRpc.ClearPresence();
1173 }
1174
1175 Discord.DiscordSettings.LoadSettings(true);
1176 }
1177 }
1178 }
1179 catch
1180 {
1181 // Discord RPC doesn't need to work always
1182 }
1183 }

◆ UpdateName()

void BrawlCrate.UI.MainForm.UpdateName ( )
inline
507 {
508 if (Program.RootPath != null)
509 {
510 string fileName = ShowFullPath
511 ? Program.RootPath
512 : Program.RootPath.TrimEnd('\\').Substring(Program.RootPath.TrimEnd('\\').LastIndexOf('\\') + 1);
513 Text = ShowFullPath ? $"{Program.AssemblyTitleShort} - {fileName}" : $"{fileName} - {Program.AssemblyTitleFull}";
514 }
515 else
516 {
517 Text = Program.AssemblyTitleFull;
518 }
519 }
bool ShowFullPath
Definition: MainForm.cs:403

Member Data Documentation

◆ _currentControl

Control BrawlCrate.UI.MainForm._currentControl

◆ checkForUpdatesToolStripMenuItem

ToolStripMenuItem BrawlCrate.UI.MainForm.checkForUpdatesToolStripMenuItem

◆ editToolStripMenuItem

ToolStripMenuItem BrawlCrate.UI.MainForm.editToolStripMenuItem

◆ menuStrip1

MenuStrip BrawlCrate.UI.MainForm.menuStrip1

◆ modelPanel1

ModelPanel BrawlCrate.UI.MainForm.modelPanel1

◆ propertyGrid1

PropertyGrid BrawlCrate.UI.MainForm.propertyGrid1

◆ RecentFilesHandler

readonly RecentFileHandler BrawlCrate.UI.MainForm.RecentFilesHandler

◆ resourceTree

ResourceTree BrawlCrate.UI.MainForm.resourceTree

Property Documentation

◆ ApiSubManager

APISubscriptionManager BrawlCrate.UI.MainForm.ApiSubManager
get

◆ AutoCompressModules

bool BrawlCrate.UI.MainForm.AutoCompressModules
getset
329 {
330 get => _autoCompressModules;
331 set
332 {
333 _autoCompressModules = value;
334
335 BrawlLib.Properties.Settings.Default.AutoCompressStages = _autoCompressModules;
336 BrawlLib.Properties.Settings.Default.Save();
337 }
338 }
Definition: PerSessionSettings.cs:2

◆ AutoCompressPCS

bool BrawlCrate.UI.MainForm.AutoCompressPCS
getset
287 {
288 get => _autoCompressPCS;
289 set
290 {
291 _autoCompressPCS = value;
292
293 BrawlLib.Properties.Settings.Default.AutoCompressFighterPCS = _autoCompressPCS;
294 BrawlLib.Properties.Settings.Default.Save();
295 }
296 }

◆ AutoCompressStages

bool BrawlCrate.UI.MainForm.AutoCompressStages
getset
315 {
316 get => _autoCompressStages;
317 set
318 {
319 _autoCompressStages = value;
320
321 BrawlLib.Properties.Settings.Default.AutoCompressStages = _autoCompressStages;
322 BrawlLib.Properties.Settings.Default.Save();
323 }
324 }

◆ AutoDecompressFighterPAC

bool BrawlCrate.UI.MainForm.AutoDecompressFighterPAC
getset
301 {
302 get => _autoDecompressPAC;
303 set
304 {
305 _autoDecompressPAC = value;
306
307 BrawlLib.Properties.Settings.Default.AutoDecompressFighterPAC = _autoDecompressPAC;
308 BrawlLib.Properties.Settings.Default.Save();
309 }
310 }

◆ AutoPlayAudio

bool BrawlCrate.UI.MainForm.AutoPlayAudio
getset
343 {
344 get => _autoPlayAudio;
345 set
346 {
347 _autoPlayAudio = value;
348
349 BrawlLib.Properties.Settings.Default.AutoPlayAudio = _autoPlayAudio;
350 BrawlLib.Properties.Settings.Default.Save();
351 }
352 }

◆ BuildPath

string BrawlCrate.UI.MainForm.BuildPath
staticget

◆ CheckUpdatesOnStartup

bool BrawlCrate.UI.MainForm.CheckUpdatesOnStartup
getset
259 {
260 get => _updatesOnStartup;
261 set
262 {
263 _updatesOnStartup = value;
264
265 Properties.Settings.Default.CheckUpdatesAtStartup = _updatesOnStartup;
266 Properties.Settings.Default.Save();
267 }
268 }

◆ CompatibilityMode

bool BrawlCrate.UI.MainForm.CompatibilityMode
getset
387 {
388 get => _compatibilityMode;
389 set
390 {
391 _compatibilityMode = value;
392
393 BrawlLib.Properties.Settings.Default.HideMDL0Errors =
394 BrawlLib.Properties.Settings.Default.CompatibilityMode = _compatibilityMode;
395 BrawlLib.Properties.Settings.Default.Save();
397 }
398 }

◆ DisplayPropertyDescriptionsWhenAvailable

bool BrawlCrate.UI.MainForm.DisplayPropertyDescriptionsWhenAvailable
getset
244 {
245 get => _displayPropertyDescription;
246 set
247 {
248 _displayPropertyDescription = value;
249
250 Properties.Settings.Default.DisplayPropertyDescriptionWhenAvailable = _displayPropertyDescription;
251 Properties.Settings.Default.Save();
252 UpdatePropertyDescriptionBox(propertyGrid1.SelectedGridItem);
253 }
254 }

◆ GetDocumentationUpdates

bool BrawlCrate.UI.MainForm.GetDocumentationUpdates
getset
273 {
274 get => _docUpdates;
275 set
276 {
277 _docUpdates = value;
278
279 Properties.Settings.Default.GetDocumentationUpdates = _docUpdates;
280 Properties.Settings.Default.Save();
281 }
282 }

◆ Instance

MainForm BrawlCrate.UI.MainForm.Instance
staticget

◆ InterpolationForm

InterpolationForm BrawlCrate.UI.MainForm.InterpolationForm
get
53 {
54 get
55 {
56 if (_interpolationForm == null)
57 {
58 _interpolationForm = new InterpolationForm(null);
59 _interpolationForm.FormClosed += _interpolationForm_FormClosed;
60 _interpolationForm.Show();
61 }
62
63 return _interpolationForm;
64 }
65 }
InterpolationForm InterpolationForm
Definition: MainForm.cs:53

◆ RootNode

BaseWrapper BrawlCrate.UI.MainForm.RootNode
get
40{ get; private set; }

◆ ShowARCPreviews

bool BrawlCrate.UI.MainForm.ShowARCPreviews
getset
433 {
434 get => _showARCPreviews;
435 set
436 {
437 _showARCPreviews = value;
438
439 Properties.Settings.Default.PreviewARCModels = _showARCPreviews;
440 Properties.Settings.Default.Save();
442 }
443 }

◆ ShowBRRESPreviews

bool BrawlCrate.UI.MainForm.ShowBRRESPreviews
getset
418 {
419 get => _showBRRESPreviews;
420 set
421 {
422 _showBRRESPreviews = value;
423
424 Properties.Settings.Default.PreviewBRRESModels = _showBRRESPreviews;
425 Properties.Settings.Default.Save();
427 }
428 }

◆ ShowFullPath

bool BrawlCrate.UI.MainForm.ShowFullPath
getset
403 {
404 get => _showFullPath;
405 set
406 {
407 _showFullPath = value;
408
409 Properties.Settings.Default.ShowFullPath = _showFullPath;
410 Properties.Settings.Default.Save();
411 UpdateName();
412 }
413 }

◆ ShowHex

bool BrawlCrate.UI.MainForm.ShowHex
getset
372 {
373 get => _showHex;
374 set
375 {
376 _showHex = value;
377
378 Properties.Settings.Default.ShowHex = _showHex;
379 Properties.Settings.Default.Save();
381 }
382 }

◆ UpdateAutomatically

bool BrawlCrate.UI.MainForm.UpdateAutomatically
getset
358 {
359 get => _autoUpdate;
360 set
361 {
362 _autoUpdate = value;
363
364 Properties.Settings.Default.UpdateAutomatically = _autoUpdate;
365 Properties.Settings.Default.Save();
366 }
367 }

The documentation for this class was generated from the following file: