@classmethod
    def convert_to_linear(cls):
        """adds a gamma_gain node in between the selected nodes outputs to make the
        result linear
        """

        #
        # convert to linear
        #

        selection = pm.ls(sl=1)

        for file_node in selection:
            # get the connections
            outputs = file_node.outputs(plugs=True)

            if not len(outputs):
                continue

            # and insert a mip_gamma_gain
            gamma_node = pm.createNode('mip_gamma_gain')
            gamma_node.setAttr('gamma', 2.2)
            gamma_node.setAttr('reverse', True)

            # connect the file_node to gamma_node
            try:
                file_node.outValue >> gamma_node.input
                file_node.outValueA >> gamma_node.inputA
            except __HOLE__:
                file_node.outColor >> gamma_node.input

            # do all the connections from the output of the gamma
            for output in outputs:
                try:
                    gamma_node.outValue >> output
                except RuntimeError:
                    gamma_node.outValueA >> output

        pm.select(selection)
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/toolbox.py/Render.convert_to_linear