BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.PAT0TextureNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.PAT0TextureNode:
BrawlLib.SSBB.ResourceNodes.ResourceNode BrawlLib.Imaging.IVideo BrawlLib.Imaging.IImageSource

Public Member Functions

void CheckNext ()
 
void CheckPrev ()
 
PAT0TextureEntryNode GetPrevious (float index)
 Gets the last applied texture entry before or at the index. More...
 
PAT0TextureEntryNode GetEntry (float index)
 Gets the texture entry at the index, if there is one. More...
 
string GetTexture (float index, out bool kf)
 Gets the applied texture at the index and outputs if the value is a keyframe. More...
 
string GetPalette (float index, out bool kf)
 Gets the applied palette at the index and outputs if the value is a keyframe. More...
 
 PAT0TextureNode (PAT0Flags flags, int index)
 
override bool OnInitialize ()
 
override void OnPopulate ()
 
override int OnCalculateSize (bool force)
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
PAT0TextureEntryNode CreateEntry ()
 
override void SortChildren ()
 Sorts the order of texture entries by their frame index. More...
 
int GetImageIndexAtFrame (int frame)
 
Bitmap GetImage (int index)
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void OnRenamed ()
 
List< ResourceNodeGetChildrenRecursive ()
 Used primarily to get bone lists. Kept for all resource nodes for utility. More...
 
virtual void SignalPropertyChange ()
 
virtual void Dispose ()
 
void SelectChildAtIndex (int index)
 
void UpdateProperties ()
 
void UpdateCurrentControl ()
 
virtual bool MoveUp ()
 
virtual bool MoveDown ()
 
virtual void OnMoved ()
 
virtual void DoMoveDown ()
 
virtual void DoMoveDown (bool select)
 
virtual void DoMoveUp ()
 
virtual void DoMoveUp (bool select)
 
virtual bool AddUp ()
 
virtual bool AddDown ()
 
virtual bool ToParent ()
 
void Populate (int levels=-1)
 
virtual void OnPopulate ()
 
void Initialize (ResourceNode parent, FileMap source)
 
void Initialize (ResourceNode parent, VoidPtr address, int length)
 
void Initialize (ResourceNode parent, DataSource origSource)
 
virtual void Initialize (ResourceNode parent, DataSource origSource, DataSource uncompSource)
 
virtual bool OnInitialize ()
 
virtual void Restore ()
 
virtual void Remove ()
 
virtual void RemoveChild (ResourceNode child)
 
virtual void AddChild (ResourceNode child)
 
virtual void AddChild (ResourceNode child, bool change)
 
virtual void InsertChild (ResourceNode child, int index)
 
virtual void InsertChild (ResourceNode child, bool change, int index)
 
void SetSizeInternal (int size)
 
virtual void Replace (string fileName)
 
virtual void Replace (ResourceNode node)
 
virtual void Replace (string fileName, FileMapProtect prot, FileOptions options)
 
virtual void ReplaceRaw (VoidPtr address, int length)
 
virtual void ReplaceRaw (FileMap map)
 
virtual void Export (string outPath)
 
void Export (FileStream outStream)
 
virtual void ExportUncompressed (string outPath)
 
void ExportUncompressed (FileStream outStream)
 
virtual void Rebuild ()
 
virtual void Rebuild (bool force)
 
virtual void Rebuild (VoidPtr address, int length, bool force)
 
virtual void OnRebuild (VoidPtr address, int length, bool force)
 
virtual int CalculateSize (bool force)
 
virtual int OnCalculateSize (bool force)
 
void Merge ()
 
void Merge (bool forceBuild)
 
ResourceNode FindChildByType (string path, bool searchChildren, params ResourceType[] types)
 
ResourceNode FindChildByType (string path, bool searchChildren, StringComparison compare, params ResourceType[] types)
 
ResourceNode FindChild (string path)
 
ResourceNode FindChild (string path, bool searchChildren)
 
ResourceNode FindChild (string path, StringComparison compare)
 
