Level up your Python skills with argument parsing

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024

Комментарии • 10

  • @warpedworks2177
    @warpedworks2177 5 месяцев назад

    This is incredibly helpful

  •  Год назад

    Very informative. Thank you!

    • @CGPython
      @CGPython  Год назад

      You're welcome! 😊

  • @mind_of_a_darkhorse
    @mind_of_a_darkhorse Год назад

    Great tutorial! Could you cover the use of Bmesh?!

    • @CGPython
      @CGPython  Год назад

      Thanks!
      Yes I can
      Is there anything, in particular, you need help with, or you don't understand about bmesh?

    • @mind_of_a_darkhorse
      @mind_of_a_darkhorse Год назад

      @@CGPython I semi-understand it, but what are the best practices for its use.

  • @ironmark3202
    @ironmark3202 Год назад

    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()

    • @CGPython
      @CGPython  Год назад

      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

  • @ironmark3202
    @ironmark3202 Год назад

    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

    • @CGPython
      @CGPython  Год назад

      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:
      ruclips.net/video/nmJqIaSZlRs/видео.html