Example #1
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            CElement el = getSelectedElement();
            WElement ct = getSelectedElementControl();

            if (el != null)
            {
                CropTexture Frmct = new CropTexture(el);
                if (Frmct.ShowDialog() == true)
                {
                    int    x   = Convert.ToInt32(Canvas.GetLeft(Frmct.rect));
                    int    y   = Convert.ToInt32(Canvas.GetTop(Frmct.rect));
                    int    x1  = Convert.ToInt32(x + Frmct.rect.Width);
                    int    y1  = Convert.ToInt32(y + Frmct.rect.Height);
                    WPoint uv1 = new WPoint(x, y);
                    WPoint uv2 = new WPoint(x1, y1);
                    el.SetUV(uv1, uv2);
                    el.Texture                   = Frmct.SelectedTexture.Name;
                    ct.Source                    = el.getImage();
                    pictureBox1.Source           = ct.Source;
                    _propertyGrid.SelectedObject = el.Properties.Properties;
                    _propertyGrid.Update();
                }
            }
        }
Example #2
0
 public void setRect(WPoint R1, WPoint R2)
 {
     this.Rect1 = R1;
     this.Rect2 = R2;
     this.Properties.setVal("Rect", R1.X + ", " + R1.Y + " - " + R2.X + "," + R2.Y + " / 1024x768");
     this.Properties.setVal("Left", R1.X);
     this.Properties.setVal("Top", R1.Y);
     this.Properties.setVal("Width", R2.X - R1.X);
     this.Properties.setVal("Height", R2.Y - R1.Y);
 }
Example #3
0
        public void SetUV(WPoint uv1, WPoint uv2)
        {
            //this.props["UV"] = txt.Replace("UV: ", "");
            this.UV1 = uv1;
            this.UV2 = uv2;
            this.Properties.setVal("UV", uv1.X + "," + uv1.Y + " - " + uv2.X + "," + UV2.Y + " / 1024x1024");

            this.Properties.setVal("Image-Width", this.UV2.X - this.UV1.X);
            this.Properties.setVal("Image-Height", this.UV2.Y - this.UV1.Y);
        }