BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Properties | Events | List of all members
BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode:
BrawlLib.SSBB.ResourceNodes.MDL0EntryNode BrawlLib.SSBB.ResourceNodes.IMatrixNodeUser BrawlLib.Modeling.IObject BrawlLib.SSBB.ResourceNodes.ResourceNode BrawlLib.OpenGL.IRenderedObject

Public Member Functions

void SetColors (int id, string value)
 
void SetColors (int id, string value, bool skipDialog)
 
void SetUVs (int id, string value)
 
void SetUVs (int id, string value, bool skipDialog)
 
override void Dispose ()
 
override bool OnInitialize ()
 
void RecalcIndices ()
 
bool CheckVertexFormat ()
 Returns true if the facepoint descriptor does not match the linked nodes, meaning this object must be rebuilt. More...
 
void GenerateNodeCache ()
 
override int OnCalculateSize (bool force)
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
override void Export (string outPath)
 
Box GetBox ()
 
void DrawBox ()
 
void Attach ()
 
void Detach ()
 
void Refresh ()
 
void PreRender (ModelPanelViewport v)
 
override void SignalPropertyChange ()
 
void TryConvertMatrixToVertex ()
 
void TryConvertMatrixToObject ()
 
void DeferUpdateAssets ()
 
void SetEditedAssets (bool forceNewNode, params bool[] types)
 
void SetEditedVertices (bool forceNewNode=false)
 
void SetEditedNormals (bool forceNewNode=false)
 
void SetEditedColors (int id, bool forceNewNode=false)
 
void SetEditedUVs (int id, bool forceNewNode=false)
 
MDL0ObjectNode HardCopy ()
 
MDL0ObjectNode SoftCopy ()
 
void Remove (bool v, bool n, bool c1, bool c2, params bool[] uv)
 
override void Remove ()
 
void Remove (bool removeAttached)
 
void OnDrawCallsChanged ()
 
override void SignalPropertyChange ()
 
- 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 ()
 
void DeferUpdateAssets ()
 
void Attach ()
 
void Detach ()
 
void Refresh ()
 
void PreRender (ModelPanelViewport v)
 
Box GetBox ()
 

Public Attributes

MDL0VertexNode _vertexNode
 
MDL0NormalNode _normalNode
 
MDL0ColorNode[] _colorSet = new MDL0ColorNode[2]
 
MDL0UVNode[] _uvSet = new MDL0UVNode[8]
 
int _numFacepoints
 
int _numFaces
 
int _nodeId
 
int _defBufferSize = 0xE0
 
int _flag
 
int[] _nodeCache
 
bool _forceRebuild
 
bool _reOptimized
 
BindingList< DrawCall_drawCalls = new BindingList<DrawCall>()
 
PrimitiveManager _manager
 
bool _attached
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.MDL0EntryNode
int _entryIndex
 
- 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]
 
List< Vertex3Vertices [get]
 
bool TextureMatrix0Enabled [get, set]
 
bool TextureMatrix1Enabled [get, set]
 
bool TextureMatrix2Enabled [get, set]
 
bool TextureMatrix3Enabled [get, set]
 
bool TextureMatrix4Enabled [get, set]
 
bool TextureMatrix5Enabled [get, set]
 
bool TextureMatrix6Enabled [get, set]
 
bool TextureMatrix7Enabled [get, set]
 
bool TextureMatrix0Identity [get, set]
 
bool TextureMatrix1Identity [get, set]
 
bool TextureMatrix2Identity [get, set]
 
bool TextureMatrix3Identity [get, set]
 
bool TextureMatrix4Identity [get, set]
 
bool TextureMatrix5Identity [get, set]
 
bool TextureMatrix6Identity [get, set]
 
bool TextureMatrix7Identity [get, set]
 
ObjFlag Flags [get, set]
 
int ID [get]
 
int FacepointCount [get]
 
int VertexCount [get]
 
int FaceCount [get]
 
List< IMatrixNodeInfluences [get]
 
string VertexNode [get, set]
 
string?? NormalNode [get, set]
 
string ColorNode0 [get, set]
 
string ColorNode1 [get, set]
 
string TexCoord0 [get, set]
 
string TexCoord1 [get, set]
 
string TexCoord2 [get, set]
 
string TexCoord3 [get, set]
 
string TexCoord4 [get, set]
 
string TexCoord5 [get, set]
 
string TexCoord6 [get, set]
 
string TexCoord7 [get, set]
 
string FurLayerCoordNode [get, set]
 
string FurVectorNode [get, set]
 
string SingleBind [get, set]
 
IMatrixNode MatrixNode [get, set]
 
bool IsRendering [get, set]
 
bool Attached [get, set]
 
bool Deleting [get]
 
