[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39601] branches/soc-2011-avocado/blender/ source/blender/editors/mesh/autoseam_tools.c: Bug fixes regarding the operator execution optimization.
shuvro sarker
shuvro05 at gmail.com
Mon Aug 22 06:01:52 CEST 2011
Revision: 39601
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39601
Author: shuvro
Date: 2011-08-22 04:01:48 +0000 (Mon, 22 Aug 2011)
Log Message:
-----------
Bug fixes regarding the operator execution optimization.
Modified Paths:
--------------
branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c
Modified: branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c
===================================================================
--- branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c 2011-08-22 02:30:43 UTC (rev 39600)
+++ branches/soc-2011-avocado/blender/source/blender/editors/mesh/autoseam_tools.c 2011-08-22 04:01:48 UTC (rev 39601)
@@ -623,8 +623,34 @@
return 0;
}
+static int is_seam_should_recalculated(bContext *C, wmOperator *op)
+{
+ int maxdepth= RNA_int_get(op->ptr, "depth");
+ int is_combinatorial = RNA_boolean_get(op->ptr, "is_combinatorial");
+ int stretch_algo = RNA_enum_get(op->ptr, "stretch_type");
+
+ Scene *scene= CTX_data_scene(C);
+ int *autoseam_flag;
+ if(op->customdata == NULL){
+ autoseam_flag = (int *)MEM_callocN(sizeof(int), "autoseam_flag");
+ }
+
+ //initialization
+ op->customdata = autoseam_flag;
+
+ if((scene->toolsettings->autoseam_data.recursion_depth != maxdepth) || (scene->toolsettings->autoseam_data.is_combinatorial != is_combinatorial) || (scene->toolsettings->autoseam_data.stretch_type != stretch_algo)){
+ *autoseam_flag = 1;
+ }
+ else{
+ *autoseam_flag = 0;
+ }
+
+
+ return 1;
+}
+
static int generate_seam_exec(bContext *C, wmOperator *op)
{
@@ -639,23 +665,25 @@
int is_live_unwrap = RNA_boolean_get(op->ptr, "live_unwrap");
+
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
Mesh *me= ((Mesh *)obedit->data);
BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
BMesh *bm = em->bm;
- int is_new_execution = (scene->toolsettings->autoseam_data.recursion_depth == maxdepth) &&
- (scene->toolsettings->autoseam_data.is_combinatorial == is_combinatorial) &&
- (scene->toolsettings->autoseam_data.stretch_type == stretch_algo) &&
- (scene->toolsettings->autoseam_data.method == method) &&
- (scene->toolsettings->autoseam_data.fill_holes == fill_holes) &&
- (scene->toolsettings->autoseam_data.correct_aspect == correct_aspect) &&
- (scene->toolsettings->autoseam_data.is_live_unwrap == is_live_unwrap);
+ int *execution_flag;
- //printf("Is new execution value : %d\n", is_new_execution);
+ if(op->customdata == NULL){
+ op->customdata = (int *)MEM_callocN(sizeof(int), "autoseam_flag");
+ execution_flag = op->customdata;
+ *execution_flag = 1;
+ }
+ else{
+ execution_flag = op->customdata;
+ }
- if((scene->toolsettings->autoseam_data.recursion_depth != maxdepth) || (scene->toolsettings->autoseam_data.is_combinatorial != is_combinatorial) || (scene->toolsettings->autoseam_data.stretch_type != stretch_algo) || is_new_execution)
+ if(*execution_flag == 1)
{
AUTOSEAM_Adjacency adj;
if(!(bm->totfacesel)) {
@@ -739,6 +767,9 @@
DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+ MEM_freeN(op->customdata);
+ op->customdata = NULL;
+
return OPERATOR_FINISHED;
}
@@ -765,6 +796,7 @@
/* api callbacks */
ot->exec = generate_seam_exec;
ot->poll= ED_operator_editmesh;
+ ot->check = is_seam_should_recalculated;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
More information about the Bf-blender-cvs
mailing list