Esempio n. 1
0
        public static void QueryComponents(JEGameObject jgo)
        {
            // for every registered conversion get that component
            foreach (KeyValuePair <Type, Type> pair in conversions)
            {
                Component[] components = jgo.unityGameObject.GetComponents(pair.Key);

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

                    var jcomponent = Activator.CreateInstance(pair.Value) as JEComponent;

                    if (jcomponent == null)
                    {
                        ExportError.FatalError("Export component creation failed");
                    }

                    jcomponent.unityComponent = component;
                    jcomponent.jeGameObject   = jgo;
                    jgo.AddComponent(jcomponent);
                }
            }
        }
Esempio n. 2
0
        public static JEScene TraverseScene()
        {
            var scene = new JEScene();

            List <GameObject> root = new List <GameObject>();

            // Unity has no root object, so collect root game objects this way
            object[] objects = GameObject.FindObjectsOfType(typeof(GameObject));

            foreach (object o in objects)
            {
                GameObject go = (GameObject)o;

                if (go.transform.parent == null)
                {
                    root.Add(go);
                }
            }

            if (root.Count == 0)
            {
                ExportError.FatalError("Cannot Export Empty Scene");
            }

            // traverse the "root" game objects, collecting child game objects and components
            foreach (var go in root)
            {
                scene.rootGameObjects.Add(Traverse(go));
            }

            return(scene);
        }
Esempio n. 3
0
        override public void Preprocess()
        {
            unityMeshRenderer = unityComponent as MeshRenderer;
            unityMeshFilter   = jeGameObject.unityGameObject.GetComponent <MeshFilter>();

            if (unityMeshFilter == null)
            {
                ExportError.FatalError("MeshRenderer with no MeshFilter");
            }
        }