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

Public Member Functions

override bool OnInitialize ()
 
override void Export (string outPath)
 
void MakeSolid (ARGBPixel color)
 
void MakeList ()
 
bool HasPrimary (int id)
 
ARGBPixel GetPrimaryColor (int id)
 
void SetPrimaryColor (int id, ARGBPixel color)
 
string PrimaryColorName (int id)
 
int ColorCount (int id)
 
ARGBPixel GetColor (int index, int id)
 
void SetColor (int index, int id, ARGBPixel color)
 
bool GetColorConstant (int id)
 
void SetColorConstant (int id, bool constant)
 
- 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 ()
 
bool HasPrimary (int id)
 
ARGBPixel GetPrimaryColor (int id)
 
void SetPrimaryColor (int id, ARGBPixel color)
 
string PrimaryColorName (int id)
 
int ColorCount (int id)
 
ARGBPixel GetColor (int index, int id)
 
void SetColor (int index, int id, ARGBPixel color)
 
bool GetColorConstant (int id)
 
void SetColorConstant (int id, bool constant)
 

Public Attributes

bool _constant
 
- 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]
 
bool Constant [get, set]
 
EntryTarget Target [get, set]
 
ARGBPixel ColorMask [get, set]
 
List< ARGBPixelColors [get, set]
 
ARGBPixel SolidColor [get, set]
 
