diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2007-03-08 08:54:39 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2007-03-08 08:54:39 +0300 |
commit | 4bd5ab628bbbdb23b1aeb074bc66f1133cb3af29 (patch) | |
tree | d19aab0b74505d73d845ed3420e938b13a165984 /source | |
parent | f361c49d70bcb4d49c6bbaa0b974551936b828f6 (diff) |
== Multires ==
Fixed bug #6153, Blender Crash during rendering (internal) with object selected in edit mode.
* Added a render parameter to several of multires's functions. If render==true, multires won't push data onto the undo stack, and regular Mesh data is always used (as opposed to EditMesh data.)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_bad_level_calls.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/bad_level_call_stubs/stubs.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 10 | ||||
-rw-r--r-- | source/blender/include/multires.h | 7 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Mesh.c | 2 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 2 | ||||
-rw-r--r-- | source/blender/src/multires-firstlevel.c | 8 | ||||
-rw-r--r-- | source/blender/src/multires.c | 25 | ||||
-rw-r--r-- | source/blender/src/space.c | 4 |
9 files changed, 35 insertions, 31 deletions
diff --git a/source/blender/blenkernel/BKE_bad_level_calls.h b/source/blender/blenkernel/BKE_bad_level_calls.h index 3c1a1c74821..997df6430dc 100644 --- a/source/blender/blenkernel/BKE_bad_level_calls.h +++ b/source/blender/blenkernel/BKE_bad_level_calls.h @@ -201,8 +201,8 @@ struct Multires; struct MultiresLevel; struct MultiresLevel *multires_level_n(struct Multires *mr, int n); void multires_free(struct Multires *mr); -void multires_set_level(void *ob, void *me_v); -void multires_update_levels(struct Mesh *me); +void multires_set_level(struct Object *ob, struct Mesh *me, const int render); +void multires_update_levels(struct Mesh *me, const int render); void multires_calc_level_maps(struct MultiresLevel *lvl); struct Multires *multires_copy(struct Multires *orig); /* sculptmode.c */ diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c index fb1d0e6215f..f567f65b9dd 100644 --- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c +++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c @@ -294,8 +294,8 @@ void post_server_add(void) {} /* Multires/sculpt stubs */ struct MultiresLevel *multires_level_n(struct Multires *mr, int n) {return NULL;} void multires_free(struct Multires *mr) {} -void multires_set_level(void *ob, void *me_v) {} -void multires_update_levels(struct Mesh *me) {} +void multires_set_level(struct Object *ob, struct Mesh *me, const int render) {} +void multires_update_levels(struct Mesh *me, const int render) {} void multires_calc_level_maps(struct MultiresLevel *lvl) {} struct Multires *multires_copy(struct Multires *orig) {return NULL;} void sculptmode_init(struct Scene *sce) {} diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 9ef53cc8798..097890c4e47 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2225,7 +2225,7 @@ float *multires_render_pin(Object *ob, Mesh *me, int *orig_lvl) int i; /* Make sure all mesh edits are properly stored in the multires data*/ - multires_update_levels(me); + multires_update_levels(me, 1); /* Copy the highest level of multires verts */ *orig_lvl= me->mr->current; @@ -2236,7 +2236,7 @@ float *multires_render_pin(Object *ob, Mesh *me, int *orig_lvl) /* Goto the pin level for multires */ me->mr->newlvl= me->mr->pinlvl; - multires_set_level(ob, me); + multires_set_level(ob, me, 1); } return vert_copy; @@ -2256,7 +2256,7 @@ void multires_render_final(Object *ob, Mesh *me, DerivedMesh **dm, float *vert_c (*dm)->release(*dm); me->mr->newlvl= me->mr->renderlvl; - multires_set_level(ob, me); + multires_set_level(ob, me, 1); (*dm)= getMeshDerivedMesh(me, ob, NULL); /* Some of the data in dm is referenced externally, so make a copy */ @@ -2266,7 +2266,7 @@ void multires_render_final(Object *ob, Mesh *me, DerivedMesh **dm, float *vert_c /* Restore the original verts */ me->mr->newlvl= BLI_countlist(&me->mr->levels); - multires_set_level(ob, me); + multires_set_level(ob, me, 1); for(i=0; i<lvl->totvert; ++i) VecCopyf(me->mvert[i].co, &vert_copy[i*3]); } @@ -2275,7 +2275,7 @@ void multires_render_final(Object *ob, Mesh *me, DerivedMesh **dm, float *vert_c MEM_freeN(vert_copy); me->mr->newlvl= orig_lvl; - multires_set_level(ob, me); + multires_set_level(ob, me, 1); } } diff --git a/source/blender/include/multires.h b/source/blender/include/multires.h index 48a5b4554a9..6c33af2d5e3 100644 --- a/source/blender/include/multires.h +++ b/source/blender/include/multires.h @@ -55,9 +55,10 @@ void multires_free_level(struct MultiresLevel *lvl); void multires_del_lower(void *ob, void *me); void multires_del_higher(void *ob, void *me); void multires_add_level(void *ob, void *me); -void multires_set_level(void *ob, void *me); -void multires_update_levels(struct Mesh *me); -void multires_level_to_mesh(struct Object *ob, struct Mesh *me); +void multires_set_level_cb(void *ob, void *me); +void multires_set_level(struct Object *ob, struct Mesh *me, const int render); +void multires_update_levels(struct Mesh *me, const int render); +void multires_level_to_mesh(struct Object *ob, struct Mesh *me, const int render); void multires_calc_level_maps(struct MultiresLevel *lvl); void multires_edge_level_update(void *ob, void *me); int multires_modifier_warning(); diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index f483ac9fc15..eb8f875fc34 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -6618,7 +6618,7 @@ static int Mesh_setMultires( BPy_Mesh * self, PyObject *value, void *type ) switch ((int)type) { case MESH_MULTIRES_LEVEL: self->mesh->mr->newlvl = i; - multires_set_level(self->object, self->mesh); + multires_set_level(self->object, self->mesh, 0); break; case MESH_MULTIRES_EDGE: self->mesh->mr->edgelvl = i; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 1effb61c0c9..1ca495d8903 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -5196,7 +5196,7 @@ void editing_panel_mesh_multires() cy-= 20; but= uiDefButC(block,NUM,B_NOP,"Level: ",cx,cy,200,19,&me->mr->newlvl,1.0,me->mr->level_count,0,0,""); - uiButSetFunc(but,multires_set_level,ob,me); + uiButSetFunc(but,multires_set_level_cb, ob, me); cy-= 20; but= uiDefButC(block,NUM,B_NOP,"Edges: ",cx,cy,200,19,&me->mr->edgelvl,1.0,me->mr->level_count,0,0,"Set level of edges to display"); diff --git a/source/blender/src/multires-firstlevel.c b/source/blender/src/multires-firstlevel.c index ce23caa4816..db39a429c22 100644 --- a/source/blender/src/multires-firstlevel.c +++ b/source/blender/src/multires-firstlevel.c @@ -346,12 +346,12 @@ void multires_delete_layer(Mesh *me, CustomData *cd, const int type, int n) if(me && me->mr && cd) { MultiresLevel *lvl1= me->mr->levels.first; - multires_update_levels(me); + multires_update_levels(me, 0); CustomData_set_layer_active(cd, type, n); CustomData_free_layer_active(cd, type, lvl1->totface); - multires_level_to_mesh(OBACT, me); + multires_level_to_mesh(OBACT, me, 0); } } @@ -359,7 +359,7 @@ MultiresLevel *current_level(Multires *mr); void multires_add_layer(Mesh *me, CustomData *cd, const int type, const int n) { if(me && me->mr && cd) { - multires_update_levels(me); + multires_update_levels(me, 0); if(CustomData_has_layer(cd, type)) CustomData_add_layer(cd, type, CD_DUPLICATE, CustomData_get_layer(cd, type), @@ -368,6 +368,6 @@ void multires_add_layer(Mesh *me, CustomData *cd, const int type, const int n) CustomData_add_layer(cd, type, CD_DEFAULT, NULL, current_level(me->mr)->totface); CustomData_set_layer_active(cd, type, n); - multires_level_to_mesh(OBACT, me); + multires_level_to_mesh(OBACT, me, 0); } } diff --git a/source/blender/src/multires.c b/source/blender/src/multires.c index 01ea8542427..6f1d0fd82dd 100644 --- a/source/blender/src/multires.c +++ b/source/blender/src/multires.c @@ -994,7 +994,7 @@ void multires_add_level(void *ob, void *me_v) } } - multires_update_levels(me); + multires_update_levels(me, 0); me->mr->newlvl= me->mr->level_count; me->mr->current= me->mr->newlvl; /* Unless the render level has been set to something other than the @@ -1002,7 +1002,7 @@ void multires_add_level(void *ob, void *me_v) the highest available level */ if(me->mr->renderlvl == me->mr->level_count - 1) me->mr->renderlvl= me->mr->level_count; - multires_level_to_mesh(ob,me); + multires_level_to_mesh(ob, me, 0); allqueue(REDRAWBUTSEDIT, 0); @@ -1011,10 +1011,13 @@ void multires_add_level(void *ob, void *me_v) waitcursor(0); } -void multires_set_level(void *ob, void *me_v) +void multires_set_level_cb(void *ob, void *me) { - Mesh *me= me_v; + multires_set_level(ob, me, 1); +} +void multires_set_level(struct Object *ob, struct Mesh *me, const int render) +{ waitcursor(1); multires_check_state(); @@ -1022,15 +1025,15 @@ void multires_set_level(void *ob, void *me_v) if(me->pv) sculptmode_pmv_off(me); check_colors(me); - multires_update_levels(me); + multires_update_levels(me, render); me->mr->current= me->mr->newlvl; if(me->mr->current<1) me->mr->current= 1; else if(me->mr->current>me->mr->level_count) me->mr->current= me->mr->level_count; - multires_level_to_mesh(ob,me); + multires_level_to_mesh(ob, me, render); - if(G.obedit || G.f & G_SCULPTMODE) + if(!render && (G.obedit || G.f & G_SCULPTMODE)) BIF_undo_push("Multires set level"); allqueue(REDRAWBUTSEDIT, 0); @@ -1053,11 +1056,11 @@ void medge_flag_to_eed(const short flag, const char crease, EditEdge *eed) } /* note, function is called in background render too, without UI */ -void multires_level_to_mesh(Object *ob, Mesh *me) +void multires_level_to_mesh(Object *ob, Mesh *me, const int render) { MultiresLevel *lvl= BLI_findlink(&me->mr->levels,me->mr->current-1); int i; - EditMesh *em= G.obedit ? G.editMesh : NULL; + EditMesh *em= (!render && G.obedit) ? G.editMesh : NULL; EditVert **eves= NULL; EditEdge *eed= NULL; @@ -1326,7 +1329,7 @@ void multires_update_edge_flags(Multires *mr, Mesh *me, EditMesh *em) } } -void multires_update_levels(Mesh *me) +void multires_update_levels(Mesh *me, const int render) { /* cr=current, pr=previous, or=original */ MultiresLevel *cr_lvl= current_level(me->mr), *pr_lvl; @@ -1334,7 +1337,7 @@ void multires_update_levels(Mesh *me) vec3f *pr_deltas= NULL, *cr_deltas= NULL; char *pr_flag_damaged= NULL, *cr_flag_damaged= NULL, *pr_mat_damaged= NULL, *cr_mat_damaged= NULL; char *or_flag_damaged= NULL, *or_mat_damaged= NULL; - EditMesh *em= G.obedit ? G.editMesh : NULL; + EditMesh *em= (!render && G.obedit) ? G.editMesh : NULL; EditVert *eve= NULL; EditFace *efa= NULL; MultiApplyData data; diff --git a/source/blender/src/space.c b/source/blender/src/space.c index f741413a402..83aa27728fd 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1337,13 +1337,13 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case PAGEUPKEY: if(me && me->mr) { me->mr->newlvl= ((Mesh*)ob->data)->mr->current+1; - multires_set_level(ob,ob->data); + multires_set_level(ob, ob->data, 0); } break; case PAGEDOWNKEY: if(me && me->mr) { me->mr->newlvl= ((Mesh*)ob->data)->mr->current-1; - multires_set_level(ob,ob->data); + multires_set_level(ob, ob->data, 0); } break; /* Partial Visibility */ |