Skip to content

Instantly share code, notes, and snippets.

@nutti
Created April 6, 2015 10:00
Show Gist options
  • Save nutti/d4c61216e0b55584226f to your computer and use it in GitHub Desktop.
Save nutti/d4c61216e0b55584226f to your computer and use it in GitHub Desktop.
[Blender] EnumPropertyの選択項目を動的に設定する方法 ref: http://qiita.com/nutti/items/9ec0a61d182350e44319
import bpy
from bpy.props import *
# セレクトボックスに表示したい項目リストを作成する関数
def get_object_list_callback(scene, context):
items = []
# itemsに項目を追加する処理...
return items
object_list = EnumProperty(
name = "Object List", # 名称
description = "Object List", # 説明文
items = get_object_list_callback) # 項目リストを作成する関数
import bpy
from by.props import *
# セレクトボックスに表示したい項目
axis = (
("X", "X-axis", ""), # (識別子, UI表示名, 説明文)
("Y", "Y-axis", ""),
("Z", "Z-axis", ""))
transform_axis = EnumProperty(
name = "Transform Axis", # 名称
description = "Transform Axis", # 説明文
items = axis) # セレクトボックスに表示したい項目リスト
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment