private PathComponentRecord recordListFromHierarchy(GameObject gameObject, RecordMaping recordMaping, string parentPath = "")
        {
            PathComponentRecord result = new PathComponentRecord();

            List <ComponentRecord> hierarchy = new List <ComponentRecord>();

            foreach (Component component in gameObject.GetComponents <Component>())
            {
                if (component is Transform || component is Renderer)
                {
                    continue;
                }

                ComponentRecord record = new ComponentRecord();
                record.type      = component.GetType();
                record.component = component;
                record.json      = EditorJsonUtility.ToJson(component);
                hierarchy.Add(record);
            }

            result.rootMap    = recordMaping;
            result.name       = gameObject.name;
            result.path       = parentPath + "/" + result.name;
            result.go         = gameObject;
            result.components = hierarchy;

            result.localPosition = gameObject.transform.localPosition;
            result.localRotation = gameObject.transform.localRotation;
            result.localScale    = gameObject.transform.localScale;

            recordMaping.add(result);

            int childCount = gameObject.transform.childCount;

            for (int i = 0; i < childCount; i++)
            {
                PathComponentRecord item =
                    this.recordListFromHierarchy(gameObject.transform.GetChild(i).gameObject, recordMaping, result.path);

                result.children.Add(item);
            }

            return(result);
        }
Beispiel #2
0
 public virtual void init(RecordMaping fbxMap, RecordMaping modelMap)
 {
     this.fbxMap   = fbxMap;
     this.modelMap = modelMap;
 }