[Bf-committers] Python access for UV mapping

Mathew Burrack mburrack at yahoo.com
Tue Sep 14 07:39:48 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?

Isn't that what I already proposed? :) I mean, from what I understand of do_2d_mapping(), it converts an object-space coord based on one of the mapping methods you listed into a UV pair, right? Or is there something else that I'm missing? (Which is very likely, given my almost-zero-knowledge of the Blender internals)

As an aside: the only downside is that games actually *don't* want the repeating/wrapping modifiers applied, since that's done in the GPU. Granted, it wouldn't be too hard to break do_2d_mapping() apart into its actual-mapping and its extension components, so that one can be called independent of the other, but that's independent of my current question/problem :~)

Thanks,
Mathew

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
>


      


More information about the Bf-committers mailing list