Exemplo n.º 1
0
        //--------------------------------
        public void SetSceneEntity(Bootstrap.SceneEntity entity)
        {
            if (entity != _sceneEntity)
            {
                // unregister our scene entity's transform changed handler.
                if (_sceneEntity != null)
                {
                    _sceneEntity.TransformChanged -= new Bootstrap.SceneEntity.TransformChangedHandler(sceneEntity_TransformChanged);
                }

                // store the new scene entity.
                _sceneEntity = entity;

                if (_sceneEntity != null)
                {
                    // be notified whenever the new scene entity's transform is changed externally.
                    _sceneEntity.TransformChanged += new Bootstrap.SceneEntity.TransformChangedHandler(sceneEntity_TransformChanged);

                    // enable the controls.
                    veTranslate.Enabled = true;
                    veRotate.Enabled    = true;
                    veScale.Enabled     = true;

                    // store the values of the new scene entity's transform.
                    veTranslate.Vector = _sceneEntity.Position;
                    veRotate.Vector    = _sceneEntity.Rotation;
                    veScale.Vector     = _sceneEntity.Scale;


                    // if the new scene entity isn't scalable, then disable the scale editor.
                    veScale.ReadOnly = !entity.Scalable;
                }
                else
                {
                    // disable the controls.
                    veTranslate.Enabled = false;
                    veRotate.Enabled    = false;
                    veScale.Enabled     = false;
                }
            }
        }
Exemplo n.º 2
0
        //================================
        // private methods.
        //================================

        //--------------------------------
        private void sceneEntity_TransformChanged(Bootstrap.SceneEntity sender)
        {
            veTranslate.Vector = _sceneEntity.Position;
            veRotate.Vector    = _sceneEntity.Rotation;
            veScale.Vector     = _sceneEntity.Scale;
        }