def __init__(self, args_string): self.arg = ArgumentParser("RRMaya", args_string) self.log = Logger() self.workspace = self.arg.get("Database") self.image_dir = self.arg.get("FDir") self.python_path = self.arg.get("PyModPath") self.maya_scene = self.arg.get("SName") self.override_render_cmd = self.arg.get("OverwriteRenderCmd") self.kso_mode = self.arg.get("KSOMode") self.file_name = self.arg.get("FName") self.file_ext = self.arg.get("FExt") self.file_name_no_var = self.arg.get("FNameNoVar") self.file_dir = self.arg.get("FDir") self.single_output = self.arg.get("FSingleOutput") self.frame_padding = self.arg.default("FPadding", 4) self.frame_start = self.arg.get("FrStart") self.frame_end = self.arg.get("FrEnd") self.frame_step = self.arg.get("FrStep") self.frame_offset = self.arg.get("FrOffset") self.camera = self.arg.get("Camera") self.layer_name = self.arg.get("Layer") self.threads = self.arg.get("Threads") self.resx = self.arg.get("ResX") self.resy = self.arg.get("ResY") self.image_format = self.arg.get("FOverrideFormat") self.threads = self.arg.get("Threads") self.edge_aa = self.arg.get("AA1") self.samples = self.arg.get("AA2") self.max_samples = self.arg.get("AA3") self.treshold = self.arg.get("AA4") self.rx1 = self.arg.get("RegionX1") self.rx2 = self.arg.get("RegionX2") self.ry1 = self.arg.get("RegionY1") self.ry2 = self.arg.get("RegionY2") self.motion_blur = self.arg.get("RenderMotionBlur") self.render_demo = self.arg.get("RenderDemo") self.render_displace = self.arg.get("RenderDisplace") self.ext_override = self.arg.get("FExtOverride") self.verbose = self.arg.get("Verbose") self.kso_mode = self.arg.get("KSOMode")
class RRMayaJob(object): """ This class contains set of parameters describing a RoyalRender job and function that set/get or do operation on this parameters. """ def __init__(self, args_string): self.arg = ArgumentParser("RRMaya", args_string) self.log = Logger() self.workspace = self.arg.get("Database") self.image_dir = self.arg.get("FDir") self.python_path = self.arg.get("PyModPath") self.maya_scene = self.arg.get("SName") self.override_render_cmd = self.arg.get("OverwriteRenderCmd") self.kso_mode = self.arg.get("KSOMode") self.file_name = self.arg.get("FName") self.file_ext = self.arg.get("FExt") self.file_name_no_var = self.arg.get("FNameNoVar") self.file_dir = self.arg.get("FDir") self.single_output = self.arg.get("FSingleOutput") self.frame_padding = self.arg.default("FPadding", 4) self.frame_start = self.arg.get("FrStart") self.frame_end = self.arg.get("FrEnd") self.frame_step = self.arg.get("FrStep") self.frame_offset = self.arg.get("FrOffset") self.camera = self.arg.get("Camera") self.layer_name = self.arg.get("Layer") self.threads = self.arg.get("Threads") self.resx = self.arg.get("ResX") self.resy = self.arg.get("ResY") self.image_format = self.arg.get("FOverrideFormat") self.threads = self.arg.get("Threads") self.edge_aa = self.arg.get("AA1") self.samples = self.arg.get("AA2") self.max_samples = self.arg.get("AA3") self.treshold = self.arg.get("AA4") self.rx1 = self.arg.get("RegionX1") self.rx2 = self.arg.get("RegionX2") self.ry1 = self.arg.get("RegionY1") self.ry2 = self.arg.get("RegionY2") self.motion_blur = self.arg.get("RenderMotionBlur") self.render_demo = self.arg.get("RenderDemo") self.render_displace = self.arg.get("RenderDisplace") self.ext_override = self.arg.get("FExtOverride") self.verbose = self.arg.get("Verbose") self.kso_mode = self.arg.get("KSOMode") @property def render_name(self): """ returns: Name of the current renderer provided by rrSubmiter or specified in Maya settings. """ render_globals = pm.PyNode("defaultRenderGlobals") render_name = self.arg.get("Renderer") if render_name is None: return render_globals.getAttr("currentRenderer") else: return render_name @property def render_layer(self): """ Setup the Maya renderer to render only the specified layers. In case when arg layer is None will set masterLayer as rendarable. param layer: Layer name string. """ user_layer = self.arg.get("Layer") lm = pm.PyNode("renderLayerManager") render_layers = lm.listConnections() rendarable_layer = None for l in render_layers: if l.name() == user_layer: l.setAttr("renderable", True) rendarable_layer = l.name() else: l.setAttr("renderable", False) if rendarable_layer is None: # This is the case when render specified by user does not exist or None. default_layer = pm.nodetypes.RenderLayer(u"defaultRenderLayer") default_layer.setAttr("renderable", True) self.log.warning( "Failed to set layer %s as renderable. " "Does not exists. Set to %s." % (user_layer, default_layer.name()) ) rendarable_layer = default_layer.name() self.log.info("Current render layer: %s" % rendarable_layer) return rendarable_layer