public override void Get2DViewActions(Scene2DView view, Scene2DActions actions)
 {
     base.Get2DViewActions(view, actions);
     if (!view.TouchesSelectionMarquee(SectorExtent))
     {
         return;
     }
     // commented out until supported
     //actions.AddAction(this, VA_UNLOCK_SECTORS);
     if (SectorVisibleMask == 0)
     {
         actions.AddAction(this, VA_MAKE_VISIBLE);
     }
     else
     {
         actions.AddAction(this, VA_MAKE_INVISIBLE);
     }
     if (SectorCollisionMask == 0)
     {
         actions.AddAction(this, VA_ENABLE_COLLISION);
     }
     else
     {
         actions.AddAction(this, VA_DISABLE_COLLISION);
     }
 }
Ejemplo n.º 2
0
 void TriggerRepaint2D(bool bForce)
 {
     if (_bPreview2D || bForce)
     {
         Scene2DView.Update2DViews();
     }
 }
Ejemplo n.º 3
0
 public override void Get2DViewActions(Scene2DView view, Scene2DActions actions)
 {
     base.Get2DViewActions(view, actions);
     if (!this.Modifiable || !view.SelectionMarqueeWorldBox.Valid)
     {
         return;
     }
     actions.AddAction(this, VA_AS_SELECTION);
 }
Ejemplo n.º 4
0
 public override Scene2DViewFilterCategory GetScene2DRenderingFilter(Scene2DView view)
 {
     if (FilterCat == null)
     {
         FilterCat = view.CreateFilterCategory("Terrain selection");
         if (IconIndex > 0)
         {
             FilterCat.Image = EditorManager.GUI.ShapeTreeImages.ImageList.Images[IconIndex];
         }
     }
     return(FilterCat);
 }
Ejemplo n.º 5
0
        public override void Perform2DViewAction(Scene2DView view, GroupAction parent, string action)
        {
            base.Perform2DViewAction(view, parent, action);
            BoundingBox box = view.SelectionMarqueeWorldBox;

            if (action == VA_AS_SELECTION && box.Valid)
            {
                Vector3F center = box.Center;
                float    fRadX  = box.SizeX * 0.5f;
                float    fRadY  = box.SizeY * 0.5f;
                parent.Add(new MoveShapeAction(this, this.Position, center));
                parent.Add(SetPropertyAction.CreateSetPropertyAction(this, "MinX", fRadX)); // min values are also positive
                parent.Add(SetPropertyAction.CreateSetPropertyAction(this, "MinY", fRadY));
                parent.Add(SetPropertyAction.CreateSetPropertyAction(this, "MaxX", fRadX));
                parent.Add(SetPropertyAction.CreateSetPropertyAction(this, "MaxY", fRadY));
            }
        }
 public override Scene2DViewFilterCategory GetScene2DRenderingFilter(Scene2DView view)
 {
     if (FilterCat == null)
     {
         FilterCat = view.CreateFilterCategory("Terrain");
         int iIndex = TerrainShape.GetTerrainIconIndex();
         if (iIndex >= 0)
         {
             FilterCat.Image = EditorManager.GUI.ShapeTreeImages.ImageList.Images[iIndex];
         }
     }
     if (FilterCollisionCat == null)
     {
         FilterCollisionCat         = view.CreateFilterCategory("Terrain Collision");
         FilterCollisionCat.Image   = FilterCat.Image;
         FilterCollisionCat.Enabled = false; // disabled by default
     }
     return(FilterCat);
 }
Ejemplo n.º 7
0
        void UpdateSelectionRect()
        {
            Vector3F pos = this.Position;

            _selection.SetExtent(
                pos.X - _fMinX * ScaleX,
                pos.Y - _fMinY * ScaleY,
                pos.X + _fMaxX * ScaleX,
                pos.Y + _fMaxY * ScaleY
                );
            _selection.DisplayZ = pos.Z;

            if (_hotspotMinX != null)
            {
                _hotspotMinX.DisplayScaling = ScaleX;
                _hotspotMaxX.DisplayScaling = ScaleX;
                _hotspotMinY.DisplayScaling = ScaleY;
                _hotspotMaxY.DisplayScaling = ScaleY;
            }
            Scene2DView.Update2DViews();
        }
 public override void Perform2DViewAction(Scene2DView view, GroupAction parent, string action)
 {
     base.Perform2DViewAction(view, parent, action);
     if (action == VA_UNLOCK_SECTORS)
     {
         // do something here...
     }
     if (action == VA_MAKE_VISIBLE)
     {
         parent.Add(new SetSectorPropertyAction(this, "SectorVisibleMask", FlagsInt32_e.All));
     }
     else if (action == VA_MAKE_INVISIBLE)
     {
         parent.Add(new SetSectorPropertyAction(this, "SectorVisibleMask", FlagsInt32_e.None));
     }
     else if (action == VA_ENABLE_COLLISION)
     {
         parent.Add(new SetSectorPropertyAction(this, "SectorCollisionMask", FlagsInt16_e.All));
     }
     else if (action == VA_DISABLE_COLLISION)
     {
         parent.Add(new SetSectorPropertyAction(this, "SectorCollisionMask", FlagsInt16_e.None));
     }
 }
