Hi everyone, I am trying to copy keys from imported rig and paste it to the reference rig. I have written following code:
``` import pymel.core as pm # select the ctrls to copy keys sel = pm.ls("*CTRL") print(sel) # get a list of references refs = pm.listReferences() reference_namespaces = [] # get list of namespaces from reference for ref in refs: reference_namespaces.append(ref.namespace) # get time slider range of the scene min_timeRange = pm.playbackOptions(q=1, min=1) max_timeRange = pm.playbackOptions(q=1, max=1) time_value = "{}:{}".format(min_timeRange, max_timeRange) float_value = "{}:{}".format(min_timeRange, max_timeRange) for s in sel: pm.copyKey(s, time=":", hierarchy="none", controlPoints=0, shape=1) for reference_namespace in reference_namespaces: if pm.objExists(reference_namespace + ":" + s): referenced_ctrl = reference_namespace + ":" + s pm.pasteKey(referenced_ctrl, option="replaceCompletely", float=(min_timeRange, max_timeRange), time=(min_timeRange, max_timeRange), copies=1, connect=0)``` It is showing me following error: # Traceback (most recent call last): # File "<maya console>", line 1, in <module> # File "D:/Downloads/Scripts/Scripts/utkarsh/daily_scripts/transferKeys.py", line 29, in <module> # pm.pasteKey(referenced_ctrl, option="replaceCompletely", time=(min_timeRange, max_timeRange)) # File "C:\Program Files\Autodesk\Maya2020\Python\lib\site-packages\pymel\core\animation.py", line 754, in pasteKey # res = cmds.pasteKey(*args, **kwargs) # File "C:\Program Files\Autodesk\Maya2020\Python\lib\site-packages\pymel\internal\pmcmds.py", line 130, in pasteKey_wrapped # res = new_cmd(*new_args, **new_kwargs) # RuntimeError: time ranges not valid with given option # pastekey command seems to be the main issue and I checked with command page. I understand what is wrong with the command. Please help!! -- 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_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c920bd24-d2dc-4218-9e17-47e56a469ed0n%40googlegroups.com.