src/jmLightToolkit.py
def transfertLightFilters(self):
        """ Transfert light filters from first light selected to others lights selected. """
        # Get lights
        lights = self._onlyLightsFromSelection(get_shapes=True)
        if not lights:
            return None

        driver = lights[0]
        slaves = lights[1:]
        copy_attr = None

        # Get driver connection
        i = 0
        driver_connection = {}
        is_connected = pm.connectionInfo("%s.aiFilters[%s]" % (driver, i), id=True)
        while is_connected:
            driver_connection["aiFilters[%s]" % i] = pm.connectionInfo("%s.aiFilters[%s]" % (driver, i), sfd=True).split(".")[0]
            i += 1
            is_connected = pm.connectionInfo("%s.aiFilters[%s]" % (driver, i), id=True)

        if not driver_connection:
            _logger.warning("%s don't have any light filters")
            return None

        # Disconnect all light filters from the others lights
        lenght = len(driver_connection)
        for slave in slaves:
            i = 0
            is_connected = pm.connectionInfo("%s.aiFilters[%s]" % (slave, i), id=True)
            while is_connected:
                slave_connection = pm.connectionInfo("%s.aiFilters[%s]" % (slave, i), sfd=True)
                pm.PyNode(slave_connection) // pm.PyNode("%s.aiFilters[%s]" % (slave, i))
                i += 1
                is_connected = pm.connectionInfo("%s.aiFilters[%s]" % (slave, i), id=True)

            # Connect filters
            for key, value in driver_connection.items():
                pm.PyNode("%s.message" % value) >> pm.PyNode("%s.%s" % (slave.name(), key))

        pm.select(slaves)
        _logger.info("%s light filters transfered to %s" % (driver.name(), [node.name() for node in slaves]))
        return driver_connection
 Transfert light filters from first light selected to others lights selected. 
Transfert light filters from first light selected to others lights selected.
Transfert light filters from first light selected to others lights selected .
def transfertLightFilters(self):
        lights = self._onlyLightsFromSelection(get_shapes=True)
        if not lights:
            return None
        driver = lights[0]
        slaves = lights[1:]
        copy_attr = None
        i = 0
        driver_connection = {}
        is_connected = pm.connectionInfo("%s.aiFilters[%s]" % (driver, i), id=True)
        while is_connected:
            driver_connection["aiFilters[%s]" % i] = pm.connectionInfo("%s.aiFilters[%s]" % (driver, i), sfd=True).split(".")[0]
            i += 1
            is_connected = pm.connectionInfo("%s.aiFilters[%s]" % (driver, i), id=True)
        if not driver_connection:
            _logger.warning("%s don't have any light filters")
            return None
        lenght = len(driver_connection)
        for slave in slaves:
            i = 0
            is_connected = pm.connectionInfo("%s.aiFilters[%s]" % (slave, i), id=True)
            while is_connected:
                slave_connection = pm.connectionInfo("%s.aiFilters[%s]" % (slave, i), sfd=True)
                pm.PyNode(slave_connection) // pm.PyNode("%s.aiFilters[%s]" % (slave, i))
                i += 1
                is_connected = pm.connectionInfo("%s.aiFilters[%s]" % (slave, i), id=True)
            for key, value in driver_connection.items():
                pm.PyNode("%s.message" % value) >> pm.PyNode("%s.%s" % (slave.name(), key))
        pm.select(slaves)
        _logger.info("%s light filters transfered to %s" % (driver.name(), [node.name() for node in slaves]))
        return driver_connection
def transfertLightFilters ( self ) : lights = self . _onlyLightsFromSelection ( get_shapes = True ) if not lights : return None driver = lights [ 0 ] slaves = lights [ 1 : ] copy_attr = None i = 0 driver_connection = { } is_connected = pm . connectionInfo ( "%s.aiFilters[%s]" % ( driver , i ) , id = True ) while is_connected : driver_connection [ "aiFilters[%s]" % i ] = pm . connectionInfo ( "%s.aiFilters[%s]" % ( driver , i ) , sfd = True ) . split ( "." ) [ 0 ] i += 1 is_connected = pm . connectionInfo ( "%s.aiFilters[%s]" % ( driver , i ) , id = True ) if not driver_connection : _logger . warning ( "%s don't have any light filters" ) return None lenght = len ( driver_connection ) for slave in slaves : i = 0 is_connected = pm . connectionInfo ( "%s.aiFilters[%s]" % ( slave , i ) , id = True ) while is_connected : slave_connection = pm . connectionInfo ( "%s.aiFilters[%s]" % ( slave , i ) , sfd = True ) pm . PyNode ( slave_connection ) // pm . PyNode ( "%s.aiFilters[%s]" % ( slave , i ) ) i += 1 is_connected = pm . connectionInfo ( "%s.aiFilters[%s]" % ( slave , i ) , id = True ) for key , value in driver_connection . items ( ) : pm . PyNode ( "%s.message" % value ) >> pm . PyNode ( "%s.%s" % ( slave . name ( ) , key ) ) pm . select ( slaves ) _logger . info ( "%s light filters transfered to %s" % ( driver . name ( ) , [ node . name ( ) for node in slaves ] ) ) return driver_connection
Transfert light filters from first light selected to others lights selected.
Transfert light filters from first light selected to others lights selected .
""" Transfert light filters from first light selected to others lights selected. """ # Get lights # Get driver connection # Disconnect all light filters from the others lights # Connect filters
self