Fixed various errors with Blender allowing editing Library linked data.

CTRL+V on buttons
NKEY Panels
join mesh
join curve
editing buttons
boolean
vpaint
faceselect
Manipulator

Also; Transform() got in useless loop when you entered without anything
selected. Not sure why Martin recoded it this way... maybe as a first
step to handlerify it? For evil Python Aussie Bosses? :P
This commit is contained in:
2005-05-12 19:17:12 +00:00
parent 2579d377a3
commit a7bbf8245a
10 changed files with 46 additions and 28 deletions

View File

@@ -2739,7 +2739,8 @@ void editing_panels()
ob= OBACT; ob= OBACT;
if(ob==NULL) return; if(ob==NULL) return;
if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
switch(ob->type) { switch(ob->type) {
case OB_MESH: case OB_MESH:
editing_panel_links(ob); // no editmode! editing_panel_links(ob); // no editmode!
@@ -2818,5 +2819,5 @@ void editing_panels()
} }
break; break;
} }
uiClearButLock();
} }

View File

@@ -1565,6 +1565,8 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
if(uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204)==0) return; if(uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204)==0) return;
if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) { if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER); // force old style frontbuffer draw uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER); // force old style frontbuffer draw
} }
@@ -1610,6 +1612,7 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
uiDefButF(block, NUM, REDRAWVIEW3D, "SizeZ:", 160, 30, 140, 19, &(ob->size[2]), -lim, lim, 100, 3, ""); uiDefButF(block, NUM, REDRAWVIEW3D, "SizeZ:", 160, 30, 140, 19, &(ob->size[2]), -lim, lim, 100, 3, "");
uiBlockEndAlign(block); uiBlockEndAlign(block);
} }
uiClearButLock();
} }
static void view3d_panel_background(short cntrl) // VIEW3D_HANDLER_BACKGROUND static void view3d_panel_background(short cntrl) // VIEW3D_HANDLER_BACKGROUND

View File

