Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/object.c
| Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_sequencer.h" | #include "BKE_sequencer.h" | ||||
| #include "BKE_speaker.h" | #include "BKE_speaker.h" | ||||
| #include "BKE_softbody.h" | #include "BKE_softbody.h" | ||||
| #include "BKE_subsurf.h" | #include "BKE_subsurf.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_camera.h" | #include "BKE_camera.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_workspace.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "DRW_engine.h" | #include "DRW_engine.h" | ||||
| #ifdef WITH_MOD_FLUID | #ifdef WITH_MOD_FLUID | ||||
| #include "LBM_fluidsim.h" | #include "LBM_fluidsim.h" | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 613 Lines • ▼ Show 20 Lines | Object *BKE_object_add( | ||||
| LayerCollection *layer_collection; | LayerCollection *layer_collection; | ||||
| ob = object_add_common(bmain, view_layer, type, name); | ob = object_add_common(bmain, view_layer, type, name); | ||||
| layer_collection = BKE_layer_collection_get_active_ensure(scene, view_layer); | layer_collection = BKE_layer_collection_get_active_ensure(scene, view_layer); | ||||
| BKE_collection_object_add(&scene->id, layer_collection->scene_collection, ob); | BKE_collection_object_add(&scene->id, layer_collection->scene_collection, ob); | ||||
| base = BKE_view_layer_base_find(view_layer, ob); | base = BKE_view_layer_base_find(view_layer, ob); | ||||
| BKE_view_layer_base_select(view_layer, base); | BKE_view_layer_base_select(view_layer, base, NULL); | ||||
| return ob; | return ob; | ||||
| } | } | ||||
| /** | /** | ||||
| * Add a new object, using another one as a reference | * Add a new object, using another one as a reference | ||||
| * | * | ||||
| * /param ob_src object to use to determine the collections of the new object. | * /param ob_src object to use to determine the collections of the new object. | ||||
| */ | */ | ||||
| Object *BKE_object_add_from( | Object *BKE_object_add_from( | ||||
| Main *bmain, Scene *scene, ViewLayer *view_layer, | Main *bmain, Scene *scene, ViewLayer *view_layer, | ||||
| int type, const char *name, Object *ob_src) | int type, const char *name, Object *ob_src) | ||||
| { | { | ||||
| Object *ob; | Object *ob; | ||||
| Base *base; | Base *base; | ||||
| ob = object_add_common(bmain, view_layer, type, name); | ob = object_add_common(bmain, view_layer, type, name); | ||||
| BKE_collection_object_add_from(scene, ob_src, ob); | BKE_collection_object_add_from(scene, ob_src, ob); | ||||
| base = BKE_view_layer_base_find(view_layer, ob); | base = BKE_view_layer_base_find(view_layer, ob); | ||||
| BKE_view_layer_base_select(view_layer, base); | BKE_view_layer_base_select(view_layer, base, NULL); | ||||
| return ob; | return ob; | ||||
| } | } | ||||
| #ifdef WITH_GAMEENGINE | #ifdef WITH_GAMEENGINE | ||||
| void BKE_object_lod_add(Object *ob) | void BKE_object_lod_add(Object *ob) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 436 Lines • ▼ Show 20 Lines | if (ob_src->pose) { | ||||
| if (ob_src->type == OB_ARMATURE) | if (ob_src->type == OB_ARMATURE) | ||||
| BKE_pose_rebuild(ob_dst, ob_dst->data); | BKE_pose_rebuild(ob_dst, ob_dst->data); | ||||
| } | } | ||||
| defgroup_copy_list(&ob_dst->defbase, &ob_src->defbase); | defgroup_copy_list(&ob_dst->defbase, &ob_src->defbase); | ||||
| BKE_object_facemap_copy_list(&ob_dst->fmaps, &ob_src->fmaps); | BKE_object_facemap_copy_list(&ob_dst->fmaps, &ob_src->fmaps); | ||||
| BKE_constraints_copy_ex(&ob_dst->constraints, &ob_src->constraints, flag_subdata, true); | BKE_constraints_copy_ex(&ob_dst->constraints, &ob_src->constraints, flag_subdata, true); | ||||
| ob_dst->mode = OB_MODE_OBJECT; | ob_dst->mode = OB_MODE_OBJECT; | ||||
| // BKE_workspace_object_mode_ensure_updated(NULL, ob_dst, OB_MODE_OBJECT, true); | |||||
| ob_dst->sculpt = NULL; | ob_dst->sculpt = NULL; | ||||
| if (ob_src->pd) { | if (ob_src->pd) { | ||||
| ob_dst->pd = MEM_dupallocN(ob_src->pd); | ob_dst->pd = MEM_dupallocN(ob_src->pd); | ||||
| if (ob_dst->pd->rng) { | if (ob_dst->pd->rng) { | ||||
| ob_dst->pd->rng = MEM_dupallocN(ob_src->pd->rng); | ob_dst->pd->rng = MEM_dupallocN(ob_src->pd->rng); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,520 Lines • Show Last 20 Lines | |||||