def unregister(): clear() bpy.app.handlers.render_pre.remove(unsimplify_render_pre) bpy.app.handlers.render_post.remove(unsimplify_render_post) bpy.types.SCENE_PT_simplify.remove(unsimplify_ui) if utils.cycles_exists(): bpy.types.CyclesScene_PT_simplify.remove(unsimplify_ui)
def init(): scene = bpy.types.Scene scene.amaranth_debug_scene_list_missing_images = bpy.props.BoolProperty( default=False, name="List Missing Images", description="Display a list of all the missing images") scene.amaranth_lighterscorner_list_meshlights = bpy.props.BoolProperty( default=False, name="List Meshlights", description="Include light emitting meshes on the list") if utils.cycles_exists(): cycles_shader_node_types = ( ("BSDF_DIFFUSE", "Diffuse BSDF", "", 0), ("BSDF_GLOSSY", "Glossy BSDF", "", 1), ("BSDF_TRANSPARENT", "Transparent BSDF", "", 2), ("BSDF_REFRACTION", "Refraction BSDF", "", 3), ("BSDF_GLASS", "Glass BSDF", "", 4), ("BSDF_TRANSLUCENT", "Translucent BSDF", "", 5), ("BSDF_ANISOTROPIC", "Anisotropic BSDF", "", 6), ("BSDF_VELVET", "Velvet BSDF", "", 7), ("BSDF_TOON", "Toon BSDF", "", 8), ("SUBSURFACE_SCATTERING", "Subsurface Scattering", "", 9), ("EMISSION", "Emission", "", 10), ("BSDF_HAIR", "Hair BSDF", "", 11), ("BACKGROUND", "Background", "", 12), ("AMBIENT_OCCLUSION", "Ambient Occlusion", "", 13), ("HOLDOUT", "Holdout", "", 14), ("VOLUME_ABSORPTION", "Volume Absorption", "", 15), ("VOLUME_SCATTER", "Volume Scatter", "", 16), ) scene.amaranth_cycles_node_types = bpy.props.EnumProperty( items=cycles_shader_node_types, name="Shader")
def register(): init() bpy.app.handlers.render_pre.append(unsimplify_render_pre) bpy.app.handlers.render_post.append(unsimplify_render_post) bpy.types.SCENE_PT_simplify.append(unsimplify_ui) if utils.cycles_exists(): bpy.types.CyclesScene_PT_simplify.append(unsimplify_ui)
def unregister(): bpy.utils.unregister_class(AMTH_RENDER_OT_cycles_samples_percentage) bpy.utils.unregister_class(AMTH_RENDER_OT_cycles_samples_percentage_set) if utils.cycles_exists(): bpy.types.CYCLES_RENDER_PT_sampling.remove(render_cycles_scene_samples) clear()
def register(): init() bpy.utils.register_class(AMTH_RENDER_OT_cycles_samples_percentage) bpy.utils.register_class(AMTH_RENDER_OT_cycles_samples_percentage_set) if utils.cycles_exists(): if bpy.app.version >= (2, 79, 1): bpy.types.CYCLES_RENDER_PT_sampling.append(render_cycles_scene_samples) else: bpy.types.CyclesRender_PT_sampling.append(render_cycles_scene_samples)
def init(): scene = bpy.types.Scene if utils.cycles_exists(): scene.amaranth_cycles_list_sampling = bpy.props.BoolProperty( default=False, name="Samples Per:") bpy.types.CyclesRenderSettings.use_samples_final = bpy.props.BoolProperty( name="Use Final Render Samples", description="Use current shader samples as final render samples", default=False)
def unregister(): clear() bpy.app.handlers.render_pre.remove(unsimplify_render_pre) bpy.app.handlers.render_post.remove(unsimplify_render_post) bpy.types.SCENE_PT_simplify.remove(unsimplify_ui) if utils.cycles_exists(): if bpy.app.version >= (2, 79, 1): bpy.types.CYCLES_SCENE_PT_simplify.remove(unsimplify_ui) else: bpy.types.CyclesScene_PT_simplify.remove(unsimplify_ui)
def init(): scene = bpy.types.Scene if utils.cycles_exists(): scene.amaranth_cycles_list_sampling = bpy.props.BoolProperty( default=False, name="Samples Per:") # Note: add versioning code to address changes introduced in 2.79.1 from cycles import properties as _cycles_props _cycles_props.CyclesRenderSettings.use_samples_final = BoolProperty( name="Use Final Render Samples", description="Use current shader samples as final render samples", default=False, )
def init(): scene = bpy.types.Scene if utils.cycles_exists(): scene.amaranth_cycles_list_sampling = bpy.props.BoolProperty( default=False, name="Samples Per:") # Note: add versioning code to adress changes introduced in 2.79.1 if bpy.app.version >= (2, 79, 1): from cycles import properties as _cycles_props _cycles_props.CyclesRenderSettings.use_samples_final = BoolProperty( name="Use Final Render Samples", description="Use current shader samples as final render samples", default=False ) else: bpy.types.CyclesRenderSettings.use_samples_final = BoolProperty( name="Use Final Render Samples", description="Use current shader samples as final render samples", default=False )
def register(): init() bpy.utils.register_class(AMTH_RENDER_OT_cycles_samples_percentage) bpy.utils.register_class(AMTH_RENDER_OT_cycles_samples_percentage_set) if utils.cycles_exists(): bpy.types.CyclesRender_PT_sampling.append(render_cycles_scene_samples)
def draw(self, context): layout = self.layout scene = context.scene images = bpy.data.images images_missing = [] list_missing_images = scene.amaranth_debug_scene_list_missing_images materials = AMTH_SCENE_OT_cycles_shader_list_nodes.materials materials_count = len(AMTH_SCENE_OT_cycles_shader_list_nodes.materials) missing_material_slots_obs = AMTH_SCENE_OT_list_missing_material_slots.objects missing_material_slots_count = len( AMTH_SCENE_OT_list_missing_material_slots.objects) missing_material_slots_lib = AMTH_SCENE_OT_list_missing_material_slots.libraries engine = scene.render.engine # List Missing Images box = layout.box() row = box.row(align=True) split = row.split() col = split.column() if images: import os.path for im in images: if im.type not in ("UV_TEST", "RENDER_RESULT", "COMPOSITING"): if not os.path.exists( bpy.path.abspath(im.filepath, library=im.library)): images_missing.append([ "%s%s [%s]%s" % ("[L] " if im.library else "", im.name, im.users, " [F]" if im.use_fake_user else ""), im.filepath if im.filepath else "No Filepath", im.library.filepath if im.library else "" ]) if images_missing: row = col.row(align=True) row.alignment = "LEFT" row.prop(scene, "amaranth_debug_scene_list_missing_images", icon="%s" % "TRIA_DOWN" if list_missing_images else "TRIA_RIGHT", emboss=False) split = split.split() col = split.column() col.label(text="%s missing %s" % (str(len(images_missing)), 'image' if len(images_missing) == 1 else "images"), icon="ERROR") if list_missing_images: col = box.column(align=True) for mis in images_missing: col.label(text=mis[0], icon="IMAGE_DATA") col.label(text=mis[1], icon="LIBRARY_DATA_DIRECT") if mis[2]: row = col.row(align=True) row.alignment = "LEFT" row.operator( AMTH_SCENE_OT_blender_instance_open.bl_idname, text=mis[2], icon="LINK_BLEND", emboss=False).filepath = mis[2] col.separator() else: row = col.row(align=True) row.alignment = "LEFT" row.label(text="Great! No missing images", icon="RIGHTARROW_THIN") split = split.split() col = split.column() col.label(text="%s %s loading correctly" % (str( len(images)), "image" if len(images) == 1 else "images"), icon="IMAGE_DATA") else: row = col.row(align=True) row.alignment = "LEFT" row.label(text="No images loaded yet", icon="RIGHTARROW_THIN") # List Cycles Materials by Shader if utils.cycles_exists() and engine == "CYCLES": box = layout.box() split = box.split() col = split.column(align=True) col.prop(scene, "amaranth_cycles_node_types", icon="MATERIAL") row = split.row(align=True) row.operator(AMTH_SCENE_OT_cycles_shader_list_nodes.bl_idname, icon="SORTSIZE", text="List Materials Using Shader") if materials_count != 0: row.operator( AMTH_SCENE_OT_cycles_shader_list_nodes_clear.bl_idname, icon="X", text="") col.separator() try: materials except NameError: pass else: if materials_count != 0: col = box.column(align=True) count = 0 col.label( text="%s %s found" % (materials_count, "material" if materials_count == 1 else "materials"), icon="INFO") for mat in materials: count += 1 col.label(text="%s" % (materials[count - 1]), icon="MATERIAL") # List Missing Node Trees box = layout.box() row = box.row(align=True) split = row.split() col = split.column(align=True) split = col.split() split.label(text="Node Links") split.operator(AMTH_SCENE_OT_list_missing_node_links.bl_idname, icon="NODETREE") if AMTH_SCENE_OT_list_missing_node_links.count_groups != 0 or \ AMTH_SCENE_OT_list_missing_node_links.count_images != 0 or \ AMTH_SCENE_OT_list_missing_node_links.count_image_node_unlinked != 0: col.label(text="Warning! Check Console", icon="ERROR") if AMTH_SCENE_OT_list_missing_node_links.count_groups != 0: col.label( text="%s" % ("%s node %s missing link" % (str(AMTH_SCENE_OT_list_missing_node_links.count_groups), "group" if AMTH_SCENE_OT_list_missing_node_links.count_groups == 1 else "groups")), icon="NODETREE") if AMTH_SCENE_OT_list_missing_node_links.count_images != 0: col.label( text="%s" % ("%s image %s missing link" % (str(AMTH_SCENE_OT_list_missing_node_links.count_images), "node" if AMTH_SCENE_OT_list_missing_node_links.count_images == 1 else "nodes")), icon="IMAGE_DATA") if AMTH_SCENE_OT_list_missing_node_links.count_image_node_unlinked != 0: col.label(text="%s" % ("%s image %s with no output conected" % (str(AMTH_SCENE_OT_list_missing_node_links. count_image_node_unlinked), "node" if AMTH_SCENE_OT_list_missing_node_links. count_image_node_unlinked == 1 else "nodes")), icon="NODE") # List Empty Materials Slots box = layout.box() split = box.split() col = split.column(align=True) col.label(text="Material Slots") row = split.row(align=True) row.operator(AMTH_SCENE_OT_list_missing_material_slots.bl_idname, icon="MATERIAL", text="List Empty Materials Slots") if missing_material_slots_count != 0: row.operator( AMTH_SCENE_OT_list_missing_material_slots_clear.bl_idname, icon="X", text="") col.separator() try: missing_material_slots_obs except NameError: pass else: if missing_material_slots_count != 0: col = box.column(align=True) count = 0 count_lib = 0 col.label(text="%s %s with empty material slots found" % (missing_material_slots_count, "object" if missing_material_slots_count == 1 else "objects"), icon="INFO") for obs in missing_material_slots_obs: count += 1 row = col.row() row.alignment = "LEFT" row.label(text="%s" % missing_material_slots_obs[count - 1], icon="OBJECT_DATA") if missing_material_slots_lib: col.separator() col.label( "Check %s:" % ("this library" if len(missing_material_slots_lib) == 1 else "these libraries")) for libs in missing_material_slots_lib: count_lib += 1 row = col.row(align=True) row.alignment = "LEFT" row.operator( AMTH_SCENE_OT_blender_instance_open.bl_idname, text=missing_material_slots_lib[count_lib - 1], icon="LINK_BLEND", emboss=False ).filepath = missing_material_slots_lib[count_lib - 1]
def render_cycles_scene_samples(self, context): layout = self.layout scene = context.scene render = scene.render if utils.cycles_exists(): cscene = scene.cycles list_sampling = scene.amaranth_cycles_list_sampling # List Samples #if (len(scene.render.layers) > 1) or (len(bpy.data.scenes) > 1): if (len(scene.render.views) > 1) or (len(bpy.data.scenes) > 1): box = layout.box() row = box.row(align=True) col = row.column(align=True) row = col.row(align=True) row.alignment = "LEFT" row.prop(scene, "amaranth_cycles_list_sampling", icon="%s" % "TRIA_DOWN" if list_sampling else "TRIA_RIGHT", emboss=False) if list_sampling: #if len(scene.render.layers) == 1 and render.layers[0].samples == 0: if len(scene.render.views) == 1 and render.view_layers[0].samples == 0: pass else: col.separator() #col.label(text="RenderLayers:", icon="RENDERLAYERS") col.label(text="View Layers:", icon="RENDERLAYERS") #for rl in scene.render.layers: for rl in scene.view_layers: row = col.row(align=True) row.label(text=rl.name, icon="BLANK1") row.prop(rl, "samples", text="%s" % "Samples" if rl.samples > 0 else "Automatic (%s)" % cscene.samples) if (len(bpy.data.scenes) > 1): col.separator() col.label(text="Scenes:", icon="SCENE_DATA") if utils.cycles_exists(): for s in bpy.data.scenes: if s != scene: row = col.row(align=True) if s.render.engine == "CYCLES": cscene = s.cycles #row.label(s.name) row.label(text=s.name) row.prop(cscene, "samples", icon="BLANK1") else: row.label(text="Scene: '%s' is not using Cycles" % s.name) else: for s in bpy.data.scenes: if s != scene: row = col.row(align=True) if s.render.engine == "CYCLES": cscene = s.cycles row.label(text=s.name, icon="BLANK1") row.prop(cscene, "aa_samples", text="AA Samples") else: row.label(text="Scene: '%s' is not using Cycles" % s.name)
def unregister(): if utils.cycles_exists(): bpy.types.CYCLES_RENDER_PT_sampling.remove(render_cycles_scene_samples) clear()
def register(): init() if utils.cycles_exists(): bpy.types.CYCLES_RENDER_PT_sampling.append(render_cycles_scene_samples)
def draw(self, context): layout = self.layout scene = context.scene objects = bpy.data.objects ob_act = context.active_object lamps = bpy.data.lamps list_meshlights = scene.amaranth_lighterscorner_list_meshlights engine = scene.render.engine if utils.cycles_exists(): layout.prop(scene, "amaranth_lighterscorner_list_meshlights") box = layout.box() if lamps: if objects: row = box.row(align=True) split = row.split(percentage=0.45) col = split.column() col.label(text="Name") if engine in ["CYCLES", "BLENDER_RENDER"]: if engine == "BLENDER_RENDER": split = split.split(percentage=0.7) else: split = split.split(percentage=0.27) col = split.column() col.label(text="Samples") if utils.cycles_exists() and engine == "CYCLES": split = split.split(percentage=0.2) col = split.column() col.label(text="Size") split = split.split(percentage=1.0) col = split.column() col.label(text="%sRender Visibility" % "Rays /" if utils.cycles_exists() else "") for ob in objects: is_lamp = ob.type == "LAMP" is_emission = True if utils.cycles_is_emission( context, ob) and list_meshlights else False if ob and is_lamp or is_emission: lamp = ob.data if utils.cycles_exists(): clamp = ob.data.cycles visibility = ob.cycles_visibility row = box.row(align=True) split = row.split(percentage=1.0) col = split.column() row = col.row(align=True) col.active = ob == ob_act row.label(icon="%s" % ("LAMP_%s" % ob.data.type if is_lamp else "MESH_GRID")) split = row.split(percentage=.45) col = split.column() row = col.row(align=True) row.alignment = "LEFT" row.active = True row.operator( AMTH_SCENE_OT_amaranth_object_select.bl_idname, text="%s %s%s" % (" [L] " if ob.library else "", ob.name, "" if ob.name in context.scene.objects else " [Not in Scene]"), emboss=False).object = ob.name if ob.library: row = col.row(align=True) row.alignment = "LEFT" row.operator( AMTH_SCENE_OT_blender_instance_open.bl_idname, text=ob.library.filepath, icon="LINK_BLEND", emboss=False).filepath = ob.library.filepath if utils.cycles_exists() and engine == "CYCLES": split = split.split(percentage=0.25) col = split.column() if is_lamp: if scene.cycles.progressive == "BRANCHED_PATH": col.prop(clamp, "samples", text="") if scene.cycles.progressive == "PATH": col.label(text="N/A") else: col.label(text="N/A") if engine == "BLENDER_RENDER": split = split.split(percentage=0.7) col = split.column() if is_lamp: if lamp.type == "HEMI": col.label(text="Not Available") elif lamp.type == "AREA" and lamp.shadow_method == "RAY_SHADOW": row = col.row(align=True) row.prop(lamp, "shadow_ray_samples_x", text="X") if lamp.shape == "RECTANGLE": row.prop(lamp, "shadow_ray_samples_y", text="Y") elif lamp.shadow_method == "RAY_SHADOW": col.prop(lamp, "shadow_ray_samples", text="Ray Samples") elif lamp.shadow_method == "BUFFER_SHADOW": col.prop(lamp, "shadow_buffer_samples", text="Buffer Samples") else: col.label(text="No Shadow") else: col.label(text="N/A") if utils.cycles_exists() and engine == "CYCLES": split = split.split(percentage=0.2) col = split.column() if is_lamp: if lamp.type in ["POINT", "SUN", "SPOT"]: col.label(text="%.2f" % lamp.shadow_soft_size) elif lamp.type == "HEMI": col.label(text="N/A") elif lamp.type == "AREA" and lamp.shape == "RECTANGLE": col.label(text="%.2fx%.2f" % (lamp.size, lamp.size_y)) else: col.label(text="%.2f" % lamp.size) else: col.label(text="N/A") split = split.split(percentage=1.0) col = split.column() row = col.row(align=True) if utils.cycles_exists(): row.prop(visibility, "camera", text="") row.prop(visibility, "diffuse", text="") row.prop(visibility, "glossy", text="") row.prop(visibility, "shadow", text="") row.separator() row.prop(ob, "hide", text="", emboss=False) row.prop(ob, "hide_render", text="", emboss=False) else: box.label(text="No Lamps", icon="LAMP_DATA")
def button_select_meshlights(self, context): if utils.cycles_exists() and utils.cycles_active(context): self.layout.operator('object.select_meshlights', icon="LAMP_SUN")
def render_cycles_scene_samples(self, context): layout = self.layout scene = context.scene render = scene.render if utils.cycles_exists(): cscene = scene.cycles list_sampling = scene.amaranth_cycles_list_sampling # Set Render Samples if utils.cycles_exists() and cscene.progressive == "BRANCHED_PATH": layout.separator() split = layout.split() col = split.column() col.operator( AMTH_RENDER_OT_cycles_samples_percentage_set.bl_idname, text="%s" % "Set as Render Samples" if cscene.use_samples_final else "Set New Render Samples", icon="%s" % "PINNED" if cscene.use_samples_final else "UNPINNED") col = split.column() row = col.row(align=True) row.enabled = True if scene.get("amth_cycles_samples_final") else False row.operator( AMTH_RENDER_OT_cycles_samples_percentage.bl_idname, text="100%").percent = 100 row.operator( AMTH_RENDER_OT_cycles_samples_percentage.bl_idname, text="75%").percent = 75 row.operator( AMTH_RENDER_OT_cycles_samples_percentage.bl_idname, text="50%").percent = 50 row.operator( AMTH_RENDER_OT_cycles_samples_percentage.bl_idname, text="25%").percent = 25 # List Samples if (len(scene.render.layers) > 1) or (len(bpy.data.scenes) > 1): box = layout.box() row = box.row(align=True) col = row.column(align=True) row = col.row(align=True) row.alignment = "LEFT" row.prop(scene, "amaranth_cycles_list_sampling", icon="%s" % "TRIA_DOWN" if list_sampling else "TRIA_RIGHT", emboss=False) if list_sampling: if len(scene.render.layers) == 1 and render.layers[0].samples == 0: pass else: col.separator() col.label(text="RenderLayers:", icon="RENDERLAYERS") for rl in scene.render.layers: row = col.row(align=True) row.label(rl.name, icon="BLANK1") row.prop( rl, "samples", text="%s" % "Samples" if rl.samples > 0 else "Automatic (%s)" % (cscene.aa_samples if cscene.progressive == "BRANCHED_PATH" else cscene.samples)) if (len(bpy.data.scenes) > 1): col.separator() col.label(text="Scenes:", icon="SCENE_DATA") if utils.cycles_exists() and cscene.progressive == "PATH": for s in bpy.data.scenes: if s != scene: row = col.row(align=True) if s.render.engine == "CYCLES": cscene = s.cycles row.label(s.name) row.prop(cscene, "samples", icon="BLANK1") else: row.label( text="Scene: '%s' is not using Cycles" % s.name) else: for s in bpy.data.scenes: if s != scene: row = col.row(align=True) if s.render.engine == "CYCLES": cscene = s.cycles row.label(s.name, icon="BLANK1") row.prop(cscene, "aa_samples", text="AA Samples") else: row.label( text="Scene: '%s' is not using Cycles" % s.name)
def poll(cls, context): return utils.cycles_exists()
def render_cycles_scene_samples(self, context): layout = self.layout scene = context.scene render = scene.render if utils.cycles_exists(): cscene = scene.cycles list_sampling = scene.amaranth_cycles_list_sampling # Set Render Samples if utils.cycles_exists() and cscene.progressive == "BRANCHED_PATH": layout.separator() split = layout.split() col = split.column() col.operator(AMTH_RENDER_OT_cycles_samples_percentage_set.bl_idname, text="%s" % "Set as Render Samples" if cscene.use_samples_final else "Set New Render Samples", icon="%s" % "PINNED" if cscene.use_samples_final else "UNPINNED") col = split.column() row = col.row(align=True) row.enabled = True if scene.get("amth_cycles_samples_final") else False row.operator(AMTH_RENDER_OT_cycles_samples_percentage.bl_idname, text="100%").percent = 100 row.operator(AMTH_RENDER_OT_cycles_samples_percentage.bl_idname, text="75%").percent = 75 row.operator(AMTH_RENDER_OT_cycles_samples_percentage.bl_idname, text="50%").percent = 50 row.operator(AMTH_RENDER_OT_cycles_samples_percentage.bl_idname, text="25%").percent = 25 # List Samples if (len(scene.render.layers) > 1) or (len(bpy.data.scenes) > 1): box = layout.box() row = box.row(align=True) col = row.column(align=True) row = col.row(align=True) row.alignment = "LEFT" row.prop(scene, "amaranth_cycles_list_sampling", icon="%s" % "TRIA_DOWN" if list_sampling else "TRIA_RIGHT", emboss=False) if list_sampling: if len(scene.render.layers) == 1 and render.layers[0].samples == 0: pass else: col.separator() col.label(text="RenderLayers:", icon="RENDERLAYERS") for rl in scene.render.layers: row = col.row(align=True) row.label(rl.name, icon="BLANK1") row.prop(rl, "samples", text="%s" % "Samples" if rl.samples > 0 else "Automatic (%s)" % (cscene.aa_samples if cscene.progressive == "BRANCHED_PATH" else cscene.samples)) if (len(bpy.data.scenes) > 1): col.separator() col.label(text="Scenes:", icon="SCENE_DATA") if utils.cycles_exists() and cscene.progressive == "PATH": for s in bpy.data.scenes: if s != scene: row = col.row(align=True) if s.render.engine == "CYCLES": cscene = s.cycles row.label(s.name) row.prop(cscene, "samples", icon="BLANK1") else: row.label(text="Scene: '%s' is not using Cycles" % s.name) else: for s in bpy.data.scenes: if s != scene: row = col.row(align=True) if s.render.engine == "CYCLES": cscene = s.cycles row.label(s.name, icon="BLANK1") row.prop(cscene, "aa_samples", text="AA Samples") else: row.label(text="Scene: '%s' is not using Cycles" % s.name)
def ui_menu_lamps_add(self, context): if cycles_exists() and context.scene.render.engine == 'CYCLES': self.layout.separator() self.layout.operator( AMTH_OBJECT_OT_meshlight_add.bl_idname, icon="LAMP_AREA", text="Meshlight")
def unregister(): bpy.utils.unregister_class(AMTH_RENDER_OT_cycles_samples_percentage) bpy.utils.unregister_class(AMTH_RENDER_OT_cycles_samples_percentage_set) if utils.cycles_exists(): bpy.types.CyclesRender_PT_sampling.remove(render_cycles_scene_samples) clear()
def ui_menu_lamps_add(self, context): if cycles_exists() and context.scene.render.engine == 'CYCLES': self.layout.separator() self.layout.operator(AMTH_OBJECT_OT_meshlight_add.bl_idname, icon="LAMP_AREA", text="Meshlight")
def poll(cls, context): return utils.cycles_exists() and utils.cycles_active(context)