public override void maintainKey(AMITarget itarget, UnityEngine.Object targetObj)
        {
            if (itarget.isMeta)
            {
                if (string.IsNullOrEmpty(_cameraPath))
                {
                    if (_camera)
                    {
                        _cameraPath = AMUtil.GetPath(itarget.root, _camera);
                        itarget.SetCache(_cameraPath, _camera.transform);
                    }
                }

                if (string.IsNullOrEmpty(_cameraEndPath))
                {
                    if (_cameraEnd)
                    {
                        _cameraEndPath = AMUtil.GetPath(itarget.root, _cameraEnd);
                        itarget.SetCache(_cameraEndPath, _cameraEnd.transform);
                    }
                }

                _camera    = null;
                _cameraEnd = null;
            }
            else
            {
                if (!_camera)
                {
                    if (!string.IsNullOrEmpty(_cameraPath))
                    {
                        Transform t = itarget.GetCache(_cameraPath);
                        if (!t)
                        {
                            t = AMUtil.GetTarget(itarget.root, _cameraPath);
                        }
                        _camera = t ? t.GetComponent <Camera>() : null;
                    }
                }

                if (!_cameraEnd)
                {
                    if (!string.IsNullOrEmpty(_cameraEndPath))
                    {
                        Transform t = itarget.GetCache(_cameraEndPath);
                        if (!t)
                        {
                            t = AMUtil.GetTarget(itarget.root, _cameraEndPath);
                        }
                        _cameraEnd = t ? t.GetComponent <Camera>() : null;
                    }
                }

                _cameraPath    = "";
                _cameraEndPath = "";
            }
        }
        public bool setCamera(AMITarget itarget, Camera camera)
        {
            if (getCamera(itarget) != camera)
            {
                if (camera)
                {
                    if (itarget.isMeta)
                    {
                        _camera     = null;
                        _cameraPath = AMUtil.GetPath(itarget.root, camera);
                        itarget.SetCache(_cameraPath, camera.transform);
                    }
                    else
                    {
                        _camera     = camera;
                        _cameraPath = "";
                    }
                }
                else
                {
                    _camera     = null;
                    _cameraPath = "";
                }

                return(true);
            }
            return(false);
        }
        public Camera getCamera(AMITarget itarget)
        {
            if (itarget.isMeta)
            {
                if (!string.IsNullOrEmpty(_cameraPath))
                {
                    Transform t = itarget.GetCache(_cameraPath);
                    if (t)
                    {
                        return(t.GetComponent <Camera>());
                    }
                    else
                    {
                        t = AMUtil.GetTarget(itarget.root, _cameraPath);
                        itarget.SetCache(_cameraPath, t);
                        if (t)
                        {
                            return(t.GetComponent <Camera>());
                        }
                    }
                }

                return(null);
            }
            else
            {
                return(_camera);
            }
        }
Exemple #4
0
        public override void maintainKey(AMITarget itarget, UnityEngine.Object targetObj)
        {
            if (itarget.isMeta)
            {
                if (string.IsNullOrEmpty(targetPath))
                {
                    if (target)
                    {
                        targetPath = AMUtil.GetPath(itarget.root, target);
                        itarget.SetCache(targetPath, target);
                    }
                }

                target = null;
            }
            else
            {
                if (!target)
                {
                    if (!string.IsNullOrEmpty(targetPath))
                    {
                        target = itarget.GetCache(targetPath);
                        if (!target)
                        {
                            target = AMUtil.GetTarget(itarget.root, targetPath);
                        }
                    }
                }

                targetPath = "";
            }
        }
Exemple #5
0
        /// <summary>
        /// Gets the target relative to animator's hierarchy if we are referencing via AnimatorMeta
        /// </summary>
        public UnityEngine.Object GetTarget(AMITarget target)
        {
            UnityEngine.Object ret = null;

            if (target != null && target.isMeta)
            {
                Transform tgt = target.GetCache(_targetPath);
                if (tgt)
                {
                    ret = GetSerializeObject(tgt.gameObject);
                }
                else
                {
                    tgt = Utility.GetTarget(target.root, _targetPath);
                    target.SetCache(_targetPath, tgt);
                    if (tgt)
                    {
                        ret = GetSerializeObject(tgt.gameObject);
                    }
                }
            }
            else
            {
                ret = GetSerializeObject(null);
            }

            return(ret);
        }
