Script Idea - Saving UV coordinates

Having just lost an hours UV unwrapping work in blender UV mapping window by accidently pressign unwrap from window I have came up with the idea of saving the UV coordinates into a file.

That way you can do some uv mapping, then save the uv coordinate list rather than continually saving the blender file.

Is this possible?


Brian

sure it’s possible, it’s even easy to do.

Martin

sure it’s possible, it’s even easy to do.

Hey, theeth, and do you think it would be possible to apply the UV coordinates of a mesh to a not UVmapped copy of the same mesh?

Env

Duush… I may be well off target here but what comes to mind is Ctrl-W-+ or Ctrl-S? No need for a script.

sure, not really harder, just the inverse operation.

Martin

Being able to save and load uv coordinates as well as texture data would make using radiosity for the game engine a viable solution. I for one would love such a script!

TorQ

radiosity mesh doesn’t have the same faces as before, so that would be impossible.

Martin

(emphasis mine)

I beg to differ, but it would be difficult.

Radiosity will probably add new faces.
The problem with that is that if a face is non-planar (not perfectly flat) the script would have trouble Identifying the resulting faces as from the originals, and finding the new uv coordinates.

for all planar faces it would be almost trivial.
(if you are familar with the math involved)

I would very much like to write a script like what is suggested, but time is not avaliable right now.

(my other idea relating to radiosity in the game engine is a flag that would have the vertex colors added to the result of lighting, instead of multiplied with it, so that real-time lighting in combination with radiosity solutions is viable. Now thinking about it this would require multiple render passes, and if radiosity in the game engine were to become more common, some better culling system would have to be used to allow the increased polycount)

(emphasis mine)

I beg to differ, but it would be difficult. [/quote]
you’re right, of course.

I should have thought about it a little more before using such strong word as impossible. :wink:

Martin

env wrote:
Quote:
sure it’s possible, it’s even easy to do.

Hey, theeth, and do you think it would be possible to apply the UV coordinates of a mesh to a not UVmapped copy of the same mesh?

sure, not really harder, just the inverse operation.

This is a nice thing! It would be a very useful script, IMHO.
Any chance someone with programming skill could write it?

Env

Radiosity uses the original faces to create the new ones.
So they are all co-planar : same normal, and in the same place: the limits of the original face …

Heh, you learn something new every day!


Brian

[quote=“jms”]

Radiosity uses the original faces to create the new ones.
So they are all co-planar : same normal, and in the same place: the limits of the original face …[/quote]
but quads aren’t restricted to being planar exactly.
I looked this morning and I now know where it puts the new faces…
if you imagine the edges being subdivided, new quads are created to fill between the edges across.
maybe an image would be better, but no time.

I cannot write a script (in the coming week) because I have finals to study for, and stuff to do after that.

By the way… You can set radiosity so it DOES NOT subdivide the faces when it does its calculation.

TorQ

I hope I’m not beating a dead horse here… I was wondering if since you can have the exact same model resulting from the radiosity calculation except for maybe vertex numbering (if that’s what blender does). Wouldn’t it be possible to export a uv coordinate’s GLOBAL position and then load it onto the new radiosity model by finding matching vertex positions? You could set the script so that it had an adjustible tollerance for finding vertex positions. Of course the models would have to be in the same position, or the script could have an offset based on the models center point. Anyway, just some non programmer suggestions.

that could be done, but personnaly, I don’t really have time do tackle a big task like that.

Martin

of course. i for one, wasn’t speaking of you in particular…

of course, I was just saying…

mayeb the best way to do it would be to play directly in the radiosity code, so that it would automaticly generate the new UV coords corresponding to the new faces. Mathematically speaking, that would be much easier than doing it after the subdivisions are done.

Martin

sorry if this is a stupid question, but how do i get the texture for a face in blender-python 2.23? i have a mesh with different uv-textures and i want to get the name of the textures depending on the current face, not only uv-coords.