예제 #1
0
def update_diffuse_texture(self, context: bpy.types.Context) -> None:
    if not context.active_object:
        return

    material = context.active_object.active_material

    if material:
        props = material.ls3d_props

        ntree = material.node_tree

        if NODE_SHADER in ntree.nodes:
            shader_node = ntree.nodes[NODE_SHADER]

            if not props.diffuse_texture:

                input = find_node_input(shader_node, "Base Color")

                if input:
                    for link in input.links:
                        node = link.from_node

                        if node:
                            ntree.links.remove(link)
            else:
                if NODE_DIFFUSE in ntree.nodes:
                    diffuse_node = ntree.nodes[NODE_DIFFUSE]

                    ntree.links.new(shader_node.inputs["Base Color"],
                                    diffuse_node.outputs["Color"])
예제 #2
0
def panel_node_draw(layout, ntree, output_type):
    node = find_output_node(ntree, output_type)

    if node:
        input = find_node_input(node, 'Surface')
        layout.template_node_view(ntree, node, input)
        return True

    return False
예제 #3
0
def get_image_from_node(node: bpy.types.Node,
                        input_name: str) -> Optional[bpy.types.Image]:
    input = find_node_input(node, input_name)
    if input:
        for link in input.links:
            node = link.from_node
            if node:
                if isinstance(node, bpy.types.ShaderNodeTexImage):
                    return node.image
    return None
예제 #4
0
def panel_node_draw(layout, ntree, _output_type, input_name):
    node = ntree.get_output_node('EEVEE')

    if node:
        input = find_node_input(node, input_name)
        if input:
            layout.template_node_view(ntree, node, input)
        else:
            layout.label(text="Incompatible output node")
    else:
        layout.label(text="No output node")
예제 #5
0
파일: Unifier.py 프로젝트: TriVoxel/Unifier
def panel_node_draw(layout, ntree, output_type):
    node = find_output_node(ntree, output_type)

    if node:
        input = find_node_input(node, 'Surface')
        if input:
            layout.template_node_view(ntree, node, input)
        else:
            layout.label(text="Incompatible output node")
    else:
        layout.label(text="No output node")
예제 #6
0
def panel_node_draw(layout, ntree, _output_type, input_name):
    node = ntree.get_output_node('EEVEE')

    if node:
        input = find_node_input(node, input_name)
        if input:
            layout.template_node_view(ntree, node, input)
        else:
            layout.label(text="Incompatible output node")
    else:
        layout.label(text="No output node")
예제 #7
0
    def draw(self, context):
        layout = self.layout

        world = context.world
        ntree = world.node_tree
        node = ntree.get_output_node('EEVEE')

        if node:
            input = find_node_input(node, 'Volume')
            if input:
                layout.template_node_view(ntree, node, input)
            else:
                layout.label(text="Incompatible output node")
        else:
            layout.label(text="No output node")
    def draw(self, context):
        layout = self.layout

        world = context.world

        layout.prop(world, "use_nodes", icon='NODETREE')
        layout.separator()

        if world.use_nodes:
            ntree = world.node_tree
            node = find_output_node(ntree, 'OUTPUT_WORLD')

            if not node:
                layout.label(text="No output node")
            else:
                input = find_node_input(node, 'Surface')
                layout.template_node_view(ntree, node, input)
        else:
            layout.prop(world, "horizon_color", text="Color")
예제 #9
0
def panel_ui_node_view(context, layout, id_data, output_type, input_name):
    from ..nodes import base_socket
    if not id_data.use_nodes:
        layout.operator("octane.use_shading_nodes", icon='NODETREE')
        return False
    node_tree = id_data.node_tree
    base_socket.OCTANE_OT_base_node_link_menu.draw_node_link_menu(context, layout, node_tree, output_type, input_name)
    output_node = node_tree.get_output_node('octane')
    if output_node and output_node.type == output_type:
        _input = find_node_input(output_node, input_name)
        target_node = _input.links[0].from_node if (_input and len(_input.links)) else None
        if target_node and _input:
            if hasattr(target_node, "octane_node_type"):
                _panel_ui_node_view(context, layout, node_tree, target_node)
            else:
                layout.template_node_view(node_tree, output_node, _input)
        else:
            layout.label(text="Incompatible or invalid output node")
    else:
        layout.label(text="Incompatible or invalid output node")
    return True
예제 #10
0
파일: utils.py 프로젝트: lunadigital/btoa
def panel_node_draw(layout, id_data, output_type, input_name):
    #if not id_data.use_nodes:
    #    layout.operator("cycles.use_shading_nodes", icon='NODETREE')
    #    return False

    ntree = id_data.node_tree

    if ntree is not None:
        node = ntree.get_output_node()
        if node:
            input = find_node_input(node, input_name)
            if input:
                layout.template_node_view(ntree, node, input)
            else:
                layout.label(text="Incompatible output node")
        else:
            layout.label(text="No output node")

        return True

    return False
예제 #11
0
def update_alpha_texture(self, context: bpy.types.Context) -> None:
    if not context.active_object:
        return

    material = context.active_object.active_material

    if material:
        props = material.ls3d_props

        ntree = material.node_tree

        if NODE_SHADER in ntree.nodes:
            shader_node = ntree.nodes[NODE_SHADER]

            if not props.alpha_texture and not props.diffuse_alpha:
                material.blend_method = 'OPAQUE'

                input = find_node_input(shader_node, "Alpha")

                if input:
                    for link in input.links:
                        node = link.from_node

                        if node:
                            ntree.links.remove(link)
            else:
                material.blend_method = 'BLEND'

                if props.alpha_texture and not props.diffuse_alpha:
                    if NODE_ALPHA in ntree.nodes:
                        alpha_node = ntree.nodes[NODE_ALPHA]

                        ntree.links.new(shader_node.inputs["Alpha"],
                                        alpha_node.outputs["Color"])
                else:
                    if NODE_DIFFUSE in ntree.nodes:
                        diffuse_node = ntree.nodes[NODE_DIFFUSE]

                        ntree.links.new(shader_node.inputs["Alpha"],
                                        diffuse_node.outputs["Alpha"])
예제 #12
0
    def draw(self, context):
        layout = self.layout

        world = context.world

        layout.prop(world, "use_nodes", icon='NODETREE')
        layout.separator()

        if world.use_nodes:
            ntree = world.node_tree
            node = ntree.get_output_node('EEVEE')

            if node:
                input = find_node_input(node, 'Surface')
                if input:
                    layout.template_node_view(ntree, node, input)
                else:
                    layout.label(text="Incompatible output node")
            else:
                layout.label(text="No output node")
        else:
            layout.prop(world, "color")
