PDA

View Full Version : Get a list of transforms per vertex in Python


musi
10-12-2010, 12:39 PM
Hi,

I am trying to get a list of transforms per vertex (of skinned mesh), and I need to do it in Python.
It seams that I can't use skinPercent command, because it has a limitation with transform flag in query mode. The only thread I found on the subject is this:
http://forums.cgsociety.org/showthread.php?f=89&t=525082&highlight=skinPercent+Python

Anybody knows if there is another way of getting a list of influences per vertex using Python?

Thanks

INVINCIBLE0918
10-13-2010, 05:05 AM
i've got the similar problem


Exception in thread Thread-2:
Traceback (most recent call last):
File "D:\Python25\lib\threading.py", line 488, in __bootstrap_inner
self.run()
File "D:\Python25\lib\threading.py", line 448, in run
self.__target(*self.__args, **self.__kwargs)
File "D:\INVINCIBLE\code\python\project\pdeExportTool\animationUI.py", line 38, in __call__
self.res = self.func(*self.args)
File "D:\INVINCIBLE\code\python\project\pdeExportTool\animationUI.py", line 410, in OnRun
exportAnimationBatch.exportCharacterAnimation(obj,characterOutput)
File "D:\INVINCIBLE\code\python\project\pdeExportTool\exportAnimationBatch.py", line 155, in exportCharacterAnimation
mc.select('root',replace = True)
TypeError: Flag 'replace' must be passed a boolean argument


I finally find that error :
RuntimeError: Maya commands (maya.cmds.*) maya only be called from the main thread

musi
10-13-2010, 07:34 AM
I found a solution to my problem (thanks to my colleagues).
Python code to get transforms per vertex is this:

mc.skinPercent("skinCluster5", 'symetricalHead.vtx[35]', query=True, transform=None)

Trick here is using None with transform flag.

INVINCIBLE0918, I am only starting with Python and didn't get to threading, but thanks for heads up, I will remember that.

CGTalk Moderation
10-13-2010, 07:34 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.