0
$\begingroup$

I've been working on a python script in Blender (2.8) and so far everything's been going fairly smoothly, except for an infuriating problem I encountered yesterday.

It seems that the 'bpy.ops.mesh.subdivide' operator suddenly forces the 'quadcorner' parameter, even though it is (or at least should be) optional. This makes the generated mesh a mess of millions of verts that often crashes Blender.

The weirdest part is that everything worked correctly until an accidental modifier application that crashed Blender, and after reopening the program it has worked very weirdly.

This is the subdivision part of my code:

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.subdivide(number_cuts=xsubds, smoothness=0.0)
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')
me.update()
bm.from_mesh(me)

for e in bm.edges:
    if ((e.verts[0].co[1]) != (e.verts[1].co[1])):
        edgeindex = e.index
        obj.data.edges[edgeindex].select = True


bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.subdivide(number_cuts=ysubds, smoothness=0.0)
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')
me.update()
bm.from_mesh(me)

for e in bm.edges:
    if ((e.verts[0].co[2]) != (e.verts[1].co[2])):
        edgeindex = e.index
        obj.data.edges[edgeindex].select = True

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.subdivide(number_cuts=zsubds, smoothness=0.0)
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')
me.update()
bm.from_mesh(me)

And it returns with a nonsensical quadcorner:

bpy.ops.object.editmode_toggle()
bpy.ops.mesh.subdivide(number_cuts=14, smoothness=0, quadcorner='INNERVERT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.editmode_toggle()
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.subdivide(number_cuts=8, smoothness=0, quadcorner='INNERVERT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.editmode_toggle()
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.subdivide(number_cuts=10, smoothness=0, quadcorner='INNERVERT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.editmode_toggle()

I tested with earlier backups as well, which have the same symptoms all of a sudden, suggesting that this is a problem with how Blender functions and not the code that just suddenly doesn't work anymore. I even tried a couple newer releases but to no avail (currently running this morning's release, caf52e3779a9-windows64).

It's getting a bit infuriating so I'd really appreciate if someone could tell me what's going on! I essentially can't continue my project before this is fixed one way or another.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.