List< DrawCallBaseDrawCalls [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.MDL0EntryNode
MDL0Node Model [get]
 
BRRESNode BRESNode [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.SSBB.ResourceNodes.IMatrixNodeUser
IMatrixNode MatrixNode [get, set]
 
- Properties inherited from BrawlLib.Modeling.IObject
List< Vertex3Vertices [get]
 
- Properties inherited from BrawlLib.OpenGL.IRenderedObject
List< DrawCallBaseDrawCalls [get]
 
bool IsRendering [get, set]
 
bool Attached [get]
 

Events

EventHandler DrawCallsChanged
 
- Events inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
SelectEventHandler SelectChild
 
EventHandler UpdateProps
 
MoveEventHandler MovedUp
 
ResourceEventHandler Disposing
 
ResourceChildEventHandler ChildAdded
 
ResourceChildInsertEventHandler ChildInserted
 
- Events inherited from BrawlLib.OpenGL.IRenderedObject
EventHandler DrawCallsChanged
 

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 ()
 

Member Function Documentation

◆ Attach()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Attach ( )
inline

Implements BrawlLib.OpenGL.IRenderedObject.

1681 {
1682 _attached = true;
1683 Model.Attach();
1684 }
MDL0Node Model
Definition: MDL0GroupNode.cs:28
void Attach()
Definition: MDL0Node.cs:2966
bool _attached
Definition: MDL0ObjectNode.cs:1368

◆ CheckVertexFormat()

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.CheckVertexFormat ( )
inline

Returns true if the facepoint descriptor does not match the linked nodes, meaning this object must be rebuilt.

975 {
976 bool b1 = _vertexFormat.PosFormat != XFDataFormat.None;
977 bool b2 = _elementIndices[0] != -1;
978 if (b1 != b2)
979 {
980 return true;
981 }
982
983 b1 = _vertexFormat.NormalFormat != XFDataFormat.None;
984 b2 = _elementIndices[1] != -1;
985 if (b1 != b2)
986 {
987 return true;
988 }
989
990 for (int i = 0; i < 2; i++)
991 {
992 b1 = _vertexFormat.GetColorFormat(i) != XFDataFormat.None;
993 b2 = _elementIndices[i + 2] != -1;
994 if (b1 != b2)
995 {
996 return true;
997 }
998 }
999
1000 for (int i = 0; i < 8; i++)
1001 {
1002 b1 = _vertexFormat.GetUVFormat(i) != XFDataFormat.None;
1003 b2 = _elementIndices[i + 4] != -1;
1004 if (b1 != b2)
1005 {
1006 return true;
1007 }
1008 }
1009
1010 return false;
1011 }
XFDataFormat
Definition: XF.cs:459
XFDataFormat GetColorFormat(int index)
Definition: CP.cs:85
XFDataFormat GetUVFormat(int index)
Definition: CP.cs:105

◆ DeferUpdateAssets()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.DeferUpdateAssets ( )
inline

Implements BrawlLib.SSBB.ResourceNodes.IMatrixNodeUser.

1764 {
1765 _updateAssets = false;
1766 }

◆ Detach()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Detach ( )
inline

Implements BrawlLib.OpenGL.IRenderedObject.

1687 {
1688 _attached = false;
1689
1690 Model?.Detach();
1691 }
void Detach()
Definition: MDL0Node.cs:3018

◆ Dispose()

override void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Dispose ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

713 {
714 if (_manager != null && _parent != null && _parent._disposed)
715 {
717 _manager = null;
718 }
719
720 base.Dispose();
721 }
void Dispose()
Definition: PrimitiveManager.cs:459
PrimitiveManager _manager
Definition: MDL0ObjectNode.cs:710
ResourceNode _parent
Definition: ResourceNode.cs:142

◆ DrawBox()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.DrawBox ( )
inline
1656 {
1658 }
Definition: TKContext.cs:15
static void DrawWireframeBox(Box value)
Definition: TKContext.cs:230
Box GetBox()
Definition: MDL0ObjectNode.cs:1370

◆ Export()

override void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Export ( string  outPath)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1312 {
1313 if (outPath.EndsWith(".obj"))
1314 {
1315 Wavefront.Serialize(outPath, this);
1316 }
1317 else
1318 {
1319 base.Export(outPath);
1320 }
1321 }
Definition: Wavefront.cs:9
static void Serialize(string outPath, params object[] assets)
Definition: Wavefront.cs:10

◆ GenerateNodeCache()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.GenerateNodeCache ( )
inline
1014 {
1015 if (MatrixNode != null)
1016 {
1017 _nodeCache = new int[0];
1018 return;
1019 }
1020
1021 //Create node table
1022 HashSet<int> nodes = new HashSet<int>();
1023 foreach (Vertex3 v in _manager._vertices)
1024 {
1025 if (v.MatrixNode != null)
1026 {
1027 nodes.Add(v.MatrixNode.NodeIndex);
1028 }
1029 }
1030
1031 //Copy to array and sort
1032 _nodeCache = new int[nodes.Count];
1033 nodes.CopyTo(_nodeCache);
1034 Array.Sort(_nodeCache);
1035 }
List< Vertex3 > _vertices
Definition: PrimitiveManager.cs:48
Definition: Vertex.cs:13
IMatrixNode MatrixNode
Definition: Vertex.cs:195
IMatrixNode MatrixNode
Definition: MDL0ObjectNode.cs:649
int[] _nodeCache
Definition: MDL0ObjectNode.cs:619
int NodeIndex
Definition: IMatrixNode.cs:11

◆ GetBox()

Box BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.GetBox ( )
inline

Implements BrawlLib.OpenGL.IRenderedObject.

1371 {
1372 if (_manager?._vertices == null)
1373 {
1374 return new Box();
1375 }
1376
1377 Box box = Box.ExpandableVolume;
1378 foreach (Vertex3 vertex in _manager._vertices)
1379 {
1380 box.ExpandVolume(vertex.WeightedPosition);
1381 }
1382
1383 return box;
1384 }
Vector3 WeightedPosition
Definition: Vertex.cs:222
Definition: Box.cs:6
static readonly Box ExpandableVolume
Definition: Box.cs:7
void ExpandVolume(Vector3 value)
Definition: Box.cs:29

◆ HardCopy()

MDL0ObjectNode BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.HardCopy ( )
inline
1820 {
1821 MDL0ObjectNode o = new MDL0ObjectNode
1822 {
1824 Name = Name,
1827 _furVecNode = _furVecNode,
1828 _furPosNode = _furPosNode,
1829 _matrixNode = _matrixNode,
1830 _elementIndices = _elementIndices,
1833 _drawCalls = new BindingList<DrawCall>()
1834 };
1835 for (int i = 0; i < 2; i++)
1836 {
1837 o._colorSet[i] = _colorSet[i];
1838 }
1839
1840 for (int i = 0; i < 8; i++)
1841 {
1842 o._uvSet[i] = _uvSet[i];
1843 }
1844
1845 foreach (DrawCall c in _drawCalls)
1846 {
1847 o._drawCalls.Add(new DrawCall(o)
1848 {
1849 MaterialNode = c.MaterialNode,
1850 VisibilityBoneNode = c.VisibilityBoneNode,
1851 DrawPriority = c.DrawPriority,
1852 DrawPass = c.DrawPass
1853 });
1854 }
1855
1857 return o;
1858 }
PrimitiveManager HardCopy()
Returns an identical copy of this manager but as a completely new instance with reallocated buffers.
Definition: PrimitiveManager.cs:119
override void SignalPropertyChange()
Definition: MDL0GroupNode.cs:66
BindingList< DrawCall > _drawCalls
Definition: MDL0ObjectNode.cs:626
MDL0VertexNode _vertexNode
Definition: MDL0ObjectNode.cs:216
MDL0UVNode[] _uvSet
Definition: MDL0ObjectNode.cs:419
int _numFacepoints
Definition: MDL0ObjectNode.cs:613
MDL0NormalNode _normalNode
Definition: MDL0ObjectNode.cs:217
MDL0ColorNode[] _colorSet
Definition: MDL0ObjectNode.cs:330
int _numFaces
Definition: MDL0ObjectNode.cs:614
virtual string Name
Definition: ResourceNode.cs:223

◆ OnCalculateSize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1039 {
1040 MDL0Node model = Model;
1041 if (model._isImport)
1042 {
1043 //Continue checking for single bind
1044 if (_nodeId == -2 && MatrixNode == null)
1045 {
1046 bool first = true;
1047 foreach (Vertex3 v in _manager._vertices)
1048 {
1049 if (first)
1050 {
1051 if (v.MatrixNode != null)
1052 {
1054 MatrixNode = model._linker.NodeCache[v.MatrixNode.NodeIndex];
1055 }
1056
1057 first = false;
1058 }
1059
1060 v.MatrixNode = null;
1061 }
1062
1063 //Check if a single bind was even found.
1064 if (MatrixNode == null)
1065 {
1066 if (model._boneList != null && model._boneList.Count > 0)
1067 {
1068 MatrixNode = model._boneList[0] as IMatrixNode;
1069 }
1070 else if (model._linker.BoneCache != null && model._linker.BoneCache.Length > 0)
1071 {
1072 MatrixNode = model._linker.BoneCache[0];
1073 }
1074 else if (model._linker.NodeCache != null && model._linker.NodeCache.Length > 0)
1075 {
1076 MatrixNode = model._linker.NodeCache[0];
1077 }
1078
1079 //At this point, if a single bind still hasn't been found
1080 //it doesn't even matter because the model doesn't have any matrices at all
1081 }
1082 }
1083 }
1084
1085 //Collect vertex node ids
1087
1088 //Recollect indices of linked nodes
1089 RecalcIndices();
1090
1091 //Check that the facepoint descriptor matches the linked nodes
1092 if (!_forceRebuild)
1093 {
1095 }
1096
1097 //Primitives need to be
1098 _manager._remakePrimitives = model._isImport || _reOptimized || _manager.AssetsChanged;
1099
1100 //Rebuild only under certain circumstances
1102 {
1103 _manager._isWeighted = Weighted;
1104
1105 int size = (int) MDL0Object.Size;
1106 if (model._version >= 10)
1107 {
1108 size += 4; //Add extra -1 value
1109 }
1110
1111 //Set vertex descriptor
1113 _elementIndices,
1114 model._linker._vertices,
1115 model._linker._colors,
1116 model._linker._forceDirectAssets);
1117
1118 //Add table length
1119 size += _nodeCache.Length * 2 + 4;
1120 _tableLen = (size.Align(0x10) + 0xE0) % 0x20 == 0 ? size.Align(0x10) : size.Align(0x20);
1121
1122 //Add def length
1123 size = _tableLen + 0xE0;
1124
1125 //If assets have been changed, linked asset nodes must be recreated!
1126 //This will merge internally stored face data buffers into facepoints,
1127 //then group them and store the groups in _primGroups
1128 if (model._isImport || _manager.AssetsChanged)
1129 {
1135 !model._isImport ? false : Collada._importOptions._forceCCW,
1136 out _numFacepoints,
1137 out _numFaces);
1138 }
1139
1140 size += _manager.GetDisplayListSize();
1141 int align = size.Align(0x10) % 0x20 == 0 ? 0x10 : 0x20;
1142 int diff = size.Align(align) - size;
1143 size += diff;
1144 _manager._primitiveSize += diff;
1145
1146 return size;
1147 }
1148
1149 return base.OnCalculateSize(force);
1150 }
uint _minStripLen
Definition: ColladaImporter.cs:1213
bool _forceCCW
Definition: ColladaImporter.cs:1207
bool _pushCacheHits
Definition: ColladaImporter.cs:1214
bool _useTristrips
Definition: ColladaImporter.cs:1215
uint _cacheSize
Definition: ColladaImporter.cs:1212
Definition: ColladaAssetDecoder.cs:10
static ImportOptions _importOptions
Definition: ColladaImporter.cs:949
int GetDisplayListSize()
Definition: PrimitiveManager.cs:773
bool _remakePrimitives
Definition: PrimitiveManager.cs:100
bool AssetsChanged
Definition: PrimitiveManager.cs:24
void GroupPrimitives(bool useStrips, uint cacheSize, uint minStripLen, bool pushCacheHits, bool forceCCW, out int newPointCount, out int newFaceCount)
Currently should only should be called when importing a model with the collada importer or when inter...
Definition: PrimitiveManager.cs:834
void SetVertexDescList(short[] indices, List< VertexCodec > vertexCodecs, List< ColorCodec > colorCodecs, params bool[] forceDirect)
Definition: PrimitiveManager.cs:1218
int _nodeId
Definition: MDL0ObjectNode.cs:615
bool CheckVertexFormat()
Returns true if the facepoint descriptor does not match the linked nodes, meaning this object must be...
Definition: MDL0ObjectNode.cs:974
void GenerateNodeCache()
Definition: MDL0ObjectNode.cs:1013
bool _forceRebuild
Definition: MDL0ObjectNode.cs:623
void DeferUpdateAssets()
Definition: MDL0ObjectNode.cs:1763
bool _reOptimized
Definition: MDL0ObjectNode.cs:623
void RecalcIndices()
Definition: MDL0ObjectNode.cs:953
Definition: IMatrixNode.cs:9
Definition: MDL0.cs:1868
const uint Size
Definition: MDL0.cs:1869

