Previous Thread  Next Thread

chat icon Setting the view and render levels of a subsurface modifier

CallMeMisterX

Posted: Mon Aug 06, 2012 4:09 pm
Joined: 07 Apr 2012
Posts: 4
Hello, I'm just getting into the Python API. Currently, I have been successful adding a subsurface modifier to an object, but I can't seem to wrap my head around how to set the view level and render level for the modifier, once applied. I have tried the documentation, but can't seem to figure it out.
My code so far:

>>>bpy.ops.mesh.primitive_ico_sphere_add()
{'FINISHED'}
>>>bpy.ops.object.shade_smooth()
{'FINISHED'}
>>>bpy.ops.object.modifier_add(type='SUBSURF')
{'FINISHED'}

Any help is greatly appreciated.
Reply with quote


CoDEmanX

Posted: Wed Aug 08, 2012 11:19 pm
Joined: 05 Apr 2009
Posts: 694
Code:
bpy.context.active_object.modifiers['Subsurf'].levels = 2  # View
bpy.context.active_object.modifiers['Subsurf'].render_levels = 2  # Render

_________________
I'm sitting, waiting, wishing, building Blender in superstition...
Reply with quote


CallMeMisterX

Posted: Thu Aug 09, 2012 2:53 am
Joined: 07 Apr 2012
Posts: 4
Awesome. Thanks. Exactly what I was looking for.
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group