[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4717] trunk/py/scripts/addons/ render_povray: *Fixed one bug with multi-materials bearing custom pov code

Campbell Barton ideasman42 at gmail.com
Tue Sep 3 05:53:59 CEST 2013


sent previous mail be accident.

if material.pov.replacement_text != "":

This is incorrect, material is defined in a loop above, and for meshes
with no materials its not defined at all and raises an exception.

Currently the way it works is by using the last material accessed,
which seems rather arbitrary.

On Sat, Aug 31, 2013 at 11:35 PM, Maurice Raybaud
<mauriceraybaud at hotmail.fr> wrote:
> Revision: 4717
>           http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4717
> Author:   mauriceraybaud
> Date:     2013-08-31 13:35:28 +0000 (Sat, 31 Aug 2013)
> Log Message:
> -----------
> *Fixed one bug with multi-materials bearing custom pov code
> *Commented out a property that was not yet implemented in exporter
> *Added frame number export for hand made pov animation
> Thanks to a patch made by Markku Myllym?\195?\164ki
>
> Modified Paths:
> --------------
>     trunk/py/scripts/addons/render_povray/__init__.py
>     trunk/py/scripts/addons/render_povray/render.py
>     trunk/py/scripts/addons/render_povray/ui.py
>
> Modified: trunk/py/scripts/addons/render_povray/__init__.py
> ===================================================================
> --- trunk/py/scripts/addons/render_povray/__init__.py   2013-08-31 08:01:59 UTC (rev 4716)
> +++ trunk/py/scripts/addons/render_povray/__init__.py   2013-08-31 13:35:28 UTC (rev 4717)
> @@ -411,12 +411,12 @@
>              min=0.45, max=5.00, soft_min=1.00, soft_max=2.50, default=1.00)
>
>      ##################################CustomPOV Code############################
> -    #Only DUMMIES below for now:
> -    replacement_text = StringProperty(
> -            name="Declared name:",
> -            description="Type the declared name in custom POV code or an external .inc "
> -                        "it points at. pigment {} expected",
> -            default="")
> +    #commented out below if we wanted custom pov code in texture only, inside exported material:
> +    #replacement_text = StringProperty(
> +    #        name="Declared name:",
> +    #        description="Type the declared name in custom POV code or an external .inc "
> +    #                    "it points at. pigment {} expected",
> +    #        default="")
>
>
>  ###############################################################################
>
> Modified: trunk/py/scripts/addons/render_povray/render.py
> ===================================================================
> --- trunk/py/scripts/addons/render_povray/render.py     2013-08-31 08:01:59 UTC (rev 4716)
> +++ trunk/py/scripts/addons/render_povray/render.py     2013-08-31 13:35:28 UTC (rev 4717)
> @@ -1252,6 +1252,10 @@
>                                  file.write("\n #declare MAT_%s = \ntexture{\n" % currentMatName)
>
>                                  ################################################################################
> +
> +                                if material.pov.replacement_text != "":
> +                                    file.write("%s\n" % material.pov.replacement_text)
> +                                #################################################################################
>                                  if material.diffuse_shader == 'MINNAERT':
>                                      tabWrite("\n")
>                                      tabWrite("aoi\n")
> @@ -1971,7 +1975,10 @@
>          tabWrite("}\n")
>
>      def exportCustomCode():
> -
> +        # Write CurrentAnimation Frame for use in Custom POV Code
> +        file.write("#declare CURFRAMENUM = %d;\n" % bpy.context.scene.frame_current)
> +        #Change path and uncomment to add an animated include file by hand:
> +        file.write("//#include \"/home/user/directory/animation_include_file.inc\"\n")
>          for txt in bpy.data.texts:
>              if txt.pov.custom_code:
>                  # Why are the newlines needed?
> @@ -1988,16 +1995,17 @@
>      file.write("#version 3.7;\n")
>
>      if not scene.pov.tempfiles_enable and comments:
> -        file.write("\n//--CUSTOM CODE--\n\n")
> -    exportCustomCode()
> +        file.write("\n//--Global settings--\n\n")
>
> -    if not scene.pov.tempfiles_enable and comments:
> -        file.write("\n//--Global settings and background--\n\n")
> -
>      exportGlobalSettings(scene)
>
> +
>      if not scene.pov.tempfiles_enable and comments:
> -        file.write("\n")
> +        file.write("\n//--Custom Code--\n\n")
> +    exportCustomCode()
> +
> +    if not scene.pov.tempfiles_enable and comments:
> +        file.write("\n//--Background--\n\n")
>
>      exportWorld(scene.world)
>
>
> Modified: trunk/py/scripts/addons/render_povray/ui.py
> ===================================================================
> --- trunk/py/scripts/addons/render_povray/ui.py 2013-08-31 08:01:59 UTC (rev 4716)
> +++ trunk/py/scripts/addons/render_povray/ui.py 2013-08-31 13:35:28 UTC (rev 4717)
> @@ -518,21 +518,21 @@
>          layout.active = tex.pov.tex_gamma_enable
>          layout.prop(tex.pov, "tex_gamma_value", text="Gamma Value")
>
> +#commented out below UI for texture only custom code inside exported material:
> +# class TEXTURE_PT_povray_replacement_text(TextureButtonsPanel, bpy.types.Panel):
> +    # bl_label = "Custom POV Code"
> +    # COMPAT_ENGINES = {'POVRAY_RENDER'}
>
> -class TEXTURE_PT_povray_replacement_text(TextureButtonsPanel, bpy.types.Panel):
> -    bl_label = "Custom POV Code"
> -    COMPAT_ENGINES = {'POVRAY_RENDER'}
> +    # def draw(self, context):
> +        # layout = self.layout
>
> -    def draw(self, context):
> -        layout = self.layout
> +        # tex = context.texture
>
> -        tex = context.texture
> +        # col = layout.column()
> +        # col.label(text="Replace properties with:")
> +        # col.prop(tex.pov, "replacement_text", text="")
>
> -        col = layout.column()
> -        col.label(text="Replace properties with:")
> -        col.prop(tex.pov, "replacement_text", text="")
>
> -
>  class OBJECT_PT_povray_obj_importance(ObjectButtonsPanel, bpy.types.Panel):
>      bl_label = "POV-Ray"
>      COMPAT_ENGINES = {'POVRAY_RENDER'}
>
> _______________________________________________
> Bf-extensions-cvs mailing list
> Bf-extensions-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-extensions-cvs



-- 
- Campbell


More information about the Bf-extensions-cvs mailing list