From 3e5e49d9025985e182f75f1c245cc508ee927976 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Apr 2011 08:54:43 +0000 Subject: [PATCH] add margin access [#26806] Missing pack margin for pack islands in UV editor --- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 416c65c6297..cc5efd9a6ca 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -431,13 +431,20 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) /* ******************** Pack Islands operator **************** */ -static int pack_islands_exec(bContext *C, wmOperator *UNUSED(op)) +static int pack_islands_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; + if(RNA_property_is_set(op->ptr, "margin")) { + scene->toolsettings->uvcalc_margin= RNA_float_get(op->ptr, "margin"); + } + else { + RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin); + } + handle = construct_param_handle(scene, em, 1, 0, 1, 1); param_pack(handle, scene->toolsettings->uvcalc_margin); param_flush(handle); @@ -460,6 +467,9 @@ void UV_OT_pack_islands(wmOperatorType *ot) /* api callbacks */ ot->exec= pack_islands_exec; ot->poll= ED_operator_uvedit; + + /* properties */ + RNA_def_float_factor(ot->srna, "margin", 0.0f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f); } /* ******************** Average Islands Scale operator **************** */