◆ OnDrawCallsChanged()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.OnDrawCallsChanged ( )
inline
2025 {
2026 if (_attached)
2027 {
2028 DrawCallsChanged?.Invoke(this, null);
2029 }
2030 else if (Model != null && Model.Attached)
2031 {
2033 }
2034 }
bool Attached
Definition: MDL0Node.cs:2959
void OnDrawCallsChanged()
Definition: MDL0Node.cs:3624
EventHandler DrawCallsChanged
Definition: MDL0ObjectNode.cs:2022

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

724 {
725 MDL0Object* header = Header;
726 _nodeId = header->_nodeId;
727
729
730 ModelLinker linker = Model._linker;
731
732 MatrixNode = _nodeId >= 0 && _nodeId < Model._linker.NodeCache.Length
734 : null;
735
736 _vertexFormat = header->_vertexFormat;
737 _vertexSpecs = header->_vertexSpecs;
739 _numFaces = header->_numFaces;
740 _flag = header->_flag;
742 _entryIndex = header->_index;
743
744 //Conditional name assignment
745 if (_name == null && header->_stringOffset != 0)
746 {
747 if (!_replaced)
748 {
749 _name = header->ResourceString;
750 }
751 else
752 {
753 _name = "polygon" + Index;
754 }
755 }
756
757 //Link nodes
758 if (header->_vertexId >= 0 && Model._vertList != null)
759 {
760 foreach (MDL0VertexNode v in Model._vertList)
761 {
762 if (header->_vertexId == v.ID)
763 {
764 (_vertexNode = v)._objects.Add(this);
765 break;
766 }
767 }
768 }
769
770 if (header->_normalId >= 0 && Model._normList != null)
771 {
772 foreach (MDL0NormalNode n in Model._normList)
773 {
774 if (header->_normalId == n.ID)
775 {
776 (_normalNode = n)._objects.Add(this);
777 break;
778 }
779 }
780 }
781
782 int id;
783 for (int i = 0; i < 2; i++)
784 {
785 if ((id = ((bshort*) header->_colorIds)[i]) >= 0 && Model._colorList != null)
786 {
787 foreach (MDL0ColorNode c in Model._colorList)
788 {
789 if (id == c.ID)
790 {
791 (_colorSet[i] = c)._objects.Add(this);
792 break;
793 }
794 }
795 }
796 }
797
798 for (int i = 0; i < 8; i++)
799 {
800 if ((id = ((bshort*) header->_uids)[i]) >= 0 && Model._uvList != null)
801 {
802 foreach (MDL0UVNode u in Model._uvList)
803 {
804 if (id == u.ID)
805 {
806 (_uvSet[i] = u)._objects.Add(this);
807 break;
808 }
809 }
810 }
811 }
812
813 if (Model._version > 9)
814 {
815 if (header->_furVectorId >= 0)
816 {
817 foreach (MDL0FurVecNode v in Model._furVecList)
818 {
819 if (header->_furVectorId == v.ID)
820 {
821 (_furVecNode = v)._objects.Add(this);
822 break;
823 }
824 }
825 }
826
827 if (header->_furLayerCoordId >= 0)
828 {
829 foreach (MDL0FurPosNode n in Model._furPosList)
830 {
831 if (header->_furLayerCoordId == n.ID)
832 {
833 (_furPosNode = n)._objects.Add(this);
834 break;
835 }
836 }
837 }
838 }
839
840 //Link element indices for rebuild
841 _elementIndices[0] = (short) (_vertexNode != null ? _vertexNode.Index : -1);
842 _elementIndices[1] = (short) (_normalNode != null ? _normalNode.Index : -1);
843 for (int i = 2; i < 4; i++)
844 {
845 _elementIndices[i] = (short) (_colorSet[i - 2] != null ? _colorSet[i - 2].Index : -1);
846 }
847
848 for (int i = 4; i < 12; i++)
849 {
850 _elementIndices[i] = (short) (_uvSet[i - 4] != null ? _uvSet[i - 4].Index : -1);
851 }
852
853 _elementIndices[12] = (short) (_furVecNode != null ? _furVecNode.Index : -1);
854 _elementIndices[13] = (short) (_furPosNode != null ? _furPosNode.Index : -1);
855
856 //Create primitive manager
857 _manager = new PrimitiveManager(header, Model._assets, linker.NodeCache, this);
858
859 //Read internal object node cache and read influence list
860 if (Model._linker.NodeCache != null && _matrixNode == null)
861 {
862 _influences = new List<IMatrixNode>();
863 bushort* weights = header->WeightIndices(Model._version);
864 int count = *(bint*) weights;
865 weights += 2;
866 for (int i = 0; i < count; i++, weights++)
867 {
868 if (*weights < Model._linker.NodeCache.Length)
869 {
870 _influences.Add(Model._linker.NodeCache[*weights]);
871 }
872 }
873 }
874
875 //Check for errors
876 if (header->_totalLength % 0x20 != 0)
877 {
878 Model._errors.Add("Object " + Index + " has an improper data length.");
880 _forceRebuild = true;
881 }
882
883 if ((0x24 + header->_primitives._offset) % 0x20 != 0)
884 {
885 Model._errors.Add("Object " + Index + " has an improper primitives start offset.");
887 _forceRebuild = true;
888 }
889
890 if (CheckVertexFormat())
891 {
892 Model._errors.Add("Object " + Index +
893 " has a facepoint descriptor that does not match its linked nodes.");
895 _forceRebuild = true;
896
897 for (int i = 0; i < 2; i++)
898 {
899 if (_colorSet[i] != null && _manager._faceData[i + 2] == null)
900 {
902 }
903 }
904 }
905
906 if (HasTexMtx && !Weighted)
907 {
908 Model._errors.Add("Object " + Index + " has texture matrices but is not weighted.");
909 for (int i = 0; i < 8; i++)
910 {
911 _manager.HasTextureMatrix[i] = false;
912 }
913
915 _forceRebuild = true;
916 }
917
918 //if (!Weighted)
919 //{
920 // bool notFloat = HasANonFloatAsset;
921 // foreach (PrimitiveGroup p in _primGroups)
922 // {
923 // bool o = false;
924 // foreach (PrimitiveHeader ph in p._headers)
925 // if (ph.Type != WiiBeginMode.TriangleList && notFloat)
926 // {
927 // Model._errors.Add("Object " + Index + " will explode in-game due to assets that are not written as float.");
928 // SignalPropertyChange();
929
930 // if (_vertexNode.Format != WiiVertexComponentType.Float)
931 // _vertexNode._forceRebuild = _vertexNode._forceFloat = true;
932
933 // if (_normalNode != null && _normalNode.Format != WiiVertexComponentType.Float)
934 // _normalNode._forceRebuild = _normalNode._forceFloat = true;
935
936 // for (int i = 4; i < 12; i++)
937 // if (_uvSet[i - 4] != null && _uvSet[i - 4].Format != WiiVertexComponentType.Float)
938 // _uvSet[i - 4]._forceRebuild = _uvSet[i - 4]._forceFloat = true;
939
940 // o = true;
941 // break;
942 // }
943 // if (o)
944 // break;
945 // }
946 //}
947
948 return false;
949 }
Definition: UnsafeBuffer.cs:7
Definition: PrimitiveManager.cs:20
int _pointCount
Definition: PrimitiveManager.cs:51
bool[] HasTextureMatrix
Definition: PrimitiveManager.cs:96
UnsafeBuffer[] _faceData
Definition: PrimitiveManager.cs:59
int _version
Definition: BRRESNode.cs:1045
int _entryIndex
Definition: MDL0GroupNode.cs:22
List< ResourceNode > _colorList
Definition: MDL0Node.cs:313
List< ResourceNode > _vertList
Definition: MDL0Node.cs:309
ModelLinker _linker
Definition: MDL0Node.cs:45
List< ResourceNode > _furVecList
Definition: MDL0Node.cs:315
List< ResourceNode > _furPosList
Definition: MDL0Node.cs:314
List< ResourceNode > _normList
Definition: MDL0Node.cs:310
AssetStorage _assets
Definition: MDL0Node.cs:46
List< string > _errors
Definition: MDL0Node.cs:51
List< ResourceNode > _uvList
Definition: MDL0Node.cs:311
int _defBufferSize
Definition: MDL0ObjectNode.cs:616
int _flag
Definition: MDL0ObjectNode.cs:617
override void SignalPropertyChange()
Definition: MDL0ObjectNode.cs:1707
bool _replaced
Definition: ResourceNode.cs:827
void SetSizeInternal(int size)
Definition: ResourceNode.cs:799
string _name
Definition: ResourceNode.cs:139
int Index
Definition: ResourceNode.cs:301
Definition: ModelLinker.cs:33
IMatrixNode[] NodeCache
Definition: ModelLinker.cs:142
Definition: BigEndianTypes.cs:9
Definition: BigEndianTypes.cs:148
Definition: BigEndianTypes.cs:192
string ResourceString
Definition: MDL0.cs:1939
bshort _vertexId
Definition: MDL0.cs:1890
fixed short _colorIds[2]
Definition: MDL0.cs:1892
short _furLayerCoordId
Definition: MDL0.cs:1903
bint _numVertices
Definition: MDL0.cs:1887
short _furVectorId
Definition: MDL0.cs:1897
bint _stringOffset
Definition: MDL0.cs:1884
bshort _normalId
Definition: MDL0.cs:1891
XFVertexSpecs _vertexSpecs
Definition: MDL0.cs:1876
fixed short _uids[8]
Definition: MDL0.cs:1893
CPVertexFormat _vertexFormat
Definition: MDL0.cs:1875
bint _totalLength
Definition: MDL0.cs:1871
bint _numFaces
Definition: MDL0.cs:1888
bint _nodeId
Definition: MDL0.cs:1873
bint _index
Definition: MDL0.cs:1885
PrimDataGroup _primitives
Definition: MDL0.cs:1879
bushort * WeightIndices(int version)
Definition: MDL0.cs:1927
bint _flag
Definition: MDL0.cs:1883
PrimDataGroup _defintions
Definition: MDL0.cs:1878
bint _bufferSize
Definition: MDL0.cs:1838
bint _offset
Definition: MDL0.cs:1840

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1153 {
1154 MDL0Object* header = (MDL0Object*) address;
1155
1156 MDL0Node model = Model;
1157
1158 header->_defintions._size = 0x80 +
1159 (_uvSet[2] == null
1160 ? 0
1161 : 0x20 +
1162 (_uvSet[5] == null
1163 ? 0
1164 : 0x20 +
1165 (_uvSet[7] == null ? 0 : 0x20)));
1166
1168 {
1169 //Set header values
1170 header->_totalLength = length;
1171 header->_numVertices = _numFacepoints;
1172 header->_numFaces = _numFaces;
1175 header->_primitives._offset = _tableLen + 0xBC;
1177 header->_defintions._offset = _tableLen - 0x18;
1178 header->_flag = _flag;
1179 header->_index = _entryIndex;
1180
1181 //Set node table offset
1182 if (model._version < 10)
1183 {
1184 header->_nodeTableOffset = 0x64;
1185 }
1186 else
1187 {
1188 header->_furVectorId = _elementIndices[12];
1189 header->_furLayerCoordId = _elementIndices[13];
1190 *((byte*) header + 0x67) = 0x68;
1191 }
1192
1193 //Set the node id
1194 header->_nodeId = _nodeId = _matrixNode != null ? _matrixNode.NodeIndex : -1;
1195
1196 //Set asset ids
1197 header->_vertexId = model._isImport && model._linker._forceDirectAssets[0]
1198 ? (short) -1
1199 : (short) (_elementIndices[0] >= 0 ? _elementIndices[0] : -1);
1200 header->_normalId = model._isImport && model._linker._forceDirectAssets[1]
1201 ? (short) -1
1202 : (short) (_elementIndices[1] >= 0 ? _elementIndices[1] : -1);
1203 for (int i = 2; i < 4; i++)
1204 {
1205 *(bshort*) &header->_colorIds[i - 2] = model._isImport && model._linker._forceDirectAssets[i]
1206 ? (short) -1
1207 : (short) (_elementIndices[i] >= 0 ? _elementIndices[i] : -1);
1208 }
1209
1210 for (int i = 4; i < 12; i++)
1211 {
1212 *(bshort*) &header->_uids[i - 4] = model._isImport && model._linker._forceDirectAssets[i]
1213 ? (short) -1
1214 : (short) (_elementIndices[i] >= 0 ? _elementIndices[i] : -1);
1215 }
1216
1217 //Write def list
1218 MDL0PolygonDefs* Defs = header->DefList;
1219 *Defs = MDL0PolygonDefs.Default;
1220
1221 //Array flags are already set
1223
1224 //Set vertex flags using descriptor list (sets the flags to this object)
1225 _manager.WriteVertexDescriptor(out _vertexFormat, out _vertexSpecs);
1226
1227 //Set UVAT groups using format list (writes directly to header)
1229
1230 //Write newly set flags
1231 header->_vertexFormat._lo = Defs->VtxFmtLo = _vertexFormat._lo;
1232 header->_vertexFormat._hi = Defs->VtxFmtHi = _vertexFormat._hi;
1233 header->_vertexSpecs = Defs->VtxSpecs = _vertexSpecs;
1234
1235 //Write weight table only if the object is weighted
1236 if (_matrixNode == null)
1237 {
1238 WriteWeightTable(header->WeightIndices(model._version));
1239 }
1240
1241 //Write primitives
1242 _manager.WritePrimitives(header, model._linker.NodeCache);
1243
1244 _manager.AssetsChanged = false;
1245 }
1246 else
1247 {
1248 //Move raw data over
1249 base.OnRebuild(address, length, force);
1250
1251 CorrectNodeIds(header);
1252
1253 header->_vertexId = _elementIndices[0];
1254 header->_normalId = _elementIndices[1];
1255 for (int i = 2; i < 4; i++)
1256 {
1257 *(bshort*) &header->_colorIds[i - 2] = (short) (_elementIndices[i] >= 0 ? _elementIndices[i] : -1);
1258 }
1259
1260 for (int i = 4; i < 12; i++)
1261 {
1262 *(bshort*) &header->_uids[i - 4] = (short) (_elementIndices[i] >= 0 ? _elementIndices[i] : -1);
1263 }
1264
1265 if (model._version >= 10)
1266 {
1267 *(bshort*) ((byte*) header + 0x60) = _elementIndices[12];
1268 *(bshort*) ((byte*) header + 0x62) = _elementIndices[13];
1269 }
1270 }
1271
1272 _forceRebuild = _reOptimized = false;
1273 }
XFArrayFlags _arrayFlags
Definition: PrimitiveManager.cs:105
int _primitiveSize
Definition: PrimitiveManager.cs:102
void WriteVertexFormat(MDL0Object *polygon)
Definition: PrimitiveManager.cs:1539
void WriteVertexDescriptor(out CPVertexFormat vertexFormat, out XFVertexSpecs vertexSpecs)
This sets up how to read the facepoints that are going to be written.
Definition: PrimitiveManager.cs:1326
MDL0PolygonDefs * DefList
Definition: MDL0.cs:1925
XFArrayFlags _arrayFlags
Definition: MDL0.cs:1881
bint _nodeTableOffset
Definition: MDL0.cs:1908
Definition: MDL0.cs:1950
static readonly MDL0PolygonDefs Default
Definition: MDL0.cs:1974
XFVertexSpecs VtxSpecs
Definition: MDL0.cs:1963
buint VtxFmtLo
Definition: MDL0.cs:1955
buint VtxFmtHi
Definition: MDL0.cs:1957
bint _size
Definition: MDL0.cs:1839
buint _hi
Definition: CP.cs:58
buint _lo
Definition: CP.cs:58

