Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Raybaud <mauriceraybaud@hotmail.fr>2013-08-31 17:35:28 +0400
committerMaurice Raybaud <mauriceraybaud@hotmail.fr>2013-08-31 17:35:28 +0400
commite3469ffd06efaf241b77e46cc12309b199e0370e (patch)
treec653e6f6f9859c1e9af20fe9ef6dccb7e56677d4
parent03a8bde12fd96ebb72f97fd02f3dd44dc6889466 (diff)
*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äki
-rw-r--r--render_povray/__init__.py12
-rw-r--r--render_povray/render.py22
-rw-r--r--render_povray/ui.py20
3 files changed, 31 insertions, 23 deletions
diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index 140e8969..16a1e5da 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -411,12 +411,12 @@ class RenderPovSettingsTexture(PropertyGroup):
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="")
###############################################################################
diff --git a/render_povray/render.py b/render_povray/render.py
index ce660024..f7c80d9a 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -1252,6 +1252,10 @@ def write_pov(filename, scene=None, info_callback=None):
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 @@ def write_pov(filename, scene=None, info_callback=None):
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 @@ def write_pov(filename, scene=None, info_callback=None):
file.write("#version 3.7;\n")
if not scene.pov.tempfiles_enable and comments:
- file.write("\n//--CUSTOM CODE--\n\n")
- exportCustomCode()
-
- if not scene.pov.tempfiles_enable and comments:
- file.write("\n//--Global settings and background--\n\n")
+ file.write("\n//--Global settings--\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)
diff --git a/render_povray/ui.py b/render_povray/ui.py
index d53f2804..7334909c 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -518,19 +518,19 @@ class TEXTURE_PT_povray_tex_gamma(TextureButtonsPanel, bpy.types.Panel):
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):