def Maya_toggleConnection(self, attribute, *args): """Toggle on and off the connection state of specific attributes. Keyword arguments: attribute Return: none """ if (self.Maya_getInput(self.selectedShader, attribute) == (None, None)): self.User_warningDialog("Error", "Nothing is connected to %s" % self.selectedShader + '.' + attribute) else: connectionState = pc.shadingConnection(self.selectedShader + '.' + attribute, q=True, cs=True) if (connectionState): pc.shadingConnection(self.selectedShader + '.' + attribute, e=True, cs=False) else: pc.shadingConnection(self.selectedShader + '.' + attribute, e=True, cs=True) self.UI_refreshIcons()
def UI_refreshIcons(self): """Refresh connection state icons Keyword arguments: none Return: none """ # Given specific attributes, we look for their state for attribute in ('color', 'KsColor', 'specularRoughness', 'normalCamera'): # Connection state connectionState = pc.shadingConnection(self.selectedShader + '.' + attribute, q=True, cs=True) # If the connection is OK, we display the correct icon to disable it if (connectionState): pc.iconTextButton(self.dynamicButtons[attribute + 'Toggle'], edit=True, image="disableForRendering.png") else: pc.iconTextButton(self.dynamicButtons[attribute + 'Toggle'], edit=True, image="enableForRendering.png")