I’m attempting to set up a weight paint gradient on a basic object, and I’m running into context issues. I’m not very familiar with python, but I assume that I’m supposed to indicate that the desired mode for this to take effect is weight paint, and not object/edit/whatever the default is (though I could be way off).
The problem is in the last line of code…
import bpy #Emitter Object bpy.ops.mesh.primitive_plane_add() #Object Name bpy.data.objects["Plane"].name = "Emitter" #Subsurf Modifier bpy.ops.object.modifier_add(type='SUBSURF') bpy.data.objects["Emitter"].modifiers["Subsurf"].levels = 7 bpy.data.objects["Emitter"].modifiers["Subsurf"].render_levels = 7 bpy.ops.object.modifier_apply(modifier = "Subsurf") #Vertex Groups <b>bpy.ops.paint.weight_gradient(type='LINEAR', xstart=0, xend=1, ystart=0, yend=1, cursor=1002)</b>
The console displays “RuntimeError: Operator bpy.ops.paint.weight_gradient.poll() failed, context is incorrect”