I've created an Addon which create a standard Light Rig with parameters for adjusting light intensity and color. After executing the code, the parameter of color shows in the addon while the one which associated to intensity doesn't display.
Before creating the script, I used the python console to help me to create the addon.
The code to access/get the color of the light (bpy.context.object.data.color)and that of (bpy.context.object.data.energy) appear to be similar.
So I created the script below to try to create the attributes to change light intensity and color. But it seems it only works for color but not for intensity. I have looked up the documentation and have been thinking about using PointerProperty to get the intensity by bpy.types.AreaLight from bpy.types.Light and bpy.types.Object. But it doesn't work and it's not displayed in my Addon.
import bpy from bpy.props import FloatProperty, FloatVectorProperty
class LightSetPanel(bpy.types.Panel):
bl_label = "Lighting Rig Add-On"
bl_idname = "LIGHT_PT_PANEL"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Light Rig"
def draw(self, context):
layout = self.layout
row = layout.row()
row.operator("light.rig_operator")
ob = bpy.context.active_object
da = ob.data
row=layout.row()
row.prop(da,"color")
row= layout.row()
row.prop(da, "intensity")
def updateIntensity(self,context):
obj = bpy.context.active_object
light = obj.data
light.energy = self.intensity
light.color = self.color
class LightParamSet(bpy.types.PropertyGroup):
intensity: FloatProperty(
name="intensity",
subtype="POWER",
min=0, max= 12,
update = updateIntensity)
color : FloatVectorProperty(
name="color",
subtype="COLOR",
update = updateIntensity)
def register():
bpy.utils.register_class(LightSetPanel)
bpy.utils.register_class(LIGHT_RIG)
bpy.utils.register_class(LightParamSet)
def unregister():
bpy.utils.unregister_class(LightSetPanel)
bpy.utils.unregister_class(LIGHT_RIG)
bpy.utils.unregister_class(LightParamSet)
if name == "main":
register()
The screenshot of the Addon after executing the Python script.
A big thanks if anyone can help.

bpy.types.Scene.my_tool = PointerProperty(type=LightParamSet), this way you can access your properties per scene reference:context.scene.my_tool.intensity, and thusrow.prop(context.scene.my_tool, "intensity")in the layout, read: How to create a custom UI? – brockmann Apr 16 '21 at 10:23