Skip to content
Snippets Groups Projects
ui.py 161 KiB
Newer Older
  • Learn to ignore specific revisions
  •                 if tex.pov.func_list in {
                        "f_ellipsoid",
                        "f_folium_surface",
                        "f_hyperbolic_torus",
                        "f_kampyle_of_eudoxus",
                        "f_parabolic_torus",
                        "f_quartic_cylinder",
                        "f_torus2",
                    }:
    
                    if tex.pov.func_list in {
                        "f_blob2",
                        "f_cross_ellipsoids",
                        "f_flange_cover",
                        "f_isect_ellipsoids",
                        "f_kummer_surface_v2",
                        "f_ovals_of_cassini",
                        "f_rounded_box",
                        "f_spikes_2d",
                        "f_strophoid",
                    }:
    
                    if tex.pov.func_list in {
                        "f_algbr_cyl1",
                        "f_algbr_cyl2",
                        "f_algbr_cyl3",
                        "f_algbr_cyl4",
                        "f_blob",
                        "f_mesh1",
                        "f_poly4",
                        "f_spikes",
                    }:
    
                    if tex.pov.func_list in {
                        "f_devils_curve_2d",
                        "f_dupin_cyclid",
                        "f_folium_surface_2d",
                        "f_hetero_mf",
                        "f_kampyle_of_eudoxus_2d",
                        "f_lemniscate_of_gerono_2d",
                        "f_polytubes",
                        "f_ridge",
                        "f_ridged_mf",
                        "f_spiral",
                        "f_witch_of_agnesi",
                    }:
    
                    if tex.pov.func_list in {
                        "f_helix1",
                        "f_helix2",
                        "f_piriform_2d",
                        "f_strophoid_2d",
                    }:
    
                        func = 7
                    if tex.pov.func_list == "f_helical_torus":
                        func = 8
                    column_flow = layout.column_flow(columns=3, align=True)
    
                    column_flow.label(text="X")
    
                    column_flow.prop(tex.pov, "func_plus_x", text="")
                    column_flow.prop(tex.pov, "func_x", text="Value")
                    column_flow = layout.column_flow(columns=3, align=True)
    
                    column_flow.label(text="Y")
    
                    column_flow.prop(tex.pov, "func_plus_y", text="")
                    column_flow.prop(tex.pov, "func_y", text="Value")
                    column_flow = layout.column_flow(columns=3, align=True)
    
                    column_flow.label(text="Z")
    
                    column_flow.prop(tex.pov, "func_plus_z", text="")
                    column_flow.prop(tex.pov, "func_z", text="Value")
    
                    row = layout.row(align=align)
    
                    if func > 0:
                        row.prop(tex.pov, "func_P0", text="P0")
                    if func > 1:
                        row.prop(tex.pov, "func_P1", text="P1")
    
                    row = layout.row(align=align)
    
                    if func > 2:
                        row.prop(tex.pov, "func_P2", text="P2")
                    if func > 3:
                        row.prop(tex.pov, "func_P3", text="P3")
    
                    row = layout.row(align=align)
    
                    if func > 4:
                        row.prop(tex.pov, "func_P4", text="P4")
                    if func > 5:
                        row.prop(tex.pov, "func_P5", text="P5")
    
                    row = layout.row(align=align)
    
                    if func > 6:
                        row.prop(tex.pov, "func_P6", text="P6")
                    if func > 7:
                        row.prop(tex.pov, "func_P7", text="P7")
    
                        row = layout.row(align=align)
    
                        row.prop(tex.pov, "func_P8", text="P8")
                        row.prop(tex.pov, "func_P9", text="P9")
    
                ###################################################End Patterns############################
    
                layout.prop(tex.pov, "warp_types", text="Warp types")  # warp
    
                if tex.pov.warp_types == "TOROIDAL":
    
                    layout.prop(
                        tex.pov, "warp_tor_major_radius", text="Major radius"
                    )
                if tex.pov.warp_types not in {"CUBIC", "NONE"}:
                    layout.prop(
                        tex.pov, "warp_orientation", text="Warp orientation"
                    )
    
                col = layout.column(align=align)
    
                row = col.row()
                row.prop(tex.pov, "warp_dist_exp", text="Distance exponent")
    
                row = col.row()
                row.prop(tex.pov, "modifier_frequency", text="Frequency")
                row.prop(tex.pov, "modifier_phase", text="Phase")
    
    
    
                row.label(text="Offset:")
                row.label(text="Scale:")
                row.label(text="Rotate:")
    
                col = layout.column(align=align)
                row = col.row()
    
                row.prop(tex.pov, "tex_mov_x", text="X")
                row.prop(tex.pov, "tex_scale_x", text="X")
                row.prop(tex.pov, "tex_rot_x", text="X")
    
                row.prop(tex.pov, "tex_mov_y", text="Y")
                row.prop(tex.pov, "tex_scale_y", text="Y")
                row.prop(tex.pov, "tex_rot_y", text="Y")
    
                row.prop(tex.pov, "tex_mov_z", text="Z")
                row.prop(tex.pov, "tex_scale_z", text="Z")
                row.prop(tex.pov, "tex_rot_z", text="Z")
    
    
                row.label(text="Turbulence:")
    
                col = layout.column(align=align)
                row = col.row()
    
                row.prop(tex.pov, "warp_turbulence_x", text="X")
                row.prop(tex.pov, "modifier_octaves", text="Octaves")
    
                row.prop(tex.pov, "warp_turbulence_y", text="Y")
                row.prop(tex.pov, "modifier_lambda", text="Lambda")
    
                row.prop(tex.pov, "warp_turbulence_z", text="Z")
                row.prop(tex.pov, "modifier_omega", text="Omega")
    
    class TEXTURE_PT_POV_mapping(TextureSlotPanel, Panel):
        """Use this class to define POV texture mapping buttons"""
        bl_label = "Mapping"
        COMPAT_ENGINES = {'POVRAY_RENDER'}
        bl_space_type = 'PROPERTIES'
        bl_region_type = 'WINDOW'
    
        @classmethod
        def poll(cls, context):
            idblock = pov_context_tex_datablock(context)
            if isinstance(idblock, Brush) and not context.sculpt_object:
                return False
    
            if not getattr(context, "texture_slot", None):
                return False
    
            engine = context.scene.render.engine
            return (engine in cls.COMPAT_ENGINES)
    
        def draw(self, context):
            layout = self.layout
    
            idblock = pov_context_tex_datablock(context)
    
            #tex = context.texture_slot
            tex = mat.pov_texture_slots[
                mat.active_texture_index
            ]
            if not isinstance(idblock, Brush):
                split = layout.split(percentage=0.3)
                col = split.column()
                col.label(text="Coordinates:")
                col = split.column()
                col.prop(tex, "texture_coords", text="")
    
                if tex.texture_coords == 'ORCO':
                    """
                    ob = context.object
                    if ob and ob.type == 'MESH':
                        split = layout.split(percentage=0.3)
                        split.label(text="Mesh:")
                        split.prop(ob.data, "texco_mesh", text="")
                    """
                elif tex.texture_coords == 'UV':
                    split = layout.split(percentage=0.3)
                    split.label(text="Map:")
                    ob = context.object
                    if ob and ob.type == 'MESH':
                        split.prop_search(tex, "uv_layer", ob.data, "uv_textures", text="")
                    else:
                        split.prop(tex, "uv_layer", text="")
    
                elif tex.texture_coords == 'OBJECT':
                    split = layout.split(percentage=0.3)
                    split.label(text="Object:")
                    split.prop(tex, "object", text="")
    
                elif tex.texture_coords == 'ALONG_STROKE':
                    split = layout.split(percentage=0.3)
                    split.label(text="Use Tips:")
                    split.prop(tex, "use_tips", text="")
    
            if isinstance(idblock, Brush):
                if context.sculpt_object or context.image_paint_object:
                    brush_texture_settings(layout, idblock, context.sculpt_object)
            else:
                if isinstance(idblock, FreestyleLineStyle):
                    split = layout.split(percentage=0.3)
                    split.label(text="Projection:")
                    split.prop(tex, "mapping", text="")
    
                    split = layout.split(percentage=0.3)
                    split.separator()
                    row = split.row()
                    row.prop(tex, "mapping_x", text="")
                    row.prop(tex, "mapping_y", text="")
                    row.prop(tex, "mapping_z", text="")
    
                elif isinstance(idblock, Material):
                    split = layout.split(percentage=0.3)
                    split.label(text="Projection:")
                    split.prop(tex, "mapping", text="")
    
                    split = layout.split()
    
                    col = split.column()
                    if tex.texture_coords in {'ORCO', 'UV'}:
                        col.prop(tex, "use_from_dupli")
                        if (idblock.type == 'VOLUME' and tex.texture_coords == 'ORCO'):
                            col.prop(tex, "use_map_to_bounds")
                    elif tex.texture_coords == 'OBJECT':
                        col.prop(tex, "use_from_original")
                        if (idblock.type == 'VOLUME'):
                            col.prop(tex, "use_map_to_bounds")
                    else:
                        col.label()
    
                    col = split.column()
                    row = col.row()
                    row.prop(tex, "mapping_x", text="")
                    row.prop(tex, "mapping_y", text="")
                    row.prop(tex, "mapping_z", text="")
    
                row = layout.row()
                row.column().prop(tex, "offset")
                row.column().prop(tex, "scale")
    
    class TEXTURE_PT_POV_influence(TextureSlotPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov texture influence buttons."""
    
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        bl_label = "Influence"
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        bl_space_type = 'PROPERTIES'
        bl_region_type = 'WINDOW'
    
        #bl_context = 'texture'
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        @classmethod
        def poll(cls, context):
    
            idblock = pov_context_tex_datablock(context)
    
                # isinstance(idblock, Brush) and # Brush used for everything since 2.8
                context.scene.texture_context == 'OTHER'
    
            ):  # XXX replace by isinstance(idblock, bpy.types.Brush) and ...
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                return False
    
    
            # Specify below also for pov_world_texture_slots, lights etc.
            # to display for various types of slots but only when any
            if not getattr(idblock, "pov_texture_slots", None):
                return False
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
            engine = context.scene.render.engine
    
            return engine in cls.COMPAT_ENGINES
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
        def draw(self, context):
    
            layout = self.layout
    
    
            idblock = pov_context_tex_datablock(context)
            # tex = context.pov_texture_slot
    
            #mat = bpy.context.active_object.active_material
            texslot = idblock.pov_texture_slots[
                idblock.pov.active_texture_index
    
            ]  # bpy.data.textures[mat.active_texture_index]
            tex = bpy.data.textures[
    
                idblock.pov_texture_slots[idblock.pov.active_texture_index].texture
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            def factor_but(layout, toggle, factor, name):
                row = layout.row(align=True)
    
                row.prop(texslot, toggle, text="")
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                sub = row.row(align=True)
    
                sub.active = getattr(texslot, toggle)
                sub.prop(texslot, factor, text=name, slider=True)
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                return sub  # XXX, temp. use_map_normal needs to override.
    
            if isinstance(idblock, Material):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                col = split.column()
    
                if idblock.pov.type in {'SURFACE', 'WIRE'}:
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                    split = layout.split()
    
                    col = split.column()
                    col.label(text="Diffuse:")
    
                    factor_but(
                        col, "use_map_diffuse", "diffuse_factor", "Intensity"
                    )
                    factor_but(
                        col,
                        "use_map_color_diffuse",
                        "diffuse_color_factor",
                        "Color",
                    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                    factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
    
                    factor_but(
                        col,
                        "use_map_translucency",
                        "translucency_factor",
                        "Translucency",
                    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
                    col.label(text="Specular:")
    
                    factor_but(
                        col, "use_map_specular", "specular_factor", "Intensity"
                    )
                    factor_but(
                        col, "use_map_color_spec", "specular_color_factor", "Color"
                    )
                    factor_but(
                        col, "use_map_hardness", "hardness_factor", "Hardness"
                    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
                    col = split.column()
                    col.label(text="Shading:")
                    factor_but(col, "use_map_ambient", "ambient_factor", "Ambient")
                    factor_but(col, "use_map_emit", "emit_factor", "Emit")
                    factor_but(col, "use_map_mirror", "mirror_factor", "Mirror")
                    factor_but(col, "use_map_raymir", "raymir_factor", "Ray Mirror")
    
                    col.label(text="Geometry:")
                    # XXX replace 'or' when displacement is fixed to not rely on normal influence value.
    
                    sub_tmp = factor_but(
                        col, "use_map_normal", "normal_factor", "Normal"
                    )
                    sub_tmp.active = (
                        texslot.use_map_normal or texslot.use_map_displacement
                    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                    # END XXX
    
                    factor_but(col, "use_map_warp", "warp_factor", "Warp")
    
                    factor_but(
                        col,
                        "use_map_displacement",
                        "displacement_factor",
                        "Displace",
                    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
                    # ~ sub = col.column()
    
                    # ~ sub.active = texslot.use_map_translucency or texslot.map_emit or texslot.map_alpha or texslot.map_raymir or texslot.map_hardness or texslot.map_ambient or texslot.map_specularity or texslot.map_reflection or texslot.map_mirror
    
                    # ~ sub.prop(texslot, "default_value", text="Amount", slider=True)
    
                elif idblock.pov.type == 'HALO':
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                    layout.label(text="Halo:")
    
                    split = layout.split()
    
                    col = split.column()
    
                    factor_but(
                        col,
                        "use_map_color_diffuse",
                        "diffuse_color_factor",
                        "Color",
                    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                    factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
    
                    col = split.column()
                    factor_but(col, "use_map_raymir", "raymir_factor", "Size")
    
                    factor_but(
                        col, "use_map_hardness", "hardness_factor", "Hardness"
                    )
                    factor_but(
                        col, "use_map_translucency", "translucency_factor", "Add"
                    )
    
                elif idblock.pov.type == 'VOLUME':
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                    layout.label(text="Volume:")
    
                    split = layout.split()
    
                    col = split.column()
                    factor_but(col, "use_map_density", "density_factor", "Density")
    
                    factor_but(
                        col, "use_map_emission", "emission_factor", "Emission"
                    )
                    factor_but(
                        col, "use_map_scatter", "scattering_factor", "Scattering"
                    )
                    factor_but(
                        col, "use_map_reflect", "reflection_factor", "Reflection"
                    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
                    col = split.column()
                    col.label(text=" ")
    
                    factor_but(
                        col,
                        "use_map_color_emission",
                        "emission_color_factor",
                        "Emission Color",
                    )
                    factor_but(
                        col,
                        "use_map_color_transmission",
                        "transmission_color_factor",
                        "Transmission Color",
                    )
                    factor_but(
                        col,
                        "use_map_color_reflection",
                        "reflection_color_factor",
                        "Reflection Color",
                    )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
                    layout.label(text="Geometry:")
    
                    split = layout.split()
    
                    col = split.column()
                    factor_but(col, "use_map_warp", "warp_factor", "Warp")
    
                    col = split.column()
    
                    factor_but(
                        col,
                        "use_map_displacement",
                        "displacement_factor",
                        "Displace",
                    )
    
            elif isinstance(idblock, Light):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                split = layout.split()
    
                col = split.column()
                factor_but(col, "use_map_color", "color_factor", "Color")
    
                col = split.column()
                factor_but(col, "use_map_shadow", "shadow_factor", "Shadow")
    
            elif isinstance(idblock, World):
                split = layout.split()
    
                col = split.column()
                factor_but(col, "use_map_blend", "blend_factor", "Blend")
                factor_but(col, "use_map_horizon", "horizon_factor", "Horizon")
    
                col = split.column()
    
                factor_but(
                    col, "use_map_zenith_up", "zenith_up_factor", "Zenith Up"
                )
                factor_but(
                    col, "use_map_zenith_down", "zenith_down_factor", "Zenith Down"
                )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            elif isinstance(idblock, ParticleSettings):
                split = layout.split()
    
                col = split.column()
                col.label(text="General:")
                factor_but(col, "use_map_time", "time_factor", "Time")
                factor_but(col, "use_map_life", "life_factor", "Lifetime")
                factor_but(col, "use_map_density", "density_factor", "Density")
                factor_but(col, "use_map_size", "size_factor", "Size")
    
                col = split.column()
                col.label(text="Physics:")
                factor_but(col, "use_map_velocity", "velocity_factor", "Velocity")
                factor_but(col, "use_map_damp", "damp_factor", "Damp")
                factor_but(col, "use_map_gravity", "gravity_factor", "Gravity")
                factor_but(col, "use_map_field", "field_factor", "Force Fields")
    
                layout.label(text="Hair:")
    
                split = layout.split()
    
                col = split.column()
                factor_but(col, "use_map_length", "length_factor", "Length")
                factor_but(col, "use_map_clump", "clump_factor", "Clump")
                factor_but(col, "use_map_twist", "twist_factor", "Twist")
    
                col = split.column()
    
                factor_but(
                    col, "use_map_kink_amp", "kink_amp_factor", "Kink Amplitude"
                )
                factor_but(
                    col, "use_map_kink_freq", "kink_freq_factor", "Kink Frequency"
                )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                factor_but(col, "use_map_rough", "rough_factor", "Rough")
    
            elif isinstance(idblock, FreestyleLineStyle):
                split = layout.split()
    
                col = split.column()
    
                factor_but(
                    col, "use_map_color_diffuse", "diffuse_color_factor", "Color"
                )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                col = split.column()
                factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
    
            layout.separator()
    
            if not isinstance(idblock, ParticleSettings):
                split = layout.split()
    
                col = split.column()
    
                # col.prop(tex, "blend_type", text="Blend") #deprecated since 2.8
                # col.prop(tex, "use_rgb_to_intensity") #deprecated since 2.8
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                # color is used on gray-scale textures even when use_rgb_to_intensity is disabled.
    
                # col.prop(tex, "color", text="") #deprecated since 2.8
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
                col = split.column()
    
                # col.prop(tex, "invert", text="Negative") #deprecated since 2.8
                # col.prop(tex, "use_stencil") #deprecated since 2.8
    
            # if isinstance(idblock, (Material, World)):
            # col.prop(tex, "default_value", text="DVar", slider=True)
    
    class TEXTURE_PT_POV_tex_gamma(TextureButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov texture gamma buttons."""
    
    
        bl_label = "Image Gamma"
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        def draw_header(self, context):
            tex = context.texture
    
    
            self.layout.prop(
                tex.pov, "tex_gamma_enable", text="", icon='SEQ_LUMA_WAVEFORM'
            )
    
    
        def draw(self, context):
            layout = self.layout
    
            tex = context.texture
    
    
            layout.active = tex.pov.tex_gamma_enable
            layout.prop(tex.pov, "tex_gamma_value", text="Gamma Value")
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
    
    
    # commented out below UI for texture only custom code inside exported material:
    
    # class TEXTURE_PT_povray_replacement_text(TextureButtonsPanel, Panel):
    
    # bl_label = "Custom POV Code"
    # COMPAT_ENGINES = {'POVRAY_RENDER'}
    
    # def draw(self, context):
    # layout = self.layout
    
    # tex = context.texture
    
    # col = layout.column()
    # col.label(text="Replace properties with:")
    # col.prop(tex.pov, "replacement_text", text="")
    
    class OBJECT_PT_POV_obj_parameters(ObjectButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov specific object level options buttons."""
    
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        @classmethod
        def poll(cls, context):
    
            engine = context.scene.render.engine
    
            return engine in cls.COMPAT_ENGINES
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
        def draw(self, context):
            layout = self.layout
    
            obj = context.object
    
    
            split = layout.split()
    
            col = split.column(align=True)
    
    
    Thomas Dinges's avatar
    Thomas Dinges committed
            col.label(text="Radiosity:")
    
            col.prop(obj.pov, "importance_value", text="Importance")
    
    Thomas Dinges's avatar
    Thomas Dinges committed
            col.label(text="Photons:")
    
            col.prop(obj.pov, "collect_photons", text="Receive Photon Caustics")
    
                col.prop(
                    obj.pov, "spacing_multiplier", text="Photons Spacing Multiplier"
                )
    
            col.prop(obj.pov, "hollow")
            col.prop(obj.pov, "double_illuminate")
    
            if obj.type == 'META' or obj.pov.curveshape == 'lathe':
    
                # if obj.pov.curveshape == 'sor'
                col.prop(obj.pov, "sturm")
            col.prop(obj.pov, "no_shadow")
            col.prop(obj.pov, "no_image")
            col.prop(obj.pov, "no_reflection")
            col.prop(obj.pov, "no_radiosity")
            col.prop(obj.pov, "inverse")
            col.prop(obj.pov, "hierarchy")
    
            # col.prop(obj.pov,"boundorclip",text="Bound / Clip")
            # if obj.pov.boundorclip != "none":
    
            # col.prop_search(obj.pov,"boundorclipob",context.blend_data,"objects",text="Object")
            # text = "Clipped by"
            # if obj.pov.boundorclip == "clipped_by":
            # text = "Bounded by"
            # col.prop(obj.pov,"addboundorclip",text=text)
    
    
    class OBJECT_PT_POV_obj_sphere(PovDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov sphere primitive parameters buttons."""
    
    
        bl_label = "POV Sphere"
    
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        # bl_options = {'HIDE_HEADER'}
    
        @classmethod
        def poll(cls, context):
            engine = context.scene.render.engine
            obj = context.object
    
            return (
                obj
                and obj.pov.object_as == 'SPHERE'
                and (engine in cls.COMPAT_ENGINES)
            )
    
    
        def draw(self, context):
            layout = self.layout
    
            obj = context.object
    
            col = layout.column()
    
            if obj.pov.object_as == 'SPHERE':
                if obj.pov.unlock_parameters == False:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Exported parameters below",
                        icon='LOCKED',
                    )
    
                    col.label(text="Sphere radius: " + str(obj.pov.sphere_radius))
    
                else:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Edit exported parameters",
                        icon='UNLOCKED',
                    )
    
                    col.label(text="3D view proxy may get out of synch")
                    col.active = obj.pov.unlock_parameters
    
    
                    layout.operator(
                        "pov.sphere_update", text="Update", icon="SHADING_RENDERED"
                    )
    
                    # col.label(text="Parameters:")
    
                    col.prop(obj.pov, "sphere_radius", text="Radius of Sphere")
    
    
    class OBJECT_PT_POV_obj_cylinder(PovDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov cylinder primitive parameters buttons."""
    
    
        bl_label = "POV Cylinder"
    
        # bl_options = {'HIDE_HEADER'}
    
        @classmethod
        def poll(cls, context):
            engine = context.scene.render.engine
            obj = context.object
    
            return (
                obj
                and obj.pov.object_as == 'CYLINDER'
                and (engine in cls.COMPAT_ENGINES)
            )
    
    
        def draw(self, context):
            layout = self.layout
    
            obj = context.object
    
            col = layout.column()
    
            if obj.pov.object_as == 'CYLINDER':
                if obj.pov.unlock_parameters == False:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Exported parameters below",
                        icon='LOCKED',
                    )
                    col.label(
                        text="Cylinder radius: " + str(obj.pov.cylinder_radius)
                    )
                    col.label(
                        text="Cylinder cap location: "
                        + str(obj.pov.cylinder_location_cap)
                    )
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Edit exported parameters",
                        icon='UNLOCKED',
                    )
    
                    col.label(text="3D view proxy may get out of synch")
                    col.active = obj.pov.unlock_parameters
    
    
                    layout.operator(
                        "pov.cylinder_update", text="Update", icon="MESH_CYLINDER"
                    )
    
                    # col.label(text="Parameters:")
    
                    col.prop(obj.pov, "cylinder_radius")
                    col.prop(obj.pov, "cylinder_location_cap")
    
    
    class OBJECT_PT_POV_obj_cone(PovDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov cone primitive parameters buttons."""
    
    
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        # bl_options = {'HIDE_HEADER'}
    
        @classmethod
        def poll(cls, context):
            engine = context.scene.render.engine
            obj = context.object
    
            return (
                obj
                and obj.pov.object_as == 'CONE'
                and (engine in cls.COMPAT_ENGINES)
            )
    
    
        def draw(self, context):
            layout = self.layout
    
            obj = context.object
    
            col = layout.column()
    
            if obj.pov.object_as == 'CONE':
                if obj.pov.unlock_parameters == False:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Exported parameters below",
                        icon='LOCKED',
                    )
                    col.label(
                        text="Cone base radius: " + str(obj.pov.cone_base_radius)
                    )
                    col.label(
                        text="Cone cap radius: " + str(obj.pov.cone_cap_radius)
                    )
                    col.label(
                        text="Cone proxy segments: " + str(obj.pov.cone_segments)
                    )
    
                    col.label(text="Cone height: " + str(obj.pov.cone_height))
                else:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Edit exported parameters",
                        icon='UNLOCKED',
                    )
    
                    col.label(text="3D view proxy may get out of synch")
                    col.active = obj.pov.unlock_parameters
    
    
                    layout.operator(
                        "pov.cone_update", text="Update", icon="MESH_CONE"
                    )
    
                    # col.label(text="Parameters:")
                    col.prop(
                        obj.pov, "cone_base_radius", text="Radius of Cone Base"
                    )
    
                    col.prop(obj.pov, "cone_cap_radius", text="Radius of Cone Cap")
    
                    col.prop(
                        obj.pov, "cone_segments", text="Segmentation of Cone proxy"
                    )
    
                    col.prop(obj.pov, "cone_height", text="Height of the cone")
    
    
    class OBJECT_PT_POV_obj_superellipsoid(PovDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov superellipsoid primitive parameters buttons."""
    
    
        bl_label = "POV Superquadric ellipsoid"
    
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        # bl_options = {'HIDE_HEADER'}
    
        @classmethod
        def poll(cls, context):
            engine = context.scene.render.engine
            obj = context.object
    
            return (
                obj
                and obj.pov.object_as == 'SUPERELLIPSOID'
                and (engine in cls.COMPAT_ENGINES)
            )
    
    
        def draw(self, context):
            layout = self.layout
    
            obj = context.object
    
            col = layout.column()
    
            if obj.pov.object_as == 'SUPERELLIPSOID':
                if obj.pov.unlock_parameters == False:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Exported parameters below",
                        icon='LOCKED',
                    )
    
                    col.label(text="Radial segmentation: " + str(obj.pov.se_u))
                    col.label(text="Lateral segmentation: " + str(obj.pov.se_v))
                    col.label(text="Ring shape: " + str(obj.pov.se_n1))
                    col.label(text="Cross-section shape: " + str(obj.pov.se_n2))
                    col.label(text="Fill up and down: " + str(obj.pov.se_edit))
                else:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Edit exported parameters",
                        icon='UNLOCKED',
                    )
    
                    col.label(text="3D view proxy may get out of synch")
                    col.active = obj.pov.unlock_parameters
    
    
                    layout.operator(
                        "pov.superellipsoid_update",
                        text="Update",
                        icon="MOD_SUBSURF",
                    )
    
                    # col.label(text="Parameters:")
    
                    col.prop(obj.pov, "se_u")
                    col.prop(obj.pov, "se_v")
                    col.prop(obj.pov, "se_n1")
                    col.prop(obj.pov, "se_n2")
                    col.prop(obj.pov, "se_edit")
    
    class OBJECT_PT_POV_obj_torus(PovDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov torus primitive parameters buttons."""
    
    
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        # bl_options = {'HIDE_HEADER'}
    
        @classmethod
        def poll(cls, context):
            engine = context.scene.render.engine
            obj = context.object
    
            return (
                obj
                and obj.pov.object_as == 'TORUS'
                and (engine in cls.COMPAT_ENGINES)
            )
    
    
        def draw(self, context):
            layout = self.layout
    
            obj = context.object
    
            col = layout.column()
    
            if obj.pov.object_as == 'TORUS':
                if obj.pov.unlock_parameters == False:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Exported parameters below",
                        icon='LOCKED',
                    )
                    col.label(
                        text="Torus major radius: "
                        + str(obj.pov.torus_major_radius)
                    )
                    col.label(
                        text="Torus minor radius: "
                        + str(obj.pov.torus_minor_radius)
                    )
                    col.label(
                        text="Torus major segments: "
                        + str(obj.pov.torus_major_segments)
                    )
                    col.label(
                        text="Torus minor segments: "
                        + str(obj.pov.torus_minor_segments)
                    )
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Edit exported parameters",
                        icon='UNLOCKED',
                    )
    
                    col.label(text="3D view proxy may get out of synch")
                    col.active = obj.pov.unlock_parameters
    
    
                    layout.operator(
                        "pov.torus_update", text="Update", icon="MESH_TORUS"
                    )
    
                    # col.label(text="Parameters:")
    
                    col.prop(obj.pov, "torus_major_radius")
                    col.prop(obj.pov, "torus_minor_radius")
                    col.prop(obj.pov, "torus_major_segments")
                    col.prop(obj.pov, "torus_minor_segments")
    
    
    class OBJECT_PT_POV_obj_supertorus(PovDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov supertorus primitive parameters buttons."""
    
    
        bl_label = "POV SuperTorus"
    
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        # bl_options = {'HIDE_HEADER'}
    
        @classmethod
        def poll(cls, context):
            engine = context.scene.render.engine
            obj = context.object
    
            return (
                obj
                and obj.pov.object_as == 'SUPERTORUS'
                and (engine in cls.COMPAT_ENGINES)
            )
    
    
        def draw(self, context):
            layout = self.layout
    
            obj = context.object
    
            col = layout.column()
    
            if obj.pov.object_as == 'SUPERTORUS':
                if obj.pov.unlock_parameters == False:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Exported parameters below",
                        icon='LOCKED',
                    )
                    col.label(
                        text="SuperTorus major radius: "
                        + str(obj.pov.st_major_radius)
                    )
                    col.label(
                        text="SuperTorus minor radius: "
                        + str(obj.pov.st_minor_radius)
                    )
                    col.label(
                        text="SuperTorus major segments: " + str(obj.pov.st_u)
                    )
                    col.label(
                        text="SuperTorus minor segments: " + str(obj.pov.st_v)
                    )
    
                    col.label(
                        text="SuperTorus Ring Manipulator: " + str(obj.pov.st_ring)
                    )
                    col.label(
                        text="SuperTorus Cross Manipulator: "
                        + str(obj.pov.st_cross)
                    )
                    col.label(
                        text="SuperTorus Internal And External radii: "
                        + str(obj.pov.st_ie)
                    )
    
                    col.label(
                        text="SuperTorus accuracy: " + str(ob.pov.st_accuracy)
                    )
                    col.label(
                        text="SuperTorus max gradient: "
                        + str(ob.pov.st_max_gradient)
                    )
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Edit exported parameters",
                        icon='UNLOCKED',
                    )
    
                    col.label(text="3D view proxy may get out of synch")
                    col.active = obj.pov.unlock_parameters
    
    
                    layout.operator(
                        "pov.supertorus_update", text="Update", icon="MESH_TORUS"
                    )
    
                    # col.label(text="Parameters:")
    
                    col.prop(obj.pov, "st_major_radius")
                    col.prop(obj.pov, "st_minor_radius")