Skip to content
Snippets Groups Projects
ui.py 142 KiB
Newer Older
  • Learn to ignore specific revisions
  • Maurice Raybaud's avatar
    Maurice Raybaud committed
                    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")
                    col.prop(obj.pov, "st_u")
                    col.prop(obj.pov, "st_v")
                    col.prop(obj.pov, "st_ring")
                    col.prop(obj.pov, "st_cross")
                    col.prop(obj.pov, "st_ie")
    
                    # col.prop(obj.pov, "st_edit") #?
    
                    col.prop(obj.pov, "st_accuracy")
                    col.prop(obj.pov, "st_max_gradient")
    
    class OBJECT_PT_POV_obj_parametric(PovDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov parametric surface primitive parameters buttons."""
    
    
        bl_label = "POV Parametric surface"
    
        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 == 'PARAMETRIC'
                and (engine in cls.COMPAT_ENGINES)
            )
    
    
        def draw(self, context):
            layout = self.layout
    
            obj = context.object
    
            col = layout.column()
    
            if obj.pov.object_as == 'PARAMETRIC':
                if obj.pov.unlock_parameters == False:
    
                    col.prop(
                        obj.pov,
                        "unlock_parameters",
                        text="Exported parameters below",
                        icon='LOCKED',
                    )
    
                    col.label(text="Minimum U: " + str(obj.pov.u_min))
                    col.label(text="Minimum V: " + str(obj.pov.v_min))
                    col.label(text="Maximum U: " + str(obj.pov.u_max))
                    col.label(text="Minimum V: " + str(obj.pov.v_min))
                    col.label(text="X Function: " + str(obj.pov.x_eq))
                    col.label(text="Y Function: " + str(obj.pov.y_eq))
                    col.label(text="Z Function: " + str(obj.pov.x_eq))
    
                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.parametric_update", text="Update", icon="SCRIPTPLUGINS"
                    )
    
                    col.prop(obj.pov, "u_min", text="Minimum U")
                    col.prop(obj.pov, "v_min", text="Minimum V")
                    col.prop(obj.pov, "u_max", text="Maximum U")
                    col.prop(obj.pov, "v_max", text="Minimum V")
                    col.prop(obj.pov, "x_eq", text="X Function")
                    col.prop(obj.pov, "y_eq", text="Y Function")
                    col.prop(obj.pov, "z_eq", text="Z Function")
    
    
    class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to define pov object replacement field."""
    
    
    Thomas Dinges's avatar
    Thomas Dinges committed
            col = layout.column()
    
            col.prop(obj.pov, "replacement_text", text="")
    
    ###############################################################################
    # Add Povray Objects
    ###############################################################################
    
    class VIEW_MT_POV_primitives_add(bpy.types.Menu):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Define the primitives menu with presets"""
    
        bl_idname = "VIEW_MT_POV_primitives_add"
    
        bl_label = "Povray"
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        @classmethod
        def poll(cls, context):
            engine = context.scene.render.engine
    
            return engine == 'POVRAY_RENDER'
    
        def draw(self, context):
    
            layout = self.layout
            layout.operator_context = 'INVOKE_REGION_WIN'
    
            layout.menu(
                VIEW_MT_POV_Basic_Shapes.bl_idname, text="Primitives", icon="GROUP"
            )
            layout.menu(VIEW_MT_POV_import.bl_idname, text="Import", icon="IMPORT")
    
    
    class VIEW_MT_POV_Basic_Shapes(bpy.types.Menu):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class to sort simple primitives menu entries."""
    
    
        bl_idname = "POVRAY_MT_basic_shape_tools"
    
        bl_label = "Basic_shapes"
    
        def draw(self, context):
    
            layout = self.layout
            layout.operator_context = 'INVOKE_REGION_WIN'
    
            layout.operator(
                "pov.addplane", text="Infinite Plane", icon='MESH_PLANE'
            )
            layout.operator("pov.addbox", text="Box", icon='MESH_CUBE')
            layout.operator("pov.addsphere", text="Sphere", icon='SHADING_RENDERED')
            layout.operator(
                "pov.addcylinder", text="Cylinder", icon="MESH_CYLINDER"
            )
            layout.operator("pov.cone_add", text="Cone", icon="MESH_CONE")
            layout.operator("pov.addtorus", text="Torus", icon='MESH_TORUS')
    
            layout.operator("pov.addrainbow", text="Rainbow", icon="COLOR")
            layout.operator("pov.addlathe", text="Lathe", icon='MOD_SCREW')
            layout.operator("pov.addprism", text="Prism", icon='MOD_SOLIDIFY')
            layout.operator(
                "pov.addsuperellipsoid",
                text="Superquadric Ellipsoid",
                icon='MOD_SUBSURF',
            )
            layout.operator(
                "pov.addheightfield", text="Height Field", icon="RNDCURVE"
            )
            layout.operator(
                "pov.addspheresweep", text="Sphere Sweep", icon='FORCE_CURVE'
            )
    
            layout.operator(
                "pov.addblobsphere", text="Blob Sphere", icon='META_DATA'
            )
    
            layout.label(text="Isosurfaces")
    
            layout.operator(
                "pov.addisosurfacebox", text="Isosurface Box", icon="META_CUBE"
            )
            layout.operator(
                "pov.addisosurfacesphere",
                text="Isosurface Sphere",
                icon="META_BALL",
            )
            layout.operator(
                "pov.addsupertorus", text="Supertorus", icon="SURFACE_NTORUS"
            )
    
            layout.label(text="Macro based")
            layout.operator(
                "pov.addpolygontocircle",
                text="Polygon To Circle Blending",
                icon="MOD_CAST",
            )
            layout.operator("pov.addloft", text="Loft", icon="SURFACE_NSURFACE")
    
            layout.separator()
            # Warning if the Add Advanced Objects addon containing
            # Add mesh extra objects is not enabled
            if not check_add_mesh_extra_objects():
    
                # col = box.column()
                layout.label(
                    text="Please enable Add Mesh: Extra Objects addon", icon="INFO"
                )
                # layout.separator()
                layout.operator(
                    "preferences.addon_show",
                    text="Go to Add Mesh: Extra Objects addon",
                    icon="PREFERENCES",
                ).module = "add_mesh_extra_objects"
    
                # layout.separator()
    
                layout.operator(
                    "pov.addparametric", text="Parametric", icon='SCRIPTPLUGINS'
                )
    
    
    class VIEW_MT_POV_import(bpy.types.Menu):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class for the import menu."""
    
    
        bl_idname = "POVRAY_MT_import_tools"
    
        def draw(self, context):
    
            layout = self.layout
            layout.operator_context = 'INVOKE_REGION_WIN'
    
            layout.operator("import_scene.pov", icon="FORCE_LENNARDJONES")
    
    
    
    def menu_func_add(self, context):
        engine = context.scene.render.engine
        if engine == 'POVRAY_RENDER':
    
            self.layout.menu("VIEW_MT_POV_primitives_add", icon="PLUGIN")
    
    def menu_func_import(self, context):
        engine = context.scene.render.engine
        if engine == 'POVRAY_RENDER':
    
            self.layout.operator("import_scene.pov", icon="FORCE_LENNARDJONES")
    
    ##############Nodes
    
    # def find_node_input(node, name):
    
    # for input in node.inputs:
    # if input.name == name:
    # return input
    
    
    # def panel_node_draw(layout, id_data, output_type, input_name):
    
    # if not id_data.use_nodes:
    # #layout.operator("pov.material_use_nodes", icon='SOUND')#'NODETREE')
    # #layout.operator("pov.use_shading_nodes", icon='NODETREE')
    # layout.operator("WM_OT_context_toggle", icon='NODETREE').data_path = \
    # "material.pov.material_use_nodes"
    # return False
    
    # ntree = id_data.node_tree
    
    # node = find_node(id_data, output_type)
    # if not node:
    # layout.label(text="No output node")
    # else:
    # input = find_node_input(node, input_name)
    # layout.template_node_view(ntree, node, input)
    
    class NODE_MT_POV_map_create(bpy.types.Menu):
    
        """Create maps"""
    
        bl_idname = "POVRAY_MT_node_map_create"
    
        bl_label = "Create map"
    
    
        def draw(self, context):
    
            layout = self.layout
            layout.operator("node.map_create")
    
    
    def menu_func_nodes(self, context):
        ob = context.object
    
        if hasattr(ob, 'active_material'):
            mat = context.object.active_material
    
            if mat and context.space_data.tree_type == 'ObjectNodeTree':
    
                self.layout.prop(mat.pov, "material_use_nodes")
    
                self.layout.menu(NODE_MT_POV_map_create.bl_idname)
    
                self.layout.operator("wm.updatepreviewkey")
    
            if (
                hasattr(mat, 'active_texture')
                and context.scene.render.engine == 'POVRAY_RENDER'
            ):
                tex = mat.active_texture
    
                if tex and context.space_data.tree_type == 'TextureNodeTree':
    
                    self.layout.prop(tex.pov, "texture_use_nodes")
    
    ###############################################################################
    # Camera Povray Settings
    
    ###############################################################################
    
    class CAMERA_PT_POV_cam_dof(CameraDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class for camera depth of field focal blur buttons."""
    
    
        bl_label = "POV Aperture"
    
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        bl_parent_id = "DATA_PT_camera_dof_aperture"
        bl_options = {'HIDE_HEADER'}
    
        # def draw_header(self, context):
        # cam = context.camera
    
        # self.layout.prop(cam.pov, "dof_enable", text="")
    
        def draw(self, context):
            layout = self.layout
    
            cam = context.camera
    
    
            layout.active = cam.dof.use_dof
    
            layout.use_property_split = True  # Active single-column layout
    
            flow = layout.grid_flow(
                row_major=True,
                columns=0,
                even_columns=True,
                even_rows=False,
                align=False,
            )
    
            col = flow.column()
            col.label(text="F-Stop value will export as")
    
            col.label(
                text="POV aperture : "
                + "%.3f" % (1 / cam.dof.aperture_fstop * 1000)
            )
    
            col = flow.column()
    
            col.prop(cam.pov, "dof_samples_min")
            col.prop(cam.pov, "dof_samples_max")
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            col.prop(cam.pov, "dof_variance")
    
    class CAMERA_PT_POV_cam_nor(CameraDataButtonsPanel, Panel):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Use this class for camera normal perturbation buttons."""
    
    
        bl_label = "POV Perturbation"
    
        COMPAT_ENGINES = {'POVRAY_RENDER'}
    
        def draw_header(self, context):
            cam = context.camera
    
            self.layout.prop(cam.pov, "normal_enable", text="")
    
        def draw(self, context):
            layout = self.layout
    
            cam = context.camera