◆ PreRender()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.PreRender ( ModelPanelViewport  v)
inline

Implements BrawlLib.OpenGL.IRenderedObject.

1699 {
1700 Model?.PreRender(v);
1701 }
void PreRender(ModelPanelViewport v)
Definition: MDL0Node.cs:3041

◆ RecalcIndices()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.RecalcIndices ( )
inline
954 {
955 _elementIndices[0] = (short) (_vertexNode != null ? _vertexNode.Index : _elementIndices[0]);
956 _elementIndices[1] = (short) (_normalNode != null ? _normalNode.Index : _elementIndices[1]);
957 for (int i = 2; i < 4; i++)
958 {
959 _elementIndices[i] = (short) (_colorSet[i - 2] != null ? _colorSet[i - 2].Index : _elementIndices[i]);
960 }
961
962 for (int i = 4; i < 12; i++)
963 {
964 _elementIndices[i] = (short) (_uvSet[i - 4] != null ? _uvSet[i - 4].Index : _elementIndices[i]);
965 }
966
967 _elementIndices[12] = (short) (_furVecNode != null ? _furVecNode.Index : _elementIndices[0]);
968 _elementIndices[13] = (short) (_furPosNode != null ? _furPosNode.Index : _elementIndices[1]);
969 }

◆ Refresh()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Refresh ( )
inline

