Page Menu
Home
Search
Configure Global Search
Log In
Files
F76002
dynamic_enum_multiselect_enum_flag.py
Public
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
codemanx
Feb 4 2014, 7:55 PM
Size
1 KB
Subscribers
None
dynamic_enum_multiselect_enum_flag.py
View Options
import
bpy
class
HelloWorldPanel
(
bpy
.
types
.
Panel
):
"""Creates a Panel in the Object properties window"""
bl_label
=
"Hello World Panel"
bl_idname
=
"OBJECT_PT_hello"
bl_space_type
=
'PROPERTIES'
bl_region_type
=
'WINDOW'
bl_context
=
"object"
def
draw
(
self
,
context
):
layout
=
self
.
layout
layout
.
prop
(
context
.
scene
,
"prop1"
)
layout
.
prop
(
context
.
scene
,
"prop2"
)
def
items_prop1
(
self
,
context
):
types
=
{
ob
.
type
:
ob
.
type
for
ob
in
context
.
scene
.
objects
}
return
[(
t
,
t
,
""
)
for
t
in
types
]
def
items_prop2
(
self
,
context
):
return
[(
ob
.
name
,
ob
.
name
,
""
)
for
ob
in
context
.
scene
.
objects
if
ob
.
type
in
context
.
scene
.
prop1
]
def
update_prop1
(
self
,
context
):
print
(
"Prop1 changed to"
,
context
.
scene
.
prop1
)
def
update_prop2
(
self
,
context
):
print
(
"Prop2 changed to"
,
context
.
scene
.
prop2
)
def
register
():
bpy
.
utils
.
register_class
(
HelloWorldPanel
)
bpy
.
types
.
Scene
.
prop1
=
bpy
.
props
.
EnumProperty
(
items
=
items_prop1
,
update
=
update_prop1
,
options
=
{
'ENUM_FLAG'
})
bpy
.
types
.
Scene
.
prop2
=
bpy
.
props
.
EnumProperty
(
items
=
items_prop2
,
update
=
update_prop2
)
def
unregister
():
bpy
.
utils
.
unregister_class
(
HelloWorldPanel
)
del
bpy
.
types
.
Scene
.
prop1
del
bpy
.
types
.
Scene
.
prop2
if
__name__
==
"__main__"
:
register
()
File Metadata
Details
Mime Type
text/x-c++
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
07/5a/d91dd51b3bc26f6815554391dccf
Event Timeline
Log In to Comment