Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_relations.c
| Show First 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static int make_proxy_exec(bContext *C, wmOperator *op) | static int make_proxy_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Object *ob, *gob = ED_object_active_context(C); | Object *ob, *gob = ED_object_active_context(C); | ||||
| GroupObject *go; | GroupObject *go; | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| SceneLayer *sl = CTX_data_scene_layer(C); | |||||
| if (gob->dup_group != NULL) { | if (gob->dup_group != NULL) { | ||||
| go = BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "object")); | go = BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "object")); | ||||
| ob = go->ob; | ob = go->ob; | ||||
| } | } | ||||
| else { | else { | ||||
| ob = gob; | ob = gob; | ||||
| gob = NULL; | gob = NULL; | ||||
| } | } | ||||
| if (ob) { | if (ob) { | ||||
| Object *newob; | Object *newob; | ||||
| Base *newbase, *oldbase = BASACT; | Base *newbase, *oldbase = BASACT; | ||||
| char name[MAX_ID_NAME + 4]; | char name[MAX_ID_NAME + 4]; | ||||
| BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2); | BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2); | ||||
| /* Add new object for the proxy */ | /* Add new object for the proxy */ | ||||
| newob = BKE_object_add(bmain, scene, OB_EMPTY, name); | newob = BKE_object_add(bmain, scene, sl, OB_EMPTY, name); | ||||
| /* set layers OK */ | /* set layers OK */ | ||||
| newbase = BASACT; /* BKE_object_add sets active... */ | newbase = BASACT; /* BKE_object_add sets active... */ | ||||
| newbase->lay = oldbase->lay; | newbase->lay = oldbase->lay; | ||||
| newob->lay = newbase->lay; | newob->lay = newbase->lay; | ||||
| /* remove base, leave user count of object, it gets linked in BKE_object_make_proxy */ | /* remove base, leave user count of object, it gets linked in BKE_object_make_proxy */ | ||||
| if (gob == NULL) { | if (gob == NULL) { | ||||
| ▲ Show 20 Lines • Show All 1,440 Lines • ▼ Show 20 Lines | static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const int flag, const bool copy_groups) | ||||
| clear_sca_new_poins(); /* BGE logic */ | clear_sca_new_poins(); /* BGE logic */ | ||||
| /* duplicate all the objects of the scene */ | /* duplicate all the objects of the scene */ | ||||
| SceneCollection *msc = BKE_collection_master(scene); | SceneCollection *msc = BKE_collection_master(scene); | ||||
| single_object_users_scene_collection(bmain, scene, msc, flag, copy_groups); | single_object_users_scene_collection(bmain, scene, msc, flag, copy_groups); | ||||
| /* loop over SceneLayers and assign the pointers accordingly */ | /* loop over SceneLayers and assign the pointers accordingly */ | ||||
| for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) { | for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) { | ||||
| for (ObjectBase *ob_base = sl->object_bases.first; ob_base; ob_base = ob_base->next) { | for (ObjectBase *base = sl->object_bases.first; base; base = base->next) { | ||||
| ID_NEW_REMAP(ob_base->object); | ID_NEW_REMAP(base->object); | ||||
| } | } | ||||
| } | } | ||||
| /* duplicate groups that consist entirely of duplicated objects */ | /* duplicate groups that consist entirely of duplicated objects */ | ||||
| for (group = bmain->group.first; group; group = group->id.next) { | for (group = bmain->group.first; group; group = group->id.next) { | ||||
| if (copy_groups && group->gobject.first) { | if (copy_groups && group->gobject.first) { | ||||
| bool all_duplicated = true; | bool all_duplicated = true; | ||||
| ▲ Show 20 Lines • Show All 754 Lines • Show Last 20 Lines | |||||