Exemple #6
0
 public void SetTarget(AMITarget target, Transform item)
 {
     if (target.isMeta && item)
     {
         _targetPath = Utility.GetPath(target.root, item);
         target.SetCache(_targetPath, item);
         SetSerializeObject(GetSerializeObject(item.gameObject));
     }
     else
     {
         _targetPath = "";
         SetSerializeObject(item ? GetSerializeObject(item.gameObject) : null);
     }
 }
Exemple #7
0
 public void SetTarget(AMITarget itarget, Transform t)
 {
     if (itarget.isMeta)
     {
         target     = null;
         targetPath = AMUtil.GetPath(itarget.root, t);
         itarget.SetCache(targetPath, t);
     }
     else
     {
         target     = t;
         targetPath = "";
     }
 }
Exemple #8
0
        public virtual void maintainTrack(AMITarget itarget)
        {
            Object obj = null;

            //fix the target info
            if (itarget.isMeta)
            {
                if (string.IsNullOrEmpty(_targetPath))
                {
                    obj = GetSerializeObject(null);
                    if (obj)
                    {
                        _targetPath = Utility.GetPath(itarget.root, obj);
                        itarget.SetCache(_targetPath, Utility.GetTransform(obj));
                    }
                }
                SetSerializeObject(null);
            }
            else
            {
                obj = GetSerializeObject(null);
                if (obj == null)
                {
                    if (!string.IsNullOrEmpty(_targetPath))
                    {
                        Transform tgt = itarget.GetCache(_targetPath);
                        if (tgt == null)
                        {
                            tgt = Utility.GetTarget(itarget.root, _targetPath);
                        }
                        if (tgt)
                        {
                            obj = GetSerializeObject(tgt.gameObject);
                        }
                        SetSerializeObject(obj);
                    }
                }
                _targetPath = "";
            }

            //maintain keys
            foreach (AMKey key in keys)
            {
                key.maintainKey(itarget, obj);
            }
        }
Exemple #9
0
        public Transform GetTarget(AMITarget itarget)
        {
            Transform ret = null;

            if (itarget.isMeta)
            {
                if (!string.IsNullOrEmpty(targetPath))
                {
                    ret = itarget.GetCache(targetPath);
                    if (ret == null)
                    {
                        ret = AMUtil.GetTarget(itarget.root, targetPath);
                        itarget.SetCache(targetPath, ret);
                    }
                }
            }
            else
            {
                ret = target;
            }
            return(ret);
        }
        public override void maintainKey(AMITarget itarget, UnityEngine.Object targetObj)
        {
            if(itarget.isMeta) {
                if(string.IsNullOrEmpty(_cameraPath)) {
                    if(_camera) {
                        _cameraPath = AMUtil.GetPath(itarget.root, _camera);
                        itarget.SetCache(_cameraPath, _camera.transform);
                    }
                }

                if(string.IsNullOrEmpty(_cameraEndPath)) {
                    if(_cameraEnd) {
                        _cameraEndPath = AMUtil.GetPath(itarget.root, _cameraEnd);
                        itarget.SetCache(_cameraEndPath, _cameraEnd.transform);
                    }
                }

                _camera = null;
                _cameraEnd = null;
            }
            else {
                if(!_camera) {
                    if(!string.IsNullOrEmpty(_cameraPath)) {
                        Transform t = itarget.GetCache(_cameraPath);
                        if(!t)
                            t = AMUtil.GetTarget(itarget.root, _cameraPath);
                        _camera = t ? t.GetComponent<Camera>() : null;
                    }
                }

                if(!_cameraEnd) {
                    if(!string.IsNullOrEmpty(_cameraEndPath)) {
                        Transform t = itarget.GetCache(_cameraEndPath);
                        if(!t)
                            t = AMUtil.GetTarget(itarget.root, _cameraEndPath);
                        _cameraEnd = t ? t.GetComponent<Camera>() : null;
                    }
                }

                _cameraPath = "";
                _cameraEndPath = "";
            }
        }
 public Transform GetTarget(AMITarget itarget)
 {
     Transform ret = null;
     if(itarget.isMeta) {
         if(!string.IsNullOrEmpty(targetPath)) {
             ret = itarget.GetCache(targetPath);
             if(ret == null) {
                 ret = AMUtil.GetTarget(itarget.root, targetPath);
                 itarget.SetCache(targetPath, ret);
             }
         }
     }
     else
         ret = target;
     return ret;
 }
 public void SetTarget(AMITarget itarget, Transform t)
 {
     if(itarget.isMeta) {
         target = null;
         targetPath = AMUtil.GetPath(itarget.root, t);
         itarget.SetCache(targetPath, t);
     }
     else {
         target = t;
         targetPath = "";
     }
 }
