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:
authorCampbell Barton <ideasman42@gmail.com>2011-03-10 08:52:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-10 08:52:16 +0300
commit3ad8fd44c4047d0ee95eca50de066ad87419c738 (patch)
treeecc07527b1f39de1f2b660318dcbeca02d405956 /source/blender/editors
parent6a324428554a5a01da58af810fd18f7b12a1f373 (diff)
request from Jedrzej Slewczuk's:
Option for tagging creases (Ctrl+RMB) to also re-unwrap the mesh. In 2.42 this could be done by setting rt==8 (very hidden), now its a little less hidden (in the toolbar).
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_uvedit.h6
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c11
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c42
3 files changed, 44 insertions, 15 deletions
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index a0c4148c055..b975be54f5f 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -66,11 +66,15 @@ void uvedit_uv_select(struct Scene *scene, struct EditFace *efa, struct MTFace *
int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, float co[2], float uv[2]);
-/* uvedit_unwrap.c */
+/* uvedit_unwrap_ops.c */
void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
void ED_uvedit_live_unwrap_re_solve(void);
void ED_uvedit_live_unwrap_end(short cancel);
+/* single call up unwrap using scene settings, used for edge tag unwrapping */
+void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel);
+
+/* uvedit_draw.c */
void draw_uvedit_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct Object *obedit);
#endif /* ED_UVEDIT_H */
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 50ea99f46ba..5075ae94f8d 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -79,6 +79,7 @@ editmesh_mods.c, UI level access, no geometry changes
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
+#include "ED_uvedit.h"
#include "BIF_gl.h"
@@ -2201,7 +2202,15 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2])
me->drawflag |= ME_DRAWBWEIGHTS;
break;
}
-
+
+ /* live unwrap while tagging */
+ if( (vc.scene->toolsettings->edge_mode_live_unwrap) &&
+ (vc.scene->toolsettings->edge_mode == EDGE_MODE_TAG_SEAM) &&
+ (CustomData_has_layer(&em->fdata, CD_MTFACE))
+ ) {
+ ED_unwrap_lscm(vc.scene, vc.obedit, FALSE); /* unwrap all not just sel */
+ }
+
DAG_id_tag_update(vc.obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
}
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index e0dbe8407d3..d4e6b3b98b9 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -812,41 +812,57 @@ static void uv_map_clip_correct(EditMesh *em, wmOperator *op)
/* ******************** Unwrap operator **************** */
+/* assumes UV layer is checked, doesn't run update funcs */
+void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
+{
+ EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+
+ const short fill_holes= scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
+ const short correct_aspect= !(scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT);
+
+ ParamHandle *handle= construct_param_handle(scene, em, 0, fill_holes, sel, correct_aspect);
+
+ param_lscm_begin(handle, PARAM_FALSE, scene->toolsettings->unwrapper == 0);
+ param_lscm_solve(handle);
+ param_lscm_end(handle);
+
+ param_pack(handle, scene->toolsettings->uvcalc_margin);
+
+ param_flush(handle);
+
+ param_delete(handle);
+
+ BKE_mesh_end_editmesh(obedit->data, em);
+}
+
static int unwrap_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
- EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
- ParamHandle *handle;
int method = RNA_enum_get(op->ptr, "method");
int fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
/* add uvs if they don't exist yet */
if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
- BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_CANCELLED;
}
/* remember last method for live unwrap */
scene->toolsettings->unwrapper = method;
- handle= construct_param_handle(scene, em, 0, fill_holes, 1, correct_aspect);
-
- param_lscm_begin(handle, PARAM_FALSE, method == 0);
- param_lscm_solve(handle);
- param_lscm_end(handle);
-
- param_pack(handle, scene->toolsettings->uvcalc_margin);
+ if(fill_holes) scene->toolsettings->uvcalc_flag |= UVCALC_FILLHOLES;
+ else scene->toolsettings->uvcalc_flag &= ~UVCALC_FILLHOLES;
- param_flush(handle);
+ if(correct_aspect) scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
+ else scene->toolsettings->uvcalc_flag |= UVCALC_NO_ASPECT_CORRECT;
- param_delete(handle);
+ /* execute unwrap */
+ ED_unwrap_lscm(scene, obedit, FALSE);
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
}