Subsurf: Show error when Blender is built without OpenSubdiv
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 3 Sep 2019 09:43:55 +0000 (11:43 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 3 Sep 2019 09:45:52 +0000 (11:45 +0200)
source/blender/modifiers/CMakeLists.txt
source/blender/modifiers/intern/MOD_multires.c
source/blender/modifiers/intern/MOD_subsurf.c

index 5116fefde94f0e12aac3260081ede3d6ed54c22b..1ae1f891e6f16248970e4cf44a50396d3241daf5 100644 (file)
@@ -141,6 +141,10 @@ if(WITH_MOD_OCEANSIM)
   add_definitions(-DWITH_OCEANSIM)
 endif()
 
+if(WITH_OPENSUBDIV)
+  add_definitions(-DWITH_OPENSUBDIV)
+endif()
+
 if(WITH_BULLET)
   list(APPEND LIB
     extern_bullet
index c64d9be11580e2a773b147d73f3f40b5215bef46..dd7c001931c6801a4115fa7bd30f15a84d2e3b6a 100644 (file)
@@ -168,6 +168,10 @@ static Mesh *multires_as_ccg(MultiresModifierData *mmd,
 static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
 {
   Mesh *result = mesh;
+#if !defined(WITH_OPENSUBDIV)
+  modifier_setError(md, "Disabled, built without OpenSubdiv");
+  return result;
+#endif
   MultiresModifierData *mmd = (MultiresModifierData *)md;
   SubdivSettings subdiv_settings;
   BKE_multires_subdiv_settings_init(&subdiv_settings, mmd);
index 0b1249e263cf034154c36e9e3ec0e77db59a956c..08a884fa879e2494578f306bb3649a362a09c6cc 100644 (file)
@@ -208,6 +208,10 @@ static SubsurfRuntimeData *subsurf_ensure_runtime(SubsurfModifierData *smd)
 static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
 {
   Mesh *result = mesh;
+#if !defined(WITH_OPENSUBDIV)
+  modifier_setError(md, "Disabled, built without OpenSubdiv");
+  return result;
+#endif
   SubsurfModifierData *smd = (SubsurfModifierData *)md;
   SubdivSettings subdiv_settings;
   subdiv_settings_init(&subdiv_settings, smd);