Sorry a bit late of a reaction, here the part of the code for the panel. I now have a extra check which hides the other one know. What i dont like about this is that the panel is jumping and shows different layout. The layout doesnt stay the same, which i prefer.
class DATA_PT_thea_Emittance(DataButtonsPanel, Panel): bl_label = "Emittance"
COMPAT_ENGINES = set(['THEA_RENDER'])
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
return (engine in cls.COMPAT_ENGINES)
def draw(self, context):
checked = False
layout = self.layout
lamp = context.lamp
row = layout.row()
if(lamp is not None):
if (lamp.thea_TextureFilename==""):
row.prop(lamp, "color", text="")
row.prop(lamp, "thea_TextureFilename")
split = layout.split()
colL = split.column()
colR = split.column()
if lamp.type in {'SPOT'} :
sub = colL
sub.enabled = lamp.thea_enableProjector == False
sub.prop(lamp, "thea_enableIES")
if lamp.type in {'SPOT'} and lamp.thea_enableIES:
colR.prop(lamp, "thea_IESFilename")
layout.prop(lamp, "thea_IESMultiplier")
row = layout.row()
split = layout.split()
colL = split.column()
colR = split.column()
if lamp.type in {'SPOT'} :
sub = row
sub.enabled = lamp.thea_enableIES == False
sub.prop(lamp, "thea_enableProjector")
if lamp.type in {'SPOT'} and lamp.thea_enableProjector:
colL.prop(lamp, "thea_ProjectorWidth")
colR.prop(lamp, "thea_ProjectorHeight")
split = layout.split()
split = layout.split()
colL = split.column()
colR = split.column()
split = layout.split()
if (lamp.thea_enableIES == False) and lamp.type != 'SUN':
colL.prop(lamp, "thea_EmittancePower")
# sub = row
# sub.enabled = lamp.thea_enableIES == False
# sub.prop(lamp, "thea_enableProjector")
layout.prop(lamp, "thea_EmittanceEfficacy")
if lamp.type == 'SUN':
colL.prop(lamp, "thea_EmittancePower")
colR.prop(lamp, "thea_SunEmittanceUnit")
layout.prop(lamp, "thea_SunAttenuation")
elif (lamp.thea_enableIES == False):
colR.prop(lamp, "thea_EmittanceUnit")
# CHANGED > Added Sun for attenuation
if lamp.type in {'POINT', 'SPOT', 'AREA'}:
layout.prop(lamp, "thea_EmittanceAttenuation")
#sub.prop(lamp, "distance")
# if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED':
# col.label(text="Attenuation Factors:")
# sub = col.column(align=True)
# sub.prop(lamp, "linear_attenuation", slider=True, text="Linear")
# sub.prop(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
#col.prop(lamp, "use_sphere")
if lamp.type == 'AREA':
col.prop(lamp, "distance")
col.prop(lamp, "gamma")
EDIT
Sorry i build something in which prevents 2 options be active, that was my workaround. I also made one or the other inactive when one is checked so they cant be active at the same time