Exemplo n.º 1
0
        public void bindData(visualLogicData logicData, TreeNode treeNode)
        {
            mIsBindingData = true;

            mData = logicData;
            mNode = treeNode;


            // Move data to control data (DATA -> CONTROL DATA)
            //
            refreshComboBoxItems();

            bool found1 = false;

            for (int i = 0; i < typeComboBox.Items.Count; i++)
            {
                if (String.Compare(mData.value, (string)typeComboBox.Items[i], true) == 0)
                {
                    typeComboBox.SelectedIndex = i;
                    found1 = true;
                    break;
                }
            }

            if (!found1)
            {
                typeComboBox.SelectedIndex = -1;
                typeComboBox.SelectedItem  = null;
                typeComboBox.Text          = null;
            }


            bool found2 = false;

            for (int i = 0; i < comboBox1.Items.Count; i++)
            {
                if (String.Compare(mData.modelref, (string)comboBox1.Items[i], true) == 0)
                {
                    comboBox1.SelectedIndex = i;
                    found2 = true;
                    break;
                }
            }

            if (!found2)
            {
                comboBox1.SelectedIndex = -1;
                comboBox1.SelectedItem  = null;
                comboBox1.Text          = null;
            }


            mIsBindingData = false;
        }
Exemplo n.º 2
0
        public void refreshComboBoxItems()
        {
            toBoneComboBox.Items.Clear();

            // Get model we are attaching to
            TreeNode animAssetNode = mNode.Parent;
            TreeNode animNode      = animAssetNode.Parent;
            TreeNode modelNode     = animNode.Parent;

            visualModel vmodel = modelNode.Tag as visualModel;

            if ((vmodel != null) && (vmodel.component != null))
            {
                GrannyInstance granInst = null;

                if (vmodel.component.asset != null)
                {
                    granInst = vmodel.component.asset.mInstance;
                }
                else if ((vmodel.component.logic != null) &&
                         (vmodel.component.logic.type == visualLogic.LogicType.Variation) &&
                         (vmodel.component.logic.logicdata.Count > 0))
                {
                    visualLogicData curLogicData = vmodel.component.logic.logicdata[0];
                    if (curLogicData.asset != null)
                    {
                        granInst = curLogicData.asset.mInstance;
                    }
                }

                if (granInst != null)
                {
                    List <string> boneList = new List <string>();
                    boneList.Clear();
                    granInst.getBoneNames(ref boneList);

                    // check all tags
                    foreach (string curBoneName in boneList)
                    {
                        if (!String.IsNullOrEmpty(curBoneName))
                        {
                            toBoneComboBox.Items.Add(curBoneName);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void updateData()
        {
            if ((mData == null) || (mNode == null))
            {
                return;
            }

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

            afterChanges.value = "p" + System.Convert.ToString((int)floatSliderEdit.Value);

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

            mVisualEditorPage.mUndoRedoManager.addUndoRedoActionAndExecute(undoAction);
        }
Exemplo n.º 4
0
        public void updateData()
        {
            if ((mData == null) || (mNode == null))
            {
                return;
            }

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

            afterChanges.value    = (string)typeComboBox.SelectedItem;
            afterChanges.modelref = (string)comboBox1.SelectedItem;

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

            mVisualEditorPage.mUndoRedoManager.addUndoRedoActionAndExecute(undoAction);
        }
Exemplo n.º 5
0
        public void bindData(visualLogicData logicData, TreeNode treeNode)
        {
            mIsBindingData = true;

            mData = logicData;
            mNode = treeNode;


            int percentValue = 0;

            if (!string.IsNullOrEmpty(mData.value))
            {
                percentValue = System.Convert.ToInt32(mData.value.Substring(1));
            }
            floatSliderEdit.Value = percentValue;


            mIsBindingData = false;
        }
Exemplo n.º 6
0
        public void bindData(visualLogicData logicData, TreeNode treeNode)
        {
            mIsBindingData = true;

            mData = logicData;
            mNode = treeNode;


            // Move data to control data (DATA -> CONTROL DATA)
            //
            refreshComboBoxItems();

            int percentValue = 0;

            if (!string.IsNullOrEmpty(mData.value))
            {
                percentValue = System.Convert.ToInt32(mData.value.Substring(1));
            }
            floatSliderEdit.Value = percentValue;


            bool found = false;

            for (int i = 0; i < comboBox1.Items.Count; i++)
            {
                if (String.Compare(mData.modelref, (string)comboBox1.Items[i], true) == 0)
                {
                    comboBox1.SelectedIndex = i;
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                comboBox1.SelectedIndex = -1;
                comboBox1.SelectedItem  = null;
                comboBox1.Text          = null;
            }


            mIsBindingData = false;
        }
Exemplo n.º 7
0
        public void bindData(visualLogicData logicData, TreeNode treeNode)
        {
            mIsBindingData = true;

            mData = logicData;
            mNode = treeNode;


            // Move data to control data (DATA -> CONTROL DATA)
            //
            refreshComboBoxItems();

            textBoxName.Text = mData.value;

            bool found = false;

            for (int i = 0; i < comboBox1.Items.Count; i++)
            {
                if (String.Compare(mData.modelref, (string)comboBox1.Items[i], true) == 0)
                {
                    comboBox1.SelectedIndex = i;
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                comboBox1.SelectedIndex = -1;
                comboBox1.SelectedItem  = null;
                comboBox1.Text          = null;
            }

            weightNumericUpDown1.Value = mData.weight;


            mIsBindingData = false;
        }
Exemplo n.º 8
0
        public void refreshComboBoxItems()
        {
            toBoneComboBox.Items.Clear();

            // Get model we are attaching to
            TreeNode animNode  = mNode.Parent;
            TreeNode modelNode = animNode.Parent;

            visualModel vmodel = modelNode.Tag as visualModel;

            if ((vmodel != null) && (vmodel.component != null))
            {
                GrannyInstance granInst = null;

                if (vmodel.component.asset != null)
                {
                    granInst = vmodel.component.asset.mInstance;
                }
                else if ((vmodel.component.logic != null) &&
                         (vmodel.component.logic.type == visualLogic.LogicType.Variation) &&
                         (vmodel.component.logic.logicdata.Count > 0))
                {
                    visualLogicData curLogicData = vmodel.component.logic.logicdata[0];
                    if (curLogicData.asset != null)
                    {
                        granInst = curLogicData.asset.mInstance;
                    }
                }

                if (granInst != null)
                {
                    List <string> boneList = new List <string>();
                    boneList.Clear();
                    granInst.getBoneNames(ref boneList);

                    // check all tags
                    foreach (string curBoneName in boneList)
                    {
                        if (!String.IsNullOrEmpty(curBoneName))
                        {
                            toBoneComboBox.Items.Add(curBoneName);
                        }
                    }
                }
            }


            ModelSystem.GrannyInstance instance = null;
            fromBoneComboBox.Items.Clear();

            // If dealing with a modelref get get instance for it, else use attachment instance
            if (mData.type == visualModelComponentOrAnimAttach.AttachType.ModelRef)
            {
                foreach (visualModel curModel in mVisualEditorPage.visualFile.model)
                {
                    if (string.Compare(curModel.name, mData.name, true) == 0)
                    {
                        if ((curModel.component != null) && (curModel.component.asset != null))
                        {
                            instance = curModel.component.asset.mInstance;
                        }
                    }
                }
            }
            else
            {
                instance = mData.mInstance;
            }

            if (instance != null)
            {
                List <string> boneList = new List <string>();
                boneList.Clear();
                instance.getBoneNames(ref boneList);

                // check all tags
                foreach (string curBoneName in boneList)
                {
                    if (!String.IsNullOrEmpty(curBoneName))
                    {
                        fromBoneComboBox.Items.Add(curBoneName);
                    }
                }
            }


            modelRefComboBox.Items.Clear();
            foreach (visualModel model in mVisualEditorPage.visualFile.model)
            {
                if (!String.IsNullOrEmpty(model.name))
                {
                    // skip model we are currently adding the attachment to (you can't attach to yourself)
                    if ((model.component == null) || (!model.component.attach.Contains(mData)))
                    {
                        modelRefComboBox.Items.Add(model.name);
                    }
                }
            }
        }