Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_decimate.c
| Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| DecimateModifierData *dmd = (DecimateModifierData *) md; | DecimateModifierData *dmd = (DecimateModifierData *) md; | ||||
| dmd->percent = 1.0; | dmd->percent = 1.0; | ||||
| dmd->angle = DEG2RADF(5.0f); | dmd->angle = DEG2RADF(5.0f); | ||||
| dmd->defgrp_factor = 1.0; | dmd->defgrp_factor = 1.0; | ||||
| } | } | ||||
| static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) | static void requiredDataMask(Object *UNUSED(ob), ModifierData *md, CustomData_MeshMasks *r_cddata_masks) | ||||
| { | { | ||||
| DecimateModifierData *dmd = (DecimateModifierData *) md; | DecimateModifierData *dmd = (DecimateModifierData *) md; | ||||
| CustomDataMask dataMask = 0; | |||||
| /* ask for vertexgroups if we need them */ | /* ask for vertexgroups if we need them */ | ||||
| if (dmd->defgrp_name[0] && (dmd->defgrp_factor > 0.0f)) { | if (dmd->defgrp_name[0] != '\0' && (dmd->defgrp_factor > 0.0f)) { | ||||
| dataMask |= CD_MASK_MDEFORMVERT; | r_cddata_masks->vmask |= CD_MASK_MDEFORMVERT; | ||||
| } | } | ||||
| return dataMask; | |||||
| } | } | ||||
| static DecimateModifierData *getOriginalModifierData( | static DecimateModifierData *getOriginalModifierData( | ||||
| const DecimateModifierData *dmd, const ModifierEvalContext *ctx) | const DecimateModifierData *dmd, const ModifierEvalContext *ctx) | ||||
| { | { | ||||
| Object *ob_orig = DEG_get_original_object(ctx->object); | Object *ob_orig = DEG_get_original_object(ctx->object); | ||||
| return (DecimateModifierData *)modifiers_findByName(ob_orig, dmd->modifier.name); | return (DecimateModifierData *)modifiers_findByName(ob_orig, dmd->modifier.name); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | if (dmd->mode == MOD_DECIM_MODE_COLLAPSE) { | ||||
| } | } | ||||
| } | } | ||||
| bm = BKE_mesh_to_bmesh_ex( | bm = BKE_mesh_to_bmesh_ex( | ||||
| mesh, | mesh, | ||||
| &(struct BMeshCreateParams){0}, | &(struct BMeshCreateParams){0}, | ||||
| &(struct BMeshFromMeshParams){ | &(struct BMeshFromMeshParams){ | ||||
| .calc_face_normal = calc_face_normal, | .calc_face_normal = calc_face_normal, | ||||
| .cd_mask_extra = CD_MASK_ORIGINDEX, | .cd_mask_extra = {.vmask=CD_MASK_ORIGINDEX, .emask=CD_MASK_ORIGINDEX, .pmask=CD_MASK_ORIGINDEX}, | ||||
| }); | }); | ||||
| switch (dmd->mode) { | switch (dmd->mode) { | ||||
| case MOD_DECIM_MODE_COLLAPSE: | case MOD_DECIM_MODE_COLLAPSE: | ||||
| { | { | ||||
| const bool do_triangulate = (dmd->flag & MOD_DECIM_FLAG_TRIANGULATE) != 0; | const bool do_triangulate = (dmd->flag & MOD_DECIM_FLAG_TRIANGULATE) != 0; | ||||
| const int symmetry_axis = (dmd->flag & MOD_DECIM_FLAG_SYMMETRY) ? dmd->symmetry_axis : -1; | const int symmetry_axis = (dmd->flag & MOD_DECIM_FLAG_SYMMETRY) ? dmd->symmetry_axis : -1; | ||||
| const float symmetry_eps = 0.00002f; | const float symmetry_eps = 0.00002f; | ||||
| Show All 16 Lines | #endif | ||||
| } | } | ||||
| if (vweights) { | if (vweights) { | ||||
| MEM_freeN(vweights); | MEM_freeN(vweights); | ||||
| } | } | ||||
| updateFaceCount(ctx, dmd, bm->totface); | updateFaceCount(ctx, dmd, bm->totface); | ||||
| result = BKE_mesh_from_bmesh_for_eval_nomain(bm, 0); | result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL); | ||||
| BLI_assert(bm->vtoolflagpool == NULL && | BLI_assert(bm->vtoolflagpool == NULL && | ||||
| bm->etoolflagpool == NULL && | bm->etoolflagpool == NULL && | ||||
| bm->ftoolflagpool == NULL); /* make sure we never alloc'd these */ | bm->ftoolflagpool == NULL); /* make sure we never alloc'd these */ | ||||
| BLI_assert(bm->vtable == NULL && | BLI_assert(bm->vtable == NULL && | ||||
| bm->etable == NULL && | bm->etable == NULL && | ||||
| bm->ftable == NULL); | bm->ftable == NULL); | ||||
| BM_mesh_free(bm); | BM_mesh_free(bm); | ||||
| ▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines | |||||