Implements BrawlLib.OpenGL.IRenderedObject.

1694 {
1695 Model?.Refresh();
1696 }
void Refresh()
Definition: MDL0Node.cs:3027

◆ Remove() [1/3]

override void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Remove ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1951 {
1952 int j = 0;
1953 foreach (DrawCall dc in _drawCalls)
1954 {
1955 ++j;
1956 if (dc.MaterialNode._objects.Count == 1 &&
1957 MessageBox.Show(
1958 $"Do you want to remove this object's material{(_drawCalls.Count > 1 ? " " + j : "")}?",
1959 "", MessageBoxButtons.YesNo) == DialogResult.Yes)
1960 {
1961 dc.MaterialNode.Remove();
1962 }
1963 }
1964
1965 Remove(
1966 _vertexNode != null && _vertexNode._objects.Count == 1 &&
1967 MessageBox.Show("Do you want to remove this object's vertex node?", "", MessageBoxButtons.YesNo) ==
1968 DialogResult.Yes,
1969 _normalNode != null && _normalNode._objects.Count == 1 &&
1970 MessageBox.Show("Do you want to remove this object's normal node?", "", MessageBoxButtons.YesNo) ==
1971 DialogResult.Yes,
1972 _colorSet[0] != null && _colorSet[0]._objects.Count == 1 &&
1973 MessageBox.Show("Do you want to remove this object's color node 1?", "", MessageBoxButtons.YesNo) ==
1974 DialogResult.Yes,
1975 _colorSet[1] != null && _colorSet[1]._objects.Count == 1 &&
1976 MessageBox.Show("Do you want to remove this object's color node 2?", "", MessageBoxButtons.YesNo) ==
1977 DialogResult.Yes,
1978 _uvSet[0] != null && _uvSet[0]._objects.Count == 1 &&
1979 MessageBox.Show("Do you want to remove this object's uv node 1?", "", MessageBoxButtons.YesNo) ==
1980 DialogResult.Yes,
1981 _uvSet[1] != null && _uvSet[1]._objects.Count == 1 &&
1982 MessageBox.Show("Do you want to remove this object's uv node 2?", "", MessageBoxButtons.YesNo) ==
1983 DialogResult.Yes,
1984 _uvSet[2] != null && _uvSet[2]._objects.Count == 1 &&
1985 MessageBox.Show("Do you want to remove this object's uv node 3?", "", MessageBoxButtons.YesNo) ==
1986 DialogResult.Yes,
1987 _uvSet[3] != null && _uvSet[3]._objects.Count == 1 &&
1988 MessageBox.Show("Do you want to remove this object's uv node 4?", "", MessageBoxButtons.YesNo) ==
1989 DialogResult.Yes,
1990 _uvSet[4] != null && _uvSet[4]._objects.Count == 1 &&
1991 MessageBox.Show("Do you want to remove this object's uv node 5?", "", MessageBoxButtons.YesNo) ==
1992 DialogResult.Yes,
1993 _uvSet[5] != null && _uvSet[5]._objects.Count == 1 &&
1994 MessageBox.Show("Do you want to remove this object's uv node 6?", "", MessageBoxButtons.YesNo) ==
1995 DialogResult.Yes,
1996 _uvSet[6] != null && _uvSet[6]._objects.Count == 1 &&
1997 MessageBox.Show("Do you want to remove this object's uv node 7?", "", MessageBoxButtons.YesNo) ==
1998 DialogResult.Yes,
1999 _uvSet[7] != null && _uvSet[7]._objects.Count == 1 &&
2000 MessageBox.Show("Do you want to remove this object's uv node 8?", "", MessageBoxButtons.YesNo) ==
2001 DialogResult.Yes);
2002 }
List< MDL0ObjectNode > _objects
Definition: MDL0ColorNode.cs:17
List< MDL0ObjectNode > _objects
Definition: MDL0NormalNode.cs:16
override void Remove()
Definition: MDL0ObjectNode.cs:1950
List< MDL0ObjectNode > _objects
Definition: MDL0UVNode.cs:14
List< MDL0ObjectNode > _objects
Definition: MDL0VertexNode.cs:15

◆ Remove() [2/3]

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Remove ( bool  removeAttached)
inline
2005 {
2006 int j = 0;
2007 foreach (DrawCall dc in _drawCalls)
2008 {
2009 ++j;
2010 if (dc.MaterialNode._objects.Count == 1 && removeAttached)
2011 {
2012 dc.MaterialNode.Remove();
2013 }
2014 }
2015
2016 Remove(removeAttached, removeAttached, removeAttached, removeAttached, removeAttached, removeAttached,
2017 removeAttached, removeAttached, removeAttached, removeAttached, removeAttached, removeAttached);
2018 }