예제 #13
0
    def draw(self, context):
        layout = self.layout
        ob = bpy.context.object

        row = layout.row()
        col = row.column(align=True)
        col2 = row.column()
        try:
            actdat = bpy.context.active_object.data
        except:
            pass

        def cam_props(cam):
            camdat = cam.data
            scene = bpy.context.scene
            rd = scene.render
            col.separator()
            col.prop(scene, "camera", text='')
            col.separator()
            col.prop(camdat, "type", text='', expand=False)
            if camdat.type == 'PERSP':
                col.prop(camdat, "lens")
            elif camdat.type == 'ORTHO':
                col.prop(camdat, "ortho_scale")
            elif camdat.type == 'PANO':
                engine = context.engine
                if engine == 'CYCLES':
                    ccam = camdat.cycles
                    col.prop(ccam, "panorama_type")
                    if ccam.panorama_type == 'FISHEYE_EQUIDISTANT':
                        col.prop(ccam, "fisheye_fov")
                    elif ccam.panorama_type == 'FISHEYE_EQUISOLID':
                        col.prop(ccam, "fisheye_lens", text="Lens")
                        col.prop(ccam, "fisheye_fov")
                    elif ccam.panorama_type == 'EQUIRECTANGULAR':
                        sub = col.column(align=True)
                        sub.prop(ccam, "latitude_min", text="Latitute Min")
                        sub.prop(ccam, "latitude_max", text="Max")
                        sub = col.column(align=True)
                        sub.prop(ccam, "longitude_min", text="Longiture Min")
                        sub.prop(ccam, "longitude_max", text="Max")
                elif engine in {
                        'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_OPENGL'
                }:
                    col.prop(camdat, "lens")
            row = col.row()

            dof_options = camdat.dof
            if context.engine == 'BLENDER_EEVEE':
                row = col.row(align=True)
                row.prop(dof_options, "aperture_fstop")
                row.prop(dof_options, "aperture_blades")
                row = col.row(align=True)
                row.prop(dof_options, "focus_distance")
                row.prop(dof_options, "focus_object", text="")

            else:
                col.label(text="Viewport")
                col.prop(dof_options, "aperture_fstop")
                col.prop(dof_options, "aperture_blades")
            #SECOND COLUMN##############################################################

            col2.prop(rd, "resolution_x", text="Res X")
            col2.prop(rd, "resolution_y", text="Res Y")
            col2.prop(rd, "resolution_percentage", text="Res %")
            #col2.prop(scene, "frame_current", text="Current Frame")
            row = col2.row(align=True)
            row.prop(scene, "frame_start", text="F Start")
            row.prop(scene, "frame_end", text="F End")
            row = col2.row(align=True)
            row.prop(scene, "frame_step", text="Step")
            row.prop(rd, "fps", text='FPS')

            #row = col2.row(align = True)
            #row.prop(actdat, "clip_start", text="Clip Start")
            #row.prop(actdat, "clip_end", text="Clip End")

        # if bpy.context.space_data.region_3d.view_perspective == 'CAMERA':
        # cam_props(bpy.context.scene.camera)

        if ob.type == 'CAMERA':
            cam_props(ob)
        elif ob.type == 'EMPTY':
            col.prop(ob, "empty_display_size", text='Display Size')
            col.prop(ob, "empty_display_type", text='')

        elif ob.type == 'LIGHT':
            col.label(text='Light Type')
            col.prop(actdat, "type", text='', expand=False)
            if actdat.type in {'POINT', 'SPOT', 'SUN'}:
                col.prop(actdat, "shadow_soft_size", text="Radius")
            if actdat.type == 'AREA':
                col.prop(actdat, "shape", text='')
                if actdat.shape in {'SQUARE', 'DISK'}:
                    col.prop(actdat, "size")
                if actdat.shape in {'RECTANGLE', 'ELLIPSE'}:
                    col.prop(actdat, "size", text="Size X")
                    col.prop(actdat, "size_y", text="Size Y")
            if actdat.type == 'SUN':
                col.prop(actdat, "shadow_cascade_count", text="Count")
                col.prop(actdat, "shadow_cascade_fade", text="Fade")
                col.prop(actdat,
                         "shadow_cascade_max_distance",
                         text="Max Distance")
                col.prop(actdat,
                         "shadow_cascade_exponent",
                         text="Distribution")
            if actdat.type == 'SPOT':
                col.prop(actdat, "spot_size", text="Size")
                col.prop(actdat, "spot_blend", text="Blend", slider=True)
                col.prop(actdat, "show_cone")
            col.prop(actdat, "color")
            col.prop(actdat, "energy")
            col2.label(text='Shadows')
            col2.prop(actdat, "shadow_buffer_clip_start", text="Clip Start")
            # col2.prop(actdat, "shadow_buffer_clip_end", text="End")
            # col2.prop(actdat, "shadow_buffer_soft", text="Fake Softness")
            col2.prop(actdat, "shadow_buffer_bias", text="Contact Clip")
            # col2.prop(actdat, "shadow_buffer_exp", text="Darkness")
            # col2.prop(actdat, "shadow_buffer_bleed_bias", text="Bleed Bias")
            col2.prop(actdat, "cutoff_distance", text="Distance")
            scene = context.scene
            props = scene.eevee

            col.label(text='GLOBAL LIGHT PROPERTIES')
            row = col2.row()
            row.scale_x = .2
            #row.prop(props, "shadow_method", text='')
            row.prop(props, "shadow_cube_size", text="")
            row.prop(props, "shadow_cascade_size", text="")
            col.prop(props, "use_shadow_high_bitdepth")
            col.prop(props, "use_soft_shadows")
            col.prop(props, "taa_samples")
            col.prop(props, "taa_render_samples")

        elif ob.type == 'LIGHT_PROBE':
            col.label(text='LIGHT PROBE PROPERTIES')
            col.prop(bpy.context.active_object, 'name', text='')
            probe = actdat
            if probe.type == 'GRID':
                col.prop(probe, "influence_distance", text="Distance")
                col.prop(probe, "falloff")
                col.prop(probe, "intensity")
                col.separator()
                col.prop(probe, "grid_resolution_x", text="Grid X")
                col.prop(probe, "grid_resolution_y", text="Grid Y")
                col.prop(probe, "grid_resolution_z", text="Grid Z")
            elif probe.type == 'PLANAR':
                col.prop(probe, "influence_distance", text="Distance")
            else:
                col.prop(probe, "influence_type")
                if probe.influence_type == 'ELIPSOID':
                    col.prop(probe, "influence_distance", text="Radius")
                else:
                    col.prop(probe, "influence_distance", text="Size")
                col.prop(probe, "falloff")
                col.prop(probe, "intensity")
            col2.operator('scene.light_cache_bake')
            col2.operator('scene.light_cache_free')

        elif ob.type == 'MESH':
            if bpy.context.object.mode == 'SCULPT':
                toolsettings = bpy.context.tool_settings
                sculpt = toolsettings.sculpt

                brush = toolsettings.unified_paint_settings
                col.label(text='SCULPT PROPERTIES')
                col.prop(bpy.context.active_object, 'name', text='')
                col.separator()
                col.prop(brush, "size")

                row = col.row()
                sub = row.column()
                sub.scale_x = .1

                sub.operator('paint.brush_select',
                             text='Snake Hook').sculpt_tool = 'SNAKE_HOOK'
                sub.operator('paint.brush_select',
                             text='Inflate').sculpt_tool = 'INFLATE'
                sub.operator('paint.brush_select',
                             text='Crease').sculpt_tool = 'CREASE'
                sub.operator('paint.brush_select',
                             text='Clay').sculpt_tool = 'CLAY'
                sub = row.column()
                sub.scale_x = .1
                sub.operator('paint.brush_select',
                             text='Draw').sculpt_tool = 'DRAW'
                sub.operator('paint.brush_select',
                             text='Grab').sculpt_tool = 'GRAB'
                sub.operator('paint.brush_select',
                             text='Flatten').sculpt_tool = 'FLATTEN'
                sub.operator('paint.brush_select',
                             text='Fill').sculpt_tool = 'FILL'
                #               col.operator('sculpt.dynamic_topology_toggle', text = 'Dynotopo')
                row = col.row()
                row.prop(sculpt.brush, "use_frontface")
                row.prop(sculpt, "use_symmetry_x")
                row.prop(sculpt, "use_smooth_shading")
                row = col.row()
                if sculpt.detail_type_method in {'CONSTANT', 'MANUAL'}:
                    row.prop(sculpt, "constant_detail_resolution")
                if sculpt.detail_type_method == 'BRUSH':
                    row.prop(sculpt, "detail_percent")
                if sculpt.detail_type_method == 'RELATIVE':
                    row.prop(sculpt, "detail_size")
                #col.prop(sculpt, "detail_refine_method",text='')
                row.prop(sculpt, "detail_type_method", text='')
                row = col.row()
                row.operator("sculpt.detail_flood_fill",
                             text='Detail Flood Fill')
                row.operator(
                    "sculpt.dynamic_topology_toggle",
                    icon='CHECKBOX_HLT'
                    if bpy.context.sculpt_object.use_dynamic_topology_sculpting
                    else 'CHECKBOX_DEHLT',
                    text="Dynotopo",
                )

                #bpy.ops.wm.tool_set_by_id(name="Draw", space_type = 'VIEW_3D')


