I’m here to learn about Python and bpy. I’m already watching lots of youtube tutorials, but I’d like to learn a bit more about scripting add-ons through fiddling with Blender’s own code.
What i’m currently trying to do is edit Blender’s default torus (and other primitive shape) values.
I can’t seem to make it work by editing the source live.
What would be the best method for me to understand what’s going on and how to achieve the results I need.
in Bmesh mode
you need to create a new Bmesh at beginning then do the modif and after save it
see template
bmesh_simple_editmode.py
as example
# This example assumes we have a mesh object in edit-mode
import bpy
import bmesh
# Get the active mesh
obj = bpy.context.edit_object
me = obj.data
# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)
bm.faces.active = None
# Modify the BMesh, can do anything here...
for v in bm.verts:
v.co.x += 1.0
# Show the updates in the viewport
# and recalculate n-gon tessellation.
bmesh.update_edit_mesh(me, True)