diff options
Diffstat (limited to 'source/blender/modifiers')
30 files changed, 312 insertions, 236 deletions
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 65024e46a2b..549751ce267 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -31,7 +31,7 @@ set(INC ../editors/include ../makesdna ../makesrna - ../render/extern/include + ../render ../windowmanager ../../../intern/eigen ../../../intern/guardedalloc diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 324cac3df8b..38fb19e3233 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -258,7 +258,7 @@ static void panel_draw(const bContext *UNUSED(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, IFACE_("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); diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 7e21300f3c2..da1754b8ebd 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -69,7 +69,7 @@ static void initData(ModifierData *md) MEMCPY_STRUCT_AFTER(amd, DNA_struct_default_get(ArrayModifierData), modifier); /* Open the first subpanel by default, it corresspnds to Relative offset which is enabled too. */ - md->ui_expand_flag = (1 << 0) | (1 << 1); + md->ui_expand_flag = UI_PANEL_DATA_EXPAND_ROOT | UI_SUBPANEL_DATA_EXPAND_1; } static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData) @@ -481,7 +481,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd, /* calculate the maximum number of copies which will fit within the * prescribed length */ - if (amd->fit_type == MOD_ARR_FITLENGTH || amd->fit_type == MOD_ARR_FITCURVE) { + if (ELEM(amd->fit_type, MOD_ARR_FITLENGTH, MOD_ARR_FITCURVE)) { const float float_epsilon = 1e-6f; bool offset_is_too_small = false; float dist = len_v3(offset[3]); @@ -508,6 +508,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd, if (offset_is_too_small) { BKE_modifier_set_error( + ctx->object, &amd->modifier, "The offset is too small, we cannot generate the amount of geometry it would require"); } @@ -518,7 +519,8 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd, else if (((size_t)count * (size_t)chunk_nverts + (size_t)start_cap_nverts + (size_t)end_cap_nverts) > max_num_vertices) { count = 1; - BKE_modifier_set_error(&amd->modifier, + BKE_modifier_set_error(ctx->object, + &amd->modifier, "The amount of copies is too high, we cannot generate the amount of " "geometry it would require"); } diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index b84c8a186b5..04ddac338e5 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -208,7 +208,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * Object *ob = ctx->object; if (harden_normals && (ob->type == OB_MESH) && !(((Mesh *)ob->data)->flag & ME_AUTOSMOOTH)) { - BKE_modifier_set_error(md, "Enable 'Auto Smooth' in Object Data Properties"); + BKE_modifier_set_error(ob, md, "Enable 'Auto Smooth' in Object Data Properties"); harden_normals = false; } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 8d0c7cd6d49..124ef950385 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -189,7 +189,7 @@ static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data)) return BM_elem_flag_test(f, BM_FACE_TAG) ? 1 : 0; } -static bool BMD_error_messages(ModifierData *md, Collection *col) +static bool BMD_error_messages(const Object *ob, ModifierData *md, Collection *col) { BooleanModifierData *bmd = (BooleanModifierData *)md; @@ -202,21 +202,21 @@ static bool BMD_error_messages(ModifierData *md, Collection *col) #ifndef WITH_GMP /* If compiled without GMP, return a error. */ if (use_exact) { - BKE_modifier_set_error(md, "Compiled without GMP, using fast solver"); + BKE_modifier_set_error(ob, md, "Compiled without GMP, using fast solver"); error_returns_result = false; } #endif /* If intersect is selected using fast solver, return a error. */ if (operand_collection && operation_intersect && !use_exact) { - BKE_modifier_set_error(md, "Cannot execute, intersect only available using exact solver"); + BKE_modifier_set_error(ob, md, "Cannot execute, intersect only available using exact solver"); error_returns_result = true; } /* If the selected collection is empty and using fast solver, return a error. */ if (operand_collection) { if (!use_exact && BKE_collection_is_empty(col)) { - BKE_modifier_set_error(md, "Cannot execute, fast solver and empty collection"); + BKE_modifier_set_error(ob, md, "Cannot execute, fast solver and empty collection"); error_returns_result = true; } @@ -225,7 +225,7 @@ static bool BMD_error_messages(ModifierData *md, Collection *col) FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (col, operand_ob) { if (operand_ob->type != OB_MESH) { BKE_modifier_set_error( - md, "Cannot execute, the selected collection contains non mesh objects"); + ob, md, "Cannot execute, the selected collection contains non mesh objects"); error_returns_result = true; } } @@ -623,7 +623,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * return result; } - BMD_error_messages(md, NULL); + BMD_error_messages(ctx->object, md, NULL); Object *operand_ob = bmd->object; @@ -651,7 +651,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* if new mesh returned, return it; otherwise there was * an error, so delete the modifier object */ if (result == NULL) { - BKE_modifier_set_error(md, "Cannot execute boolean operation"); + BKE_modifier_set_error(object, md, "Cannot execute boolean operation"); } } } @@ -662,7 +662,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } /* Return result for certain errors. */ - if (BMD_error_messages(md, col) == confirm_return) { + if (BMD_error_messages(ctx->object, md, col) == confirm_return) { return result; } diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c index eaf8c44a9be..5884ec0aa17 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c @@ -615,7 +615,7 @@ static void correctivesmooth_modifier_do(ModifierData *md, csmd_orig->bind_coords_num = csmd->bind_coords_num; } else { - BKE_modifier_set_error(md, "Attempt to bind from inactive dependency graph"); + BKE_modifier_set_error(ob, md, "Attempt to bind from inactive dependency graph"); } } @@ -625,7 +625,7 @@ static void correctivesmooth_modifier_do(ModifierData *md, } if ((csmd->rest_source == MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) && (csmd->bind_coords == NULL)) { - BKE_modifier_set_error(md, "Bind data required"); + BKE_modifier_set_error(ob, md, "Bind data required"); goto error; } @@ -633,14 +633,14 @@ static void correctivesmooth_modifier_do(ModifierData *md, if (csmd->rest_source == MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) { if (csmd->bind_coords_num != numVerts) { BKE_modifier_set_error( - md, "Bind vertex count mismatch: %u to %u", csmd->bind_coords_num, numVerts); + ob, md, "Bind vertex count mismatch: %u to %u", csmd->bind_coords_num, numVerts); goto error; } } else { /* MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO */ if (ob->type != OB_MESH) { - BKE_modifier_set_error(md, "Object is not a mesh"); + BKE_modifier_set_error(ob, md, "Object is not a mesh"); goto error; } else { @@ -648,7 +648,7 @@ static void correctivesmooth_modifier_do(ModifierData *md, if (me_numVerts != numVerts) { BKE_modifier_set_error( - md, "Original vertex count mismatch: %u to %u", me_numVerts, numVerts); + ob, md, "Original vertex count mismatch: %u to %u", me_numVerts, numVerts); goto error; } } diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c index d841ace2cce..d4c941d144d 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.c +++ b/source/blender/modifiers/intern/MOD_datatransfer.c @@ -232,16 +232,19 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * if (BKE_reports_contain(&reports, RPT_ERROR)) { const char *report_str = BKE_reports_string(&reports, RPT_ERROR); - BKE_modifier_set_error(md, "%s", report_str); + BKE_modifier_set_error(ctx->object, md, "%s", report_str); MEM_freeN((void *)report_str); } else if ((dtmd->data_types & DT_TYPE_LNOR) && !(me->flag & ME_AUTOSMOOTH)) { - BKE_modifier_set_error((ModifierData *)dtmd, "Enable 'Auto Smooth' in Object Data Properties"); + BKE_modifier_set_error( + ctx->object, (ModifierData *)dtmd, "Enable 'Auto Smooth' in Object Data Properties"); } else if (result->totvert > HIGH_POLY_WARNING || ((Mesh *)(ob_source->data))->totvert > HIGH_POLY_WARNING) { BKE_modifier_set_error( - md, "Source or destination object has a high polygon count, computation might be slow"); + ctx->object, + md, + "Source or destination object has a high polygon count, computation might be slow"); } return result; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 2532afc933e..10ed4f8d80b 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -140,7 +140,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } if (dmd->face_count <= 3) { - BKE_modifier_set_error(md, "Modifier requires more than 3 input faces"); + BKE_modifier_set_error(ctx->object, md, "Modifier requires more than 3 input faces"); return mesh; } diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index efd46f53eb6..d432559fcfa 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -61,7 +61,7 @@ #include "MOD_ui_common.h" #include "MOD_util.h" -#include "RE_shader_ext.h" +#include "RE_texture.h" /* Displace */ diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c index 8eb9e97573d..a484b4d8147 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.c +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c @@ -666,8 +666,7 @@ static void LaplacianDeformModifier_do( sysdif = isSystemDifferent(lmd, ob, mesh, numVerts); sys = lmd->cache_system; if (sysdif) { - if (sysdif == LAPDEFORM_SYSTEM_ONLY_CHANGE_ANCHORS || - sysdif == LAPDEFORM_SYSTEM_ONLY_CHANGE_GROUP) { + if (ELEM(sysdif, LAPDEFORM_SYSTEM_ONLY_CHANGE_ANCHORS, LAPDEFORM_SYSTEM_ONLY_CHANGE_GROUP)) { filevertexCos = MEM_malloc_arrayN(numVerts, sizeof(float[3]), "TempModDeformCoordinates"); memcpy(filevertexCos, lmd->vertexco, sizeof(float[3]) * numVerts); MEM_SAFE_FREE(lmd->vertexco); @@ -684,14 +683,15 @@ static void LaplacianDeformModifier_do( else { if (sysdif == LAPDEFORM_SYSTEM_CHANGE_VERTEXES) { BKE_modifier_set_error( - &lmd->modifier, "Vertices changed from %d to %d", lmd->total_verts, numVerts); + ob, &lmd->modifier, "Vertices changed from %d to %d", lmd->total_verts, numVerts); } else if (sysdif == LAPDEFORM_SYSTEM_CHANGE_EDGES) { BKE_modifier_set_error( - &lmd->modifier, "Edges changed from %d to %d", sys->total_edges, mesh->totedge); + ob, &lmd->modifier, "Edges changed from %d to %d", sys->total_edges, mesh->totedge); } else if (sysdif == LAPDEFORM_SYSTEM_CHANGE_NOT_VALID_GROUP) { - BKE_modifier_set_error(&lmd->modifier, + BKE_modifier_set_error(ob, + &lmd->modifier, "Vertex group '%s' is not valid, or maybe empty", sys->anchor_grp_name); } @@ -704,8 +704,10 @@ static void LaplacianDeformModifier_do( } else { if (!isValidVertexGroup(lmd, ob, mesh)) { - BKE_modifier_set_error( - &lmd->modifier, "Vertex group '%s' is not valid, or maybe empty", lmd->anchor_grp_name); + BKE_modifier_set_error(ob, + &lmd->modifier, + "Vertex group '%s' is not valid, or maybe empty", + lmd->anchor_grp_name); lmd->flag &= ~MOD_LAPLACIANDEFORM_BIND; } else if (lmd->total_verts > 0 && lmd->total_verts == numVerts) { @@ -725,7 +727,7 @@ static void LaplacianDeformModifier_do( } } if (sys && sys->is_matrix_computed && !sys->has_solution) { - BKE_modifier_set_error(&lmd->modifier, "The system did not find a solution"); + BKE_modifier_set_error(ob, &lmd->modifier, "The system did not find a solution"); } } diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index f7a8faf7a1c..d51f95bd18d 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -82,7 +82,7 @@ struct BLaplacianSystem { typedef struct BLaplacianSystem LaplacianSystem; static void required_data_mask(Object *ob, ModifierData *md, CustomData_MeshMasks *r_cddata_masks); -static bool is_disabled(const struct Scene *UNUSED(scene), ModifierData *md, bool useRenderParams); +static bool is_disabled(const struct Scene *scene, ModifierData *md, bool useRenderParams); static float compute_volume(const float center[3], float (*vertexCos)[3], const MPoly *mpoly, diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc index 78d44179ca1..92ee5a84df9 100644 --- a/source/blender/modifiers/intern/MOD_mask.cc +++ b/source/blender/modifiers/intern/MOD_mask.cc @@ -322,7 +322,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* Return empty or input mesh when there are no vertex groups. */ MDeformVert *dvert = (MDeformVert *)CustomData_get_layer(&mesh->vdata, CD_MDEFORMVERT); - if (dvert == NULL) { + if (dvert == nullptr) { return invert_mask ? mesh : BKE_mesh_new_nomain_from_template(mesh, 0, 0, 0, 0, 0); } @@ -418,13 +418,13 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) int mode = RNA_enum_get(ptr, "mode"); - uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); uiLayoutSetPropSep(layout, true); if (mode == MOD_MASK_MODE_ARM) { row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "armature", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "armature", 0, nullptr, ICON_NONE); sub = uiLayoutRow(row, true); uiLayoutSetPropDecorate(sub, false); uiItemR(sub, ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT); @@ -433,7 +433,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", nullptr); } - uiItemR(layout, ptr, "threshold", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "threshold", 0, nullptr, ICON_NONE); modifier_panel_end(layout, ptr); } @@ -456,26 +456,26 @@ ModifierTypeInfo modifierType_Mask = { /* copyData */ BKE_modifier_copydata_generic, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, /* modifyMesh */ modifyMesh, - /* modifyHair */ NULL, - /* modifyPointCloud */ NULL, - /* modifyVolume */ NULL, + /* modifyHair */ nullptr, + /* modifyPointCloud */ nullptr, + /* modifyVolume */ nullptr, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ NULL, + /* freeData */ nullptr, /* isDisabled */ isDisabled, /* updateDepsgraph */ updateDepsgraph, - /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnTime */ nullptr, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, - /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, + /* foreachTexLink */ nullptr, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ nullptr, + /* blendRead */ nullptr, }; diff --git a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc index cc16da0fa80..61d556a64af 100644 --- a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc +++ b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc @@ -107,7 +107,7 @@ class OpenVDBMeshAdapter { static void initData(ModifierData *md) { MeshToVolumeModifierData *mvmd = reinterpret_cast<MeshToVolumeModifierData *>(md); - mvmd->object = NULL; + mvmd->object = nullptr; mvmd->resolution_mode = MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT; mvmd->voxel_size = 0.1f; mvmd->voxel_amount = 32; @@ -139,32 +139,32 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) { uiLayout *layout = panel->layout; - PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); MeshToVolumeModifierData *mvmd = static_cast<MeshToVolumeModifierData *>(ptr->data); uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); - uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "density", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "object", 0, nullptr, ICON_NONE); + uiItemR(layout, ptr, "density", 0, nullptr, ICON_NONE); { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "use_fill_volume", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "exterior_band_width", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "use_fill_volume", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "exterior_band_width", 0, nullptr, ICON_NONE); uiLayout *subcol = uiLayoutColumn(col, false); uiLayoutSetActive(subcol, !mvmd->fill_volume); - uiItemR(subcol, ptr, "interior_band_width", 0, NULL, ICON_NONE); + uiItemR(subcol, ptr, "interior_band_width", 0, nullptr, ICON_NONE); } { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "resolution_mode", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "resolution_mode", 0, nullptr, ICON_NONE); if (mvmd->resolution_mode == MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT) { - uiItemR(col, ptr, "voxel_amount", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "voxel_amount", 0, nullptr, ICON_NONE); } else { - uiItemR(col, ptr, "voxel_size", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "voxel_size", 0, nullptr, ICON_NONE); } } @@ -213,11 +213,11 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo MeshToVolumeModifierData *mvmd = reinterpret_cast<MeshToVolumeModifierData *>(md); Object *object_to_convert = mvmd->object; - if (object_to_convert == NULL) { + if (object_to_convert == nullptr) { return input_volume; } Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(object_to_convert, false); - if (mesh == NULL) { + if (mesh == nullptr) { return input_volume; } BKE_mesh_wrapper_ensure_mdata(mesh); @@ -273,8 +273,8 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo return volume; #else - UNUSED_VARS(md, ctx); - BKE_modifier_set_error(md, "Compiled without OpenVDB"); + UNUSED_VARS(md); + BKE_modifier_set_error(ctx->object, md, "Compiled without OpenVDB"); return input_volume; #endif } @@ -290,26 +290,26 @@ ModifierTypeInfo modifierType_MeshToVolume = { /* copyData */ BKE_modifier_copydata_generic, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, - /* modifyMesh */ NULL, - /* modifyHair */ NULL, - /* modifyPointCloud */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, + /* modifyMesh */ nullptr, + /* modifyHair */ nullptr, + /* modifyPointCloud */ nullptr, /* modifyVolume */ modifyVolume, /* initData */ initData, - /* requiredDataMask */ NULL, - /* freeData */ NULL, - /* isDisabled */ NULL, + /* requiredDataMask */ nullptr, + /* freeData */ nullptr, + /* isDisabled */ nullptr, /* updateDepsgraph */ updateDepsgraph, - /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnTime */ nullptr, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, - /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, + /* foreachTexLink */ nullptr, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ nullptr, + /* blendRead */ nullptr, }; diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 5d5b8b847d5..b808d738fe8 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -171,13 +171,13 @@ static void meshcache_do(MeshCacheModifierData *mcmd, /* we could support any object type */ if (UNLIKELY(ob->type != OB_MESH)) { - BKE_modifier_set_error(&mcmd->modifier, "'Integrate' only valid for Mesh objects"); + BKE_modifier_set_error(ob, &mcmd->modifier, "'Integrate' only valid for Mesh objects"); } else if (UNLIKELY(me->totvert != numVerts)) { - BKE_modifier_set_error(&mcmd->modifier, "'Integrate' original mesh vertex mismatch"); + BKE_modifier_set_error(ob, &mcmd->modifier, "'Integrate' original mesh vertex mismatch"); } else if (UNLIKELY(me->totpoly == 0)) { - BKE_modifier_set_error(&mcmd->modifier, "'Integrate' requires faces"); + BKE_modifier_set_error(ob, &mcmd->modifier, "'Integrate' requires faces"); } else { /* the moons align! */ @@ -216,7 +216,7 @@ static void meshcache_do(MeshCacheModifierData *mcmd, /* -------------------------------------------------------------------- */ /* Apply the transformation matrix (if needed) */ if (UNLIKELY(err_str)) { - BKE_modifier_set_error(&mcmd->modifier, "%s", err_str); + BKE_modifier_set_error(ob, &mcmd->modifier, "%s", err_str); } else if (ok) { bool use_matrix = false; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index e2c8db07623..0e530312238 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -373,7 +373,7 @@ static void meshdeformModifier_do(ModifierData *md, Object *ob_target = mmd->object; cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false); if (cagemesh == NULL) { - BKE_modifier_set_error(md, "Cannot get mesh from cage object"); + BKE_modifier_set_error(ctx->object, md, "Cannot get mesh from cage object"); return; } @@ -388,7 +388,7 @@ static void meshdeformModifier_do(ModifierData *md, if (!mmd->bindcagecos) { /* progress bar redraw can make this recursive .. */ if (!DEG_is_active(ctx->depsgraph)) { - BKE_modifier_set_error(md, "Attempt to bind from inactive dependency graph"); + BKE_modifier_set_error(ob, md, "Attempt to bind from inactive dependency graph"); goto finally; } if (!recursive_bind_sentinel) { @@ -405,16 +405,16 @@ static void meshdeformModifier_do(ModifierData *md, totcagevert = BKE_mesh_wrapper_vert_len(cagemesh); if (mmd->totvert != totvert) { - BKE_modifier_set_error(md, "Vertices changed from %d to %d", mmd->totvert, totvert); + BKE_modifier_set_error(ob, md, "Vertices changed from %d to %d", mmd->totvert, totvert); goto finally; } else if (mmd->totcagevert != totcagevert) { BKE_modifier_set_error( - md, "Cage vertices changed from %d to %d", mmd->totcagevert, totcagevert); + ob, md, "Cage vertices changed from %d to %d", mmd->totcagevert, totcagevert); goto finally; } else if (mmd->bindcagecos == NULL) { - BKE_modifier_set_error(md, "Bind data missing"); + BKE_modifier_set_error(ob, md, "Bind data missing"); goto finally; } diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index 70732636d02..73106b2e816 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -127,7 +127,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * BKE_cachefile_reader_open(cache_file, &mcmd->reader, ctx->object, mcmd->object_path); if (!mcmd->reader) { BKE_modifier_set_error( - md, "Could not create Alembic reader for file %s", cache_file->filepath); + ctx->object, md, "Could not create Alembic reader for file %s", cache_file->filepath); return mesh; } } @@ -170,7 +170,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } if (err_str) { - BKE_modifier_set_error(md, "%s", err_str); + BKE_modifier_set_error(ctx->object, md, "%s", err_str); } if (!ELEM(result, NULL, mesh) && (mesh != org_mesh)) { diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index e3a8d651183..9f99e036601 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -74,7 +74,7 @@ static void initData(ModifierData *md) MEMCPY_STRUCT_AFTER(mmd, DNA_struct_default_get(MultiresModifierData), modifier); /* Open subdivision panels by default. */ - md->ui_expand_flag = (1 << 0) | (1 << 1); + md->ui_expand_flag = UI_PANEL_DATA_EXPAND_ROOT | UI_SUBPANEL_DATA_EXPAND_1; } static void requiredDataMask(Object *UNUSED(ob), @@ -216,7 +216,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * { Mesh *result = mesh; #if !defined(WITH_OPENSUBDIV) - BKE_modifier_set_error(md, "Disabled, built without OpenSubdiv"); + BKE_modifier_set_error(ctx->object, md, "Disabled, built without OpenSubdiv"); return result; #endif MultiresModifierData *mmd = (MultiresModifierData *)md; @@ -300,7 +300,7 @@ static void deformMatrices(ModifierData *md, { #if !defined(WITH_OPENSUBDIV) - BKE_modifier_set_error(md, "Disabled, built without OpenSubdiv"); + BKE_modifier_set_error(ctx->object, md, "Disabled, built without OpenSubdiv"); return; #endif @@ -478,7 +478,6 @@ static void advanced_panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayoutSetActive(layout, !has_displacement); - uiItemR(layout, ptr, "subdivision_type", 0, NULL, ICON_NONE); uiItemR(layout, ptr, "quality", 0, NULL, ICON_NONE); col = uiLayoutColumn(layout, false); diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index 1be74a8fed2..0ec564d2e2d 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -476,7 +476,15 @@ static bool is_valid_target(NormalEditModifierData *enmd) if ((enmd->mode == MOD_NORMALEDIT_MODE_DIRECTIONAL) && enmd->target) { return true; } - BKE_modifier_set_error((ModifierData *)enmd, "Invalid target settings"); + return false; +} + +static bool is_valid_target_with_error(const Object *ob, NormalEditModifierData *enmd) +{ + if (is_valid_target(enmd)) { + return true; + } + BKE_modifier_set_error(ob, (ModifierData *)enmd, "Invalid target settings"); return false; } @@ -491,7 +499,7 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, (enmd->mix_limit == (float)M_PI)); /* Do not run that modifier at all if autosmooth is disabled! */ - if (!is_valid_target(enmd) || mesh->totloop == 0) { + if (!is_valid_target_with_error(ctx->object, enmd) || mesh->totloop == 0) { return mesh; } @@ -506,7 +514,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, if (!(((Mesh *)ob->data)->flag & ME_AUTOSMOOTH)) #endif { - BKE_modifier_set_error((ModifierData *)enmd, "Enable 'Auto Smooth' in Object Data Properties"); + BKE_modifier_set_error( + ob, (ModifierData *)enmd, "Enable 'Auto Smooth' in Object Data Properties"); return mesh; } diff --git a/source/blender/modifiers/intern/MOD_simulation.cc b/source/blender/modifiers/intern/MOD_simulation.cc index 10a4b3f7cf9..0766c59cda6 100644 --- a/source/blender/modifiers/intern/MOD_simulation.cc +++ b/source/blender/modifiers/intern/MOD_simulation.cc @@ -169,25 +169,25 @@ ModifierTypeInfo modifierType_Simulation = { /* copyData */ copyData, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, - /* modifyMesh */ NULL, - /* modifyHair */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, + /* modifyMesh */ nullptr, + /* modifyHair */ nullptr, /* modifyPointCloud */ modifyPointCloud, - /* modifyVolume */ NULL, + /* modifyVolume */ nullptr, /* initData */ initData, - /* requiredDataMask */ NULL, + /* requiredDataMask */ nullptr, /* freeData */ freeData, /* isDisabled */ isDisabled, /* updateDepsgraph */ updateDepsgraph, - /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnTime */ nullptr, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, - /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, + /* foreachTexLink */ nullptr, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, /* blendWrite */ blendWrite, /* blendRead */ blendRead, diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 20445a7006a..6936f5a53f8 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -998,8 +998,8 @@ static void add_poly(SkinOutput *so, BMVert *v1, BMVert *v2, BMVert *v3, BMVert BMVert *verts[4] = {v1, v2, v3, v4}; BMFace *f; - BLI_assert(v1 != v2 && v1 != v3 && v1 != v4); - BLI_assert(v2 != v3 && v2 != v4); + BLI_assert(!ELEM(v1, v2, v3, v4)); + BLI_assert(!ELEM(v2, v3, v4)); BLI_assert(v3 != v4); BLI_assert(v1 && v2 && v3); @@ -1414,7 +1414,7 @@ static void quad_from_tris(BMEdge *e, BMFace *adj[2], BMVert *ndx[4]) /* Find what the second tri has that the first doesn't */ for (i = 0; i < 3; i++) { - if (tri[1][i] != tri[0][0] && tri[1][i] != tri[0][1] && tri[1][i] != tri[0][2]) { + if (!ELEM(tri[1][i], tri[0][0], tri[0][1], tri[0][2])) { opp = tri[1][i]; break; } @@ -1760,13 +1760,19 @@ static bool skin_output_branch_hulls( return result; } +typedef enum eSkinErrorFlag { + SKIN_ERROR_NO_VALID_ROOT = (1 << 0), + SKIN_ERROR_HULL = (1 << 1), +} eSkinErrorFlag; + static BMesh *build_skin(SkinNode *skin_nodes, int totvert, const MeshElemMap *emap, const MEdge *medge, int totedge, const MDeformVert *input_dvert, - SkinModifierData *smd) + SkinModifierData *smd, + eSkinErrorFlag *r_error) { SkinOutput so; int v; @@ -1802,7 +1808,7 @@ static BMesh *build_skin(SkinNode *skin_nodes, skin_update_merged_vertices(skin_nodes, totvert); if (!skin_output_branch_hulls(&so, skin_nodes, totvert, emap, medge)) { - BKE_modifier_set_error(&smd->modifier, "Hull error"); + *r_error |= SKIN_ERROR_HULL; } /* Merge triangles here in the hope of providing better target @@ -1848,7 +1854,7 @@ static void skin_set_orig_indices(Mesh *mesh) * 2) Generate node frames * 3) Output vertices and polygons from frames, connections, and hulls */ -static Mesh *base_skin(Mesh *origmesh, SkinModifierData *smd) +static Mesh *base_skin(Mesh *origmesh, SkinModifierData *smd, eSkinErrorFlag *r_error) { Mesh *result; MVertSkin *nodes; @@ -1878,16 +1884,14 @@ static Mesh *base_skin(Mesh *origmesh, SkinModifierData *smd) MEM_freeN(emat); emat = NULL; - bm = build_skin(skin_nodes, totvert, emap, medge, totedge, dvert, smd); + bm = build_skin(skin_nodes, totvert, emap, medge, totedge, dvert, smd, r_error); MEM_freeN(skin_nodes); MEM_freeN(emap); MEM_freeN(emapmem); if (!has_valid_root) { - BKE_modifier_set_error( - &smd->modifier, - "No valid root vertex found (you need one per mesh island you want to skin)"); + *r_error |= SKIN_ERROR_NO_VALID_ROOT; } if (!bm) { @@ -1904,7 +1908,7 @@ static Mesh *base_skin(Mesh *origmesh, SkinModifierData *smd) return result; } -static Mesh *final_skin(SkinModifierData *smd, Mesh *mesh) +static Mesh *final_skin(SkinModifierData *smd, Mesh *mesh, eSkinErrorFlag *r_error) { Mesh *result; @@ -1914,7 +1918,7 @@ static Mesh *final_skin(SkinModifierData *smd, Mesh *mesh) } mesh = subdivide_base(mesh); - result = base_skin(mesh, smd); + result = base_skin(mesh, smd, r_error); BKE_id_free(NULL, mesh); return result; @@ -1934,11 +1938,25 @@ static void initData(ModifierData *md) md->mode |= eModifierMode_Editmode; } -static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx), Mesh *mesh) +static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) { - Mesh *result; + eSkinErrorFlag error = 0; + Mesh *result = final_skin((SkinModifierData *)md, mesh, &error); + + if (error & SKIN_ERROR_NO_VALID_ROOT) { + error &= ~SKIN_ERROR_NO_VALID_ROOT; + BKE_modifier_set_error( + ctx->object, + md, + "No valid root vertex found (you need one per mesh island you want to skin)"); + } + if (error & SKIN_ERROR_HULL) { + error &= ~SKIN_ERROR_HULL; + BKE_modifier_set_error(ctx->object, md, "Hull error"); + } + BLI_assert(error == 0); - if (!(result = final_skin((SkinModifierData *)md, mesh))) { + if (result == NULL) { return mesh; } return result; diff --git a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c index 47adb7ba0bd..8acf07f9181 100644 --- a/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c +++ b/source/blender/modifiers/intern/MOD_solidify_nonmanifold.c @@ -2501,16 +2501,25 @@ Mesh *MOD_solidify_nonmanifold_modifyMesh(ModifierData *md, MEM_freeN(face_edges); } if (edge_index != numNewEdges) { - BKE_modifier_set_error( - md, "Internal Error: edges array wrong size: %u instead of %u", numNewEdges, edge_index); + BKE_modifier_set_error(ctx->object, + md, + "Internal Error: edges array wrong size: %u instead of %u", + numNewEdges, + edge_index); } if (poly_index != numNewPolys) { - BKE_modifier_set_error( - md, "Internal Error: polys array wrong size: %u instead of %u", numNewPolys, poly_index); + BKE_modifier_set_error(ctx->object, + md, + "Internal Error: polys array wrong size: %u instead of %u", + numNewPolys, + poly_index); } if (loop_index != numNewLoops) { - BKE_modifier_set_error( - md, "Internal Error: loops array wrong size: %u instead of %u", numNewLoops, loop_index); + BKE_modifier_set_error(ctx->object, + md, + "Internal Error: loops array wrong size: %u instead of %u", + numNewLoops, + loop_index); } BLI_assert(edge_index == numNewEdges); BLI_assert(poly_index == numNewPolys); diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index c30dd9f8765..1aa015682dd 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -254,7 +254,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * { Mesh *result = mesh; #if !defined(WITH_OPENSUBDIV) - BKE_modifier_set_error(md, "Disabled, built without OpenSubdiv"); + BKE_modifier_set_error(ctx->object, md, "Disabled, built without OpenSubdiv"); return result; #endif SubsurfModifierData *smd = (SubsurfModifierData *)md; @@ -309,7 +309,7 @@ static void deformMatrices(ModifierData *md, int num_verts) { #if !defined(WITH_OPENSUBDIV) - BKE_modifier_set_error(md, "Disabled, built without OpenSubdiv"); + BKE_modifier_set_error(ctx->object, md, "Disabled, built without OpenSubdiv"); return; #endif diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index aa48eaa6a32..5407397e3bf 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -70,6 +70,9 @@ typedef struct SDefAdjacencyArray { uint num; /* Careful, this is twice the number of polygons (avoids an extra loop) */ } SDefAdjacencyArray; +/** + * Polygons per edge (only 2, any more will exit calculation). + */ typedef struct SDefEdgePolys { uint polys[2], num; } SDefEdgePolys; @@ -83,37 +86,67 @@ typedef struct SDefBindCalcData { const MPoly *const mpoly; const MEdge *const medge; const MLoop *const mloop; + /** Coordinates to bind to, transformed into local space (compatible with `vertexCos`). */ float (*const targetCos)[3]; + /** Coordinates to bind (reference to the modifiers input argument). */ float (*const vertexCos)[3]; float imat[4][4]; const float falloff; int success; } SDefBindCalcData; +/** + * This represents the relationship between a point (a source coordinate) + * and the face-corner it's being bound to (from the target mesh). + * + * \note Some of these values could be de-duplicated however these are only + * needed once when running bind, so optimizing this structure isn't a priority. + */ typedef struct SDefBindPoly { + /** Coordinates copied directly from the modifiers inptut. */ float (*coords)[3]; + /** Coordinates projected into 2D space using `normal`. */ float (*coords_v2)[2]; + /** The point being queried projected into 2D space using `normal`. */ float point_v2[2]; float weight_angular; float weight_dist_proj; float weight_dist; float weight; float scales[2]; + /** Center of `coords` */ float centroid[3]; + /** Center of `coords_v2` */ float centroid_v2[2]; + /** + * The calculated normal of coords (could be shared between faces). + */ float normal[3]; float cent_edgemid_vecs_v2[2][2]; + /** + * The unsigned angle of this face-corner in `[0.0 .. PI]` range, + * where a small value is a thin corner. PI is is a straight line. + * Take care dividing by this value as it can approach zero. + */ float edgemid_angle; float point_edgemid_angles[2]; float corner_edgemid_angles[2]; float dominant_angle_weight; + /** Index of the input polygon. */ uint index; + /** Number of vertices in this face. */ uint numverts; + /** + * This polygons loop-start. + * \note that we could look this up from the polygon. + */ uint loopstart; uint edge_inds[2]; uint edge_vert_inds[2]; + /** The index of this corner in the face (starting at zero). */ uint corner_ind; uint dominant_edge; + /** When true `point_v2` is inside `coords_v2`. */ bool inside; } SDefBindPoly; @@ -256,7 +289,7 @@ static int buildAdjacencyMap(const MPoly *poly, { const MLoop *loop; - /* Fing polygons adjacent to edges */ + /* Find polygons adjacent to edges. */ for (int i = 0; i < numpoly; i++, poly++) { loop = &mloop[poly->loopstart]; @@ -466,7 +499,7 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data, bwdata->bind_polys = bpoly; /* Loop over all adjacent edges, - * and build the SDefBindPoly data for each poly adjacent to those. */ + * and build the #SDefBindPoly data for each poly adjacent to those. */ for (vedge = vert_edges; vedge; vedge = vedge->next) { uint edge_ind = vedge->index; @@ -475,7 +508,7 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data, bpoly = bwdata->bind_polys; for (int j = 0; j < bwdata->numpoly; bpoly++, j++) { - /* If coords isn't allocated, we have reached the first uninitialized bpoly */ + /* If coords isn't allocated, we have reached the first uninitialized `bpoly`. */ if ((bpoly->index == edge_polys[edge_ind].polys[i]) || (!bpoly->coords)) { break; } @@ -530,7 +563,7 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data, } } - /* Compute poly's parametric data */ + /* Compute polygons parametric data. */ mid_v3_v3_array(bpoly->centroid, bpoly->coords, poly->totloop); normal_poly_v3(bpoly->normal, bpoly->coords, poly->totloop); @@ -540,7 +573,7 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data, cross_v3_v3v3(axis, bpoly->normal, world); normalize_v3(axis); - /* Map coords onto 2d normal plane */ + /* Map coords onto 2d normal plane. */ map_to_plane_axis_angle_v2_v3v3fl(bpoly->point_v2, point_co, axis, angle); zero_v2(bpoly->centroid_v2); @@ -595,7 +628,7 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data, bpoly->corner_edgemid_angles[1] = angle_normalized_v2v2(tmp_vec_v2, bpoly->cent_edgemid_vecs_v2[1]); - /* Check for inifnite weights, and compute angular data otherwise */ + /* Check for infinite weights, and compute angular data otherwise. */ if (bpoly->weight_dist < FLT_EPSILON) { inf_weight_flags |= MOD_SDEF_INFINITE_WEIGHT_DIST_PROJ; inf_weight_flags |= MOD_SDEF_INFINITE_WEIGHT_DIST; @@ -665,10 +698,10 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data, } } - /* Compute scalings and falloff. - * Scale all weights if no infinite weight is found, - * scale only unprojected weight if projected weight is infinite, - * scale none if both are infinite. */ + /* Compute scaling and falloff: + * - Scale all weights if no infinite weight is found. + * - Scale only un-projected weight if projected weight is infinite. + * - Scale none if both are infinite. */ if (!inf_weight_flags) { bpoly = bwdata->bind_polys; @@ -892,7 +925,7 @@ static void bindVert(void *__restrict userdata, interp_weights_poly_v2( sdbind->vert_weights, bpoly->coords_v2, bpoly->numverts, bpoly->point_v2); - /* Reproject vert based on weights and original poly verts, + /* Re-project vert based on weights and original poly verts, * to reintroduce poly non-planarity */ zero_v3(point_co_proj); for (int j = 0; j < bpoly->numverts; j++, loop++) { @@ -1010,7 +1043,8 @@ static void bindVert(void *__restrict userdata, freeBindData(bwdata); } -static bool surfacedeformBind(SurfaceDeformModifierData *smd_orig, +static bool surfacedeformBind(Object *ob, + SurfaceDeformModifierData *smd_orig, SurfaceDeformModifierData *smd_eval, float (*vertexCos)[3], uint numverts, @@ -1031,20 +1065,20 @@ static bool surfacedeformBind(SurfaceDeformModifierData *smd_orig, vert_edges = MEM_calloc_arrayN(tnumverts, sizeof(*vert_edges), "SDefVertEdgeMap"); if (vert_edges == NULL) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Out of memory"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Out of memory"); return false; } adj_array = MEM_malloc_arrayN(tnumedges, 2 * sizeof(*adj_array), "SDefVertEdge"); if (adj_array == NULL) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Out of memory"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Out of memory"); MEM_freeN(vert_edges); return false; } edge_polys = MEM_calloc_arrayN(tnumedges, sizeof(*edge_polys), "SDefEdgeFaceMap"); if (edge_polys == NULL) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Out of memory"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Out of memory"); MEM_freeN(vert_edges); MEM_freeN(adj_array); return false; @@ -1052,14 +1086,14 @@ static bool surfacedeformBind(SurfaceDeformModifierData *smd_orig, smd_orig->verts = MEM_malloc_arrayN(numverts, sizeof(*smd_orig->verts), "SDefBindVerts"); if (smd_orig->verts == NULL) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Out of memory"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Out of memory"); freeAdjacencyMap(vert_edges, adj_array, edge_polys); return false; } BKE_bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_LOOPTRI, 2); if (treeData.tree == NULL) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Out of memory"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Out of memory"); freeAdjacencyMap(vert_edges, adj_array, edge_polys); MEM_freeN(smd_orig->verts); smd_orig->verts = NULL; @@ -1070,8 +1104,8 @@ static bool surfacedeformBind(SurfaceDeformModifierData *smd_orig, mpoly, medge, mloop, tnumpoly, tnumedges, vert_edges, adj_array, edge_polys); if (adj_result == MOD_SDEF_BIND_RESULT_NONMANY_ERR) { - BKE_modifier_set_error((ModifierData *)smd_eval, - "Target has edges with more than two polygons"); + BKE_modifier_set_error( + ob, (ModifierData *)smd_eval, "Target has edges with more than two polygons"); freeAdjacencyMap(vert_edges, adj_array, edge_polys); free_bvhtree_from_mesh(&treeData); MEM_freeN(smd_orig->verts); @@ -1098,7 +1132,7 @@ static bool surfacedeformBind(SurfaceDeformModifierData *smd_orig, }; if (data.targetCos == NULL) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Out of memory"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Out of memory"); freeData((ModifierData *)smd_orig); return false; } @@ -1117,20 +1151,20 @@ static bool surfacedeformBind(SurfaceDeformModifierData *smd_orig, MEM_freeN(data.targetCos); if (data.success == MOD_SDEF_BIND_RESULT_MEM_ERR) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Out of memory"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Out of memory"); freeData((ModifierData *)smd_orig); } else if (data.success == MOD_SDEF_BIND_RESULT_NONMANY_ERR) { - BKE_modifier_set_error((ModifierData *)smd_eval, - "Target has edges with more than two polygons"); + BKE_modifier_set_error( + ob, (ModifierData *)smd_eval, "Target has edges with more than two polygons"); freeData((ModifierData *)smd_orig); } else if (data.success == MOD_SDEF_BIND_RESULT_CONCAVE_ERR) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Target contains concave polygons"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Target contains concave polygons"); freeData((ModifierData *)smd_orig); } else if (data.success == MOD_SDEF_BIND_RESULT_OVERLAP_ERR) { - BKE_modifier_set_error((ModifierData *)smd_eval, "Target contains overlapping vertices"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Target contains overlapping vertices"); freeData((ModifierData *)smd_orig); } else if (data.success == MOD_SDEF_BIND_RESULT_GENERIC_ERR) { @@ -1138,7 +1172,7 @@ static bool surfacedeformBind(SurfaceDeformModifierData *smd_orig, * to explain this with a reasonably sized message. * Though it shouldn't really matter all that much, * because this is very unlikely to occur */ - BKE_modifier_set_error((ModifierData *)smd_eval, "Target contains invalid polygons"); + BKE_modifier_set_error(ob, (ModifierData *)smd_eval, "Target contains invalid polygons"); freeData((ModifierData *)smd_orig); } @@ -1235,7 +1269,7 @@ static void surfacedeformModifier_do(ModifierData *md, if (!(smd->flags & MOD_SDEF_BIND)) { if (smd->verts != NULL) { if (!DEG_is_active(ctx->depsgraph)) { - BKE_modifier_set_error(md, "Attempt to bind from inactive dependency graph"); + BKE_modifier_set_error(ob, md, "Attempt to bind from inactive dependency graph"); return; } ModifierData *md_orig = BKE_modifier_get_original(md); @@ -1247,7 +1281,7 @@ static void surfacedeformModifier_do(ModifierData *md, Object *ob_target = smd->target; target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false); if (!target) { - BKE_modifier_set_error(md, "No valid target mesh"); + BKE_modifier_set_error(ob, md, "No valid target mesh"); return; } @@ -1257,7 +1291,7 @@ static void surfacedeformModifier_do(ModifierData *md, /* If not bound, execute bind. */ if (smd->verts == NULL) { if (!DEG_is_active(ctx->depsgraph)) { - BKE_modifier_set_error(md, "Attempt to unbind from inactive dependency graph"); + BKE_modifier_set_error(ob, md, "Attempt to unbind from inactive dependency graph"); return; } @@ -1271,7 +1305,7 @@ static void surfacedeformModifier_do(ModifierData *md, /* Avoid converting edit-mesh data, binding is an exception. */ BKE_mesh_wrapper_ensure_mdata(target); - if (!surfacedeformBind(smd_orig, smd, vertexCos, numverts, tnumpoly, tnumverts, target)) { + if (!surfacedeformBind(ob, smd_orig, smd, vertexCos, numverts, tnumpoly, tnumverts, target)) { smd->flags &= ~MOD_SDEF_BIND; } /* Early abort, this is binding 'call', no need to perform whole evaluation. */ @@ -1280,17 +1314,17 @@ static void surfacedeformModifier_do(ModifierData *md, /* Poly count checks */ if (smd->numverts != numverts) { - BKE_modifier_set_error(md, "Vertices changed from %u to %u", smd->numverts, numverts); + BKE_modifier_set_error(ob, md, "Vertices changed from %u to %u", smd->numverts, numverts); return; } if (smd->numpoly != tnumpoly) { - BKE_modifier_set_error(md, "Target polygons changed from %u to %u", smd->numpoly, tnumpoly); + BKE_modifier_set_error( + ob, md, "Target polygons changed from %u to %u", smd->numpoly, tnumpoly); return; } - /* Early out if modifier would not affect input at all - still *after* the sanity checks (and - * potential binding) above. - */ + /* Early out if modifier would not affect input at all - still *after* the sanity checks + * (and potential binding) above. */ if (smd->strength == 0.0f) { return; } @@ -1454,8 +1488,7 @@ static void blendWrite(BlendWriter *writer, const ModifierData *md) 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) { + if (ELEM(smd->verts[i].binds[j].mode, MOD_SDEF_MODE_CENTROID, MOD_SDEF_MODE_LOOPTRI)) { BLO_write_float3_array(writer, 1, smd->verts[i].binds[j].vert_weights); } else { @@ -1483,8 +1516,7 @@ static void blendRead(BlendDataReader *reader, ModifierData *md) 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) { + if (ELEM(smd->verts[i].binds[j].mode, MOD_SDEF_MODE_CENTROID, MOD_SDEF_MODE_LOOPTRI)) { BLO_read_float3_array(reader, 1, &smd->verts[i].binds[j].vert_weights); } else { diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c index bad76a0b559..6c92ceb6fc0 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.c +++ b/source/blender/modifiers/intern/MOD_ui_common.c @@ -229,14 +229,14 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v) /* Apply as shapekey. */ if (BKE_modifier_is_same_topology(md) && !BKE_modifier_is_non_geometrical(md)) { uiItemBooleanO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply As Shapekey"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"), ICON_SHAPEKEY_DATA, "OBJECT_OT_modifier_apply_as_shapekey", "keep_modifier", false); uiItemBooleanO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Save As Shapekey"), + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Save as Shape Key"), ICON_SHAPEKEY_DATA, "OBJECT_OT_modifier_apply_as_shapekey", "keep_modifier", @@ -416,7 +416,7 @@ PanelType *modifier_panel_register(ARegionType *region_type, ModifierType type, /* Give the panel the special flag that says it was built here and corresponds to a * modifier rather than a #PanelType. */ - panel_type->flag = PNL_LAYOUT_HEADER_EXPAND | PNL_DRAW_BOX | PNL_INSTANCED; + panel_type->flag = PANEL_TYPE_HEADER_EXPAND | PANEL_TYPE_DRAW_BOX | PANEL_TYPE_INSTANCED; panel_type->reorder = modifier_reorder; panel_type->get_list_data_expand_flag = get_modifier_expand_flag; panel_type->set_list_data_expand_flag = set_modifier_expand_flag; @@ -453,7 +453,7 @@ PanelType *modifier_subpanel_register(ARegionType *region_type, panel_type->draw_header = draw_header; panel_type->draw = draw; panel_type->poll = modifier_ui_poll; - panel_type->flag = (PNL_DEFAULT_CLOSED | PNL_DRAW_BOX); + panel_type->flag = (PANEL_TYPE_DEFAULT_CLOSED | PANEL_TYPE_DRAW_BOX); BLI_assert(parent != NULL); BLI_strncpy(panel_type->parent_id, parent->idname, BKE_ST_MAXNAME); diff --git a/source/blender/modifiers/intern/MOD_volume_displace.cc b/source/blender/modifiers/intern/MOD_volume_displace.cc index 22bf5cd4893..f4e1936713c 100644 --- a/source/blender/modifiers/intern/MOD_volume_displace.cc +++ b/source/blender/modifiers/intern/MOD_volume_displace.cc @@ -45,7 +45,7 @@ #include "MOD_modifiertypes.h" #include "MOD_ui_common.h" -#include "RE_shader_ext.h" +#include "RE_texture.h" #include "RNA_access.h" @@ -62,7 +62,7 @@ static void initData(ModifierData *md) { VolumeDisplaceModifierData *vdmd = reinterpret_cast<VolumeDisplaceModifierData *>(md); - vdmd->texture = NULL; + vdmd->texture = nullptr; vdmd->strength = 0.5f; copy_v3_fl(vdmd->texture_mid_level, 0.5f); vdmd->texture_sample_radius = 1.0f; @@ -71,11 +71,11 @@ static void initData(ModifierData *md) static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx) { VolumeDisplaceModifierData *vdmd = reinterpret_cast<VolumeDisplaceModifierData *>(md); - if (vdmd->texture != NULL) { + if (vdmd->texture != nullptr) { DEG_add_generic_id_relation(ctx->node, &vdmd->texture->id, "Volume Displace Modifier"); } if (vdmd->texture_map_mode == MOD_VOLUME_DISPLACE_MAP_OBJECT) { - if (vdmd->texture_map_object != NULL) { + if (vdmd->texture_map_object != nullptr) { DEG_add_object_relation( ctx->node, vdmd->texture_map_object, DEG_OB_COMP_TRANSFORM, "Volume Displace Modifier"); } @@ -114,14 +114,14 @@ static void panel_draw(const bContext *C, Panel *panel) uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); - uiTemplateID(layout, C, ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL); + uiTemplateID(layout, C, ptr, "texture", "texture.new", nullptr, nullptr, 0, ICON_NONE, nullptr); uiItemR(layout, ptr, "texture_map_mode", 0, "Texture Mapping", ICON_NONE); if (vdmd->texture_map_mode == MOD_VOLUME_DISPLACE_MAP_OBJECT) { uiItemR(layout, ptr, "texture_map_object", 0, "Object", ICON_NONE); } - uiItemR(layout, ptr, "strength", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "strength", 0, nullptr, ICON_NONE); uiItemR(layout, ptr, "texture_sample_radius", 0, "Sample Radius", ICON_NONE); uiItemR(layout, ptr, "texture_mid_level", 0, "Mid Level", ICON_NONE); @@ -166,7 +166,7 @@ template<typename GridType> struct DisplaceOp { openvdb::Vec3d compute_displace_vector(const openvdb::Coord &coord) const { - if (this->texture != NULL) { + if (this->texture != nullptr) { const openvdb::Vec3f texture_pos = coord.asVec3s() * this->index_to_texture; const openvdb::Vec3d texture_value = this->evaluate_texture(texture_pos); const openvdb::Vec3d displacement = (texture_value - this->texture_mid_level) * @@ -180,7 +180,7 @@ template<typename GridType> struct DisplaceOp { { TexResult texture_result = {0}; BKE_texture_get_value( - NULL, this->texture, const_cast<float *>(pos.asV()), &texture_result, false); + nullptr, this->texture, const_cast<float *>(pos.asV()), &texture_result, false); return {texture_result.tr, texture_result.tg, texture_result.tb}; } }; @@ -270,7 +270,7 @@ struct DisplaceGridOp { return index_to_object * object_to_world; } case MOD_VOLUME_DISPLACE_MAP_OBJECT: { - if (vdmd.texture_map_object == NULL) { + if (vdmd.texture_map_object == nullptr) { return index_to_object; } const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->obmat); @@ -295,7 +295,7 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo const int grid_amount = BKE_volume_num_grids(volume); for (int grid_index = 0; grid_index < grid_amount; grid_index++) { VolumeGrid *volume_grid = BKE_volume_grid_get(volume, grid_index); - BLI_assert(volume_grid != NULL); + BLI_assert(volume_grid != nullptr); openvdb::GridBase::Ptr grid = BKE_volume_grid_openvdb_for_write(volume, volume_grid, false); VolumeGridType grid_type = BKE_volume_grid_type(volume_grid); @@ -307,7 +307,7 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo return volume; #else UNUSED_VARS(md, ctx); - BKE_modifier_set_error(md, "Compiled without OpenVDB"); + BKE_modifier_set_error(ctx->object, md, "Compiled without OpenVDB"); return volume; #endif } @@ -323,26 +323,26 @@ ModifierTypeInfo modifierType_VolumeDisplace = { /* copyData */ BKE_modifier_copydata_generic, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, - /* modifyMesh */ NULL, - /* modifyHair */ NULL, - /* modifyPointCloud */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, + /* modifyMesh */ nullptr, + /* modifyHair */ nullptr, + /* modifyPointCloud */ nullptr, /* modifyVolume */ modifyVolume, /* initData */ initData, - /* requiredDataMask */ NULL, - /* freeData */ NULL, - /* isDisabled */ NULL, + /* requiredDataMask */ nullptr, + /* freeData */ nullptr, + /* isDisabled */ nullptr, /* updateDepsgraph */ updateDepsgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ NULL, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, - /* freeRuntimeData */ NULL, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ nullptr, + /* blendRead */ nullptr, }; diff --git a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc index 913a457c38d..e008dc3f140 100644 --- a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc +++ b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc @@ -59,7 +59,7 @@ using blender::Span; static void initData(ModifierData *md) { VolumeToMeshModifierData *vmmd = reinterpret_cast<VolumeToMeshModifierData *>(md); - vmmd->object = NULL; + vmmd->object = nullptr; vmmd->threshold = 0.1f; strncpy(vmmd->grid_name, "density", MAX_NAME); vmmd->adaptivity = 0.0f; @@ -91,7 +91,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) { uiLayout *layout = panel->layout; - PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); VolumeToMeshModifierData *vmmd = static_cast<VolumeToMeshModifierData *>(ptr->data); uiLayoutSetPropSep(layout, true); @@ -99,26 +99,26 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "object", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "grid_name", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "object", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "grid_name", 0, nullptr, ICON_NONE); } { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "resolution_mode", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "resolution_mode", 0, nullptr, ICON_NONE); if (vmmd->resolution_mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT) { - uiItemR(col, ptr, "voxel_amount", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "voxel_amount", 0, nullptr, ICON_NONE); } else if (vmmd->resolution_mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE) { - uiItemR(col, ptr, "voxel_size", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "voxel_size", 0, nullptr, ICON_NONE); } } { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "threshold", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "adaptivity", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "use_smooth_shade", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "threshold", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "adaptivity", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_smooth_shade", 0, nullptr, ICON_NONE); } modifier_panel_end(layout, ptr); @@ -293,7 +293,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * BKE_volume_load(volume, DEG_get_bmain(ctx->depsgraph)); VolumeGrid *volume_grid = BKE_volume_grid_find(volume, vmmd->grid_name); if (volume_grid == nullptr) { - BKE_modifier_set_error(md, "Cannot find '%s' grid", vmmd->grid_name); + BKE_modifier_set_error(ctx->object, md, "Cannot find '%s' grid", vmmd->grid_name); return create_empty_mesh(input_mesh); } @@ -302,7 +302,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * const VolumeGridType grid_type = BKE_volume_grid_type(volume_grid); VolumeToMeshOp to_mesh_op{*grid, *vmmd, *ctx}; if (!BKE_volume_grid_type_operation(grid_type, to_mesh_op)) { - BKE_modifier_set_error(md, "Expected a scalar grid"); + BKE_modifier_set_error(ctx->object, md, "Expected a scalar grid"); return create_empty_mesh(input_mesh); } @@ -313,8 +313,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } return mesh; #else - UNUSED_VARS(md, ctx); - BKE_modifier_set_error(md, "Compiled without OpenVDB"); + UNUSED_VARS(md); + BKE_modifier_set_error(ctx->object, md, "Compiled without OpenVDB"); return create_empty_mesh(input_mesh); #endif } @@ -330,26 +330,26 @@ ModifierTypeInfo modifierType_VolumeToMesh = { /* copyData */ BKE_modifier_copydata_generic, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, /* modifyMesh */ modifyMesh, - /* modifyHair */ NULL, - /* modifyPointCloud */ NULL, - /* modifyVolume */ NULL, + /* modifyHair */ nullptr, + /* modifyPointCloud */ nullptr, + /* modifyVolume */ nullptr, /* initData */ initData, - /* requiredDataMask */ NULL, - /* freeData */ NULL, - /* isDisabled */ NULL, + /* requiredDataMask */ nullptr, + /* freeData */ nullptr, + /* isDisabled */ nullptr, /* updateDepsgraph */ updateDepsgraph, - /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnTime */ nullptr, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, - /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, + /* foreachTexLink */ nullptr, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ nullptr, + /* blendRead */ nullptr, }; diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 4d1e2cea86f..53e41484606 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -57,7 +57,7 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" -#include "RE_shader_ext.h" +#include "RE_texture.h" #include "MOD_ui_common.h" #include "MOD_util.h" diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 4c8b511f19a..45f06a7778c 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -51,7 +51,8 @@ #include "RNA_access.h" #include "MEM_guardedalloc.h" -#include "RE_shader_ext.h" + +#include "RE_texture.h" #include "MOD_modifiertypes.h" #include "MOD_ui_common.h" diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c index 65bb009fc58..bd15d909834 100644 --- a/source/blender/modifiers/intern/MOD_weighted_normal.c +++ b/source/blender/modifiers/intern/MOD_weighted_normal.c @@ -574,7 +574,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * if (!(((Mesh *)ob->data)->flag & ME_AUTOSMOOTH)) #endif { - BKE_modifier_set_error((ModifierData *)wnmd, "Enable 'Auto Smooth' in Object Data Properties"); + BKE_modifier_set_error( + ctx->object, (ModifierData *)wnmd, "Enable 'Auto Smooth' in Object Data Properties"); return mesh; } diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 1c1ca08183d..c5e2ecb9660 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -55,7 +55,7 @@ #include "MOD_ui_common.h" #include "MOD_util.h" #include "MOD_weightvg_util.h" -#include "RE_shader_ext.h" /* Texture masking. */ +#include "RE_texture.h" /* Texture masking. */ /* Maps new_w weights in place, using either one of the predefined functions, or a custom curve. * Return values are in new_w. |