Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_relations.c
| Show First 20 Lines • Show All 2,055 Lines • ▼ Show 20 Lines | FOREACH_OBJECT_FLAG_BEGIN (scene, view_layer, v3d, flag, ob) { | ||||
| if (!ID_IS_LINKED(ob)) { | if (!ID_IS_LINKED(ob)) { | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| BKE_animdata_copy_id_action(bmain, &ob->id); | BKE_animdata_copy_id_action(bmain, &ob->id); | ||||
| } | } | ||||
| } | } | ||||
| FOREACH_OBJECT_FLAG_END; | FOREACH_OBJECT_FLAG_END; | ||||
| } | } | ||||
| static void single_objectdata_action_users( | |||||
| Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const int flag) | |||||
| { | |||||
| FOREACH_OBJECT_FLAG_BEGIN (scene, view_layer, v3d, flag, ob) { | |||||
| if (!ID_IS_LINKED(ob) && ob->data != NULL) { | |||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | |||||
| BKE_animdata_copy_id_action(bmain, (ID *)ob->data); | |||||
| } | |||||
| } | |||||
| FOREACH_OBJECT_FLAG_END; | |||||
| } | |||||
| static void single_mat_users( | static void single_mat_users( | ||||
| Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const int flag) | Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const int flag) | ||||
| { | { | ||||
| Material *ma, *man; | Material *ma, *man; | ||||
| int a; | int a; | ||||
| FOREACH_OBJECT_FLAG_BEGIN (scene, view_layer, v3d, flag, ob) { | FOREACH_OBJECT_FLAG_BEGIN (scene, view_layer, v3d, flag, ob) { | ||||
| if (!ID_IS_LINKED(ob)) { | if (!ID_IS_LINKED(ob)) { | ||||
| ▲ Show 20 Lines • Show All 566 Lines • ▼ Show 20 Lines | static int make_single_user_exec(bContext *C, wmOperator *op) | ||||
| if (RNA_boolean_get(op->ptr, "material")) { | if (RNA_boolean_get(op->ptr, "material")) { | ||||
| single_mat_users(bmain, scene, view_layer, v3d, flag); | single_mat_users(bmain, scene, view_layer, v3d, flag); | ||||
| } | } | ||||
| if (RNA_boolean_get(op->ptr, "animation")) { | if (RNA_boolean_get(op->ptr, "animation")) { | ||||
| single_object_action_users(bmain, scene, view_layer, v3d, flag); | single_object_action_users(bmain, scene, view_layer, v3d, flag); | ||||
| } | } | ||||
| if (RNA_boolean_get(op->ptr, "obdata_animation")) { | |||||
| single_objectdata_action_users(bmain, scene, view_layer, v3d, flag); | |||||
| } | |||||
sybren: I guess this shouldn't be here, it can be removed when committing the patch. | |||||
| BKE_main_id_newptr_and_tag_clear(bmain); | BKE_main_id_newptr_and_tag_clear(bmain); | ||||
| WM_event_add_notifier(C, NC_WINDOW, NULL); | WM_event_add_notifier(C, NC_WINDOW, NULL); | ||||
| if (update_deps) { | if (update_deps) { | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| } | } | ||||
| Show All 25 Lines | void OBJECT_OT_make_single_user(wmOperatorType *ot) | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| /* properties */ | /* properties */ | ||||
| ot->prop = RNA_def_enum(ot->srna, "type", type_items, MAKE_SINGLE_USER_SELECTED, "Type", ""); | ot->prop = RNA_def_enum(ot->srna, "type", type_items, MAKE_SINGLE_USER_SELECTED, "Type", ""); | ||||
| RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects"); | RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects"); | ||||
| RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data"); | RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data"); | ||||
| RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each data-block"); | RNA_def_boolean(ot->srna, "material", 0, "Materials", "Make materials local to each data-block"); | ||||
| RNA_def_boolean( | RNA_def_boolean(ot->srna, | ||||
| ot->srna, "animation", 0, "Object Animation", "Make animation data local to each object"); | "animation", | ||||
| 0, | |||||
| "Object Animation", | |||||
| "Make object animation data local to each object"); | |||||
| RNA_def_boolean(ot->srna, | |||||
| "obdata_animation", | |||||
| 0, | |||||
| "Object Data Animation", | |||||
| "Make object data (mesh, curve etc.) animation data local to each object"); | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* ------------------------------------------------------------------- */ | /* ------------------------------------------------------------------- */ | ||||
| /** \name Drop Named Material on Object Operator | /** \name Drop Named Material on Object Operator | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines | |||||
I guess this shouldn't be here, it can be removed when committing the patch.