Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/modifier.c
| Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_utils.h" | #include "BLI_string_utils.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BKE_appdir.h" | #include "BKE_appdir.h" | ||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_library.h" | |||||
| #include "BKE_library_query.h" | |||||
| #include "BKE_multires.h" | #include "BKE_multires.h" | ||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| /* may move these, only for modifier_path_relbase */ | /* may move these, only for modifier_path_relbase */ | ||||
| #include "BKE_global.h" /* ugh, G.main->name only */ | #include "BKE_global.h" /* ugh, G.main->name only */ | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| /* end */ | /* end */ | ||||
| ▲ Show 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | void modifier_copyData_generic(const ModifierData *md_src, ModifierData *md_dst) | ||||
| const ModifierTypeInfo *mti = modifierType_getInfo(md_src->type); | const ModifierTypeInfo *mti = modifierType_getInfo(md_src->type); | ||||
| const size_t data_size = sizeof(ModifierData); | const size_t data_size = sizeof(ModifierData); | ||||
| const char *md_src_data = ((const char *)md_src) + data_size; | const char *md_src_data = ((const char *)md_src) + data_size; | ||||
| char *md_dst_data = ((char *)md_dst) + data_size; | char *md_dst_data = ((char *)md_dst) + data_size; | ||||
| BLI_assert(data_size <= (size_t)mti->structSize); | BLI_assert(data_size <= (size_t)mti->structSize); | ||||
| memcpy(md_dst_data, md_src_data, (size_t)mti->structSize - data_size); | memcpy(md_dst_data, md_src_data, (size_t)mti->structSize - data_size); | ||||
| } | } | ||||
| void modifier_copyData(ModifierData *md, ModifierData *target) | static void modifier_copy_data_id_us_cb(void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin, int cb_flag) | ||||
| { | |||||
| ID *id = *idpoin; | |||||
| if (id != NULL && (cb_flag & IDWALK_CB_USER) != 0) { | |||||
| id_us_plus(id); | |||||
| } | |||||
| } | |||||
| void modifier_copyData_ex(ModifierData *md, ModifierData *target, const int flag) | |||||
| { | { | ||||
| const ModifierTypeInfo *mti = modifierType_getInfo(md->type); | const ModifierTypeInfo *mti = modifierType_getInfo(md->type); | ||||
| target->mode = md->mode; | target->mode = md->mode; | ||||
| if (mti->copyData) | if (mti->copyData) { | ||||
| mti->copyData(md, target); | mti->copyData(md, target); | ||||
| } | } | ||||
| if ((flag & LIB_ID_COPY_NO_USER_REFCOUNT) == 0) { | |||||
| if (mti->foreachIDLink) { | |||||
| mti->foreachIDLink(target, NULL, modifier_copy_data_id_us_cb, NULL); | |||||
| } | |||||
| else if (mti->foreachObjectLink) { | |||||
| mti->foreachObjectLink(target, NULL, (ObjectWalkFunc)modifier_copy_data_id_us_cb, NULL); | |||||
| } | |||||
| } | |||||
| } | |||||
| void modifier_copyData(ModifierData *md, ModifierData *target) | |||||
| { | |||||
| modifier_copyData_ex(md, target, 0); | |||||
| } | |||||
| bool modifier_supportsCage(struct Scene *scene, ModifierData *md) | bool modifier_supportsCage(struct Scene *scene, ModifierData *md) | ||||
| { | { | ||||
| const ModifierTypeInfo *mti = modifierType_getInfo(md->type); | const ModifierTypeInfo *mti = modifierType_getInfo(md->type); | ||||
| md->scene = scene; | md->scene = scene; | ||||
| return ((!mti->isDisabled || !mti->isDisabled(md, 0)) && | return ((!mti->isDisabled || !mti->isDisabled(md, 0)) && | ||||
| ▲ Show 20 Lines • Show All 502 Lines • Show Last 20 Lines | |||||