ResourceNode FindChild (string path, bool searchChildren, StringComparison compare)
 
ResourceNode[] FindChildrenByClassType (string path, Type type)
 
ResourceNode[] FindChildrenByType (string path, ResourceType type)
 
ResourceNode[] FindChildrenByTypeInGroup (string path, ResourceType type, byte group)
 
ResourceNode[] FindChildrenByName (string name)
 
unsafe string FindName (string name)
 
ResourceNode FindEmbeddedIndex (int index)
 
virtual unsafe byte[] MD5 ()
 Find the MD5 checksum of this node's data. If this node doesn't have any data (BRESGroupNode, for example), this method will return null. More...
 
string MD5Str ()
 Get the result of the MD5() function as a string of hexadecimal digits. If MD5() returns null, this method will return an empty string. More...
 
ResourceNode PrevSibling ()
 
ResourceNode NextSibling ()
 
override string ToString ()
 
virtual void SortChildren ()
 
int GetImageIndexAtFrame (int frame)
 
Bitmap GetImage (int index)
 

Public Attributes

PAT0Flags _texFlags
 
int _textureIndex
 
int textureCount
 
ushort _texNameIndex
 
ushort _pltNameIndex
 
bool _hasPlt
 
bool _hasTex
 
float _frameScale
 
bool _rebuild = true
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
Form _mainForm
 
string _name
 
string _origPath
 
ResourceNode _parent
 
List< ResourceNode_children = new List<ResourceNode>()
 
int _calcSize
 
EventHandler UpdateControl
 
MoveEventHandler MovedDown
 
ResourceEventHandler Renamed
 
ResourceEventHandler PropertyChanged
 
ResourceEventHandler Replaced
 
ResourceEventHandler Restored
 
ResourceChildEventHandler ChildRemoved
 
bool _isPopulating
 
bool _replaced
 

Properties

override ResourceType ResourceFileType [get]
 
override Type[] AllowedChildTypes [get]
 
bool HasTexture [get, set]
 
bool HasPalette [get, set]
 
int TextureIndex [get, set]
 
uint NumFrames [get]
 
bool Loop [get]
 
float FrameRate [get]
 
IAudioStream Audio [get]
 
uint Frequency [get]
 