#            else:
#                col.operator_menu_enum("object.modifier_add", "type")
#                for md in ob.modifiers:
#                    box = col.template_modifier(md)
#                    if box:
#                        getattr(self, md.type)(box, ob, md)

##SECOND COLUMN##############################################################

        elif ob.type == 'GPENCIL':
            toolsettings = bpy.context.tool_settings
            sculpt = toolsettings.sculpt

            brush = toolsettings.unified_paint_settings
            col.separator()
            col.prop(toolsettings.gpencil_paint.brush, "size")

            row = col.row()
            sub = row.column()
            sub.scale_x = .1
            sub2 = row.column()
            sub2.scale_x = .1
            sub.operator('wm.tool_set_by_id',
                         text='Draw').name = 'builtin_brush.Draw'
            sub.operator('wm.tool_set_by_id',
                         text='Erase').name = 'builtin_brush.Erase'
            sub.operator('wm.tool_set_by_id',
                         text='Fill').name = 'builtin_brush.Fill'
            sub2.operator('wm.tool_set_by_id', text='Box').name = 'builtin.box'
            sub2.operator('wm.tool_set_by_id',
                          text='Circle').name = 'builtin.circle'
            sub2.operator('wm.tool_set_by_id',
                          text='Line').name = 'builtin.line'
            col.prop(bpy.context.tool_settings.gpencil_sculpt,
                     "lock_axis",
                     text='')
            col.prop(bpy.context.tool_settings,
                     "gpencil_stroke_placement_view3d",
                     text='')

            col2.operator_menu_enum("object.gpencil_modifier_add", "type")
            for md in ob.grease_pencil_modifiers:
                box = col2.template_greasepencil_modifier(md)
                if box:
                    getattr(self, md.type)(box, ob, md)

        elif ob.type == 'META':
            col2.label(text='META PROPERTIES')
            col.prop(bpy.context.active_object, 'name', text='')
            try:
                col.prop(actdat.elements.active, "type", text='')
                col.prop(actdat.elements.active, "radius", text='Size')
                if actdat.elements.active.type == 'CAPSULE':
                    col.prop(actdat.elements.active, "size_x", text='X')
                if actdat.elements.active.type == 'PLANE':
                    col.prop(actdat.elements.active, "size_x", text='X')
                    col.prop(actdat.elements.active, "size_y", text='Y')
                if actdat.elements.active.type in {'CUBE', 'ELLIPSOID'}:
                    col.prop(actdat.elements.active, "size_x", text='X')
                    col.prop(actdat.elements.active, "size_y", text='Y')
                    col.prop(actdat.elements.active, "size_z", text='Z')
                col.prop(actdat.elements.active, "stiffness", text='Stiffness')
                col.prop(actdat.elements.active,
                         "use_negative",
                         text='Subtract')
                col.prop(actdat.elements.active, "hide", text='Hide')

            except:
                pass
            col2.prop(actdat, "resolution", text='Resolution')
            col2.prop(actdat, "render_resolution", text='Render Resolution')
            col2.prop(actdat, "threshold")
            col2.label(text='Update Method')
            col2.prop(actdat, "update_method", text='')
            col2.operator('object.convert',
                          text='Convert To Mesh').target = 'MESH'

        elif ob.type == 'LATTICE':
            col.label(text='LATTICE PROPERTIES')
            col.prop(bpy.context.active_object, 'name', text='')
            col.separator()
            lat = actdat
            col = col.column(align=True)
            col.prop(lat, "points_u", text="U")
            col.prop(lat, "points_v", text="V")
            col.prop(lat, "points_w", text="W")
            col.separator()
            col.prop(lat, "interpolation_type_u", text="U")
            col.prop(lat, "interpolation_type_v", text="V")
            col.prop(lat, "interpolation_type_w", text="W")
            col.prop(lat, "use_outside")
            col.prop_search(lat, "vertex_group", context.object,
                            "vertex_groups")

        elif ob.type == 'FONT':
            text = actdat
            col.label(text='TEXT PROPERTIES')
            col.prop(bpy.context.active_object, 'name', text='')
            char = text.edit_format
            #           row = layout.split(factor=0.25)
            #           row.label(text="Regular")
            col.template_ID(text,
                            "font",
                            open="font.open",
                            unlink="font.unlink")
            # row = layout.split(factor=0.25)
            # row.label(text="Bold")
            # row.template_ID(text, "font_bold", open="font.open", unlink="font.unlink")
            # row = layout.split(factor=0.25)
            # row.label(text="Italic")
            # row.template_ID(text, "font_italic", open="font.open", unlink="font.unlink")
            # row = layout.split(factor=0.25)
            # row.label(text="Bold & Italic")
            # row.template_ID(text, "font_bold_italic", open="font.open", unlink="font.unlink")
            # row = layout.row(align=True)
            # row.prop(char, "use_bold", toggle=True)
            # row.prop(char, "use_italic", toggle=True)
            # row.prop(char, "use_underline", toggle=True)
            # row.prop(char, "use_small_caps", toggle=True)

            col.prop(text, "size", text="Size")
            col.prop(text, "shear")
            col.prop(text, "space_character", text="Character Spacing")
            col.prop(text, "space_word", text="Word Spacing")
            col.prop(text, "space_line", text="Line Spacing")

            #           col.prop(text, "family")

            # sub = col.column(align=True)
            # sub.prop(text, "underline_position", text="Underline Position")
            # sub.prop(text, "underline_height", text="Underline Thickness")
            # col.prop(text, "small_caps_scale", text="Small Caps Scale")
            col.prop(text, "align_x", text="")
            col.prop(text, "align_y", text="")
            col.prop(text, "offset_x", text="Offset X")
            col.prop(text, "offset_y", text="Offset Y")
            col.prop(text, "follow_curve")

            col2.label(text='3D TEXT PROPERTIES')
            col2.prop(text, "offset")
            col2.prop(text, "extrude")
            col2.prop(text, "taper_object")
            col2.prop(text, "use_map_taper")
            col2.operator('object.convert',
                          text='Convert to Curves').target = 'CURVE'
            col2.operator('object.convert',
                          text='Convert to Mesh').target = 'MESH'

        elif ob.type == 'CURVE':
            col.label(text='CURVE PROPERTIES')
            col.prop(bpy.context.active_object, 'name', text='')

            curve = actdat
            col.label(text='Extrusion Shape')
            col.prop(curve, "fill_mode", text='')
            col.prop(curve, "bevel_object", text="")
            col.prop(curve, "bevel_depth", text="Thickness")
            col.prop(curve, "bevel_resolution", text="Smoothness")
            col.prop(curve, "offset")
            col.prop(curve, "extrude")
            col.prop(curve, "use_map_taper")
            col.prop(curve, "use_fill_caps")
            col.prop(curve, "taper_object", text='')
            row = col.row(align=True)
            row.scale_x = .1
            row.prop(curve, "dimensions", expand=True)
            col2.prop(curve, "resolution_u", text="Resolution U")
            col2.prop(curve, "resolution_v", text="Resolution V")
            col2.prop(curve, "render_resolution_u", text="Render U")
            col2.prop(curve, "render_resolution_v", text="Render V")
            col2.prop(curve, "twist_mode")
            col2.prop(curve, "twist_smooth", text="Smooth")

            col2.prop(curve, "use_fill_deform")
            col2.prop(curve, "use_radius")
            col2.prop(curve, "use_stretch")
            col2.prop(curve, "use_deform_bounds")
            col2.prop(curve, "bevel_factor_start", text="Bevel Start")
            col2.prop(curve, "bevel_factor_end", text="End")
            col2.prop(curve,
                      "bevel_factor_mapping_start",
                      text="Bevel Mapping Start")
            col2.prop(curve, "bevel_factor_mapping_end", text="End")

        elif len(bpy.context.selected_objects) == 0 or self.type == 'WORLD':
            col.label(text='WORLD PROPERTIES')
            if bpy.context.scene.camera:
                cam_props(bpy.context.scene.camera)

            world = bpy.context.scene.world
            if world.use_nodes:
                ntree = world.node_tree
                node = ntree.get_output_node('EEVEE')

                if node:
                    input = find_node_input(node, 'Surface')
                    inputvol = find_node_input(node, 'Volume')
                    if input:
                        col.template_node_view(ntree, node, input)
                    if input:
                        col.separator()
                        col.separator()
                        col.template_node_view(ntree, node, inputvol)
                    else:
                        col.label(text="Incompatible output node")
                else:
                    col.label(text="No output node")
            else:
                col.prop(world, "color")
            scene = bpy.context.scene
            props = scene.eevee
            box = col.box().column()

            box.active = props.use_bloom
            box.label(text='Bloom')
            box.prop(props, "bloom_threshold")
            box.prop(props, "bloom_knee")
            box.prop(props, "bloom_radius")
            box.prop(props, "bloom_color")
            box.prop(props, "bloom_intensity")
            box.prop(props, "bloom_clamp")
            scene = context.scene
            rd = scene.render
            row = col2.row(align=True)
            row.prop(actdat, "clip_start", text="Clip Start")
            row.prop(actdat, "clip_end", text="Clip End")

            col2.prop(bpy.context.scene.render, "engine", text='')
            col2.prop(bpy.context.scene.view_settings,
                      'view_transform',
                      text='')
            col2.prop(bpy.context.scene.view_settings, 'look', text='')

            col2.template_curve_mapping(bpy.context.scene.view_settings,
                                        "curve_mapping",
                                        type='COLOR',
                                        levels=True)
    def draw(self, context):
        layout = self.layout
        row = layout.row()
        col = row.column(align=True)
        col2 = row.column(align=True)
        #Vertex Color
        ob = context.object
        ts = context.tool_settings
        ups = ts.unified_paint_settings
        ptr = ups if ups.use_unified_color else ts.vertex_paint.brush
        col.template_color_picker(ptr, 'color', value_slider=True)

        col.prop(ptr, 'color', text='')

        if bpy.context.object.type == 'MESH':
            col.operator("mesh.material_apply",
                         text='Apply Material and Vertex Color')
            me = bpy.context.active_object.data
            col.template_list("MESH_UL_vcols",
                              "vcols",
                              me,
                              "vertex_colors",
                              me.vertex_colors,
                              "active_index",
                              rows=1)
        col.separator()
        col.template_ID(ob, "active_material")
        col.separator()
        #		col.template_list("", "vcols", me, "vertex_colors", me.vertex_colors, "active_index", rows=1)
        #		 col.operator("mesh.vertex_color_add", icon='ZOOMIN', text="")
        #		 col.operator("mesh.vertex_color_remove", icon='ZOOMOUT', text="")

        #Material Slots
        rows = 6

        actob = context.active_object

        row = col.row()

        sub = row.column()
        sub.template_list("MATERIAL_UL_matslots",
                          "",
                          ob,
                          "material_slots",
                          ob,
                          "active_material_index",
                          rows=rows)
        sub = row.column()

        sub.operator("object.material_slot_move", icon='TRIA_UP',
                     text="").direction = 'UP'
        sub.operator("object.material_slot_move", icon='TRIA_DOWN',
                     text="").direction = 'DOWN'
        col.separator()
        col.operator("object.material_slot_assign", text="Assign")
        col.operator("3dview.material_slot_add", icon='ADD', text="Add Slot")
        col.operator("3dview.material_slot_remove",
                     icon='REMOVE',
                     text="Remove Slot")
        if actob.type == 'GPENCIL':
            col.operator('gpencil.stroke_change_color',
                         icon='NONE',
                         text='Apply')
        else:
            col.operator('3dview.material_new', icon='NONE', text='New')
        col.operator('3dview.material_copy', icon='NONE', text='Copy')
        col.operator('3dview.material_delete', icon='NONE', text='Delete')

        if tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (False,
                                                                       False,
                                                                       True):
            col.operator("mesh.select_similar",
                         text='Select By Material').type = 'MATERIAL'
        mat = bpy.context.object.active_material
        col.separator()
        col.prop(mat, "blend_method", text='')
        col.separator()
        col.prop(mat, "refraction_depth", text='')
        col.row().prop(mat, "use_screen_refraction")
        col.row().prop(mat, "use_sss_translucency")

        col.separator()
        col.operator('popup.hp_render', icon='NONE', text='Render Settings')
        #Nodes

        if bpy.context.object.type == 'MESH':
            box = col2.box()
            sub = box.column(align=True)
            ntree = bpy.context.object.active_material.node_tree
            node = ntree.get_output_node('EEVEE')
            if node:
                input = find_node_input(node, 'Surface')
                inputvolume = find_node_input(node, 'Volume')
                inputdisplacement = find_node_input(node, 'Displacement')
                if input:
                    sub.template_node_view(ntree, node, input)
                if inputvolume:
                    sub.template_node_view(ntree, node, inputvolume)
                if inputdisplacement:
                    sub.template_node_view(ntree, node, inputdisplacement)

                else:
                    sub.label(text="Incompatible output node")
            else:
                sub.label(text="No output node")

            # actnode = bpy.context.active_object.active_material.node_tree.nodes.active
            # col2.prop(actnode, 'type', text='Shader')
            # for x in bpy.context.active_object.active_material.node_tree.nodes.active.inputs:
            # if x.name != 'Normal' and x.name != 'Clearcoat Normal' and x.name != 'Tangent':
            # col2.prop(x,'default_value', text = x.name)


