10
$\begingroup$

I wanted to know whether there is a way to set the default amount of vertices of added geometry (Such as default circles and cylinders) ? Changing the amount from 32 can get quite annoying as I am working quite a lot with subdivision modeling...

$\endgroup$
6
$\begingroup$

AFAIK it's already hardcoded into Blender, set as default value for each operators creating primitive objects like a circle. One way to get around this is to add new menu to access these operators, but with different default value. I made a sample code below, also downloadable here.

When this code is put to a file, opened in Blender's text area and executed, or installed as an addon (after uncommenting bl_info block), it will insert a new submenu to Add, containing some primitive operators but with different default value upon execution:

Low Vertex Mesh

There might be simpler ways, but this is the only workaround I know.

import bpy

# bl_info = {
#     "name": "Low Vertex Count Objects",
#     "author": "",
#     "version": (1, 0),
#     "blender": (2, 63, 0),
#     "location": "View3D > Add",
#     "description": "Add primitive object with low initial vertex count",
#     "warning": "",
#     "wiki_url": "",
#     "tracker_url": "",
#     "category": "Add Mesh"}

def custom_object_add(self, context):
    layout = self.layout
    layout.menu("INFO_MT_low_vertex_mesh_add", icon='PLUGIN')

class INFO_MT_low_vertex_mesh_add(bpy.types.Menu):
    bl_idname = "INFO_MT_low_vertex_mesh_add"
    bl_label = "Low Vertex Mesh"

    def draw(self, context):
        layout = self.layout

        prop = layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle (12)")
        prop.vertices = 12

        prop = layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone (12)")
        prop.vertices = 12

        prop = layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder (12)")
        prop.vertices = 12

        prop = layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere (8x4)")
        prop.segments = 8
        prop.ring_count = 4

def register():
    bpy.utils.register_module(__name__)
    bpy.types.INFO_MT_add.append(custom_object_add)

def unregister():
    bpy.utils.unregister_module(__name__)
    bpy.types.INFO_MT_add.remove(custom_object_add)

if __name__ == '__main__':
    register()
$\endgroup$
5
$\begingroup$

It's possible to override the defaults like so:

from bpy.props import IntProperty
from bpy.types import (
    MESH_OT_primitive_circle_add,
    MESH_OT_primitive_cylinder_add,
    MESH_OT_primitive_uv_sphere_add,
)

MESH_OT_primitive_circle_add.vertices = IntProperty(name="Vertices", default=16)
MESH_OT_primitive_cylinder_add.vertices = IntProperty(name="Vertices", default=16)
MESH_OT_primitive_uv_sphere_add.segments = IntProperty(name="Segments", default=16)
MESH_OT_primitive_uv_sphere_add.ring_count = IntProperty(name="Rings", default=8)

Save in scripts/startup/ with a .py file extension.

$\endgroup$
1
$\begingroup$

You can use the CreaPrim addon to create a new (low poly) primitive for you (so you don't have to write the script yourself). To do so:

  1. Enable the CreaPrim addon in your settings.
  2. Create your circle mesh
  3. Select your mesh and in the toolbar scroll down to the CreaPrim panel:

    creaprim toolbar

  4. Name your circle.

  5. Click CreaPrim.
  6. The primitive is now an add-on which you can enable in your preferences (you may want to create a new file, enable the add-on and press CTRLU to update the default settings).

Note: If you get an error when trying to create the primitive (like I did) you may have to use a cylinder instead of a circle. I think there's a bug that doesn't allow you to create one vertex thick meshes

$\endgroup$
  • $\begingroup$ What is that Retopo button under Cell Fracture? (I haven't got one) $\endgroup$ – gandalf3 Jul 29 '13 at 19:29
  • $\begingroup$ It's for grease pencil retopology (addon that you can enable in the settings). $\endgroup$ – CharlesL Jul 29 '13 at 20:55

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.