diff --git a/render_povray/__init__.py b/render_povray/__init__.py index 140e89695ea3af4274e5ed4ee0b858a74112802e..16a1e5da75868eeb2a9992230a413c9bf483e0d5 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 ce660024a40aab45a7fd7cd689d753ef06126eb9..f7c80d9a5c9ad32b395fb891f5e2411a5142f78f 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 d53f28041b60a9315eaf31004aa4eed0518dd3df..7334909c4955380203085dd99d052c0bc5f706fd 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):