Get the latest Blender, older versions, or experimental builds.
Stay up-to-date with the new features in the latest Blender releases.
Access production assets and knowledge from the open movies.
Documentation on the usage and features in Blender.
Latest development updates, by Blender developers.
Guidelines, release notes and development docs.
A platform to collect and share results of the Blender Benchmark.
The yearly event that brings the community together.
Support core development with a monthly contribution.
Perform a single donation with more payment options available.
#!BPY
"""
Name: 'Member Suggest'
Blender: 246
Group: 'TextPlugin'
Shortcut: 'Period'
Tooltip: 'Lists members of the object preceding the cursor in the current text \
space'
# Only run if we have the required modules
try:
import bpy
from BPyTextPlugin import *
OK = True
except ImportError:
OK = False
def main():
txt = bpy.data.texts.active
(line, c) = current_line(txt)
# Check we are in a normal context
if get_context(txt) != NORMAL:
return
pre = get_targets(line, c)
if len(pre) <= 1:
list = []
imports = get_imports(txt)
# Identify the root (root.sub.sub.)
if imports.has_key(pre[0]):
obj = imports[pre[0]]
else:
# Step through sub-attributes
for name in pre[1:-1]:
obj = getattr(obj, name)
except AttributeError:
print "Attribute not found '%s' in '%s'" % (name, '.'.join(pre))
attr = obj.__dict__.keys()
attr = dir(obj)
for k in attr:
v = getattr(obj, k)
if is_module(v): t = 'm'
elif callable(v): t = 'f'
else: t = 'v'
list.append((k, t))
except (AttributeError, TypeError): # Some attributes are not readable
pass
if list != []:
list.sort(cmp = suggest_cmp)
txt.suggest(list, pre[-1])
if OK:
main()