/// <summary> /// Set all the values through the constructor /// </summary> /// <param name="paramID">Index of this visual param</param> /// <param name="name">Internal name</param> /// <param name="group"></param> /// <param name="wearable"></param> /// <param name="label">Displayable label of this characteristic</param> /// <param name="labelMin">Displayable label for the minimum value of this characteristic</param> /// <param name="labelMax">Displayable label for the maximum value of this characteristic</param> /// <param name="def">Default value</param> /// <param name="min">Minimum value</param> /// <param name="max">Maximum value</param> /// <param name="isBumpAttribute">Is this param used for creation of bump layer?</param> /// <param name="drivers">Array of param IDs that are drivers for this parameter</param> /// <param name="alpha">Alpha blending/bump info</param> /// <param name="colorParams">Color information</param> public VisualParamEx(int paramID, string name, int group, string wearable, string label, string labelMin, string labelMax, float def, float min, float max, bool isBumpAttribute, int[] drivers, VisualAlphaParam? alpha, VisualColorParam? colorParams) { ParamID = paramID; Name = name; Group = group; Wearable = wearable; Label = label; LabelMin = labelMin; LabelMax = labelMax; DefaultValue = def; MaxValue = max; MinValue = min; IsBumpAttribute = isBumpAttribute; Drivers = drivers; AlphaParams = alpha; ColorParams = colorParams; sex = EparamSex.SEX_BOTH; }
public VisualParamEx(XmlNode node) { ParamID = Int32.Parse(node.Attributes.GetNamedItem("id").Value); Name = node.Attributes.GetNamedItem("name").Value; Group = Int32.Parse(node.Attributes.GetNamedItem("group").Value); //These dont exist for facal expresion morphs if (node.Attributes.GetNamedItem("wearable") != null) Wearable = node.Attributes.GetNamedItem("wearable").Value; MinValue = float.Parse(node.Attributes.GetNamedItem("value_min").Value, Utils.EnUsCulture); MaxValue = float.Parse(node.Attributes.GetNamedItem("value_max").Value, Utils.EnUsCulture); // These do not exists for driven parameters if (node.Attributes.GetNamedItem("label_min") != null) { LabelMin = node.Attributes.GetNamedItem("label_min").Value; } if (node.Attributes.GetNamedItem("label_max") != null) { LabelMax = node.Attributes.GetNamedItem("label_max").Value; } XmlNode sexnode = node.Attributes.GetNamedItem("sex"); if (sexnode != null) { if (sexnode.Value == "male") { sex = EparamSex.SEX_MALE; } else { sex = EparamSex.SEX_FEMALE; } } if (node.ParentNode.Name == "mesh") { this.morphmesh = node.ParentNode.Attributes.GetNamedItem("type").Value; } Group = int.Parse(node.Attributes.GetNamedItem("group").Value); if (Group == (int)GroupType.VISUAL_PARAM_GROUP_TWEAKABLE) { if (!tweakable_params.ContainsKey(ParamID)) //stupid duplicate shared params { tweakable_params.Add(this.ParamID, this); } else { Logger.Log(String.Format("Warning duplicate tweakable paramater ID {0} {1}", count, this.Name), Helpers.LogLevel.Warning); } count++; } if (allParams.ContainsKey(ParamID)) { //Logger.Log("Shared VisualParam id " + ParamID.ToString() + " "+Name, Helpers.LogLevel.Info); allParams[ParamID].identicalIds.Add(this); } else { //Logger.Log("VisualParam id " + ParamID.ToString() + " " + Name, Helpers.LogLevel.Info); allParams.Add(ParamID, this); } if (matchchildnode("param_skeleton", node)) { pType = ParamType.TYPE_BONEDEFORM; // If we are in the skeleton section then we also have bone deforms to parse BoneDeforms = new Dictionary<string, BoneDeform>(); if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes) { ParseBoneDeforms(node.ChildNodes[0].ChildNodes); } } if (matchchildnode("param_morph", node)) { pType = ParamType.TYPE_MORPH; VolumeDeforms = new Dictionary<string, VolumeDeform>(); if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes) { ParseVolumeDeforms(node.ChildNodes[0].ChildNodes); } } if (matchchildnode("param_driver", node)) { pType = ParamType.TYPE_DRIVER; childparams = new List<driven>(); if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes) //LAZY { ParseDrivers(node.ChildNodes[0].ChildNodes); } } if (matchchildnode("param_color", node)) { pType = ParamType.TYPE_COLOR; if (node.HasChildNodes) { foreach (XmlNode colorchild in node.ChildNodes) { if (colorchild.Name == "param_color") { //TODO extract <value color="50, 25, 5, 255" /> } } } } }
public VisualParamEx(XmlNode node, ParamType pt) { pType = pt; ParamID = Int32.Parse(node.Attributes.GetNamedItem("id").Value); Name = node.Attributes.GetNamedItem("name").Value; Group = Int32.Parse(node.Attributes.GetNamedItem("group").Value); //These dont exist for facal expresion morphs if (node.Attributes.GetNamedItem("wearable") != null) Wearable = node.Attributes.GetNamedItem("wearable").Value; MinValue = float.Parse(node.Attributes.GetNamedItem("value_min").Value); MaxValue = float.Parse(node.Attributes.GetNamedItem("value_max").Value); // These do not exists for driven parameters if (node.Attributes.GetNamedItem("label_min") != null) { LabelMin = node.Attributes.GetNamedItem("label_min").Value; } if (node.Attributes.GetNamedItem("label_max") != null) { LabelMax = node.Attributes.GetNamedItem("label_max").Value; } XmlNode sexnode = node.Attributes.GetNamedItem("sex"); if (sexnode != null) { if (sexnode.Value == "male") { sex = EparamSex.SEX_MALE; } else { sex = EparamSex.SEX_FEMALE; } } Group = int.Parse(node.Attributes.GetNamedItem("group").Value); if (Group == (int)GroupType.VISUAL_PARAM_GROUP_TWEAKABLE) { if (!tweakable_params.ContainsKey(ParamID)) //stupid duplicate shared params { tweakable_params.Add(this.ParamID, this); } //Logger.Log(String.Format("Adding tweakable paramater ID {0} {1}", count, this.Name), Helpers.LogLevel.Info); count++; } //TODO other paramaters but these arew concerned with editing the GUI display so not too fussed at the moment try { allParams.Add(ParamID, this); } catch { Logger.Log("Duplicate VisualParam in allParams id " + ParamID.ToString(), Helpers.LogLevel.Info); } if (pt == ParamType.TYPE_BONEDEFORM) { // If we are in the skeleton section then we also have bone deforms to parse BoneDeforms = new Dictionary<string, Vector3>(); if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes) { ParseBoneDeforms(node.ChildNodes[0].ChildNodes); } deformParams.Add(ParamID, this); } if (pt == ParamType.TYPE_MORPH) { VolumeDeforms = new Dictionary<string, VolumeDeform>(); if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes) { ParseVolumeDeforms(node.ChildNodes[0].ChildNodes); } try { morphParams.Add(ParamID, this); } catch { Logger.Log("Duplicate VisualParam in morphParams id " + ParamID.ToString(), Helpers.LogLevel.Info); } } if (pt == ParamType.TYPE_DRIVER) { childparams = new List<driven>(); if (node.HasChildNodes && node.ChildNodes[0].HasChildNodes) //LAZY { ParseDrivers(node.ChildNodes[0].ChildNodes); } drivenParams.Add(ParamID, this); } if (pt == ParamType.TYPE_COLOR) { if (node.HasChildNodes) { foreach (XmlNode colorchild in node.ChildNodes) { if (colorchild.Name == "param_color") { //TODO extract <value color="50, 25, 5, 255" /> } } } } }