Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/BLI_blenlib.h1
-rw-r--r--source/blender/include/BDR_editobject.h1
-rw-r--r--source/blender/include/BIF_toolbox.h2
-rw-r--r--source/blender/include/blendef.h8
-rw-r--r--source/blender/python/api2_2x/Constraint.c8
-rw-r--r--source/blender/python/api2_2x/Object.c5
-rw-r--r--source/blender/src/butspace.c3
-rw-r--r--source/blender/src/buttons_editing.c25
-rw-r--r--source/blender/src/buttons_logic.c8
-rw-r--r--source/blender/src/buttons_object.c33
-rw-r--r--source/blender/src/buttons_scene.c2
-rw-r--r--source/blender/src/buttons_shading.c74
-rw-r--r--source/blender/src/drawipo.c4
-rw-r--r--source/blender/src/drawnla.c2
-rw-r--r--source/blender/src/drawnode.c2
-rw-r--r--source/blender/src/drawview.c2
-rw-r--r--source/blender/src/editarmature.c6
-rw-r--r--source/blender/src/editcurve.c7
-rw-r--r--source/blender/src/editface.c17
-rw-r--r--source/blender/src/editipo.c13
-rw-r--r--source/blender/src/editnode.c2
-rw-r--r--source/blender/src/editobject.c37
-rw-r--r--source/blender/src/editview.c31
-rw-r--r--source/blender/src/header_ipo.c4
-rw-r--r--source/blender/src/header_node.c2
-rw-r--r--source/blender/src/header_view3d.c4
-rw-r--r--source/blender/src/headerbuttons.c8
-rw-r--r--source/blender/src/meshtools.c5
-rw-r--r--source/blender/src/outliner.c12
-rw-r--r--source/blender/src/toolbox.c5
30 files changed, 197 insertions, 136 deletions
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index 464b851413f..ad2dbc52d69 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -389,4 +389,3 @@ void BLI_timestr(double time, char *str);
#endif
#endif
-
diff --git a/source/blender/include/BDR_editobject.h b/source/blender/include/BDR_editobject.h
index 31412a4fd0a..2a96a8d65cb 100644
--- a/source/blender/include/BDR_editobject.h
+++ b/source/blender/include/BDR_editobject.h
@@ -117,6 +117,7 @@ void add_hook(void);
void hook_select(struct HookModifierData *hmd);
int hook_getIndexArray(int *tot, int **indexar, char *name, float *cent_r);
+int object_data_is_libdata(struct Object *ob);
void hide_objects(int select);
void show_objects(void);
diff --git a/source/blender/include/BIF_toolbox.h b/source/blender/include/BIF_toolbox.h
index d2ff84d18d8..72867cbfa05 100644
--- a/source/blender/include/BIF_toolbox.h
+++ b/source/blender/include/BIF_toolbox.h
@@ -43,6 +43,8 @@ void reset_toolbox(void);
void notice (char *str, ...);
void error (char *fmt, ...);
+void error_libdata (void);
+
int saveover (char *filename);
int okee (char *fmt, ...);
diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h
index dc0d1998808..4b36aea88a8 100644
--- a/source/blender/include/blendef.h
+++ b/source/blender/include/blendef.h
@@ -95,8 +95,8 @@
#define NOT_YET 0
-#define TESTBASE(base) ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) )
-#define TESTBASELIB(base) ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && ((base)->object->id.lib==0))
+#define TESTBASE(base) ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0) )
+#define TESTBASELIB(base) ( ((base)->flag & SELECT) && ((base)->lay & G.vd->lay) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0))
#define BASE_SELECTABLE(base) ((base->lay & G.vd->lay) && !(base->object->restrictflag & OB_RESTRICT_SELECT) && !(base->object->restrictflag & OB_RESTRICT_VIEW))
#define FIRSTBASE G.scene->base.first
#define LASTBASE G.scene->base.last
@@ -441,4 +441,8 @@
#define VP_HARD 64
#define VP_ONLYVGROUP 128
+/* Error messages */
+#define ERROR_LIBDATA_MESSAGE "Can't edit external libdata"
+
+
#endif
diff --git a/source/blender/python/api2_2x/Constraint.c b/source/blender/python/api2_2x/Constraint.c
index 901947574b4..37c24dbbda6 100644
--- a/source/blender/python/api2_2x/Constraint.c
+++ b/source/blender/python/api2_2x/Constraint.c
@@ -392,10 +392,14 @@ static PyObject *Constraint_insertKey( BPy_Constraint * self, PyObject * arg )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a float argument" );
- // constraint_active_func(ob_v, con_v);
+ /* constraint_active_func(ob_v, con_v); */
get_constraint_ipo_context( ob, actname );
icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, CO_ENFORCE);
-
+
+ if (!icu)
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "cannot get a curve from this IPO, may be using libdata" );
+
if( ob->action )
insert_vert_ipo( icu, get_action_frame(ob, cfra), con->enforce);
else
diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c
index beeb42af96c..29478de74ff 100644
--- a/source/blender/python/api2_2x/Object.c
+++ b/source/blender/python/api2_2x/Object.c
@@ -2504,6 +2504,11 @@ static PyObject *Object_setConstraintInfluenceForBone( BPy_Object * self,
icu = verify_ipocurve((ID *)self->object, ID_CO, boneName, constName,
CO_ENFORCE);
+
+ if (!icu)
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "cannot get a curve from this IPO, may be using libdata" );
+
insert_vert_ipo(icu, (float)CFRA, influence);
self->object->recalc |= OB_RECALC_OB;
diff --git a/source/blender/src/butspace.c b/source/blender/src/butspace.c
index e58b3d5542f..f694c9aa862 100644
--- a/source/blender/src/butspace.c
+++ b/source/blender/src/butspace.c
@@ -39,6 +39,7 @@
#include <config.h>
#endif
+#include "blendef.h"
#include "MEM_guardedalloc.h"
#include "DNA_color_types.h"
@@ -714,7 +715,7 @@ void drawbutspace(ScrArea *sa, void *spacedata)
glClearColor(col[0], col[1], col[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT);
- uiSetButLock(G.scene->id.lib!=0, "Can't edit library data");
+ uiSetButLock(G.scene->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiFreeBlocksWin(&sa->uiblocks, sa->win);
/* select the context to be drawn, per contex/tab the actual context is tested */
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 96e4ed4454d..6bf20a228ea 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -803,7 +803,7 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_type", UI_EMBOSS, UI_HELV, curarea->win);
if( uiNewPanel(curarea, block, "Mesh", "Editing", 320, 0, 318, 204)==0) return;
- uiSetButLock(me->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, ME_AUTOSMOOTH, REDRAWVIEW3D, "Auto Smooth",10,180,170,19, &me->flag, 0, 0, 0, 0, "Treats all set-smoothed faces with angles less than Degr: as 'smooth' during render");
@@ -2057,7 +2057,7 @@ static void editing_panel_modifiers(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "editing_panel_modifiers", UI_EMBOSS, UI_HELV, curarea->win);
if( uiNewPanel(curarea, block, "Modifiers", "Editing", 640, 0, 318, 204)==0) return;
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
uiNewPanelHeight(block, 204);
uiDefBlockBut(block, modifiers_add_menu, ob, "Add Modifier", 0, 190, 130, 20, "Add a new modifier");
@@ -2110,7 +2110,7 @@ static void editing_panel_shapes(Object *ob)
if( uiNewPanel(curarea, block, "Shapes", "Editing", 640, 0, 318, 204)==0) return;
/* Todo check data is library here */
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
uiDefBut(block, BUT, B_ADDKEY, "Add Shape Key" , 10, 180, 150, 20, NULL, 0.0, 0.0, 0, 0, "Add new Shape Key");
@@ -3017,7 +3017,7 @@ static void editing_panel_camera_type(Object *ob, Camera *cam)
block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_type", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Camera", "Editing", 320, 0, 318, 204)==0) return;
- uiSetButLock(ob->id.lib || cam->id.lib, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
uiDefBut(block, LABEL, 10, "Lens:", 10, 180, 150, 20, 0, 0.0, 0.0, 0, 0, "");
@@ -3761,7 +3761,7 @@ static int ob_arm_bone_pchan_lock(Object *ob, bArmature *arm, Bone *bone, bPoseC
return 0;
if(arm->id.lib) {
if(pchan==NULL)
- uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(1, ERROR_LIBDATA_MESSAGE);
else if(ob->proxy && bone->layer & arm->layer_protected) {
uiSetButLock(1, "Can't edit protected proxy channel");
return 1;
@@ -4389,8 +4389,7 @@ static void editing_panel_links(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "editing_panel_links", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Link and Materials", "Editing", 0, 0, 318, 204)==0) return;
- if (ob)
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
buttons_active_id(&id, &idfrom);
@@ -4434,7 +4433,7 @@ static void editing_panel_links(Object *ob)
uiBlockSetCol(block, TH_AUTO);
}
if(ob) {
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
but = uiDefBut(block, TEX, B_IDNAME, "OB:", xco, 180, 454-xco, YIC, ob->id.name+2, 0.0, 21.0, 0, 0, "Active Object name.");
#ifdef WITH_VERSE
if(ob->vnode) uiButSetFunc(but, test_and_send_idbutton_cb, ob, ob->id.name);
@@ -4504,7 +4503,7 @@ static void editing_panel_links(Object *ob)
else {
ID *id= ob->data;
- uiSetButLock(id->lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign (block);
uiDefBut (block, BUT, B_NEWVGROUP, "New", 143, 90, 70, 21, 0, 0, 0, 0, 0, "Creates a new vertex group");
@@ -4522,7 +4521,7 @@ static void editing_panel_links(Object *ob)
else return;
id= ob->data;
- uiSetButLock(id->lib!=NULL, "Cannot edit Library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if(ob->type==OB_MESH) poin= &( ((Mesh *)ob->data)->texflag );
else if(ob->type==OB_MBALL) poin= &( ((MetaBall *)ob->data)->texflag );
@@ -5313,9 +5312,7 @@ void editing_panel_mesh_multires()
block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_multires", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Multires", "Editing", 500, 0, 318, 204)==0) return;
- if (ob->id.lib || me->id.lib)
- uiSetButLock(1, "Can't edit library data");
-
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if(!me->mr) {
but= uiDefBut(block,BUT,B_NOP,"Add Multires", cx,cy,268,19,0,0,0,0,0,"");
@@ -5384,7 +5381,7 @@ void editing_panels()
ob= OBACT;
if(ob==NULL) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
switch(ob->type) {
case OB_MESH:
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index 2a2cf583129..1a1d7828ef0 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -2536,7 +2536,7 @@ void logic_buts(void)
ob= OBACT;
if(ob==0) return;
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
sprintf(name, "buttonswin %d", curarea->win);
block= uiNewBlock(&curarea->uiblocks, name, UI_EMBOSS, UI_HELV, curarea->win);
@@ -2622,7 +2622,7 @@ void logic_buts(void)
for(a=0; a<count; a++) {
ob= (Object *)idar[a];
uiClearButLock();
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if( (ob->scavisflag & OB_VIS_SENS) == 0) continue;
@@ -2693,7 +2693,7 @@ void logic_buts(void)
for(a=0; a<count; a++) {
ob= (Object *)idar[a];
uiClearButLock();
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
/* presume it is only objects for now */
@@ -2761,7 +2761,7 @@ void logic_buts(void)
for(a=0; a<count; a++) {
ob= (Object *)idar[a];
uiClearButLock();
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
/* presume it is only objects for now */
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index b22bc0fa2e1..c0b9d324503 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -254,7 +254,12 @@ static void add_influence_key_to_constraint_func (void *ob_v, void *con_v)
/* adds ipo & channels & curve if needed */
icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, CO_ENFORCE);
-
+
+ if (!icu) {
+ error("Cannot get a curve from this IPO, may be dealing with linked data");
+ return;
+ }
+
if(ob->action)
insert_vert_ipo(icu, get_action_frame(ob, (float)CFRA), con->enforce);
else
@@ -1588,7 +1593,7 @@ void softbody_bake(Object *ob)
}
else {
for(base=G.scene->base.first; base; base= base->next) {
- if(TESTBASE(base)) {
+ if(TESTBASELIB(base)) {
if(base->object->soft) {
sb= base->object->soft;
sfra= MIN2(sfra, sb->sfra);
@@ -1628,7 +1633,7 @@ void softbody_bake(Object *ob)
sbObjectToSoftbody(ob); // free bake
else {
for(base=G.scene->base.first; base; base= base->next) {
- if(TESTBASE(base)) {
+ if(TESTBASELIB(base)) {
if(base->object->soft) {
sbObjectToSoftbody(base->object); // free bake
}
@@ -1646,7 +1651,7 @@ void softbody_bake(Object *ob)
ob->softflag &= ~OB_SB_BAKEDO;
else {
for(base=G.scene->base.first; base; base= base->next)
- if(TESTBASE(base))
+ if(TESTBASELIB(base))
if(base->object->soft)
base->object->softflag &= ~OB_SB_BAKEDO;
}
@@ -1953,7 +1958,7 @@ static void object_panel_object(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "object_panel_object", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Object and Links", "Object", 0, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
/* object name */
uiBlockSetCol(block, TH_BUT_SETTING2);
@@ -2020,7 +2025,7 @@ static void object_panel_anim(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Anim settings", "Object", 320, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefButS(block, ROW,B_TRACKBUTS,"TrackX", 24,180,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
@@ -2085,7 +2090,7 @@ static void object_panel_draw(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "object_panel_draw", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Draw", "Object", 640, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
/* LAYERS */
xco= 120;
@@ -2148,7 +2153,7 @@ void object_panel_constraint(char *context)
block= uiNewBlock(&curarea->uiblocks, "object_panel_constraint", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Constraints", context, 960, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
/* this is a variable height panel, newpanel doesnt force new size on existing panels */
/* so first we make it default height */
@@ -2391,7 +2396,7 @@ static void object_panel_fields(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "object_panel_fields", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Fields and Deflection", "Physics", 0, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
/* should become button, option? */
if(ob->pd==NULL) {
@@ -2504,7 +2509,7 @@ static void object_softbodies_II(Object *ob)
uiNewPanelTabbed("Soft Body", "Physics");
if(uiNewPanel(curarea, block, "Soft Body Collision", "Physics", 651, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
val = modifiers_isSoftbodyEnabled(ob);
if(!val) {
@@ -2581,7 +2586,7 @@ static void object_softbodies(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "object_softbodies", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Soft Body", "Physics", 640, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
val = modifiers_isSoftbodyEnabled(ob);
but = uiDefButI(block, TOG, REDRAWBUTSOBJECT, "Soft Body", 10,200,130,20, &val, 0, 0, 0, 0, "Sets object to become soft body");
@@ -2711,7 +2716,7 @@ static void object_panel_particles_motion(Object *ob)
uiNewPanelTabbed("Particles ", "Physics");
if(uiNewPanel(curarea, block, "Particle Motion", "Physics", 320, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
/* top row */
uiBlockBeginAlign(block);
@@ -2775,7 +2780,7 @@ static void object_panel_particles(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "object_panel_particles", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Particles ", "Physics", 320, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if (ob->type == OB_MESH) {
uiBlockBeginAlign(block);
@@ -2867,7 +2872,7 @@ static void object_panel_fluidsim(Object *ob)
block= uiNewBlock(&curarea->uiblocks, "object_fluidsim", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Fluid Simulation", "Physics", 1060, 0, 318, 204)==0) return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if(ob->type==OB_MESH) {
if(((Mesh *)ob->data)->totvert == 0) {
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index ca0a319c159..b70778987a5 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -392,7 +392,7 @@ static void sound_panel_sound(bSound *sound)
uiDefBut(block, BUT, B_SOUND_COPY_SOUND, "Copy sound", 220,160,90,20, 0, 0, 0, 0, 0, "Make another copy (duplicate) of the current sound");
- uiSetButLock(sound->id.lib!=0, "Can't edit library data");
+ uiSetButLock(sound->id.lib!=0, ERROR_LIBDATA_MESSAGE);
sound_initialize_sample(sound);
sample = sound->sample;
diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c
index 3cf7e80f04f..ce9c2f53906 100644
--- a/source/blender/src/buttons_shading.c
+++ b/source/blender/src/buttons_shading.c
@@ -420,7 +420,7 @@ static void texture_panel_plugin(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_plugin", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Plugin", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
if(tex->plugin && tex->plugin->doit) {
@@ -452,7 +452,7 @@ static void texture_panel_magic(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_magic", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Magic", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefButS(block, NUM, B_TEXPRV, "Depth:", 10, 90, 150, 19, &tex->noisedepth, 0.0, 10.0, 0, 0, "Sets the depth of the pattern");
@@ -465,7 +465,7 @@ static void texture_panel_blend(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_blend", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Blend", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_TEXPRV, "Lin", 10, 180, 75, 19, &tex->stype, 2.0, 0.0, 0, 0, "Creates a linear progresion");
@@ -494,7 +494,7 @@ static void texture_panel_wood(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_wood", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Wood", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_TEXPRV, "Bands", 10, 180, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Uses standard wood texture in bands");
@@ -526,7 +526,7 @@ static void texture_panel_stucci(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_stucci", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Stucci", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_TEXPRV, "Plastic", 10, 180, 100, 19, &tex->stype, 2.0, 0.0, 0, 0, "Uses standard stucci");
@@ -555,7 +555,7 @@ static void texture_panel_marble(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_marble", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Marble", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_TEXPRV, "Soft", 10, 180, 100, 18, &tex->stype, 2.0, 0.0, 0, 0, "Uses soft marble");
@@ -588,7 +588,7 @@ static void texture_panel_clouds(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_clouds", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Clouds", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_TEXPRV, "Default", 10, 180, 70, 18, &tex->stype, 2.0, 0.0, 0, 0, "Uses standard noise");
@@ -618,7 +618,7 @@ static void texture_panel_musgrave(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_musgrave", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Musgrave", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
str= "Multifractal %x0|Ridged Multifractal %x1|Hybrid Multifractal %x2|Hetero Terrain %x4|fBm %x3";
uiDefButS(block, MENU, B_TEXREDR_PRV, str, 10, 160, 150, 19, &tex->stype, 0.0, 0.0, 0, 0, "Sets Musgrave type");
@@ -653,7 +653,7 @@ static void texture_panel_distnoise(Tex *tex)
uiBlock *block;
block= uiNewBlock(&curarea->uiblocks, "texture_panel_distnoise", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Distorted Noise", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
/* distortion amount */
@@ -682,7 +682,7 @@ static void texture_panel_voronoi(Tex *tex)
uiBlock *block;
block= uiNewBlock(&curarea->uiblocks, "texture_panel_voronoi", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Voronoi", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
/* color types */
uiBlockBeginAlign(block);
@@ -1076,7 +1076,7 @@ void uiblock_image_panel(uiBlock *block, Image **ima_pp, ImageUser *iuser,
/* the main ima source types */
if(ima) {
- uiSetButLock(ima->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ima->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiBlockSetFunc(block, image_src_change_cb, ima, iuser);
uiDefButS(block, ROW, imagechanged, "Still", 10, 180, 60, 20, &ima->source, 0.0, IMA_SRC_FILE, 0, 0, "Single Image file");
@@ -1216,7 +1216,7 @@ static void texture_panel_image_map(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_image_map", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Map Image", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
/* types */
uiBlockBeginAlign(block);
@@ -1281,7 +1281,7 @@ static void texture_panel_envmap(Tex *tex)
block= uiNewBlock(&curarea->uiblocks, "texture_panel_envmap", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Envmap", "Texture", 640, 0, 318, 204)==0) return;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
if(tex->env==NULL) {
tex->env= BKE_add_envmap();
@@ -1609,7 +1609,7 @@ static void texture_panel_texture(MTex *mtex, Material *ma, World *wrld, Lamp *l
char textypes[512];
Tex *tex= (Tex *)id;
- uiSetButLock(tex->id.lib!=0, "Can't edit library data");
+ uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
/* newnoise: all texture types as menu, not enough room for more buttons.
* Can widen panel, but looks ugly when other panels overlap it */
@@ -1931,7 +1931,7 @@ static void world_panel_mapto(World *wrld)
uiNewPanelTabbed("Texture and Input", "World");
if(uiNewPanel(curarea, block, "Map To", "World", 1280, 0, 318, 204)==0) return;
- uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+ uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
mtex= wrld->mtex[ wrld->texact ];
if(mtex==NULL) {
@@ -1985,7 +1985,7 @@ static void world_panel_texture(World *wrld)
block= uiNewBlock(&curarea->uiblocks, "world_panel_texture", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Texture and Input", "World", 960, 0, 318, 204)==0) return;
- uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+ uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
/* TEX CHANNELS */
uiBlockSetCol(block, TH_BUT_NEUTRAL);
@@ -2065,7 +2065,7 @@ static void world_panel_mistaph(World *wrld)
block= uiNewBlock(&curarea->uiblocks, "world_panel_mistaph", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Mist / Stars / Physics", "World", 640, 0, 318, 204)==0) return;
- uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+ uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
#if GAMEBLENDER == 1
uiDefButI(block, MENU, 1,
@@ -2170,7 +2170,7 @@ static void world_panel_world(World *wrld)
if(wrld==NULL) return;
- uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+ uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockSetCol(block, TH_AUTO);
uiDefButF(block, COL, B_WORLDPRV, "", 10,150,145,19, &wrld->horr, 0, 0, 0, B_COLHOR, "");
@@ -2209,7 +2209,7 @@ static void world_panel_preview(World *wrld)
if(wrld==NULL) return;
- uiSetButLock(wrld->id.lib!=0, "Can't edit library data");
+ uiSetButLock(wrld->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockSetDrawExtraFunc(block, BIF_previewdraw);
@@ -2316,7 +2316,7 @@ static void lamp_panel_mapto(Object *ob, Lamp *la)
uiNewPanelTabbed("Texture and Input", "Lamp");
if(uiNewPanel(curarea, block, "Map To", "Lamp", 1280, 0, 318, 204)==0) return;
- uiSetButLock(la->id.lib!=0, "Can't edit library data");
+ uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
mtex= la->mtex[ la->texact ];
if(mtex==NULL) {
@@ -2363,7 +2363,7 @@ static void lamp_panel_texture(Object *ob, Lamp *la)
block= uiNewBlock(&curarea->uiblocks, "lamp_panel_texture", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Texture and Input", "Lamp", 960, 0, 318, 204)==0) return;
- uiSetButLock(la->id.lib!=0, "Can't edit library data");
+ uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
/* TEX CHANNELS */
uiBlockSetCol(block, TH_BUT_NEUTRAL);
@@ -2447,7 +2447,7 @@ static void lamp_panel_spot(Object *ob, Lamp *la)
if(G.vd) grid= G.vd->grid;
if(grid<1.0) grid= 1.0;
- uiSetButLock(la->id.lib!=0, "Can't edit library data");
+ uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockSetCol(block, TH_BUT_SETTING1);
uiBlockBeginAlign(block);
@@ -2553,7 +2553,7 @@ static void lamp_panel_yafray(Object *ob, Lamp *la)
/* hemis not used in yafray */
if(la->type==LA_HEMI) return;
- uiSetButLock(la->id.lib!=0, "Can't edit library data");
+ uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
/* photonlight params */
if (la->type==LA_YF_PHOTON) {
@@ -2641,7 +2641,7 @@ static void lamp_panel_lamp(Object *ob, Lamp *la)
if(G.vd) grid= G.vd->grid;
if(grid<1.0) grid= 1.0;
- uiSetButLock(la->id.lib!=0, "Can't edit library data");
+ uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockSetCol(block, TH_BUT_SETTING2);
xco= std_libbuttons(block, 8, 180, 0, NULL, B_LAMPBROWSE, ID_LA, 0, (ID *)la, (ID *)ob, &(G.buts->menunr), B_LAMPALONE, B_LAMPLOCAL, 0, 0, 0);
@@ -2650,7 +2650,7 @@ static void lamp_panel_lamp(Object *ob, Lamp *la)
uiDefButF(block, NUM,B_LAMPREDRAW,"Dist:", xco,180,300-xco,20,&la->dist, 0.01, 5000.0*grid, 100, 0, "Sets the distance value at which light intensity is half");
uiBlockBeginAlign(block);
- uiSetButLock(la->id.lib!=0, "Can't edit library data");
+ uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
if(la->type==LA_AREA) {
//uiDefButS(block, MENU, B_LAMPREDRAW, "Shape %t|Square %x0|Rect %x1|Cube %x2|Box %x3",
uiDefButS(block, MENU, B_LAMPREDRAW, "Shape %t|Square %x0|Rect %x1",
@@ -2709,7 +2709,7 @@ static void lamp_panel_preview(Object *ob, Lamp *la)
block= uiNewBlock(&curarea->uiblocks, "lamp_panel_preview", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Preview", "Lamp", 0, 0, 318, 204)==0) return;
- uiSetButLock(la->id.lib!=0, "Can't edit library data");
+ uiSetButLock(la->id.lib!=0, ERROR_LIBDATA_MESSAGE);
uiBlockSetDrawExtraFunc(block, BIF_previewdraw);
@@ -2950,7 +2950,7 @@ static void material_panel_map_to(Material *ma, int from_nodes)
uiNewPanelTabbed("Texture", "Material");
if(uiNewPanel(curarea, block, "Map To", "Material", 1600, 0, 318, 204)==0) return;
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
mtex= ma->mtex[ ma->texact ];
if(mtex==NULL) {
@@ -3030,7 +3030,7 @@ static void material_panel_map_input(Object *ob, Material *ma)
uiNewPanelTabbed("Texture", "Material");
if(uiNewPanel(curarea, block, "Map Input", "Material", 1280, 0, 318, 204)==0) return;
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
mtex= ma->mtex[ ma->texact ];
if(mtex==NULL) {
@@ -3119,7 +3119,7 @@ static void material_panel_texture(Material *ma)
}
uiBlockEndAlign(block);
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
/* SEPTEX */
uiBlockSetCol(block, TH_AUTO);
@@ -3182,7 +3182,7 @@ static void material_panel_tramir(Material *ma)
uiNewPanelTabbed("Shaders", "Material");
if(uiNewPanel(curarea, block, "Mirror Transp", "Material", 640, 0, 318, 204)==0) return;
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
uiDefButBitI(block, TOG, MA_RAYMIRROR, B_MATPRV,"Ray Mirror",210,180,100,20, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for mirror reflection rendering");
@@ -3231,7 +3231,7 @@ static void material_panel_tramir_yafray(Material *ma)
uiNewPanelTabbed("Shaders", "Material");
if(uiNewPanel(curarea, block, "Mirror Transp", "Material", 640, 0, 318, 204)==0) return;
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
/* material preset menu */
uiDefBut(block, LABEL, 0, "Mat.Preset", 20, 182, 100, 20, 0, 0.0, 0.0, 0, 0, "");
@@ -3277,7 +3277,7 @@ static void material_panel_shading(Material *ma)
block= uiNewBlock(&curarea->uiblocks, "material_panel_shading", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Shaders", "Material", 640, 0, 318, 204)==0) return;
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
if(ma->mode & MA_HALO) {
uiDefButF(block, NUM, B_MATPRV, "HaloSize: ", 10,155,190,18, &(ma->hasize), 0.0, 100.0, 10, 3, "Sets the dimension of the halo");
@@ -3384,7 +3384,7 @@ static void material_panel_ramps(Material *ma)
uiNewPanelTabbed("Material", "Material");
if(uiNewPanel(curarea, block, "Ramps", "Material", 640, 0, 318, 204)==0) return;
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiBlockSetCol(block, TH_BUT_SETTING1);
@@ -3454,7 +3454,7 @@ static void material_panel_material(Material *ma)
block= uiNewBlock(&curarea->uiblocks, "material_panel_material", UI_EMBOSS, UI_HELV, curarea->win);
if(uiNewPanel(curarea, block, "Material", "Material", 320, 0, 318, 204)==0) return;
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
uiBlockBeginAlign(block);
uiDefIconBut(block, BUT, B_MATCOPY, ICON_COPYUP, 262,200,XIC,YIC, 0, 0, 0, 0, 0, "Copies Material to the buffer");
uiDefIconBut(block, BUT, B_MATPASTE, ICON_PASTEUP, 283,200,XIC,YIC, 0, 0, 0, 0, 0, "Pastes Material from the buffer");
@@ -3580,7 +3580,7 @@ static void material_panel_links(Object *ob, Material *ma)
uiBlockSetCol(block, TH_BUT_SETTING2);
xco= std_libbuttons(block, 10, 160, 0, NULL, B_MATBROWSE, ID_MA, 0, id, idfrom, &(G.buts->menunr), B_MATALONE, B_MATLOCAL, B_MATDELETE, B_AUTOMATNAME, B_KEEPDATA);
- if(ma) uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ if(ma) uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
if(ma)
uiDefButC(block, TOG, B_MAT_USENODES, "Nodes", xco+5,160,300-xco-5,20, &ma->use_nodes, 0.0f, 0.0f, 0, 0, "");
@@ -3596,7 +3596,7 @@ static void material_panel_links(Object *ob, Material *ma)
/* indicate which one is linking a material */
if(id) {
if(id->lib)
- uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(1, ERROR_LIBDATA_MESSAGE);
else
uiClearButLock();
@@ -3621,7 +3621,7 @@ static void material_panel_links(Object *ob, Material *ma)
uiBlockEndAlign(block);
if(ma==NULL) return;
- uiSetButLock(ma->id.lib!=NULL, "Can't edit library data");
+ uiSetButLock(ma->id.lib!=NULL, ERROR_LIBDATA_MESSAGE);
/* Active material node */
if(ma->use_nodes) {
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index 293c1c2aed0..36cf21d3114 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -1839,6 +1839,10 @@ void do_ipobuts(unsigned short event)
if(ei) {
if(ei->icu==NULL) {
ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, ei->adrcode);
+ if (!ei->icu) {
+ error("Could not add a driver to this curve, may be linked data!");
+ break;
+ }
ei->flag |= IPO_SELECT;
ei->icu->flag= ei->flag;
}
diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c
index 5d9334e452b..ca73119c102 100644
--- a/source/blender/src/drawnla.c
+++ b/source/blender/src/drawnla.c
@@ -85,7 +85,7 @@
#include "butspace.h"
#include "mydevice.h"
-#define TESTBASE_SAFE(base) ((base)->flag & SELECT)
+#define TESTBASE_SAFE(base) ((base)->flag & SELECT && ((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)
/* the left hand side with channels only */
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index 60da13a4e4a..338d8042572 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -2184,7 +2184,7 @@ static void node_draw_basis(ScrArea *sa, SpaceNode *snode, bNode *node)
block= uiNewBlock(&sa->uiblocks, str, UI_EMBOSS, UI_HELV, sa->win);
uiBlockSetFlag(block, UI_BLOCK_NO_HILITE);
if(snode->id)
- uiSetButLock(snode->id->lib!=NULL, "Can't edit library data");
+ uiSetButLock(snode->id->lib!=NULL, ERROR_LIBDATA_MESSAGE);
}
}
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index daa60318686..6ff4d35e4a9 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -2200,7 +2200,7 @@ static void view3d_panel_object(short cntrl) // VIEW3D_HANDLER_OBJECT
if(!uiNewPanel(curarea, block, "Transform Properties", "View3d", 10, 230, 318, 204))
return;
- if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER); // force old style frontbuffer draw
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index e52a61b1b19..2eee1f86d80 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -522,7 +522,11 @@ int join_armature(void)
ob= OBACT;
if(ob->type!=OB_ARMATURE) return 0;
- arm= get_armature(ob);
+ if (object_data_is_libdata(ob)) {
+ error_libdata();
+ return 0;
+ }
+ arm= get_armature(ob);
/* Get editbones of active armature to add editbones to */
ebbase.first=ebbase.last= NULL;
diff --git a/source/blender/src/editcurve.c b/source/blender/src/editcurve.c
index e3dc812831b..aeea0300890 100644
--- a/source/blender/src/editcurve.c
+++ b/source/blender/src/editcurve.c
@@ -3655,6 +3655,11 @@ int join_curve(int type)
int a;
ob= OBACT;
+ if (object_data_is_libdata(ob)) {
+ error_libdata();
+ return 0;
+ }
+
if(!G.vd || ob->type!=type) return 0;
if(ob->lay & G.vd->lay); else return 0;
tempbase.first= tempbase.last= 0;
@@ -3665,7 +3670,7 @@ int join_curve(int type)
base= FIRSTBASE;
while(base) {
nextb= base->next;
- if TESTBASELIB(base) {
+ if TESTBASE(base) {
if(base->object->type==type) {
if(base->object != ob) {
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c
index 1617f6f68ca..895a081a18a 100644
--- a/source/blender/src/editface.c
+++ b/source/blender/src/editface.c
@@ -1419,16 +1419,12 @@ void set_faceselect() /* toggle */
Mesh *me = 0;
if(ob==NULL) return;
- if(ob->id.lib) {
- error("Can't edit library data");
+ if(object_data_is_libdata(ob)) {
+ error_libdata();
return;
}
me= get_mesh(ob);
- if(me && me->id.lib) {
- error("Can't edit library data");
- return;
- }
scrarea_queue_headredraw(curarea);
@@ -1517,16 +1513,13 @@ void set_texturepaint() /* toggle */
scrarea_queue_headredraw(curarea);
if(ob==NULL) return;
- if(ob->id.lib) {
- error("Can't edit library data");
+
+ if (object_data_is_libdata(ob)) {
+ error_libdata();
return;
}
me= get_mesh(ob);
- if(me && me->id.lib) {
- error("Can't edit library data");
- return;
- }
if(me)
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 4e184494b32..63e2466f4f9 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -1840,7 +1840,9 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname)
return NULL;
}
-/* returns and creates */
+/* returns and creates
+ * Make sure functions check for NULL or they will crash!
+ * */
IpoCurve *verify_ipocurve(ID *from, short blocktype, char *actname, char *constname, int adrcode)
{
Ipo *ipo;
@@ -1850,7 +1852,7 @@ IpoCurve *verify_ipocurve(ID *from, short blocktype, char *actname, char *constn
/* creates ipo too */
ipo= verify_ipo(from, blocktype, actname, constname);
- if(ipo && ipo->id.lib==NULL) {
+ if(ipo && ipo->id.lib==NULL && from->lib==NULL) {
for(icu= ipo->curve.first; icu; icu= icu->next) {
if(icu->adrcode==adrcode) break;
@@ -1980,7 +1982,10 @@ void add_vert_ipo(void)
if(ei->icu==NULL) {
if(G.sipo->from) {
ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, ei->adrcode);
- ei->flag |= ei->icu->flag & IPO_AUTO_HORIZ; /* new curve could have been added, weak... */
+ if (ei->icu)
+ ei->flag |= ei->icu->flag & IPO_AUTO_HORIZ; /* new curve could have been added, weak... */
+ else
+ error("Cannot create an IPO curve, you may be using libdata");
}
}
if(ei->icu==NULL) return;
@@ -4341,7 +4346,7 @@ void movekey_obipo(int dir) /* only call external from view3d queue */
base= FIRSTBASE;
while(base) {
- if TESTBASE(base) {
+ if TESTBASELIB(base) {
ob= base->object;
if(ob->ipo && ob->ipo->showkey) {
elems.first= elems.last= 0;
diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c
index 76de9f11b53..28c1d898a62 100644
--- a/source/blender/src/editnode.c
+++ b/source/blender/src/editnode.c
@@ -2190,7 +2190,7 @@ void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
if(fromlib==-1)
- error("Cannot edit Library Data");
+ error_libdata();
if(doredraw)
scrarea_queue_winredraw(sa);
if(doredraw==2)
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 67acf97f534..5e859501b6a 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -1593,9 +1593,8 @@ void enter_editmode(int wc)
ob= base->object;
if(ob->data==0) return;
- id= ob->data;
- if(id->lib) {
- error("Can't edit library data");
+ if (object_data_is_libdata(ob)) {
+ error_libdata();
return;
}
@@ -1604,10 +1603,6 @@ void enter_editmode(int wc)
if(ob->type==OB_MESH) {
me= get_mesh(ob);
if( me==0 ) return;
- if(me->id.lib) {
- error("Can't edit library data");
- return;
- }
if(me->pv) sculptmode_pmv_off(me);
ok= 1;
G.obedit= ob;
@@ -1618,10 +1613,6 @@ void enter_editmode(int wc)
if (ob->type==OB_ARMATURE){
arm= base->object->data;
if (!arm) return;
- if (arm->id.lib){
- error("Can't edit library data");
- return;
- }
ok=1;
G.obedit=ob;
make_editArmature();
@@ -2823,7 +2814,7 @@ void flip_subdivison(int level)
mode= eModifierMode_Render|eModifierMode_Realtime;
for(base= G.scene->base.first; base; base= base->next) {
- if(TESTBASE(base)) {
+ if(TESTBASELIB(base)) {
object_flip_subdivison(base->object, &set, level, mode);
if(base->object->dup_group) {
GroupObject *go;
@@ -4716,7 +4707,7 @@ void adduplicate(int mode, int dupflag)
base= FIRSTBASE;
while(base) {
- if TESTBASELIB(base) {
+ if TESTBASE(base) {
ob= base->object;
if(ob->flag & OB_POSEMODE) {
@@ -4937,7 +4928,7 @@ void make_duplilist_real()
base= FIRSTBASE;
while(base) {
- if TESTBASELIB(base) {
+ if TESTBASE(base) {
if(base->object->transflag & OB_DUPLI) {
ListBase *lb= object_duplilist(G.scene, base->object);
@@ -5168,7 +5159,7 @@ void set_ob_ipoflags(void)
base= FIRSTBASE;
while(base) {
- if TESTBASE(base) {
+ if TESTBASELIB(base) {
if(base->object->ipoflag & OB_DRAWKEY) {
set= 0;
break;
@@ -5179,7 +5170,7 @@ void set_ob_ipoflags(void)
base= FIRSTBASE;
while(base) {
- if TESTBASE(base) {
+ if TESTBASELIB(base) {
if(set) {
base->object->ipoflag |= OB_DRAWKEY;
if(base->object->ipo) base->object->ipo->showkey= 1;
@@ -5455,12 +5446,24 @@ void hookmenu(void)
}
}
+/*
+ * Returns true if teh Object data is a from an external blend file (libdata)
+ * */
+int object_data_is_libdata(Object *ob)
+{
+ if (!ob) return 0;
+ if (ob->id.lib) return 1;
+ if (!ob->data) return 0;
+ if (((ID *)ob->data)->lib) return 1;
+ return 0;
+}
+
void hide_objects(int select)
{
Base *base;
int changed = 0;
for(base = FIRSTBASE; base; base=base->next){
- if(TESTBASE(base)==select){
+ if(TESTBASELIB(base)==select){
base->flag &= ~SELECT;
base->object->flag = base->flag;
base->object->restrictflag |= OB_RESTRICT_VIEW;
diff --git a/source/blender/src/editview.c b/source/blender/src/editview.c
index aacb083e98a..232a69979bd 100644
--- a/source/blender/src/editview.c
+++ b/source/blender/src/editview.c
@@ -909,7 +909,10 @@ void deselectall(void) /* is toggle */
break;
}
/* are there any objects in the view*/
- if(base->lay & G.vd->lay)
+ if(base->lay & G.vd->lay &&
+ (base->object->restrictflag & OB_RESTRICT_VIEW)==0 &&
+ (base->object->restrictflag & OB_RESTRICT_SELECT)==0
+ )
ok=1;
base= base->next;
@@ -919,7 +922,10 @@ void deselectall(void) /* is toggle */
base= FIRSTBASE;
while(base) {
- if(base->lay & G.vd->lay) {
+ if(base->lay & G.vd->lay &&
+ (base->object->restrictflag & OB_RESTRICT_VIEW)==0 &&
+ (base->object->restrictflag & OB_RESTRICT_SELECT)==0
+ ) {
if(a)
select_base_v3d(base, BA_DESELECT);
else
@@ -943,7 +949,9 @@ void selectswap(void)
Base *base;
for(base= FIRSTBASE; base; base= base->next) {
- if(base->lay & G.vd->lay) {
+ if(base->lay & G.vd->lay &&
+ (base->object->restrictflag & OB_RESTRICT_VIEW)==0
+ ) {
if TESTBASE(base)
select_base_v3d(base, BA_DESELECT);
else
@@ -968,7 +976,10 @@ void selectall_type(short obtype)
base= FIRSTBASE;
while(base) {
- if((base->lay & G.vd->lay) && (base->object->type == obtype)) {
+ if((base->lay & G.vd->lay) &&
+ (base->object->type == obtype) &&
+ (base->object->restrictflag & OB_RESTRICT_VIEW)==0
+ ) {
select_base_v3d(base, BA_SELECT);
base->object->flag= base->flag;
}
@@ -989,7 +1000,9 @@ void selectall_layer(unsigned int layernum)
base= FIRSTBASE;
while(base) {
- if (base->lay == (1<< (layernum -1))) {
+ if(base->lay == (1<< (layernum -1)) &&
+ (base->object->restrictflag & OB_RESTRICT_VIEW)==0
+ ) {
select_base_v3d(base, BA_SELECT);
base->object->flag= base->flag;
}
@@ -1142,7 +1155,8 @@ static void select_all_from_groups(Base *basact)
for(go= group->gobject.first; go; go= go->next) {
if(deselect) go->ob->flag &= ~SELECT;
else {
- if (!(go->ob->restrictflag & OB_RESTRICT_SELECT))
+ if ((go->ob->restrictflag & OB_RESTRICT_SELECT)==0 &&
+ (go->ob->restrictflag & OB_RESTRICT_VIEW)==0)
go->ob->flag |= SELECT;
}
}
@@ -1169,7 +1183,10 @@ static Base *mouse_select_menu(unsigned int *buffer, int hits, short *mval)
char str[32];
for(base=FIRSTBASE; base; base= base->next) {
- if(base->lay & G.vd->lay) {
+ if(base->lay & G.vd->lay &&
+ (base->object->restrictflag & OB_RESTRICT_SELECT)==0 &&
+ (base->object->restrictflag & OB_RESTRICT_VIEW)==0
+ ) {
baseList[baseCount] = NULL;
/* two selection methods, the CTRL select uses max dist of 15 */
diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c
index 6076129c641..d4041a817db 100644
--- a/source/blender/src/header_ipo.c
+++ b/source/blender/src/header_ipo.c
@@ -1310,12 +1310,12 @@ void ipo_buttons(void)
uiBlockBeginAlign(block);
if(curarea->headertype==HEADERTOP) {
uiDefIconBut(block, BUT, B_IPOCOPY, ICON_COPYUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected curves to the buffer");
- uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, "Can't edit library data");
+ uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, ERROR_LIBDATA_MESSAGE);
uiDefIconBut(block, BUT, B_IPOPASTE, ICON_PASTEUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the curves from the buffer");
}
else {
uiDefIconBut(block, BUT, B_IPOCOPY, ICON_COPYDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected curves to the buffer");
- uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, "Can't edit library data");
+ uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, ERROR_LIBDATA_MESSAGE);
uiDefIconBut(block, BUT, B_IPOPASTE, ICON_PASTEDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the curves from the buffer");
}
uiBlockEndAlign(block);
diff --git a/source/blender/src/header_node.c b/source/blender/src/header_node.c
index b2feadd99f2..83aff8bcbe1 100644
--- a/source/blender/src/header_node.c
+++ b/source/blender/src/header_node.c
@@ -515,7 +515,7 @@ static void do_node_nodemenu(void *arg, int event)
break;
}
- if(fromlib==-1) error("Can't edit Library Data");
+ if(fromlib==-1) error_libdata();
allqueue(REDRAWNODE, 0);
}
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index c0bf857826f..78ba3fd535b 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -5202,7 +5202,7 @@ void view3d_buttons(void)
uiDefIconBut(block, BUT, B_ACTCOPY, ICON_COPYUP,
xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
"Copies the current pose to the buffer");
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
uiDefIconBut(block, BUT, B_ACTPASTE, ICON_PASTEUP,
xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
"Pastes the pose from the buffer");
@@ -5214,7 +5214,7 @@ void view3d_buttons(void)
uiDefIconBut(block, BUT, B_ACTCOPY, ICON_COPYDOWN,
xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
"Copies the current pose to the buffer");
- uiSetButLock(ob->id.lib!=0, "Can't edit library data");
+ uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
uiDefIconBut(block, BUT, B_ACTPASTE, ICON_PASTEDOWN,
xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
"Pastes the pose from the buffer");
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index dd1a99d9f2b..83297907992 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -268,14 +268,14 @@ int std_libbuttons(uiBlock *block, short xco, short yco,
if ELEM8( id_code, ID_SCE, ID_SCR, ID_MA, ID_TE, ID_WO, ID_IP, ID_AC, ID_BR) extrastr= "ADD NEW %x 32767";
else if (id_code==ID_TXT) extrastr= "OPEN NEW %x 32766 |ADD NEW %x 32767";
else if (id_code==ID_SO) extrastr= "OPEN NEW %x 32766";
-
- uiSetButLock(G.scene->id.lib!=0, "Can't edit library data");
+
+ uiSetButLock(G.scene->id.lib!=0, ERROR_LIBDATA_MESSAGE);
if( id_code==ID_SCE || id_code==ID_SCR ) uiClearButLock();
if(curarea->spacetype==SPACE_BUTS)
uiSetButLock(id_code!=ID_SCR && G.obedit!=0 && G.buts->mainb==CONTEXT_EDITING, "Cannot perform in EditMode");
- if(parid) uiSetButLock(parid->lib!=0, "Can't edit library data");
+ if(parid) uiSetButLock(parid->lib!=0, ERROR_LIBDATA_MESSAGE);
if (lb) {
if( id_code==ID_IP)
@@ -307,7 +307,7 @@ int std_libbuttons(uiBlock *block, short xco, short yco,
/* Redalert overrides pin color */
if(id->us<=0) uiBlockSetCol(block, TH_REDALERT);
- uiSetButLock(id->lib!=0, "Can't edit library data");
+ uiSetButLock(id->lib!=0, ERROR_LIBDATA_MESSAGE);
if(GS(id->name)==ID_SCE) strcpy(str1, "SCE:");
else if(GS(id->name)==ID_SCE) strcpy(str1, "SCR:");
diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c
index cbb14166b36..41a9bece61a 100644
--- a/source/blender/src/meshtools.c
+++ b/source/blender/src/meshtools.c
@@ -135,6 +135,11 @@ int join_mesh(void)
ob= OBACT;
if(!ob || ob->type!=OB_MESH) return 0;
+
+ if (object_data_is_libdata(ob)) {
+ error_libdata();
+ return 0;
+ }
#ifdef WITH_VERSE
/* it isn't allowed to join shared object at verse server
diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c
index d0d3336dc45..e29275e40d0 100644
--- a/source/blender/src/outliner.c
+++ b/source/blender/src/outliner.c
@@ -1293,7 +1293,7 @@ static void tree_element_active_object(SpaceOops *soops, TreeElement *te)
if(G.qual & LR_SHIFTKEY) {
/* swap select */
if(base->flag & SELECT) base->flag &= ~SELECT;
- else base->flag |= SELECT;
+ else if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) base->flag |= SELECT;
base->object->flag= base->flag;
}
else {
@@ -1303,8 +1303,10 @@ static void tree_element_active_object(SpaceOops *soops, TreeElement *te)
b->flag &= ~SELECT;
b->object->flag= b->flag;
}
- base->flag |= SELECT;
- base->object->flag |= SELECT;
+ if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
+ base->flag |= SELECT;
+ base->object->flag |= SELECT;
+ }
}
set_active_base(base); /* editview.c */
@@ -1895,7 +1897,7 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even
if(ELEM8(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
error("Cannot edit builtin name");
else if(tselem->id->lib)
- error("Cannot edit Library Data");
+ error_libdata();
else {
tselem->flag |= TSE_TEXTBUT;
}
@@ -2471,7 +2473,7 @@ static void object_select_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem
Base *base= (Base *)te->directdata;
if(base==NULL) base= object_in_scene((Object *)tselem->id, G.scene);
- if(base) {
+ if(base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) {
base->flag |= SELECT;
base->object->flag |= SELECT;
}
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index dcbdf5758b1..f4f9147b3b3 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -236,6 +236,11 @@ void error(char *fmt, ...)
va_end(ap);
}
+void error_libdata(void)
+{
+ error(ERROR_LIBDATA_MESSAGE);
+}
+
int saveover(char *file)
{
int len= strlen(file);