Creating A Marker or “Helper”

Creating a simple marker in MotionBuilder using Python scripting.

So here was a script that took some time for me.
Changing the Look of the marker through Python had me stumped (luckily I had a friend
who could help).

 

Changing the color of the null/model was a long and exhausting process. There was a lot of google searching as well as tons of trial and error in trying to get Python to set the color.  Finally I solved it on my own and it felt great!

The biggest thing I learned through this Python exercise was how to list out a model’s properties within the MotionBuilder Python Editor. This opened up a lot for me. The bit of code to list a models properties starts on line 12.

Another note is that below (in the codes comment) I added all the visuals for the Marker. You can read the “visual guide” and change the marker to visually fit your needs.

from pyfbsdk import *

#Creat our "marker" and names it 'VicMarker'
marker = FBModelMarker('VicMarker')

#Set our Marker to be visible
marker.Show = True

#Set the size of the marker
marker.Size = 1000

#List all poperties for "marker" so we can see what we want to set up
for property in marker.PropertyList:
    # The following name can be used to obtain a property in FBComponent.PropertyList.Find(<name>)
    print property.Name
   
#Set the "Look" property of the marker, the end # is the visual stle. See list below to find numeric values for each visual style
marker.PropertyList.Find('LookUI').Data=1
# visual style values
# 0 = Cube
# 1 = Hard Cross
# 2 = Light Cross
# 3 = Sphere
# 4 = Capsule
# 5 = Box
# 6 = Bone
# 7 = Circle
# 8 = Square
# 9 = Stick
# 10 = None
# 11 = Rigid Goal
# 12 = Rotation Goal
# 13 = Aim/Roll Goal


#Set the color value for the marker
marker.Color = FBColor(0,1,1)

I hope this helps.

4 Comments

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.