Skip to content

Instantly share code, notes, and snippets.

@MarkC-b3d
Created September 22, 2017 06:44
Show Gist options
  • Save MarkC-b3d/517d277baae1c9089ba0eb79fd7894d9 to your computer and use it in GitHub Desktop.
Save MarkC-b3d/517d277baae1c9089ba0eb79fd7894d9 to your computer and use it in GitHub Desktop.
bl_info = {
"name": "Sculpt Sphere",
"author": "Mark C <BlendedMarks>",
"version": (0,1),
"blender": (2, 79, 0),
"location": "View3D >Spacebar Menu",
"description": "Generates a sculpt sphere",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Object"}
import bpy
class sculptsphere(bpy.types.Operator):
"""Generate a sculpting sphere""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "object.make_sculptingsphere" # unique identifier for buttons and menu items to reference.
bl_label = "Sculpting Sphere" # display name in the interface.
bl_options = {'REGISTER', 'UNDO'} # enable undo for the operator.
def execute(self, context): # execute() is called by blender when running the operator.
# The original script
scene = context.scene
bpy.ops.mesh.primitive_cube_add(radius=1, view_align=False, enter_editmode=False, location=(0, 0, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.ops.view3d.layers(nr=1, extend=False)
bpy.ops.object.subdivision_set(level=2)
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf")
bpy.ops.sculpt.sculptmode_toggle()
bpy.ops.sculpt.dynamic_topology_toggle()
bpy.context.scene.tool_settings.sculpt.use_symmetry_x = True
return {'FINISHED'} # this lets blender know the operator finished successfully.
def register():
bpy.utils.register_class(sculptsphere)
def unregister():
bpy.utils.unregister_class(sculptsphere)
# This allows you to run the script directly from blenders text editor
# to test the addon without having to install it.
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment