University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

Export Joint map | General SmartBody Discussion | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Export Joint map
March 12, 2015
2:28 pm
Avatar
Member
Members
Forum Posts: 6
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Hello

I'm trying to export the joint mapping after generating it like this:

myskeleton = scene.getSkeleton('Teddy.sk')
teddy = scene.createCharacter('Teddy', '')
teddy.setSkeleton(myskeleton)

mycharacter = scene.getCharacter("Teddy")
myskeleton = mycharacter.getSkeleton()
jointMapManager = scene.getJointMapManager()
sbJointGuessMap = jointMapManager.createJointMap("Teddy-GuessMapping")
sbJointGuessMap.guessMapping(myskeleton, True)
sbJointGuessMap.applySkeleton(myskeleton)

// This line crashes SmartBody
scene.exportCharacter("Teddy", "d:\Export\Teddy")

Is there any way to export the JointMap directly?

 

Thanks for the great job here.

March 12, 2015
5:48 pm
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

With this code I found a couple of crashes and fixes them with the lastest SVN checkin (r6011).

You can get your existing application to work if you:

 

1) change the call from 'getSkeleton()' to 'createSkeleton()'.  The getSkeleton() call retrieves the skeleton template that is then instanced for each character. So when you want to make dynamic changes to the skeleton (say, renaming, adding or removing joints, etc.) you use getSkeleton(). When creating a character, you create a skeleton instance with createSkeleton()

 

2) The original COLLADA export code was written to name the character according to the contents of the deformableMesh attribute. In the code above, you are simply writing out a new skeleton, and not the mesh and skinweights, so the code crashes. You can get around this by setting the 'deformableMesh' attribute with the name of your skeleton.

 

3) If you are using windows, you should use double backslashes to make sure that the backslash is interpreted properly. Also, make sure that the directory e:\Export\Teddy exists.

 

So here's code that should work for you:

 

myskeleton = scene.createSkeleton('Teddy.sk')
teddy = scene.createCharacter('Teddy', '')
teddy.setSkeleton(myskeleton)

mycharacter = scene.getCharacter("Teddy")
myskeleton = mycharacter.getSkeleton()
jointMapManager = scene.getJointMapManager()
sbJointGuessMap = jointMapManager.createJointMap("Teddy-GuessMapping")
sbJointGuessMap.guessMapping(myskeleton, True)
sbJointGuessMap.applySkeleton(myskeleton)

mycharacter.setStringAttribute("deformableMesh", "Teddy.dae")

scene.exportCharacter("Teddy", "d:\\Export\\Teddy")

Ari

March 15, 2015
12:24 pm
Avatar
Member
Members
Forum Posts: 6
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Thank you Ari

That seemed to work correctly now. The exported dae has the correct joint names but when i import the generated dae into Autodesk Fbx viewer or into Unity3d game engine it looks messed up. But if i import it back into smartbody or view it with Visual Studio 2013 it looks fine.

I have used ChrBrad to do the tests.

VS2013 vs Unity3d screenshots

 

Once again thank you very much for the support

March 15, 2015
6:30 pm
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

hmm...It might be a scaling problem: it looks like the skeleton is very small, and the mesh is too big, causing the character to look like it is 'folded in' on itself.

Can you send me the .dae?

March 16, 2015
9:17 am
Avatar
Member
Members
Forum Posts: 6
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Sure. You can download it here.

As i mentioned i've used ChrBrad and in the file above you'll have the original and the generated .dae.

 

Thanks a lot

March 16, 2015
7:59 pm
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

Ok, like I suspected, the skeleton and the mesh are in the wrong scale. I'll have to put in a code fix.

 

Ari

March 16, 2015
8:27 pm
Avatar
Member
Members
Forum Posts: 6
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Thank you.

Another question still related.

How would you suggest me to generate a file like the "zebra2-map.py" for dynamic mapping without re-exporting a new file with the joints renamed?

Were those files included in the examples (eg. ogre-sinbad-map.py) done manually?

Thanks for you time

March 19, 2015
1:03 am
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

hmmm...it should have been part of sbgui File->Export Scene, but I see in the code it has been commented out.I'll have to look into why that was the case.

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 733

Currently Online: mondayneedle1, huberdavidsen3, casey29english, andersen19eaton, kristensen00leblanc, bager59mayo, eric506784, t9rrzpi307, g2pvwfg490
110 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

jwwalker: 80

jyambao: 51

rbaral: 47

adiaz: 30

WargnierP: 29

lucky7456969: 28

mbarros: 28

avida.matt: 26

JonathanW: 24

laguerre: 23

Member Stats:

Guest Posters: 65

Members: 52460

Moderators: 3

Admins: 4

Forum Stats:

Groups: 1

Forums: 5

Topics: 427

Posts: 2343