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);
        }
Exemple #2
0
 public abstract void doResolve(T nc, ComponentRecord fbxComponent);
Exemple #3
0
 public void resolve(Component nc, ComponentRecord fbxComponent)
 {
     doResolve((T)nc, fbxComponent);
 }