def add_aovs_to_ifd(self, wrangler, cam, now):
        """Add auto_aovs to the ifd.

        :param wrangler: A SOHO wrangler.
        :type wrangler: object
        :param cam: A SOHO camera.
        :type cam: soho.SohoObject
        :param now: The evaluation time.
        :type now: float
        :return:

        """
        import IFDapi
        import IFDsettings
        import soho

        # The parameter that defines which automatic aovs to add.
        parms = {
            "enable": soho.SohoParm(
                "enable_auto_aovs",
                "int",
                [1],
                skipdefault=False
            ),
            "auto_aovs": soho.SohoParm(
                "auto_aovs",
                "str",
                [""],
                skipdefault=False
            ),
        }

        # Attempt to evaluate the parameter.
        plist = cam.wrangle(wrangler, parms, now)

        if plist:
            # Adding is disabled so bail out.
            if plist["enable_auto_aovs"].Value[0] == 0:
                return

            aov_str = plist["auto_aovs"].Value[0]

            # Parse the string to get any aovs/groups.
            aov_items = self.get_aovs_from_string(aov_str)

            # Write any found items to the ifd.
            for item in aov_items:
                item.write_to_ifd(wrangler, cam, now)

            # If we are generating the "Op_Id" plane we will need to tell SOHO
            # to generate these properties when outputting object.  Look for
            # the "Op_Id" variable being exported and if so enable operator id
            # generation.
            for aov in flatten_aov_items(aov_items):
                if aov.variable == "Op_Id":
                    IFDapi.ray_comment("Forcing object id generation")
                    IFDsettings._GenerateOpId = True

                    break
Exemple #2
0
    def add_aovs_to_ifd(self, wrangler, cam, now):
        """Add auto_aovs to the ifd.

        :param wrangler: A SOHO wrangler.
        :type wrangler: object
        :param cam: A SOHO camera.
        :type cam: soho.SohoObject
        :param now: The evaluation time.
        :type now: float
        :return:

        """
        import IFDapi
        import IFDsettings
        import soho

        # The parameter that defines which automatic aovs to add.
        parms = {
            "enable": soho.SohoParm(
                "enable_auto_aovs",
                "int",
                [1],
                skipdefault=False
            ),
            "auto_aovs": soho.SohoParm(
                "auto_aovs",
                "str",
                [""],
                skipdefault=False
            ),
        }

        # Attempt to evaluate the parameter.
        plist = cam.wrangle(wrangler, parms, now)

        if plist:
            # Adding is disabled so bail out.
            if plist["enable_auto_aovs"].Value[0] == 0:
                return

            aov_str = plist["auto_aovs"].Value[0]

            # Parse the string to get any aovs/groups.
            aov_items = self.get_aovs_from_string(aov_str)

            # Write any found items to the ifd.
            for item in aov_items:
                item.write_to_ifd(wrangler, cam, now)

            # If we are generating the "Op_Id" plane we will need to tell SOHO
            # to generate these properties when outputting object.  Look for
            # the "Op_Id" variable being exported and if so enable operator id
            # generation.
            for aov in flatten_aov_items(aov_items):
                if aov.variable == "Op_Id":
                    IFDapi.ray_comment("Forcing object id generation")
                    IFDsettings._GenerateOpId = True

                    break
Exemple #3
0
    def addAOVsToIfd(wrangler, cam, now):
        """Add auto_aovs to the ifd."""
        import IFDapi
        import IFDsettings
        import soho

        # The parameter that defines which automatic aovs to add.
        parms = {
            "enable": soho.SohoParm(
                "enable_auto_aovs",
                "int",
                [1],
                skipdefault=False
            ),
            "auto_aovs": soho.SohoParm(
                "auto_aovs",
                "str",
                [""],
                skipdefault=False
            ),
        }

        # Attempt to evaluate the parameter.
        plist = cam.wrangle(wrangler, parms, now)

        if plist:
            # Adding is disabled so bail out.
            if plist["enable_auto_aovs"].Value[0] == 0:
                return

            aov_str = plist["auto_aovs"].Value[0]

            # Construct a manager-laf
            manager = findOrCreateSessionAOVManager()

            # Parse the string to get any aovs/groups.
            aovs = manager.getAOVsFromString(aov_str)

            # Write any found items to the ifd.
            for aov in aovs:
                aov.writeToIfd(wrangler, cam, now)

            # If we are generating the "Op_Id" plane we will need to tell SOHO
            # to generate these properties when outputting object.  Look for
            # the "Op_Id" variable being exported and if so enable operator id
            # generation
            for aov in flattenedList(aovs):
                if aov.variable == "Op_Id":
                    IFDapi.ray_comment("Forcing object id generation")
                    IFDsettings._GenerateOpId = True

                    break
    def addAOVsToIfd(wrangler, cam, now):
        """Add auto_aovs to the ifd."""
        import IFDapi
        import IFDsettings
        import soho

        # The parameter that defines which automatic aovs to add.
        parms = {
            "enable":
            soho.SohoParm("enable_auto_aovs", "int", [1], skipdefault=False),
            "auto_aovs":
            soho.SohoParm("auto_aovs", "str", [""], skipdefault=False),
        }

        # Attempt to evaluate the parameter.
        plist = cam.wrangle(wrangler, parms, now)

        if plist:
            # Adding is disabled so bail out.
            if plist["enable_auto_aovs"].Value[0] == 0:
                return

            aov_str = plist["auto_aovs"].Value[0]

            # Construct a manager-laf
            manager = findOrCreateSessionAOVManager()

            # Parse the string to get any aovs/groups.
            aovs = manager.getAOVsFromString(aov_str)

            # Write any found items to the ifd.
            for aov in aovs:
                aov.writeToIfd(wrangler, cam, now)

            # If we are generating the "Op_Id" plane we will need to tell SOHO
            # to generate these properties when outputting object.  Look for
            # the "Op_Id" variable being exported and if so enable operator id
            # generation
            for aov in flattenedList(aovs):
                if aov.variable == "Op_Id":
                    IFDapi.ray_comment("Forcing object id generation")
                    IFDsettings._GenerateOpId = True

                    break
