private void SetupSubmeshRenderer(GLexSkinnedMeshRenderer parent, int submeshIndex) { mComponent = parent.mComponent; mMesh = parent.mMesh; _submeshIndex = submeshIndex; _material = GLexMaterial.Get(parent.mComponent.sharedMaterials[submeshIndex], mComponent); }
public GLexData() { Instance = this; GLexMaterial.Reset(); GLexMesh.Reset(); GLexTexture.Reset(); GLexShader.Reset(); GLexSkinnedMeshRenderer.Reset(); GLexBone.Reset(); GLexAnimation.Reset(); GLexAnimationClip.Reset(); GLexAnimationState.Reset(); GooSkybox.Reset(); GLexAudioSource.Reset(); GooSkeleton.Reset(); mGLexGameObjects = new List <GLexGameObject>(); mGLexTopGameObjects = new List <GLexGameObject>(); mGLexComponents = new List <GLexComponent>(); }
public void PrepareForExport() { if (GLexConfig.GetOption(GLexConfig.SETUNIQUENAMES)) { Dictionary <string, int> uniqueNames = new Dictionary <string, int>(); foreach (GLexGameObject gameObject in mGLexGameObjects) { if (gameObject.Settings == null) { _addedSettingsTo.Add(gameObject); gameObject.AddSettings(); } else { gameObject.ResetSettingsExportName(); } } foreach (GLexGameObject gameObject in mGLexGameObjects) { if (uniqueNames.ContainsKey(gameObject.Settings.UniqueName)) { gameObject.Settings.UniqueName = gameObject.Settings.UniqueName + (++uniqueNames[gameObject.Settings.UniqueName]).ToString(); } else { uniqueNames.Add(gameObject.Settings.UniqueName, 0); } } } // Keep preparing objects while new ones are being added int prevGameObjectCount = 0, prevComponentCount = 0; while (prevGameObjectCount < mGLexGameObjects.Count || prevComponentCount < mGLexComponents.Count) { int goStart = prevGameObjectCount; int gcStart = prevComponentCount; prevGameObjectCount = mGLexGameObjects.Count; prevComponentCount = mGLexComponents.Count; for (int i = goStart; i < prevGameObjectCount; ++i) { mGLexGameObjects[i].PrepareForExport(); } for (int i = gcStart; i < prevComponentCount; ++i) { mGLexComponents[i].PrepareForExport(); } } // find top objects foreach (GLexGameObject gameObject in mGLexGameObjects) { if (!gameObject.HasParent) { mGLexTopGameObjects.Add(gameObject); } } GLexMaterial.PrepareForExport(); GLexMesh.PrepareForExport(); GLexTexture.PrepareForExport(); GLexShader.PrepareForExport(); GLexSkinnedMeshRenderer.StaticPrepareForExport(); GLexBone.PrepareForExport(); // GLexAnimation .PrepareForExport(); // GLexAnimationClip .PrepareForExport(); mGLexGameObjectsAsArray = mGLexGameObjects.ToArray(); mGLexTopGameObjectsAsArray = mGLexTopGameObjects.ToArray(); mGLexComponentsAsArray = mGLexComponents.ToArray(); mScene.PrepareForExport(); }