示例#1
0
    def execute(self, context):

        name = self.resource_enum  # access selection

        # Create workers
        ctx_w = worker.ContextWorker()
        imp_w = worker.ImportWorker()

        # Instantiate a resource
        res = resource.Component(project=os.environ['CURRENT_UNIPIPE_PROJECT'], name=name, type='final')

        # Check resource availability
        res_path = imp_w.construct_publish_path(resource=res, version=0, ext=ctx_w.app_interface.primary_extension)

        if not os.path.isfile(res_path):
            popup.show_message_box(message='No published final available for: "{}"'.format(name),
                                   title='File not available...',
                                   icon='INFO')
            return {'CANCELLED'}

        # Import the resource
        imp_w.import_published_resource(resource=res, maintain_links=True)

        self.report({'INFO'}, "Linked Final'd Resource: {}".format(name))

        return {'FINISHED'}
示例#2
0
    def execute(self, context):
        res = worker.ImportWorker().get_resource_from_context()

        rev_w = worker.ReviewWorker()
        # ../review/narrative/shot_0001_0002_000/preViz/default/1/sequence/shot_0001_0002_0000_preViz_default.#####.jpg
        path = rev_w.construct_path(resource=res, ext='jpg', padding=4)

        render = bpy.data.scenes[0].render

        # Set path and file settings
        render.filepath = path
        render.use_file_extension = True
        render.use_overwrite = False
        render.use_placeholder = True
        render.use_render_cache = False
        render.image_settings.file_format = 'JPEG'
        render.image_settings.color_mode = 'RGB'
        render.image_settings.quality = 90

        render.use_simplify = False  # Switch off simplify for full res when rendering

        if res.type in ['lighting']:
            # Eevee render
            render.engine = 'BLENDER_EEVEE'
            scene_eevee = bpy.data.scenes[0].eevee
            scene_eevee.use_gtao = True
            scene_eevee.use_sss = True
            scene_eevee.use_ssr = True
            scene_eevee.use_dof = True
            scene_eevee.use_motion_blur = True
            scene_eevee.taa_samples = 16
            scene_eevee.taa_render_samples = 16

        else:
            # Workbench render
            render.engine = 'BLENDER_WORKBENCH'
            shading = bpy.data.scenes[0].display.shading
            shading.color_type = 'MATERIAL'
            shading.show_xray = False
            shading.show_shadows = False
            shading.show_cavity = True
            shading.show_object_outline = False
            shading.cavity_valley_factor = 1.7
            shading.cavity_ridge_factor = 0.4
            shading.show_specular_highlight = True

        #bpy.ops.render.render('INVOKE_DEFAULT', animation=True)
        #popup.show_message_box(message='Successfully updated uvs (and model) for resource "{}"'.format(res.name),
        #                       title='Success...',
        #                       icon='INFO')

        self.report({'INFO'}, 'Rendering set for "{}": to: "{}"'.format(res.name, path))

        return {'FINISHED'}
示例#3
0
    def execute(self, context):
        imp_w = worker.ImportWorker()
        res = imp_w.get_resource_from_context()
        imp_w.import_published_resource(resource=res, maintain_links=False, type='model')

        popup.show_message_box(message="Appended model collection for resource: {}".format(res.name),
                               title='Success...',
                               icon='INFO')

        self.report({'INFO'}, "Appended model collection for resource: {}".format(res.name))

        return {'FINISHED'}
示例#4
0
    def execute(self, context):
        res = worker.ImportWorker().get_resource_from_context()
        worker.PublishWorker().publish_from_context(open_original_file=True)

        # TODO: Currently this causes crashing
        # popup.show_message_box(message='Successfully published "{}" for resource "{}"'.format(res.type, res.name),
        #                        title='Success...',
        #                        icon='INFO')

        self.report({'INFO'},
                    'Successfully published "{}" for resource "{}"'.format(
                        res.type, res.name))

        return {'FINISHED'}
示例#5
0
    def execute(self, context):
        res = worker.ImportWorker().get_resource_from_context()
        rev_w = worker.ReviewWorker()

        render = bpy.data.scenes[0].render

        if res.type == 'lighting':
            render.image_settings.file_format = 'OPEN_EXR_MULTILAYER'
            render.image_settings.color_mode = 'RGBA'
            render.image_settings.color_depth = '32'
            render.image_settings.exr_codec = 'PXR24'
            path = rev_w.construct_path(resource=res, ext='exr', padding=4)

        elif res.type == 'compositing':
            render.image_settings.file_format = 'PNG'
            render.image_settings.color_mode = 'RGB'
            render.image_settings.color_depth = '16'
            render.image_settings.compression = 10
            path = rev_w.construct_path(resource=res, ext='png', padding=4)

        else:
            render.image_settings.file_format = 'JPEG'
            render.image_settings.color_mode = 'RGB'
            render.image_settings.quality = 90
            path = rev_w.construct_path(resource=res, ext='jpg', padding=4)

        # Set Path
        render.filepath = path

        # Set generic output settings
        render.use_file_extension = True
        render.use_overwrite = False
        render.use_placeholder = True
        render.use_render_cache = False
        render.use_stamp_hostname = True

        clip_path = '../{}'.format(os.sep.join(path.rsplit(os.sep, 3)))

        self.report({'INFO'}, 'Render path for "{}": set to: "{}"'.format(
            res.name, clip_path))

        return {'FINISHED'}
