I create this but i have a problem in this When i try to change the light name it not changing actual name of light class LIGHT_UL_light_list(bpy.types.UIList): """ UIList subclass for displaying light objects in the Blender UI. """ def draw_item(self, context, layout, data, item, icon, active_data, active_propname): if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(item, "name", text="", emboss=False) elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' layout.label(text="", icon_value=icon) class LightPanel(bpy.types.Panel): """ Panel class for managing lighting in Blender's UI. """ bl_idname = "OBJECT_PT_light_panel" bl_label = "Lighting" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = 'Light Manager' def draw(self, context): """ Draws the panel with lighting options in the Blender UI. """ layout = self.layout scene = context.scene layout.template_list("LIGHT_UL_light_list", "", bpy.data, "lights", scene, "active_light_index") def register(): bpy.utils.register_class(LIGHT_UL_light_list) bpy.utils.register_class(LightPanel) bpy.types.Scene.active_light_index = bpy.props.IntProperty() def unregister(): bpy.utils.unregister_class(LightPanel) bpy.utils.unregister_class(LIGHT_UL_light_list) del bpy.types.Scene.active_light_index if __name__ == "__main__": register()
You need to change the object name, not the data name do this 1 open a new scene 2 delete everything from the scene 3 create a new script 4 copy & paste & run this gist.github.com/CGArtPython/f4d1fc945d0ca0b483144ae695a20b27
Hello sir I'm going to write a blender addon script for light Tell me how to make a custom UI list using ( template_list ) I'm not good in python scripting
Thank you for your suggestion. I will need to create a video on this topic. Diving into UI development without some Python basics will be hard, but it doesn't have to be. I would recommend starting with this playlist to get more comfortable with Python in Blender: th-cam.com/video/nmJqIaSZlRs/w-d-xo.html
This is incredibly helpful
Very informative. Thank you!
You're welcome! 😊
Great tutorial! Could you cover the use of Bmesh?!
Thanks!
Yes I can
Is there anything, in particular, you need help with, or you don't understand about bmesh?
@@CGPython I semi-understand it, but what are the best practices for its use.
I create this but i have a problem in this
When i try to change the light name it not changing actual name of light
class LIGHT_UL_light_list(bpy.types.UIList):
"""
UIList subclass for displaying light objects in the Blender UI.
"""
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.prop(item, "name", text="", emboss=False)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label(text="", icon_value=icon)
class LightPanel(bpy.types.Panel):
"""
Panel class for managing lighting in Blender's UI.
"""
bl_idname = "OBJECT_PT_light_panel"
bl_label = "Lighting"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'Light Manager'
def draw(self, context):
"""
Draws the panel with lighting options in the Blender UI.
"""
layout = self.layout
scene = context.scene
layout.template_list("LIGHT_UL_light_list", "", bpy.data, "lights", scene, "active_light_index")
def register():
bpy.utils.register_class(LIGHT_UL_light_list)
bpy.utils.register_class(LightPanel)
bpy.types.Scene.active_light_index = bpy.props.IntProperty()
def unregister():
bpy.utils.unregister_class(LightPanel)
bpy.utils.unregister_class(LIGHT_UL_light_list)
del bpy.types.Scene.active_light_index
if __name__ == "__main__":
register()
You need to change the object name, not the data name
do this
1 open a new scene
2 delete everything from the scene
3 create a new script
4 copy & paste & run this gist.github.com/CGArtPython/f4d1fc945d0ca0b483144ae695a20b27
Hello sir
I'm going to write a blender addon script for light
Tell me how to make a custom UI list using ( template_list )
I'm not good in python scripting
Thank you for your suggestion.
I will need to create a video on this topic.
Diving into UI development without some Python basics will be hard, but it doesn't have to be.
I would recommend starting with this playlist to get more comfortable with Python in Blender:
th-cam.com/video/nmJqIaSZlRs/w-d-xo.html