def filterCamera(self): """Apply camera properties.""" import mantra render_type = mantra.property("renderer:rendertype")[0] if not self.all_passes and render_type != "beauty": logger.warning("Not a beauty render, skipping deepresolver") return # Look for existing args. deep_args = mantra.property("image:deepresolver") # If deep rendering is not enabled the args will be emptry so we should # log an error and bail out. if not deep_args: logger.error( "Cannot set deepresolver: deepresolver is not enabled") return try: idx = deep_args.index("filename") # Somehow there is no filename arg so log an exception and print the # args list. except ValueError as inst: logger.exception(inst) logger.error("Deep args: {}".format(deep_args)) else: deep_args[idx + 1] = self.filepath # Set the new list as the property value setProperty("image:deepresolver", deep_args)
def filterCamera(self): """Apply camera properties.""" import mantra render_type = mantra.property("renderer:rendertype")[0] if not self.all_passes and render_type != "beauty": logger.warning("Not a beauty render, skipping deepresolver") return # Look for existing args. deepresolver = mantra.property("image:deepresolver") if deepresolver == [""]: logger.error("Cannot set deepresolver: deepresolver is not enabled") return if deepresolver: args = list(deepresolver[0].split()) try: idx = args.index("filename") except ValueError as inst: logger.exception(inst) return else: args[idx + 1] = self.filepath # Set the new list as the property value setProperty("image:deepresolver", args)
def filterCamera(self): """Apply camera properties.""" import mantra if self.res_scale is not None: resolution = mantra.property("image:resolution") new_res = [int(round(val * self.res_scale)) for val in resolution] setProperty("image:resolution", new_res) if self.sample_scale: samples = mantra.property("image:samples") # Need to make sure our values are at least a minimum of 1. new_samples = [int(math.ceil(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) # Redirect the deepresolver to 'null' to disable deep generation. if self.disable_deep: setProperty("image:deepresolver", "null")
def filterPlane(self): """Modify aov properties.""" import mantra # We can't disable the main image plane or Mantra won't render. if self.disable_aovs and mantra.property("plane:variable")[0] != "Cf+Af": setProperty("plane:disable", 1)
def filterCamera(self): """Apply camera properties.""" import mantra if self.res_scale is not None: resolution = mantra.property("image:resolution") new_res = [int(round(val * self.res_scale)) for val in resolution] setProperty("image:resolution", new_res) if self.sample_scale is not None: samples = mantra.property("image:samples") # Need to make sure our values are at least a minimum of 1. new_samples = [ max(1, int(math.ceil(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", [])
def filterCamera(self): """Apply camera properties.""" import mantra render_type = mantra.property("renderer:rendertype")[0] if not self.all_passes and render_type != "beauty": logger.warning("Not a beauty render, skipping deepresolver") return # Look for existing args. deepresolver = mantra.property("image:deepresolver") if deepresolver == ['']: logger.error( "Cannot set deepresolver: deepresolver is not enabled") return if deepresolver: args = list(deepresolver[0].split()) try: idx = args.index("filename") except ValueError as inst: logger.exception(inst) return else: args[idx + 1] = self.filepath # Set the new list as the property value setProperty("image:deepresolver", args)
def filterInstance(self): """Modify object properties.""" if self.disable_displacement: setProperty("object:displace", []) if self.disable_subd: setProperty("object:rendersubd", 0)
def filterCamera(self): """Apply camera properties.""" import mantra if self.res_scale is not None: resolution = mantra.property("image:resolution") new_res = [int(round(val * self.res_scale)) for val in resolution] setProperty("image:resolution", new_res) if self.sample_scale: samples = mantra.property("image:samples") # Need to make sure our values are at least a minimum of 1. new_samples = [ int(math.ceil(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) # Redirect the deepresolver to 'null' to disable deep generation. if self.disable_deep: setProperty("image:deepresolver", "null")
def filterPlane(self): """Modify aov properties.""" import mantra # We can't disable the main image plane or Mantra won't render. if self.disable_aovs and mantra.property( "plane:variable")[0] != "Cf+Af": setProperty("plane:disable", 1)
def filterCamera(self): """Apply camera properties.""" if self.disable_primary_image: logger.info("Disabling primary image") setProperty("image:filename", "null:") elif self.primary_image_path is not None: setProperty("image:filename", self.primary_image_path)
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)
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)
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)
def filterInstance(self): """Apply constant black shaders to objects.""" matte = Property("object:matte").value phantom = Property("object:phantom").value surface = Property("object:surface").value print matte, phantom, surface surface = mantra.property("object:surface")[0] setProperty("object:overridedetail", True) shader = "opdef:/Shop/v_constant clr 0 0 0".split() if matte == "true" or surface == "matte" or phantom == "true": setProperty("object:phantom", 1) else: setProperty("object:surface", shader) setProperty("object:displace", None)
def filterMaterial(self): """Modify material properties.""" if self.disable_displacement: setProperty("object:displace", [])
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", "")
def filterCamera(self): """Apply camera properties.""" setProperty("render:tilecallback", self.callback_path)
def filterPlane(self): """Modify image planes to ensure one will output Pz. This will disable all planes that are not C and Pz. """ channel = Property("plane:channel").value # 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)
def filterCamera(self): """Apply camera properties.""" # Disable primary image output by setting the output picture to "null:" setProperty("image:filename", "null:")