Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-08-21 16:40:23 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-08-22 11:21:45 +0300
commit9e11b8e24939fbc73930bc05ddea1f79bb00783f (patch)
tree74f12d38dde314d551fca75044299e6d8dff4408 /source/blender/modifiers
parent6b6c27694e16ee1f21fe562408afc8a1fa4690f6 (diff)
Multires: implement reshape operation
The one which is used by applying deformation modifiers on the multires.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index 4379e6748cc..6e51b229ec5 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -142,44 +142,20 @@ static DerivedMesh *applyModifier(
}
#ifdef WITH_OPENSUBDIV_MODIFIER
-static int subdiv_levels_for_modifier_get(const MultiresModifierData *mmd,
- const ModifierEvalContext *ctx)
-{
- Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
- const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER);
- return multires_get_level(
- scene, ctx->object, mmd, use_render_params, false);
-}
-
-static void subdiv_settings_init(SubdivSettings *settings,
- const MultiresModifierData *mmd)
-{
- settings->is_simple = (mmd->simple != 0);
- settings->is_adaptive = !settings->is_simple;
- settings->level = mmd->quality;
- settings->fvar_linear_interpolation =
- BKE_subdiv_fvar_interpolation_from_uv_smooth(mmd->uv_smooth);
-}
-
-static void subdiv_mesh_settings_init(SubdivToMeshSettings *settings,
- const MultiresModifierData *mmd,
- const ModifierEvalContext *ctx)
-{
- const int level = subdiv_levels_for_modifier_get(mmd, ctx);
- settings->resolution = (1 << level) + 1;
-}
-
static Mesh *applyModifier_subdiv(ModifierData *md,
const ModifierEvalContext *ctx,
Mesh *mesh)
{
+ const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER);
+ const Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
Object *object = ctx->object;
Mesh *result = mesh;
MultiresModifierData *mmd = (MultiresModifierData *)md;
SubdivSettings subdiv_settings;
- subdiv_settings_init(&subdiv_settings, mmd);
+ BKE_multires_subdiv_settings_init(&subdiv_settings, mmd);
SubdivToMeshSettings mesh_settings;
- subdiv_mesh_settings_init(&mesh_settings, mmd, ctx);
+ BKE_multires_subdiv_mesh_settings_init(
+ &mesh_settings, scene, object, mmd, use_render_params);
if (subdiv_settings.level == 0 || mesh_settings.resolution < 3) {
/* NOTE: Shouldn't really happen, is supposed to be catched by
* isDisabled() callback.