[Bf-extensions-cvs] [26380479] master: *Converted some rgb keywords to srgb to better match Blender Internal shading *added an operator to render from text editor 3 modes: 3dview, pov text only or both. this property replaces the custompov code (with "both" option) known problem is that some scenes get their rendered image passed to render results while others don't. Still useable for preview anyway.
Maurice Raybaud
noreply at git.blender.org
Thu Jul 27 23:36:19 CEST 2017
Commit: 263804791ab703c492142bc160313e235dbad0cb
Author: Maurice Raybaud
Date: Thu Jul 27 23:36:09 2017 +0200
Branches: master
https://developer.blender.org/rBA263804791ab703c492142bc160313e235dbad0cb
*Converted some rgb keywords to srgb to better match Blender Internal shading
*added an operator to render from text editor 3 modes:
3dview, pov text only or both.
this property replaces the custompov code (with "both" option)
known problem is that some scenes get their rendered image passed to render results while others don't. Still useable for preview anyway.
===================================================================
M render_povray/__init__.py
M render_povray/render.py
M render_povray/ui.py
===================================================================
diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index 911bf913..0c0aee46 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -73,6 +73,11 @@ def string_strip_hyphen(name):
###############################################################################
class RenderPovSettingsScene(PropertyGroup):
# File Options
+ text_block = StringProperty(
+ name="Text Scene Name",
+ description="Name of POV-Ray scene to use. "
+ "Set when clicking Run to render current text only",
+ maxlen=1024)
tempfiles_enable = BoolProperty(
name="Enable Tempfiles",
description="Enable the OS-Tempfiles. Otherwise set the path where"
@@ -2129,11 +2134,14 @@ class RenderPovSettingsCamera(PropertyGroup):
# Text POV properties.
###############################################################################
class RenderPovSettingsText(PropertyGroup):
- custom_code = BoolProperty(
+ custom_code = EnumProperty(
name="Custom Code",
- description="Add this text at the top of the exported POV-Ray file",
- default=False)
-
+ description="rendered source: Both adds text at the "
+ "top of the exported POV-Ray file",
+ items=(("3dview", "View", ""),
+ ("text", "Text", ""),
+ ("both", "Both", "")),
+ default="text")
###############################################################################
# Povray Preferences.
diff --git a/render_povray/render.py b/render_povray/render.py
index 4ce5bfc3..56b60d83 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -564,7 +564,7 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("light_source {\n")
tabWrite("< 0,0,0 >\n")
- tabWrite("color rgb<%.3g, %.3g, %.3g>\n" % color)
+ tabWrite("color srgb<%.3g, %.3g, %.3g>\n" % color)
if lamp.type == 'POINT':
pass
@@ -613,7 +613,7 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("fade_distance %.6f\n" % (lamp.distance / 2.0))
# Area lights have no falloff type, so always use blenders lamp quad equivalent
# for those?
- tabWrite("fade_power %d\n" % 2)
+ tabWrite("fade_power %d\n" % 0)
size_x = lamp.size
samples_x = lamp.shadow_ray_samples_x
if lamp.shape == 'SQUARE':
@@ -641,7 +641,7 @@ def write_pov(filename, scene=None, info_callback=None):
# Sun shouldn't be attenuated. Hemi and area lights have no falloff attribute so they
# are put to type 2 attenuation a little higher above.
if lamp.type not in {'SUN', 'AREA', 'HEMI'}:
- tabWrite("fade_distance %.6f\n" % (lamp.distance / 2.0))
+ tabWrite("fade_distance %.6f\n" % (lamp.distance / 10.0))
if lamp.falloff_type == 'INVERSE_SQUARE':
tabWrite("fade_power %d\n" % 2) # Use blenders lamp quad equivalent
elif lamp.falloff_type == 'INVERSE_LINEAR':
@@ -710,15 +710,15 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("direction <%.4f,%.4f,%.4f>\n"%rmatrix.translation[:])
tabWrite("up <%.4f,%.4f,%.4f>\n"%(up[0],up[1],up[2]))
tabWrite("color_map {\n")
- tabWrite("[0.000 color rgbt<1.0, 0.5, 1.0, 1.0>]\n")
- tabWrite("[0.130 color rgbt<0.5, 0.5, 1.0, 0.9>]\n")
- tabWrite("[0.298 color rgbt<0.2, 0.2, 1.0, 0.7>]\n")
- tabWrite("[0.412 color rgbt<0.2, 1.0, 1.0, 0.4>]\n")
- tabWrite("[0.526 color rgbt<0.2, 1.0, 0.2, 0.4>]\n")
- tabWrite("[0.640 color rgbt<1.0, 1.0, 0.2, 0.4>]\n")
- tabWrite("[0.754 color rgbt<1.0, 0.5, 0.2, 0.6>]\n")
- tabWrite("[0.900 color rgbt<1.0, 0.2, 0.2, 0.7>]\n")
- tabWrite("[1.000 color rgbt<1.0, 0.2, 0.2, 1.0>]\n")
+ tabWrite("[0.000 color srgbt<1.0, 0.5, 1.0, 1.0>]\n")
+ tabWrite("[0.130 color srgbt<0.5, 0.5, 1.0, 0.9>]\n")
+ tabWrite("[0.298 color srgbt<0.2, 0.2, 1.0, 0.7>]\n")
+ tabWrite("[0.412 color srgbt<0.2, 1.0, 1.0, 0.4>]\n")
+ tabWrite("[0.526 color srgbt<0.2, 1.0, 0.2, 0.4>]\n")
+ tabWrite("[0.640 color srgbt<1.0, 1.0, 0.2, 0.4>]\n")
+ tabWrite("[0.754 color srgbt<1.0, 0.5, 0.2, 0.6>]\n")
+ tabWrite("[0.900 color srgbt<1.0, 0.2, 0.2, 0.7>]\n")
+ tabWrite("[1.000 color srgbt<1.0, 0.2, 0.2, 1.0>]\n")
tabWrite("}\n")
@@ -1638,12 +1638,12 @@ def write_pov(filename, scene=None, info_callback=None):
else:
povFilter = 0.0
material_finish = materialNames[material.name]
- tabWrite("pigment {rgbft<%.3g, %.3g, %.3g, %.3g, %.3g>} \n" %
+ tabWrite("pigment {srgbft<%.3g, %.3g, %.3g, %.3g, %.3g>} \n" %
(diffuse_color[0], diffuse_color[1], diffuse_color[2],
povFilter, trans))
tabWrite("finish{%s} " % safety(material_finish, Level=2))
else:
- tabWrite("pigment{rgb 1} finish{%s} " % (safety(DEF_MAT_NAME, Level=2)))
+ tabWrite("pigment{srgb 1} finish{%s} " % (safety(DEF_MAT_NAME, Level=2)))
#writeObjectMaterial(material, ob)
writeObjectMaterial(material, elems[1])
tabWrite("radiosity{importance %3g}\n" % ob.pov.importance_value)
@@ -1701,13 +1701,13 @@ def write_pov(filename, scene=None, info_callback=None):
material_finish = materialNames[material.name]
- tabWrite("pigment {rgbft<%.3g, %.3g, %.3g, %.3g, %.3g>} \n" %
+ tabWrite("pigment {srgbft<%.3g, %.3g, %.3g, %.3g, %.3g>} \n" %
(diffuse_color[0], diffuse_color[1], diffuse_color[2],
povFilter, trans))
tabWrite("finish {%s}\n" % safety(material_finish, Level=2))
else:
- tabWrite("pigment {rgb 1} \n")
+ tabWrite("pigment {srgb 1} \n")
# Write the finish last.
tabWrite("finish {%s}\n" % (safety(DEF_MAT_NAME, Level=2)))
@@ -2115,7 +2115,7 @@ def write_pov(filename, scene=None, info_callback=None):
else:
if texturedHair:
# Write pigment and alpha (between Pov and Blender alpha 0 and 1 are reversed)
- file.write('\npigment{ color rgbf < %.3g, %.3g, %.3g, %.3g> }\n' %(initColor[0], initColor[1], initColor[2], 1.0-initColor[3]))
+ file.write('\npigment{ color srgbf < %.3g, %.3g, %.3g, %.3g> }\n' %(initColor[0], initColor[1], initColor[2], 1.0-initColor[3]))
# End the sphere_sweep declaration for this hair
file.write('}\n')
@@ -2135,7 +2135,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write('#ifndef (HairTexture)\n')
file.write(' #declare HairTexture = texture {\n')
- file.write(' pigment {rgbt <%s,%s,%s,%s>}\n' % (pmaterial.diffuse_color[0], pmaterial.diffuse_color[1], pmaterial.diffuse_color[2], (pmaterial.strand.width_fade + 0.05)))
+ file.write(' pigment {srgbt <%s,%s,%s,%s>}\n' % (pmaterial.diffuse_color[0], pmaterial.diffuse_color[1], pmaterial.diffuse_color[2], (pmaterial.strand.width_fade + 0.05)))
file.write(' }\n')
file.write('#end\n')
file.write('\n')
@@ -2765,9 +2765,9 @@ def write_pov(filename, scene=None, info_callback=None):
VcolIdx+=1
vertCols[key] = [VcolIdx]
if linebreaksinlists:
- tabWrite("texture {pigment{ color rgb <%6f,%6f,%6f> }}\n" % (col[0], col[1], col[2]))
+ tabWrite("texture {pigment{ color srgb <%6f,%6f,%6f> }}\n" % (col[0], col[1], col[2]))
else:
- tabWrite("texture {pigment{ color rgb <%6f,%6f,%6f> }}" % (col[0], col[1], col[2]))
+ tabWrite("texture {pigment{ color srgb <%6f,%6f,%6f> }}" % (col[0], col[1], col[2]))
tabStr = tab * tabLevel
else:
if material:
@@ -3442,7 +3442,7 @@ def write_pov(filename, scene=None, info_callback=None):
#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:
+ if txt.pov.custom_code == 'both':
# Why are the newlines needed?
file.write("\n")
file.write(txt.as_string())
@@ -3510,7 +3510,7 @@ def write_pov(filename, scene=None, info_callback=None):
if comments:
file.write("\n//--Material Definitions--\n\n")
# write a default pigment for objects with no material (comment out to show black)
- file.write("#default{ pigment{ color rgb 0.8 }}\n")
+ file.write("#default{ pigment{ color srgb 0.8 }}\n")
# Convert all materials to strings we can access directly per vertex.
#exportMaterials()
shading.writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments, uniqueName, materialNames, None) # default material
@@ -3716,15
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list