WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Avatar texture swaping (https://forum.worldviz.com/showthread.php?t=3807)

sleiN13 06-22-2011 03:38 AM

Avatar texture swaping
 
I'm trying to change the texture on a avatar by dynamically replacing the texture file with a other (same name file so just overriding the old one)

Vizard keeps remembering the old texture file instead of loading the new one (for that mesh). changing meshes does load the correct texture.

I've tried to create new .cfg files and even new directories and removing the old ones but still Vizard keeps using the cached texture.

I've set the viz.setOption for cache on 0
viz.setOption('viz.model.cache', '0')

and also do a
avatar.remove()
viz.clearCache(mode=viz.TEXTURE_CACHE|viz.NODE_CAC HE)

but still he loads the incorrect texture.

I've checked the directory if the new texure (with the same name) was placed there and this was the case. I've even build in a delay between ,removing the avatar and rebuilding the directory with the new texture and mesh files, and loading the new .cfg file.

So how can I make a program that swaps/replaces the texture of a avatar model (model has multiple textures so .texture() doesn't work)

farshizzo 06-22-2011 09:29 AM

You can use the viz.addTexture command to load textures and then use node.texture to apply the textures on an object. Vizard comes with a few examples/tutorials that show how to dynamically change the texture of an object (e.g. mini.py, swapping.py).

sleiN13 06-23-2011 12:25 AM

I've tried that and it applies the texture too the entire avatar while the original avatar uses multiple textures (eyes, mouth, tonque, hair, face, body). I need to get one part of the mesh of the avatar and apply the texture to that. But the help file only points to functions that retrieve the mesh ID and name (String) not a Node3D object I can texture.

sleiN13 06-23-2011 01:40 AM

I've tried the same code in Vizard 3 and their it works fine. Only Vizard 4 keeps remembering (caching) the incorrect textures.

farshizzo 06-23-2011 10:31 AM

Have a look at the node.texture command in the docs. It take an optional node parameter which specifies the name of the sub-node to apply the texture to. In this case you would specify the name of the avatar mesh.

sleiN13 06-24-2011 12:48 AM

that worked perfectly, thank you.


All times are GMT -7. The time now is 10:41 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC