示例#1
0
 public static void get_procgen_parts_phase2(ref List <string> dellist, GMDL.Model root)
 {
     foreach (GMDL.Model child in root.children)
     {
         if (!child.procFlag)
         {
             dellist.Add(child.name);
         }
         else
         {
             get_procgen_parts_phase2(ref dellist, child);
         }
     }
 }
示例#2
0
        public static void get_procgen_parts_phase3(List <string> dellist, GMDL.Model root)
        {
            for (int i = 0; i < dellist.Count; i++)
            {
                string     part_name = dellist[i];
                GMDL.Model child;
                child = collectPart(root.children, part_name);

                if (child != null)
                {
                    GMDL.Model parent = child.parent;
                    parent.children.Remove(child);
                }
            }
        }
示例#3
0
        public static GMDL.Model get_procgen_parts(ref List <string> descriptors, GMDL.Model root)
        {
            //Make deep copy of root
            GMDL.Model newRoot = ((GMDL.Scene)root).Clone();
            root.procFlag = true; //Always keep the root node

            //PHASE 1
            //Flag Procgen parts
            get_procgen_parts_phase1(ref descriptors, newRoot);
            //PHASE 2
            //Save all candidates for removal
            List <string> childDelList = new List <string>();

            get_procgen_parts_phase2(ref childDelList, newRoot);
            //PHASE 3
            //Remove candidates
            get_procgen_parts_phase3(childDelList, newRoot);



            return(newRoot);
        }
示例#4
0
 public static void get_procgen_parts_phase1(ref List <string> descriptors, GMDL.Model root)
 {
     //During phase one all procgen parts are flagged
     foreach (GMDL.Model child in root.children)
     {
         //Identify Descriptors
         if (child.name.StartsWith("_"))
         {
             for (int i = 0; i < descriptors.Count; i++)
             {
                 if (child.name.Contains(descriptors[i]))
                 {
                     child.procFlag = true;
                     Debug.WriteLine("Setting Flag on " + child.name);
                     //iterate into Descriptor children
                     get_procgen_parts_phase1(ref descriptors, child);
                 }
             }
         }
         //DO FLAG JOINTS
         else if (child.type == TYPES.JOINT)
         {
             continue;
         }
         //Standard part, Endpoint as well
         else
         {
             //Add part to partlist if not Joint, Light or Collision
             if (child.type != TYPES.JOINT & child.type != TYPES.LIGHT & child.type != TYPES.COLLISION)
             {
                 child.procFlag = true;
                 Debug.WriteLine("Setting Flag on " + child.name);
                 //Cover the case where endpoints have children as well
                 get_procgen_parts_phase1(ref descriptors, child);
             }
         }
     }
 }
示例#5
0
 public static GMDL.Model collectPart(List <GMDL.Model> coll, string name)
 {
     foreach (GMDL.Model child in coll)
     {
         if (child.name == name)
         {
             return(child);
         }
         else
         {
             GMDL.Model ret = collectPart(child.children, name);
             if (ret != null)
             {
                 return(ret);
             }
             else
             {
                 continue;
             }
         }
     }
     return(null);
 }