forked from bartvdbraak/blender
Removed set_sculpt_object. Tested with sculpt undo, sculpt+multires, sculpt+partial visibility, and sculpt+shapekeys, seems stable.
This commit is contained in:
parent
413ff0ca2d
commit
25361281a1
@ -125,7 +125,6 @@ float *get_tex_angle();
|
||||
void sculptmode_update_tex();
|
||||
char sculpt_modifiers_active(struct Object *ob);
|
||||
void sculpt();
|
||||
void set_sculpt_object(struct Object *ob);
|
||||
void set_sculptmode();
|
||||
|
||||
/* Partial Mesh Visibility */
|
||||
|
@ -605,12 +605,10 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
|
||||
error("Cannot create shape keys on a multires mesh.");
|
||||
} else {
|
||||
insert_shapekey(ob);
|
||||
set_sculpt_object(ob);
|
||||
}
|
||||
break;
|
||||
case B_SETKEY:
|
||||
ob->shapeflag |= OB_SHAPE_TEMPLOCK;
|
||||
set_sculpt_object(ob);
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWIPO, 0);
|
||||
@ -618,7 +616,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
|
||||
break;
|
||||
case B_LOCKKEY:
|
||||
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
|
||||
set_sculpt_object(ob);
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWIPO, 0);
|
||||
@ -630,7 +627,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
|
||||
if(ob->shapenr == BLI_countlist(&key->block))
|
||||
ob->shapenr= 1;
|
||||
else ob->shapenr++;
|
||||
set_sculpt_object(ob);
|
||||
do_common_editbuts(B_SETKEY);
|
||||
break;
|
||||
}
|
||||
@ -640,7 +636,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
|
||||
if(ob->shapenr <= 1)
|
||||
ob->shapenr= BLI_countlist(&key->block);
|
||||
else ob->shapenr--;
|
||||
set_sculpt_object(ob);
|
||||
do_common_editbuts(B_SETKEY);
|
||||
break;
|
||||
}
|
||||
@ -649,9 +644,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
|
||||
allqueue (REDRAWIPO, 0);
|
||||
break;
|
||||
case B_DELKEY:
|
||||
set_sculpt_object(NULL);
|
||||
delete_key(OBACT);
|
||||
set_sculpt_object(ob);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
break;
|
||||
|
||||
@ -1241,9 +1234,6 @@ static void modifiers_applyModifier(void *obv, void *mdv)
|
||||
else
|
||||
BIF_undo_push("Apply modifier");
|
||||
}
|
||||
|
||||
if (G.f & G_SCULPTMODE)
|
||||
set_sculpt_object(OBACT);
|
||||
}
|
||||
|
||||
static void modifiers_copyModifier(void *ob_v, void *md_v)
|
||||
|
@ -1602,8 +1602,6 @@ void enter_editmode(int wc)
|
||||
if(wc) waitcursor(1);
|
||||
|
||||
if(ob->type==OB_MESH) {
|
||||
if(G.f & G_SCULPTMODE) set_sculpt_object(NULL);
|
||||
|
||||
me= get_mesh(ob);
|
||||
if( me==0 ) return;
|
||||
if(me->id.lib) {
|
||||
@ -1741,9 +1739,6 @@ void exit_editmode(int flag) /* freedata==0 at render, 1= freedata, 2= do undo b
|
||||
/* also flush ob recalc, doesn't take much overhead, but used for particles */
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB|OB_RECALC_DATA);
|
||||
|
||||
if(G.f & G_SCULPTMODE)
|
||||
set_sculpt_object(ob);
|
||||
|
||||
if(freedata) {
|
||||
setcursor_space(SPACE_VIEW3D, CURSOR_STD);
|
||||
}
|
||||
|
@ -1097,10 +1097,6 @@ void set_active_base(Base *base)
|
||||
DAG_object_flush_update(G.scene, tbase->object, OB_RECALC_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
if(base->object->type==OB_MESH && G.f & G_SCULPTMODE) {
|
||||
set_sculpt_object(base->object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1133,8 +1133,6 @@ void multires_level_to_mesh(Object *ob, Mesh *me)
|
||||
multires_edge_level_update(ob,me);
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
|
||||
if(G.f & G_SCULPTMODE)
|
||||
set_sculpt_object(ob);
|
||||
}
|
||||
|
||||
mesh_update_customdata_pointers(me);
|
||||
|
@ -157,7 +157,9 @@ typedef struct ProjVert {
|
||||
containing the brush. */
|
||||
char inside;
|
||||
} ProjVert;
|
||||
|
||||
static ProjVert *projverts= NULL;
|
||||
static Object *active_ob= NULL;
|
||||
|
||||
SculptData *sculpt_data()
|
||||
{
|
||||
@ -421,7 +423,7 @@ void sculptmode_undo_update(SculptUndoStep *newcur)
|
||||
for(sus= oldcur; sus && sus != newcur; sus= sus->next);
|
||||
if(sus == newcur) forward= 1;
|
||||
|
||||
set_sculpt_object(NULL);
|
||||
active_ob= NULL;
|
||||
|
||||
/* Verts */
|
||||
if(newcur->verts) {
|
||||
@ -495,8 +497,6 @@ void sculptmode_undo_update(SculptUndoStep *newcur)
|
||||
|
||||
ss->undo->cur= newcur;
|
||||
|
||||
set_sculpt_object(ob);
|
||||
|
||||
if(!sculpt_data()->draw_mode || sculpt_modifiers_active(ob))
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
|
||||
@ -611,23 +611,6 @@ void calc_vertex_users()
|
||||
}
|
||||
}
|
||||
|
||||
/* bad function... what is this supposed to do, and why is it called all over? (ton) */
|
||||
/* its really time to add some comments in code... */
|
||||
void set_sculpt_object(Object *ob)
|
||||
{
|
||||
SculptSession *ss;
|
||||
|
||||
/* return when no sculptmode, temporal for now because this call breaks switching shapes */
|
||||
if(!(G.f & G_SCULPTMODE))
|
||||
return;
|
||||
|
||||
ss= sculpt_session();
|
||||
|
||||
if(ss && ob)
|
||||
calc_vertex_users();
|
||||
|
||||
}
|
||||
|
||||
/* ===== INTERFACE =====
|
||||
*/
|
||||
|
||||
@ -1864,29 +1847,26 @@ void sculpt()
|
||||
RectNode *rn= NULL;
|
||||
short spacing= 32000;
|
||||
|
||||
if((G.f & G_SCULPTMODE)==0) return;
|
||||
if(G.obedit) return;
|
||||
|
||||
ob= OBACT;
|
||||
if(ob->id.lib) return;
|
||||
if(!(G.f & G_SCULPTMODE) || G.obedit || !ob || !ob->id.lib || !get_mesh(OBACT) || get_mesh(OBACT)->totface == 0)
|
||||
return;
|
||||
if(!(ob->lay & G.vd->lay))
|
||||
error("Active object is not in this layer");
|
||||
|
||||
if(!ss) {
|
||||
sculpt_init_session();
|
||||
ss= sd->session;
|
||||
}
|
||||
|
||||
/* Make sure that the active mesh is set correctly */
|
||||
if(get_mesh(OBACT) != get_mesh(ob))
|
||||
set_sculpt_object(ob);
|
||||
/* Check that vertex users are up-to-date */
|
||||
if(ob != active_ob || ss->vertex_users_size != get_mesh(ob)->totvert) {
|
||||
sculptmode_free_vertexusers(ss);
|
||||
calc_vertex_users();
|
||||
active_ob= ob;
|
||||
}
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
|
||||
if(!OBACT || !get_mesh(OBACT) ||
|
||||
get_mesh(OBACT)->totface==0) return;
|
||||
|
||||
if(ob->lay & G.vd->lay); else error("Active object is not in this layer");
|
||||
|
||||
persp(PERSP_VIEW);
|
||||
|
||||
getmouseco_areawin(mvalo);
|
||||
@ -2068,8 +2048,6 @@ void set_sculptmode()
|
||||
if(G.f & G_SCULPTMODE) {
|
||||
G.f &= ~G_SCULPTMODE;
|
||||
|
||||
set_sculpt_object(NULL);
|
||||
|
||||
sculptmode_free_session(G.scene);
|
||||
} else {
|
||||
G.f |= G_SCULPTMODE;
|
||||
@ -2077,14 +2055,13 @@ void set_sculptmode()
|
||||
if(!sculptmode_brush())
|
||||
sculptmode_init(G.scene);
|
||||
|
||||
if(G.vd->twflag) G.vd->twflag= 0;
|
||||
|
||||
sculpt_init_session();
|
||||
set_sculpt_object(OBACT);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
}
|
||||
|
||||
active_ob= NULL;
|
||||
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
@ -2116,9 +2093,8 @@ void sculptmode_revert_pmv(Mesh *me)
|
||||
unsigned i;
|
||||
MVert *nve, *old_verts;
|
||||
Object *ob= OBACT;
|
||||
|
||||
/* Temporarily exit sculptmode */
|
||||
set_sculpt_object(NULL);
|
||||
|
||||
active_ob= NULL;
|
||||
|
||||
/* Reorder vertices */
|
||||
nve= me->mvert;
|
||||
@ -2148,8 +2124,6 @@ void sculptmode_revert_pmv(Mesh *me)
|
||||
me->pv->edge_map= NULL;
|
||||
MEM_freeN(me->pv->vert_map);
|
||||
me->pv->vert_map= NULL;
|
||||
|
||||
set_sculpt_object(ob);
|
||||
|
||||
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
|
||||
}
|
||||
@ -2210,7 +2184,7 @@ void sculptmode_do_pmv(Object *ob, rcti *hb_2d, int mode)
|
||||
}
|
||||
|
||||
/* Kill sculpt data */
|
||||
set_sculpt_object(NULL);
|
||||
active_ob= NULL;
|
||||
|
||||
/* Initalize map with which verts are to be hidden */
|
||||
me->pv->vert_map= MEM_mallocN(sizeof(unsigned)*me->totvert, "PMV vertmap");
|
||||
@ -2319,8 +2293,6 @@ void sculptmode_do_pmv(Object *ob, rcti *hb_2d, int mode)
|
||||
}
|
||||
me->totedge= edge_cnt_show;
|
||||
CustomData_set_layer(&me->edata, CD_MEDGE, me->medge);
|
||||
|
||||
set_sculpt_object(ob);
|
||||
|
||||
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user