Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_relations.c
| Context not available. | |||||
| #include "BKE_speaker.h" | #include "BKE_speaker.h" | ||||
| #include "BKE_texture.h" | #include "BKE_texture.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_rigidbody.h" | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| Context not available. | |||||
| static int make_links_scene_exec(bContext *C, wmOperator *op) | static int make_links_scene_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); | Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); | ||||
| Scene *scene_from = CTX_data_scene(C); | |||||
| if (scene_to == NULL) { | if (scene_to == NULL) { | ||||
| BKE_report(op->reports, RPT_ERROR, "Could not find scene"); | BKE_report(op->reports, RPT_ERROR, "Could not find scene"); | ||||
| Context not available. | |||||
| CTX_DATA_BEGIN (C, Base *, base, selected_bases) | CTX_DATA_BEGIN (C, Base *, base, selected_bases) | ||||
| { | { | ||||
| /* in case we link rigidbodies, copy the world of them as well (or we experience a crash if we try to access it */ | |||||
| if (scene_from->rigidbody_world != NULL && scene_to->rigidbody_world == NULL) { | |||||
| scene_to->rigidbody_world = BKE_rigidbody_world_copy(scene_from->rigidbody_world); | |||||
| } | |||||
| ED_object_scene_link(scene_to, base->object); | ED_object_scene_link(scene_to, base->object); | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| Context not available. | |||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| assign_material(base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF); | assign_material(base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF); | ||||
| DAG_id_tag_update(&base->object->id, OB_RECALC_OB); | |||||
| WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, base->object); | |||||
| WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); | WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); | ||||
| WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); | WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| Context not available. | |||||