[Bf-python] Scale in object_mode loss edges length

Jenny caretdashcaret at gmail.com
Sun Apr 5 19:09:13 CEST 2015


Hi Giuseppe,

If you transform/rotate/scale in Object mode, you need to apply the
transformation in order for the attributes to be reflected.

Take a look at `Apply Object transformations`:
http://wiki.blender.org/index.php/Doc:2.6/Manual/3D_interaction/Transform_Control/Reset_Object_Transformations

For scaling, after you scale, you can call:
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)

I don't think it's great to intercept keystrokes. I think the reason why
people might be frustrated (why scaling in Object mode doesn't behave as
they expect) comes from a lack of understanding of how the tools work.

Hope this helps,
Jenny

On 4/5/15 12:59 PM, Daniel Salazar - patazstudio.com wrote:
> My gawd why don't you apply the scale of the object?
> Daniel Salazar
> patazstudio.com
> 
> 
> On Sun, Apr 5, 2015 at 10:40 AM, Giuseppe De Marco <demarcog83 at gmail.com> wrote:
>> 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
>> _______________________________________________
>> Bf-python mailing list
>> Bf-python at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-python
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
> 



More information about the Bf-python mailing list