diff options
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 82 |
1 files changed, 48 insertions, 34 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 8d488eeabac..463db871f55 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -97,6 +97,7 @@ static int vertex_parent_set_poll(bContext *C) static int vertex_parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditVert *eve; @@ -230,7 +231,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_OBJECT, NULL); @@ -295,6 +296,7 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int make_proxy_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Object *ob, *gob= CTX_data_active_object(C); GroupObject *go; Scene *scene= CTX_data_scene(C); @@ -338,7 +340,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op) object_make_proxy(newob, ob, gob); /* depsgraph flushes are needed for the new data */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&newob->id, OB_RECALC_ALL); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, newob); } @@ -413,6 +415,8 @@ static EnumPropertyItem prop_clear_parent_types[] = { /* note, poll should check for editable scene */ static int parent_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); int type= RNA_enum_get(op->ptr, "type"); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -431,8 +435,8 @@ static int parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(CTX_data_scene(C)); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -517,6 +521,7 @@ void ED_object_parent(Object *ob, Object *par, int type, const char *substr) static int parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *par= CTX_data_active_object(C); bPoseChannel *pchan= NULL; @@ -594,15 +599,15 @@ static int parent_set_exec(bContext *C, wmOperator *op) switch (partype) { case PAR_CURVE: /* curve deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Curve); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Curve); ((CurveModifierData *)md)->object= par; break; case PAR_LATTICE: /* lattice deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Lattice); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Lattice); ((LatticeModifierData *)md)->object= par; break; default: /* armature deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Armature); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Armature); ((ArmatureModifierData *)md)->object= par; break; } @@ -657,8 +662,8 @@ static int parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -719,6 +724,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot) static int parent_noinv_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Object *par= CTX_data_active_object(C); par->recalc |= OB_RECALC_OB; @@ -745,8 +751,8 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(CTX_data_scene(C)); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, CTX_data_scene(C)); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -772,6 +778,7 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot) static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -786,7 +793,7 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -813,6 +820,7 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot) static int object_slow_parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -824,7 +832,7 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -858,6 +866,8 @@ static EnumPropertyItem prop_clear_track_types[] = { /* note, poll should check for editable scene */ static int object_track_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); int type= RNA_enum_get(op->ptr, "type"); if(CTX_data_edit_object(C)) { @@ -883,8 +893,8 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); - DAG_scene_sort(CTX_data_scene(C)); + DAG_ids_flush_update(bmain, 0); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -920,6 +930,7 @@ static EnumPropertyItem prop_make_track_types[] = { static int track_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obact= CTX_data_active_object(C); @@ -987,8 +998,8 @@ static int track_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; } - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -1057,6 +1068,7 @@ static int move_to_layer_invoke(bContext *C, wmOperator *op, wmEvent *event) static int move_to_layer_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); unsigned int lay, local; @@ -1097,7 +1109,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) /* warning, active object may be hidden now */ WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); return OPERATOR_FINISHED; } @@ -1123,10 +1135,10 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot) /************************** Link to Scene Operator *****************************/ -void link_to_scene(unsigned short nr) +void link_to_scene(Main *bmain, unsigned short nr) { #if 0 - Scene *sce= (Scene*) BLI_findlink(&G.main->scene, G.curscreen->scenenr-1); + Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1); Base *base, *nbase; if(sce==0) return; @@ -1146,6 +1158,7 @@ void link_to_scene(unsigned short nr) static int make_links_scene_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); if(scene_to==NULL) { @@ -1174,7 +1187,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* one day multiple scenes will be visible, then we should have some update function for them */ return OPERATOR_FINISHED; @@ -1214,6 +1227,7 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt) static int make_links_data_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); int event = RNA_int_get(op->ptr, "type"); Object *ob; ID *id; @@ -1266,7 +1280,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; } @@ -1396,7 +1410,7 @@ void new_id_matar(Material **matar, int totcol) } } -void single_obdata_users(Scene *scene, int flag) +void single_obdata_users(Main *bmain, Scene *scene, int flag) { Object *ob; Lamp *la; @@ -1512,7 +1526,7 @@ void single_obdata_users(Scene *scene, int flag) } } - me= G.main->mesh.first; + me= bmain->mesh.first; while(me) { ID_NEW(me->texcomesh); me= me->id.next; @@ -1610,10 +1624,9 @@ void do_single_tex_user(Tex **from) } } -void single_tex_users_expand() +void single_tex_users_expand(Main *bmain) { /* only when 'parent' blocks are LIB_NEW */ - Main *bmain= G.main; Material *ma; Lamp *la; World *wo; @@ -1650,10 +1663,9 @@ void single_tex_users_expand() } } -static void single_mat_users_expand(void) +static void single_mat_users_expand(Main *bmain) { /* only when 'parent' blocks are LIB_NEW */ - Main *bmain= G.main; Object *ob; Mesh *me; Curve *cu; @@ -1686,14 +1698,14 @@ static void single_mat_users_expand(void) } /* used for copying scenes */ -void ED_object_single_users(Scene *scene, int full) +void ED_object_single_users(Main *bmain, Scene *scene, int full) { single_object_users(scene, NULL, 0); if(full) { - single_obdata_users(scene, 0); - single_mat_users_expand(); - single_tex_users_expand(); + single_obdata_users(bmain, scene, 0); + single_mat_users_expand(bmain); + single_tex_users_expand(bmain); } clear_id_newpoins(); @@ -1828,6 +1840,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot) static int make_single_user_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); /* ok if this is NULL */ int flag= RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */ @@ -1836,7 +1849,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op) single_object_users(scene, v3d, flag); if(RNA_boolean_get(op->ptr, "obdata")) - single_obdata_users(scene, flag); + single_obdata_users(bmain, scene, flag); if(RNA_boolean_get(op->ptr, "material")) single_mat_users(scene, flag, FALSE); @@ -1885,6 +1898,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event) { + Main *bmain= CTX_data_main(C); Base *base= ED_view3d_give_base_under_cursor(C, event->mval); Material *ma; char name[32]; @@ -1896,7 +1910,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even assign_material(base->object, ma, 1); - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; |