0
$\begingroup$

Is it possible to bend an object like in this YouTube Tutorial without creating a reference cube for the Simple Deform modifier? The current workflow: freeze transforms, add a cube with Shift+A, center it, add the modifier, assign the cube as origin, and rotate it, feels overly long compared to Maya. Is there a faster way?

$\endgroup$
0

2 Answers 2

0
$\begingroup$

So the FASTEST way to achieve this without code or custom addons exactly as shown in the youtube video is Modeling the shape along the X axis, adding the loop cuts and using the simple deform modifier around the z axis. It gives the exact same results as the custom made addon shown as one of the answers here and without the need for an object to deform around as shown in the youtube video.

enter image description here

You can rotate the object and the effect will still work as long as you don't apply the rotation. There are a lot of ways to solve this problem using geometry nodes, using curves with extrude geometry, and modifying the vertices themselves with the proportional editing tool. Depending on your use case this may or may not be the best solution.

New contributor
daugherty.charlie is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
0
$\begingroup$

The actions you perform in the 3D Viewport can be replicated and automated using Python by creating a custom Operator.

demo

First ensure that Developer Extras is enabled under Edit > Preferences > Interface > Display. Then, paste the following script into Blender's Text Editor and click Run Script. Then, in the 3D Viewport, select the object you want to bend, press F3 and search for "Add Bend Modifier," and press Enter to run it. For even faster access, you can right-click the command list item in the F3 menu and choose Add to Quick Favorites, so next time you only need to press Q to add it.

screenshot

import bpy
from mathutils import Vector
from math import radians

class OBJECT_OT_add_bend_modifier_with_cube(bpy.types.Operator):
    """Add a Bend modifier with a helper cube"""
    bl_idname = "object.add_bend_modifier_with_cube"
    bl_label = "Add Bend Modifier with Cube"
    bl_options = {'REGISTER', 'UNDO'}

    cube_rot_z: bpy.props.FloatProperty(name="Cube Rotation Z", default=90.0, max=360.0)
    cube_loc_x: bpy.props.FloatProperty(name="Cube X", default=0.0)
    cube_loc_y: bpy.props.FloatProperty(name="Cube Y", default=0.0)
    cube_loc_z: bpy.props.FloatProperty(name="Cube Z", default=0.0)
    bend_angle_deg: bpy.props.FloatProperty(name="Bend Angle", default=90.0, max=360.0, min=-360.0)

    def invoke(self, context, event):
        obj = context.active_object
        if obj:
            loc = obj.location
            self.cube_loc_x = loc.x
            self.cube_loc_y = loc.y
            self.cube_loc_z = loc.z
        return self.execute(context)

    def execute(self, context):
        obj = context.active_object
        if obj is None:
            self.report({'ERROR'}, "No active object selected")
            return {'CANCELLED'}

        mod = obj.modifiers.get("BendSimpleDeform")
        if not mod:
            mod = obj.modifiers.new("BendSimpleDeform", 'SIMPLE_DEFORM')
            mod.deform_method = 'BEND'
            mod.deform_axis = 'Z'

        mod.angle = radians(self.bend_angle_deg)
        cube_name = f"{obj.name}_bend_helper"
        cube = bpy.data.objects.get(cube_name)

        if not cube:
            bpy.ops.mesh.primitive_cube_add(location=obj.location)
            cube = context.active_object
            cube.name = cube_name
            cube.display_type = 'WIRE'
            cube.select_set(False)

        cube.location = Vector((self.cube_loc_x, self.cube_loc_y, self.cube_loc_z))
        cube.rotation_euler[2] = radians(self.cube_rot_z)
        mod.origin = cube
        obj.select_set(True)
        context.view_layer.objects.active = obj
        return {'FINISHED'}

def register():
    bpy.utils.register_class(OBJECT_OT_add_bend_modifier_with_cube)

def unregister():
    bpy.utils.unregister_class(OBJECT_OT_add_bend_modifier_with_cube)

if __name__ == "__main__":
    register()
    # bpy.ops.object.add_bend_modifier_with_cube('INVOKE_DEFAULT')

You can also register this script to run at startup, so the operator is automatically available each time Blender launches.

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.