Ejemplo n.º 1
0
        public override MultiPositionInverseConstraintJob Create(Animator animator, ref T data, Component component)
        {
            var job = new MultiPositionInverseConstraintJob();

            job.driven       = ReadOnlyTransformHandle.Bind(animator, data.constrainedObject);
            job.drivenParent = ReadOnlyTransformHandle.Bind(animator, data.constrainedObject.parent);
            job.drivenOffset = Vector3Property.Bind(animator, component, data.offsetVector3Property);

            WeightedTransformArray sourceObjects = data.sourceObjects;

            WeightedTransformArrayBinder.BindReadWriteTransforms(animator, component, sourceObjects, out job.sourceTransforms);
            WeightedTransformArrayBinder.BindWeights(animator, component, sourceObjects, data.sourceObjectsProperty, out job.sourceWeights);

            job.sourceOffsets = new NativeArray <Vector3>(sourceObjects.Count, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);

            Vector3 drivenPos = data.constrainedObject.position;

            for (int i = 0; i < sourceObjects.Count; ++i)
            {
                job.sourceOffsets[i] = data.maintainOffset ? (drivenPos - sourceObjects[i].transform.position) : Vector3.zero;
            }

            return(job);
        }
Ejemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (this.DataContext is Vector2Property)
            {
                Vector2Property prop = this.DataContext as Vector2Property;

                ViewEditVector2Property editWindow = new ViewEditVector2Property(prop);
                if (editWindow.ShowDialog().GetValueOrDefault(false))
                {
                    prop = editWindow.EditProperty;
                    prop.OnPropertyChanged(new EventArgs());
                }
            }
            if (this.DataContext is Vector3Property)
            {
                Vector3Property prop = this.DataContext as Vector3Property;

                ViewEditVector3Property editWindow = new ViewEditVector3Property(prop);
                if (editWindow.ShowDialog().GetValueOrDefault(false))
                {
                    prop = editWindow.EditProperty;
                    prop.OnPropertyChanged(new EventArgs());
                }
            }

            if (this.DataContext is Vector4Property)
            {
                Vector4Property prop = this.DataContext as Vector4Property;

                ViewEditVector4Property editWindow = new ViewEditVector4Property(prop);
                if (editWindow.ShowDialog().GetValueOrDefault(false))
                {
                    prop = editWindow.EditProperty;
                    prop.OnPropertyChanged(new EventArgs());
                }
            }

            if (this.DataContext is BoundingBoxProperty)
            {
                BoundingBoxProperty prop = this.DataContext as BoundingBoxProperty;

                ViewEditBoundingBoxProperty editWindow = new ViewEditBoundingBoxProperty(prop);
                if (editWindow.ShowDialog().GetValueOrDefault(false))
                {
                    prop = editWindow.EditProperty;
                    prop.OnPropertyChanged(new EventArgs());
                }
            }

            if (this.DataContext is TextProperty)
            {
                TextProperty prop = this.DataContext as TextProperty;

                ViewEditTextProperty editWindow = new ViewEditTextProperty(prop);
                if (editWindow.ShowDialog().GetValueOrDefault(false))
                {
                    prop = editWindow.EditProperty;
                    prop.OnPropertyChanged(new EventArgs());
                }
            }

            if (this.DataContext is TransformProperty)
            {
                TransformProperty prop = this.DataContext as TransformProperty;

                ViewEditTransformProperty editWindow = new ViewEditTransformProperty(prop);
                if (editWindow.ShowDialog().GetValueOrDefault(false))
                {
                    prop = editWindow.EditProperty;
                    prop.OnPropertyChanged(new EventArgs());
                }
            }

            var expression = txtValue.GetBindingExpression(TextBlock.TextProperty);

            if (expression != null)
            {
                expression.UpdateTarget();
            }
        }
Ejemplo n.º 3
0
 public bool equals(Vector3Property other)
 {
     return(this.GetValue() == other.GetValue());
 }
