Пример #1
0
    def execute(self, context):
        scene = context.scene
        path = object_utils.get_object_library_path()
        
        for library in scene.objectlib.libraries:
            scene.objectlib.libraries.remove(0)
        
        dirs = os.listdir(path)

        for directory in dirs:
            libpath = os.path.join(path,directory)
            if os.path.isdir(libpath):
                lib = scene.objectlib.libraries.add()
                lib.name = directory
                lib.path = libpath

        if len(scene.objectlib.libraries) > 0:
            library = scene.objectlib.libraries[0]
            path, lib_name = os.path.split(os.path.normpath(library.path))
            if context.screen.show_fullscreen:
                fd.update_file_browser_space(context,object_utils.get_object_library_path())
            else:
                bpy.ops.objectlib.change_library(library_name=lib_name)

        scene.mv.active_addon_name = "Object Library"
        return {'FINISHED'}
Пример #2
0
    def execute(self, context):
        scene = context.scene
        path = material_utils.get_material_library_path()

        for category in scene.materiallib.categories:
            scene.materiallib.categories.remove(0)

        dirs = os.listdir(path)

        for directory in dirs:
            catpath = os.path.join(path, directory)
            if os.path.isdir(catpath):
                cat = scene.materiallib.categories.add()
                cat.name = directory
                cat.path = catpath

        if len(scene.materiallib.categories) > 0:
            category = scene.materiallib.categories[0]
            if context.screen.show_fullscreen:
                fd.update_file_browser_space(
                    context, material_utils.get_material_library_path())
            else:
                bpy.ops.materiallib.change_directory(path=category.path)

        scene.mv.active_addon_name = "Material Library"
        return {'FINISHED'}
Пример #3
0
    def execute(self, context):
        scene = context.scene
        path = group_utils.get_group_library_path()
        
        for category in scene.grouplib.categories:
            scene.grouplib.categories.remove(0)
        
        dirs = os.listdir(path)

        for directory in dirs:
            catpath = os.path.join(path,directory)
            if os.path.isdir(catpath):
                cat = scene.grouplib.categories.add()
                cat.name = directory
                cat.path = catpath
        
        if len(scene.grouplib.categories) > 0:
            category = scene.grouplib.categories[0]
            if context.screen.show_fullscreen:
                fd.update_file_browser_space(context,group_utils.get_group_library_path())
            else:
                bpy.ops.grouplib.change_directory(path=category.path)
        
        scene.mv.active_addon_name = "Group Library"
        return {'FINISHED'}
Пример #4
0
 def execute(self, context):
     scene = context.scene
     library = scene.objectlib.libraries[scene.objectlib.active_library_name]
     path = os.path.join(library.path,self.category_name)
     fd.update_file_browser_space(context,path)
     context.scene.update()
     library.active_category_name = self.category_name
     return {'FINISHED'}
Пример #5
0
 def execute(self, context):
     scene = context.scene
     addon_path = os.path.dirname(__file__)
     library_path = os.path.join(addon_path,'Objects')
     path = os.path.join(library_path,self.library_name)
     scene.objectlib.active_library_name = self.library_name
     library = scene.objectlib.libraries[scene.objectlib.active_library_name]
     library.path = path
     library.get_categories()
     fd.update_file_browser_space(context,path)
     if len(library.categories) > 0:
         bpy.ops.objectlib.change_category(category_name = library.categories[0].name)
     context.scene.update()
     return {'FINISHED'}
Пример #6
0
 def execute(self, context):
     scene = context.scene
     directory, category = os.path.split(self.path)
     scene.materiallib.active_category_name = category
     fd.update_file_browser_space(context, self.path)
     return {'FINISHED'}
Пример #7
0
 def execute(self, context):
     scene = context.scene
     directory, category = os.path.split(self.path)
     scene.grouplib.active_category_name = category
     fd.update_file_browser_space(context,self.path)
     return {'FINISHED'}