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); } } } } }
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); } } } }