diff options
author | Julian Eisel <julian@blender.org> | 2020-07-01 18:25:04 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-07-01 18:25:04 +0300 |
commit | 889c4ca9c26d770af02cedef972d65eb173bdb5e (patch) | |
tree | 6f46156146db1b3f09d92c6eaa1f44ba8a584ed4 /source/blender/modifiers | |
parent | 87df15190210eb84ef52e5dccc2932918f912da5 (diff) | |
parent | 0829cebeb024095c268f190c34daa8ae9a5a224c (diff) |
Merge branch 'asset-uuid--archived' into asset-engine--archivedasset-engine--archived
Diffstat (limited to 'source/blender/modifiers')
26 files changed, 471 insertions, 107 deletions
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 460f697a0a9..80a1ebab64e 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -175,3 +175,7 @@ endif() add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_modifiers "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +# Some modifiers include BLO_read_write.h, which includes dna_type_offsets.h +# which is generated by bf_dna. Need to ensure compilaiton order here. +add_dependencies(bf_modifiers bf_dna) diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 9cc1f4596a9..b62c03d1b03 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -49,6 +49,8 @@ #include "RNA_access.h" +#include "BLO_read_write.h" + #include "DEG_depsgraph_query.h" #include "bmesh.h" @@ -249,7 +251,7 @@ static void panel_draw(const bContext *C, Panel *panel) uiItemR(col, &ptr, "use_deform_preserve_volume", 0, NULL, ICON_NONE); uiItemR(col, &ptr, "use_multi_modifier", 0, NULL, ICON_NONE); - col = uiLayoutColumnWithHeading(layout, true, "Bind to"); + col = uiLayoutColumnWithHeading(layout, true, IFACE_("Bind to")); uiItemR(col, &ptr, "use_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE); uiItemR(col, &ptr, "use_bone_envelopes", 0, IFACE_("Bone Envelopes"), ICON_NONE); @@ -261,6 +263,13 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_Armature, panel_draw); } +static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) +{ + ArmatureModifierData *amd = (ArmatureModifierData *)md; + + amd->vert_coords_prev = NULL; +} + ModifierTypeInfo modifierType_Armature = { /* name */ "Armature", /* structName */ "ArmatureModifierData", @@ -293,5 +302,5 @@ ModifierTypeInfo modifierType_Armature = { /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 35e3bb97fc3..0a1eb8eba10 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -51,6 +51,8 @@ #include "MOD_ui_common.h" #include "MOD_util.h" +#include "BLO_read_write.h" + #include "BKE_curveprofile.h" #include "bmesh.h" #include "bmesh_tools.h" @@ -118,6 +120,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0; const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK); const int offset_type = bmd->val_flags; + const int profile_type = bmd->profile_type; const float value = bmd->value; const int mat = CLAMPIS(bmd->mat, -1, ctx->object->totcol - 1); const bool loop_slide = (bmd->flags & MOD_BEVEL_EVEN_WIDTHS) == 0; @@ -128,7 +131,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * const int miter_outer = bmd->miter_outer; const int miter_inner = bmd->miter_inner; const float spread = bmd->spread; - const bool use_custom_profile = (bmd->flags & MOD_BEVEL_CUSTOM_PROFILE); const int vmesh_method = bmd->vmesh_method; const bool invert_vgroup = (bmd->flags & MOD_BEVEL_INVERT_VGROUP) != 0; @@ -225,6 +227,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * BM_mesh_bevel(bm, value, offset_type, + profile_type, bmd->res, bmd->profile, vertex_only, @@ -242,7 +245,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * miter_inner, spread, mesh->smoothresh, - use_custom_profile, bmd->custom_profile, vmesh_method); @@ -302,6 +304,9 @@ static void panel_draw(const bContext *C, Panel *panel) case BEVEL_AMT_OFFSET: offset_name = "Offset"; break; + case BEVEL_AMT_ABSOLUTE: + offset_name = "Absolute"; + break; } uiItemR(col, &ptr, "width", 0, IFACE_(offset_name), ICON_NONE); } @@ -371,53 +376,64 @@ static void shading_panel_draw(const bContext *C, Panel *panel) static void profile_panel_draw(const bContext *C, Panel *panel) { - PointerRNA ptr; - modifier_panel_get_property_pointers(C, panel, NULL, &ptr); - uiLayout *layout = panel->layout; - - uiLayoutSetPropSep(layout, true); - - uiItemR(layout, &ptr, "profile", UI_ITEM_R_SLIDER, IFACE_("Shape"), ICON_NONE); -} - -static void custom_profile_panel_draw_header(const bContext *C, Panel *panel) -{ uiLayout *layout = panel->layout; PointerRNA ptr; modifier_panel_get_property_pointers(C, panel, NULL, &ptr); - uiItemR(layout, &ptr, "use_custom_profile", 0, NULL, ICON_NONE); -} + int profile_type = RNA_enum_get(&ptr, "profile_type"); -static void custom_profile_panel_draw(const bContext *C, Panel *panel) -{ - PointerRNA ptr; - modifier_panel_get_property_pointers(C, panel, NULL, &ptr); - uiLayout *layout = panel->layout; + uiItemR(layout, &ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - uiLayoutSetActive(layout, RNA_boolean_get(&ptr, "use_custom_profile")); + uiLayoutSetPropSep(layout, true); - uiTemplateCurveProfile(layout, &ptr, "custom_profile"); + if (ELEM(profile_type, MOD_BEVEL_PROFILE_SUPERELLIPSE, MOD_BEVEL_PROFILE_CUSTOM)) { + uiItemR(layout, + &ptr, + "profile", + UI_ITEM_R_SLIDER, + (profile_type == MOD_BEVEL_PROFILE_SUPERELLIPSE) ? IFACE_("Shape") : + IFACE_("Miter Shape"), + ICON_NONE); + + if (profile_type == MOD_BEVEL_PROFILE_CUSTOM) { + uiLayout *sub = uiLayoutColumn(layout, false); + uiLayoutSetPropDecorate(sub, false); + uiTemplateCurveProfile(sub, &ptr, "custom_profile"); + } + } } static void panelRegister(ARegionType *region_type) { PanelType *panel_type = modifier_panel_register(region_type, eModifierType_Bevel, panel_draw); - PanelType *bevel_profil_panel = modifier_subpanel_register( + modifier_subpanel_register( region_type, "profile", "Profile", NULL, profile_panel_draw, panel_type); - modifier_subpanel_register(region_type, - "custom", - "", - custom_profile_panel_draw_header, - custom_profile_panel_draw, - bevel_profil_panel); modifier_subpanel_register( region_type, "geometry", "Geometry", NULL, geometry_panel_draw, panel_type); modifier_subpanel_register( region_type, "shading", "Shading", NULL, shading_panel_draw, panel_type); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const BevelModifierData *bmd = (const BevelModifierData *)md; + + if (bmd->custom_profile) { + BKE_curveprofile_blend_write(writer, bmd->custom_profile); + } +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + BevelModifierData *bmd = (BevelModifierData *)md; + + BLO_read_data_address(reader, &bmd->custom_profile); + if (bmd->custom_profile) { + BKE_curveprofile_blend_read(reader, bmd->custom_profile); + } +} + ModifierTypeInfo modifierType_Bevel = { /* name */ "Bevel", /* structName */ "BevelModifierData", @@ -446,6 +462,6 @@ ModifierTypeInfo modifierType_Bevel = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* uiPanel */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 9f588a4d345..cc9def73e12 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -565,7 +565,7 @@ static void panel_draw(const bContext *C, Panel *panel) uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE); if (!RNA_pointer_is_null(&cast_object_ptr)) { - uiItemR(layout, &ptr, "use_radius_as_size", 0, NULL, ICON_NONE); + uiItemR(layout, &ptr, "use_transform", 0, NULL, ICON_NONE); } modifier_panel_end(layout, &ptr); diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 7a338b59e98..a355558a3ba 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -54,6 +54,8 @@ #include "MOD_ui_common.h" #include "MOD_util.h" +#include "BLO_read_write.h" + #include "DEG_depsgraph_query.h" static void initData(ModifierData *md) @@ -269,6 +271,34 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_Collision, panel_draw); } +static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) +{ + CollisionModifierData *collmd = (CollisionModifierData *)md; +#if 0 + // TODO: CollisionModifier should use pointcache + // + have proper reset events before enabling this + collmd->x = newdataadr(fd, collmd->x); + collmd->xnew = newdataadr(fd, collmd->xnew); + collmd->mfaces = newdataadr(fd, collmd->mfaces); + + collmd->current_x = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_x"); + collmd->current_xnew = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_xnew"); + collmd->current_v = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_v"); +#endif + + collmd->x = NULL; + collmd->xnew = NULL; + collmd->current_x = NULL; + collmd->current_xnew = NULL; + collmd->current_v = NULL; + collmd->time_x = collmd->time_xnew = -1000; + collmd->mvert_num = 0; + collmd->tri_num = 0; + collmd->is_static = false; + collmd->bvhtree = NULL; + collmd->tri = NULL; +} + ModifierTypeInfo modifierType_Collision = { /* name */ "Collision", /* structName */ "CollisionModifierData", @@ -300,5 +330,5 @@ ModifierTypeInfo modifierType_Collision = { /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index ba343854d41..ac91056ed7d 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -54,6 +54,8 @@ #include "MOD_ui_common.h" #include "MOD_util.h" +#include "BLO_read_write.h" + #include "BLI_strict_flags.h" #include "DEG_depsgraph_query.h" @@ -817,6 +819,28 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_CorrectiveSmooth, panel_draw); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const CorrectiveSmoothModifierData *csmd = (const CorrectiveSmoothModifierData *)md; + + if (csmd->bind_coords) { + BLO_write_float3_array(writer, (int)csmd->bind_coords_num, (float *)csmd->bind_coords); + } +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md; + + if (csmd->bind_coords) { + BLO_read_float3_array(reader, (int)csmd->bind_coords_num, (float **)&csmd->bind_coords); + } + + /* runtime only */ + csmd->delta_cache.deltas = NULL; + csmd->delta_cache.totverts = 0; +} + ModifierTypeInfo modifierType_CorrectiveSmooth = { /* name */ "CorrectiveSmooth", /* structName */ "CorrectiveSmoothModifierData", @@ -847,6 +871,6 @@ ModifierTypeInfo modifierType_CorrectiveSmooth = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 4fa7bf4cd63..75fd558ae39 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -239,14 +239,14 @@ static void panel_draw(const bContext *C, Panel *panel) int decimate_type = RNA_enum_get(&ptr, "decimate_type"); char count_info[32]; - snprintf(count_info, 32, IFACE_("Face Count: %d"), RNA_int_get(&ptr, "face_count")); + snprintf(count_info, 32, "%s: %d", IFACE_("Face Count"), RNA_int_get(&ptr, "face_count")); uiItemR(layout, &ptr, "decimate_type", 0, NULL, ICON_NONE); if (decimate_type == MOD_DECIM_MODE_COLLAPSE) { uiItemR(layout, &ptr, "ratio", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - row = uiLayoutRowWithHeading(layout, true, "Symmetry"); + row = uiLayoutRowWithHeading(layout, true, IFACE_("Symmetry")); uiLayoutSetPropDecorate(row, false); sub = uiLayoutRow(row, true); uiItemR(sub, &ptr, "use_symmetry", 0, "", ICON_NONE); diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 32e36fbd09e..894a48d9f62 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -440,6 +440,8 @@ static void panel_draw(const bContext *C, Panel *panel) PointerRNA ob_ptr; modifier_panel_get_property_pointers(C, panel, &ob_ptr, &ptr); + PointerRNA obj_data_ptr = RNA_pointer_get(&ob_ptr, "data"); + PointerRNA texture_ptr = RNA_pointer_get(&ptr, "texture"); bool has_texture = !RNA_pointer_is_null(&texture_ptr); int texture_coords = RNA_enum_get(&ptr, "texture_coords"); @@ -467,7 +469,7 @@ static void panel_draw(const bContext *C, Panel *panel) } } else if (texture_coords == MOD_DISP_MAP_UV && RNA_enum_get(&ob_ptr, "type") == OB_MESH) { - uiItemR(col, &ptr, "uv_layer", 0, NULL, ICON_NONE); + uiItemPointerR(col, &ptr, "uv_layer", &obj_data_ptr, "uv_layers", NULL, ICON_NONE); } uiItemS(layout); diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 00e39a7ea6c..29f7294c202 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -49,6 +49,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "DEG_depsgraph_query.h" @@ -1228,6 +1230,13 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_Explode, panel_draw); } +static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) +{ + ExplodeModifierData *psmd = (ExplodeModifierData *)md; + + psmd->facepa = NULL; +} + ModifierTypeInfo modifierType_Explode = { /* name */ "Explode", /* structName */ "ExplodeModifierData", @@ -1258,5 +1267,5 @@ ModifierTypeInfo modifierType_Explode = { /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 4305c32071d..c8cfc07562f 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -46,6 +46,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "DEG_depsgraph_query.h" @@ -468,6 +470,29 @@ static void panelRegister(ARegionType *region_type) region_type, "falloff", "Falloff", NULL, falloff_panel_draw, panel_type); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const HookModifierData *hmd = (const HookModifierData *)md; + + if (hmd->curfalloff) { + BKE_curvemapping_blend_write(writer, hmd->curfalloff); + } + + BLO_write_int32_array(writer, hmd->totindex, hmd->indexar); +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + HookModifierData *hmd = (HookModifierData *)md; + + BLO_read_data_address(reader, &hmd->curfalloff); + if (hmd->curfalloff) { + BKE_curvemapping_blend_read(reader, hmd->curfalloff); + } + + BLO_read_int32_array(reader, hmd->totindex, &hmd->indexar); +} + ModifierTypeInfo modifierType_Hook = { /* name */ "Hook", /* structName */ "HookModifierData", @@ -498,6 +523,6 @@ ModifierTypeInfo modifierType_Hook = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index f324a6f92b9..e53de598218 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -49,6 +49,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "MEM_guardedalloc.h" @@ -607,6 +609,35 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_MeshDeform, panel_draw); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; + int size = mmd->dyngridsize; + + BLO_write_struct_array(writer, MDefInfluence, mmd->totinfluence, mmd->bindinfluences); + BLO_write_int32_array(writer, mmd->totvert + 1, mmd->bindoffsets); + BLO_write_float3_array(writer, mmd->totcagevert, mmd->bindcagecos); + BLO_write_struct_array(writer, MDefCell, size * size * size, mmd->dyngrid); + BLO_write_struct_array(writer, MDefInfluence, mmd->totinfluence, mmd->dyninfluences); + BLO_write_int32_array(writer, mmd->totvert, mmd->dynverts); +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; + + BLO_read_data_address(reader, &mmd->bindinfluences); + BLO_read_int32_array(reader, mmd->totvert + 1, &mmd->bindoffsets); + BLO_read_float3_array(reader, mmd->totcagevert, &mmd->bindcagecos); + BLO_read_data_address(reader, &mmd->dyngrid); + BLO_read_data_address(reader, &mmd->dyninfluences); + BLO_read_int32_array(reader, mmd->totvert, &mmd->dynverts); + + /* Deprecated storage. */ + BLO_read_float_array(reader, mmd->totvert, &mmd->bindweights); + BLO_read_float3_array(reader, mmd->totcagevert, &mmd->bindcos); +} + ModifierTypeInfo modifierType_MeshDeform = { /* name */ "MeshDeform", /* structName */ "MeshDeformModifierData", @@ -638,6 +669,6 @@ ModifierTypeInfo modifierType_MeshDeform = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index b4269513f8e..9eae7ae941f 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -44,6 +44,8 @@ #include "RNA_access.h" +#include "BLO_read_write.h" + #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_query.h" @@ -229,6 +231,13 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_MeshSequenceCache, panel_draw); } +static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) +{ + MeshSeqCacheModifierData *msmcd = (MeshSeqCacheModifierData *)md; + msmcd->reader = NULL; + msmcd->reader_object_path[0] = '\0'; +} + ModifierTypeInfo modifierType_MeshSequenceCache = { /* name */ "MeshSequenceCache", /* structName */ "MeshSeqCacheModifierData", @@ -260,5 +269,5 @@ ModifierTypeInfo modifierType_MeshSequenceCache = { /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 6abea36df35..5f67d591e60 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -181,18 +181,17 @@ static void data_panel_draw(const bContext *C, Panel *panel) uiLayoutSetPropSep(layout, true); - col = uiLayoutColumnWithHeading(layout, false, IFACE_("Mirror U")); - row = uiLayoutRow(col, true); + col = uiLayoutColumn(layout, true); + row = uiLayoutRowWithHeading(col, true, IFACE_("Mirror U")); uiLayoutSetPropDecorate(row, false); sub = uiLayoutRow(row, true); uiItemR(sub, &ptr, "use_mirror_u", 0, "", ICON_NONE); sub = uiLayoutRow(sub, true); uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_mirror_u")); uiItemR(sub, &ptr, "mirror_offset_u", UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemDecoratorR(row, &ptr, "mirror_offset_v", 0); + uiItemDecoratorR(row, &ptr, "mirror_offset_u", 0); - col = uiLayoutColumnWithHeading(layout, false, "V"); - row = uiLayoutRow(col, true); + row = uiLayoutRowWithHeading(col, true, IFACE_("V")); uiLayoutSetPropDecorate(row, false); sub = uiLayoutRow(row, true); uiItemR(sub, &ptr, "use_mirror_v", 0, "", ICON_NONE); @@ -201,6 +200,10 @@ static void data_panel_draw(const bContext *C, Panel *panel) uiItemR(sub, &ptr, "mirror_offset_v", UI_ITEM_R_SLIDER, "", ICON_NONE); uiItemDecoratorR(row, &ptr, "mirror_offset_v", 0); + col = uiLayoutColumn(layout, true); + uiItemR(col, &ptr, "offset_u", UI_ITEM_R_SLIDER, IFACE_("Offset U"), ICON_NONE); + uiItemR(col, &ptr, "offset_v", UI_ITEM_R_SLIDER, IFACE_("V"), ICON_NONE); + uiItemR(layout, &ptr, "use_mirror_vertex_groups", 0, IFACE_("Vertex Groups"), ICON_NONE); uiItemR(layout, &ptr, "use_mirror_udim", 0, IFACE_("Flip UDIM"), ICON_NONE); } diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index e56ff991b6f..53e53315cfe 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -296,10 +296,10 @@ static void panel_draw(const bContext *C, Panel *panel) /** * Changing some of the properties can not be done once there is an - * actual displacement stored for this multires modifier. This check - * will disallow changes for those properties. - * This check is a bit stupif but it should be sufficient for the usual - * multires usage. It might become less strict and only disallow + * actual displacement stored for this multi-resolution modifier. + * This check will disallow changes for those properties. + * This check is a bit stupid but it should be sufficient for the usual + * multi-resolution usage. It might become less strict and only disallow * modifications if there is CD_MDISPS layer, or if there is actual * non-zero displacement, but such checks will be too slow to be done * on every redraw. diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 1cdba84bb27..88581464a02 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -49,6 +49,8 @@ #include "RNA_access.h" +#include "BLO_read_write.h" + #include "WM_types.h" /* For UI free bake operator. */ #include "DEG_depsgraph_query.h" @@ -674,6 +676,13 @@ static void panelRegister(ARegionType *region_type) #endif /* WITH_OCEANSIM */ } +static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) +{ + OceanModifierData *omd = (OceanModifierData *)md; + omd->oceancache = NULL; + omd->ocean = NULL; +} + ModifierTypeInfo modifierType_Ocean = { /* name */ "Ocean", /* structName */ "OceanModifierData", @@ -706,5 +715,5 @@ ModifierTypeInfo modifierType_Ocean = { /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 8c25c3eb4ba..ea0c63da1b0 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -46,6 +46,8 @@ #include "DEG_depsgraph_query.h" +#include "BLO_read_write.h" + #include "MOD_ui_common.h" #include "MOD_util.h" @@ -295,6 +297,18 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_ParticleSystem, panel_draw); } +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; + + psmd->mesh_final = NULL; + psmd->mesh_original = NULL; + /* This is written as part of ob->particlesystem. */ + BLO_read_data_address(reader, &psmd->psys); + psmd->flag &= ~eParticleSystemFlag_psys_updated; + psmd->flag |= eParticleSystemFlag_file_loaded; +} + ModifierTypeInfo modifierType_ParticleSystem = { /* name */ "ParticleSystem", /* structName */ "ParticleSystemModifierData", @@ -330,5 +344,5 @@ ModifierTypeInfo modifierType_ParticleSystem = { /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index b1e6e12b4b3..6fc564448c3 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -190,8 +190,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx) break; } /* TODO(jbakker): Dualcon crashes when run in parallel. Could be related to incorrect - * input data or that the library isn't thread safe. This was identified when changing the task - * isolations during T76553. */ + * input data or that the library isn't thread safe. + * This was identified when changing the task isolation's during T76553. */ static ThreadMutex dualcon_mutex = BLI_MUTEX_INITIALIZER; BLI_mutex_lock(&dualcon_mutex); output = dualcon(&input, diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index f8d372f4d2b..82a8227c33a 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -128,7 +128,7 @@ static void panel_draw(const bContext *C, Panel *panel) uiItemR(layout, &ptr, "use_even_offset", 0, NULL, ICON_NONE); } - col = uiLayoutColumnWithHeading(layout, false, "Rim"); + col = uiLayoutColumnWithHeading(layout, false, IFACE_("Rim")); uiItemR(col, &ptr, "use_rim", 0, IFACE_("Fill"), ICON_NONE); sub = uiLayoutColumn(col, false); uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_rim")); diff --git a/source/blender/modifiers/intern/MOD_solidify_extrude.c b/source/blender/modifiers/intern/MOD_solidify_extrude.c index 75d2be5292e..a56194354f8 100644 --- a/source/blender/modifiers/intern/MOD_solidify_extrude.c +++ b/source/blender/modifiers/intern/MOD_solidify_extrude.c @@ -76,7 +76,7 @@ BLI_INLINE bool edgeref_is_init(const EdgeFaceRef *edge_ref) } /** - * \param dm: Mesh to calculate normals for. + * \param mesh: Mesh to calculate normals for. * \param poly_nors: Precalculated face normals. * \param r_vert_nors: Return vert normals. */ diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index aca4cad95b8..cbd2c2d27be 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -57,6 +57,8 @@ #include "MOD_modifiertypes.h" #include "MOD_ui_common.h" +#include "BLO_read_write.h" + #include "intern/CCGSubSurf.h" typedef struct SubsurfRuntimeData { @@ -414,8 +416,6 @@ static void advanced_panel_draw(const bContext *C, Panel *panel) uiItemR(layout, &ptr, "quality", 0, NULL, ICON_NONE); uiItemR(layout, &ptr, "uv_smooth", 0, NULL, ICON_NONE); uiItemR(layout, &ptr, "use_creases", 0, NULL, ICON_NONE); - - modifier_panel_end(layout, &ptr); } static void panelRegister(ARegionType *region_type) @@ -425,6 +425,13 @@ static void panelRegister(ARegionType *region_type) region_type, "advanced", "Advanced", NULL, advanced_panel_draw, panel_type); } +static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) +{ + SubsurfModifierData *smd = (SubsurfModifierData *)md; + + smd->emCache = smd->mCache = NULL; +} + ModifierTypeInfo modifierType_Subsurf = { /* name */ "Subdivision", /* structName */ "SubsurfModifierData", @@ -458,5 +465,5 @@ ModifierTypeInfo modifierType_Subsurf = { /* freeRuntimeData */ freeRuntimeData, /* panelRegister */ panelRegister, /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 32b342b1471..e476e01a9f2 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -51,6 +51,8 @@ #include "MOD_ui_common.h" #include "MOD_util.h" +#include "BLO_read_write.h" + #include "MEM_guardedalloc.h" static void initData(ModifierData *md) @@ -210,6 +212,17 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_Surface, panel_draw); } +static void blendRead(BlendDataReader *UNUSED(reader), ModifierData *md) +{ + SurfaceModifierData *surmd = (SurfaceModifierData *)md; + + surmd->mesh = NULL; + surmd->bvhtree = NULL; + surmd->x = NULL; + surmd->v = NULL; + surmd->numverts = 0; +} + ModifierTypeInfo modifierType_Surface = { /* name */ "Surface", /* structName */ "SurfaceModifierData", @@ -242,5 +255,5 @@ ModifierTypeInfo modifierType_Surface = { /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index e1bc6305b0a..fc41afb6613 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -47,6 +47,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "DEG_depsgraph.h" @@ -1438,6 +1440,64 @@ static void panelRegister(ARegionType *region_type) modifier_panel_register(region_type, eModifierType_SurfaceDeform, panel_draw); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const SurfaceDeformModifierData *smd = (const SurfaceDeformModifierData *)md; + + BLO_write_struct_array(writer, SDefVert, smd->numverts, smd->verts); + + if (smd->verts) { + for (int i = 0; i < smd->numverts; i++) { + BLO_write_struct_array(writer, SDefBind, smd->verts[i].numbinds, smd->verts[i].binds); + + if (smd->verts[i].binds) { + for (int j = 0; j < smd->verts[i].numbinds; j++) { + BLO_write_uint32_array( + writer, smd->verts[i].binds[j].numverts, smd->verts[i].binds[j].vert_inds); + + if (smd->verts[i].binds[j].mode == MOD_SDEF_MODE_CENTROID || + smd->verts[i].binds[j].mode == MOD_SDEF_MODE_LOOPTRI) { + BLO_write_float3_array(writer, 1, smd->verts[i].binds[j].vert_weights); + } + else { + BLO_write_float_array( + writer, smd->verts[i].binds[j].numverts, smd->verts[i].binds[j].vert_weights); + } + } + } + } + } +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md; + + BLO_read_data_address(reader, &smd->verts); + + if (smd->verts) { + for (int i = 0; i < smd->numverts; i++) { + BLO_read_data_address(reader, &smd->verts[i].binds); + + if (smd->verts[i].binds) { + for (int j = 0; j < smd->verts[i].numbinds; j++) { + BLO_read_uint32_array( + reader, smd->verts[i].binds[j].numverts, &smd->verts[i].binds[j].vert_inds); + + if (smd->verts[i].binds[j].mode == MOD_SDEF_MODE_CENTROID || + smd->verts[i].binds[j].mode == MOD_SDEF_MODE_LOOPTRI) { + BLO_read_float3_array(reader, 1, &smd->verts[i].binds[j].vert_weights); + } + else { + BLO_read_float_array( + reader, smd->verts[i].binds[j].numverts, &smd->verts[i].binds[j].vert_weights); + } + } + } + } + } +} + ModifierTypeInfo modifierType_SurfaceDeform = { /* name */ "SurfaceDeform", /* structName */ "SurfaceDeformModifierData", @@ -1468,6 +1528,6 @@ ModifierTypeInfo modifierType_SurfaceDeform = { /* foreachTexLink */ NULL, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c index cc0d3d8ccee..63ec9a2d929 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.c +++ b/source/blender/modifiers/intern/MOD_ui_common.c @@ -127,7 +127,7 @@ void modifier_panel_end(uiLayout *layout, PointerRNA *ptr) /** * Gets RNA pointers for the active object and the panel's modifier data. Also locks - * the layout if the modifer is from a linked object, and sets the context pointer. + * the layout if the modifier is from a linked object, and sets the context pointer. */ #define ERROR_LIBDATA_MESSAGE TIP_("External library data") void modifier_panel_get_property_pointers(const bContext *C, @@ -146,8 +146,7 @@ void modifier_panel_get_property_pointers(const bContext *C, } uiBlock *block = uiLayoutGetBlock(panel->layout); - UI_block_lock_set( - block, BKE_object_obdata_is_libdata(ob) || ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE); + UI_block_lock_set(block, ID_IS_LINKED(ob), ERROR_LIBDATA_MESSAGE); uiLayoutSetContextPointer(panel->layout, "modifier", r_md_ptr); } @@ -222,19 +221,29 @@ static bool modifier_can_delete(ModifierData *md) return true; } -static void modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void *md_v) +static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v) { + PointerRNA op_ptr; + uiLayout *row; ModifierData *md = (ModifierData *)md_v; + PointerRNA ptr; + Object *ob = get_modifier_object(C); + RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr); + uiLayoutSetContextPointer(layout, "modifier", &ptr); uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); + uiLayoutSetUnitsX(layout, 4.0f); + + /* Apply. */ uiItemEnumO(layout, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), - 0, + ICON_CHECKMARK, "apply_as", MODIFIER_APPLY_DATA); + /* Apply as shapekey. */ if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) { uiItemEnumO(layout, "OBJECT_OT_modifier_apply", @@ -244,6 +253,7 @@ static void modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void MODIFIER_APPLY_SHAPE); } + /* Duplicate. */ if (!ELEM(md->type, eModifierType_Fluidsim, eModifierType_Softbody, @@ -256,17 +266,42 @@ static void modifier_ops_extra_draw(bContext *UNUSED(C), uiLayout *layout, void "OBJECT_OT_modifier_copy"); } - if (modifier_can_delete(md) && !modifier_is_simulation(md)) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete"), - ICON_X, - "OBJECT_OT_modifier_remove"); + uiItemS(layout); + + /* Move to first. */ + row = uiLayoutColumn(layout, false); + uiItemFullO(row, + "OBJECT_OT_modifier_move_to_index", + IFACE_("Move to First"), + ICON_TRIA_UP, + NULL, + WM_OP_INVOKE_DEFAULT, + 0, + &op_ptr); + RNA_int_set(&op_ptr, "index", 0); + if (!md->prev) { + uiLayoutSetEnabled(row, false); + } + + /* Move to last. */ + row = uiLayoutColumn(layout, false); + uiItemFullO(row, + "OBJECT_OT_modifier_move_to_index", + IFACE_("Move to Last"), + ICON_TRIA_DOWN, + NULL, + WM_OP_INVOKE_DEFAULT, + 0, + &op_ptr); + RNA_int_set(&op_ptr, "index", BLI_listbase_count(&ob->modifiers) - 1); + if (!md->next) { + uiLayoutSetEnabled(row, false); } } static void modifier_panel_header(const bContext *C, Panel *panel) { - uiLayout *row, *sub; + uiLayout *row, *sub, *name_row; uiLayout *layout = panel->layout; PointerRNA ptr; @@ -280,32 +315,22 @@ static void modifier_panel_header(const bContext *C, Panel *panel) const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); Scene *scene = CTX_data_scene(C); int index = panel->runtime.list_index; - bool narrow_panel = (panel->sizex < UI_UNIT_X * 8 && panel->sizex != 0); /* Modifier Icon. */ - row = uiLayoutRow(layout, false); + sub = uiLayoutRow(layout, true); if (mti->isDisabled && mti->isDisabled(scene, md, 0)) { - uiLayoutSetRedAlert(row, true); + uiLayoutSetRedAlert(sub, true); } - uiItemL(row, "", RNA_struct_ui_icon(ptr.type)); + uiItemL(sub, "", RNA_struct_ui_icon(ptr.type)); - /* Modifier Name. */ - if (!narrow_panel) { - uiItemR(layout, &ptr, "name", 0, "", ICON_NONE); - } + row = uiLayoutRow(layout, true); - /* Switch context buttons. */ - if (modifier_is_simulation(md) == 1) { - uiItemStringO( - layout, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PHYSICS"); - } - else if (modifier_is_simulation(md) == 2) { - uiItemStringO( - layout, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PARTICLES"); - } + /* Modifier Name. + * Count how many buttons are added to the header to check if there is enough space. */ + int buttons_number = 0; + name_row = uiLayoutRow(row, true); - /* Mode switching buttons. */ - row = uiLayoutRow(layout, true); + /* Display mode switching buttons. */ if (ob->type == OB_MESH) { int last_cage_index; int cage_index = BKE_modifiers_get_cage_index(scene, ob, &last_cage_index, 0); @@ -315,12 +340,14 @@ static void modifier_panel_header(const bContext *C, Panel *panel) uiLayoutSetActive(sub, false); } uiItemR(sub, &ptr, "show_on_cage", 0, "", ICON_NONE); + buttons_number++; } } /* Tessellation point for curve-typed objects. */ else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { if (mti->type != eModifierTypeType_Constructive) { /* Constructive modifiers tessellates curve before applying. */ - uiItemR(layout, &ptr, "use_apply_on_spline", 0, "", ICON_NONE); + uiItemR(row, &ptr, "use_apply_on_spline", 0, "", ICON_NONE); + buttons_number++; } } /* Collision and Surface are always enabled, hide buttons. */ @@ -330,15 +357,45 @@ static void modifier_panel_header(const bContext *C, Panel *panel) sub = uiLayoutRow(row, true); uiLayoutSetActive(sub, (md->mode & eModifierMode_Realtime)); uiItemR(sub, &ptr, "show_in_editmode", 0, "", ICON_NONE); + buttons_number++; } uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE); uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE); + buttons_number += 2; } - row = uiLayoutRow(layout, false); + /* Extra operators menu. */ uiItemMenuF(row, "", ICON_DOWNARROW_HLT, modifier_ops_extra_draw, md); - /* Some padding at the end, so the buttons aren't too close to the drag button. */ + /* Delete button. */ + if (modifier_can_delete(md) && !modifier_is_simulation(md)) { + sub = uiLayoutRow(row, false); + uiLayoutSetEmboss(sub, UI_EMBOSS_NONE); + uiItemO(sub, "", ICON_X, "OBJECT_OT_modifier_remove"); + buttons_number++; + } + + /* Switch context buttons. */ + if (modifier_is_simulation(md) == 1) { + uiItemStringO( + row, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PHYSICS"); + buttons_number++; + } + else if (modifier_is_simulation(md) == 2) { + uiItemStringO( + row, "", ICON_PROPERTIES, "WM_OT_properties_context_change", "context", "PARTICLES"); + buttons_number++; + } + + bool display_name = (panel->sizex / UI_UNIT_X - buttons_number > 5) || (panel->sizex == 0); + if (display_name) { + uiItemR(name_row, &ptr, "name", 0, "", ICON_NONE); + } + else { + uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT); + } + + /* Extra padding for delete button. */ uiItemS(layout); } @@ -369,7 +426,7 @@ PanelType *modifier_panel_register(ARegionType *region_type, ModifierType type, panel_type->poll = modifier_ui_poll; /* Give the panel the special flag that says it was built here and corresponds to a - * modifer rather than a PanelType. */ + * modifier rather than a #PanelType. */ panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED; panel_type->reorder = modifier_reorder; panel_type->get_list_data_expand_flag = get_modifier_expand_flag; @@ -381,7 +438,7 @@ PanelType *modifier_panel_register(ARegionType *region_type, ModifierType type, } /** - * Add a shild panel to the parent. + * Add a child panel to the parent. * * \note To create the panel type's idname, it appends the \a name argument to the \a parent's * idname. diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index b32efa3fb8f..2b67b26e620 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -49,6 +49,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "DEG_depsgraph.h" @@ -510,6 +512,25 @@ static void panelRegister(ARegionType *region_type) region_type, "texture", "Texture", NULL, texture_panel_draw, panel_type); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const WarpModifierData *tmd = (const WarpModifierData *)md; + + if (tmd->curfalloff) { + BKE_curvemapping_blend_write(writer, tmd->curfalloff); + } +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + WarpModifierData *tmd = (WarpModifierData *)md; + + BLO_read_data_address(reader, &tmd->curfalloff); + if (tmd->curfalloff) { + BKE_curvemapping_blend_read(reader, tmd->curfalloff); + } +} + ModifierTypeInfo modifierType_Warp = { /* name */ "Warp", /* structName */ "WarpModifierData", @@ -540,6 +561,6 @@ ModifierTypeInfo modifierType_Warp = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index c1fe8e1f009..789b65dbde3 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -388,7 +388,7 @@ static void panel_draw(const bContext *C, Panel *panel) uiLayoutSetPropSep(layout, true); - row = uiLayoutRowWithHeading(layout, true, "Motion"); + row = uiLayoutRowWithHeading(layout, true, IFACE_("Motion")); uiItemR(row, &ptr, "use_x", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE); uiItemR(row, &ptr, "use_y", UI_ITEM_R_TOGGLE | UI_ITEM_R_FORCE_BLANK_DECORATE, NULL, ICON_NONE); diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 9dfc2f653cd..8039856172a 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -47,6 +47,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "BLO_read_write.h" + #include "RNA_access.h" #include "DEG_depsgraph_build.h" @@ -399,6 +401,25 @@ static void panelRegister(ARegionType *region_type) region_type, "influence", "Influence", NULL, influence_panel_draw, panel_type); } +static void blendWrite(BlendWriter *writer, const ModifierData *md) +{ + const WeightVGEditModifierData *wmd = (const WeightVGEditModifierData *)md; + + if (wmd->cmap_curve) { + BKE_curvemapping_blend_write(writer, wmd->cmap_curve); + } +} + +static void blendRead(BlendDataReader *reader, ModifierData *md) +{ + WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md; + + BLO_read_data_address(reader, &wmd->cmap_curve); + if (wmd->cmap_curve) { + BKE_curvemapping_blend_read(reader, wmd->cmap_curve); + } +} + ModifierTypeInfo modifierType_WeightVGEdit = { /* name */ "VertexWeightEdit", /* structName */ "WeightVGEditModifierData", @@ -430,6 +451,6 @@ ModifierTypeInfo modifierType_WeightVGEdit = { /* foreachTexLink */ foreachTexLink, /* freeRuntimeData */ NULL, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ blendWrite, + /* blendRead */ blendRead, }; |