{"id":726,"date":"2019-09-25T16:11:31","date_gmt":"2019-09-25T20:11:31","guid":{"rendered":"http:\/\/www.vicdebaie.com\/blog\/?p=726"},"modified":"2019-09-25T16:11:40","modified_gmt":"2019-09-25T20:11:40","slug":"motionbuilder-switch-to-camera-tool","status":"publish","type":"post","link":"http:\/\/www.vicdebaie.com\/blog\/motionbuilder-switch-to-camera-tool\/","title":{"rendered":"MotionBuilder Switch To Camera Tool"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-attachment-id=\"729\" data-permalink=\"http:\/\/www.vicdebaie.com\/blog\/motionbuilder-switch-to-camera-tool\/mobu-switch_to_cam_tool\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/Mobu-Switch_To_Cam_Tool.png?fit=931%2C385\" data-orig-size=\"931,385\" 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=\"Mobu-Switch_To_Cam_Tool\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/Mobu-Switch_To_Cam_Tool.png?fit=300%2C124\" data-large-file=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/Mobu-Switch_To_Cam_Tool.png?fit=678%2C280\" decoding=\"async\" loading=\"lazy\" width=\"678\" height=\"280\" src=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/Mobu-Switch_To_Cam_Tool.png?resize=678%2C280\" alt=\"\" class=\"wp-image-729\" srcset=\"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/Mobu-Switch_To_Cam_Tool.png?w=931 931w, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/Mobu-Switch_To_Cam_Tool.png?resize=300%2C124 300w, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/Mobu-Switch_To_Cam_Tool.png?resize=768%2C318 768w\" sizes=\"(max-width: 678px) 100vw, 678px\" data-recalc-dims=\"1\" \/><\/figure><\/div>\n\n\n\n<p>I was working with a scene that had A LOT of cameras, multiple cameras per character. Jumping between all of them while I worked was a annoying so I wrote a quick script\/tool that helped me handle dealing with all that.<\/p>\n\n\n\n<p>The &#8220;Switch To Camera Tool&#8221; is a very simple script. It lists all cameras within your scene, the list can be filtered by name or you can it can omit the orthographic camera by a check of a box. As the default orthographic  cameras can already be easily switched to via dedicated short cut keys I thought a omission feature would be nice. <br><br>The UI has check boxes that allow you to easily display elements to each camera (time code, safe frames, grid, etc.).  The tool will remember which display elements you have set up for each camera and if you need to add or remove a camera to your scene there is a &#8220;Refresh Camera List&#8221;.  <\/p>\n\n\n<p><iframe loading=\"lazy\" style=\"display: block; margin: auto;\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/HuHRKIbDo84\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\"><\/iframe><\/p>\n\n\n<p style=\"text-align:center\">Above is a quick demo of the tool in action.<\/p>\n\n\n<p>I&#8217;ve posted the code for the script below and you can find the tool <a href=\"https:\/\/drive.google.com\/open?id=1cmhmUl6dwVLusdd7nRVobYgnvLiCpqxe\">here<\/a> if you don&#8217;t want to do that pesky copy and paste. \ud83d\ude42<\/p>\n\n\n<pre class=\"wp-block-code\"><pre class=\"brush: python; title: ; notranslate\" title=\"\">import pyfbsdk as fb\nimport pyfbsdk_additions as fba\n\n##Create A List Of All Cameras In The Scene\ndef GenerateCamList():\n    ##Clean Out The Drop Down List And Generate A New List\n    delMe = DrpDwn_CamList.Items\n    for i in DrpDwn_CamList.Items&#x5B;:]:\n        if i in delMe: \n            DrpDwn_CamList.Items.remove(i)\n           \n    for cam in fb.FBSystem().Scene.Cameras: \n        DrpDwn_CamList.Items.append(cam.LongName)\n    \n    ##Filter Out Orthographic Cameras If Then &quot;Filter Out Orthagraphic Cameras&quot; Check Box Is Active    \n    if btnFilterCamList.State == 1:\n        orthoCams = (&quot;Producer Front&quot;, &quot;Producer Back&quot;, &quot;Producer Right&quot;, &quot;Producer Left&quot;, &quot;Producer Top&quot;, &quot;Producer Bottom&quot;)\n        for i in DrpDwn_CamList.Items&#x5B;:]:\n           if i in orthoCams:\n               DrpDwn_CamList.Items.remove(i)\n    \n    ##Filter Camera List By User Defined Name\n    if efilterCamByString.Text != &quot;&quot;:\n        ##Create A Data List        \n        data = DrpDwn_CamList.Items\n        ##Create An Empty Filter List\n        filterData = &#x5B;]\n        for i in data:\n            if efilterCamByString.Text.lower() in i.lower():\n                ##Add Items To Filter List Based On The String Provided In The UI Field\n                filterData.extend(&#x5B;i])\n        ##Generate The Filtered List         \n        DrpDwn_CamList.Items.removeAll()\n        for i in filterData:\n            DrpDwn_CamList.Items.append(str(i))\n            \n##Filter Out Orthagraphic Cameras Check Box\ndef btnFilterCamList_CallBack(control, event):\n    GenerateCamList()\n\n##Switch Viewer Camera To The Selected Drop Down Item\ndef CameraList_CallBack(control, event):\n    try:\n        cameraName = DrpDwn_CamList.Items&#x5B;DrpDwn_CamList.ItemIndex]\n        for cam in fb.FBSystem().Scene.Cameras:\n            if cam.LongName == cameraName: \n                fb.FBApplication().SwitchViewerCamera(cam)\n                                \n                global camtool_CurrentCam\n                camtool_CurrentCam = cam\n                    \n                btnViewCameraInterest.State = camtool_CurrentCam.ViewCameraInterest\n                btnViewNearFarPlane.State = camtool_CurrentCam.ViewNearFarPlane = btnViewNearFarPlane.State\n                btnViewShowName.State = camtool_CurrentCam.ViewShowName\n                btnViewShowGrid.State = camtool_CurrentCam.ViewShowGrid\n                btnViewShowAxis.State = camtool_CurrentCam.ViewShowAxis\n                btnViewShowTimeCode.State = camtool_CurrentCam.ViewShowTimeCode\n                btnViewOpticalCenter.State = camtool_CurrentCam.ViewOpticalCenter\n                btnDisplaySafeArea.State = camtool_CurrentCam.PropertyList.Find(&quot;DisplaySafeArea&quot;).Data\n                \n                btnViewCameraInterest.Enabled = True\n                btnViewNearFarPlane.Enabled = True\n                btnViewShowName.Enabled = True\n                btnViewShowGrid.Enabled = True\n                btnViewShowAxis.Enabled = True\n                btnViewShowTimeCode.Enabled = True\n                btnViewOpticalCenter.Enabled = True\n                btnDisplaySafeArea.Enabled = True\n                DrpDwn_SafeFrame.Enabled = btnDisplaySafeArea.State\n                \n                return camtool_CurrentCam\n\n    except: pass \n    \n##Filter By Drop Down List By Name (As The User Types The List Will Be Updated)\ndef efilterCamByString_Callback(control, event):\n    GenerateCamList()\n\ndef UpDateCamDisplay():\n    try:                    \n        camtool_CurrentCam.ViewCameraInterest = btnViewCameraInterest.State\n        camtool_CurrentCam.ViewNearFarPlane = btnViewNearFarPlane.State\n        camtool_CurrentCam.ViewShowName = btnViewShowName.State\n        camtool_CurrentCam.ViewShowGrid = btnViewShowGrid.State\n        camtool_CurrentCam.ViewShowAxis = btnViewShowAxis.State\n        camtool_CurrentCam.ViewShowTimeCode = btnViewShowTimeCode.State\n        camtool_CurrentCam.ViewOpticalCenter = btnViewOpticalCenter.State\n        camtool_CurrentCam.PropertyList.Find(&quot;DisplaySafeArea&quot;).Data = btnDisplaySafeArea.State\n        \n        ##Enable Safe Frame Area Drop Down Menu\n        DrpDwn_SafeFrame.Enabled = btnDisplaySafeArea.State\n        if camtool_CurrentCam.SafeAreaMode == &quot;kFBSafeAreaSquare&quot;: DrpDwn_SafeFrame.ItemIndex = 0\n        if camtool_CurrentCam.SafeAreaMode == &quot;kFBSafeAreaRound&quot;: DrpDwn_SafeFrame.ItemIndex = 1\n        \n    except: pass\n\n##Camera Display Options\ndef CameraDislay_CallBack(control, event):\n    UpDateCamDisplay()\n\n##Change Safe Frame Area Visual     \ndef Change_SafeFrameArea():\n    if DrpDwn_SafeFrame.Items&#x5B;DrpDwn_SafeFrame.ItemIndex] == &quot;Square Safe Area&quot;:\n        try: camtool_CurrentCam.SafeAreaMode = fb.FBCameraSafeAreaMode.kFBSafeAreaSquare\n        except: pass\n    if DrpDwn_SafeFrame.Items&#x5B;DrpDwn_SafeFrame.ItemIndex] == &quot;Round Safe Area&quot;:\n        try: camtool_CurrentCam.SafeAreaMode = fb.FBCameraSafeAreaMode.kFBSafeAreaRound\n        except: pass\n\n##Set Safe Frame Area Drop Down Menu \ndef DrpDwn_SafeFrame_CallBack(control, event):\n    Change_SafeFrameArea()\n\n##Refresh Camera List Button\ndef RefreshCamList_CallBack(control, event):\n    GenerateCamList()\n            \n'''\nUI Layout\n'''\ndef PopulateTool(t):    \n    ##Camera Drop Down List------------------------------------------------------------------------------\n    CamList = fb.FBLabel()\n    x = fb.FBAddRegionParam(5,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    y = fb.FBAddRegionParam(5,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    w = fb.FBAddRegionParam(290,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;CamList&quot;,&quot;CamList&quot;, x, y, w, h)\n    t.SetControl(&quot;CamList&quot;, CamList)\n    CamList.Caption = &quot;Camera List:&quot;\n    CamList.ReadOnly = True\n    CamList.Style = fb.FBTextStyle.kFBTextStyleBold\n    CamList.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    \n    global DrpDwn_CamList\n    DrpDwn_CamList = fb.FBList()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;CamList&quot;)\n    y = fb.FBAddRegionParam(5,fb.FBAttachType.kFBAttachBottom,&quot;CamList&quot;)\n    w = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachRight,&quot;CamList&quot;)\n    h = fb.FBAddRegionParam(120,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;DrpDwn_CamList&quot;,&quot;DrpDwn_CamList&quot;, x, y, w, h)\n    t.SetControl(&quot;DrpDwn_CamList&quot;, DrpDwn_CamList)\n    DrpDwn_CamList.ItemIndex = -1\n    DrpDwn_CamList.MultiSelect = False\n    DrpDwn_CamList.ExtendedSelect = False\n    DrpDwn_CamList.Style = fb.FBListStyle.kFBVerticalList\n    \n    for cam in fb.FBSystem().Scene.Cameras:\n        DrpDwn_CamList.Items.append(cam.LongName)\n        \n    DrpDwn_CamList.OnChange.Add(CameraList_CallBack)\n    \n    ##Filter Orthographic And Perspective Cameras\n    global btnFilterCamList\n    btnFilterCamList = fb.FBButton()\n    x = fb.FBAddRegionParam(10,fb.FBAttachType.kFBAttachRight,&quot;DrpDwn_CamList&quot;)\n    y = fb.FBAddRegionParam(-20,fb.FBAttachType.kFBAttachTop,&quot;DrpDwn_CamList&quot;)\n    w = fb.FBAddRegionParam(185,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(35,fb.FBAttachType.kFBAttachNone,&quot;DrpDwn_CamList&quot;)\n    t.AddRegion(&quot;btnFilterCamList&quot;,&quot;btnFilterCamList&quot;, x, y, w, h)\n    t.SetControl(&quot;btnFilterCamList&quot;, btnFilterCamList)\n    btnFilterCamList.Caption = &quot;Filter Out Orthographic Cameras&quot;\n    btnFilterCamList.Style = fb.FBButtonStyle.kFBCheckbox\n    btnFilterCamList.State = 0\n    btnFilterCamList.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnFilterCamList.Look = fb.FBButtonLook.kFBLookNormal\n    btnFilterCamList.OnClick.Add(btnFilterCamList_CallBack)\n   \n    ##Filter By String\n    FilterCamByName = fb.FBLabel()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;DrpDwn_CamList&quot;)\n    y = fb.FBAddRegionParam(10,fb.FBAttachType.kFBAttachBottom,&quot;DrpDwn_CamList&quot;)\n    w = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachRight,&quot;DrpDwn_CamList&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;FilterCamByName&quot;,&quot;FilterCamByName&quot;, x, y, w, h)\n    t.SetControl(&quot;FilterCamByName&quot;, FilterCamByName)\n    FilterCamByName.Caption = &quot;Filter Camer List By Name:&quot;\n    FilterCamByName.ReadOnly = True\n    FilterCamByName.Style = fb.FBTextStyle.kFBTextStyleBold\n    FilterCamByName.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    \n    global efilterCamByString\n    efilterCamByString = fb.FBEdit()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;FilterCamByName&quot;)\n    y = fb.FBAddRegionParam(5,fb.FBAttachType.kFBAttachBottom,&quot;FilterCamByName&quot;)\n    w = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachRight,&quot;FilterCamByName&quot;)\n    h = fb.FBAddRegionParam(25,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;efilterCamByString&quot;,&quot;efilterCamByString&quot;, x, y, w, h)\n    t.SetControl(&quot;efilterCamByString&quot;, efilterCamByString)\n    efilterCamByString.OnChange.Add(efilterCamByString_Callback)\n    \n    \n    CamDisplay = fb.FBLabel()\n    x = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachLeft,&quot;btnFilterCamList&quot;)\n    y = fb.FBAddRegionParam(1,fb.FBAttachType.kFBAttachBottom,&quot;btnFilterCamList&quot;)\n    w = fb.FBAddRegionParam(100,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;CamDisplay&quot;,&quot;CamDisplay&quot;, x, y, w, h)\n    t.SetControl(&quot;CamDisplay&quot;, CamDisplay)\n    CamDisplay.Caption = &quot;Display:&quot;\n    CamDisplay.ReadOnly = True\n    CamDisplay.Style = fb.FBTextStyle.kFBTextStyleBold\n    CamDisplay.Justify = fb.FBTextJustify.kFBTextJustifyLeft\n    \n    ##Display Check Boxes\n    global btnViewCameraInterest\n    btnViewCameraInterest = fb.FBButton()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;CamDisplay&quot;)\n    y = fb.FBAddRegionParam(2,fb.FBAttachType.kFBAttachBottom,&quot;CamDisplay&quot;)\n    w = fb.FBAddRegionParam(110,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnViewCameraInterest&quot;,&quot;btnViewCameraInterest&quot;, x, y, w, h)\n    t.SetControl(&quot;btnViewCameraInterest&quot;, btnViewCameraInterest)\n    btnViewCameraInterest.Caption = &quot;Camera Interest&quot;\n    btnViewCameraInterest.Style = fb.FBButtonStyle.kFBCheckbox\n    btnViewCameraInterest.Enabled = False\n    btnViewCameraInterest.State = 0\n    btnViewCameraInterest.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnViewCameraInterest.Look = fb.FBButtonLook.kFBLookNormal\n    btnViewCameraInterest.OnClick.Add(CameraDislay_CallBack)\n\n    global btnViewNearFarPlane\n    btnViewNearFarPlane = fb.FBButton()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;btnViewCameraInterest&quot;)\n    y = fb.FBAddRegionParam(2,fb.FBAttachType.kFBAttachBottom,&quot;btnViewCameraInterest&quot;)\n    w = fb.FBAddRegionParam(140,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnViewNearFarPlane&quot;,&quot;btnViewNearFarPlane&quot;, x, y, w, h)\n    t.SetControl(&quot;btnViewNearFarPlane&quot;, btnViewNearFarPlane)\n    btnViewNearFarPlane.Caption = &quot;Camera Near\/Far Plane&quot;\n    btnViewNearFarPlane.Style = fb.FBButtonStyle.kFBCheckbox\n    btnViewNearFarPlane.Enabled = False\n    btnViewNearFarPlane.State = 0\n    btnViewNearFarPlane.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnViewNearFarPlane.Look = fb.FBButtonLook.kFBLookNormal\n    btnViewNearFarPlane.OnClick.Add(CameraDislay_CallBack)\n    \n    global btnViewShowName\n    btnViewShowName = fb.FBButton()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;btnViewNearFarPlane&quot;)\n    y = fb.FBAddRegionParam(2,fb.FBAttachType.kFBAttachBottom,&quot;btnViewNearFarPlane&quot;)\n    w = fb.FBAddRegionParam(95,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnViewShowName&quot;,&quot;btnViewShowName&quot;, x, y, w, h)\n    t.SetControl(&quot;btnViewShowName&quot;, btnViewShowName)\n    btnViewShowName.Caption = &quot;Camera Label&quot;\n    btnViewShowName.Style = fb.FBButtonStyle.kFBCheckbox\n    btnViewShowName.Enabled = False\n    btnViewShowName.State = 1\n    btnViewShowName.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnViewShowName.Look = fb.FBButtonLook.kFBLookNormal\n    btnViewShowName.OnClick.Add(CameraDislay_CallBack)\n\n    global btnViewShowGrid\n    btnViewShowGrid = fb.FBButton()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;btnViewShowName&quot;)\n    y = fb.FBAddRegionParam(2,fb.FBAttachType.kFBAttachBottom,&quot;btnViewShowName&quot;)\n    w = fb.FBAddRegionParam(50,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnViewShowGrid&quot;,&quot;btnViewShowGrid&quot;, x, y, w, h)\n    t.SetControl(&quot;btnViewShowGrid&quot;, btnViewShowGrid)\n    btnViewShowGrid.Caption = &quot;Grid&quot;\n    btnViewShowGrid.Style = fb.FBButtonStyle.kFBCheckbox\n    btnViewShowGrid.Enabled = False\n    btnViewShowGrid.State = 1\n    btnViewShowGrid.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnViewShowGrid.Look = fb.FBButtonLook.kFBLookNormal\n    btnViewShowGrid.OnClick.Add(CameraDislay_CallBack)\n\n    global btnViewShowAxis\n    btnViewShowAxis = fb.FBButton()\n    x = fb.FBAddRegionParam(40,fb.FBAttachType.kFBAttachRight,&quot;btnViewShowGrid&quot;)\n    y = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachTop,&quot;btnViewShowGrid&quot;)\n    w = fb.FBAddRegionParam(50,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnViewShowAxis&quot;,&quot;btnViewShowAxis&quot;, x, y, w, h)\n    t.SetControl(&quot;btnViewShowAxis&quot;, btnViewShowAxis)\n    btnViewShowAxis.Caption = &quot;Axis&quot;\n    btnViewShowAxis.Style = fb.FBButtonStyle.kFBCheckbox\n    btnViewShowAxis.Enabled = False\n    btnViewShowAxis.State = 0\n    btnViewShowAxis.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnViewShowAxis.Look = fb.FBButtonLook.kFBLookNormal\n    btnViewShowAxis.OnClick.Add(CameraDislay_CallBack)\n\n    global btnViewShowTimeCode\n    btnViewShowTimeCode = fb.FBButton()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;btnViewShowGrid&quot;)\n    y = fb.FBAddRegionParam(2,fb.FBAttachType.kFBAttachBottom,&quot;btnViewShowGrid&quot;)\n    w = fb.FBAddRegionParam(80,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnViewShowTimeCode&quot;,&quot;btnViewShowTimeCode&quot;, x, y, w, h)\n    t.SetControl(&quot;btnViewShowTimeCode&quot;, btnViewShowTimeCode)\n    btnViewShowTimeCode.Caption = &quot;Time Code&quot;\n    btnViewShowTimeCode.Style = fb.FBButtonStyle.kFBCheckbox\n    btnViewShowTimeCode.Enabled = False\n    btnViewShowTimeCode.State = 0\n    btnViewShowTimeCode.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnViewShowTimeCode.Look = fb.FBButtonLook.kFBLookNormal\n    btnViewShowTimeCode.OnClick.Add(CameraDislay_CallBack)\n\n    global btnViewOpticalCenter\n    btnViewOpticalCenter = fb.FBButton()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;btnViewShowAxis&quot;)\n    y = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachTop,&quot;btnViewShowTimeCode&quot;)\n    w = fb.FBAddRegionParam(60,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnViewOpticalCenter&quot;,&quot;btnViewOpticalCenter&quot;, x, y, w, h)\n    t.SetControl(&quot;btnViewOpticalCenter&quot;, btnViewOpticalCenter)\n    btnViewOpticalCenter.Caption = &quot;Center&quot;\n    btnViewOpticalCenter.Style = fb.FBButtonStyle.kFBCheckbox\n    btnViewOpticalCenter.Enabled = False\n    btnViewOpticalCenter.State = 0\n    btnViewOpticalCenter.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnViewOpticalCenter.Look = fb.FBButtonLook.kFBLookNormal\n    btnViewOpticalCenter.OnClick.Add(CameraDislay_CallBack)\n\n    global btnDisplaySafeArea\n    btnDisplaySafeArea = fb.FBButton()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;btnViewShowTimeCode&quot;)\n    y = fb.FBAddRegionParam(2,fb.FBAttachType.kFBAttachBottom,&quot;btnViewShowTimeCode&quot;)\n    w = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnDisplaySafeArea&quot;,&quot;btnDisplaySafeArea&quot;, x, y, w, h)\n    t.SetControl(&quot;btnDisplaySafeArea&quot;, btnDisplaySafeArea)\n    btnDisplaySafeArea.Caption = &quot;&quot;\n    btnDisplaySafeArea.Style = fb.FBButtonStyle.kFBCheckbox\n    btnDisplaySafeArea.Enabled = False\n    btnDisplaySafeArea.State = 0\n    btnDisplaySafeArea.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnDisplaySafeArea.Look = fb.FBButtonLook.kFBLookNormal\n    btnDisplaySafeArea.OnClick.Add(CameraDislay_CallBack)\n\n    global DrpDwn_SafeFrame\n    DrpDwn_SafeFrame = fb.FBList()\n    x = fb.FBAddRegionParam(2,fb.FBAttachType.kFBAttachRight,&quot;btnDisplaySafeArea&quot;)\n    y = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachTop,&quot;btnDisplaySafeArea&quot;)\n    w = fb.FBAddRegionParam(155,fb.FBAttachType.kFBAttachRight,&quot;CamList&quot;)\n    h = fb.FBAddRegionParam(20,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;DrpDwn_SafeFrame&quot;,&quot;DrpDwn_SafeFrame&quot;, x, y, w, h)\n    t.SetControl(&quot;DrpDwn_SafeFrame&quot;, DrpDwn_SafeFrame)\n    DrpDwn_SafeFrame.ItemIndex = 0\n    DrpDwn_SafeFrame.MultiSelect = False\n    DrpDwn_SafeFrame.ExtendedSelect = False\n    DrpDwn_SafeFrame.Enabled = False\n    DrpDwn_SafeFrame.Style = fb.FBListStyle.kFBDropDownList\n    \n    safeFrameList = &#x5B;&quot;Square Safe Area&quot;, &quot;Round Safe Area&quot;]\n    for i in safeFrameList:\n        DrpDwn_SafeFrame.Items.append(i)\n        \n    DrpDwn_SafeFrame.OnChange.Add(DrpDwn_SafeFrame_CallBack)\n    \n    btnRefreshCamList = fb.FBButton()\n    x = fb.FBAddRegionParam(0,fb.FBAttachType.kFBAttachLeft,&quot;btnDisplaySafeArea&quot;)\n    y = fb.FBAddRegionParam(15,fb.FBAttachType.kFBAttachBottom,&quot;btnDisplaySafeArea&quot;)\n    w = fb.FBAddRegionParam(40,fb.FBAttachType.kFBAttachRight,&quot;DrpDwn_SafeFrame&quot;)\n    h = fb.FBAddRegionParam(40,fb.FBAttachType.kFBAttachNone,&quot;&quot;)\n    t.AddRegion(&quot;btnRefreshCamList&quot;,&quot;btnRefreshCamList&quot;, x, y, w, h)\n    t.SetControl(&quot;btnRefreshCamList&quot;, btnRefreshCamList)\n    btnRefreshCamList.Caption = &quot;Refresh Camera List&quot;\n    btnRefreshCamList.Style = fb.FBButtonStyle.kFBPushButton\n    btnRefreshCamList.Justify = fb.FBTextJustify.kFBTextJustifyCenter\n    btnRefreshCamList.Look = fb.FBButtonLook.kFBLookNormal\n    btnRefreshCamList.OnClick.Add(RefreshCamList_CallBack)\n    \ndef CreateTool():\n    global t\n    t = fba.FBCreateUniqueTool(&quot;Swtich To Camera Tool&quot;)\n    t.MinSizeX = t.MaxSizeX = 495\n    t.MinSizeY = t.MaxSizeY = 250\n    PopulateTool(t)\n    fb.ShowTool(t)\n\nCreateTool()\n<\/pre>\n\n\n\n<p>This was a very quick tool to create, the fun part was figuring out how to filter the list and how to get the tool to read the settings from the cameras upon selection - that was a happy little surprise feature that came about through accident (to some degree).<\/p>\n\n\n\n<p><br>As always, I hope this helps. \ud83d\ude42<\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>A tool to help you quickly jump between all the cameras within you MotionBuilder scene.<\/p>\n","protected":false},"author":1,"featured_media":729,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","jetpack_publicize_message":"MotionBuilder Switch To Camera Tool\n\nhttps:\/\/youtu.be\/HuHRKIbDo84\n\n#MotionBuilder #Python","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[4],"tags":[5,7,8],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/Mobu-Switch_To_Cam_Tool.png?fit=931%2C385","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8pltq-bI","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":518,"url":"http:\/\/www.vicdebaie.com\/blog\/motionbuilder-python-fbdelete\/","url_meta":{"origin":726,"position":0},"title":"MotionBuilder Python FBDelete","author":"admin","date":"April 23, 2018","format":false,"excerpt":"I've been asked a few times now on how to delete objects, files, takes, layers, etc. from MotionBuilder's Scenes. I thought I would take a few moments to go through the basics of FBDelete(). All examples below share pretty much the exact same structure with there scripts, we create an\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\/04\/fbdelete.png?fit=420%2C294&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":190,"url":"http:\/\/www.vicdebaie.com\/blog\/motionbuilder-python-tool-saveit\/","url_meta":{"origin":726,"position":1},"title":"MotionBuilder Python Tool &#8220;SaveIt&#8221;","author":"admin","date":"February 12, 2017","format":false,"excerpt":"Here is a script\/tool I created for MotionBuilder using Python. \u00a0This tool will\u00a0do an incremental save of your scene. Why? Incremental saves are amazingly useful, I thought a tool that automates the process down to one click would be fun. A big thanks goes out to my college Raphael Lappiere\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\/SaveIt_tool.jpg?fit=600%2C220&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":566,"url":"http:\/\/www.vicdebaie.com\/blog\/motionbuilder-python-parent-constraint-tool\/","url_meta":{"origin":726,"position":2},"title":"MotionBuilder Python Parent Constraint Tool","author":"admin","date":"June 18, 2018","format":false,"excerpt":"Here is a quick post to share a tool I created a little while back. It is designed to help to quickly create Parent Constraints between two objects as well as easily allow the user to bake that constraint down. The script can be found HERE and there are a\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_3937.jpg?fit=443%2C364&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":188,"url":"http:\/\/www.vicdebaie.com\/blog\/shelveit-tool\/","url_meta":{"origin":726,"position":3},"title":"ShelveIt tool","author":"admin","date":"February 21, 2017","format":false,"excerpt":"Here is a tool that I whipped up:\u00a0Shelve It. It's a simple Python script that will duplicate your current MotionBuilder take, name it using the original take's name but add the suffix \"_Shelved\". It can come in hand when you want to explore some more changes on a take you\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\/Screen-Shot-2017-02-21-at-10.29.02-PM.png?fit=962%2C524&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/Screen-Shot-2017-02-21-at-10.29.02-PM.png?fit=962%2C524&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2017\/02\/Screen-Shot-2017-02-21-at-10.29.02-PM.png?fit=962%2C524&resize=700%2C400 2x"},"classes":[]},{"id":711,"url":"http:\/\/www.vicdebaie.com\/blog\/using-motionbuilder-python-to-cast-real-time-shadows\/","url_meta":{"origin":726,"position":4},"title":"Using MotionBuilder Python To Cast Real-Time Shadows","author":"admin","date":"September 18, 2019","format":false,"excerpt":"Using Python To Quickly Add A Real Time Shadow To Your MotionBuilder Scene.","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\/09\/ShadowCube.png?fit=1157%2C526&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/ShadowCube.png?fit=1157%2C526&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/ShadowCube.png?fit=1157%2C526&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.vicdebaie.com\/blog\/wp-content\/uploads\/2019\/09\/ShadowCube.png?fit=1157%2C526&resize=1050%2C600 3x"},"classes":[]},{"id":739,"url":"http:\/\/www.vicdebaie.com\/blog\/motionbuilder-python-choose-interaction-mode-tool\/","url_meta":{"origin":726,"position":5},"title":"MotionBuilder Python -Choose Interaction Mode Tool","author":"admin","date":"November 18, 2019","format":false,"excerpt":"A quick script that allows the user to change Motionbuilder's Interaction Mode with a single click","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\/GUID-1F064D55-DE9A-4005-9179-80AAAAD4B3AA.png?fit=356%2C202&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/726"}],"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=726"}],"version-history":[{"count":9,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/726\/revisions"}],"predecessor-version":[{"id":744,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/posts\/726\/revisions\/744"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/media\/729"}],"wp:attachment":[{"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/media?parent=726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/categories?post=726"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.vicdebaie.com\/blog\/wp-json\/wp\/v2\/tags?post=726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}