5
Group: 'ScriptTemplate'
6
Tooltip: 'Add a new text for writing a text plugin'
9
from Blender import Window
15
Name: 'My Plugin Script'
18
Shortcut: 'Ctrl+Alt+U'
19
Tooltip: 'Put some useful info here'
22
# Add a licence here if you wish to re-distribute, we recommend the GPL
24
from Blender import Window, sys
25
import BPyTextPlugin, bpy
27
def my_script_util(txt):
28
# This function prints out statistical information about a script
30
desc = BPyTextPlugin.get_cached_descriptor(txt)
31
print '---------------------------------------'
32
print 'Script Name:', desc.name
33
print 'Classes:', len(desc.classes)
34
print ' ', desc.classes.keys()
35
print 'Functions:', len(desc.defs)
36
print ' ', desc.defs.keys()
37
print 'Variables:', len(desc.vars)
38
print ' ', desc.vars.keys()
42
# Gets the active text object, there can be many in one blend file.
43
txt = bpy.data.texts.active
45
# Silently return if the script has been run with no active text
49
# Text plug-ins should run quickly so we time it here
53
# Run our utility function
56
# Timing the script is a good way to be aware on any speed hits when scripting
57
print 'Plugin script finished in %.2f seconds' % (sys.time()-t)
61
# This lets you import the script without running it
62
if __name__ == '__main__':
66
new_text = bpy.data.texts.new('textplugin_template.py')
67
new_text.write(script_data)
68
bpy.data.texts.active = new_text
5
Group: 'ScriptTemplate'
6
Tooltip: 'Add a new text for writing a text plugin'
9
from Blender import Window
15
Name: 'My Plugin Script'
18
Shortcut: 'Ctrl+Alt+U'
19
Tooltip: 'Put some useful info here'
22
# Add a licence here if you wish to re-distribute, we recommend the GPL
24
from Blender import Window, sys
25
import BPyTextPlugin, bpy
27
def my_script_util(txt):
28
# This function prints out statistical information about a script
30
desc = BPyTextPlugin.get_cached_descriptor(txt)
31
print '---------------------------------------'
32
print 'Script Name:', desc.name
33
print 'Classes:', len(desc.classes)
34
print ' ', desc.classes.keys()
35
print 'Functions:', len(desc.defs)
36
print ' ', desc.defs.keys()
37
print 'Variables:', len(desc.vars)
38
print ' ', desc.vars.keys()
42
# Gets the active text object, there can be many in one blend file.
43
txt = bpy.data.texts.active
45
# Silently return if the script has been run with no active text
49
# Text plug-ins should run quickly so we time it here
53
# Run our utility function
56
# Timing the script is a good way to be aware on any speed hits when scripting
57
print 'Plugin script finished in %.2f seconds' % (sys.time()-t)
61
# This lets you import the script without running it
62
if __name__ == '__main__':
66
new_text = bpy.data.texts.new('textplugin_template.py')
67
new_text.write(script_data)
68
bpy.data.texts.active = new_text