◆ Remove() [3/3]

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Remove ( bool  v,
bool  n,
bool  c1,
bool  c2,
params bool[]  uv 
)
inline
1868 {
1869 Deleting = true;
1870 MDL0Node node = Model;
1871
1872 if (node == null)
1873 {
1874 base.Remove();
1875 return;
1876 }
1877
1878 for (int i = 0; i < 2; i++)
1879 {
1880 if (_colorSet[i] != null)
1881 {
1882 _colorSet[i]._objects.Remove(this);
1883 if (_colorSet[i]._objects.Count == 0 && (i == 0 ? c1 : c2))
1884 {
1885 _colorSet[i].Remove();
1886 }
1887 }
1888 }
1889
1890 for (int i = 0; i < 8; i++)
1891 {
1892 if (_uvSet[i] != null)
1893 {
1894 _uvSet[i]._objects.Remove(this);
1895 if (_uvSet[i]._objects.Count == 0 && uv[i])
1896 {
1897 _uvSet[i].Remove();
1898 }
1899 }
1900 }
1901
1902 if (_vertexNode != null)
1903 {
1904 if (_vertexNode._objects.Count == 1 && v)
1905 {
1907 }
1908 else
1909 {
1910 _vertexNode._objects.Remove(this);
1911 }
1912 }
1913
1914 if (_normalNode != null)
1915 {
1916 if (_normalNode._objects.Count == 1 && n)
1917 {
1919 }
1920 else
1921 {
1922 _normalNode._objects.Remove(this);
1923 }
1924 }
1925
1926 MatrixNode = null;
1927
1928 foreach (DrawCall c in _drawCalls)
1929 {
1930 c.VisibilityBoneNode = null;
1931 c.MaterialNode = null;
1932 }
1933
1934 _drawCalls.Clear();
1935
1936 DrawCallsChanged?.Invoke(null, null);
1937
1938 if (_manager != null)
1939 {
1940 foreach (Vertex3 vertex in _manager._vertices)
1941 {
1942 vertex.MatrixNode?.Users.Remove(vertex);
1943 }
1944 }
1945
1946 Dispose();
1947 base.Remove();
1948 }
override void Dispose()
Definition: MDL0ObjectNode.cs:712
bool Deleting
Definition: MDL0ObjectNode.cs:1865
virtual void Remove()
Definition: ResourceNode.cs:741
List< IMatrixNodeUser > Users
Definition: IMatrixNode.cs:10

◆ SetColors() [1/2]

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetColors ( int  id,
string  value 
)
inline
333 {
334 SetColors(id, value, false);
335 }
void SetColors(int id, string value)
Definition: MDL0ObjectNode.cs:332

◆ SetColors() [2/2]

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetColors ( int  id,
string  value,
bool  skipDialog 
)
inline
338 {
339 MDL0ColorNode oldNode = _colorSet[id];
340 if (string.IsNullOrEmpty(value))
341 {
342 if (oldNode != null && (skipDialog || MessageBox.Show(RootNode._mainForm,
343 "Are you sure you want to remove this reference?", "Continue?",
344 MessageBoxButtons.OKCancel) ==
345 DialogResult.OK))
346 {
347 if (oldNode._objects.Contains(this))
348 {
349 oldNode._objects.Remove(this);
350 }
351
352 _colorSet[id] = null;
353 _elementIndices[id + 2] = -1;
354 _forceRebuild = true;
355 }
356 else
357 {
358 return; //No point setting a null node to null
359 }
360 }
361 else
362 {
363 MDL0ColorNode newNode = Model.FindChild($"Colors/{value}", false) as MDL0ColorNode;
364 if (newNode != null)
365 {
366 if (oldNode != null)
367 {
368 if (newNode.NumEntries < oldNode.NumEntries)
369 {
370 if (!skipDialog && MessageBox.Show(null,
371 "This node has less colors than in the originally linked color node.\nAny colors that cannot be found will use the first color instead.\nIs this okay?",
372 "", MessageBoxButtons.YesNo) == DialogResult.No)
373 {
374 return;
375 }
376
377 _forceRebuild = true;
378 }
379
380 if (oldNode._objects.Contains(this))
381 {
382 oldNode._objects.Remove(this);
383 }
384 }
385
386 (_colorSet[id] = newNode)._objects.Add(this);
387 _elementIndices[id + 2] = (short) newNode.Index;
388 }
389 else
390 {
391 MessageBox.Show("A color node with this name was not found.");
392 return;
393 }
394 }
395
397 }
ResourceNode RootNode
Definition: ResourceNode.cs:175
Form _mainForm
Definition: ResourceNode.cs:130
ResourceNode FindChild(string path)
Definition: ResourceNode.cs:1342

◆ SetEditedAssets()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetEditedAssets ( bool  forceNewNode,
params bool[]  types 
)
inline
1769 {
1770 if (types.Length > 0 && types[0])
1771 {
1772 SetEditedVertices(forceNewNode);
1773 }
1774
1775 if (types.Length > 1 && types[1])
1776 {
1777 SetEditedNormals(forceNewNode);
1778 }
1779
1780 if (types.Length > 2 && types[2])
1781 {
1782 SetEditedColors(0, forceNewNode);
1783 }
1784
1785 if (types.Length > 3 && types[3])
1786 {
1787 SetEditedColors(1, forceNewNode);
1788 }
1789
1790 for (int i = 0; i < 8; i++)
1791 {
1792 if (types.Length > i + 4 && types[i + 4])
1793 {
1794 SetEditedUVs(i, forceNewNode);
1795 }
1796 }
1797 }
void SetEditedNormals(bool forceNewNode=false)
Definition: MDL0ObjectNode.cs:1804
void SetEditedVertices(bool forceNewNode=false)
Definition: MDL0ObjectNode.cs:1799
void SetEditedColors(int id, bool forceNewNode=false)
Definition: MDL0ObjectNode.cs:1809
void SetEditedUVs(int id, bool forceNewNode=false)
Definition: MDL0ObjectNode.cs:1814

◆ SetEditedColors()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetEditedColors ( int  id,
bool  forceNewNode = false 
)
inline
1810 {
1811 _manager.ColorsChanged(this, id, forceNewNode);
1812 }
void ColorsChanged(MDL0ObjectNode obj, int id, bool forceNewNode=false)
Definition: PrimitiveManager.cs:2426

◆ SetEditedNormals()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetEditedNormals ( bool  forceNewNode = false)
inline
1805 {
1806 _manager.NormalsChanged(this, forceNewNode);
1807 }
void NormalsChanged(MDL0ObjectNode obj, bool forceNewNode=false)
Definition: PrimitiveManager.cs:2356

◆ SetEditedUVs()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetEditedUVs ( int  id,
bool  forceNewNode = false 
)
inline
1815 {
1816 _manager.UVsChanged(this, id, forceNewNode);
1817 }
void UVsChanged(MDL0ObjectNode obj, int id, bool forceNewNode=false)
Definition: PrimitiveManager.cs:2490

◆ SetEditedVertices()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetEditedVertices ( bool  forceNewNode = false)
inline
1800 {
1801 _manager.PositionsChanged(this, forceNewNode);
1802 }
void PositionsChanged(MDL0ObjectNode obj, bool forceNewNode=false)
Definition: PrimitiveManager.cs:2283

◆ SetUVs() [1/2]

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetUVs ( int  id,
string  value 
)
inline
422 {
423 SetUVs(id, value, false);
424 }
void SetUVs(int id, string value)
Definition: MDL0ObjectNode.cs:421

◆ SetUVs() [2/2]

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SetUVs ( int  id,
string  value,
bool  skipDialog 
)
inline
427 {
428 MDL0UVNode oldNode = _uvSet[id];
429 if (string.IsNullOrEmpty(value))
430 {
431 if (oldNode != null && (skipDialog || MessageBox.Show(RootNode._mainForm,
432 "Are you sure you want to remove this reference?", "Continue?",
433 MessageBoxButtons.OKCancel) ==
434 DialogResult.OK))
435 {
436 if (oldNode._objects.Contains(this))
437 {
438 oldNode._objects.Remove(this);
439 }
440
441 _uvSet[id] = null;
442 _elementIndices[id + 4] = -1;
443 _forceRebuild = true;
444 }
445 else
446 {
447 return; //No point setting a null node to null
448 }
449 }
450 else
451 {
452 MDL0UVNode newNode = Model.FindChild($"UVs/{value}", false) as MDL0UVNode;
453 if (newNode != null)
454 {
455 if (oldNode != null)
456 {
457 if (newNode.NumEntries < oldNode.NumEntries)
458 {
459 MessageBox.Show(
460 $"Not enough UVs.\nNeeds: {oldNode.NumEntries}\nSelection: {newNode.NumEntries}");
461 return;
462 }
463
464 if (oldNode._objects.Contains(this))
465 {
466 oldNode._objects.Remove(this);
467 }
468 }
469
470 (_uvSet[id] = newNode)._objects.Add(this);
471 _elementIndices[id + 4] = (short) newNode.Index;
472 }
473 else
474 {
475 return;
476 }
477 }
478
480 }

