Exemple #1
0
 public void AddKeyframeAtTimeUsingCurrentValue(USPropertyInfo propertyInfo, float time)
 {
     USUndoManager.RegisterCompleteObjectUndo(propertyInfo, "Add Keyframe");
     propertyInfo.AddKeyframe(time, AutoTangentMode);
     USUndoManager.RegisterCompleteObjectUndo(this, "Add Keyframe");
     RebuildCurvesOnNextGUI = true;
     AreCurvesDirty         = true;
     EditorWindow.Repaint();
 }
 public PropertyBox(USPropertyInfo propertyInfo, bool shouldShowFavouriteButton)
 {
     ShouldShowAddRemove       = true;
     AddingProperty            = false;
     ShouldDisplayComponent    = true;
     ShouldShowFavouriteButton = shouldShowFavouriteButton;
     componentImage            = EditorGUIUtility.ObjectContent(propertyInfo.Component, propertyInfo.Component.GetType()).image;
     Component    = propertyInfo.Component;
     PropertyName = propertyInfo.PropertyName;
 }
 public void AddProperty(USPropertyInfo propertyInfo)
 {
     if (propertyInfo.propertyName != null && this.ContainsProperty(propertyInfo.propertyName, propertyInfo.Component))
     {
         throw new Exception("Cannot Add a property that we already have");
     }
     if (propertyInfo.fieldName != null && this.ContainsProperty(propertyInfo.fieldName, propertyInfo.Component))
     {
         throw new Exception("Cannot Add a field that we already have");
     }
     this.propertyList.Add(propertyInfo);
 }
        private void AddProperty()
        {
            var usPropertyInfo = CreateInstance <USPropertyInfo>();

            USUndoManager.RegisterCreatedObjectUndo(usPropertyInfo, "Add Curve");
            USUndoManager.PropertyChange(PropertyTimeline, "Add Curve");
            USUndoManager.PropertyChange(this, "Add Curve");
            foreach (var child in Children)
            {
                USUndoManager.PropertyChange(child, "Add Curve");
            }

            object propertyValue = null;

            usPropertyInfo.Component = PropertyFieldInfo.Component;

            if (PropertyFieldInfo.Property != null)
            {
                usPropertyInfo.propertyInfo = PropertyFieldInfo.Property;
                propertyValue = PropertyFieldInfo.Property.GetValue(PropertyFieldInfo.Component, null);
            }
            else if (PropertyFieldInfo.Field != null)
            {
                usPropertyInfo.fieldInfo = PropertyFieldInfo.Field;
                propertyValue            = PropertyFieldInfo.Field.GetValue(PropertyFieldInfo.Component);
            }

            usPropertyInfo.InternalName = MappedType;
            usPropertyInfo.CreatePropertyInfo(USPropertyInfo.GetMappedType(propertyValue.GetType()));
            usPropertyInfo.AddKeyframe(propertyValue, 0.0f, CurveAutoTangentModes.None);
            usPropertyInfo.AddKeyframe(propertyValue, PropertyTimeline.Sequence.Duration, CurveAutoTangentModes.None);
            PropertyTimeline.AddProperty(usPropertyInfo);

            for (var curveIndex = 0; curveIndex < usPropertyInfo.curves.Count; curveIndex++)
            {
                ((USPropertyMemberHierarchyItem)Children[curveIndex]).Curve = usPropertyInfo.curves[curveIndex];
            }

            usPropertyInfo.StoreBaseState();

            IsSelected = true;
            foreach (var child in Children)
            {
                ((USPropertyMemberHierarchyItem)child).IsSelected = true;
            }
        }
Exemple #5
0
        private void AddProperty(PropertyBox propertyBox)
        {
            Debug.Log("Adding Property " + propertyBox);

            var usPropertyInfo = CreateInstance <USPropertyInfo>();

            USUndoManager.RegisterCreatedObjectUndo(usPropertyInfo, "Add Curve");
            USUndoManager.RegisterCompleteObjectUndo(PropertyTimeline, "Add Curve");
            USUndoManager.RegisterCompleteObjectUndo(this, "Add Curve");
            USUndoManager.RegisterCompleteObjectUndo(CurveEditor, "Add Curve");

            object propertyValue = null;

            usPropertyInfo.Component = propertyBox.PropertyFieldInfo.Component;

            if (propertyBox.PropertyFieldInfo.Property != null)
            {
                usPropertyInfo.propertyInfo = propertyBox.PropertyFieldInfo.Property;
                propertyValue = propertyBox.PropertyFieldInfo.Property.GetValue(propertyBox.PropertyFieldInfo.Component, null);
            }
            else if (propertyBox.PropertyFieldInfo.Field != null)
            {
                usPropertyInfo.fieldInfo = propertyBox.PropertyFieldInfo.Field;
                propertyValue            = propertyBox.PropertyFieldInfo.Field.GetValue(propertyBox.PropertyFieldInfo.Component);
            }

            usPropertyInfo.InternalName = propertyBox.PropertyFieldInfo.MappedType;
            usPropertyInfo.CreatePropertyInfo(USPropertyInfo.GetMappedType(propertyValue.GetType()));
            usPropertyInfo.AddKeyframe(propertyValue, 0.0f, CurveAutoTangentModes.None);
            usPropertyInfo.AddKeyframe(propertyValue, PropertyTimeline.Sequence.Duration, CurveAutoTangentModes.None);
            PropertyTimeline.AddProperty(usPropertyInfo);

            usPropertyInfo.StoreBaseState();

            var newCurves = CurveEditor.Curves;

            newCurves.AddRange(usPropertyInfo.curves);
            CurveEditor.Curves = newCurves;

            propertyBox.ShouldShowFavouriteButton = false;
            propertyBox.ShouldShowAddRemove       = false;
            propertyBoxes.Add(propertyBox);
        }
 public override void Process(float sequencerTime, float playbackRate)
 {
     if (!base.AffectedObject)
     {
         return;
     }
     for (int i = 0; i < this.propertyList.Count; i++)
     {
         USPropertyInfo uSPropertyInfo = this.propertyList[i];
         if (uSPropertyInfo != null)
         {
             if (!uSPropertyInfo.Component)
             {
                 uSPropertyInfo.Component = base.AffectedObject.GetComponent(uSPropertyInfo.ComponentType);
             }
             if (uSPropertyInfo.Component && uSPropertyInfo.Component.transform != base.AffectedObject)
             {
                 uSPropertyInfo.Component = base.AffectedObject.GetComponent(uSPropertyInfo.ComponentType);
             }
             uSPropertyInfo.SetValue(sequencerTime);
         }
     }
 }
Exemple #7
0
 public void RemoveProperty(USPropertyInfo propertyInfo)
 {
     propertyList.Remove(propertyInfo);
 }