more work on the composite material
parent
5594d2ba5e
commit
213f7d44d3
|
@ -5,6 +5,7 @@ import bpy
|
|||
|
||||
from extensions_framework import declarative_property_group
|
||||
from extensions_framework import util as efutil
|
||||
from extensions_framework.validate import Logic_Operator
|
||||
from mitsuba.properties.texture import TextureParameter
|
||||
from mitsuba.export import ParamSet
|
||||
|
||||
|
@ -513,7 +514,7 @@ class WeightedMaterialParameter:
|
|||
self.propertyGroup = propertyGroup
|
||||
|
||||
def get_controls(self):
|
||||
return [ ['%s_material' % self.name, .8, '%s_weight' % self.name ]]
|
||||
return [ ['%s_material' % self.name, .7, '%s_weight' % self.name ]]
|
||||
|
||||
def get_properties(self):
|
||||
return [
|
||||
|
@ -545,9 +546,17 @@ class WeightedMaterialParameter:
|
|||
|
||||
|
||||
param_mat = []
|
||||
for i in range(0, 6):
|
||||
for i in range(1, 6):
|
||||
param_mat.append(WeightedMaterialParameter("mat%i" % i, "Material %i" % i, "mitsuba_mat_composite"));
|
||||
|
||||
|
||||
def mitsuba_mat_composite_visibility():
|
||||
result = {}
|
||||
for i in range(2, 6):
|
||||
result["mat%i_material" % i] = {'nElements' : Logic_Operator({'gte' : i})}
|
||||
result["mat%i_weight" % i] = {'nElements' : Logic_Operator({'gte' : i})}
|
||||
return result
|
||||
|
||||
class mitsuba_mat_composite(declarative_property_group):
|
||||
controls = [
|
||||
'nElements'
|
||||
|
@ -565,3 +574,10 @@ class mitsuba_mat_composite(declarative_property_group):
|
|||
'save_in_preset': True
|
||||
}
|
||||
] + sum(map(lambda x: x.get_properties(), param_mat), [])
|
||||
|
||||
visibility = mitsuba_mat_composite_visibility()
|
||||
|
||||
def get_params(self):
|
||||
params = ParamSet()
|
||||
return params
|
||||
|
||||
|
|
|
@ -28,3 +28,14 @@ class ui_material_composite(mitsuba_material_sub, bpy.types.Panel):
|
|||
display_property_groups = [
|
||||
( ('material', 'mitsuba_material'), 'mitsuba_mat_composite' )
|
||||
]
|
||||
|
||||
def draw(self, context):
|
||||
super().draw(context)
|
||||
|
||||
mat = context.material.mitsuba_material.mitsuba_mat_composite
|
||||
weight = 0
|
||||
for i in range(1,mat.nElements+1):
|
||||
weight += getattr(mat, "mat%i_weight" % i)
|
||||
if weight > 1:
|
||||
row = self.layout.row()
|
||||
row.label("Warning: material weights sum to >1")
|
||||
|
|
|
@ -44,7 +44,6 @@ class setup_preset(render_described_context, bpy.types.Panel):
|
|||
|
||||
super().draw(context)
|
||||
|
||||
|
||||
class engine(render_described_context, bpy.types.Panel):
|
||||
'''
|
||||
Engine settings UI Panel
|
||||
|
|
Loading…
Reference in New Issue