Exemple #5
0
    def writeDataToIfd(data, wrangler, cam, now):
        """Write AOV data to the ifd."""
        import IFDapi

        # Call the 'pre_defplane' hook.  If the function returns True,
        # return.
        if _callPreDefPlane(data, wrangler, cam, now):
            return

        # Start of plane block in IFD.
        IFDapi.ray_start("plane")

        # Primary block information.
        IFDapi.ray_property("plane", "variable", [data["variable"]])
        IFDapi.ray_property("plane", "vextype", [data["vextype"]])
        IFDapi.ray_property("plane", "channel", [data["channel"]])

        if "quantize" in data:
            IFDapi.ray_property("plane", "quantize", [data["quantize"]])

        # Optional AOV information.
        if "planefile" in data:
            planefile = data["planefile"]

            if planefile is not None:
                IFDapi.ray_property("plane", "planefile", [planefile])

        if "lightexport" in data:
            IFDapi.ray_property("plane", "lightexport", [data["lightexport"]])

        if "pfilter" in data:
            IFDapi.ray_property("plane", "pfilter", [data["pfilter"]])

        if "sfilter" in data:
            IFDapi.ray_property("plane", "sfilter", [data["sfilter"]])

        if "component" in data:
            IFDapi.ray_property("plane", "component", [data["component"]])

        # Call the 'post_defplane' hook.
        if _callPostDefPlane(data, wrangler, cam, now):
            return

        # End the plane definition block.
        IFDapi.ray_end()
Exemple #6
0
    def writeToIfd(data, wrangler, cam, now):
        """Write the plane to the ifd.

        Args:
            data : (dict)
                The data dictionary containing output information.

            wrangler : (Object)
                A wrangler object.

            cam : (soho.SohoObject)
                The camera being rendered.

            now : (float)
                The parameter evaluation time.

        Raises:
            N/A

        Returns:
            None

        """
        import IFDapi

        # Call the 'pre_defplane' hook.  If the function returns True,
        # return.
        if _callPreDefPlane(data, wrangler, cam, now):
            return

        # Start of plane block in IFD.
        IFDapi.ray_start("plane")

        # Primary block information.
        IFDapi.ray_property("plane", "variable", [data["variable"]])
        IFDapi.ray_property("plane", "vextype", [data["vextype"]])
        IFDapi.ray_property("plane", "channel", [data["channel"]])
        IFDapi.ray_property("plane", "quantize", [data["quantize"]])

        # Optional plane information.
        if "planefile" in data:
            planefile = data["planefile"]
            if planefile is not None:
                IFDapi.ray_property("plane", "planefile", [planefile])

        if "lightexport" in data:
            IFDapi.ray_property("plane", "lightexport", [data["lightexport"]])

        if "pfilter" in data:
            IFDapi.ray_property("plane", "pfilter", [data["pfilter"]])

        if "sfilter" in data:
            IFDapi.ray_property("plane", "sfilter", [data["sfilter"]])

        # Call the 'post_defplane' hook.
        if _callPostDefPlane(data, wrangler, cam, now):
            return

        # End the plane definition block.
        IFDapi.ray_end()
