SmartBody : 1. Control SmartBody with Python

In this tutorial, you will learn the basics of controling SmartBody via Python commands. The section Using Python with SmartBody describes different ways to sending out Python commands to SmartBody. Though the easiest way is to open the Command Window by selecting Window–>Command Window from the menu. 

The first step to access SmartBody via Python is to use 'scene' object. It is the main entity to create characters, query system informations, or obtain other manager class to create different character capabilities.

Here is an example to use the scene object :

print 'media path = ' + scene.getMediaPath()

The above command obtain and print out the default media path from SmartBody.

 You can also print out additional informations such as number of characters and pawns in the scene using other commands :

print 'num of pawns in the scene = ' + str(scene.getNumPawns())
print 'num of characters in the scene = ' + str(scene.getNumCharacters())


Note : For now, ignore the meaning for media path or pawns as we will discuss more about them in the coming tutorials.