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).
This commit is contained in:
@@ -177,7 +177,15 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel):
|
||||
col = layout.column(align=True)
|
||||
col.prop(mesh, "use_mirror_x")
|
||||
col.prop(mesh, "use_mirror_topology")
|
||||
col.prop(context.tool_settings, "edge_path_mode")
|
||||
|
||||
ts = context.tool_settings
|
||||
|
||||
col.label("Edge Select Mode")
|
||||
col.prop(ts, "edge_path_mode", text="")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.active = ts.edge_path_mode == 'SEAM'
|
||||
col.prop(context.tool_settings, "edge_path_live_unwrap")
|
||||
|
||||
# ********** default tools for editmode_curve ****************
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -2202,6 +2203,14 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2])
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -812,28 +812,17 @@ static void uv_map_clip_correct(EditMesh *em, wmOperator *op)
|
||||
|
||||
/* ******************** Unwrap operator **************** */
|
||||
|
||||
static int unwrap_exec(bContext *C, wmOperator *op)
|
||||
/* assumes UV layer is checked, doesn't run update funcs */
|
||||
void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
|
||||
{
|
||||
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;
|
||||
}
|
||||
const short fill_holes= scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
|
||||
const short correct_aspect= !(scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT);
|
||||
|
||||
/* remember last method for live unwrap */
|
||||
scene->toolsettings->unwrapper = method;
|
||||
ParamHandle *handle= construct_param_handle(scene, em, 0, fill_holes, sel, correct_aspect);
|
||||
|
||||
handle= construct_param_handle(scene, em, 0, fill_holes, 1, correct_aspect);
|
||||
|
||||
param_lscm_begin(handle, PARAM_FALSE, method == 0);
|
||||
param_lscm_begin(handle, PARAM_FALSE, scene->toolsettings->unwrapper == 0);
|
||||
param_lscm_solve(handle);
|
||||
param_lscm_end(handle);
|
||||
|
||||
@@ -843,10 +832,37 @@ static int unwrap_exec(bContext *C, wmOperator *op)
|
||||
|
||||
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);
|
||||
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)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* remember last method for live unwrap */
|
||||
scene->toolsettings->unwrapper = method;
|
||||
|
||||
if(fill_holes) scene->toolsettings->uvcalc_flag |= UVCALC_FILLHOLES;
|
||||
else scene->toolsettings->uvcalc_flag &= ~UVCALC_FILLHOLES;
|
||||
|
||||
if(correct_aspect) scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
|
||||
else scene->toolsettings->uvcalc_flag |= UVCALC_NO_ASPECT_CORRECT;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -726,9 +726,11 @@ typedef struct ToolSettings {
|
||||
|
||||
/* Alt+RMB option */
|
||||
char edge_mode;
|
||||
char edge_mode_live_unwrap;
|
||||
|
||||
/* Transform */
|
||||
short snap_mode, snap_flag, snap_target;
|
||||
char snap_mode;
|
||||
short snap_flag, snap_target;
|
||||
short proportional, prop_mode;
|
||||
char proportional_objects; /* proportional edit, object mode */
|
||||
char pad[3];
|
||||
@@ -1176,7 +1178,7 @@ typedef enum SculptFlags {
|
||||
|
||||
/* toolsettings->uvcalc_flag */
|
||||
#define UVCALC_FILLHOLES 1
|
||||
/*#define UVCALC_NO_ASPECT_CORRECT 2*/ /* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */
|
||||
#define UVCALC_NO_ASPECT_CORRECT 2 /* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */
|
||||
#define UVCALC_TRANSFORM_CORRECT 4 /* adjust UV's while transforming to avoid distortion */
|
||||
|
||||
/* toolsettings->uv_flag */
|
||||
|
||||
@@ -1206,6 +1206,10 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
||||
RNA_def_property_enum_items(prop, edge_tag_items);
|
||||
RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
|
||||
|
||||
prop= RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
|
||||
RNA_def_property_ui_text(prop, "Live Unwrap", "Tagging edges re-calculates unwrap");
|
||||
|
||||
/* etch-a-ton */
|
||||
prop= RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING);
|
||||
|
||||
Reference in New Issue
Block a user