def _observer_file_browser(subject):
    from rna_info import get_direct_properties

    window_manager = subject.context['window_manager']
    screen = subject.context['screen']

    FILE_BROWSER = lambda area: area.spaces.active.type == 'FILE_BROWSER'
    SCREENSHOT_DIRECTORY = lambda params: window_manager.clipboard in params.directory
    to_update_filebrowser = lambda area: FILE_BROWSER(area) and SCREENSHOT_DIRECTORY(area.spaces.active.params)
    use_filter_props = lambda prop: prop.identifier.startswith('use_filter')

    overrides = subject.context.copy()

    file_browser_areas = filter(to_update_filebrowser, screen.areas)

    for file_browser in file_browser_areas:
        params = file_browser.spaces.active.params

        for prop in filter(use_filter_props , get_direct_properties(params.bl_rna)):
            setattr(params, prop.identifier, False)

        params.use_filter = True
        params.use_filter_image = True
        params.display_type = 'FILE_IMGDISPLAY'

        overrides['area'] = file_browser
        overrides['space_data'] = file_browser.spaces.active

        bpy.ops.file.refresh(overrides)
def _observer_file_browser(subject):
    from rna_info import get_direct_properties

    window_manager = subject.context["window_manager"]
    screen = subject.context["screen"]

    FILE_BROWSER = lambda area: area.spaces.active.type == "FILE_BROWSER"
    SCREENSHOT_DIRECTORY = lambda params: window_manager.clipboard in params.directory
    to_update_filebrowser = lambda area: FILE_BROWSER(area) and SCREENSHOT_DIRECTORY(area.spaces.active.params)
    use_filter_props = lambda prop: prop.identifier.startswith("use_filter")

    overrides = subject.context.copy()

    file_browser_areas = filter(to_update_filebrowser, screen.areas)

    for file_browser in file_browser_areas:
        params = file_browser.spaces.active.params

        for prop in filter(use_filter_props, get_direct_properties(params.bl_rna)):
            setattr(params, prop.identifier, False)

        params.use_filter = True
        params.use_filter_image = True
        params.display_type = "FILE_IMGDISPLAY"

        overrides["area"] = file_browser
        overrides["space_data"] = file_browser.spaces.active

        bpy.ops.file.refresh(overrides)
Ejemplo n.º 3
0
import bpy

from rna_info import get_direct_properties

from itertools import groupby
from pprint import pprint


property_type = lambda prop: prop.type

theTypeRna = bpy.types.Object.bl_rna


properties = sorted(theTypeRna.properties, key=property_type)

properties_direct = sorted(get_direct_properties(theTypeRna), key=property_type)


pprint(set.difference(*(map(set, (properties, properties_direct)))))


propmap = { key: tuple(group) for key, group in groupby(properties_direct, property_type) }


pprint(propmap)