Esempio n. 1
0
        static BundleGameObject Traverse(GameObject obj, BundleGameObject jparent = null)
        {
            BundleGameObject jgo = new BundleGameObject(obj, jparent);

            foreach (Transform child in obj.transform)
            {
                Traverse(child.gameObject, jgo);
            }
            return(jgo);
        }
Esempio n. 2
0
        static void reset()
        {
            BundleResource.Reset();
            BundleComponent.Reset();
            BundleScene.Reset();
            BundleGameObject.Reset();
            BundleComponent.RegisterStandardComponents();

            MeshExporter.Reset();
            MaterialExporter.Reset();
        }
Esempio n. 3
0
        public BundleGameObject(GameObject go, BundleGameObject parent)
        {
            allGameObjectLookup[go] = this;
            this.unityGameObject    = go;
            this.parent             = parent;
            this.name = go.name;

            if (parent != null)
            {
                parent.children.Add(this);
            }
            BundleComponent.QueryComponents(this);
        }
Esempio n. 4
0
        public static void QueryComponents(BundleGameObject jgo)
        {
            // for every registered conversion get that component
            bool isQueried = false;

            foreach (KeyValuePair <Type, Type> pair in conversions)
            {
                Component[] components = jgo.unityGameObject.GetComponents(pair.Key);
                if (components.Length > 0)
                {
                    isQueried = true;
                }

                foreach (Component component in components)
                {
                    MeshRenderer meshRenderer = component as MeshRenderer;
                    if (meshRenderer != null && !meshRenderer.enabled)
                    {
                        continue;
                    }

                    var jcomponent = Activator.CreateInstance(pair.Value) as BundleComponent;
                    if (jcomponent == null)
                    {
                        ExportError.FatalError("Export component creation failed");
                    }

                    jcomponent.unityComponent = component;
                    jcomponent.jeGameObject   = jgo;
                    jgo.AddComponent(jcomponent);
                }
            }

            if (!isQueried)
            {
                Debug.LogWarning("Unregistered game object " + jgo.unityGameObject.name);
            }
        }