@@ -3374,7 +3374,7 @@ void join_curve(int type)
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
nextb= base->next; nextb= base->next;
if TESTBASE(base) { if TESTBASELIB(base) {
if(base->object->type==type) { if(base->object->type==type) {
if(base->object != ob) { if(base->object != ob) {

View File

@@ -1202,7 +1202,8 @@ void set_faceselect() /* toggle */
Mesh *me = 0; Mesh *me = 0;
scrarea_queue_headredraw(curarea); scrarea_queue_headredraw(curarea);
if(ob->id.lib) return;
if(G.f & G_FACESELECT) G.f &= ~G_FACESELECT; if(G.f & G_FACESELECT) G.f &= ~G_FACESELECT;
else { else {
if (ob && ob->type == OB_MESH) G.f |= G_FACESELECT; if (ob && ob->type == OB_MESH) G.f |= G_FACESELECT;

View File

@@ -1958,12 +1958,13 @@ void special_editmenu(void)
} }
else { else {
Base *base, *base_select= NULL; Base *base, *base_select= NULL;
Object *ob= OBACT;
// Get the active object mesh. // Get the active object mesh.
Mesh *me= get_mesh(OBACT); Mesh *me= get_mesh(ob);
// If the active object is a mesh... // If the active object is a mesh...
if (me) { if (me && ob->id.lib==NULL) {
// Bring up a little menu with the boolean operation choices on. // Bring up a little menu with the boolean operation choices on.
nr= pupmenu("Boolean %t|Intersect%x1|Union%x2|Difference%x3"); nr= pupmenu("Boolean %t|Intersect%x1|Union%x2|Difference%x3");
@@ -1975,7 +1976,7 @@ void special_editmenu(void)
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if(base->flag & SELECT) { if TESTBASELIB(base) {
if(base->object != OBACT) base_select= base; if(base->object != OBACT) base_select= base;
} }
@@ -3269,7 +3270,7 @@ void std_rmouse_transform(void (*xf_func)(int, int))
initTransform(TFM_TRANSLATION, CTX_NONE); initTransform(TFM_TRANSLATION, CTX_NONE);
Transform(); Transform();
} }
else else if(xf_func)
xf_func('g', 0); xf_func('g', 0);
while(get_mbut() & mousebut) BIF_wait_for_statechange(); while(get_mbut() & mousebut) BIF_wait_for_statechange();
@@ -3290,7 +3291,7 @@ void std_rmouse_transform(void (*xf_func)(int, int))
void rightmouse_transform(void) void rightmouse_transform(void)
{ {
std_rmouse_transform(Transform); std_rmouse_transform(NULL);
} }
@@ -3311,7 +3312,7 @@ void single_object_users(int flag)
if( (base->flag & flag)==flag) { if( (base->flag & flag)==flag) {
if(ob->id.lib==0 && ob->id.us>1) { if(ob->id.lib==NULL && ob->id.us>1) {
obn= copy_object(ob); obn= copy_object(ob);
ob->id.us--; ob->id.us--;
@@ -3328,7 +3329,7 @@ void single_object_users(int flag)
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
ob= base->object; ob= base->object;
if(ob->id.lib==0) { if(ob->id.lib==NULL) {
if( (base->flag & flag)==flag) { if( (base->flag & flag)==flag) {
relink_constraints(&base->object->constraints); relink_constraints(&base->object->constraints);
@@ -3395,7 +3396,7 @@ void single_obdata_users(int flag)
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
ob= base->object; ob= base->object;
if(ob->id.lib==0 && (base->flag & flag)==flag ) { if(ob->id.lib==NULL && (base->flag & flag)==flag ) {
id= ob->data; id= ob->data;
if(id && id->us>1 && id->lib==0) { if(id && id->us>1 && id->lib==0) {
@@ -3527,7 +3528,7 @@ void single_mat_users(int flag)
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
ob= base->object; ob= base->object;
if(ob->id.lib==0 && (flag==0 || (base->flag & SELECT)) ) { if(ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
for(a=1; a<=ob->totcol; a++) { for(a=1; a<=ob->totcol; a++) {
ma= give_current_material(ob, a); ma= give_current_material(ob, a);
@@ -3764,7 +3765,7 @@ void make_local(void)
while(base) { while(base) {
ob= base->object; ob= base->object;
if( (base->flag & SELECT)) { if( (base->flag & SELECT)) {
if(ob->id.lib==0) { if(ob->id.lib==NULL) {
ID_NEW(ob->parent); ID_NEW(ob->parent);
ID_NEW(ob->track); ID_NEW(ob->track);
} }

View File

@@ -431,9 +431,10 @@ static int ui_but_copy_paste(uiBut *but, char mode)
static float rgb[3]; static float rgb[3];
void *poin; void *poin;
if(mode=='v' && but->lock) return;
poin= but->poin; poin= but->poin;
if ELEM3(but->type, NUM, NUMSLI, HSVSLI) { if ELEM3(but->type, NUM, NUMSLI, HSVSLI) {
if(mode=='c') { if(mode=='c') {

View File

@@ -140,7 +140,7 @@ void join_mesh(void)
/* count */ /* count */
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASE(base) { if TESTBASELIB(base) {
if(base->object->type==OB_MESH) { if(base->object->type==OB_MESH) {
me= base->object->data; me= base->object->data;
totvert+= me->totvert; totvert+= me->totvert;
@@ -173,7 +173,7 @@ void join_mesh(void)
/* if needed add edges to other meshes */ /* if needed add edges to other meshes */
if(hasedges) { if(hasedges) {
for(base= FIRSTBASE; base; base= base->next) { for(base= FIRSTBASE; base; base= base->next) {
if TESTBASE(base) { if TESTBASELIB(base) {
if(base->object->type==OB_MESH) { if(base->object->type==OB_MESH) {
me= base->object->data; me= base->object->data;
if(me->medge==NULL) make_edges(me); if(me->medge==NULL) make_edges(me);
@@ -196,7 +196,7 @@ void join_mesh(void)
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASE(base) { if TESTBASELIB(base) {
if(ob!=base->object && base->object->type==OB_MESH) { if(ob!=base->object && base->object->type==OB_MESH) {
me= base->object->data; me= base->object->data;
@@ -272,7 +272,7 @@ void join_mesh(void)
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
nextb= base->next; nextb= base->next;
if TESTBASE(base) { if TESTBASELIB(base) {
if(base->object->type==OB_MESH) { if(base->object->type==OB_MESH) {
me= base->object->data; me= base->object->data;

View File

@@ -514,6 +514,8 @@ void Transform()
short pmval[2] = {0, 0}, mval[2], val; short pmval[2] = {0, 0}, mval[2], val;
unsigned short event; unsigned short event;
if(Trans.total==0) return; // added, can happen now! (ton)
Mat3One(mati); Mat3One(mati);
// Emptying event queue // Emptying event queue

View File

@@ -353,13 +353,10 @@ int calc_manipulator_stats(ScrArea *sa)
base= (G.scene->base.first); base= (G.scene->base.first);
while(base) { while(base) {
if(v3d->lay & base->lay) { if TESTBASELIB(base) {
if(ob==NULL) ob= base->object;
if(base->flag & SELECT) { calc_tw_center(base->object->obmat[3]);
if(ob==NULL) ob= base->object; totsel++;
calc_tw_center(base->object->obmat[3]);
totsel++;
}
} }
base= base->next; base= base->next;
} }

View File

@@ -329,6 +329,8 @@ void clear_vpaint()
ob= OBACT; ob= OBACT;
me= get_mesh(ob); me= get_mesh(ob);
if(ob->id.lib) return;
if(me==0 || me->totface==0) return; if(me==0 || me->totface==0) return;
if(me->tface) tface_to_mcol(me); if(me->tface) tface_to_mcol(me);
@@ -793,6 +795,8 @@ void weight_paint(void)
if(indexar==NULL) init_vertexpaint(); if(indexar==NULL) init_vertexpaint();
ob= OBACT; ob= OBACT;
if(ob->id.lib) return;
me= get_mesh(ob); me= get_mesh(ob);
if (!me->dvert){ if (!me->dvert){
return; return;
@@ -957,8 +961,10 @@ void vertex_paint()
if(indexar==NULL) init_vertexpaint(); if(indexar==NULL) init_vertexpaint();
ob= OBACT; ob= OBACT;
if(ob->id.lib) return;
me= get_mesh(ob); me= get_mesh(ob);
if(me==0 || me->totface==0) return; if(me==NULL || me->totface==0) return;
if(ob->lay & G.vd->lay); else error("Active object is not in this layer"); if(ob->lay & G.vd->lay); else error("Active object is not in this layer");
if(me->tface==NULL && me->mcol==NULL) make_vertexcol(); if(me->tface==NULL && me->mcol==NULL) make_vertexcol();
@@ -1119,6 +1125,7 @@ void set_wpaint(void) /* toggle */
scrarea_queue_headredraw(curarea); scrarea_queue_headredraw(curarea);
ob= OBACT; ob= OBACT;
if(ob->id.lib) return;
me= get_mesh(ob); me= get_mesh(ob);
if(me && me->totface>=MAXINDEX) { if(me && me->totface>=MAXINDEX) {
@@ -1155,6 +1162,11 @@ void set_vpaint(void) /* toggle */
scrarea_queue_headredraw(curarea); scrarea_queue_headredraw(curarea);
ob= OBACT; ob= OBACT;
if(ob->id.lib) {
G.f &= ~G_VERTEXPAINT;
return;
}
me= get_mesh(ob); me= get_mesh(ob);
if(me && me->totface>=MAXINDEX) { if(me && me->totface>=MAXINDEX) {