Page Menu
Home
Search
Configure Global Search
Log In
Files
F7857838
activate_init_bug_test.py
Ryan Inch (Imaginer)
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Ryan Inch (Imaginer)
Oct 26 2019, 6:37 AM
Size
3 KB
Subscribers
None
activate_init_bug_test.py
View Options
bl_info
=
{
"name"
:
"Activate Init Bug Test"
,
"description"
:
""
,
"author"
:
"Ryan Inch"
,
"version"
:
(
1
,
0
),
"blender"
:
(
2
,
80
,
0
),
"location"
:
""
,
"warning"
:
''
,
# used for warning icon and text in addons panel
"wiki_url"
:
""
,
"category"
:
"User Interface"
}
import
bpy
from
bpy.props
import
(
CollectionProperty
,
IntProperty
,
StringProperty
,
)
from
bpy.types
import
(
Operator
,
Panel
,
UIList
,
UI_UL_list
,
PropertyGroup
,
)
class
AIBTPopupTest
(
Operator
):
bl_label
=
"Popup Test"
bl_idname
=
"view3d.aibt_popup_test"
test
=
True
def
draw
(
self
,
context
):
layout
=
self
.
layout
scn
=
context
.
scene
row
=
layout
.
row
()
if
self
.
test
:
row
.
activate_init
=
True
self
.
test
=
False
row
.
prop
(
context
.
scene
,
"name"
,
text
=
""
,
expand
=
True
)
layout
.
separator
()
layout
.
separator
()
layout
.
separator
()
layout
.
separator
()
def
execute
(
self
,
context
):
wm
=
context
.
window_manager
return
wm
.
invoke_popup
(
self
)
class
AIBTListCollection
(
PropertyGroup
):
name
:
StringProperty
()
class
AIBTListTest
(
Operator
):
bl_label
=
"UI List Test"
bl_idname
=
"view3d.aibt_list_test"
def
draw
(
self
,
context
):
layout
=
self
.
layout
scn
=
context
.
scene
layout
.
row
()
.
template_list
(
"AIBT_UL_items"
,
""
,
scn
,
"AIBTListCollection"
,
scn
,
"AIBTListIndex"
,
rows
=
15
,
sort_lock
=
True
)
def
execute
(
self
,
context
):
wm
=
context
.
window_manager
new_cm_listitem
=
context
.
scene
.
AIBTListCollection
.
add
()
new_cm_listitem
.
name
=
"Test"
return
wm
.
invoke_popup
(
self
)
class
AIBT_UL_items
(
UIList
):
test
=
True
def
draw_item
(
self
,
context
,
layout
,
data
,
item
,
icon
,
active_data
,
active_propname
,
index
):
scn
=
context
.
scene
row
=
layout
.
row
()
if
self
.
test
:
row
.
activate_init
=
True
self
.
test
=
False
row
.
prop
(
context
.
scene
,
"name"
,
text
=
""
,
expand
=
True
)
def
invoke
(
self
,
context
,
event
):
pass
class
TestPanel
(
Panel
):
bl_label
=
"Test Panel"
bl_idname
=
"AIBT_PT_test_panel"
bl_space_type
=
'PROPERTIES'
bl_region_type
=
'WINDOW'
test
=
True
def
draw
(
self
,
context
):
layout
=
self
.
layout
row
=
layout
.
row
()
if
self
.
test
:
row
.
activate_init
=
True
self
.
test
=
False
row
.
prop
(
context
.
scene
,
"name"
)
classes
=
(
AIBTPopupTest
,
AIBTListCollection
,
AIBTListTest
,
AIBT_UL_items
,
TestPanel
,
)
addon_keymaps
=
[]
def
register
():
for
cls
in
classes
:
bpy
.
utils
.
register_class
(
cls
)
bpy
.
types
.
Scene
.
AIBTListCollection
=
CollectionProperty
(
type
=
AIBTListCollection
)
bpy
.
types
.
Scene
.
AIBTListIndex
=
IntProperty
()
# create the global menu hotkey
wm
=
bpy
.
context
.
window_manager
km
=
wm
.
keyconfigs
.
addon
.
keymaps
.
new
(
name
=
'Object Mode'
)
kmi
=
km
.
keymap_items
.
new
(
'view3d.aibt_list_test'
,
'T'
,
'PRESS'
,
ctrl
=
True
)
addon_keymaps
.
append
((
km
,
kmi
))
km
=
wm
.
keyconfigs
.
addon
.
keymaps
.
new
(
name
=
'Object Mode'
)
kmi
=
km
.
keymap_items
.
new
(
'view3d.aibt_popup_test'
,
'T'
,
'PRESS'
,
alt
=
True
)
addon_keymaps
.
append
((
km
,
kmi
))
def
unregister
():
for
cls
in
classes
:
bpy
.
utils
.
unregister_class
(
cls
)
del
bpy
.
types
.
Scene
.
AIBTListCollection
del
bpy
.
types
.
Scene
.
AIBTListIndex
# remove keymaps when add-on is deactivated
for
km
,
kmi
in
addon_keymaps
:
km
.
keymap_items
.
remove
(
kmi
)
addon_keymaps
.
clear
()
if
__name__
==
"__main__"
:
register
()
File Metadata
Details
Attached
Mime Type
text/x-python
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4b/da/a999d306d125b980a1aec914774d
Attached To
T71112: UI: support 'activate_init' for popups which refresh
Event Timeline
Log In to Comment