I have two operators I want to run in sequence when I click on a button. The first operator changes object mode to edit mode. The second operator subdivides the mesh ten times.
bpy.ops.object.editmode_toggle() bpy.ops.mesh.subdivide(number_cuts=10, smoothness=0, ngon=True, quadcorner='STRAIGHT_CUT', fractal=0, fractal_along_normal=0, seed=0)
In python, how do I limit the subdivide operator to run once. That is, when it runs and the mesh is subdivided 10 times, you can't subdivide again when you click the button again. Kindly assist.
False. If it'sFalse, run the op and immediately set it toTrue. If it'sTruedon't run the op. There are a lot of ways to save the state, and the right one depends on how you've set up your script. – Marty Fouts Jan 03 '22 at 03:31