Skip to content

Instantly share code, notes, and snippets.

@setanarut
Created May 16, 2026 06:59
Show Gist options
  • Select an option

  • Save setanarut/1f7dfcd5229d778f67f21a14f1fa4b25 to your computer and use it in GitHub Desktop.

Select an option

Save setanarut/1f7dfcd5229d778f67f21a14f1fa4b25 to your computer and use it in GitHub Desktop.
Blender 3.6 motion path to curve addon
bl_info = {
"name": "Motion Path to Curve",
"blender": (3, 6, 0),
"category": "Object",
}
import bpy
class OBJECT_OT_create_motion_curve(bpy.types.Operator):
bl_idname = "object.create_motion_curve"
bl_label = "Create Curve from Path"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
ob = context.object
scene = context.scene
if ob is None:
return {'CANCELLED'}
bpy.ops.object.paths_calculate()
mp = ob.motion_path
if mp:
path = bpy.data.curves.new(name='path', type='CURVE')
path.dimensions = '3D'
path.bevel_depth = 0.05
curve = bpy.data.objects.new('Curve', path)
scene.collection.objects.link(curve)
spline = path.splines.new('BEZIER')
spline.bezier_points.add(len(mp.points)-1)
for i, o in enumerate(spline.bezier_points):
o.co = mp.points[i].co
o.handle_right_type = 'AUTO'
o.handle_left_type = 'AUTO'
build_mod = curve.modifiers.new(name="Build", type='BUILD')
build_mod.frame_start = scene.frame_start
build_mod.frame_duration = scene.frame_end - scene.frame_start + 1
bpy.ops.object.paths_clear()
return {'FINISHED'}
class VIEW3D_PT_motion_curve(bpy.types.Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'Motion Curve'
bl_label = "Motion to Curve"
def draw(self, context):
layout = self.layout
layout.operator(OBJECT_OT_create_motion_curve.bl_idname)
classes = (
OBJECT_OT_create_motion_curve,
VIEW3D_PT_motion_curve,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment