当前位置: 首页>>代码示例>>Python>>正文


Python addon_utils.modules方法代码示例

本文整理汇总了Python中addon_utils.modules方法的典型用法代码示例。如果您正苦于以下问题:Python addon_utils.modules方法的具体用法?Python addon_utils.modules怎么用?Python addon_utils.modules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在addon_utils的用法示例。


在下文中一共展示了addon_utils.modules方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reload_addon

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def reload_addon(self):
        # if post_update false, skip this function
        # else, unload/reload addon & trigger popup
        if self._auto_reload_post_update == False:
            print("Restart blender to reload addon and complete update")
            return

        if self._verbose: print("Reloading addon...")
        addon_utils.modules(refresh=True)
        bpy.utils.refresh_script_paths()

        # not allowed in restricted context, such as register module
        # toggle to refresh
        bpy.ops.wm.addon_disable(module=self._addon_package)
        bpy.ops.wm.addon_refresh()
        bpy.ops.wm.addon_enable(module=self._addon_package)


    # -------------------------------------------------------------------------
    # Other non-api functions and setups
    # ------------------------------------------------------------------------- 
开发者ID:ndee85,项目名称:coa_tools,代码行数:23,代码来源:addon_updater.py

示例2: execute

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def execute(self, context):
		import addon_utils
		my_info = None
		for module in addon_utils.modules():
			info = addon_utils.module_bl_info(module)
			if info['name'] == common.addon_name:
				my_info = info
				break
		area = common.get_request_area(context, 'USER_PREFERENCES')
		if area and my_info:
			context.user_preferences.active_section = 'ADDONS'
			context.window_manager.addon_search = my_info['name']
			context.window_manager.addon_filter = 'All'
			if 'COMMUNITY' not in context.window_manager.addon_support:
				context.window_manager.addon_support = {'OFFICIAL', 'COMMUNITY'}
			if not my_info['show_expanded']:
				bpy.ops.wm.addon_expand(module=__name__.split('.')[0])
		else:
			self.report(type={'ERROR'}, message="表示できるエリアが見つかりませんでした")
			return {'CANCELLED'}
		return {'FINISHED'} 
开发者ID:CM3D2user,项目名称:Blender-CM3D2-Converter,代码行数:23,代码来源:misc_INFO_MT_help.py

示例3: draw

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def draw(self, context):
        import addon_utils
        
        layout = self.layout
        
        userpref = context.user_preferences
        used_ext = {ext.module for ext in userpref.addons}
        
        for mod in addon_utils.modules(refresh=False):
            if mod.bl_info['category'] == 'Library Add-on':
                if mod.__name__ in used_ext:
                    layout.operator('wm.addon_disable',text=mod.bl_info["name"],icon='CHECKBOX_HLT').module = mod.__name__
                else:
                    layout.operator('wm.addon_enable',text=mod.bl_info["name"],icon='CHECKBOX_DEHLT').module = mod.__name__
        layout.separator()
        layout.operator('wm.save_userpref',text="Save User Preferences",icon='FILE_TICK')

#------REGISTER 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:20,代码来源:space_fluid_file.py

示例4: draw

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def draw(self, context):
        layout = self.layout
        userpref = context.user_preferences
        used_ext = {ext.module for ext in userpref.addons}
        
        for mod in addon_utils.modules(refresh=False):
            if mod.bl_info["category"] == "Fluid Designer":
                module_name = mod.__name__
                is_enabled = module_name in used_ext  
                              
                if is_enabled:
                    layout.operator("wm.addon_disable", 
                                    icon='CHECKBOX_HLT', 
                                    text=mod.bl_info["name"], 
                                    emboss=False).module = module_name
                else:
                    layout.operator("wm.addon_enable", 
                                    icon='CHECKBOX_DEHLT', 
                                    text=mod.bl_info["name"], 
                                    emboss=False).module = module_name
                    
        layout.separator()
        
        layout.operator("wm.save_userpref", text="Save User Settings") 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:26,代码来源:space_fluid_info.py

示例5: execute

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def execute(self, context):
        import addon_utils

        module_name = self.module

        modules = addon_utils.modules(refresh=False)
        mod = addon_utils.addons_fake_modules.get(module_name)
        if mod is not None:
            info = addon_utils.module_bl_info(mod)
            info["show_expanded"] = True

            bpy.context.user_preferences.active_section = 'ADDONS'
            context.window_manager.addon_filter = 'All'
            context.window_manager.addon_search = info["name"]
            bpy.ops.screen.userpref_show('INVOKE_DEFAULT')

        return {'FINISHED'}


# Note: shares some logic with WM_OT_addon_install
# but not enough to de-duplicate. Fixes here may apply to both. 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:23,代码来源:wm.py

示例6: reload_addon

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def reload_addon(self):
		# if post_update false, skip this function
		# else, unload/reload addon & trigger popup
		if self._auto_reload_post_update == False:
			print("Restart blender to reload addon and complete update")
			return

		if self._verbose: print("Reloading addon...")
		addon_utils.modules(refresh=True)
		bpy.utils.refresh_script_paths()

		# not allowed in restricted context, such as register module
		# toggle to refresh
		bpy.ops.wm.addon_disable(module=self._addon_package)
		bpy.ops.wm.addon_refresh()
		bpy.ops.wm.addon_enable(module=self._addon_package)


	# -------------------------------------------------------------------------
	# Other non-api functions and setups
	# ------------------------------------------------------------------------- 
开发者ID:blenderskool,项目名称:kaleidoscope,代码行数:23,代码来源:addon_updater.py

示例7: reload_addon

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def reload_addon(self):
		# if post_update false, skip this function
		# else, unload/reload addon & trigger popup
		if self._auto_reload_post_update == False:
			print("Restart blender to reload addon and complete update")
			return


		if self._verbose:print("Reloading addon...")
		addon_utils.modules(refresh=True)
		bpy.utils.refresh_script_paths()

		# not allowed in restricted context, such as register module
		# toggle to refresh
		bpy.ops.wm.addon_disable(module=self._addon_package)
		bpy.ops.wm.addon_refresh()
		bpy.ops.wm.addon_enable(module=self._addon_package)


	# -------------------------------------------------------------------------
	# Other non-api functions and setups
	# ------------------------------------------------------------------------- 
开发者ID:johnroper100,项目名称:CrowdMaster,代码行数:24,代码来源:addon_updater.py

示例8: reload_addon

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def reload_addon(self):
        # if post_update false, skip this function
        # else, unload/reload addon & trigger popup
        if self._auto_reload_post_update is False:
            print("Restart blender to reload addon and complete update")
            return

        if self._verbose:
            print("Reloading addon...")
        addon_utils.modules(refresh=True)
        bpy.utils.refresh_script_paths()

        # not allowed in restricted context, such as register module
        # toggle to refresh
        bpy.ops.wm.addon_disable(module=self._addon_package)
        bpy.ops.wm.addon_refresh()
        bpy.ops.wm.addon_enable(module=self._addon_package)

    # -------------------------------------------------------------------------
    # Other non-api functions and setups
    # ------------------------------------------------------------------------- 
开发者ID:Grim-es,项目名称:material-combiner-addon,代码行数:23,代码来源:addon_updater.py

示例9: do_request

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def do_request():
    loop     = asyncio.get_event_loop()
    future   = loop.run_in_executor(None, requests.get, 'https://api.github.com/repos/norgeotloic/BakeMyScan/releases')
    response = await future
    object = json.loads(response.text)
    bpy.types.Scene.newVersion = object[0]["tag_name"]
    for mod in addon_utils.modules():
        if mod.bl_info.get("name") == "BakeMyScan":
            bpy.types.Scene.currentVersion = ".".join([str(x) for x in mod.bl_info.get("version")])
            if bpy.types.Scene.currentVersion == bpy.types.Scene.newVersion:
                print("No new updates")
            else:
                print("A new update is available")
                print("%s -> %s" % (bpy.types.Scene.currentVersion, bpy.types.Scene.newVersion))
                for a in object[0]["assets"]:
                    if a["name"] == "BakeMyScan.zip":
                        bpy.types.Scene.update_url = a["browser_download_url"]
                        print(bpy.types.Scene.update_url) 
开发者ID:norgeotloic,项目名称:BakeMyScan,代码行数:20,代码来源:op_UPDATE.py

示例10: reload_addon

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def reload_addon(self):
        # if post_update false, skip this function
        # else, unload/reload addon & trigger popup
        if self._auto_reload_post_update == False:
            print("Restart blender to reload addon and complete update")
            return


        if self._verbose:print("Reloading addon...")
        addon_utils.modules(refresh=True)
        bpy.utils.refresh_script_paths()

        # not allowed in restricted context, such as register module
        # toggle to refresh
        bpy.ops.wm.addon_disable(module=self._addon_package)
        bpy.ops.wm.addon_refresh()
        bpy.ops.wm.addon_enable(module=self._addon_package)


    # -------------------------------------------------------------------------
    # Other non-api functions and setups
    # ------------------------------------------------------------------------- 
开发者ID:WowDevTools,项目名称:Blender-WMO-import-export-scripts,代码行数:24,代码来源:addon_updater.py

示例11: path_from_addon

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def path_from_addon(module):
        import os
        import addon_utils

        for mod in addon_utils.modules():
            if mod.__name__ == module:
                filepath = mod.__file__
                if os.path.exists(filepath):
                    if os.path.splitext(os.path.basename(filepath))[0] == "__init__":
                        return os.path.dirname(filepath), True
                    else:
                        return filepath, False
        return None, False 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:15,代码来源:wm.py

