예제 #1
0
    public override FootIKConstraintJob Create(Animator animator, ref FootIKConstraintData data, Component component)
    {
        var job = new FootIKConstraintJob();

        job.leftToe    = ReadOnlyTransformHandle.Bind(animator, data.leftToe);
        job.leftAnkle  = ReadOnlyTransformHandle.Bind(animator, data.leftAnkle);
        job.rightToe   = ReadOnlyTransformHandle.Bind(animator, data.rightToe);
        job.rightAnkle = ReadOnlyTransformHandle.Bind(animator, data.rightAnkle);

        job.leftEffector  = ReadWriteTransformHandle.Bind(animator, data.leftEffector);
        job.rightEffector = ReadWriteTransformHandle.Bind(animator, data.rightEffector);

        job.hips = ReadWriteTransformHandle.Bind(animator, data.hips);

        job.weightShiftAngle      = FloatProperty.Bind(animator, component, data.weightShiftAngleProperty);
        job.weightShiftHorizontal = FloatProperty.Bind(animator, component, data.weightShiftHorizontalProperty);
        job.weightShiftVertical   = FloatProperty.Bind(animator, component, data.weightShiftVerticalProperty);

        job.maxFootRotationOffset = FloatProperty.Bind(animator, component, data.maxFootRotationOffsetProperty);

        job.ikOffset        = Vector2Property.Bind(animator, component, data.ikOffsetProperty);
        job.normalLeftFoot  = Vector3Property.Bind(animator, component, data.normalLeftFootProperty);
        job.normalRightFoot = Vector3Property.Bind(animator, component, data.normalRightFootProperty);

        return(job);
    }
        public ViewEditVector2Property(Vector2Property prop)
        {
            InitializeComponent();
            EditProperty = prop;

            txtX.Text = EditProperty.X.ToString();
            txtY.Text = EditProperty.Y.ToString();
        }
예제 #3
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();
            }
        }
예제 #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;
    }
예제 #5
0
 public bool equals(Vector2Property other)
 {
     return(this.GetValue() == other.GetValue());
 }
예제 #6
0
        private void CreateLotModel()
        {
            //Create the plane representing the lot (texture & size)
            if (UnitFileEntry.LotOverlayBoxSize != null)
            {
                Vector2Property lotSize = UnitFileEntry.LotOverlayBoxSize;

                RectangleVisual3D groundPlane = new RectangleVisual3D();

                groundPlane.Width     = (lotSize.X);
                groundPlane.Length    = (lotSize.Y);
                groundPlane.Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), -90));
                if (UnitFileEntry.LotOverlayBoxOffset != null)
                {
                    //    groundPlane.Transform = Transform3DHelper.CombineTransform(groundPlane.Transform, new TranslateTransform3D(-1 * UnitFileEntry.LotOverlayBoxOffset.X, -1 * UnitFileEntry.LotOverlayBoxOffset.Y, 0));
                }
                if (UnitFileEntry.LotPlacementTransform != null && UnitFileEntry.LotPlacementTransform.Count > 0)
                {
                    groundPlane.Transform = Transform3DHelper.CombineTransform(groundPlane.Transform, (Transform3D) new MatrixTransform3D(UnitFileEntry.LotPlacementTransform[0].GetAsMatrix3D()).Inverse);
                }

                if (UnitFileEntry.LotMask != null)
                {
                    DatabaseIndex index = DatabaseManager.Instance.Indices.Find(k => k.InstanceId == UnitFileEntry.LotMask.InstanceId && k.TypeId == 0x2f4e681c);
                    if (index != null)
                    {
                        Color color1 = Colors.Black;
                        Color color2 = Colors.Red;
                        Color color3 = Colors.Green;
                        Color color4 = Colors.Blue;

                        if (UnitFileEntry.LotColor1 != null)
                        {
                            color1 = Color.FromRgb((byte)(255 * UnitFileEntry.LotColor1.R), (byte)(255 * UnitFileEntry.LotColor1.G), (byte)(255 * UnitFileEntry.LotColor1.B));
                        }
                        if (UnitFileEntry.LotColor2 != null)
                        {
                            color2 = Color.FromRgb((byte)(255 * UnitFileEntry.LotColor2.R), (byte)(255 * UnitFileEntry.LotColor2.G), (byte)(255 * UnitFileEntry.LotColor2.B));
                        }
                        if (UnitFileEntry.LotColor3 != null)
                        {
                            color3 = Color.FromRgb((byte)(255 * UnitFileEntry.LotColor3.R), (byte)(255 * UnitFileEntry.LotColor3.G), (byte)(255 * UnitFileEntry.LotColor3.B));
                        }
                        if (UnitFileEntry.LotColor4 != null)
                        {
                            color4 = Color.FromRgb((byte)(255 * UnitFileEntry.LotColor4.R), (byte)(255 * UnitFileEntry.LotColor4.G), (byte)(255 * UnitFileEntry.LotColor4.B));
                        }

                        using (MemoryStream byteStream = new MemoryStream(index.GetIndexData(true)))
                        {
                            RasterImage rasterImage = RasterImage.CreateFromStream(byteStream, RasterChannel.Preview, color4, color3, color2, color1);
                            groundPlane.Material = new DiffuseMaterial(new ImageBrush(rasterImage.MipMaps[0]));
                        }
                    }

                    groundPlane.BackMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Transparent));
                }

                viewPort.Children.Add(groundPlane);
            }
        }
예제 #7
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);
    }