def addLoc(self, name, parent, position=None): """Add a loc object to the guide. This mehod can initialize the object or draw it. Loc object is a simple null to define a position or a tranformation in the guide. Args: name (str): Local name of the element. parent (dagNode): The parent of the element. position (vector): The default position of the element. Returns: dagNode: The locator object. """ if name not in self.tra.keys(): self.tra[name] = transform.getTransformFromPos(position) if name in self.prim.keys(): # this functionality is not implemented. The actual design from # softimage Gear should be review to fit in Maya. loc = self.prim[name].create(parent, self.getName(name), self.tra[name], color=17) else: loc = icon.guideLocatorIcon(parent, self.getName(name), color=17, m=self.tra[name]) return loc
def addLocMulti(self, name, parent, updateParent=True): """Add multiple loc objects to the guide. This method can initialize the object or draw it. Loc object is a simple null to define a position or a tranformation in the guide. Args: name (str): Local name of the element. parent (dagNode): The parent of the element. minimum (int): The minimum number of loc. maximum (int): The maximum number of loc. updateParent (bool): if True update the parent reference. False, keep the same for all loc. Returns: list of dagNode: The created loc objects in a list. """ if "#" not in name: mgear.log( "You need to put a '#' in the name of multiple location.", mgear.sev_error) return False locs = [] i = 0 while True: localName = string.replaceSharpWithPadding(name, i) if localName not in self.tra.keys(): break loc = icon.guideLocatorIcon(parent, self.getName(localName), color=17, m=self.tra[localName]) locs.append(loc) if updateParent: parent = loc i += 1 return locs