University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

Argument Error Load Script | 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
Argument Error Load Script
September 17, 2014
7:23 pm
Avatar
Member
Members
Forum Posts: 20
Member Since:
September 11, 2014
sp_UserOfflineSmall Offline

Hello to all,

I am trying to load a character by running a simple python script but i have the below error:

"Boost.Python

.

ArgumentError

:

Python argument types in
SBScene.createCharacter(SBScene, str)
did not match C++ signature:
createCharacter(class SmartBody::SBScene {lvalue}, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >) "

 

I have followed the SmartBody tutorial on how to create a character so the script has the below instructions:
mycharacter = scene.createCharacter("name")
myskeleton = scene.createSkeleton("path/to/my/.dae file")
mycharacter.setSkeleton("myskeleton")
mycharacter.createStandardControllers()

 

Am i missing something here?

My best,
Metallos

September 18, 2014
7:58 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

the createCharacter() function has two arguments: the first one is the name of the character, the second is an id that is sent to the renderer to decide what model to use. If you are using sbgui (as opposed to Unity or Ogre or some other rendering engine) than you can just use "", so change what you have to:

 

mycharacter = scene.createCharacter("name", "")
myskeleton = scene.createSkeleton("path/to/my/.dae file")
mycharacter.setSkeleton("myskeleton")
mycharacter.createStandardControllers()

 

Ari

September 22, 2014
1:33 pm
Avatar
Member
Members
Forum Posts: 20
Member Since:
September 11, 2014
sp_UserOfflineSmall Offline

When i drag and drop my .dae file into the scene everything is OK, but when i am executing the above instructions error occurs. More precicsly the myskeleton = scene.createSkeleton("path/to/my/.dae file")   instructions cann't read the .dae file. On the examples you say that it has to be either .sk either .dae. 

What may be the possible reasons of not reading well the file cause the output of the error tells only that it can not be read.

Also if i give the path on this mycharacter = scene.createCharacter("name", "path/to/my/.dae file") then it's ok but then i am not going to have any skeleton right?

Metalos

September 23, 2014
12:06 am
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

try this:

 

1) load the .dae file as an asset

scene.loadAssetsFromPath("path/to/my/file.dae")

2) The skeleton will be named according to the file

myskeleton = scene.createSkeleton("file.dae")

 

With regard to your last question, the character and skeleton creation are different stages. If you don't specify a skeleton, you get one with a single joint.

 

Ari

September 23, 2014
3:19 pm
Avatar
Member
Members
Forum Posts: 20
Member Since:
September 11, 2014
sp_UserOfflineSmall Offline

Thanks Ari.

That really helped. Now the simulation is running.

One more thing i want to ask is that i want to print some values of the Mesh but it's value is NULL.
More precisely when i run(C++)
DeformableMeshInstance *dm = new DeformableMeshInstance();
dm = character->getActiveMesh();

The value of dm is NULL.(By using this then i want to get the MeshInstance and print values of Vertx and so on).
Is this proper?

Thanks,
Metalos

September 23, 2014
11:01 pm
Avatar
Admin
Forum Posts: 983
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

You would need to attach the mesh to the character first:

scene.setStringAttribute("deformableMesh", "file.dae")

since only attaching the skeleton doesn't mean that the mesh and skinning weights are attached as well. Does that work?

 

Ari

September 24, 2014
11:05 am
Avatar
Member
Members
Forum Posts: 20
Member Since:
September 11, 2014
sp_UserOfflineSmall Offline

I did the attach the way you said but again the character->getActiveMesh() variable is still NULL. Maybe this is logically happening as i am not having anything rendered yet?
More precisly the code is :

scene->setMediaPath(mediaPath);
//we load the .dae file as an asset
scene->loadAssetsFromPath("path/to/dae.file");
scene->loadAssets();
SmartBody::SBSkeleton* skeleton = scene->createSkeleton("file.dae");
SmartBody::SBCharacter* character = scene->createCharacter("name", "");
character->setSkeleton(skeleton);
//attach the mesh to the character
character->setStringAttribute("deformableMesh", "file.dae or path/to/file.dae");
character->createStandardControllers();

DeformableMeshInstance *dm = new DeformableMeshInstance();
dm = character->getActiveMesh();//-->NULL

The thing is want to print some values of the mesh,this is what i want to reach in the end..

Thanks,
Metalos

October 1, 2014
4:53 pm
Avatar
Member
Members
Forum Posts: 20
Member Since:
September 11, 2014
sp_UserOfflineSmall Offline

I have also tried the following after the character->createStandardControllers();

 command :

 

....
SmartBody::SBPawn *p = character->getSkeleton()->getPawn(); //(NOT NULL)
DeformableMeshInstance *ms = p ->getActiveMesh(); //(NULL)
DeformableMesh *msi = ms->getDeformableMesh();//(NULL)

 

Is there any different way to get the Mesh?What's wrong with the above? 
I want to get the Positions and the Normals of the Mesh, if that is not working is there any other way?

I would appreciate any reply!

thanks