graphic:python:blender

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
graphic:python:blender [2024/01/25 06:12] – [Blender variable naming standards] yinggraphic:python:blender [2024/01/31 08:00] – [Blender variable naming standards] ying
Line 393: Line 393:
 ref:  ref: 
   * https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Addons   * https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Addons
 +  * https://developer.blender.org/docs/release_notes/2.80/python_api/addons/
   * https://s-nako.work/2020/12/blender-addon-naming-rules/   * https://s-nako.work/2020/12/blender-addon-naming-rules/
 +  * https://b3d.interplanety.org/en/class-naming-conventions-in-blender-2-8-python-api/
  
   * **Class name convention**: UPPER_CASE_{SEPARATOR}_mixed_case   * **Class name convention**: UPPER_CASE_{SEPARATOR}_mixed_case
Line 422: Line 424:
  
 Example of class name, balancing between Python PEP Example of class name, balancing between Python PEP
-  * BLOSM addon, <code python>+  * example addon, <code python> 
 +class BUILDMAKER_OT_CreateAsset(bpy.types.Operator): 
 +    bl_idname = "custom.buildmaker_create_asset" 
 +     
 +class CreateAsset(bpy.types.Operator): 
 +    bl_idname = "BUILDMAKER_OT_CreateAsset"
  
 +class BUILDMAKER_OT_createAsset(bpy.types.Operator):
 +
 +# 2.8x onwards, property
 +class MyOperator(bpy.types.Operator):
 +    value: IntProperty()
 +
 +class ToolProperties(bpy.types.PropertyGroup):
 +    commandLineMode: bpy.props.BoolProperty(
 +        name = "Command line mode",
 +        description = "The option specifies if the addon is used in the command line mode",
 +        default = False
 +    ) 
 +    
 +class ToolProps(bpy.types.PropertyGroup):
 +    email : StringProperty(
 +        name="email",
 +        description="User email",
 +        default=""
 +    )
 +class TOOL_PROPS(bpy.types.PropertyGroup):
 +    lon: FloatProperty()
 +    lat: FloatProperty()
 +class BUILDMAKER_PG_color(PropertyGroup):
 +    color: FloatVectorProperty(subtype='COLOR', min=0, max=1, update=updColor, size=4)
 </code> </code>
 ===== common blender api commands ===== ===== common blender api commands =====
Line 544: Line 575:
 **UI** **UI**
   * bpy.types.Panel   * bpy.types.Panel
 +    * the panel display order is determined by the order bpy.utils.register_class processes
   * bpy.types.UIList   * bpy.types.UIList
   * bpy.types.Operator   * bpy.types.Operator
  • graphic/python/blender.txt
  • Last modified: 2024/05/20 03:26
  • by ying