protected virtual bool StartEditMode(Camera camera)
		{
			if (editMode == EditMode.EditShape ||
				editMode == EditMode.ExtrudeShape)
			{
				return false;
			}

			Undo.RecordObject(this, "Created shape");
			if (GUIUtility.hotControl == shapeId)
			{
				GUIUtility.hotControl = 0;
				GUIUtility.keyboardControl = 0;
				EditorGUIUtility.SetWantsMouseJumping(0);
				EditorGUIUtility.editingTextField = false;
			}
			
			CalculateWorldSpaceTangents(camera);
			brushPosition = buildPlane.Project(ShapeSettings.GetCenter(buildPlane));
			editMode = EditMode.EditShape;

			CSGPlane newPlane = buildPlane;
			ShapeSettings.CalculatePlane(ref newPlane);
			if (newPlane.normal.sqrMagnitude != 0)
				buildPlane = newPlane;

            if (ModelTraits.IsModelEditable(geometryModel))
                SelectionUtility.LastUsedModel = geometryModel;

			UpdateBaseShape();

			//StartExtrudeMode();
			//GrabHeightHandle(ignoreFirstMouseUp: true);
			return true;
		}
Beispiel #2
0
        protected virtual bool StartEditMode()
        {
            if (editMode == EditMode.EditShape ||
                editMode == EditMode.ExtrudeShape)
            {
                return(false);
            }
            Undo.RecordObject(this, "Created shape");
            if (GUIUtility.hotControl == shapeId)
            {
                GUIUtility.hotControl      = 0;
                GUIUtility.keyboardControl = 0;
                EditorGUIUtility.SetWantsMouseJumping(0);
                EditorGUIUtility.editingTextField = false;
            }

            CalculateWorldSpaceTangents();
            brushPosition = ShapeSettings.GetCenter(gridTangent, gridBinormal);
            editMode      = EditMode.EditShape;

            CSGPlane newPlane = buildPlane;

            ShapeSettings.CalculatePlane(ref newPlane);
            if (newPlane.normal.sqrMagnitude != 0)
            {
                buildPlane = newPlane;
            }

            if (geometryModel &&
                geometryModel.isActiveAndEnabled)
            {
                SelectionUtility.LastUsedModel = geometryModel;
            }

            UpdateBaseShape();

            //StartExtrudeMode();
            //GrabHeightHandle(ignoreFirstMouseUp: true);
            return(true);
        }