diff options
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 65 |
1 files changed, 42 insertions, 23 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 077ae2830a9..4678416e1c9 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -211,7 +211,8 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (ob != obedit) { ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; par = obedit->parent; @@ -428,7 +429,8 @@ void ED_object_parent_clear(bContext *C, int type) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (ob->parent == NULL) continue; @@ -673,7 +675,8 @@ static int parent_set_exec(bContext *C, wmOperator *op) int partype = RNA_enum_get(op->ptr, "type"); int ok = 1; - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) { ok = 0; break; @@ -754,7 +757,8 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) par->recalc |= OB_RECALC_OB; /* context iterator */ - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (ob != par) { if (BKE_object_parent_loop_check(par, ob)) { BKE_report(op->reports, RPT_ERROR, "Loop in parents"); @@ -805,7 +809,8 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (ob->parent) { if (ob->partype & PARSLOW) { ob->partype -= PARSLOW; @@ -847,7 +852,8 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (ob->parent) ob->partype |= PARSLOW; @@ -898,7 +904,8 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode"); return OPERATOR_CANCELLED; } - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { bConstraint *con, *pcon; /* remove track-object for old track */ @@ -964,7 +971,8 @@ static int track_set_exec(bContext *C, wmOperator *op) bConstraint *con; bDampTrackConstraint *data; - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (ob != obact) { con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK); @@ -983,7 +991,8 @@ static int track_set_exec(bContext *C, wmOperator *op) bConstraint *con; bTrackToConstraint *data; - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (ob != obact) { con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO); @@ -1004,7 +1013,8 @@ static int track_set_exec(bContext *C, wmOperator *op) bConstraint *con; bLockTrackConstraint *data; - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + { if (ob != obact) { con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK); @@ -1058,7 +1068,8 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op) if (!RNA_struct_property_is_set(op->ptr, "layers")) { /* note: layers are set in bases, library objects work for this */ - CTX_DATA_BEGIN (C, Base *, base, selected_bases) { + CTX_DATA_BEGIN (C, Base *, base, selected_bases) + { lay |= base->lay; } CTX_DATA_END; @@ -1107,7 +1118,8 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) if (v3d && v3d->localvd) { /* now we can move out of localview. */ /* note: layers are set in bases, library objects work for this */ - CTX_DATA_BEGIN (C, Base *, base, selected_bases) { + CTX_DATA_BEGIN (C, Base *, base, selected_bases) + { lay = base->lay & ~v3d->lay; base->lay = lay; base->object->lay = lay; @@ -1120,7 +1132,8 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) else { /* normal non localview operation */ /* note: layers are set in bases, library objects work for this */ - CTX_DATA_BEGIN (C, Base *, base, selected_bases) { + CTX_DATA_BEGIN (C, Base *, base, selected_bases) + { /* upper byte is used for local view */ local = base->lay & 0xFF000000; base->lay = lay + local; @@ -1202,7 +1215,8 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - CTX_DATA_BEGIN (C, Base *, base, selected_bases) { + CTX_DATA_BEGIN (C, Base *, base, selected_bases) + { if (!object_in_scene(base->object, scene_to)) { Base *nbase = MEM_mallocN(sizeof(Base), "newbase"); *nbase = *base; @@ -1262,7 +1276,8 @@ static int make_links_data_exec(bContext *C, wmOperator *op) ob = ED_object_active_context(C); - CTX_DATA_BEGIN (C, Object *, obt, selected_editable_objects) { + CTX_DATA_BEGIN (C, Object *, obt, selected_editable_objects) + { if (ob != obt) { if (allow_make_links_data(event, ob, obt)) { switch (event) { @@ -1471,7 +1486,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) } break; case OB_CAMERA: - ob->data = copy_camera(ob->data); + ob->data = BKE_camera_copy(ob->data); break; case OB_MESH: ob->data = copy_mesh(ob->data); @@ -1611,7 +1626,7 @@ static void single_tex_users_expand(Main *bmain) if (ma->id.flag & LIB_NEW) { for (b = 0; b < MAX_MTEX; b++) { if (ma->mtex[b] && ma->mtex[b]->tex) { - do_single_tex_user(&(ma->mtex[b]->tex) ); + do_single_tex_user(&(ma->mtex[b]->tex)); } } } @@ -1621,7 +1636,7 @@ static void single_tex_users_expand(Main *bmain) if (la->id.flag & LIB_NEW) { for (b = 0; b < MAX_MTEX; b++) { if (la->mtex[b] && la->mtex[b]->tex) { - do_single_tex_user(&(la->mtex[b]->tex) ); + do_single_tex_user(&(la->mtex[b]->tex)); } } } @@ -1631,7 +1646,7 @@ static void single_tex_users_expand(Main *bmain) if (wo->id.flag & LIB_NEW) { for (b = 0; b < MAX_MTEX; b++) { if (wo->mtex[b] && wo->mtex[b]->tex) { - do_single_tex_user(&(wo->mtex[b]->tex) ); + do_single_tex_user(&(wo->mtex[b]->tex)); } } } @@ -1725,21 +1740,24 @@ static int make_local_exec(bContext *C, wmOperator *op) clear_id_newpoins(); - CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_objects) + { if (ob->id.lib) id_make_local(&ob->id, 0); } CTX_DATA_END; /* maybe object pointers */ - CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_objects) + { if (ob->id.lib == NULL) { ID_NEW(ob->parent); } } CTX_DATA_END; - CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_objects) + { id = ob->data; if (id && mode > 1) { @@ -1767,7 +1785,8 @@ static int make_local_exec(bContext *C, wmOperator *op) CTX_DATA_END; if (mode > 1) { - CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { + CTX_DATA_BEGIN (C, Object *, ob, selected_objects) + { if (ob->type == OB_LAMP) { la = ob->data; |