示例12: check_for_smc

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def check_for_smc():
    global draw_smc_ui, old_smc_version, smc_is_disabled, found_very_old_smc

    draw_smc_ui = None
    found_very_old_smc = False

    for mod in addon_utils.modules():
        if mod.bl_info['name'] == "Shotariya-don":
            if hasattr(bpy.context.scene, 'shotariya_tex_idx'):
                found_very_old_smc = True
            continue
        if mod.bl_info['name'] == "Shotariya's Material Combiner":
            # print(mod.__name__, mod.bl_info['version'])
            # print(addon_utils.check(mod.__name__))
            if mod.bl_info['version'] < (2, 1, 1, 2):
                old_smc_version = True
                # print('TOO OLD!')
                continue
            if not addon_utils.check(mod.__name__)[0]:
                smc_is_disabled = True
                # print('DISABLED!')
                continue

            # print('FOUND!')
            old_smc_version = False
            smc_is_disabled = False
            found_very_old_smc = False
            draw_smc_ui = getattr(import_module(mod.__name__ + '.operators.ui.include'), 'draw_ui')
            break


# @register_wrap
# class AtlasList(bpy.types.UIList):
#     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
#         mat = item.material
#         row = layout.row()
#         row.prop(mat, 'name', emboss=False, text='', icon_value=layout.icon(mat))
#         sub_row = row.row()
#         sub_row.scale_x = 0.2
#         row.prop(mat, 'add_to_atlas', text='') 
开发者ID:GiveMeAllYourCats,项目名称:cats-blender-plugin,代码行数:42,代码来源:optimization.py

示例13: __init__

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def __init__(self):
        # get version and github_path
        for mod in addon_utils.modules():
            if mod.bl_info.get("name", "") == addon_name:
                self.version = mod.bl_info.get("version", "")
                self.github_path = mod.bl_info.get("tracker_url", "")
                break
        self.txt_name = addon_name + "_error_report.txt"

    ############################################# 
开发者ID:patmo141,项目名称:object_alignment,代码行数:12,代码来源:reportError.py

示例14: register

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def register():
    print("-------------REGISTER SORCAR-------------")
    path = repr([i for i in addon_utils.modules() if i.bl_info['name'] == "Sorcar"][0]).split("from '")[1].split("__init__.py'>")[0]
    classes_ops = import_ops(path)
    classes_sockets = import_sockets(path)
    classes_ui = import_ui(path)
    classes_nodes = import_nodes(path)

    global all_classes, addon_keymaps
    all_classes = [ScNodeTree]
    all_classes.extend(classes_ops)
    all_classes.extend(classes_sockets)
    all_classes.extend(classes_ui)
    all_classes.append(SorcarPreferences)

    total_nodes = 0
    node_categories = []
    for cat in classes_nodes:
        total_nodes += len(classes_nodes[cat])
        node_categories.append(ScNodeCategory(identifier="sc_"+cat, name=bpy.path.display_name(cat), items=[NodeItem(i.bl_idname) for i in classes_nodes[cat]]))
        all_classes.extend(classes_nodes[cat])
    
    for i in all_classes:
        bpy.utils.register_class(i)
    nodeitems_utils.register_node_categories("sc_node_categories", node_categories)
    if not (update_each_frame in bpy.app.handlers.frame_change_post):
        bpy.app.handlers.frame_change_post.append(update_each_frame)
    
    if (not bpy.app.background):
        km, kmi = init_keymaps()
        for k in kmi:
            k.active = True
            addon_keymaps.append((km, k))
    
    addon_updater_ops.register(bl_info)
    
    print_log("REGISTERED", msg="{} operators, {} sockets, {} UI, {} keymaps & {} nodes ({} categories)".format(len(classes_ops), len(classes_sockets), len(classes_ui), len(addon_keymaps), total_nodes, len(classes_nodes))) 
开发者ID:aachman98,项目名称:Sorcar,代码行数:39,代码来源:__init__.py

示例15: enable_addons

# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import modules [as 别名]
def enable_addons(addons=None, support=None, disable=False, check_only=False):
    """
    Enable (or disable) addons based either on a set of names, or a set of 'support' types.
    Returns the list of all affected addons (as fake modules)!
    If "check_only" is set, no addon will be enabled nor disabled.
    """
    import addon_utils

    if addons is None:
        addons = {}
    if support is None:
        support = {}

    userpref = bpy.context.user_preferences
    used_ext = {ext.module for ext in userpref.addons}

    ret = [mod for mod in addon_utils.modules()
               if ((addons and mod.__name__ in addons) or
                   (not addons and addon_utils.module_bl_info(mod)["support"] in support))]

    if not check_only:
        for mod in ret:
            module_name = mod.__name__
            if disable:
                if module_name not in used_ext:
                    continue
                print("    Disabling module ", module_name)
                bpy.ops.wm.addon_disable(module=module_name)
            else:
                if module_name in used_ext:
                    continue
                print("    Enabling module ", module_name)
                bpy.ops.wm.addon_enable(module=module_name)

        # XXX There are currently some problems with bpy/rna...
        #     *Very* tricky to solve!
        #     So this is a hack to make all newly added operator visible by
        #     bpy.types.OperatorProperties.__subclasses__()
        for cat in dir(bpy.ops):
            cat = getattr(bpy.ops, cat)
            for op in dir(cat):
                getattr(cat, op).get_rna()

    return ret


##### Main Classes ##### 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:49,代码来源:utils.py


注:本文中的addon_utils.modules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。