Templates: tweak sculpt to work w/o opensubdiv
authorCampbell Barton <ideasman42@gmail.com>
Thu, 29 Nov 2018 20:10:52 +0000 (07:10 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 29 Nov 2018 20:23:41 +0000 (07:23 +1100)
release/scripts/startup/bl_app_templates_system/Sculpting/__init__.py

index 77f879addae9c7e5aa30778ad402c1cbe3ed8856..dc4eed8ef7228cf7312770ce0d2492f91183a2e7 100644 (file)
@@ -9,9 +9,14 @@ def load_handler(dummy):
     if bpy.data.filepath == "":
         # Apply subdivision modifier on startup
         bpy.ops.object.mode_set(mode='OBJECT')
-        bpy.ops.object.modifier_apply(modifier="Subdivision")
-        bpy.ops.object.mode_set(mode='EDIT')
-        bpy.ops.transform.tosphere(value=1.0)
+        if bpy.app.opensubdiv.supported:
+            bpy.ops.object.modifier_apply(modifier="Subdivision")
+            bpy.ops.object.mode_set(mode='EDIT')
+            bpy.ops.transform.tosphere(value=1.0)
+        else:
+            bpy.ops.object.modifier_remove(modifier="Subdivision")
+            bpy.ops.object.mode_set(mode='EDIT')
+            bpy.ops.mesh.subdivide(number_cuts=6, smoothness=1.0)
         bpy.ops.object.mode_set(mode='SCULPT')
 
 def register():