Ejemplo n.º 9
0
        public override void Get2DViewActions(Scene2DView view, Scene2DActions actions)
        {
            base.Get2DViewActions(view, actions);

              if (!view.TouchesSelectionMarquee(this.AbsoluteBoundingBox))
            return;

              if (this.Modifiable)
              {
            actions.AddAction(this, VA_EDIT_SECTOR_PROPERTIES);
            actions.AddAction(this, VA_IMPORT_HEIGHTMAP);
            actions.AddAction(this, VA_REPAIR_SECTORS);
              }
              actions.AddAction(this, VA_RELOAD_SECTORS);
        }
 public override float GetScene2DRenderingSortingKey(Scene2DView view)
 {
     return(-100000000.0f); // below everything else
 }
 public override void Undo()
 {
     base.Undo();
     Scene2DView.Update2DViews();
 }
Ejemplo n.º 12
0
        public override void Perform2DViewAction(Scene2DView view, GroupAction parent, string action)
        {
            base.Perform2DViewAction(view, parent, action);

              // sector range - used by all actions
              BoundingBox selBox = view.SelectionMarqueeWorldBox;
              int x1, y1, x2, y2;
              Config.GetSectorIndicesAtWorldPos(selBox.vMin, out x1, out y1);
              Config.GetSectorIndicesAtWorldPos(selBox.vMax, out x2, out y2);
              Config.ClampSectorRange(ref x1, ref y1, ref x2, ref y2);

              if (action == VA_EDIT_SECTOR_PROPERTIES)
              {
             ShapeCollection shapes = new ShapeCollection();
             for (int sy = y1; sy <= y2; sy++)
               for (int sx = x1; sx <= x2; sx++)
             shapes.Add(GetZone(sx, sy));
             EditorManager.SelectedShapes = shapes;
              }
              else if (action == VA_IMPORT_HEIGHTMAP)
              {
            ImportHeightmapDDS import = new ImportHeightmapDDS();
            x1 *= Config.SamplesPerSectorX;
            y1 *= Config.SamplesPerSectorY;
            x2 = (x2 + 1) * Config.SamplesPerSectorX;
            y2 = (y2 + 1) * Config.SamplesPerSectorY;
            ApplyHeightmapFilterDlg.RunFilter(import, x1, y1, x2, y2);
              }
              else if (action == VA_REPAIR_SECTORS)
              {
            EditorManager.Progress.ShowProgressDialog("Repair Sectors");
            EngineTerrain.EnsureSectorRangeLoaded(x1, y1, x2, y2, (int)SectorEditorFlags_e.AnythingDirty, true, true, EditorManager.Progress);
            EditorManager.Progress.HideProgressDialog();
              }
              else if (action == VA_RELOAD_SECTORS)
              {
            EditorManager.Progress.ShowProgressDialog("Reload Sectors");
            EngineTerrain.ReloadSectorRange(x1, y1, x2, y2, false, EditorManager.Progress);
            EditorManager.Progress.HideProgressDialog();
            EditorManager.ActiveView.UpdateView(false);
              }
        }
 public override void Do()
 {
     base.Do();
     Scene2DView.Update2DViews();
 }