int TypeCount [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.IColorSource
int TypeCount [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
 

Member Function Documentation

◆ ColorCount()

int BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.ColorCount ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

657 {
658 return _numEntries == 0 ? 1 : _numEntries;
659 }

◆ Export()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

583 {
584 int length = 12 + (_numEntries != 0 ? _colors.Count * 4 : 4);
585 using (FileStream stream = new FileStream(outPath, FileMode.OpenOrCreate, FileAccess.ReadWrite,
586 FileShare.None, 8, FileOptions.RandomAccess))
587 {
588 stream.SetLength(length);
589 using (FileMap map = FileMap.FromStream(stream))
590 {
591 CLR0MaterialEntry* entry = (CLR0MaterialEntry*) map.Address;
592
593 entry->_colorMask = _colorMask;
594 entry->_data = 8;
595 *((bint*) entry + 2) = _numEntries;
596
597 RGBAPixel* pData = entry->Data;
598 if (_numEntries != 0)
599 {
600 foreach (ARGBPixel p in _colors)
601 {
602 *pData++ = p;
603 }
604 }
605 else
606 {
607 *pData = _solidColor;
608 }
609 }
610 }
611 }
Definition: FileMap.cs:10
static FileMap FromStream(FileStream stream)
Definition: FileMap.cs:117
VoidPtr Address
Definition: FileMap.cs:16
Definition: PixelTypes.cs:16
Definition: PixelTypes.cs:327
Definition: BigEndianTypes.cs:9

◆ GetColor()

ARGBPixel BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.GetColor ( int  index,
int  id 
)
inline

Implements BrawlLib.Imaging.IColorSource.

662 {
663 return _numEntries == 0 ? _solidColor : _colors[index];
664 }

◆ GetColorConstant()

bool BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.GetColorConstant ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

681 {
682 return Constant;
683 }
bool Constant
Definition: CLR0Node.cs:421

◆ GetPrimaryColor()

ARGBPixel BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.GetPrimaryColor ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

637 {
638 return _colorMask;
639 }

◆ HasPrimary()

bool BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.HasPrimary ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

632 {
633 return true;
634 }

◆ MakeList()

void BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.MakeList ( )
inline
622 {
623 _constant = false;
624 int entries = ((CLR0Node) Parent._parent)._numFrames;
625 _numEntries = _colors.Count;
626 NumEntries = entries;
627 }
bool _constant
Definition: CLR0Node.cs:417
ResourceNode _parent
Definition: ResourceNode.cs:142
ResourceNode Parent
Definition: ResourceNode.cs:245

◆ MakeSolid()

void BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.MakeSolid ( ARGBPixel  color)
inline
614 {
615 _numEntries = 0;
616 _constant = true;
617 _solidColor = color;
619 }
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

534 {
535 _colors.Clear();
536
537 _colorMask = Header->_colorMask;
538
539 if (_replaced && WorkingUncompressed.Length >= 16 && Header->_data == 8)
540 {
541 _numEntries = *((bint*) Header + 2);
542 _constant = _numEntries == 0;
543 RGBAPixel* data = Header->Data;
544 if (_constant)
545 {
546 _solidColor = *data;
547 }
548 else
549 {
550 int frameCount = ((CLR0Node) Parent.Parent)._numFrames;
551 for (int i = 0; i < frameCount; i++)
552 {
553 _colors.Add(i >= _numEntries ? new ARGBPixel() : (ARGBPixel) (*data++));
554 }
555
556 _numEntries = frameCount;
557 }
558 }
559 else
560 {
561 if (_constant)
562 {
563 _numEntries = 0;
564 _solidColor = Header->SolidColor;
565 }
566 else
567 {
568 _numEntries = ((CLR0Node) Parent.Parent)._numFrames;
569 RGBAPixel* data = Header->Data;
570 for (int i = 0; i < _numEntries; i++)
571 {
572 _colors.Add(*data++);
573 }
574 }
575 }
576
577 _name = _target.ToString();
578
579 return false;
580 }
bool _replaced
Definition: ResourceNode.cs:827
string _name
Definition: ResourceNode.cs:139
DataSource WorkingUncompressed
Definition: ResourceNode.cs:183
int Length
Definition: ResourceNode.cs:32

◆ PrimaryColorName()

string BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.PrimaryColorName ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

649 {
650 return "Mask:";
651 }

◆ SetColor()

void BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.SetColor ( int  index,
int  id,
ARGBPixel  color 
)
inline

Implements BrawlLib.Imaging.IColorSource.

667 {
668 if (_numEntries == 0)
669 {
670 _solidColor = color;
671 }
672 else
673 {
674 _colors[index] = color;
675 }
676
678 }

◆ SetColorConstant()

void BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.SetColorConstant ( int  id,
bool  constant 
)
inline

Implements BrawlLib.Imaging.IColorSource.

686 {
687 Constant = constant;
688 }

◆ SetPrimaryColor()

void BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.SetPrimaryColor ( int  id,
ARGBPixel  color 
)
inline

Implements BrawlLib.Imaging.IColorSource.

642 {
643 _colorMask = color;
645 }

Member Data Documentation

◆ _constant

bool BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode._constant

Property Documentation

◆ ColorMask

ARGBPixel BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.ColorMask
getset
468 {
469 get => _colorMask;
470 set
471 {
472 _colorMask = value;
474 }
475 }

◆ Colors

List<ARGBPixel> BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.Colors
getset
481 {
482 get => _colors;
483 set
484 {
485 _colors = value;
487 }
488 }

◆ Constant

bool BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.Constant
getset
421 {
422 get => _constant;
423 set
424 {
425 if (_constant != value)
426 {
427 _constant = value;
428 if (_constant)
429 {
430 MakeSolid(_solidColor);
431 }
432 else
433 {
434 MakeList();
435 }
436
438 }
439 }
440 }
void MakeList()
Definition: CLR0Node.cs:621
void MakeSolid(ARGBPixel color)
Definition: CLR0Node.cs:613
void UpdateCurrentControl()
Definition: ResourceNode.cs:482

◆ ResourceFileType

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

◆ SolidColor

ARGBPixel BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.SolidColor
getset
494 {
495 get => _solidColor;
496 set
497 {
498 _solidColor = value;
500 }
501 }

◆ Target

EntryTarget BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.Target
getset
446 {
447 get => _target;
448 set
449 {
450 foreach (CLR0MaterialEntryNode t in Parent.Children)
451 {
452 if (t._target == value)
453 {
454 return;
455 }
456 }
457
458 _target = value;
459 Name = _target.ToString();
461 }
462 }
virtual string Name
Definition: ResourceNode.cs:223
List< ResourceNode > Children
Definition: ResourceNode.cs:262

◆ TypeCount

int BrawlLib.SSBB.ResourceNodes.CLR0MaterialEntryNode.TypeCount
get

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