◆ SignalPropertyChange()

override void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SignalPropertyChange ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.MDL0EntryNode.

1708 {
1709 base.SignalPropertyChange();
1710
1712 }
static void InvalidateModelPanels(IRenderedObject obj)
Definition: TKContext.cs:216

◆ SoftCopy()

MDL0ObjectNode BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SoftCopy ( )
inline
1861 {
1862 return MemberwiseClone() as MDL0ObjectNode;
1863 }

◆ TryConvertMatrixToObject()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TryConvertMatrixToObject ( )
inline
1730 {
1731 if (_matrixNode == null)
1732 {
1733 IMatrixNode mtxNode = null;
1734 bool singlebind = true;
1735
1736 int i = 0;
1737 foreach (Vertex3 v in _manager._vertices)
1738 {
1739 i++;
1740
1741 if (mtxNode == null)
1742 {
1743 mtxNode = v.MatrixNode;
1744 }
1745
1746 if (v.MatrixNode != mtxNode)
1747 {
1748 singlebind = false;
1749 break;
1750 }
1751 }
1752
1753 if (singlebind)
1754 {
1756 MatrixNode = mtxNode;
1757 }
1758 }
1759 }

◆ TryConvertMatrixToVertex()

void BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TryConvertMatrixToVertex ( )
inline
1715 {
1716 if (_matrixNode != null)
1717 {
1720 MatrixNode = null;
1721 foreach (Vertex3 v in _manager._vertices)
1722 {
1724 v.MatrixNode = m;
1725 }
1726 }
1727 }
void DeferUpdateAssets()
Definition: Vertex.cs:188

Member Data Documentation

◆ _attached

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._attached

◆ _colorSet

MDL0ColorNode [] BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._colorSet = new MDL0ColorNode[2]

◆ _defBufferSize

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._defBufferSize = 0xE0

◆ _drawCalls

BindingList<DrawCall> BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._drawCalls = new BindingList<DrawCall>()

◆ _flag

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._flag

◆ _forceRebuild

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._forceRebuild

◆ _manager

PrimitiveManager BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._manager

◆ _nodeCache

int [] BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._nodeCache

◆ _nodeId

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._nodeId

◆ _normalNode

MDL0NormalNode BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._normalNode

◆ _numFacepoints

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._numFacepoints

◆ _numFaces

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._numFaces

◆ _reOptimized

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._reOptimized

◆ _uvSet

MDL0UVNode [] BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._uvSet = new MDL0UVNode[8]

◆ _vertexNode

MDL0VertexNode BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode._vertexNode

Property Documentation

◆ Attached

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Attached
getset

Implements BrawlLib.OpenGL.IRenderedObject.

1363 {
1364 get => _attached;
1365 set => _attached = value;
1366 }

◆ ColorNode0

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.ColorNode0
getset
402 {
403 get => _colorSet[0] == null ? null : _colorSet[0]._name;
404 set => SetColors(0, value);
405 }

◆ ColorNode1

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.ColorNode1
getset
410 {
411 get => _colorSet[1] == null ? null : _colorSet[1]._name;
412 set => SetColors(1, value);
413 }

◆ Deleting

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Deleting
get
1865{ get; private set; }

◆ DrawCalls

List<DrawCallBase> BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.DrawCalls
get

◆ FaceCount

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.FaceCount
get

◆ FacepointCount

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.FacepointCount
get

◆ Flags

ObjFlag BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Flags
getset
192 {
193 get => (ObjFlag) _flag;
194 set
195 {
196 _flag = (int) value;
198 }
199 }
ObjFlag
Definition: MDL0.cs:1858

◆ FurLayerCoordNode

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.FurLayerCoordNode
getset
556 {
557 get => _furPosNode == null ? null : _furPosNode._name;
558 set
559 {
560 if (!string.IsNullOrEmpty(value))
561 {
562 MDL0FurPosNode node =
563 Model.FindChild($"FurLayerCoords/{value}", false) as MDL0FurPosNode;
564 if (node != null && _furPosNode != null && node.NumVertices >= _furPosNode.NumVertices)
565 {
566 if (_furPosNode != null && _furPosNode._objects.Contains(this))
567 {
568 _furPosNode._objects.Remove(this);
569 }
570
571 (_furPosNode = node)._objects.Add(this);
572 _elementIndices[12] = (short) node.Index;
573 }
574 }
575
577 }
578 }
short NumVertices
Definition: MDL0FurPosNode.cs:30

◆ FurVectorNode

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.FurVectorNode
getset
583 {
584 get => _furVecNode == null ? null : _furVecNode._name;
585 set
586 {
587 if (!string.IsNullOrEmpty(value))
588 {
589 MDL0FurVecNode node =
590 Model.FindChild($"FurVectors/{value}", false) as MDL0FurVecNode;
591 if (node != null && _furVecNode != null && node.NumEntries >= _furVecNode.NumEntries)
592 {
593 if (_furVecNode != null && _furVecNode._objects.Contains(this))
594 {
595 _furVecNode._objects.Remove(this);
596 }
597
598 (_furVecNode = node)._objects.Add(this);
599 _elementIndices[13] = (short) node.Index;
600 }
601 }
602
604 }
605 }
ushort NumEntries
Definition: MDL0FurVecNode.cs:21

◆ ID

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.ID
get

◆ Influences

List<IMatrixNode> BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Influences
get

◆ IsRendering

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.IsRendering
getset

Implements BrawlLib.OpenGL.IRenderedObject.

1339 {
1340 get
1341 {
1342 foreach (DrawCall c in _drawCalls)
1343 {
1344 if (c._render)
1345 {
1346 return true;
1347 }
1348 }
1349
1350 return false;
1351 }
1352 set
1353 {
1354 foreach (DrawCall c in _drawCalls)
1355 {
1356 c._render = value;
1357 }
1358 }
1359 }

◆ MatrixNode

IMatrixNode BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.MatrixNode
getset

Implements BrawlLib.SSBB.ResourceNodes.IMatrixNodeUser.

649 {
650 get => _matrixNode;
651 set
652 {
653 if (_matrixNode == value)
654 {
655 return;
656 }
657
658 if (_manager != null)
659 {
660 foreach (Vertex3 v in _manager._vertices)
661 {
663 v.ChangeInfluence(value);
664
665 if (v._matrixNode != null && v._matrixNode.Users.Contains(v))
666 {
667 v._matrixNode.Users.Remove(v);
668 }
669 }
670
671 if (_updateAssets)
672 {
673 SetEditedAssets(false, true, true);
674 }
675 }
676
677 if (_matrixNode != null)
678 {
679 if (_matrixNode is MDL0BoneNode && ((MDL0BoneNode) _matrixNode)._singleBindObjects.Contains(this))
680 {
681 ((MDL0BoneNode) _matrixNode)._singleBindObjects.Remove(this);
682 }
683 else if (_matrixNode.Users.Contains(this))
684 {
685 _matrixNode.Users.Remove(this);
686 }
687 }
688
689 if ((_matrixNode = value) != null)
690 {
691 //Singlebind bones aren't added to NodeMix, but its node id is still built as influenced
692 if (_matrixNode is MDL0BoneNode && !((MDL0BoneNode) _matrixNode)._singleBindObjects.Contains(this))
693 {
694 ((MDL0BoneNode) _matrixNode)._singleBindObjects.Add(this);
695 }
696 else if (!_matrixNode.Users.Contains(this))
697 {
698 _matrixNode.Users.Add(this);
699 }
700 }
701
702 _updateAssets = true;
703 }
704 }
void ChangeInfluence(IMatrixNode newMatrixNode)
Definition: Vertex.cs:108
void SetEditedAssets(bool forceNewNode, params bool[] types)
Definition: MDL0ObjectNode.cs:1768

◆ NormalNode

