{"id":292,"date":"2017-03-13T13:03:47","date_gmt":"2017-03-13T17:03:47","guid":{"rendered":"http:\/\/www.vicdebaie.com\/blog\/?p=292"},"modified":"2017-11-07T16:34:07","modified_gmt":"2017-11-07T21:34:07","slug":"mirroring-motionbuilder-character-animation-with-python","status":"publish","type":"post","link":"http:\/\/www.vicdebaie.com\/blog\/mirroring-motionbuilder-character-animation-with-python\/","title":{"rendered":"Mirroring MotionBuilder Character Animation with Python"},"content":{"rendered":"<p><img data-attachment-id=\"242\" data-permalink=\"http:\/\/www.vicdebaie.com\/blog\/mirroring-motionbuilder-character-animation-with-python\/img_4039-1-jpg\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/img_4039-1.jpg?fit=244%2C127\" data-orig-size=\"244,127\" 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;1&quot;}\" data-image-title=\"\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/img_4039-1.jpg?fit=244%2C127\" data-large-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/img_4039-1.jpg?fit=244%2C127\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-242 alignnone\" src=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/img_4039-1.jpg?resize=405%2C211\" alt=\"\" width=\"405\" height=\"211\" data-recalc-dims=\"1\" \/><\/p>\n<p>In a previous post I went over &#8220;<a href=\"http:\/\/www.vicdebaie.com\/blog\/plotting-character-animation-with-a-motionbuilder-python-script\/\">Plotting and Plot Options<\/a>&#8221; as well as <a href=\"http:\/\/www.vicdebaie.com\/blog\/?p=288&amp;preview=true\">&#8220;dir&#8221;<\/a> where we exposed the &#8220;MirrorMode&#8221; of a Character.<\/p>\n<p>Now with all that information exposed I will show you how I created a simple script that will mirror a\u00a0Character&#8217;s animation, first by setting the &#8220;MirrorMode&#8221; to be enabled, then we will plot the animation and finally the &#8220;MirrorMode&#8221; will be set off.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nfrom pyfbsdk import *\r\n\r\n# Creat lCharacter\r\nlCharacter = FBApplication().CurrentCharacter\r\n\r\n#Plot Ctrl Setttings\r\nPlotCtrlRigTakeOptions = FBPlotOptions()\r\nPlotCtrlRigTakeOptions.ConstantKeyReducerKeepOneKey = False\r\nPlotCtrlRigTakeOptions.PlotAllTakes = False\r\nPlotCtrlRigTakeOptions.PlotOnFrame = True\r\nPlotCtrlRigTakeOptions.PlotPeriod = FBTime( 0, 0, 0, 1 )\r\nPlotCtrlRigTakeOptions.PlotTranslationOnRootOnly = False\r\nPlotCtrlRigTakeOptions.PreciseTimeDiscontinuities = False\r\nPlotCtrlRigTakeOptions.RotationFilterToApply = FBRotationFilter.kFBRotationFilterUnroll\r\nPlotCtrlRigTakeOptions.UseConstantKeyReducer = False\r\n\r\nif lCharacter.MirrorMode == False:\r\n    # Turn on Mirror\r\n    lCharacter.MirrorMode = True\r\n    # Plot On Skeleton\r\n    lCharacter.PlotAnimation (FBCharacterPlotWhere.kFBCharacterPlotOnSkeleton,PlotCtrlRigTakeOptions )\r\n    # Plot Back On Control Rig\r\n    lCharacter.PlotAnimation (FBCharacterPlotWhere.kFBCharacterPlotOnControlRig,PlotCtrlRigTakeOptions )\r\n    # Turn Off Mirror\r\n    lCharacter.MirrorMode = False\r\n\r\nelse:\r\n    # Plot On Skeleton\r\n    lCharacter.PlotAnimation (FBCharacterPlotWhere.kFBCharacterPlotOnSkeleton,PlotCtrlRigTakeOptions )\r\n    # Plot Back On Control Rig\r\n    lCharacter.PlotAnimation (FBCharacterPlotWhere.kFBCharacterPlotOnControlRig,PlotCtrlRigTakeOptions )\r\n    # Turn Off Mirror\r\n    lCharacter.MirrorMode = False\r\n\r\n# Clean up\r\ndel (lCharacter)\r\n<\/pre>\n<p>In production I created a similar script for my team except it had worked like this:<br \/>\n1. Create a Copy of the Current take<br \/>\n2. Name the New take to &#8220;the original takes name&#8221; + &#8220;_Mirrored&#8221;<br \/>\n3. On the New take (&#8220;the original takes name&#8221; + &#8220;_Mirrored&#8221;) set the &#8220;MirrorMode&#8221; to be on<br \/>\n4. Set up my Plotting Options and Plot to Skeleton and then back to Ctrl rig (just like we did with the above script)<br \/>\n5. Turn Mirror Mode off<\/p>\n<p>This type of script is great to not only make mirroring animation faster but also to ensure that turning &#8220;MirrorMode&#8221; off is never forgotten &#8211; I did that a lot.<\/p>\n<p>I hope this helps.<\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>In a previous post I went over &#8220;Plotting and Plot Options&#8221; as well as &#8220;dir&#8221; where we exposed the &#8220;MirrorMode&#8221; of a Character. Now with all that information exposed I will show you how I created a simple script that will mirror a\u00a0Character&#8217;s animation, first by setting the &#8220;MirrorMode&#8221; to be enabled, then we will [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":241,"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\/02\/img_4039.jpg?fit=244%2C127","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8pltq-4I","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":81,"url":"http:\/\/www.vicdebaie.com\/blog\/plotting-character-animation-with-a-motionbuilder-python-script\/","url_meta":{"origin":292,"position":0},"title":"Plotting Character Animation With A MotionBuilder Python Script .\u00a0","author":"admin","date":"February 9, 2017","format":false,"excerpt":"Let's go over how to use Python to plot animation onto a character's Control Rig. The interesting part of this is\u00a0the \"plot options\" and how we call back on them when we plot. \u00a0 [code language=\"python\"] from pyfbsdk import * # Defining our Characater as the currnetly selected one lCharacter\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":747,"url":"http:\/\/www.vicdebaie.com\/blog\/motionbuilder-python-mirror-character-animation-through-story-mode\/","url_meta":{"origin":292,"position":1},"title":"MotionBuilder Python &#8211; Mirror Character Animation Through Story Mode","author":"admin","date":"November 21, 2019","format":false,"excerpt":"A quick script that will mirror animations via Story Mode.","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\/2019\/11\/Mirror-Cap.jpg?fit=960%2C640&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/11\/Mirror-Cap.jpg?fit=960%2C640&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/11\/Mirror-Cap.jpg?fit=960%2C640&resize=700%2C400 2x"},"classes":[]},{"id":276,"url":"http:\/\/www.vicdebaie.com\/blog\/saving-motionbuilder-character-animation-with-python\/","url_meta":{"origin":292,"position":2},"title":"Saving MotionBuilder Character Animation with Python","author":"admin","date":"April 5, 2017","format":false,"excerpt":"When I get Mocap it's usually in a messy scene. Optics, Markets, strange NameSpace, etc. they all can bog down a scene. One of the first thing I do is save out the Character Animation and load it back into a clean scene. Using Python to save out Character Animation\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\/03\/img_4059-1.jpg?fit=300%2C200&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":175,"url":"http:\/\/www.vicdebaie.com\/blog\/%ef%bb%bfplotting-selected-properties-using-motionbuilders-python\/","url_meta":{"origin":292,"position":3},"title":"\ufeffPlotting selected properties using MotionBuilder&#8217;s Python.","author":"admin","date":"February 17, 2017","format":false,"excerpt":"I ran\u00a0the script I created in \"Animating and setting keys with MotionBuilder's Python Editor\"\u00a0and decided that I would use the scene it creates\u00a0to learn how to plot on selected properties in MotionBuilder's Python Editor. Update: I found a work around for the bug and it is covered in my \"lock-and-plot-selected-properties-using-motionbuilders-python\"\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":253,"url":"http:\/\/www.vicdebaie.com\/blog\/move-a-character-in-motionbuilder-to-the-worlds-center-with-python\/","url_meta":{"origin":292,"position":4},"title":"Move a Character in MotionBuilder to the World&#8217;s Center with Python","author":"admin","date":"March 7, 2018","format":false,"excerpt":"\u200eWith a dozen takes in my Motionbuilder scene and my Character placed at different locations on each take, I decided Python would help me move my Character to the World's Center. With raw Mocap data your Character's Wold Position is all based on the Actors position within the volume during\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\/IMG_4056.jpg?fit=800%2C600&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/IMG_4056.jpg?fit=800%2C600&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/IMG_4056.jpg?fit=800%2C600&resize=700%2C400 2x"},"classes":[]},{"id":288,"url":"http:\/\/www.vicdebaie.com\/blog\/getting-information-on-motionbuilders-python-with-dir\/","url_meta":{"origin":292,"position":5},"title":"Getting information on MotionBuilder&#8217;s Python with dir","author":"admin","date":"March 13, 2017","format":false,"excerpt":"Trying to figure how things work in MotionBuilder'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 - the \"dir\"! :) What does \"dir\" do? The definition I was able to find is \"It gives\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":[]}],"_links":{"self":[{"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/292"}],"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=292"}],"version-history":[{"count":8,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/292\/revisions"}],"predecessor-version":[{"id":442,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/292\/revisions\/442"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/media\/241"}],"wp:attachment":[{"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/media?parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/categories?post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/tags?post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}