Page Menu
Home
Search
Configure Global Search
Log In
Paste
P656
operator_id_py_to_c.py
Active
Public
Actions
Authored by
Campbell Barton (campbellbarton)
on Apr 16 2018, 1:34 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Tags
None
Subscribers
None
#!/usr/bin/env python3
# Script to convert py ID's to C operator ID's
# Ctrl-C over button or menu item, paste here, then run.
a
=
'''
bpy.ops.foo()
'''
pre
=
"bpy.ops."
ls
=
[]
for
w
in
a
.
strip
()
.
split
(
'
\n
'
):
if
w
.
startswith
(
pre
):
w
=
w
[
len
(
pre
):]
.
split
(
'('
)[
0
]
head
,
tail
=
w
.
partition
(
'.'
)[
0
::
2
]
ls
.
append
(
head
.
upper
()
+
"_OT_"
+
tail
)
# print w/ dotpoints
for
w
in
ls
:
print
(
"- "
+
w
+
''
)
Event Timeline
Campbell Barton (campbellbarton)
created this paste.
Apr 16 2018, 1:34 PM
Campbell Barton (campbellbarton)
mentioned this in
T54641: Multi-object mode support (parent task)
.
Log In to Comment