forked from bartvdbraak/blender
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.
This commit is contained in:
parent
626c268096
commit
1728c20a63
@ -40,8 +40,7 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel):
|
||||
layout.template_ID(space, "pin_id")
|
||||
else:
|
||||
row = layout.row()
|
||||
row.label(text="", icon='OBJECT_DATA')
|
||||
row.prop(ob, "name", text="")
|
||||
row.template_ID(context.scene.objects, "active")
|
||||
|
||||
|
||||
class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user