def get_render_range(instance): from reveries import utils from reveries.maya import pipeline project = instance.context.data["projectDoc"] asset_name = pipeline.has_turntable() proj_start, proj_end, _ = utils.compose_timeline_data(project, asset_name) return proj_start, proj_end
def process(self, context): from reveries import utils from reveries.maya import pipeline # (TODO) Involving turntable is because this plugin used to validate # dailies turntable playblast or render publishing. # But we don't do it here now, should be removed. asset_name = pipeline.has_turntable() if asset_name is None and not asset_has_frame_range(context): self.log.info("No range been set on this asset, skipping..") return True # (TODO) Might need to get frame data from instance object, for case # like publishing multiple shots' camera in one scene. scene_start = context.data["startFrame"] scene_end = context.data["endFrame"] scene_fps = context.data["fps"] project = context.data["projectDoc"] proj_start, proj_end, fps = utils.compose_timeline_data( project, asset_name, scene_fps) # Check if any of the values are present if any(value is None for value in (scene_start, scene_end)): raise ValueError("No time values for this context. This is a bug." "(Missing `startFrame` or `endFrame`)") is_invalid = False # Raise error if scene_start/scene_end are not enough to include the # frame range settings in database. if proj_start < scene_start: is_invalid = True self.log.debug("Start Frame: {}".format(proj_start)) self.log.debug("Scene Start Frame: {}".format(scene_start)) self.log.error("Start frame not consistent with project " "settings.") if proj_end > scene_end: is_invalid = True self.log.debug("End Frame: {}".format(proj_end)) self.log.debug("Scene End Frame: {}".format(scene_end)) self.log.error("End frame not consistent with project " "settings.") # raise error if fps is not consistent with the settings on database. if int(scene_fps) != int(fps): is_invalid = True self.log.debug("FPS: {}".format(fps)) self.log.debug("Scene FPS: {}".format(scene_fps)) self.log.error("FPS not consistent with project settings.") if is_invalid: raise ValueError("Timeline does not match with project settings.")
def get_invalid(cls, instance): """Rendering resolution should be the same as project settings""" from reveries.maya import pipeline valid_resolutions = list() project = instance.context.data["projectDoc"] is_turntable = pipeline.has_turntable() turntable = project["data"]["pipeline"]["maya"].get("turntable") if turntable is not None and turntable == is_turntable: # (NOTE) When publishing turntable, some asset may need other # render resolution width/height to fit in. # # To add extra valid resolution for asset, add this to # the turntable asset data: # # "exceptions" : { # "assetName": [ # [width1, height1], # [width2, height2], # ... # ] # } # # (TODO) Might need to think a better way to implement this. # ttable_doc = io.find_one({"type": "asset", "name": turntable}) ttable_data = ttable_doc["data"] exception = ttable_data["exceptions"].get(instance.data["asset"]) if exception is not None: valid_resolutions += exception.get("resolution", []) proj_width, proj_height = utils.get_resolution_data(project, is_turntable) valid_resolutions.append((proj_width, proj_height)) scene_width, scene_height = instance.data["resolution"] invalid = True for res in valid_resolutions: if res[0] == scene_width or res[1] == scene_height: invalid = False break if invalid: cls.log.error("Resolution width and height should be {0} x {1}." "".format(*valid_resolutions.pop())) for res in valid_resolutions: cls.log.error("Or {0} x {1}".format(*res)) return invalid
def process(self, context): from reveries import utils from reveries.maya import pipeline asset_name = pipeline.has_turntable() if asset_name is None and not asset_has_frame_range(context): self.log.info("No range been set on this asset, skipping..") return True scene_start = context.data["startFrame"] scene_end = context.data["endFrame"] scene_fps = context.data["fps"] project = context.data["projectDoc"] proj_start, proj_end, fps = utils.compose_timeline_data( project, asset_name, scene_fps) # Check if any of the values are present if any(value is None for value in (scene_start, scene_end)): raise ValueError("No time values for this context. This is a bug." "(Missing `startFrame` or `endFrame`)") is_invalid = False # Raise error if scene_start/scene_end are not enough to include the # frame range settings in database. if proj_start < scene_start: is_invalid = True self.log.debug("Start Frame: {}".format(proj_start)) self.log.debug("Scene Start Frame: {}".format(scene_start)) self.log.error("Start frame not consistent with project " "settings.") if proj_end > scene_end: is_invalid = True self.log.debug("End Frame: {}".format(proj_end)) self.log.debug("Scene End Frame: {}".format(scene_end)) self.log.error("End frame not consistent with project " "settings.") # raise error if fps is not consistent with the settings on database. if int(scene_fps) != int(fps): is_invalid = True self.log.debug("FPS: {}".format(fps)) self.log.debug("Scene FPS: {}".format(scene_fps)) self.log.error("FPS not consistent with project settings.") if is_invalid: raise ValueError("Timeline does not match with project settings.")
def fix_invalid(cls, context): asset_name = has_turntable() strict = False if asset_name is None else True set_scene_timeline(asset_name=asset_name, strict=strict)
def fix_invalid(cls, context): from reveries.maya import pipeline asset_name = pipeline.has_turntable() strict = False if asset_name is None else True pipeline.set_scene_timeline(asset_name=asset_name, strict=strict)