####Grease Pencil Material Props
        ma = bpy.context.object.active_material
        if ma is not None and ma.grease_pencil is not None:
            gpcolor = ma.grease_pencil
            col2.label(text='                               ++STROKE++')
            col2.active = not gpcolor.lock
            col2.operator('3dview.gp_stroketoggle', text='Toggle Stroke')
            col2.prop(gpcolor, "mode", text="")
            col2.prop(gpcolor, "stroke_style", text="")
            if gpcolor.stroke_style == 'TEXTURE':
                row = col2.row()
                row.enabled = not gpcolor.lock
                col = row.column(align=True)
                col.template_ID(gpcolor, "stroke_image", open="image.open")
                col.prop(gpcolor, "pixel_size", text="UV Factor")
                col.prop(gpcolor, "use_stroke_pattern", text="Use As Pattern")
            if gpcolor.stroke_style == 'SOLID' or gpcolor.use_stroke_pattern is True:
                col2.prop(gpcolor, "color", text="")
            col2.label(text='')
            col2.active = not gpcolor.lock
            col2.label(text='                                 ++FILL++')
            col2.operator('3dview.gp_filltoggle', text='Toggle Fill')
            col2.prop(gpcolor, "fill_style", text="")
            if gpcolor.fill_style == 'GRADIENT':
                col2.prop(gpcolor, "gradient_type", text="")
            if gpcolor.fill_style != 'TEXTURE':
                col2.prop(gpcolor, "fill_color", text="")
                if gpcolor.fill_style in {'GRADIENT', 'CHESSBOARD'}:
                    col2.prop(gpcolor, "mix_color", text="")
                if gpcolor.fill_style == 'GRADIENT':
                    col2.prop(gpcolor, "mix_factor", text="Gradient Mix")
                if gpcolor.fill_style in {'GRADIENT', 'CHESSBOARD'}:
                    col2.prop(gpcolor, "flip", text="Flip Colors")
                    col2.prop(gpcolor, "pattern_shift", text="Location")
                    col2.prop(gpcolor, "pattern_scale", text="Scale")
                if gpcolor.gradient_type == 'RADIAL' and gpcolor.fill_style not in {
                        'SOLID', 'CHESSBOARD'
                }:
                    col2.prop(gpcolor, "pattern_radius", text="Radius")
                else:
                    if gpcolor.fill_style != 'SOLID':
                        col2.prop(gpcolor, "pattern_angle", text="Angle")
                if gpcolor.fill_style == 'CHESSBOARD':
                    col2.prop(gpcolor, "pattern_gridsize", text="Box Size")

            # Texture
            if gpcolor.fill_style == 'TEXTURE' or (gpcolor.texture_mix is True
                                                   and gpcolor.fill_style
                                                   == 'SOLID'):
                col2.template_ID(gpcolor, "fill_image", open="image.open")
                if gpcolor.fill_style == 'TEXTURE':
                    col2.prop(gpcolor,
                              "use_fill_pattern",
                              text="Use As Pattern")
                    if gpcolor.use_fill_pattern is True:
                        col2.prop(gpcolor, "fill_color", text="Color")
                col2.prop(gpcolor, "texture_offset", text="Offset")
                col2.prop(gpcolor, "texture_scale", text="Scale")
                col2.prop(gpcolor, "texture_angle")
                col2.prop(gpcolor, "texture_opacity")
                col2.prop(gpcolor, "texture_clamp", text="Clip Image")
                if gpcolor.use_fill_pattern is False:
                    col2.prop(gpcolor, "texture_mix", text="Mix With Color")
                    if gpcolor.texture_mix is True:
                        col2.prop(gpcolor, "fill_color", text="Mix Color")
                        col2.prop(gpcolor,
                                  "mix_factor",
                                  text="Mix Factor",
                                  slider=True)

            col2.label(text='')
            col2.label(text='                                  /// LAYERS')
            gpd = context.gpencil_data
            row = col2.row()
            sub = row.column()
            layer_rows = 7
            sub.template_list("GPENCIL_UL_layer",
                              "",
                              gpd,
                              "layers",
                              gpd.layers,
                              "active_index",
                              rows=layer_rows,
                              reverse=True)
            sub = row.column()
            sub.operator("gpencil.layer_add", icon='ADD', text="")

            sub.operator("gpencil.layer_remove", icon='REMOVE', text="")
            sub.operator("gpencil.layer_move", icon='TRIA_UP',
                         text="").type = 'UP'
            sub.operator("gpencil.layer_move", icon='TRIA_DOWN',
                         text="").type = 'DOWN'
            sub.operator("gpencil.layer_merge", icon='TRIA_DOWN_BAR', text="")
            sub.operator("gpencil.layer_isolate", icon='GREASEPENCIL',
                         text="").affect_visibility = False
            sub.operator("gpencil.layer_isolate",
                         icon='RESTRICT_VIEW_OFF',
                         text="").affect_visibility = True
            sub.menu("GPENCIL_MT_layer_specials", icon='ERROR', text="")
            gpl = context.active_gpencil_layer
            col2.prop(gpl, "opacity", text="Layer Opacity", slider=True)