Exemple #13
0
    public virtual void maintainTrack(AMITarget itarget)
    {
        Object obj = null;

        //fix the target info
        if(itarget.isMeta) {
            if(string.IsNullOrEmpty(_targetPath)) {
                obj = GetSerializeObject(null);
                if(obj) {
                    _targetPath = AMUtil.GetPath(itarget.root, obj);
                    itarget.SetCache(_targetPath, AMUtil.GetTransform(obj));
                }
            }
            SetSerializeObject(null);
        }
        else {
            obj = GetSerializeObject(null);
            if(obj == null) {
                if(!string.IsNullOrEmpty(_targetPath)) {
                    Transform tgt = itarget.GetCache(_targetPath);
                    if(tgt == null)
                        tgt = AMUtil.GetTarget(itarget.root, _targetPath);
                    if(tgt)
                        obj = GetSerializeObject(tgt.gameObject);
                    SetSerializeObject(obj);
                }
            }
            _targetPath = "";
        }

        //maintain keys
        foreach(AMKey key in keys)
            key.maintainKey(itarget, obj);
    }
Exemple #14
0
 public void SetTarget(AMITarget target, Transform item)
 {
     if(target.isMeta && item) {
         _targetPath = AMUtil.GetPath(target.root, item);
         target.SetCache(_targetPath, item);
         SetSerializeObject(GetSerializeObject(item.gameObject));
     }
     else {
         _targetPath = "";
         SetSerializeObject(item ? GetSerializeObject(item.gameObject) : null);
     }
 }
        public bool setCamera(AMITarget itarget, Camera camera)
        {
            if(getCamera(itarget) != camera) {
                if(camera) {
                    if(itarget.isMeta) {
                        _camera = null;
                        _cameraPath = AMUtil.GetPath(itarget.root, camera);
                        itarget.SetCache(_cameraPath, camera.transform);

                    }
                    else {
                        _camera = camera;
                        _cameraPath = "";
                    }
                }
                else {
                    _camera = null;
                    _cameraPath = "";
                }

                return true;
            }
            return false;
        }
    public override void maintainKey(AMITarget itarget, UnityEngine.Object targetObj)
    {
        if(itarget.isMeta) {
            if(string.IsNullOrEmpty(targetPath)) {
                if(target) {
                    targetPath = AMUtil.GetPath(itarget.root, target);
                    itarget.SetCache(targetPath, target);
                }
            }

            target = null;
        }
        else {
            if(!target) {
                if(!string.IsNullOrEmpty(targetPath)) {
                    target = itarget.GetCache(targetPath);
                    if(!target)
                        target = AMUtil.GetTarget(itarget.root, targetPath);
                }
            }

            targetPath = "";
        }
    }
        public Camera getCamera(AMITarget itarget)
        {
            if(itarget.isMeta) {
                if(!string.IsNullOrEmpty(_cameraPath)) {
                    Transform t = itarget.GetCache(_cameraPath);
                    if(t)
                        return t.GetComponent<Camera>();
                    else {
                        t = AMUtil.GetTarget(itarget.root, _cameraPath);
                        itarget.SetCache(_cameraPath, t);
                        if(t)
                            return t.GetComponent<Camera>();
                    }
                }

                return null;
            }
            else
                return _camera;
        }
Exemple #18
0
    /// <summary>
    /// Gets the target relative to animator's hierarchy if we are referencing via AnimatorMeta
    /// </summary>
    public UnityEngine.Object GetTarget(AMITarget target)
    {
        UnityEngine.Object ret = null;

        if(target.isMeta) {
            Transform tgt = target.GetCache(_targetPath);
            if(tgt)
                ret = GetSerializeObject(tgt.gameObject);
            else {
                tgt = AMUtil.GetTarget(target.root, _targetPath);
                target.SetCache(_targetPath, tgt);
                if(tgt)
                    ret = GetSerializeObject(tgt.gameObject);
            }
        }
        else
            ret = GetSerializeObject(null);

        return ret;
    }