Ejemplo n.º 14
0
        public override void OnPaintScene2DView(Scene2DView view, PaintEventArgs e)
        {
            base.OnPaintScene2DView(view, e);

              if (_minimapImage != null)
              {
            BoundingBox abs = AbsoluteBoundingBox;
            Point p1 = view.Transform(abs.vMin);
            Point p2 = view.Transform(abs.vMax);
            Rectangle dst = new Rectangle(p1.X, p1.Y, p2.X - p1.X, p2.Y - p1.Y);

            _2dViewAttr.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
            //        e.Graphics.DrawImage(_minimapImage, dst);
            e.Graphics.DrawImage(_minimapImage, dst, 0, 0, _minimapImage.Width, _minimapImage.Height, GraphicsUnit.Pixel, _2dViewAttr);
              }
        }
 public override void Perform2DViewAction(Scene2DView view, GroupAction parent, string action)
 {
     base.Perform2DViewAction(view, parent, action);
       if (action == VA_UNLOCK_SECTORS)
       {
     // do something here...
       }
       if (action == VA_MAKE_VISIBLE)
       {
     parent.Add(new SetSectorPropertyAction(this, "SectorVisibleMask", FlagsInt32_e.All));
       }
       else if (action == VA_MAKE_INVISIBLE)
       {
     parent.Add(new SetSectorPropertyAction(this, "SectorVisibleMask", FlagsInt32_e.None));
       }
       else if (action == VA_ENABLE_COLLISION)
       {
     parent.Add(new SetSectorPropertyAction(this, "SectorCollisionMask", FlagsInt16_e.All));
       }
       else if (action == VA_DISABLE_COLLISION)
       {
     parent.Add(new SetSectorPropertyAction(this, "SectorCollisionMask", FlagsInt16_e.None));
       }
 }
 public override Scene2DViewFilterCategory GetScene2DRenderingFilter(Scene2DView view)
 {
     if (FilterCat == null)
       {
     FilterCat = view.CreateFilterCategory("Terrain");
     int iIndex = TerrainShape.GetTerrainIconIndex();
     if (iIndex >= 0)
       FilterCat.Image = EditorManager.GUI.ShapeTreeImages.ImageList.Images[iIndex];
       }
       if (FilterCollisionCat == null)
       {
     FilterCollisionCat = view.CreateFilterCategory("Terrain Collision");
     FilterCollisionCat.Image = FilterCat.Image;
     FilterCollisionCat.Enabled = false; // disabled by default
       }
       return FilterCat;
 }
 public override void Get2DViewActions(Scene2DView view, Scene2DActions actions)
 {
     base.Get2DViewActions(view, actions);
       if (!view.TouchesSelectionMarquee(SectorExtent))
     return;
       // commented out until supported
       //actions.AddAction(this, VA_UNLOCK_SECTORS);
       if (SectorVisibleMask == 0)
     actions.AddAction(this, VA_MAKE_VISIBLE);
       else
     actions.AddAction(this, VA_MAKE_INVISIBLE);
       if (SectorCollisionMask == 0)
     actions.AddAction(this, VA_ENABLE_COLLISION);
       else
     actions.AddAction(this, VA_DISABLE_COLLISION);
 }
 public override void Perform2DViewAction(Scene2DView view, GroupAction parent, string action)
 {
     base.Perform2DViewAction(view, parent, action);
       BoundingBox box = view.SelectionMarqueeWorldBox;
       if (action == VA_AS_SELECTION && box.Valid)
       {
     Vector3F center = box.Center;
     float fRadX = box.SizeX * 0.5f;
     float fRadY = box.SizeY * 0.5f;
     parent.Add(new MoveShapeAction(this, this.Position, center));
     parent.Add(SetPropertyAction.CreateSetPropertyAction(this, "MinX", fRadX)); // min values are also positive
     parent.Add(SetPropertyAction.CreateSetPropertyAction(this, "MinY", fRadY));
     parent.Add(SetPropertyAction.CreateSetPropertyAction(this, "MaxX", fRadX));
     parent.Add(SetPropertyAction.CreateSetPropertyAction(this, "MaxY", fRadY));
       }
 }
 public override void Get2DViewActions(Scene2DView view, Scene2DActions actions)
 {
     base.Get2DViewActions(view, actions);
       if (!this.Modifiable || !view.SelectionMarqueeWorldBox.Valid)
     return;
       actions.AddAction(this, VA_AS_SELECTION);
 }
 public override BoundingBox GetAbsoluteBoundingBox(Scene2DView view)
 {
     return SectorExtent; // no margins
 }
Ejemplo n.º 21
0
 public override Scene2DViewFilterCategory GetScene2DRenderingFilter(Scene2DView view)
 {
     if (FilterCat == null)
       {
     FilterCat = view.CreateFilterCategory("Terrain"); // might use "Terrain mini map"
     int iIndex = TerrainShape.GetTerrainIconIndex();
     if (iIndex >= 0)
       FilterCat.Image = EditorManager.GUI.ShapeTreeImages.ImageList.Images[iIndex];
       }
       return FilterCat;
 }
 public override float GetScene2DRenderingSortingKey(Scene2DView view)
 {
     return -100000000.0f; // below everything else
 }
Ejemplo n.º 23
0
 public override float GetScene2DRenderingSortingKey(Scene2DView view)
 {
     return 100000000.0f; // under ther sectors
 }
Ejemplo n.º 24
0
 public override Scene2DViewFilterCategory GetScene2DRenderingFilter(Scene2DView view)
 {
     if (FilterCat == null)
       {
     FilterCat = view.CreateFilterCategory("Trigger Boxes");
     if (IconIndex > 0)
       FilterCat.Image = EditorManager.GUI.ShapeTreeImages.ImageList.Images[IconIndex];
       }
       return FilterCat;
 }
 public override BoundingBox GetAbsoluteBoundingBox(Scene2DView view)
 {
     return(SectorExtent); // no margins
 }