Ejemplo n.º 1
0
    def filterCamera(self):
        """Apply camera properties."""
        if self.res_scale is not None:
            resolution = getProperty("image:resolution")

            new_res = [
                _scaleResolution(val, self.res_scale) for val in resolution
            ]

            setProperty("image:resolution", new_res)

        if self.sample_scale is not None:
            samples = getProperty("image:samples")

            new_samples = [
                _scaleSampleValue(val, self.sample_scale) for val in samples
            ]

            setProperty("image:samples", new_samples)

        # Set the blurquality values to 0 to disable blur.
        if self.disable_blur:
            setProperty("renderer:blurquality", 0)
            setProperty("renderer:rayblurquality", 0)

        # Set the deepresolver to have no args, thus stopping it from running.
        if self.disable_deep:
            setProperty("image:deepresolver", [])

        if self.disable_tilecallback:
            setProperty("render:tilecallback", "")
Ejemplo n.º 2
0
    def filterPlane(self):
        """Modify image planes to ensure one will output Pz.

        This will disable all planes that are not C and Pz.

        """
        channel = getProperty("plane:channel")

        # The if the plane is Pz then store that it is set.
        if channel == "Pz":
            self.data["set_pz"] = True

        # If we haven't found a Pz plane yet and this channel isn't a primary
        # output channel then we will force it to be Pz.
        if not self.data["set_pz"] and channel not in ("C", "Of"):
            setProperty("plane:variable", "Pz")
            setProperty("plane:vextype", "float")
            setProperty("plane:channel", "Pz")
            setProperty("plane:pfilter", "minmax min")
            setProperty("plane:quantize", None)
            self.data["set_pz"] = True

        # Disable any other planes.
        elif channel not in ("C", "Pz"):
            setProperty("plane:disable", True)
Ejemplo n.º 3
0
    def filterInstance(self):
        """Apply constant black shaders to objects."""
        matte = getProperty("object:matte")
        phantom = getProperty("object:phantom")
        surface = getProperty("object:surface")

        setProperty("object:overridedetail", True)

        if matte == "true" or surface == "matte" or phantom == "true":
            setProperty("object:phantom", 1)

        else:
            shader = "opdef:/Shop/v_constant clr 0 0 0".split()

            setProperty("object:surface", shader)
            setProperty("object:displace", None)
Ejemplo n.º 4
0
    def filterCamera(self):
        """Apply camera properties."""
        render_type = getProperty("renderer:rendertype")

        if not self.all_passes and render_type != "beauty":
            logger.warning("Not a beauty render, skipping deepresolver")
            return

        if self.disable_deep_image:
            logger.info("Disabling deep resolver")
            setProperty("image:deepresolver", [])

        else:
            # Look for existing args.
            deep_args = getProperty("image:deepresolver")

            # If deep rendering is not enabled the args will be empty.
            if not deep_args:
                # If a resolver type and filename was passed then we will create
                # args for the resolver type to enable deep output.
                if self.deepresolver and self.filename:
                    deep_args = [self.deepresolver]

                # Log an error and abort.
                else:
                    logger.error(
                        "Cannot set deepresolver: deep output is not enabled")

                    return

            # Modify the args to include any passed along options.
            self._modifyDeepArgs(deep_args)

            logger.debug("Setting 'image:deepresolver': {}".format(" ".join(
                [str(arg) for arg in deep_args])))

            setProperty("image:deepresolver", deep_args)
Ejemplo n.º 5
0
    def setProperty(self):
        """Set the property under mantra."""
        import hou

        # Is this property being applied using a name mask.
        if self.mask is not None:
            # Get the name of the item that is currently being filtered.
            filtered_item = getProperty(self.mask_property_name)

            # If the mask pattern doesn't match, abort.
            if not hou.patternMatch(self.mask, filtered_item):
                return

        # Call the super class function to set the property.
        super(MaskedPropertySetter, self).setProperty()
Ejemplo n.º 6
0
    def setProperty(self):
        """Set the property to the value."""
        import hou

        # Don't do anything if the property isn't enabled.
        if not self.enabled:
            return

        # Is this property being applied to a specific render type.
        if self.rendertype is not None:
            # Get the rendertype for the current pass.
            rendertype = getProperty("renderer:rendertype")

            # If the type pattern doesn't match, abort.
            if not hou.patternMatch(self.rendertype, rendertype):
                return

        logger.debug(
            "Setting property '{}' to {}".format(self.name, self.value)
        )

        # Update the property value.
        setProperty(self.name, self.value)
Ejemplo n.º 7
0
 def shouldRun(self):
     """Only run if we are enabled AND rendering to ip."""
     return self.enabled and getProperty("image:filename") == "ip"
Ejemplo n.º 8
0
 def filterPlane(self):
     """Modify aov properties."""
     # We can't disable the main image plane or Mantra won't render.
     if self.disable_aovs and getProperty("plane:variable") != "Cf+Af":
         setProperty("plane:disable", 1)