[Bf-committers] Python access for UV mapping

Campbell Barton ideasman42 at gmail.com
Mon Sep 13 10:03:20 CEST 2010

Since games engines mainly use image textures which have no need for a
Z axis - you only need UV's,
So what about having a tool/function, that converts coords like Orco,
Global, Nor, Refl, etc into UV's?

On Sun, Sep 12, 2010 at 11:11 PM, Mathew Burrack <mburrack at yahoo.com> wrote:
> 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
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers

- Campbell

More information about the Bf-committers mailing list