{"id":288,"date":"2017-03-13T13:01:20","date_gmt":"2017-03-13T17:01:20","guid":{"rendered":"http:\/\/www.vicdebaie.com\/blog\/?p=288"},"modified":"2017-11-07T16:34:31","modified_gmt":"2017-11-07T21:34:31","slug":"getting-information-on-motionbuilders-python-with-dir","status":"publish","type":"post","link":"http:\/\/www.vicdebaie.com\/blog\/getting-information-on-motionbuilders-python-with-dir\/","title":{"rendered":"Getting information on MotionBuilder&#8217;s Python with dir"},"content":{"rendered":"<p><img data-attachment-id=\"289\" data-permalink=\"http:\/\/www.vicdebaie.com\/blog\/getting-information-on-motionbuilders-python-with-dir\/mobupy_printdir\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?fit=877%2C139\" data-orig-size=\"877,139\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mobupy_printdir\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?fit=300%2C48\" data-large-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?fit=678%2C107\" decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-289\" src=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?resize=678%2C107\" alt=\"\" width=\"678\" height=\"107\" srcset=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?w=877 877w, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?resize=300%2C48 300w, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?resize=768%2C122 768w\" sizes=\"(max-width: 678px) 100vw, 678px\" data-recalc-dims=\"1\" \/><\/p>\n<p>Trying to figure how things work in MotionBuilder&#8217;s Python editor is tough. Google and the SDK Help that comes along with MotionBuilder are great, but there is still more help out there &#8211; the &#8220;dir&#8221;! \ud83d\ude42<\/p>\n<p>What does &#8220;dir&#8221; do? The definition I was able to find is &#8220;It gives you an alphabetical listing of valid attributes&#8221;. It&#8217;s so much easier to show you what it does than it is to explain.<\/p>\n<p>Here we will use &#8220;dir&#8221; to see all the attributes on the object FBApplication():<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nfrom pyfbsdk import *\r\n\r\n# Set variable for FBApplication.\r\nlApp = FBApplication()\r\n\r\n# print out the dir\r\nprint dir(lApp)\r\n<\/pre>\n<p><img data-attachment-id=\"289\" data-permalink=\"http:\/\/www.vicdebaie.com\/blog\/getting-information-on-motionbuilders-python-with-dir\/mobupy_printdir\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?fit=877%2C139\" data-orig-size=\"877,139\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mobupy_printdir\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?fit=300%2C48\" data-large-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?fit=678%2C107\" decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-289\" src=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?resize=678%2C107\" alt=\"\" width=\"678\" height=\"107\" srcset=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?w=877 877w, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?resize=300%2C48 300w, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?resize=768%2C122 768w\" sizes=\"(max-width: 678px) 100vw, 678px\" data-recalc-dims=\"1\" \/><br \/>\nHere we can see the results of the print the dir() command.<\/p>\n<p>From here we can see that there is an attribute for &#8220;CurrentCharacter&#8221;. If I open up the scene\u00a0&#8220;mia_rigged.fbx&#8221; we can then do something like:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nfrom pyfbsdk import *\r\n\r\nprint dir(FBApplication().CurrentCharacter)\r\n<\/pre>\n<p>Now that all the attributes are listed for the Mia Character, we can see that there is one called &#8220;MirrorMode&#8221;.<\/p>\n<p><img data-attachment-id=\"291\" data-permalink=\"http:\/\/www.vicdebaie.com\/blog\/getting-information-on-motionbuilders-python-with-dir\/dirporpertycurcharmirromode\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/dirporpertycurcharmirromode.jpg?fit=406%2C31\" data-orig-size=\"406,31\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"dirporpertycurcharmirromode\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/dirporpertycurcharmirromode.jpg?fit=300%2C23\" data-large-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/dirporpertycurcharmirromode.jpg?fit=406%2C31\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-291 alignnone\" src=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/dirporpertycurcharmirromode.jpg?resize=406%2C31\" alt=\"\" width=\"406\" height=\"31\" srcset=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/dirporpertycurcharmirromode.jpg?w=406 406w, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/dirporpertycurcharmirromode.jpg?resize=300%2C23 300w\" sizes=\"(max-width: 406px) 100vw, 406px\" data-recalc-dims=\"1\" \/><\/p>\n<p>With that exposed we could setup a script that will mirror animation in MotionBuilder with ease (which you can find <a href=\"http:\/\/www.vicdebaie.com\/blog\/?p=292&amp;preview=true\">here<\/a>).<br \/>\nThis is a great way to find or explore within python.<\/p>\n<p>I like to have the below snippet of code near by when I am trying to figure out things:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n\r\n# create a variable lGetInfor - pastehere = paste the object you want to list the attributes of\r\nlGetInfor = pastehere\r\nprint dir(lGetInfor)\r\n\r\n<\/pre>\n<p>\\<\/p>\n<p>I hope this helps.<\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Trying to figure how things work in MotionBuilder&#8217;s Python editor is tough. Google and the SDK Help that comes along with MotionBuilder are great, but there is still more help out there &#8211; the &#8220;dir&#8221;! \ud83d\ude42 What does &#8220;dir&#8221; do? The definition I was able to find is &#8220;It gives you an alphabetical listing of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":289,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[4],"tags":[5,7],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/03\/mobupy_printdir.jpg?fit=877%2C139","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8pltq-4E","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":419,"url":"http:\/\/www.vicdebaie.com\/blog\/re-visting-motionbuilders-python-dir\/","url_meta":{"origin":288,"position":0},"title":"Re-visting MotionBuilder&#8217;s Python Dir()","author":"admin","date":"October 15, 2017","format":false,"excerpt":"In a previous post I briefly talked about the dir() command within python. The dir() command is an invaluable tool when trying to discover valid attributes. This is going to be a very quick post on how I have been using the print dir() command to list out attribute with\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"http:\/\/www.vicdebaie.com\/blog\/category\/python\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":469,"url":"http:\/\/www.vicdebaie.com\/blog\/running-a-python-script-on-every-motionbuilder-file-within-a-directory\/","url_meta":{"origin":288,"position":1},"title":"Running a Python Script On Every MotionBuilder File Within A Directory","author":"admin","date":"March 6, 2018","format":false,"excerpt":"It's been awhile since I have posted, We are approaching launch of my next game tittle and now that I have a free moment I thought I would demonstrate how to run a python script on multiple \".fbx\" files. All the \".fbx\" files for this demo will exist within the\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"http:\/\/www.vicdebaie.com\/blog\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/03\/Possibility.jpg?fit=960%2C627&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/03\/Possibility.jpg?fit=960%2C627&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/03\/Possibility.jpg?fit=960%2C627&resize=700%2C400 2x"},"classes":[]},{"id":492,"url":"http:\/\/www.vicdebaie.com\/blog\/returning-a-specific-word-from-motionbuilders-python-dir\/","url_meta":{"origin":288,"position":2},"title":"Returning A Specific Word From MotionBuilder&#8217;s Python Dir()","author":"admin","date":"March 8, 2018","format":false,"excerpt":"I'm not sure why I did not think of this before, here is a little function that will search a user specified module using dir(), but it will also search the components and only return the ones that match the user's specified filtered word. Let me explain with an example.\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"http:\/\/www.vicdebaie.com\/blog\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/03\/simplepath.jpg?fit=1024%2C683&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/03\/simplepath.jpg?fit=1024%2C683&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/03\/simplepath.jpg?fit=1024%2C683&resize=700%2C400 2x"},"classes":[]},{"id":596,"url":"http:\/\/www.vicdebaie.com\/blog\/motionbuilder-python-my-fav-story-functions\/","url_meta":{"origin":288,"position":3},"title":"MotionBuilder Python My Fav Story Functions","author":"admin","date":"July 17, 2018","format":false,"excerpt":"After posting \"MotionBuilder Python Library aka. My Fav Functions\" I thought I would follow up with some breakdown on manipulating Story Tracks, Clips and Folders with MotionBuilder's Python modules. I briefly covered this a while ago here but that was really just an example of how to put characters into\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"http:\/\/www.vicdebaie.com\/blog\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/07\/Storycheatsheet.jpg?fit=782%2C474&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/07\/Storycheatsheet.jpg?fit=782%2C474&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2018\/07\/Storycheatsheet.jpg?fit=782%2C474&resize=700%2C400 2x"},"classes":[]},{"id":172,"url":"http:\/\/www.vicdebaie.com\/blog\/animating-and-setting-keys-with-motionbuilders-python-editor\/","url_meta":{"origin":288,"position":4},"title":"Animating and setting keys with MotionBuilder&#8217;s Python Editor","author":"admin","date":"February 16, 2017","format":false,"excerpt":"Here is the code for a Python script that I wrote dealing animating and setting keys on a selected object within MotionBuilder. Writing this animation script really helped me get a better understanding on how to\u00a0use MotionBuilder's FBTime. The exercise forced me to sit down for about two hours and\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"http:\/\/www.vicdebaie.com\/blog\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/AnimateWithCode.jpg?fit=600%2C220&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":274,"url":"http:\/\/www.vicdebaie.com\/blog\/using-python-to-import-motionbuilder-characters-into-story\/","url_meta":{"origin":288,"position":5},"title":"Using Python to import MotionBuilder Characters into story.\u00a0","author":"admin","date":"April 6, 2017","format":false,"excerpt":"\u00a0 MotionBuilder comes with a great script that will place your selected character into a Character Track within the Story, I wanted to write one that would put all of the scene's Characters into the story. Once again I will use the \"Mia_Rigged.fbx\" file to test my script. I created\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"http:\/\/www.vicdebaie.com\/blog\/category\/python\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/04\/MobuPython_StoryScript.jpg?fit=1011%2C224&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/04\/MobuPython_StoryScript.jpg?fit=1011%2C224&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/04\/MobuPython_StoryScript.jpg?fit=1011%2C224&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/288"}],"collection":[{"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/comments?post=288"}],"version-history":[{"count":4,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/288\/revisions"}],"predecessor-version":[{"id":443,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/288\/revisions\/443"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/media\/289"}],"wp:attachment":[{"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/media?parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/categories?post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/tags?post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}