def __init__(self): ''' Constructor ''' x = 0 while x < 8192: constr = pm.sc_constraint_get_info(x) if constr != None: s = str(constr.name) self.__dict__[s] = constr.id #print s x = x + 1 else: x = x + 1 continue
def __init__(self): ''' Constructor ''' x=0 while x< 8192: constr = pm.sc_constraint_get_info(x) if constr!=None: s = str(constr.name) self.__dict__[s] = constr.id #print s x=x+1 else: x=x+1 continue
def sc_constraint_new(self, constr_uid, *arguments): """Creates constraint @param constr_uid: constarint uid @param arguments: constraint arguments """ constr = None info = None self.lock.acquire() info = pm.sc_constraint_get_info(constr_uid) self.lock.release() if not info : return None self.lock.acquire() constr = pm.sc_constraint_new_by_info(info) self.lock.release() if not constr : return None i = 0 self.lock.acquire() params = pm.sc_paramArray_frompointer(constr.params) inp_spec = pm.sc_param_specArray_frompointer(info.input_spec) self.lock.release() for arg in arguments: p = pm.sc_param() if arg == None : raise RuntimeError("Parameters must be an objects") if inp_spec[i] == pm.SC_PD_TYPE: p.type = arg elif inp_spec[i] == pm.SC_PD_ADDR or info.input_spec[i] == pm.SC_PD_ADDR_0: p.addr = arg elif inp_spec[i] == pm.SC_PD_INT: p.i = arg else: self.lock.acquire() pm.sc_constraint_free(constr) self.lock.release() params[i] = p i += 1 return constr