def _bake(selection, frame_range): start_time = cmds.timerX()
# selection = controllers selected cmds.select(selection)
# Isolate to get the bake faster panelFocus = cmds.getPanel(withFocus=True) visPanels = cmds.getPanel(visiblePanels=True) modelPanels = cmds.getPanel(type="modelPanel") if modelPanels: for pan in modelPanels: finder = pan in visPanels if finder: activePanel = pan cmds.setFocus(activePanel) cmds.scriptedPanel( "referenceEditorPanel1", edit=True, replacePanel=activePanel ) total01 = cmds.timerX(startTime=start_time) # Took about 0.02
# Mostly looking at only Translate and Rotate channels. channels = ["translate", "rotate"] axis = ["X", "Y", "Z"] for frame in range(frame_range[0], frame_range[1]): cmds.currentTime(frame) for channel in channels: for axi in axis: temp_attr = "".join((channel, axi)) cmds.setKeyframe(attribute=temp_attr, time=frame)
total02 = cmds.timerX(startTime=start_time) # Took about 27.66
# Back to the prespective cmds.modelPanel( activePanel, edit=True, replacePanel="referenceEditorPanel1" ) cmds.setFocus(panelFocus)
# Filter baked curve cmds.filterCurve(filter="euler")
totalTime = cmds.timerX(startTime=start_time) # Took 28.11
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/9399f1ee-04fd-498d-8c95-cb952abdab53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I added that command in, to ensure that animation is being baked properly in each frame across the frame range defined.I tried commenting out that particular line, only the first frame is being baked while the rest of the frames are static....
On Thursday, July 19, 2018 at 2:51:27 PM UTC-7, Justin Israel wrote:Is the cmds.currentTime(frame) necessary, if you are already passing a "time" value to setKeyframe()? I imagine you are wasting a bunch of cpu time changing the current frame in the scene and triggering updates.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/205c754e-2140-426c-943d-e15313be8105%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/01ff3672-50a2-414a-b0fe-65bb5074a4e3%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2ee6fa25-1366-4c83-90bf-2772f4232167%40googlegroups.com.