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

Public Member Functions

void MakeSolid (RGBAPixel 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)
 
Vector4 GetAmbientColorFrame (float index)
 
override bool OnInitialize ()
 
override int OnCalculateSize (bool force)
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode
override bool OnInitialize ()
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
IColorSource FindColorMatch (bool constant, int frameCount, int id)
 
int WriteColors (ref int flags, int bit, RGBAPixel solidColor, List< RGBAPixel > colors, bool constant, int frameCount, VoidPtr valueAddr, ref VoidPtr thisMatchAddr, VoidPtr thatMatchAddr, RGBAPixel *dataAddr)
 
void DecodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, int flags, int fixedBit)
 Reads keyframes from an address and sets them in the keyframe array provided. More...
 
- 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 = true
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode
int[] _dataLengths = {0, 0, 0}
 
VoidPtr[] _dataAddrs = new VoidPtr[3]
 
- 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 ColorEnabled [get, set]
 
bool AlphaEnabled [get, set]
 
bool Constant [get, set]
 
List< RGBAPixelColors [get, set]
 
RGBAPixel SolidColor [get, set]
 
int TypeCount [get]
 
int FrameCount [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode
override bool AllowNullNames [get]
 
SCN0Node Scene [get]
 
int NodeIndex [get]
 
int RealIndex [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.SCN0EntryNode
static void DecodeKeyframes (KeyframeArray kf, VoidPtr dataAddr)
 Reads keyframes at an address, starting with the keyframe array header. More...
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, VoidPtr offset, ref int flags, int fixedBit)
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, VoidPtr offset)
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr)
 
- 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.SCN0EntryNode
void ReadColors (uint flags, uint bit, ref RGBAPixel solidColor, ref List< RGBAPixel > colors, int frameCount, VoidPtr address, ref bool constant, ref int numEntries)
 
void CalcKeyLen (KeyframeArray keyframes)
 
- 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.SCN0AmbientLightNode.ColorCount ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

176 {
177 return _numEntries == 0 ? 1 : _numEntries;
178 }

◆ GetAmbientColorFrame()

Vector4 BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.GetAmbientColorFrame ( float  index)
inline
212 {
213 if (Constant)
214 {
215 return _solidColor;
216 }
217
218 int colorIndex = (int) Math.Truncate(index);
219 Vector4 color = _colors[colorIndex.Clamp(0, _colors.Count - 1)];
220 if (colorIndex + 1 < _colors.Count)
221 {
222 float frac = index - colorIndex;
223 Vector4 interp = _colors[colorIndex + 1];
224 color += (interp - color) * frac;
225 }
226
227 return color;
228 }
bool Constant
Definition: SCN0AmbientLightNode.cs:59
Definition: Vector4.cs:12

◆ GetColor()

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

Implements BrawlLib.Imaging.IColorSource.

181 {
182 return _numEntries == 0 ? (ARGBPixel) _solidColor : (ARGBPixel) _colors[index];
183 }
Definition: PixelTypes.cs:16

◆ GetColorConstant()

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

Implements BrawlLib.Imaging.IColorSource.

200 {
201 return Constant;
202 }

◆ GetPrimaryColor()

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

Implements BrawlLib.Imaging.IColorSource.

158 {
159 return new ARGBPixel();
160 }

◆ HasPrimary()

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

Implements BrawlLib.Imaging.IColorSource.

153 {
154 return false;
155 }

◆ MakeList()

void BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.MakeList ( )
inline
143 {
144 _constant = false;
145 int entries = Scene.FrameCount;
146 _numEntries = _colors.Count;
147 NumEntries = entries;
148 }
bool _constant
Definition: SCN0AmbientLightNode.cs:55
SCN0Node Scene
Definition: SCN0GroupNode.cs:242
override int FrameCount
Definition: SCN0Node.cs:72

◆ MakeSolid()

void BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.MakeSolid ( RGBAPixel  color)
inline
135 {
136 _numEntries = 0;
137 _constant = true;
138 _solidColor = color;
140 }
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313

◆ OnCalculateSize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

276 {
277 for (int i = 0; i < 3; i++)
278 {
279 _dataLengths[i] = 0;
280 }
281
282 _match = null;
283
284 if (_name == "<null>")
285 {
286 return SCN0AmbientLight.Size;
287 }
288
289 _match = FindColorMatch(_constant, FrameCount, 0) as SCN0AmbientLightNode;
290 if (_match == null && !_constant)
291 {
292 _dataLengths[1] += 4 * (FrameCount + 1);
293 }
294
295 if (_constant)
296 {
297 _fixedFlags |= 0x80;
298 }
299 else
300 {
301 _fixedFlags &= 0x7F;
302 }
303
304 return SCN0AmbientLight.Size;
305 }
string _name
Definition: ResourceNode.cs:139
int FrameCount
Definition: SCN0AmbientLightNode.cs:230
int[] _dataLengths
Definition: SCN0GroupNode.cs:256
IColorSource FindColorMatch(bool constant, int frameCount, int id)
Definition: SCN0GroupNode.cs:314
const int Size
Definition: SCN0.cs:324

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

