예제 #1
0
        public bool RemoveBehaviour(IGizmoBehaviour behaviour)
        {
            if (behaviour == null)
            {
                return(false);
            }

            if (behaviour == _moveGizmo)
            {
                _moveGizmo = null;
            }
            else if (behaviour == _rotationGizmo)
            {
                _rotationGizmo = null;
            }
            else if (behaviour == _scaleGizmo)
            {
                _scaleGizmo = null;
            }
            else if (behaviour == _universalGizmo)
            {
                _universalGizmo = null;
            }
            else if (behaviour == _sceneGizmo)
            {
                _sceneGizmo = null;
            }
            else if (behaviour == _objectTransformGizmo)
            {
                _objectTransformGizmo = null;
            }

            return(_behaviours.Remove(behaviour));
        }
예제 #2
0
        public ObjectTransformGizmo CreateObjectScaleGizmo()
        {
            ScaleGizmo scaleGizmo     = CreateScaleGizmo();
            var        transformGizmo = scaleGizmo.Gizmo.AddBehaviour <ObjectTransformGizmo>();

            transformGizmo.SetTransformChannelFlags(ObjectTransformGizmo.Channels.Scale);
            transformGizmo.SetTransformSpace(GizmoSpace.Local);
            transformGizmo.MakeTransformSpacePermanent();

            transformGizmo.SharedSettings = _objectScaleGizmoSettings;

            return(transformGizmo);
        }
예제 #3
0
        public ScaleGizmo CreateScaleGizmo()
        {
            Gizmo      gizmo      = CreateGizmo();
            ScaleGizmo scaleGizmo = new ScaleGizmo();

            gizmo.AddBehaviour(scaleGizmo);

            scaleGizmo.SharedHotkeys       = _scaleGizmoHotkeys;
            scaleGizmo.SharedLookAndFeel3D = _scaleGizmoLookAndFeel3D;
            scaleGizmo.SharedSettings3D    = _scaleGizmoSettings3D;

            return(scaleGizmo);
        }
예제 #4
0
        public bool AddBehaviour(IGizmoBehaviour behaviour)
        {
            if (behaviour == null || behaviour.Gizmo != null)
            {
                return(false);
            }

            GizmoBehaviorInitParams initParams = new GizmoBehaviorInitParams();

            initParams.Gizmo = this;

            behaviour.Init_SystemCall(initParams);
            if (!_behaviours.Add(behaviour))
            {
                return(false);
            }

            Type behaviourType = behaviour.GetType();

            if (behaviourType == typeof(MoveGizmo))
            {
                _moveGizmo = behaviour as MoveGizmo;
            }
            else if (behaviourType == typeof(RotationGizmo))
            {
                _rotationGizmo = behaviour as RotationGizmo;
            }
            else if (behaviourType == typeof(ScaleGizmo))
            {
                _scaleGizmo = behaviour as ScaleGizmo;
            }
            else if (behaviourType == typeof(UniversalGizmo))
            {
                _universalGizmo = behaviour as UniversalGizmo;
            }
            else if (behaviourType == typeof(SceneGizmo))
            {
                _sceneGizmo = behaviour as SceneGizmo;
            }
            else if (behaviourType == typeof(ObjectTransformGizmo))
            {
                _objectTransformGizmo = behaviour as ObjectTransformGizmo;
            }

            behaviour.OnAttached();
            behaviour.OnEnabled();

            return(true);
        }