Exemple #7
0
def _write_data_to_ifd(data, wrangler, cam, now):
    """Write AOV data to the ifd.

    :param data: AOV data.
    :type data: dict
    :param wrangler: A SOHO wrangler.
    :type wrangler: object
    :param cam: A SOHO camera.
    :type cam: soho.SohoObject
    :param now: The evaluation time.
    :type now: float
    :return: Whether or not the hook was successful.
    :rtype bool

    """
    import IFDapi

    # Call the 'pre_defplane' hook.  If the function returns True,
    # return.
    if _call_pre_defplane(data, wrangler, cam, now):
        return

    # Start of plane block in IFD.
    IFDapi.ray_start("plane")

    # Primary block information.
    IFDapi.ray_property("plane", "variable", [data[consts.VARIABLE_KEY]])
    IFDapi.ray_property("plane", "vextype", [data[consts.VEXTYPE_KEY]])
    IFDapi.ray_property("plane", "channel", [data[consts.CHANNEL_KEY]])

    if consts.QUANTIZE_KEY in data:
        IFDapi.ray_property("plane", "quantize", [data[consts.QUANTIZE_KEY]])

    # Optional AOV information.
    if consts.PLANEFILE_KEY in data:
        planefile = data["planefile"]

        if planefile is not None:
            IFDapi.ray_property("plane", "planefile", [planefile])

    if consts.LIGHTEXPORT_KEY in data:
        IFDapi.ray_property("plane", "lightexport", [data[consts.LIGHTEXPORT_KEY]])

    if consts.PFILTER_KEY in data:
        IFDapi.ray_property("plane", "pfilter", [data[consts.PFILTER_KEY]])

    if consts.SFILTER_KEY in data:
        IFDapi.ray_property("plane", "sfilter", [data[consts.SFILTER_KEY]])

    if consts.COMPONENT_KEY in data:
        IFDapi.ray_property("plane", "component", [data[consts.COMPONENT_KEY]])

    if consts.EXCLUDE_DCM_KEY in data:
        IFDapi.ray_property("plane", "excludedcm", [True])

    # Call the 'post_defplane' hook.
    if _call_post_defplane(data, wrangler, cam, now):
        return

    # End the plane definition block.
    IFDapi.ray_end()
Exemple #8
0
def _write_data_to_ifd(data, wrangler, cam, now):
    """Write AOV data to the ifd.

    :param data: AOV data.
    :type data: dict
    :param wrangler: A SOHO wrangler.
    :type wrangler: object
    :param cam: A SOHO camera.
    :type cam: soho.SohoObject
    :param now: The evaluation time.
    :type now: float
    :return: Whether or not the hook was successful.
    :rtype bool

    """
    import IFDapi

    # Call the 'pre_defplane' hook.  If the function returns True,
    # return.
    if _call_pre_defplane(data, wrangler, cam, now):
        return

    # Start of plane block in IFD.
    IFDapi.ray_start("plane")

    # Primary block information.
    IFDapi.ray_property("plane", "variable", [data[consts.VARIABLE_KEY]])
    IFDapi.ray_property("plane", "vextype", [data[consts.VEXTYPE_KEY]])
    IFDapi.ray_property("plane", "channel", [data[consts.CHANNEL_KEY]])

    if consts.QUANTIZE_KEY in data:
        IFDapi.ray_property("plane", "quantize", [data[consts.QUANTIZE_KEY]])

    # Optional AOV information.
    if consts.PLANEFILE_KEY in data:
        planefile = data["planefile"]

        if planefile is not None:
            IFDapi.ray_property("plane", "planefile", [planefile])

    if consts.LIGHTEXPORT_KEY in data:
        IFDapi.ray_property("plane", "lightexport",
                            [data[consts.LIGHTEXPORT_KEY]])

    if consts.PFILTER_KEY in data:
        IFDapi.ray_property("plane", "pfilter", [data[consts.PFILTER_KEY]])

    if consts.SFILTER_KEY in data:
        IFDapi.ray_property("plane", "sfilter", [data[consts.SFILTER_KEY]])

    if consts.COMPONENT_KEY in data:
        IFDapi.ray_property("plane", "component", [data[consts.COMPONENT_KEY]])

    if consts.EXCLUDE_DCM_KEY in data:
        IFDapi.ray_property("plane", "excludedcm", [True])

    # Call the 'post_defplane' hook.
    if _call_post_defplane(data, wrangler, cam, now):
        return

    # End the plane definition block.
    IFDapi.ray_end()
Exemple #9
0
    def writeDataToIfd(data, wrangler, cam, now):
        """Write AOV data to the ifd."""
        import IFDapi

        # Call the 'pre_defplane' hook.  If the function returns True,
        # return.
        if _callPreDefPlane(data, wrangler, cam, now):
            return

        # Start of plane block in IFD.
        IFDapi.ray_start("plane")

        # Primary block information.
        IFDapi.ray_property("plane", "variable", [data["variable"]])
        IFDapi.ray_property("plane", "vextype", [data["vextype"]])
        IFDapi.ray_property("plane", "channel", [data["channel"]])

        if "quantize" in data:
            IFDapi.ray_property("plane", "quantize", [data["quantize"]])

        # Optional AOV information.
        if "planefile" in data:
            planefile = data["planefile"]

            if planefile is not None:
                IFDapi.ray_property("plane", "planefile", [planefile])

        if "lightexport" in data:
            IFDapi.ray_property("plane", "lightexport", [data["lightexport"]])

        if "pfilter" in data:
            IFDapi.ray_property("plane", "pfilter", [data["pfilter"]])

        if "sfilter" in data:
            IFDapi.ray_property("plane", "sfilter", [data["sfilter"]])

        if "component" in data:
            IFDapi.ray_property("plane", "component", [data["component"]])

        if "exclude_from_dcm" in data:
            IFDapi.ray_property("plane", "excludedcm", [True])

        # Call the 'post_defplane' hook.
        if _callPostDefPlane(data, wrangler, cam, now):
            return

        # End the plane definition block.
        IFDapi.ray_end()