[Bf-committers] Python access for UV mapping

Mathew Burrack mburrack at yahoo.com
Mon Sep 13 01:11:20 CEST 2010


Hello all,

I'm working on trying to add a Python hook that I need for my particular game exporter I'm working on. Specifically, there is currently only Python access for UV coordinates on a mesh if it has a UV unwrap modifier applied. If there isn't, and the mesh just relies on the mapping settings in the material's texture, there isn't any way to determine what the actual mapping is from Python (at least, not that I've found).

So I set about to add a function to MaterialTextureSlot called get_mapped_texture_coord. You give it an object-space coordinate and a normal, and it returns the corresponding generated U,V coordinate. In other words, an interface to do_2d_mapping() inside texture.c. 

My current problem is that I don't see any easy way to bridge the Python glue code in blender/makesrna/internal (bf_rna) to the rendering code in blender/render/intern (bf_render). Granted, I can do some extern declarations and such to make the linking work, but that wouldn't exactly be "clean".

Does anyone have a recommendation about how to do this the "proper" way? I'd like to do so, so that I can submit it as a patch, and I don't mind doing whatever work necessary to build the proper bridging; I just need to know *what* to do.

Thanks!
Mathew


      


More information about the Bf-committers mailing list