示例#1
0
        public void bindData(visualModelAnimAsset animAsset, TreeNode treeNode)
        {
            mIsBindingData = true;

            mData = animAsset;
            mNode = treeNode;

            // Move data to control data (DATA -> CONTROL DATA)
            //
            fileBrowseControl1.FileName = mData.file;
            weightNumericUpDown1.Value  = mData.weight;

            if (mData.progression != null)
            {
                opacityProgressionCheckBox.Checked = true;
                opacityProgressionButton.Enabled   = true;

                mProgression = new EditorCore.FloatProgression();
                mProgression.Copy(mData.progression);
            }
            else
            {
                opacityProgressionCheckBox.Checked = false;
                opacityProgressionButton.Enabled   = false;

                mProgression = null;
            }

            mIsBindingData = false;
        }
示例#2
0
        public void updateData()
        {
            if ((mData == null) || (mNode == null))
            {
                return;
            }

            // Move control data to data (CONTROL DATA -> DATA)
            //
            visualModelAnimAsset afterChanges = new visualModelAnimAsset();

            afterChanges.file   = fileBrowseControl1.FileName;
            afterChanges.weight = (int)weightNumericUpDown1.Value;

            // Create a progression copy if:
            //    - progression is not null
            //    - progression has 2 or more points
            //    - if progression only has 2 points makes sure they are not the default values
            if ((mProgression != null) &&
                (mProgression.Stages.Count >= 2))
            //((mProgression.Stages.Count == 2) && (mProgression.Stages[0].Value != 1.0f) || (mProgression.Stages[1].Value != 1.0f))
            {
                afterChanges.progression = new EditorCore.FloatProgression();
                afterChanges.progression.Copy(mProgression);
            }
            else
            {
                afterChanges.progression = null;
            }

            // Load asset
            afterChanges.loadAsset();

            // Add/Execute undo action
            UndoRedoChangeDataAction undoAction = new UndoRedoChangeDataAction(mData, afterChanges);

            mVisualEditorPage.mUndoRedoManager.addUndoRedoActionAndExecute(undoAction);
        }