Ejemplo n.º 4
0
    public void SetValue(object value)
    {
        string typeName = value.GetType().ToString();

        switch (typeName)
        {
        case "byte":
        {
            if (type == EPropertyType.EPropertyType_Byte)
            {
                ByteProperty prop = this as ByteProperty;
                prop.SetValue((byte)value);
                return;
            }
        }
        break;

        case "bool":
        {
            if (type == EPropertyType.EPropertyType_Bool)
            {
                BoolProperty prop = this as BoolProperty;
                prop.SetValue((bool)value);
                return;
            }
        }
        break;

        case "short":
        {
            if (type == EPropertyType.EPropertyType_Short)
            {
                ShortProperty prop = this as ShortProperty;
                prop.SetValue((short)value);
                return;
            }
        }
        break;

        case "int":
        {
            if (type == EPropertyType.EPropertyType_Int)
            {
                IntProperty prop = this as IntProperty;
                prop.SetValue((int)value);
                return;
            }
        }
        break;

        case "long":
        {
            if (type == EPropertyType.EPropertyType_Long)
            {
                LongProperty prop = this as LongProperty;
                prop.SetValue((long)value);
                return;
            }
        }
        break;

        case "float":
        {
            if (type == EPropertyType.EPropertyType_Float)
            {
                FloatProperty prop = this as FloatProperty;
                prop.SetValue((float)value);
                return;
            }
        }
        break;

        case "double":
        {
            if (type == EPropertyType.EPropertyType_Double)
            {
                DoubleProperty prop = this as DoubleProperty;
                prop.SetValue((double)value);
                return;
            }
        }
        break;

        case "Vector2":
        {
            if (type == EPropertyType.EPropertyType_Vector2)
            {
                Vector2Property prop = this as Vector2Property;
                prop.SetValue((Vector2)value);
                return;
            }
        }
        break;

        case "Vector3":
        {
            if (type == EPropertyType.EPropertyType_Vector3)
            {
                Vector3Property prop = this as Vector3Property;
                prop.SetValue((Vector3)value);
                return;
            }
        }
        break;

        case "Vector4":
        {
            if (type == EPropertyType.EPropertyType_Vector4)
            {
                Vector4Property prop = this as Vector4Property;
                prop.SetValue((Vector4)value);
                return;
            }
        }
        break;

        case "Quaternion":
        {
            if (type == EPropertyType.EPropertyType_Quaternion)
            {
                QuaternionProperty prop = this as QuaternionProperty;
                prop.SetValue((Quaternion)value);
                return;
            }
        }
        break;

        case "Matrix4x4":
        {
            if (type == EPropertyType.EPropertyType_Matrix4x4)
            {
                Matrix4x4Property prop = this as Matrix4x4Property;
                prop.SetValue((Matrix4x4)value);
                return;
            }
        }
        break;

        case "Color":
        {
            if (type == EPropertyType.EPropertyType_Color)
            {
                ColorProperty prop = this as ColorProperty;
                prop.SetValue((Color)value);
                return;
            }
        }
        break;

        case "string":
        {
            if (type == EPropertyType.EPropertyType_String)
            {
                StringProperty prop = this as StringProperty;
                prop.SetValue((string)value);
                return;
            }
        }
        break;

        case "object":
        {
            if (type == EPropertyType.EPropertyType_Object)
            {
                m_value = value;
                return;
            }
        }
        break;
        }
        return;
    }
Ejemplo n.º 5
0
    void Start()
    {
        m_sceneController = new SceneController();
        BaseState bs  = new BaseState();
        Property  pt1 = new StringProperty("pt1");
        Property  pt2 = new Vector2Property("vpt");
        Property  pt3 = new Matrix4x4Property("matpt");
        Property  pt4 = new QuaternionProperty("qpt");

        pt2.value = new Vector2(23, 11);
        pt1.value = "test";
        pt3.value = Matrix4x4.identity;
        pt4.value = Quaternion.identity;
        Property pt5 = new ColorProperty("cpt");
        Property pt6 = new IntProperty("ipt");
        Property pt7 = new Vector3Property("v3pt");

        pt5.value = Color.red;
        pt6.value = 612;
        pt7.value = new Vector3(12, 11, 33);

        PropertySet        ps  = new PropertySet("pset", null);
        PrpertySetProperty pts = new PrpertySetProperty("pts");
        PropertySet        ps2 = new PropertySet("pset2", null);

        ps2.SetProperty(pt5);
        ps2.SetProperty(pt6);
        ps2.SetProperty(pt7);
        pts.value = ps2;

        ps.SetProperty(pt1);
        ps.SetProperty(pt2);
        ps.SetProperty(pt3);
        ps.SetProperty(pt4);
        ps.SetProperty(pts);


        //bs.RegisterProperty(new StringProperty("name"));
        //bs.SetProperty("name", "lily");
        //object v = bs.GetPropertyValue("name");
        Property pt = ps.GetProperty("pt1");

        Debug.Log(pt.name + "  " + pt.value);
        pt = ps.GetProperty("vpt");
        Debug.Log(pt.name + "  " + pt.value);
        pt = ps.GetProperty("matpt");
        Debug.Log(pt.name + "  " + pt.value);
        pt = ps.GetProperty("qpt");
        Debug.Log(pt.name + "  " + pt.value);
        pt = ps.GetProperty("pts");
        PropertySet ps3 = pt.value as PropertySet;

        pt = ps3.GetProperty("cpt");
        Debug.Log(pt.name + "  " + pt.value);
        pt = ps3.GetProperty("ipt");
        Debug.Log(pt.name + "  " + pt.value);
        pt = ps3.GetProperty("v3pt");
        Debug.Log(pt.name + "  " + pt.value);
        //Debug.Log(pt2.name + "  " + pt2.value);
        //Debug.Log(pt3.name + "  " + pt3.value);
        //Debug.Log(pt4.name + "  " + pt4.value);
    }