[Bf-blender-cvs] [59ca7f5] soc-2016-uv_tools: Added option to run "average islands scale" before packing.

Phil Gosch noreply at git.blender.org
Thu Jul 28 10:14:30 CEST 2016


Commit: 59ca7f55bc605ef20234f1ea54fd95fe803f91e3
Author: Phil Gosch
Date:   Thu Jul 28 10:14:00 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB59ca7f55bc605ef20234f1ea54fd95fe803f91e3

Added option to run "average islands scale" before packing.

(user request from ba)

===================================================================

M	source/blender/editors/uvedit/uvedit_unwrap_ops.c

===================================================================

diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 2b5f80d..141b88c 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -860,6 +860,7 @@ static bool irregular_pack_islands_init(bContext *C, wmOperator *op)
 	SimulatedAnnealing *simann;
 	unsigned int seed = 31415926;
 	float wasted_area, rot_steps, margin;
+	bool average_scale = RNA_boolean_get(op->ptr, "average_islands_scale");
 
 	/* Keep for now, needed when making packing work with current selection */
 	/*if (!uvedit_have_selection(scene, em, implicit)) {
@@ -889,6 +890,9 @@ static bool irregular_pack_islands_init(bContext *C, wmOperator *op)
 	simann->rot_steps = RNA_int_get(op->ptr, "rotation_steps");
 	pi->sa = simann;
 
+	if (average_scale)
+		param_average(pi->handle);
+
 	param_irregular_pack_begin(pi->handle, &wasted_area, pi->margin, pi->sa->rot_steps /* SA */);
 	pi->wasted_area_last = wasted_area;
 
@@ -1085,6 +1089,7 @@ void UV_OT_irregular_pack_islands(wmOperatorType *ot)
 	RNA_def_float(ot->srna, "margin", 0.0f, 0.0f, 1.0f, "Margin", "Border Margin/Padding to apply per UV island", 0.0f, 1.0f);
 	RNA_def_int(ot->srna, "rotation_steps", 4, 0, 360, "Rotation Steps", "Allowed rotations to try during packing. (2=180�, 4=90�, etc.)", 0, 360);
 	RNA_def_int(ot->srna, "iterations", 0, 0, INT_MAX, "Iterations", "Number of iterations to run, 0 is unlimited when run interactively", 0, 10000);
+	RNA_def_boolean(ot->srna, "average_islands_scale", true, "Average Islands Scale", "Average Islands Scale before starting packing");
 }
 
 /* ******************** XXX (SaphireS): DEBUG-TEST operator **************** */




More information about the Bf-blender-cvs mailing list