It exports and renders successfully... except there are no objects. Just a blank background.
78 lines
3.2 KiB
Python
78 lines
3.2 KiB
Python
import bpy
|
|
|
|
from .util import escape_name, mat2str, needs_def_mb, needs_xform_mb, ExportCancelled
|
|
|
|
class Material:
|
|
def __init__(self, render_engine, depsgraph, material):
|
|
self.mat = material
|
|
|
|
def take_sample(self, render_engine, depsgraph, time):
|
|
# TODO: motion blur of material settings
|
|
pass
|
|
|
|
def export(self, render_engine, w):
|
|
render_engine.update_stats("", "Psychopath: Exporting %s" % self.mat.name)
|
|
|
|
w.write("SurfaceShader $%s {\n" % escape_name(self.mat.name))
|
|
w.indent()
|
|
if self.mat.psychopath.surface_shader_type == 'Emit':
|
|
w.write("Type [Emit]\n")
|
|
if self.mat.psychopath.color_type == 'Rec709':
|
|
col = self.mat.psychopath.color
|
|
w.write("Color [rec709, %f %f %f]\n" % (
|
|
col[0], col[1], col[2],
|
|
))
|
|
elif self.mat.psychopath.color_type == 'Blackbody':
|
|
w.write("Color [blackbody, %f %f]\n" % (
|
|
self.mat.psychopath.color_blackbody_temp,
|
|
1.0,
|
|
))
|
|
elif self.mat.psychopath.color_type == 'ColorTemperature':
|
|
w.write("Color [color_temperature, %f %f]\n" % (
|
|
self.mat.psychopath.color_blackbody_temp,
|
|
1.0,
|
|
))
|
|
elif self.mat.psychopath.surface_shader_type == 'Lambert':
|
|
w.write("Type [Lambert]\n")
|
|
if self.mat.psychopath.color_type == 'Rec709':
|
|
col = self.mat.psychopath.color
|
|
w.write("Color [rec709, %f %f %f]\n" % (
|
|
col[0], col[1], col[2],
|
|
))
|
|
elif self.mat.psychopath.color_type == 'Blackbody':
|
|
w.write("Color [blackbody, %f %f]\n" % (
|
|
self.mat.psychopath.color_blackbody_temp,
|
|
1.0,
|
|
))
|
|
elif self.mat.psychopath.color_type == 'ColorTemperature':
|
|
w.write("Color [color_temperature, %f %f]\n" % (
|
|
self.mat.psychopath.color_blackbody_temp,
|
|
1.0,
|
|
))
|
|
elif self.mat.psychopath.surface_shader_type == 'GGX':
|
|
w.write("Type [GGX]\n")
|
|
if self.mat.psychopath.color_type == 'Rec709':
|
|
col = self.mat.psychopath.color
|
|
w.write("Color [rec709, %f %f %f]\n" % (
|
|
col[0], col[1], col[2],
|
|
))
|
|
elif self.mat.psychopath.color_type == 'Blackbody':
|
|
w.write("Color [blackbody, %f %f]\n" % (
|
|
self.mat.psychopath.color_blackbody_temp,
|
|
1.0,
|
|
))
|
|
elif self.mat.psychopath.color_type == 'ColorTemperature':
|
|
w.write("Color [color_temperature, %f %f]\n" % (
|
|
self.mat.psychopath.color_blackbody_temp,
|
|
1.0,
|
|
))
|
|
w.write("Roughness [%f]\n" % self.mat.psychopath.roughness)
|
|
w.write("Fresnel [%f]\n" % self.mat.psychopath.fresnel)
|
|
else:
|
|
raise "Unsupported surface shader type '%s'" % self.mat.psychopath.surface_shader_type
|
|
w.unindent()
|
|
w.write("}\n")
|
|
|
|
def cleanup(self):
|
|
pass
|