Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2012-05-16 18:30:41 +0400
committerAntony Riakiotakis <kalast@gmail.com>2012-05-16 18:30:41 +0400
commit5ff7ede1b5e50fd1c521dbf17760117c67be885e (patch)
tree6931ef43554d61d967a28ea2ab1fc68295a230a9 /source/blender/editors/mesh/editmesh_utils.c
parent2e89e0096a5520e3fa042eb748958507d251c77a (diff)
modal operation for bevel and inset:
This commit adds some first building blocks for the two operators to work modally based on mouse input. To make their function easier, two hotkeys are introduced, Ctrl+B for bevel and I for inset. TODO: After discussion with Campbell, we would like to add scale-style line indicators for the operators. This is already done for transform operators but a new interface for mesh operations may have to be written using pieces from that code since, strictly speaking bevel and inset are not exactly "transform" operators. Also, a better input method for inset is needed and more options exposed. The method implemented right now uses mouse move for thickness and ctrl-mouse move for depth. These are calculated using the distance of the selection center in screen space and the mouse position. While that may work and prevents abrupt changes in values when switching from thickness tweak mode to depth tweak mode, it limits the magnitude of values that can be put into the tool especially in small or large scale. Alternatives until a better method is written include: * use relative offset (works but may give strange results) * tweak manually after the operation.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_utils.c')
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 533ead1ff29..c3fbb2e8c16 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -58,6 +58,52 @@
#include "mesh_intern.h"
+/* mesh backup implementation. This would greatly benefit from some sort of binary diffing
+ * just as the undo stack would. So leaving this as an interface for further work */
+
+BMBackup EDBM_redo_state_store(BMEditMesh *em)
+{
+ BMBackup backup;
+ backup.bmcopy = BM_mesh_copy(em->bm);
+ return backup;
+}
+
+void EDBM_redo_state_restore(BMBackup backup, BMEditMesh *em, int recalctess)
+{
+ BMesh *tmpbm;
+ if (!em || !backup.bmcopy)
+ return;
+
+ BM_mesh_data_free(em->bm);
+ tmpbm = BM_mesh_copy(backup.bmcopy);
+ *em->bm = *tmpbm;
+ MEM_freeN(tmpbm);
+ tmpbm = NULL;
+
+ if (recalctess)
+ BMEdit_RecalcTessellation(em);
+}
+
+void EDBM_redo_state_free(BMBackup *backup, BMEditMesh *em, int recalctess)
+{
+ if (em && backup->bmcopy) {
+ BM_mesh_data_free(em->bm);
+ *em->bm = *backup->bmcopy;
+ }
+ else if (backup->bmcopy) {
+ BM_mesh_data_free(backup->bmcopy);
+ }
+
+ if (backup->bmcopy)
+ MEM_freeN(backup->bmcopy);
+ backup->bmcopy = NULL;
+
+ if (recalctess && em)
+ BMEdit_RecalcTessellation(em);
+}
+
+
+
void EDBM_mesh_normals_update(BMEditMesh *em)
{
BM_mesh_normals_update(em->bm, TRUE);