[Bf-blender-cvs] [6a9b374] soc-2016-uv_tools: Added temoprary Debug/Test UV operator
Phil Gosch
noreply at git.blender.org
Tue Jun 21 15:37:08 CEST 2016
Commit: 6a9b37499a41d9238d8dcacca24aaf6961f3f8e7
Author: Phil Gosch
Date: Tue Jun 21 15:34:28 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB6a9b37499a41d9238d8dcacca24aaf6961f3f8e7
Added temoprary Debug/Test UV operator
This is very handy for testing isolated functions which are needed with packing
Will be removed once it's not needed anymore
===================================================================
M source/blender/editors/uvedit/uvedit_intern.h
M source/blender/editors/uvedit/uvedit_ops.c
M source/blender/editors/uvedit/uvedit_parametrizer.c
M source/blender/editors/uvedit/uvedit_parametrizer.h
M source/blender/editors/uvedit/uvedit_unwrap_ops.c
===================================================================
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index b16f94a..5d50ed2 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -90,4 +90,7 @@ void UV_OT_sphere_project(struct wmOperatorType *ot);
void UV_OT_unwrap(struct wmOperatorType *ot);
void UV_OT_stitch(struct wmOperatorType *ot);
+/* XXX (SaphireS): Remove */
+void UV_OT_test(struct wmOperatorType *ot);
+
#endif /* __UVEDIT_INTERN_H__ */
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index e64baa0..d3d94d6 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -4677,6 +4677,8 @@ void ED_operatortypes_uvedit(void)
WM_operatortype_append(UV_OT_cursor_set);
WM_operatortype_append(UV_OT_tile_set);
+
+ WM_operatortype_append(UV_OT_test);
}
void ED_keymap_uvedit(wmKeyConfig *keyconf)
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 53652b8..02ca0b3 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4964,3 +4964,13 @@ void param_flush_restore(ParamHandle *handle)
}
}
+/* XXX (SaphireS): Remove */
+void param_test(ParamHandle *handle)
+{
+ /* TEST STUFF */
+ printf("param_test() reached!\n");
+
+ float area = p_face_uv_area_combined(handle);
+
+ printf("used uv charts area: %f\n", area);
+}
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h
index 9b81dab..1ae5902 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -123,6 +123,8 @@ void param_shortest_path(ParamHandle *handle, bool *p_found, bool topological_di
void param_flush(ParamHandle *handle);
void param_flush_restore(ParamHandle *handle);
+/* XXX (SaphireS): Remove */
+void param_test(ParamHandle *handle);
#ifdef __cplusplus
}
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index e99b2b5..051b1f5 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -815,6 +815,55 @@ void UV_OT_pack_islands(wmOperatorType *ot)
RNA_def_float_factor(ot->srna, "margin", 0.001f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f);
}
+/* ******************** XXX (SaphireS): DEBUG-TEST operator **************** */
+
+/* XXX (SaphireS): Remove */
+void ED_uvedit_test_debug(Scene *scene, Object *ob, BMesh *bm, bool selected, bool correct_aspect)
+{
+ ParamHandle *handle;
+ int hparams = set_handle_params(true, false, selected, correct_aspect, true);
+ handle = construct_param_handle(scene, ob, bm, hparams);
+
+ param_test(handle);
+
+ param_flush(handle);
+ param_delete(handle);
+}
+
+/* XXX (SaphireS): Remove */
+static int test_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ Object *obedit = CTX_data_edit_object(C);
+ BMEditMesh *em = BKE_editmesh_from_object(obedit);
+
+ /*if (!uvedit_have_selection(scene, em, true)) {
+ return OPERATOR_CANCELLED;
+ }*/
+
+ ED_uvedit_test_debug(scene, obedit, em->bm, false, true);
+
+ DAG_id_tag_update(obedit->data, 0);
+ WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
+
+ return OPERATOR_FINISHED;
+}
+
+/* XXX (SaphireS): Remove */
+void UV_OT_test(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "DEBUG - TEST";
+ ot->idname = "UV_OT_test";
+ ot->description = "Debug operator to test stuff";
+
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* api callbacks */
+ ot->exec = test_exec;
+ ot->poll = ED_operator_uvedit;
+}
+
/* ******************** Average Islands Scale operator **************** */
static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
More information about the Bf-blender-cvs
mailing list