Page MenuHome

Sets the local (x,y,z) scale to the image aspect of the first texture of the first material found
Closed, ArchivedPublicPATCH

Description

Project: Blender Extensions
Tracker: Py Scripts Upload
Blender: 2.51
Category: Object
Python: 3.1
Script name: Scale to Image
Author(s): testscreenings
Status: Closed

This is a port of the 2.49 functionality of the alt-V shortcut to scale an object
to the proportions of the imagetexture the object uses.

Usage:
When activated in object mode (by pressing alt-V, or searching for the operator)
all selected objects scale-X values get set to the
X-aspect of the first image in the texture stack of the first material in the material stack
of the respective object.
When using this it is important to take the original scalevalues into account
since all it does is setting a new value for the scale.x component
and resets scale.y and scyle.z back to 1.

Todo:
Maybe have a look into taking the original scalevalues into account.

Event Timeline

Changes/Development:

V 0.2:
- added Option to choose along which axis to scale along
- added option to either preapply the objects scale (default)
or leave it as it was and just set the new scaling.
?: is it better to to do the function which is doing the scaling inside the operator class
or outside as is done here? preference? best practices?

V 0.3

I think this may be it.

although some weird stuff is happening when saving a .b25.blend with
the addon enabled.
It seems to be impossible to unregister it then and the shortcut doesn't get registered.

If not enabled at startup it seems to work as expected,
so i guess it may not be my fault?

V 0.4
Cleanup by Pontiac.

Thanks

V 0.5

- if no imagetexture is found the UVtexture is used

partly rewritten

-thrown out the preapplying of scale option
-if no Imagetexture is found it now looks if there is
a uv-texture instead.
-option to use uv-texture instead

Florian Meyer (testscreenings) changed the task status from Unknown Status to Unknown Status.Dec 22 2010, 5:28 PM