diff options
author | Ton Roosendaal <ton@blender.org> | 2011-04-08 20:56:44 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-04-08 20:56:44 +0400 |
commit | 1728c20a63123f1377f7192c1bd521286eac2228 (patch) | |
tree | 376d979006aca8fee63e880c2120b655c7bcf833 /source | |
parent | 626c26809624305a936b87485ee1123136ada658 (diff) |
Fixes related to using Library files:
- Assigning local materials to library objects disabled
(crashes on undo/redo cases)
- Disabling options in Material buttons to add/remove slots
on library data
- Drawing Object ID template in Object properties, this
allows browse active Object, but especially shows library
status then.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 2 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 2 |
4 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index ce4c3a21d80..daa665f7183 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -687,6 +687,9 @@ void assign_material(Object *ob, Material *ma, int act) if(act>MAXMAT) return; if(act<1) act= 1; + /* prevent crashing when using accidentally */ + if(ob->id.lib) return; + /* test arraylens */ totcolp= give_totcolp(ob); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 42b6926e847..01e785ef88c 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -416,7 +416,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT); - if(id->lib == NULL && !(ELEM4(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT))) { + if(id->lib == NULL && !(ELEM5(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) { uiDefButR(block, TOG, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL); } } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 2fe8533c04c..306e9f977de 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -76,9 +76,10 @@ #include "WM_api.h" #include "WM_types.h" -#include "ED_render.h" #include "ED_curve.h" #include "ED_mesh.h" +#include "ED_render.h" +#include "ED_screen.h" #include "RNA_define.h" @@ -285,6 +286,7 @@ void OBJECT_OT_material_slot_add(wmOperatorType *ot) /* api callbacks */ ot->exec= material_slot_add_exec; + ot->poll= ED_operator_object_active_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -320,6 +322,7 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot) /* api callbacks */ ot->exec= material_slot_remove_exec; + ot->poll= ED_operator_object_active_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -379,6 +382,7 @@ void OBJECT_OT_material_slot_assign(wmOperatorType *ot) /* api callbacks */ ot->exec= material_slot_assign_exec; + ot->poll= ED_operator_object_active_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 8ebb71c33d0..331d9cfa957 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2988,7 +2988,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL, NULL); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK); RNA_def_property_ui_text(prop, "Active Object", "Active object for this scene"); /* Could call: ED_base_object_activate(C, scene->basact); * but would be a bad level call and it seems the notifier is enough */ |