예제 #15
0
    def draw(self, context):
        layout = self.layout
        row = layout.row()
        col = row.column()
        col2 = row.column()
        layout.use_property_split = True
        #FIRST COLUMN##############################################################

        scene = context.scene
        rd = scene.render
        props = scene.eevee
        image_settings = rd.image_settings
        col.label(text='RENDER CAMERA')
        col.prop(scene, "camera", text='')
        row = col.row()
        row.scale_x = .5
        row.prop(rd, "resolution_x", text="X")
        row.prop(rd, "resolution_y", text="Y")
        row.prop(rd, "resolution_percentage", text="%")
        row = col.row()
        row.prop(scene, "frame_start", text="F Start")
        row.prop(rd, "fps", text='F Rate')
        row = col.row()
        row.prop(scene, "frame_end", text="F End")
        row.prop(scene, "frame_step", text="F Step")
        col.separator()
        row = col.row()
        row.operator('render.opengl', text='R View')
        row.operator('render.render', text='R Cam')
        row = col.row()
        row.operator('render.opengl', text='R View Anim').animation = True
        row.operator('render.render', text='R Cam Anim').animation = True
        col.separator()

        #           col.prop(world, "use_nodes", icon='NODETREE')

        col.label(text='WORLD')
        world = bpy.context.scene.world
        col.prop(scene.eevee, "use_soft_shadows")
        if world.use_nodes:
            ntree = world.node_tree
            node = ntree.get_output_node('EEVEE')

            if node:
                input = find_node_input(node, 'Surface')
                inputvol = find_node_input(node, 'Volume')
                if input:
                    col.template_node_view(ntree, node, input)
                if input:
                    col.separator()
                    col.separator()
                    col.prop(scene.eevee,
                             "use_volumetric",
                             text="Use Volumetric")
                    col.template_node_view(ntree, node, inputvol)
                else:
                    col.label(text="Incompatible output node")
            else:
                col.label(text="No output node")
        else:
            col.prop(world, "color")
        scene = bpy.context.scene
        props = scene.eevee
        # col.label(text='BLOOM')
        # box = col.box().column()
        # box.active = props.use_bloom
        # box.prop(props, "bloom_threshold")
        # box.prop(props, "bloom_knee")
        # box.prop(props, "bloom_radius")
        # box.prop(props, "bloom_color")
        # box.prop(props, "bloom_intensity")
        # box.prop(props, "bloom_clamp")
        #SECOND COLUMN##############################################################

        col2.label(text='RENDER SETTINGS')
        col2.prop(scene.render, "engine", text='')
        col2.prop(scene.view_settings, 'view_transform', text='')
        col2.prop(scene.view_settings, 'look', text='')
        col2.template_curve_mapping(scene.view_settings,
                                    "curve_mapping",
                                    levels=True)
        col2.prop(image_settings, "file_format", text='')
        col2.prop(image_settings, "compression")
        row = col2.row()
        row.scale_x = .5
        if image_settings.file_format == 'FFMPEG':
            row.prop(rd.ffmpeg, "format", text='')
            row.prop(rd.ffmpeg, "codec", text='')

        else:
            row = col2.row()
            row.scale_x = .2
            row.prop(image_settings, "color_mode", expand=True)
            row = col.row()
            row.scale_x = .2
            row.prop(image_settings, "col_depth", expand=True)
        col2.prop(rd, "filepath", text="")
        col2.prop(rd, "use_overwrite")
        #       col.prop(rd, "use_placeholder")

        #       col.prop(rd, "use_file_extension")
        #       col.prop(rd, "use_render_cache")
        ffmpeg = rd.ffmpeg
        col2.prop(props, "taa_samples")
        col2.prop(props, "taa_render_samples")
        col2.prop(props, "use_taa_reprojection")
 def display_input(layout, ntree, node, input_name):
     input = find_node_input(node, input_name)
     layout.template_node_view(ntree, node, input)