int ImageCount [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
string FilePath [get]
 
string FileName [get]
 
string DirectoryName [get]
 
ResourceNode RootNode [get]
 
DataSource OriginalSource [get]
 
DataSource UncompressedSource [get]
 
DataSource WorkingSource [get]
 
DataSource WorkingUncompressed [get]
 
virtual bool HasChildren [get]
 
virtual ResourceType ResourceFileType [get]
 
string NodeType [get]
 
virtual string TreePathAbsolute [get]
 
virtual string TreePath [get]
 
virtual int Level [get]
 
virtual int MaxNameLength [get]
 
virtual bool AllowDuplicateNames [get]
 
virtual bool AllowNullNames [get]
 
virtual string Name [get, set]
 
ResourceNode Parent [get, set]
 
List< ResourceNodeChildren [get]
 
int Index [get]
 
int HexIndex [get]
 
bool IsCompressed [get]
 
bool HasChanged [get, set]
 
bool IsBranch [get]
 
bool HasMerged [get]
 
virtual bool AllowSaving [get, set]
 
virtual bool IsDirty [get, set]
 
virtual uint UncompressedSize [get]
 
virtual Type[] AllowedChildTypes [get]
 
virtual string Compression [get, set]
 
virtual bool RetainChildrenOnReplace [get]
 
virtual bool supportsCompression [get]
 
static MD5CryptoServiceProvider MD5Provider [get]
 
- Properties inherited from BrawlLib.Imaging.IVideo
bool Loop [get]
 
uint NumFrames [get]
 
float FrameRate [get]
 
IAudioStream Audio [get]
 
uint Frequency [get]
 
- Properties inherited from BrawlLib.Imaging.IImageSource
int ImageCount [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
static ResourceNode[] FindAllSubNodes (ResourceNode root)
 
static ResourceNode FindNode (ResourceNode root, string path, bool searchChildren, StringComparison compare)
 
- Protected Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void ForceReplacedEvent ()
 
virtual void MergeInternal ()
 
- Events inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
SelectEventHandler SelectChild
 
EventHandler UpdateProps
 
MoveEventHandler MovedUp
 
ResourceEventHandler Disposing
 
ResourceChildEventHandler ChildAdded
 
ResourceChildInsertEventHandler ChildInserted
 

Constructor & Destructor Documentation

◆ PAT0TextureNode()

BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.PAT0TextureNode ( PAT0Flags  flags,
int  index 
)
inline
1048 {
1049 _texFlags = flags;
1050 _hasTex = _texFlags.HasFlag(PAT0Flags.HasTexture);
1051 _hasPlt = _texFlags.HasFlag(PAT0Flags.HasPalette);
1052 _textureIndex = index;
1053 _name = "Texture" + _textureIndex;
1054 }
PAT0Flags _texFlags
Definition: PAT0Node.cs:812
bool _hasPlt
Definition: PAT0Node.cs:815
int _textureIndex
Definition: PAT0Node.cs:813
bool _hasTex
Definition: PAT0Node.cs:815
string _name
Definition: ResourceNode.cs:139
PAT0Flags
Definition: PAT0.cs:9

Member Function Documentation

◆ CheckNext()

void BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.CheckNext ( )
inline
872 {
873 if (Index == Parent.Children.Count - 1)
874 {
875 return;
876 }
877
878 int index = Index;
879 if (_textureIndex > ((PAT0TextureNode) Parent.Children[Index + 1])._textureIndex)
880 {
881 DoMoveDown();
882 if (index != Index)
883 {
884 CheckNext();
885 }
886 }
887 }
void CheckNext()
Definition: PAT0Node.cs:871
ResourceNode Parent
Definition: ResourceNode.cs:245
int Index
Definition: ResourceNode.cs:301
virtual void DoMoveDown()
Definition: ResourceNode.cs:531
List< ResourceNode > Children
Definition: ResourceNode.cs:262

◆ CheckPrev()

void BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.CheckPrev ( )
inline
890 {
891 if (Index == 0)
892 {
893 return;
894 }
895
896 int index = Index;
897 if (_textureIndex < ((PAT0TextureNode) Parent.Children[Index - 1])._textureIndex)
898 {
899 DoMoveUp();
900 if (index != Index)
901 {
902 CheckPrev();
903 }
904 }
905 }
void CheckPrev()
Definition: PAT0Node.cs:889
virtual void DoMoveUp()
Definition: ResourceNode.cs:548

◆ CreateEntry()

PAT0TextureEntryNode BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.CreateEntry ( )
inline
1143 {
1144 float value = Children.Count > 0 ? ((PAT0TextureEntryNode) Children[Children.Count - 1])._frame + 1 : 0;
1145 PAT0TextureEntryNode node = new PAT0TextureEntryNode {_frame = value};
1146 AddChild(node);
1147 node.Texture = "NewTexture";
1148 return node;
1149 }
virtual void AddChild(ResourceNode child)
Definition: ResourceNode.cs:757

◆ GetEntry()

PAT0TextureEntryNode BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.GetEntry ( float  index)
inline

Gets the texture entry at the index, if there is one.

936 {
937 PAT0TextureEntryNode prev = null;
938 if (Children.Count == 0)
939 {
940 return null;
941 }
942
943 foreach (PAT0TextureEntryNode next in Children)
944 {
945 if (next.Index == 0)
946 {
947 prev = next;
948 continue;
949 }
950
951 if (prev._frame <= index && next._frame > index)
952 {
953 break;
954 }
955
956 prev = next;
957 }
958
959 if ((int) prev._frame == index)
960 {
961 return prev;
962 }
963
964 return null;
965 }

◆ GetImage()

Bitmap BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.GetImage ( int  index)
inline

Implements BrawlLib.Imaging.IImageSource.

1194 {
1195 if (index < 0 || index >= Children.Count)
1196 {
1197 return null;
1198 }
1199
1200 return ((PAT0TextureEntryNode) Children[index]).GetImage(0);
1201 }

◆ GetImageIndexAtFrame()

int BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.GetImageIndexAtFrame ( int  frame)
inline

Implements BrawlLib.Imaging.IVideo.

1177 {
1178 PAT0TextureEntryNode node = GetPrevious(frame);
1179 if (node != null)
1180 {
1181 return node.Index;
1182 }
1183
1184 return 0;
1185 }
PAT0TextureEntryNode GetPrevious(float index)
Gets the last applied texture entry before or at the index.
Definition: PAT0Node.cs:910

◆ GetPalette()

string BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.GetPalette ( float  index,
out bool  kf 
)
inline

Gets the applied palette at the index and outputs if the value is a keyframe.

1011 {
1012 PAT0TextureEntryNode prev = null;
1013 if (Children.Count == 0)
1014 {
1015 kf = false;
1016 return null;
1017 }
1018
1019 foreach (PAT0TextureEntryNode next in Children)
1020 {
1021 if (next.Index == 0)
1022 {
1023 prev = next;
1024 continue;
1025 }
1026
1027 if (prev._frame <= index && next._frame > index)
1028 {
1029 break;
1030 }
1031
1032 prev = next;
1033 }
1034
1035 if ((int) prev._frame == index)
1036 {
1037 kf = true;
1038 }
1039 else
1040 {
1041 kf = false;
1042 }
1043
1044 return prev.Palette;
1045 }

◆ GetPrevious()

PAT0TextureEntryNode BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.GetPrevious ( float  index)
inline

Gets the last applied texture entry before or at the index.

911 {
912 PAT0TextureEntryNode prev = null;
913 foreach (PAT0TextureEntryNode next in Children)
914 {
915 if (next.Index == 0)
916 {
917 prev = next;
918 continue;
919 }
920
921 if (prev._frame <= index && next._frame > index)
922 {
923 break;
924 }
925
926 prev = next;
927 }
928
929 return prev;
930 }

◆ GetTexture()

string BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.GetTexture ( float  index,
out bool  kf 
)
inline

Gets the applied texture at the index and outputs if the value is a keyframe.

971 {
972 PAT0TextureEntryNode prev = null;
973 if (Children.Count == 0)
974 {
975 kf = false;
976 return null;
977 }
978
979 foreach (PAT0TextureEntryNode next in Children)
980 {
981 if (next.Index == 0)
982 {
983 prev = next;
984 continue;
985 }
986
987 if (prev._frame <= index && next._frame > index)
988 {
989 break;
990 }
991
992 prev = next;
993 }
994
995 if ((int) prev._frame == index)
996 {
997 kf = true;
998 }
999 else
1000 {
1001 kf = false;
1002 }
1003
1004 return prev.Texture;
1005 }

◆ OnCalculateSize()

override int BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.OnCalculateSize ( bool  force)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1077 {
1078 return Children.Count > 1 ? PAT0TextureTable.Size + PAT0Texture.Size * Children.Count : 0;
1079 }

◆ OnInitialize()

override bool BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.OnInitialize ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1057 {
1058 _frameScale = Header->_frameScale;
1059 textureCount = Header->_textureCount;
1060
1061 return textureCount > 0;
1062 }
int textureCount
Definition: PAT0Node.cs:813
float _frameScale
Definition: PAT0Node.cs:816
bshort _textureCount
Definition: PAT0.cs:225
bfloat _frameScale
Definition: PAT0.cs:227

◆ OnPopulate()

override void BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.OnPopulate ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1065 {
1066 if (!_texFlags.HasFlag(PAT0Flags.FixedTexture))
1067 {
1068 PAT0Texture* current = Header->Textures;
1069 for (int i = 0; i < textureCount; i++, current++)
1070 {
1071 new PAT0TextureEntryNode().Initialize(this, new DataSource(current, PAT0Texture.Size));
1072 }
1073 }
1074 }
const int Size
Definition: PAT0.cs:246
PAT0Texture * Textures
Definition: PAT0.cs:240

◆ OnRebuild()

override void BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.OnRebuild ( VoidPtr  address,
int  length,
bool  force 
)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1082 {
1083 if (Children.Count > 1)
1084 {
1085 PAT0TextureTable* table = (PAT0TextureTable*) address;
1086 table->_textureCount = (short) Children.Count;
1087 float f = (Children[Children.Count - 1] as PAT0TextureEntryNode)._frame;
1088 table->_frameScale = f == 0 ? 0 : 1.0f / f;
1089 table->_pad = 0;
1090
1091 PAT0Texture* entry = table->Textures;
1092 foreach (PAT0TextureEntryNode n in Children)
1093 {
1094 n.Rebuild(entry++, PAT0Texture.Size, true);
1095 }
1096 }
1097 }

◆ SortChildren()

override void BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.SortChildren ( )
inlinevirtual

Sorts the order of texture entries by their frame index.

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1155 {
1156 Top:
1157 for (int i = 0; i < Children.Count; i++)
1158 {
1159 PAT0TextureEntryNode t = Children[i] as PAT0TextureEntryNode;
1160 int x = t.Index;
1161 t.CheckNext();
1162 t.CheckPrev();
1163 if (t.Index != x)
1164 {
1165 goto Top;
1166 }
1167 }
1168 }

Member Data Documentation

◆ _frameScale

float BrawlLib.SSBB.ResourceNodes.PAT0TextureNode._frameScale

◆ _hasPlt

bool BrawlLib.SSBB.ResourceNodes.PAT0TextureNode._hasPlt

◆ _hasTex

bool BrawlLib.SSBB.ResourceNodes.PAT0TextureNode._hasTex

◆ _pltNameIndex

ushort BrawlLib.SSBB.ResourceNodes.PAT0TextureNode._pltNameIndex

◆ _rebuild

bool BrawlLib.SSBB.ResourceNodes.PAT0TextureNode._rebuild = true

◆ _texFlags

PAT0Flags BrawlLib.SSBB.ResourceNodes.PAT0TextureNode._texFlags

◆ _texNameIndex

ushort BrawlLib.SSBB.ResourceNodes.PAT0TextureNode._texNameIndex

◆ _textureIndex

int BrawlLib.SSBB.ResourceNodes.PAT0TextureNode._textureIndex

◆ textureCount

int BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.textureCount

Property Documentation

◆ AllowedChildTypes

override Type [] BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.AllowedChildTypes
get

◆ Audio

IAudioStream BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.Audio
get

◆ FrameRate

float BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.FrameRate
get

◆ Frequency

uint BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.Frequency
get

◆ HasPalette

bool BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.HasPalette
getset
839 {
840 get => _hasPlt;
841 set
842 {
843 _hasPlt = value;
845 }
846 }
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313

◆ HasTexture

bool BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.HasTexture
getset
828 {
829 get => _hasTex;
830 set
831 {
832 _hasTex = value;
834 }
835 }

◆ ImageCount

int BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.ImageCount
get

◆ Loop

bool BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.Loop
get

◆ NumFrames

uint BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.NumFrames
get

◆ ResourceFileType

override ResourceType BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.ResourceFileType
get

◆ TextureIndex

int BrawlLib.SSBB.ResourceNodes.PAT0TextureNode.TextureIndex
getset
850 {
851 get => _textureIndex;
852 set
853 {
854 foreach (PAT0TextureNode t in Parent.Children)
855 {
856 if (t.Index != Index && t._textureIndex == (value > 7 ? 7 : value < 0 ? 0 : value))
857 {
858 return;
859 }
860 }
861
862 _textureIndex = value > 7 ? 7 : value < 0 ? 0 : value;
863
864 Name = "Texture" + _textureIndex;
865
866 CheckNext();
867 CheckPrev();
868 }
869 }
virtual string Name
Definition: ResourceNode.cs:223

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