示例#6
0
    def execute(self, context):

        # Remove old materials first
        for material in bpy.data.materials:
            material.user_clear()
            bpy.data.materials.remove(material)

        # Append new materials
        imp_w = worker.ImportWorker()
        res = imp_w.get_resource_from_context()
        imp_w.import_published_resource(resource=res, maintain_links=False, type='shader')

        # Process assignment file TODO

        popup.show_message_box(message="Appended materials for resource: {}".format(res.name),
                               title='Success...',
                               icon='INFO')

        self.report({'INFO'}, "Appended materials for resource: {}".format(res.name))

        return {'FINISHED'}
示例#7
0
    def execute(self, context):

        # Discover resource
        imp_w = worker.ImportWorker()
        res = imp_w.get_resource_from_context()

        # Append the rig
        imp_w.import_published_resource(resource=res, maintain_links=False, type='rig')

        # Append the shaders - remove old shaders first
        for material in bpy.data.materials:
            material.user_clear()
            bpy.data.materials.remove(material)

        try:
            imp_w.import_published_resource(resource=res, maintain_links=False, type='shader')

            # Process assignment file
            path = imp_w.construct_publish_path(resource=res, version=-1, type='shader', ext='json')
            if os.path.isfile(path):
                with open(path, 'r') as readFile:
                    data = json.loads(readFile.read())
                    process_assignment(data)

        except Exception as e:
            self.report({'INFO'}, "Successfully built final resource: {} without material. "
                                  "Mat Error: {}".format(res.name, str(e)))

            return {'FINISHED'}

        popup.show_message_box(message="Successfully built final resource: {}".format(res.name),
                               title='Success...',
                               icon='INFO')

        self.report({'INFO'}, "Successfully built final resource: {}".format(res.name))

        return {'FINISHED'}
示例#8
0
    def execute(self, context):
        res = worker.ImportWorker().get_resource_from_context()

        scene = bpy.data.scenes[0]
        render = scene.render

        if res.type == 'lighting':

            # Cycles render
            cycles = scene.cycles
            render.engine = 'CYCLES'
            cycles.device = 'GPU'

            # Sampling
            cycles.progressive = 'PATH'
            cycles.samples = 768
            cycles.preivew_samples = 768
            cycles.use_animated_seed = True
            cycles.sampling_pattern = 'CORRELATED_MUTI_JITTER'

            # Light Paths
            cycles.caustics_reflective = False
            cycles.caustics_refractive = False

            # Hair
            scene.cycles_curves.use_curves = True
            scene.cycles_curves.minimum_width = 1
            scene.cycles_curves.shape = 'RIBBONS'
            scene.cycles_curves.primitive = 'CURVE_SEGMENTS'
            scene.cycles_curves.subdivisions = 3

            # Film
            cycles.film_transparent = True

            # Performance
            render.tile_x = 8
            render.tile_y = 8
            cycles.tile_order = 'TOP_TO_BOTTOM'

            render.use_compositing = False

        elif res.type == 'compositing':
            # Cycles render # NOT really needed....
            cycles = scene.cycles
            render.engine = 'CYCLES'
            cycles.device = 'GPU'
            render.use_compositing = True

        else:
            # Workbench render
            render.engine = 'BLENDER_WORKBENCH'
            shading = bpy.data.scenes[0].display.shading
            shading.color_type = 'MATERIAL'
            shading.show_xray = False
            shading.show_shadows = False
            shading.show_cavity = True
            shading.show_object_outline = True
            shading.cavity_valley_factor = 1.7
            shading.cavity_ridge_factor = 0.4
            shading.show_specular_highlight = True
            render.use_compositing = False

        render.use_simplify = False  # Switch off simplify for full res when rendering
        render.use_sequencer = False

        self.report({'INFO'}, 'Render settings set for {} type: "{}"'.format(
            res.resource_type, res.type))

        return {'FINISHED'}
示例#9
0
 def poll(cls, context):
     res = worker.ImportWorker().get_resource_from_context()
     if res is not None and res.resource_type == 'narrative':
         return True
示例#10
0
 def poll(cls, context):
     res = worker.ImportWorker().get_resource_from_context()
     if res is not None and res.type == 'shader':
         return True
示例#11
0
 def poll(cls, context):
     if worker.ImportWorker().get_resource_from_context() is not None:
         return True
示例#12
0
    def poll(cls, context):

        res = worker.ImportWorker().get_resource_from_context()

        if res is not None and hasattr(res, 'type') and res.type == 'final':
            return True