i can't figure out how class method pastethesekeys() work. tried passing (self) parameter got error passing in 2 parameters when me looks i'm passing in 1 self. removed self argument , getting message.
# animation copy tool # bakari holmes 5/7/2015 # designed copy , existing animation # 1 rig , make process easier # simple ui import maya.cmds mc import functools import maya.mel mm import pprint class animcopywindow(object): #@classmethod def showui(cls): win = cls() win.create() return win def __init__(self): self.window = "animation copy tool" self.title = "animation copier" self.size = (546,350) def pastethesekeys(): self.offsetval = mc.intfieldgrp(self.int_offset, q=true, value1=true) self.selobj_pastekeys = mc.ls(sl=true) objectquant in self.selobj_pastekeys: print objectquant self.ct = mc.currenttime(query = true) self.t = self.ct + self.offsetval mc.currenttime(self.t) # mc.selectkey(selobj_pastekeys[objectquant]) mc.pastekey(time=(self.t,self.t), f=(1.0,1.0), option="merge", copies=1, to=0, fo=0, vo=0) def create(self): # check see if window exists if mc.window(self.window,exists=true): mc.deleteui(self.window,window=true) self.window = mc.window(self.window, title=self.title,widthheight=self.size,menubar=true) self.copyanim = mc.window(title="transfer animation tool", backgroundcolor=[0.3,0.3,0.3],sizeable=false,resizetofitchildren=true) #set layout ui mc.columnlayout(adjustablecolumn=true) self.tx_src = mc.textfieldgrp(label="source object", editable=false, text=sel[0]) self.int_offset = mc.intfieldgrp(label="frame offset amount", value1=0) #add paste animation button self.btn1 = mc.button(label="paste animation", command="pastethesekeys()", bgc=[0.1,0.1,0.5]) #add close button window self.btn2 = mc.button(label="close window", command="mc.deleteui", bgc=[0.2,0.2,0.2]) mc.showwindow() #copyanim="copyanim" #store selected object info sel = mc.ls(selection=true) if (len(sel) != 1): mm.eval("warning must select 1 animated object;") else: mc.copykey() win = animcopywindow() win.create() pprint.pprint(channels())
the function pastethesekeys()
needs defined self parameter used outside function. or use staticmethod
decorator if need not accept self.
@staticmethod def pastethesekeys(): ...
Comments
Post a Comment