string?? BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.NormalNode
getset
266 {
267 get => _normalNode == null ? null : _normalNode._name;
268 set
269 {
270 MDL0NormalNode oldNode = _normalNode;
271 if (string.IsNullOrEmpty(value))
272 {
273 if (oldNode != null && MessageBox.Show(RootNode._mainForm,
274 "Are you sure you want to remove this reference?", "Continue?",
275 MessageBoxButtons.OKCancel) == DialogResult.OK)
276 {
277 if (oldNode._objects.Contains(this))
278 {
279 oldNode._objects.Remove(this);
280 }
281
282 _normalNode = null;
283 _elementIndices[1] = -1;
284 _forceRebuild = true;
285 }
286 else
287 {
288 return; //No point setting a null node to null
289 }
290 }
291 else
292 {
293 MDL0NormalNode newNode =
294 Model.FindChild($"Normals/{value}", false) as MDL0NormalNode;
295 if (newNode != null)
296 {
297 if (_normalNode != null)
298 {
299 if (newNode.NumEntries < _normalNode.NumEntries)
300 {
301 MessageBox.Show(
302 $"Not enough normals.\nNeeds: {_normalNode.NumEntries}\nSelection: {newNode.NumEntries}");
303 return;
304 }
305
306 if (_normalNode._objects.Contains(this))
307 {
308 _normalNode._objects.Remove(this);
309 }
310 }
311
312 (_normalNode = newNode)._objects.Add(this);
313 _elementIndices[1] = (short) newNode.Index;
314 }
315 else
316 {
317 MessageBox.Show("A normal node with this name was not found.");
318 return;
319 }
320 }
321
323 }
324 }
int NumEntries
Definition: MDL0NormalNode.cs:31

◆ ResourceFileType

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

◆ SingleBind

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.SingleBind
getset
635 {
636 get => _matrixNode == null ? "(none)" :
637 _matrixNode.IsPrimaryNode ? ((MDL0BoneNode) _matrixNode)._name : "(multiple)";
638 set
639 {
640 MatrixNode = string.IsNullOrEmpty(value) ? null : Model.FindBone(value);
642 }
643 }
MDL0BoneNode FindBone(string name)
Definition: MDL0Node.cs:752
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313

◆ TexCoord0

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TexCoord0
getset
485 {
486 get => _uvSet[0] == null ? null : _uvSet[0]._name;
487 set => SetUVs(0, value);
488 }

◆ TexCoord1

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TexCoord1
getset
493 {
494 get => _uvSet[1] == null ? null : _uvSet[1]._name;
495 set => SetUVs(1, value);
496 }

◆ TexCoord2

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TexCoord2
getset
501 {
502 get => _uvSet[2] == null ? null : _uvSet[2]._name;
503 set => SetUVs(2, value);
504 }

◆ TexCoord3

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TexCoord3
getset
509 {
510 get => _uvSet[3] == null ? null : _uvSet[3]._name;
511 set => SetUVs(3, value);
512 }

◆ TexCoord4

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TexCoord4
getset
517 {
518 get => _uvSet[4] == null ? null : _uvSet[4]._name;
519 set => SetUVs(4, value);
520 }

◆ TexCoord5

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TexCoord5
getset
525 {
526 get => _uvSet[5] == null ? null : _uvSet[5]._name;
527 set => SetUVs(5, value);
528 }

◆ TexCoord6

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TexCoord6
getset
533 {
534 get => _uvSet[6] == null ? null : _uvSet[6]._name;
535 set => SetUVs(6, value);
536 }

◆ TexCoord7

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TexCoord7
getset
541 {
542 get => _uvSet[7] == null ? null : _uvSet[7]._name;
543 set => SetUVs(7, value);
544 }

◆ TextureMatrix0Enabled

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix0Enabled
getset
56 {
57 get => _manager != null && _manager.HasTextureMatrix[0];
58 set => SetTexMtx(0, value);
59 }

◆ TextureMatrix0Identity

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix0Identity
getset
112 {
113 get => _manager != null && _manager.UseIdentityTexMtx[0];
114 set => SetTexMtxIdentity(0, value);
115 }
bool[] UseIdentityTexMtx
Definition: PrimitiveManager.cs:97

◆ TextureMatrix1Enabled

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix1Enabled
getset
63 {
64 get => _manager != null && _manager.HasTextureMatrix[1];
65 set => SetTexMtx(1, value);
66 }

◆ TextureMatrix1Identity

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix1Identity
getset
119 {
120 get => _manager != null && _manager.UseIdentityTexMtx[1];
121 set => SetTexMtxIdentity(1, value);
122 }

◆ TextureMatrix2Enabled

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix2Enabled
getset
70 {
71 get => _manager != null && _manager.HasTextureMatrix[2];
72 set => SetTexMtx(2, value);
73 }

◆ TextureMatrix2Identity

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix2Identity
getset
126 {
127 get => _manager != null && _manager.UseIdentityTexMtx[2];
128 set => SetTexMtxIdentity(2, value);
129 }

◆ TextureMatrix3Enabled

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix3Enabled
getset
77 {
78 get => _manager != null && _manager.HasTextureMatrix[3];
79 set => SetTexMtx(3, value);
80 }

◆ TextureMatrix3Identity

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix3Identity
getset
133 {
134 get => _manager != null && _manager.UseIdentityTexMtx[3];
135 set => SetTexMtxIdentity(3, value);
136 }

◆ TextureMatrix4Enabled

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix4Enabled
getset
84 {
85 get => _manager != null && _manager.HasTextureMatrix[4];
86 set => SetTexMtx(4, value);
87 }

◆ TextureMatrix4Identity

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix4Identity
getset
140 {
141 get => _manager != null && _manager.UseIdentityTexMtx[4];
142 set => SetTexMtxIdentity(4, value);
143 }

◆ TextureMatrix5Enabled

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix5Enabled
getset
91 {
92 get => _manager != null && _manager.HasTextureMatrix[5];
93 set => SetTexMtx(5, value);
94 }

◆ TextureMatrix5Identity

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix5Identity
getset
147 {
148 get => _manager != null && _manager.UseIdentityTexMtx[5];
149 set => SetTexMtxIdentity(5, value);
150 }

◆ TextureMatrix6Enabled

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix6Enabled
getset
98 {
99 get => _manager != null && _manager.HasTextureMatrix[6];
100 set => SetTexMtx(6, value);
101 }

◆ TextureMatrix6Identity

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix6Identity
getset
154 {
155 get => _manager != null && _manager.UseIdentityTexMtx[6];
156 set => SetTexMtxIdentity(6, value);
157 }

◆ TextureMatrix7Enabled

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix7Enabled
getset
105 {
106 get => _manager != null && _manager.HasTextureMatrix[7];
107 set => SetTexMtx(7, value);
108 }

◆ TextureMatrix7Identity

bool BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.TextureMatrix7Identity
getset
161 {
162 get => _manager != null && _manager.UseIdentityTexMtx[7];
163 set => SetTexMtxIdentity(7, value);
164 }

◆ VertexCount

int BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.VertexCount
get

◆ VertexNode

string BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.VertexNode
getset
222 {
223 get => _vertexNode == null ? null : _vertexNode._name;
224 set
225 {
226 //Can't remove the vertex node!
227 //Do nothing if attempting to set to null
228 if (!string.IsNullOrEmpty(value))
229 {
230 MDL0VertexNode newNode =
231 Model.FindChild($"Vertices/{value}", false) as MDL0VertexNode;
232 if (newNode != null)
233 {
234 if (_vertexNode != null)
235 {
236 if (newNode.NumVertices < _vertexNode.NumVertices)
237 {
238 MessageBox.Show(
239 $"Not enough vertices.\nNeeds: {_vertexNode.NumVertices}\nSelection: {newNode.NumVertices}");
240 return;
241 }
242
243 if (_vertexNode._objects.Contains(this))
244 {
245 _vertexNode._objects.Remove(this);
246 }
247 }
248
249 (_vertexNode = newNode)._objects.Add(this);
250 _elementIndices[0] = (short) newNode.Index;
251 }
252 else
253 {
254 MessageBox.Show("A vertex node with this name was not found.");
255 return;
256 }
257 }
258
260 }
261 }
ushort NumVertices
Definition: MDL0VertexNode.cs:23

◆ Vertices

List<Vertex3> BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.Vertices
get

Event Documentation

◆ DrawCallsChanged

EventHandler BrawlLib.SSBB.ResourceNodes.MDL0ObjectNode.DrawCallsChanged

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