243 {
244 //Read common header
245 base.OnInitialize();
246
247 //Set defaults
248 _colors = new List<RGBAPixel>();
249
250 //Read header values
251 _fixedFlags = Data->_fixedFlags;
252 _usageFlags = Data->_flags;
253
254 if (_name == "<null>")
255 {
256 return false;
257 }
258
259 //Read ambient light color
261 _fixedFlags,
262 1 << 7,
263 ref _solidColor,
264 ref _colors,
266 Data->_lighting.Address,
267 ref _constant,
268 ref _numEntries);
269
270 return false;
271 }
void ReadColors(uint flags, uint bit, ref RGBAPixel solidColor, ref List< RGBAPixel > colors, int frameCount, VoidPtr address, ref bool constant, ref int numEntries)
Definition: SCN0GroupNode.cs:396
VoidPtr Address
Definition: PixelTypes.cs:538
byte _flags
Definition: SCN0.cs:331
byte _fixedFlags
Definition: SCN0.cs:328
RGBAPixel _lighting
Definition: SCN0.cs:333

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

310 {
311 base.OnRebuild(address, length, force);
312
313 _matchAddr = null;
314
315 SCN0AmbientLight* header = (SCN0AmbientLight*) address;
316
317 header->_pad1 = 0;
318 header->_pad2 = 0;
319
320 if (_name == "<null>")
321 {
322 return;
323 }
324
325 int flags = _fixedFlags;
327 ref flags,
328 0x80,
329 _solidColor,
330 _colors,
331 _constant,
333 header->_lighting.Address,
334 ref _matchAddr,
335 _match == null ? null : _match._matchAddr,
336 (RGBAPixel*) _dataAddrs[1]);
337
338 header->_fixedFlags = (byte) flags;
339 header->_flags = _usageFlags;
340 }
int WriteColors(ref int flags, int bit, RGBAPixel solidColor, List< RGBAPixel > colors, bool constant, int frameCount, VoidPtr valueAddr, ref VoidPtr thisMatchAddr, VoidPtr thatMatchAddr, RGBAPixel *dataAddr)
Definition: SCN0GroupNode.cs:353
VoidPtr[] _dataAddrs
Definition: SCN0GroupNode.cs:257
Definition: PixelTypes.cs:327
byte _pad2
Definition: SCN0.cs:330
byte _pad1
Definition: SCN0.cs:329

◆ PrimaryColorName()

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

Implements BrawlLib.Imaging.IColorSource.

168 {
169 return null;
170 }

◆ SetColor()

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

Implements BrawlLib.Imaging.IColorSource.

186 {
187 if (_numEntries == 0)
188 {
189 _solidColor = color;
190 }
191 else
192 {
193 _colors[index] = color;
194 }
195
197 }

◆ SetColorConstant()

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

Implements BrawlLib.Imaging.IColorSource.

205 {
206 Constant = constant;
207 }

◆ SetPrimaryColor()

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

Implements BrawlLib.Imaging.IColorSource.

163 {
164 }

Member Data Documentation

◆ _constant

bool BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode._constant = true

Property Documentation

◆ AlphaEnabled

bool BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.AlphaEnabled
getset
38 {
39 get => (_usageFlags & 2) != 0;
40 set
41 {
42 if (value)
43 {
44 _usageFlags |= 2;
45 }
46 else
47 {
48 _usageFlags &= 1;
49 }
50
52 }
53 }

◆ ColorEnabled

bool BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.ColorEnabled
getset
19 {
20 get => (_usageFlags & 1) != 0;
21 set
22 {
23 if (value)
24 {
25 _usageFlags |= 1;
26 }
27 else
28 {
29 _usageFlags &= 2;
30 }
31
33 }
34 }

◆ Colors

List<RGBAPixel> BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.Colors
getset
84 {
85 get => _colors;
86 set
87 {
88 _colors = value;
90 }
91 }

◆ Constant

bool BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.Constant
getset
59 {
60 get => _constant;
61 set
62 {
63 if (_constant != value)
64 {
65 _constant = value;
66 if (_constant)
67 {
68 MakeSolid(new RGBAPixel());
69 }
70 else
71 {
72 MakeList();
73 }
74
76 }
77 }
78 }
void UpdateCurrentControl()
Definition: ResourceNode.cs:482
void MakeList()
Definition: SCN0AmbientLightNode.cs:142
void MakeSolid(RGBAPixel color)
Definition: SCN0AmbientLightNode.cs:134

◆ FrameCount

int BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.FrameCount
get

◆ ResourceFileType

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

◆ SolidColor

RGBAPixel BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.SolidColor
getset
97 {
98 get => _solidColor;
99 set
100 {
101 _solidColor = value;
103 }
104 }

◆ TypeCount

int BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode.TypeCount
get

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