/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="shapes"></param>
 /// <param name="mode"></param>
 /// <param name="includeShapes"></param>
 public DropToFloorAction(ShapeCollection shapes, Shape3D.DropToFloorMode mode, Vector3F axis, bool includeShapes)
     : base("Drop to Floor")
 {
     _shapes = shapes;
       _mode = mode;
       _axis = axis;
       _includeShapes = includeShapes;
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="shapes"></param>
 /// <param name="mode"></param>
 /// <param name="includeShapes"></param>
 public DropToFloorAction(ShapeCollection shapes, Shape3D.DropToFloorMode mode, Vector3F axis, bool includeShapes)
     : base("Drop to Floor")
 {
     _shapes        = shapes;
     _mode          = mode;
     _axis          = axis;
     _includeShapes = includeShapes;
 }
Esempio n. 3
0
        void CommonInit(ShapeCollection shapes, Shape3D.DropToFloorMode mode, Vector3F axis, bool includeShapes)
        {
            for (int i = 0; i < shapes.Count; i++)
            {
                Shape3D shape = shapes[i] as Shape3D;
                if (shape == null || !shape.Traceable || !shape.Modifiable)
                {
                    continue;
                }


                ShapeCollection colliderShapes = null;
                if (includeShapes)
                {
                    colliderShapes = EditorManager.Scene.AllShapesOfType(typeof(Shape3D), true);
                    if (colliderShapes.Contains(shape))
                    {
                        colliderShapes.Remove(shape);
                    }
                }

                // use a replacement action? (e.g. billboards rather want to drop every single instance)
                IAction custom = shape.GetCustomDropToFloorAction(mode, axis, colliderShapes);
                if (custom != null)
                {
                    this.Add(custom);
                    continue;
                }

                float fHeight = EditorApp.ActiveView.EngineManager.GetDropToFloorHeight(shape, mode, axis, colliderShapes);
                if (fHeight == 0.0f)
                {
                    continue;
                }
                this.Add(new MoveShapeAction(shape, shape.Position, shape.Position + axis * fHeight));
            }
        }
 protected BillboardDropToFloorAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _instances = (BillboardInstance[])info.GetValue("_instances", typeof(BillboardInstance[]));
       _shape = (BillboardGroupShape)info.GetValue("_shape", typeof(BillboardGroupShape));
       _mode = (Shape3D.DropToFloorMode)info.GetValue("_mode", typeof(Shape3D.DropToFloorMode));
       _oldHeights = (float[])info.GetValue("_oldHeights", typeof(float[]));
       _newHeights = (float[])info.GetValue("_newHeights", typeof(float[]));
 }
        public BillboardDropToFloorAction(BillboardGroupShape shape, BillboardInstance[] instances, Shape3D.DropToFloorMode mode, Vector3F axis, ShapeCollection colliderShapes)
        {
            _instances = instances;
              if (_instances == null)
            _instances = shape.Instances;

              _shape = shape;
              _mode = mode;
              _oldHeights = new float[_instances.Length];
              _newHeights = new float[_instances.Length];

              for (int i = 0; i < _instances.Length; i++)
            _oldHeights[i] = _instances[i].Z;
              _shape.EngineMesh.GetDropToFloorHeights(_shape, _instances, _mode, axis, colliderShapes);
              for (int i = 0; i < _instances.Length; i++)
            _newHeights[i] = _instances[i].Z;
        }