transformUV doesn't work with shape keys?

Hey all.

I am working on different parts of a character creator for my project and part involves having the ability to tweak some body proportions via shape keys and some limited bone scaling. Another makes use of scrolling the UV coordinates of one or more UV maps. I looked at several threads as well as the api references for transformUV and have it working to basically select a base color which is a 256x256 texture with some 32x32 blocks that the whole models UVs are scaled to fit into for this test. I intend for an AO map and some other details textures will be multiplied onto that base color later but when I add shape keys it doesn’t work. transformUV can’t do anything when there are shape keys (even just a basis added) and no errors are thrown to the console.

Is this the expected behavior? If it is I would strongly disagree that it is the way it should be because it basically means either having very limited scope for customizing objects/characters in game unless they are all made beforehand including changes to textures which must be packed and that they are all somewhere in the scene on another layer for swapping meshes or dynamically loaded.


(It should be uploaded shortly…)

To use press U to select the next color from the texture shown in the lower left. Press 5 to always jump to index 5.

Add a basis shape key and observe that the cube can’t change color in the game engine anymore.

Thanks in advance.

Just a wild guess:
Maybe shapes keys do not only contain XYZ coordinates of a pixel. Maybe they contain the UV coordinates too.

Thanks for the help. So it is a bug or a “feature” - or in this case a missing feature?

I can try to work around it using the old method of “manually” scrolling UV coords (which won’t be a speed problem since I am not going to be doing this every frame) if somebody can tell me how to access the UV coords used beyond the first one… As I am seeing it now I can scroll around the texture using getUV/setUV for each vertex only for the first UV map in the list of UV maps with the mesh as seen in the mesh tab.

Side note: Is it possible to reorder that list? I can’t believe I never tried until just now.

(Time to crash out for the night grumbling to myself that something is always in the way of making progress the way you want to… lol)

Don’t be discouraged. What you are doing with character customization is complex thing to make on any engine. It will certainly need custom stuff bridging this and that but luckily you seem to have what it takes :slight_smile:

Thanks Kheetor. It is hard sometimes to not get discouraged. I’ve been working on several things for years, slowly learning the ins and outs of the BGE, carefully reading helpful forum posts, occasionally asking a question here or there, but time after time something doesn’t work the way it is expected or there is something is not fully implemented and it becomes another redesign often scrapping hours of work. It is hard to know if what you are designing on paper will even be possible or will get completely roadblocked along the way simply because something like this doesn’t work in the BGE when you try to use some other feature along side it.

I understand that this is free software that many people work on because they love it and they find it rewarding and we can’t expect anything to be perfect. (I’ve worked in software QA for a number of years - I understand bugs and problems.) But when will there be a feature freeze in order to fix and fully flesh out what is already in Blender before adding more features? And unlike the vast majority of Blender users I do not care one bit about cycles or adding more and more obscure modeling tools. I am interested in real-time graphics and interactivity which may put me in a tiny minority, but so long as there is a BGE it is what I want to use because of the tight integration with Blender. With it I don’t have to worry about exporting/importing data to some other engine and that is HUGE. Thanks to the efforts of some it still gets some fixes and some new features here and there but I wish there was a specific team to maintain and update the BGE - I would make a donation in a heartbeat to know that the area I am most interested in is getting my direct support.

Small rant over… onto the task at hand. I read last night right before heading to bed that there is a setUV2() function which allows the second UV map to be accessed. I am still not sure if you can re-order the UV maps (which means planning ahead very carefully what I add when) but I should be able to do most of what I was intending. A while ago I extended the soft body pinning thing that used vertex colors to pin soft body vertexes to another object with rigid body joints to allow for many colors to be used and for each color to attach to a different object. (It is part of how I am doing hair and clothing.) Luckily I am not using vertex colors at all on the base meshes for my characters so I can once again turn to vertex colors this time to mark different regions on the body and change only those UV coords using setUV and setUV2… this is if setUV works with shape keys. Haha!


setUV2() does work with shape keys (yay!) but the documentation is wrong. The documentations says it takes an optional int where FLAT==1 or SECOND_UV==2 but it fails when you omit it or put in an int as the second arg. What it really takes is:

uv2 = vert.getUV2()
vert.setUV2(uv2[0], uv2[1])

You have to break up the list/vector over the two arguments. Don’t ask me why because this is totally wrong compared to setUV() but the important thing is that it works.


Found another incompatibility - Smooth modifiers. I apply them to some particularly unruly joint areas in my model and apparently they prevent setUV and setUV2 from taking effect.

Also it seems necessary to use the Edit Object > Replace Mesh GFX with the current mesh for it to work.

Fun fact: If you have the Replace Mesh actuator attached to the object transformUVs works. I discovered it testing more while prepping to write a bug. Smooth modifiers are still out thought.

:spin: ::Facepalm::

Mark this one solved.