public GooAnimationClipChannel(GLexAnimationClip pClip, GLexBone pBone)
    {
        _clip = pClip;
        _bone = pBone;
        _id = NamesUtil.GenerateUniqueId();

        ResetCurveData();
    }
    public GooAnimationClipChannel(GLexAnimationClip pClip, GLexBone pBone)
    {
        _clip = pClip;
        _bone = pBone;
        _id   = NamesUtil.GenerateUniqueId();

        ResetCurveData();
    }
    private GooAnimationClipChannel GetChannelForBone(GLexBone pBone)
    {
        GooAnimationClipChannel channel;

        if (!_boneChannels.TryGetValue(pBone, out channel))
        {
            channel = new GooAnimationClipChannel(this, pBone);
            _boneChannels.Add(pBone, channel);
        }
        return(channel);
    }
Пример #4
0
 public static int GetParentIndexOf(GLexBone bone)
 {
     if (bone.mTransform.parent != null)
     {
         foreach (GLexBone parent in mBones)
         {
             if (bone.mTransform.parent == parent.mTransform)
             {
                 return(parent.Index);
             }
         }
         return(-32768);
     }
     else
     {
         return(-32768);
     }
 }
    private void CreateBones()
    {
        _bones.Clear();

        int index = 0;

        foreach (Transform bone in _mesh.bones)
        {
            var glexBone = new GLexBone(index++, bone, _mesh);
            _bones.Add(glexBone);

            if (!GLexConfig.ExportBoneAsGameObject)
            {
                GLexData.Instance.Remove(bone, bone.gameObject);
            }
        }

        foreach (var bone in _bones)
        {
            bone.ParentIndex = GLexBone.GetParentIndexOf(bone);
        }
    }
Пример #6
0
    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>();
    }
    private void CreateBones()
    {
        _bones.Clear();

        int index = 0;
        foreach (Transform bone in _mesh.bones) {
            var glexBone = new GLexBone(index++, bone, _mesh);
            _bones.Add(glexBone);

            if (!GLexConfig.ExportBoneAsGameObject) {
                GLexData.Instance.Remove(bone, bone.gameObject);
            }
        }

        foreach (var bone in _bones) {
            bone.ParentIndex = GLexBone.GetParentIndexOf(bone);
        }
    }
 public static int GetParentIndexOf( GLexBone bone )
 {
     if( bone.mTransform.parent != null ) {
         foreach( GLexBone parent in mBones ) {
             if( bone.mTransform.parent == parent.mTransform ) {
                 return parent.Index;
             }
         }
         return -32768;
     } else {
         return -32768;
     }
 }
Пример #9
0
    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();
    }
 private GooAnimationClipChannel GetChannelForBone(GLexBone pBone)
 {
     GooAnimationClipChannel channel;
     if (!_boneChannels.TryGetValue(pBone, out channel)) {
         channel = new GooAnimationClipChannel(this, pBone);
         _boneChannels.Add(pBone, channel);
     }
     return channel;
 }