Example #1
0
def get_tree_level():
    #print('get_tree_level')

    path = bpy.context.window_manager.api_nav_props.path

    def object_list():
        #print('object_list')
        global current_module, root_m_path

        itm, val, mod, typ, props, struct, met, att, bug = [], [], [], [], [], [], [], [], []
        iterable = isiterable(current_module)
        if iterable:
            iter(current_module)
            current_type = str(module_type)
            if current_type != "<class 'str'>":
                if iterable == 'a':
                    #if iterable == 'a':
                    #current_type.__iter__()
                    itm = list(current_module.keys())
                    if not itm:
                        val = list(current_module)
                else:
                    val = list(current_module)

        for i in dir(current_module):
            try:
                t = str(type(eval(root_m_path + '.' + i)))
            except (AttributeError, SyntaxError):
                bug += [i]
                continue

            if t == "<class 'module'>":
                mod += [i]
            elif t[0:16] == "<class 'bpy_prop":
                props += [i]
            elif t[8:11] == 'bpy':
                struct += [i]
            elif t == "<class 'builtin_function_or_method'>":
                met += [i]
            elif t == "<class 'type'>":
                typ += [i]
            else:
                att += [i]

        return [itm, val, mod, typ, props, struct, met, att, bug]

    if not path:
        return [[], [], [i for i in get_root_modules()], [], [], [], [], [],
                []]
    return object_list()
def get_tree_level():
    #print('get_tree_level')
    
    path = bpy.context.window_manager.api_nav_props.path
    
    def object_list():
        #print('object_list')
        global current_module, root_m_path
        
        itm, val, mod, typ, props, struct, met, att, bug = [], [], [], [], [], [], [], [], []
        iterable = isiterable(current_module)
        if iterable:
            iter(current_module)
            current_type = str(module_type)
            if current_type != "<class 'str'>":
                if iterable == 'a':
                    #if iterable == 'a':
                        #current_type.__iter__()
                    itm = list(current_module.keys())
                    if not itm:
                        val = list(current_module)
                else :
                    val = list(current_module)
        
        for i in dir(current_module):
            try :
                t = str(type(eval(root_m_path + '.' + i)))
            except (AttributeError, SyntaxError):
                bug += [i]
                continue

            
            if t == "<class 'module'>":
                mod += [i]
            elif t[0:16] == "<class 'bpy_prop":
                props += [i]
            elif t[8:11] == 'bpy':
                struct += [i]
            elif t == "<class 'builtin_function_or_method'>":
                met += [i]
            elif t == "<class 'type'>":
                typ += [i]
            else :
                att += [i]
        
        return [itm, val, mod, typ, props, struct, met, att, bug]
    
    if not path:
        return [[], [], [i for i in get_root_modules()], [], [], [], [], [], []]
    return object_list()