private IEnumerable<IINode> GetChildNodesRecursive(IINode start) { for (int i = 0; i < start.NumChildren; i++) { yield return start.GetChildNode(i); foreach(var n in GetChildNodesRecursive(start.GetChildNode(i))) yield return n; } }
public static IEnumerable <IINode> Nodes(this IINode node) { for (int i = 0; i < node.NumberOfChildren; ++i) { if (node.GetChildNode(i) != null) { yield return(node.GetChildNode(i)); } } }
public static IEnumerable <IINode> DirectChildren(this IINode node) { List <IINode> children = new List <IINode>(); for (int i = 0; i < node.NumberOfChildren; ++i) { if (node.GetChildNode(i) != null) { children.Add(node.GetChildNode(i)); } } return(children); }
public static void BuildBind(IINode _node, int _parentId, Pose _pose) { DualQuaternion DQ = GetBoneBindDQ(_node); Joint _joint = new Joint(_pose.joints.Count, _node.Name, _parentId, DQ, DualQuaternion.Identity); _pose.joints.Add(_joint); int childrensNb = _node.NumberOfChildren; for (int i = 0; i < childrensNb; i++) { if (!_node.GetChildNode(i).Name.EndsWith("Nub")) { BuildBind(_node.GetChildNode(i), _joint.id, _pose); } } }
/// <summary> /// Returns all child IINode objects of provided IINode. /// </summary> /// <param name="maxNode"></param> /// <returns></returns> private static IEnumerable <IINode> Children(IINode maxNode) { for (int i = 0; i < maxNode.NumberOfChildren; i++) { yield return(maxNode.GetChildNode(i)); } }
public static void BuildLJoint(IINode _node, int _parentId, Pose _pose, int[] _frames, int _f, int _samplingRate, Pose _bindPose) { DualQuaternion LDQ = GetBoneLocalDQ(_node, _frames, _f); CurveHandle curve = GetCurve(_node, _frames, _f, _samplingRate); Joint _joint = new Joint(_pose.joints.Count, _node.Name, _parentId, DualQuaternion.Identity, LDQ, curve); _pose.joints.Add(_joint); int childrensNb = _node.NumberOfChildren; for (int i = 0; i < childrensNb; i++) { if (!_node.GetChildNode(i).Name.EndsWith("Nub")) { BuildLJoint(_node.GetChildNode(i), _joint.id, _pose, _frames, _f, _samplingRate, _bindPose); } } }
private void FillTree(IINode node) { this.AddNode(node, this.Tree.Nodes); for (int i = 0; i < node.NumberOfChildren; i++) { this.FillTree(node.GetChildNode(i)); } }
/// <summary> /// Recursively go through the scene and get all nodes /// Use the Autodesk.Max APIs to get the children nodes /// </summary> static private void GetSceneNodes(IINode node) { m_sceneNodes.Add(node); for (int i = 0; i < node.NumberOfChildren; i++) { GetSceneNodes(node.GetChildNode(i)); } }
private IEnumerable<IINode> getChildren(IINode node) { List<IINode> nodes = new List<IINode>(); for (int i = 0; i < node.NumberOfChildren; i++) { IINode child = node.GetChildNode(i); nodes.Add(child); nodes.AddRange(getChildren(child)); } return nodes; }
private void ReportLights(IINode node) { if (node.ObjectRef is ILightObject) { lightNum++; lightNames += (node.NodeName + "\n"); } for (int i = 0; i < node.NumberOfChildren; i++) { ReportLights(node.GetChildNode(i)); } }
private static IEnumerable<INodeWrapper> GetChildObjects(IINode node) { for (int i = 0; i < node.NumberOfChildren; i++) { IINode childNode = node.GetChildNode(i); yield return new INodeWrapper(childNode); foreach (INodeWrapper child in GetChildObjects(childNode)) { yield return child; } } }
private static IEnumerable <IINode> GetAllChildNodesRecursive(IINode iNode) { int childCount = iNode.NumberOfChildren; for (int i = 0; i < childCount; i++) { // Yields the current child node IINode child = iNode.GetChildNode(i); yield return(child); // Yields the children of the current child node foreach (var item in GetAllChildNodesRecursive(child)) { yield return(item); } } }
/// <summary> /// Recursively go through the scene and get all nodes /// Use the "Enchanced" Autodesk.Max APIs to get the children nodes /// </summary> private void GetNodes(IINode node) { m_sceneNodes.Add(node); for (int i = 0; i < node.NumberOfChildren; i++) GetNodes(node.GetChildNode(i)); }
private void IsMeshFlattenable(IINode node, AnimationGroupList animationGroupList, ref List <IINode> flattenableNodes) { //a node can't be flatten if: //- is not a mesh //- is marked as not flattenable //- is hidden //- is part of animation group //- is skinned //- is linked to animated node if (node.IsMarkedAsNotFlattenable()) { return; } if (node.IsNodeHidden(false) && !exportParameters.exportHiddenObjects) { return; } if (node.IsRootNode) { for (int i = 0; i < node.NumChildren; i++) { IINode n = node.GetChildNode(i); IsMeshFlattenable(n, animationGroupList, ref flattenableNodes); } return; } if (node.GetTriObjectFromNode() == null) { for (int i = 0; i < node.NumChildren; i++) { IINode n = node.GetChildNode(i); IsMeshFlattenable(n, animationGroupList, ref flattenableNodes); } return; } if (node.IsSkinned()) { string message = $"{node.Name} can't be flatten, because is skinned"; RaiseMessage(message, 0); for (int i = 0; i < node.NumChildren; i++) { IINode n = node.GetChildNode(i); IsMeshFlattenable(n, animationGroupList, ref flattenableNodes); } return; } if (node.IsInAnimationGroups(animationGroupList)) { string message = $"{node.Name} can't be flatten, because is part of an AnimationGroup"; RaiseMessage(message, 0); for (int i = 0; i < node.NumChildren; i++) { IINode n = node.GetChildNode(i); IsMeshFlattenable(n, animationGroupList, ref flattenableNodes); } return; } if (node.IsNodeTreeAnimated()) { string message = $"{node.Name} can't be flatten, his hierachy contains animated node"; RaiseMessage(message, 0); for (int i = 0; i < node.NumChildren; i++) { IINode n = node.GetChildNode(i); IsMeshFlattenable(n, animationGroupList, ref flattenableNodes); } return; } flattenableNodes.Add(node); }
public static void BuildBind(IINode _node, int _parentId, Pose _pose, ROD_ExportG r) { DualQuaternion DQ = GetBoneBindDQ(_node, r); Joint _joint = new Joint(_pose.joints.Count, _node.Name, _parentId, DQ, DualQuaternion.Identity); _pose.joints.Add(_joint); int childrensNb = _node.NumberOfChildren; for (int i = 0; i < childrensNb; i++) { if (!_node.GetChildNode(i).Name.EndsWith("Nub")) { BuildBind(_node.GetChildNode(i), _joint.id, _pose, r); } } }
public static void BuildLJoint(IINode _node, int _parentId, Pose _pose, int _frame, ROD_ExportG r) { DualQuaternion WDQ = GetBoneWorldDQ(_node, _frame, r); DualQuaternion LDQ = GetBoneLocalDQ(_node, _frame, r); Joint _joint = new Joint(_pose.joints.Count, _node.Name, _parentId, WDQ, LDQ); _pose.joints.Add(_joint); int childrensNb = _node.NumberOfChildren; for (int i = 0; i < childrensNb; i++) { if (!_node.GetChildNode(i).Name.EndsWith("Nub")) { BuildLJoint(_node.GetChildNode(i), _joint.id, _pose, _frame, r); } } }
private bool IsMeshFlattenable(IINode node, AnimationGroupList animationGroupList, ref List <IINode> flattenableNodes) { //a node can't be flatten if: //- is marked as not flattenable //- is hidden //- is not selected when exportOnlyselected is checked //- is part of animation group //- is linked to animated node if (node.IsMarkedAsNotFlattenable()) { logger?.RaiseWarning($"{node.Name} is marked as not flattenable"); return(false); } if (node.IsRootNode) { for (int i = 0; i < node.NumChildren; i++) { IINode n = node.GetChildNode(i); return(IsMeshFlattenable(n, animationGroupList, ref flattenableNodes)); } return(false); } if (!exportParameters.exportHiddenObjects && node.IsNodeHidden(false)) { logger?.RaiseWarning($"{node.Name} is hidden"); return(false); } if (node.IsNodeTreeAnimated()) { string message = $"{node.Name} can't be flatten, his hierarchy contains animated node"; logger?.RaiseWarning(message, 0); for (int i = 0; i < node.NumChildren; i++) { IINode n = node.GetChildNode(i); return(IsMeshFlattenable(n, animationGroupList, ref flattenableNodes)); } return(false); } if (node.IsInAnimationGroups(animationGroupList)) { string message = $"{node.Name} can't be flatten, because is part of an AnimationGroup"; logger?.RaiseWarning(message, 0); for (int i = 0; i < node.NumChildren; i++) { IINode n = node.GetChildNode(i); return(IsMeshFlattenable(n, animationGroupList, ref flattenableNodes)); } return(false); } flattenableNodes.Add(node); return(true); }