private void AddCurvesForProp(MovieProperty prop, MovieCurveClip clip, int index) { float[] values = prop.GetValues(this.component); for (int j = 0; j < values.Length; j++) { int curveIdx = clip.AddCurve(new MovieCurve(clip.length, values[j], Translation.TryGetText("Property", prop.Name) + "." + j)); this.propIdxToCurveIdxes[index].Add(curveIdx); } }
public override void AddClipInternal(MovieCurveClip clip) { for (int i = 0; i < propsToChange.Count; i++) { MovieProperty prop = propsToChange[i]; float[] values = prop.GetValues(this.component); this.AddCurvesForProp(prop, clip, i); } }
public override float[] GetWorldValues() { List <float> values = new List <float>(); for (int i = 0; i < propsToChange.Count; i++) { MovieProperty prop = propsToChange[i]; float[] propValues = prop.GetValues(this.component); values.AddRange(propValues); } return(values.ToArray()); }
private void AddNewCurves(MovieProperty prop) { for (int i = 0; i < this.propsToChange.Count; i++) { if (!this.propIdxToCurveIdxes.ContainsKey(i)) { var existing = new List <int>(); this.propIdxToCurveIdxes.Add(i, existing); foreach (MovieCurveClip clip in this.clips) { AddCurvesForProp(prop, clip, i); } } } }
internal static XElement SerializeMovieProperty(MovieProperty prop, List <int> curveIndexes) { XElement elem = new XElement("Property"); if (prop.IsField()) { elem.SetAttributeValue("type", "field"); } else { elem.SetAttributeValue("type", "property"); } elem.SetAttributeValue("name", prop.Name); elem.SetAttributeValue("curveIndexes", SerializeIntList(curveIndexes)); return(elem); }
internal static MovieProperty DeserializeMovieProperty(XElement elem, Type componentType) { bool isField = elem.Attribute("type").Value == "field"; string propName = elem.Attribute("name").Value; MovieProperty prop = null; if (isField) { FieldInfo fi = componentType.GetField(propName); prop = new MovieProperty(fi); } else { PropertyInfo pi = componentType.GetProperty(propName); prop = new MovieProperty(pi); } return(prop); }
public void AddProp(MovieProperty movieProp) { this.propsToChange.Add(movieProp); this.AddNewCurves(movieProp); }
private void LoadProperties(Component component) { this.properties = component.GetType().GetProperties().Where(pr => MovieProperty.IsSupportedType(pr.PropertyType)).ToList(); this.propertyBox.Items = this.properties.Select(pr => new GUIContent(TryGetPropertyName(pr.Name))).ToList(); this.propertyBox.SelectedIndex = 0; this.fields = component.GetType().GetFields().Where(fi => MovieProperty.IsSupportedType(fi.FieldType)).ToList(); this.fieldBox.Items = this.fields.Select(fi => new GUIContent(TryGetPropertyName(fi.Name))).ToList(); this.fieldBox.SelectedIndex = 0; }