提交 7a6ca03b 编写于 作者: V Vitaly Ovchinnikov

added double-sided option

上级 775dca6f
......@@ -116,6 +116,7 @@ bpy.types.Material.THREE_blending_type = EnumProperty(
bpy.types.Material.THREE_depth_write = BoolProperty(default=True)
bpy.types.Material.THREE_depth_test = BoolProperty(default=True)
bpy.types.Material.THREE_double_sided = BoolProperty(default=False)
class ThreeMaterial(bpy.types.Panel):
"""Adds custom properties to the Materials of an object"""
......@@ -150,6 +151,10 @@ class ThreeMaterial(bpy.types.Panel):
row.prop(mat, 'THREE_depth_test',
text="Enable depth testing")
row = layout.row()
row.prop(mat, 'THREE_double_sided',
text="Double-sided")
def _mag_filters(index):
"""Three.js mag filters
......
......@@ -302,6 +302,8 @@ NORMAL_BLENDING = 0
VERTEX_COLORS_ON = 2
VERTEX_COLORS_OFF = 0
SIDE_DOUBLE = 2
THREE_BASIC = 'MeshBasicMaterial'
THREE_LAMBERT = 'MeshLambertMaterial'
THREE_PHONG = 'MeshPhongMaterial'
......
......@@ -124,6 +124,24 @@ def depth_write(material):
return write
@_material
def double_sided(material):
"""
:param material:
:return: THREE_double_sided value
:rtype: bool
"""
logger.debug("material.double_sided(%s)", material)
try:
write = material.THREE_double_sided
except AttributeError:
logger.debug("No THREE_double_sided attribute found")
write = False
return write
@_material
def diffuse_color(material):
"""
......
......@@ -46,6 +46,9 @@ class Material(base_classes.BaseNode):
if api.material.transparent(self.node):
self[constants.TRANSPARENT] = True
if api.material.double_sided(self.node):
self[constants.SIDE] = constants.SIDE_DOUBLE
self[constants.DEPTH_TEST] = api.material.depth_test(self.node)
self[constants.DEPTH_WRITE] = api.material.depth_write(self.node)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册