public override void ReflectAttr(DependencyAttrItem relatedAttrItem, DependencyAttributeChangedEventArgs args)
        {
            int n = (attributes.Count) / 4 - 1;

            if (!int.TryParse(NonMacrolize(3), out int nAttr))
            {
                nAttr = 0;
            }
            nAttr = nAttr > App.mxUAttr ? App.mxUAttr : nAttr;
            nAttr = nAttr < 0 ? 0 : nAttr;
            if (n != nAttr)
            {
                if (n < nAttr)
                {
                    for (int i = n + 1; i <= nAttr; i++)
                    {
                        attributes.Add(new AttrItem("Value " + i + " name", "_speed", this, "prop"));
                        attributes.Add(new AttrItem("Target value " + i, "1", this));
                        attributes.Add(new AttrItem("Interpolation mode " + i, "MOVE_NORMAL", this, "interpolation"));
                        attributes.Add(new AttrItem("Modification mode " + i, "MODE_SET", this, "modification"));
                    }
                }
                else
                {
                    for (int i = 0; i < 4 * (n - nAttr); i++)
                    {
                        attributes.RemoveAt(nAttr * 4 + 4);
                    }
                }
            }
        }
        public override void ReflectAttr(DependencyAttrItem relatedAttrItem, DependencyAttributeChangedEventArgs args)
        {
            int n = (attributes.Count - 4) / 3;

            if (!int.TryParse(attributes[3].AttrInput, out int nAttr))
            {
                nAttr = 0;
            }
            nAttr = nAttr > AppConstants.mxUAttr ? AppConstants.mxUAttr : nAttr;
            nAttr = nAttr < 0 ? 0 : nAttr;
            if (n != nAttr)
            {
                if (n < nAttr)
                {
                    for (int i = n + 1; i <= nAttr; i++)
                    {
                        attributes.Add(new AttrItem("Prop " + i + " name", this));
                        attributes.Add(new AttrItem("Prop " + i + " is string", "false", this, "bool"));
                        attributes.Add(new AttrItem("Prop " + i + " edit window", this, "editWindow"));
                    }
                }
                else
                {
                    for (int i = 0; i < 3 * (n - nAttr); i++)
                    {
                        attributes.RemoveAt(nAttr * 3 + 4);
                    }
                }
            }
        }
        public override void ReflectAttr(DependencyAttrItem relatedAttrItem, DependencyAttributeChangedEventArgs args)
        {
            int n = (attributes.Count - 1) / 2;

            if (!int.TryParse(NonMacrolize(0), out int nAttr))
            {
                nAttr = 0;
            }
            nAttr = nAttr > AppConstants.mxUAttr ? AppConstants.mxUAttr : nAttr;
            nAttr = nAttr < 0 ? 0 : nAttr;
            if (n != nAttr)
            {
                if (n < nAttr)
                {
                    for (int i = n + 1; i <= nAttr; i++)
                    {
                        attributes.Add(new AttrItem("Use var", this));
                        attributes.Add(new AttrItem("To record", this, "target"));
                    }
                }
                else
                {
                    for (int i = 0; i < 2 * (n - nAttr); i++)
                    {
                        attributes.RemoveAt(nAttr * 2 + 1);
                    }
                }
            }
        }
Exemple #4
0
 public override void ReflectAttr(DependencyAttrItem relatedAttrItem, DependencyAttributeChangedEventArgs args)
 {
     //if (relatedAttrItem.attrInput != originalvalue)
     {
         while (attributes.Count > 1)
         {
             attributes.RemoveAt(1);
         }
         MetaModel target = GetModel();
         if (target != null)
         {
             string[,] props = GetProperties(target);
             int n = props.GetLength(0);
             for (int i = 0; i < n; i++)
             {
                 attributes.Add(new AttrItem(props[i, 0], this, props[i, 2]));
             }
         }
     }
 }