Auto clip textures based on the size of object

i had an idea, after trying to texture a city made by “the beast”(and giving up after the first 10 or 15 buildings), to create a script to automaticaly clip the texture based on the size of the building. eg. if i had a texture 100 stories tall and a building 7.5 blender units tall the script would set the MaxY clipping to .75. Only problem is I don’t know how to program :frowning: . I understand the basic concepts of programming. I was wondering if someone would be willing to help me create this script?

Block 1: The script needs a block of code to get the object size on the specified axis (in this case the Zaxis)
Block 2: a block of code to clip the texture based on the number gotten by Block 1. (the axis of clipping would be dependant on the axis measured Block 1)

It would also be cool if you could select multiple objects and have the script run on all the objects automaticaly
also mabye even a GUI with buttons to set the axis of clipping.

Thanks in advance!
AKA Clayton S.

Are you talking about UV mapping a texture (TEXFACE)?
If so I havea solution-

I was talking about the clip settings in the texture window (F6), But any other way is just as good if it works!
AKA Clayton S.

I wrote a script that Uses an orthographic camera to project UV coords onto a building- You set a property on the camera for what Image to use, then it will generate automatic UV coords for all faces on the selected meshes that use this face.

Its been extreamly usefull for applying tiling textures to buildings. Modifying geometry distorts UV;s but just run the script and there all recalculated.

You can even scale the camera to scale the mapping on the x/y axis.

  • Cam

that would work…but that is too much work :wink:
I was thinking that I would create a city out of enlongated cubes using the beast.when you scale an object the texture stretches and doesn’t look realto fix that I would then use the script to set the clipping of the texture.(Not UV texture) Is that possible?

the script would be as simple as this…
(I don’t know python syntax so it may not be gramaticaly(python grammar, that is) correct.)

objhight = obj.size.get (Zaxis)
tex.MaxY.set (objhight/10)

AKA Clayton S.

Procedural textures can still use UV Coords so you could still use it if you wanted.

Your script sounds extemely usefull Cambo. Do you have a
link for it. I must have missed it. Ive been strugeling adding
buildings from photo graphs with no real plans. Possably
it could be used to help in this.

3 posts in one night

rabit, rabit


If you have a CVS build I can send you an example blend with script included.

Thanks cambo. I would appreceate that.
I have the gabio’s winbin from 24th.

my email is:-

[email protected]

cant change it my profile as used it to login
as Bogey61 some time back when I forgot
my pass word.



Did you take a look?

is my proposal even possible?

Thanks cambo, the script works well.
It isent what I expected, but I bet
the guys in the game engine forum
who made the face to face anim would
be able to use it.



I’m not a coder and I was wondering if my proposal for the auto clip texture script is even possible to create?
if so would someone be willing to create it for me?
it would need to:
create a new material
create a texture
set the texture to image
set the mapping to cube
load the image
set the crop value to the hight of the building
And (If possible) move to the next selected building and repeat the process untill all the buildings have the new texture.

AKA Clayton S.

Have you tried my script?

At the moment the only thing missing in youf list is to set the texture to cube mapping, and the crop too I think.

Have ago at using automatic projected UV coords- they work well.

  • Cam

I can’t open your .blend file containing the script :-?

I appended your script to another .blend file to look at the python script. I really dont need the uvmapping as I am just applying textures to enlongated cubes. this is for an independant film for which I am doing some 3D animation.

would you be able to create the script I proposed for me? this would be invaluble to me. I would use it in my animation and also I want to see how it would be created in python.

I need this script soon. is there any way someone would be able to create this script?
AKA Clayton S.

Mabe its only campatible with CVS blender. will chech and notify you at some point.