public static MyGuiEditorVoxelHandHelper GetEditorVoxelHandShapeHelper(MyVoxelHandShapeType shapeType)
 {
     MyGuiEditorVoxelHandHelper ret;
     if (m_editorVoxelHandShapeHelpers.TryGetValue(shapeType, out ret))
         return ret;
     else
         return null;
 }
        private void UpdateVoxelHandProperties()
        {
            MyVoxelHandShapeType       voxelHandShapeType = (MyVoxelHandShapeType)m_voxelShapeTypeRadioButtonGroup.GetSelectedKey().Value;
            MyMwcVoxelHandModeTypeEnum modeType           = (MyMwcVoxelHandModeTypeEnum)m_voxelShapeModeRadioButtonGroup.GetSelectedKey().Value;
            MyMwcVoxelMaterialsEnum?   materialEnum       = (MyMwcVoxelMaterialsEnum)m_voxelShapeMaterialCombobox.GetSelectedKey();

            MyEditorVoxelHand.SetVoxelProperties(voxelHandShapeType, m_voxelShapeDistanceSlider.GetValue(), modeType, materialEnum, m_isProjectedCheckbox.Checked, m_isProjectedOnWaypointCheckbox.Checked);
        }
        public static MyGuiEditorVoxelHandHelper GetEditorVoxelHandShapeHelper(MyVoxelHandShapeType shapeType)
        {
            MyGuiEditorVoxelHandHelper ret;

            if (m_editorVoxelHandShapeHelpers.TryGetValue(shapeType, out ret))
            {
                return(ret);
            }
            else
            {
                return(null);
            }
        }
        public static void SetVoxelProperties(MyVoxelHandShapeType voxelHandShapeType, float distance, MyMwcVoxelHandModeTypeEnum modeType, MyMwcVoxelMaterialsEnum?materialEnum, bool isProjected, bool isProjectedToWaypoints)
        {
            IsProjected            = isProjected;
            IsProjectedToWaypoints = isProjectedToWaypoints;
            // same shape type
            if (voxelHandShapeType == MyEditorVoxelHand.VoxelHandShape.GetShapeType())
            {
                //if ((size >= MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (size <= MyVoxelConstants.MAX_VOXEL_HAND_SIZE))
                {
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize(size);
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize2(size2);
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize3(size3);
                    MyEditorVoxelHand.VoxelHandShape.ModeType = modeType;
                    MyEditorVoxelHand.VoxelHandShape.Material = materialEnum;
                }
            }
            // another shape type
            else
            {
                //  float newShapeSize = size;
                // if ((newShapeSize < MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (newShapeSize > MyVoxelConstants.MAX_VOXEL_HAND_SIZE))

                float newShapeSize = MyVoxelConstants.DEFAULT_VOXEL_HAND_SIZE;

                MyMwcPositionAndOrientation positionAndOritentation = new MyMwcPositionAndOrientation(MySpectator.Position, Vector3.Forward, Vector3.Up);
                switch (voxelHandShapeType)
                {
                case MyVoxelHandShapeType.Sphere:
                    MyMwcObjectBuilder_VoxelHand_Sphere sphereObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Sphere(positionAndOritentation, newShapeSize, modeType);
                    MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandSphere();
                    ((MyVoxelHandSphere)MyEditorVoxelHand.VoxelHandShape).Init(sphereObjectBuilder, null);
                    break;

                case MyVoxelHandShapeType.Box:
                    MyMwcObjectBuilder_VoxelHand_Box boxObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Box(positionAndOritentation, newShapeSize, modeType);
                    MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandBox();
                    ((MyVoxelHandBox)MyEditorVoxelHand.VoxelHandShape).Init(boxObjectBuilder, null);
                    break;

                case MyVoxelHandShapeType.Cuboid:
                    MyMwcObjectBuilder_VoxelHand_Cuboid cuboidObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cuboid(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, newShapeSize, newShapeSize, modeType);
                    MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCuboid();
                    ((MyVoxelHandCuboid)MyEditorVoxelHand.VoxelHandShape).Init(cuboidObjectBuilder, null);
                    break;

                case MyVoxelHandShapeType.Cylinder:
                    MyMwcObjectBuilder_VoxelHand_Cylinder cylinderObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cylinder(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, modeType);
                    MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCylinder();
                    ((MyVoxelHandCylinder)MyEditorVoxelHand.VoxelHandShape).Init(cylinderObjectBuilder, null);
                    break;

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }
                MyEditorVoxelHand.VoxelHandShape.Material = materialEnum;
            }

            if (IsProjected)
            {
                if (!MyFakes.MWBUILDER)
                {
                    if ((distance >= MyVoxelConstants.MIN_PROJECTED_VOXEL_HAND_OFFSET) && (distance <= MyVoxelConstants.MAX_PROJECTED_VOXEL_HAND_OFFSET))
                    {
                        MyEditorVoxelHand.SetShapeDistance(distance);
                    }
                }
            }
            else if (IsProjectedToWaypoints)
            {
            }
            else
            {
                if ((distance >= MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE) && (distance <= MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE))
                {
                    MyEditorVoxelHand.SetShapeDistance(distance);
                }
            }

            MyEditorVoxelHand.UpdateShapePosition();
        }
        public static void SetVoxelProperties(MyVoxelHandShapeType voxelHandShapeType, float distance, MyMwcVoxelHandModeTypeEnum modeType, MyMwcVoxelMaterialsEnum? materialEnum, bool isProjected, bool isProjectedToWaypoints)
        {
            IsProjected = isProjected;
            IsProjectedToWaypoints = isProjectedToWaypoints;
            // same shape type
            if (voxelHandShapeType == MyEditorVoxelHand.VoxelHandShape.GetShapeType())
            {
                //if ((size >= MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (size <= MyVoxelConstants.MAX_VOXEL_HAND_SIZE))
                {
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize(size);
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize2(size2);
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize3(size3);
                    MyEditorVoxelHand.VoxelHandShape.ModeType = modeType;
                    MyEditorVoxelHand.VoxelHandShape.Material = materialEnum;
                }
            }
            // another shape type
            else 
            {
              //  float newShapeSize = size;
               // if ((newShapeSize < MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (newShapeSize > MyVoxelConstants.MAX_VOXEL_HAND_SIZE))
               
                float    newShapeSize = MyVoxelConstants.DEFAULT_VOXEL_HAND_SIZE;
                
                MyMwcPositionAndOrientation positionAndOritentation = new MyMwcPositionAndOrientation(MySpectator.Position, Vector3.Forward, Vector3.Up);
                switch (voxelHandShapeType) 
                {
                    case MyVoxelHandShapeType.Sphere:
                        MyMwcObjectBuilder_VoxelHand_Sphere sphereObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Sphere(positionAndOritentation, newShapeSize, modeType);
                        MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandSphere();
                        ((MyVoxelHandSphere)MyEditorVoxelHand.VoxelHandShape).Init(sphereObjectBuilder, null);
                        break;
                    case MyVoxelHandShapeType.Box:
                        MyMwcObjectBuilder_VoxelHand_Box boxObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Box(positionAndOritentation, newShapeSize, modeType);
                        MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandBox();
                        ((MyVoxelHandBox)MyEditorVoxelHand.VoxelHandShape).Init(boxObjectBuilder, null);
                        break;
                    case MyVoxelHandShapeType.Cuboid:
                        MyMwcObjectBuilder_VoxelHand_Cuboid cuboidObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cuboid(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, newShapeSize, newShapeSize, modeType);
                        MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCuboid();
                        ((MyVoxelHandCuboid)MyEditorVoxelHand.VoxelHandShape).Init(cuboidObjectBuilder, null);
                        break;
                    case MyVoxelHandShapeType.Cylinder:
                        MyMwcObjectBuilder_VoxelHand_Cylinder cylinderObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cylinder(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, modeType);
                        MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCylinder();
                        ((MyVoxelHandCylinder)MyEditorVoxelHand.VoxelHandShape).Init(cylinderObjectBuilder, null);
                        break;

                    default:
                        System.Diagnostics.Debug.Assert(false);
                        break;
                }
                MyEditorVoxelHand.VoxelHandShape.Material = materialEnum;
            }

            if (IsProjected)
            {
                if (!MyFakes.MWBUILDER)
                {
                    if ((distance >= MyVoxelConstants.MIN_PROJECTED_VOXEL_HAND_OFFSET) && (distance <= MyVoxelConstants.MAX_PROJECTED_VOXEL_HAND_OFFSET))
                        MyEditorVoxelHand.SetShapeDistance(distance);
                }
            }
            else if (IsProjectedToWaypoints)
            {
            }
            else
            {
                if ((distance >= MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE) && (distance <= MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE))
                    MyEditorVoxelHand.SetShapeDistance(distance);
            }

            MyEditorVoxelHand.UpdateShapePosition();
        }