Hey,
I’ve written a small addon to try and emulate the way maya sets the proportional editing falloff.
I’m a bit inexperienced with Blender python but it seems to work with a couple of caveates…
The falloff display won’t centre on anything that isn’t a mesh component. It will still show the falloff, but it won’t centre around nurbs, for example.
The same thing applies if you have multiple objects in edit mode. It will still show the falloff size accurately, but it might not be in the right place. Other than that…
Prop Edit > turns proportional editing off and on.
Display > Shows or hides the falloff display.
Radius > sets the falloff radius. (This can be done at any time. The falloff display doesn’t have to be on)
Hope it helps with the tablet, I’ll post the code here and attach the python file. Just install it as you would any other addon.
bl_info = {
'name': 'Set Proportional Falloff',
'blender': (3, 0, 0),
'category': 'Object'
}
import bpy
from mathutils import Vector
class Globals():
displaySphere = None
ToggleDisplayButtonText = "Display is Off"
TogglePropotionalEditingButtonText = "Prop Edit"
buttonAlert = False
def update_func(self,context):
ScaleFalloff(context)
PROPS = [
('radius', bpy.props.FloatProperty(name='radius',min=0, default=1.0, update = Globals.update_func))
]
def DoesObjectExist(name):
for o in bpy.context.scene.objects:
if o.name == name:
Globals.displaySphere = o
return True
return False
def ScaleFalloff(context):
radius = context.scene.radius
if (DoesObjectExist("prop_fallOff")):
Globals.displaySphere.empty_display_size = radius
if (bpy.context.object.type == "MESH"):
median = getMedianPoint()
if (median != None):
bpy.data.objects["prop_fallOff"].location = median
bpy.context.scene.tool_settings.proportional_size = radius
def ToggleSphere(context):
if ( (DoesObjectExist("prop_fallOff")) == False):
if (bpy.context.active_object != None):
if (bpy.context.active_object.mode != "OBJECT"):
bpy.ops.object.mode_set(mode='OBJECT')
#bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.empty_add(type='SPHERE', align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
Globals.displaySphere = bpy.context.object
Globals.displaySphere.name = "prop_fallOff"
Globals.displaySphere.empty_display_size = context.scene.radius
Globals.displaySphere.hide_select = True
return
if Globals.displaySphere.hide_get():
Globals.displaySphere.hide_set(False)
Globals.ToggleDisplayButtonText = "Display is ON"
ScaleFalloff(context)
else:
Globals.displaySphere.hide_set(True)
Globals.ToggleDisplayButtonText = "Display is OFF"
def getMedianPoint():
ob = bpy.context.object
if(ob == None):
return
ob.update_from_editmode()
me = ob.data
verts_sel = [v.co for v in me.vertices if v.select]
if (len(verts_sel) == 0):
return
pivot = sum(verts_sel, Vector()) / len(verts_sel)
#worldSpace = ("Global:", ob.matrix_world * pivot)
worldSpace = ob.matrix_world @ pivot
return worldSpace
class ToggleFalloff(bpy.types.Operator):
bl_idname = 'opr.falloff_operator'
bl_label = 'ToggleFalloff'
def execute(self, context):
ToggleSphere(context)
return {'FINISHED'}
class TogglePropotionalEditing(bpy.types.Operator):
bl_idname = 'opr.proportional_editing_operator'
bl_label = 'SetFalloff'
def execute(self, context):
#bpy.context.scene.tool_settings.use_proportional_edit = False
if(bpy.context.scene.tool_settings.use_proportional_edit):
bpy.context.scene.tool_settings.use_proportional_edit = False
bpy.context.scene.tool_settings.use_proportional_edit_objects = False
Globals.TogglePropotionalEditingButtonText = "Prop Edit is Off"
Globals.buttonAlert = True
else:
bpy.context.scene.tool_settings.use_proportional_edit = True
bpy.context.scene.tool_settings.use_proportional_edit_objects = True
Globals.TogglePropotionalEditingButtonText = "Prop Edit is On"
Globals.buttonAlert = False
return {'FINISHED'}
# == PANELS
class MayaSetFalloffPanel(bpy.types.Panel):
bl_label = 'Set Prop Falloff v0.09'
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "MTools"
def draw(self, context):
col = self.layout.column()
col.operator('opr.proportional_editing_operator', text=Globals.TogglePropotionalEditingButtonText)
col.separator()
col.separator()
col.alert = False
col.operator('opr.falloff_operator', text=Globals.ToggleDisplayButtonText)
for (prop_name, _) in PROPS:
row = col.row()
row.prop(context.scene, prop_name)
# == MAIN ROUTINE
CLASSES = [
MayaSetFalloffPanel,
ToggleFalloff,
TogglePropotionalEditing
]
def register():
for (prop_name, prop_value) in PROPS:
setattr(bpy.types.Scene, prop_name, prop_value)
for klass in CLASSES:
bpy.utils.register_class(klass)
def unregister():
for (prop_name, _) in PROPS:
delattr(bpy.types.Scene, prop_name)
for klass in CLASSES:
bpy.utils.unregister_class(klass)
if __name__ == '__main__':
register()
SetProportionalFalloff.py (4.8 KB)