[Bf-python] Scale in object_mode loss edges length

Giuseppe De Marco demarcog83 at gmail.com
Sun Apr 5 18:40:08 CEST 2015


Hi all,

I realized that an addon that I wrote wasn't so usefull as I tought in
the past, when I learned blender more in the deep I understand other
way to get it where's needed.

https://developer.blender.org/T43586

But there's a criticity in Blender, even in the last release.
If I scale a mesh in object mode it changes its dimensions but the
edit attributes, as edges length, remains the same !

This is the nightmare of every CAD users. They could kill for this...
I have to get a workaround because my life is in danger when I try to
explain this criticity to them.

Now I'm coding an addon that intercepts the S keypress in objectmode
to drive it in edit mode - do the things - and then return in object
mode, this because only if we scale in edit_mode the edges length
updates its values as expected.

I've a problem and I'm loosing my self in the API, so my question is:

how to simulate S keypress in blender ?
I don't need the bpy.ops.transform.resize(), I need the mouse
interaction to set new dimensions.
What I have to call to see it on the screen ? I mean the dotted line
linked to the origin of the mesh and the mouse movements that sets in
realtime the dimension of the mesh.

this is the code:


<code>

class ForceScale_EditMode(bpy.types.Operator):
    bl_idname = 'object.force_scale_edit'
    bl_label  = 'force_scale_edit'
    bl_description = bl_info['description']
    #bl_options = {'REGISTER', 'UNDO'}


    def execute(self, context):
        self.report({'INFO'}, 'executed')
        # force to go in edit mode
        bpy.ops.object.mode_set(mode = 'EDIT')

        # selects all vertices
        bpy.ops.mesh.select_all(action="SELECT")

        # call the scale trigger to play with mouse
        # unknow function /event / whatever :(

       # if scale committed returns in object_mode and then finish
       # else: return to object_mode.

        return {'FINISHED'}

</code>

any hint would be helpfull
cheers



More information about the Bf-python mailing list