public void KeyFrameGen(int framesToGenerate, bool allowDuplicates, bool generateOrigin) { // If not in a brres, return if (_parent == null) { return; // Checks if in brres folder } if (_parent._parent == null) { return; // Checks if in brres } //Console.WriteLine("Parent is: " + _parent._parent); // Ensure models exist in a modeldata BRRESNode temp = (BRRESNode)_parent._parent; if (temp.GetFolder <MDL0Node>() == null) { //Console.WriteLine(" No MDL0 folder found"); return; } // For every model in the model folder int j = 0; //Console.WriteLine(temp.GetFolder<MDL0Node>()); foreach (MDL0Node m in temp.GetFolder <MDL0Node>().Children) { //Console.WriteLine(" " + m); // For every bone in a model MDL0BoneNode b = m.FindBoneByIndex(0); j = 0; while (b != null) { ++j; bool alreadyAdded = false; if (b != null) { //Console.WriteLine(" Bone: " + b); if (!allowDuplicates) { // Check if there's already an ID for such a bone foreach (CHR0EntryNode ch in Children) { if (ch.ToString() == b.ToString() && alreadyAdded == false) { alreadyAdded = true; //Console.WriteLine(" " + b + " has already been added to animation"); } } } // If the bone has not been added or duplicates are allowed if (!alreadyAdded) { //Console.WriteLine(" Adding keyframes for " + b); CreateEntryFromBone(b, framesToGenerate, generateOrigin); } } b = m.FindBoneByIndex(j); } } }
public void KeyFrameGenFromBone(int framesToGenerate, bool allowOverwrite, bool generateOrigin) { // If not in a brres, return if (_parent == null) { return; // Checks if in chr0 } if (_parent._parent == null) { return; // Checks if in brres folder } if (_parent._parent._parent == null) { return; // Checks if in brres } //Console.WriteLine("Parent is: " + _parent._parent._parent); // Ensure models exist in a modeldata BRRESNode temp = (BRRESNode)_parent._parent._parent; if (temp.GetFolder <MDL0Node>() == null) { //Console.WriteLine(" No MDL0 folder found"); return; } // For every model in the model folder int j = 0; //Console.WriteLine(temp.GetFolder<MDL0Node>()); foreach (MDL0Node m in temp.GetFolder <MDL0Node>().Children) { //Console.WriteLine(" " + m); // For every bone in a model MDL0BoneNode b = m.FindBone(Name); if (b == null) { //Console.WriteLine("Could not find bone " + Name + " in model " + m); } else { //Console.WriteLine("Found bone " + b + " in model " + m); for (int i = 0; i < framesToGenerate; ++i) { generateKeyframeFromBone(b, i, allowOverwrite, generateOrigin); } return; } } }
private unsafe void Load(int index, int program) { if (TKContext.CurrentContext == null) { return; } bool isStage = false; Source = null; if (Texture != null) { Texture.Delete(); } Texture = new GLTexture(); Texture.Bind(index, program); Bitmap bmp = null; if (RootNode is ARCNode) { isStage = ((ARCNode)RootNode).IsStage; } if (_folderWatcher.EnableRaisingEvents && !String.IsNullOrEmpty(_folderWatcher.Path)) { bmp = SearchDirectory(_folderWatcher.Path + Name); } BRRESNode parentBRRES = null; ARCNode parentARC = null; // Safely search for whether this is part of a BRRES if (_parent != null) { if (_parent._parent != null) { if (_parent._parent._parent != null) { if (_parent._parent._parent._parent != null) { if (_parent._parent._parent._parent is BRRESNode) { parentBRRES = (BRRESNode)_parent._parent._parent._parent; if (parentBRRES._parent != null) { if (parentBRRES._parent is ARCNode) { parentARC = (ARCNode)parentBRRES._parent; } } } } } } } List <ResourceNode> nodes = TKContext.CurrentContext._states["_Node_Refs"] as List <ResourceNode>; TEX0Node tNode = null; if (bmp == null && TKContext.CurrentContext._states.ContainsKey("_Node_Refs") && parentBRRES != null) { ResourceNode node = parentBRRES; //Search node itself first if ((tNode = node.SearchForTextures("Textures(NW4R)/" + Name, true, false) as TEX0Node) != null) { Source = tNode; Texture.Attach(tNode, _palette); return; } } if (bmp == null && TKContext.CurrentContext._states.ContainsKey("_Node_Refs") && parentARC != null) { ResourceNode node = parentARC; //Search node itself first if ((tNode = node.SearchForTextures("Textures(NW4R)/" + Name, true, isStage) as TEX0Node) != null) { Source = tNode; Texture.Attach(tNode, _palette); return; } else //Then search the directory { bmp = SearchDirectory(node._origPath); } } if (bmp != null) { Texture.Attach(bmp); } else { Texture.Default(); } }