當前位置: 首頁>>代碼示例>>Python>>正文


Python addon_utils.check方法代碼示例

本文整理匯總了Python中addon_utils.check方法的典型用法代碼示例。如果您正苦於以下問題:Python addon_utils.check方法的具體用法?Python addon_utils.check怎麽用?Python addon_utils.check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在addon_utils的用法示例。


在下文中一共展示了addon_utils.check方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: process_msg

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def process_msg(msgs, msgctxt, msgid, msgsrc, reports, check_ctxt, settings):
    if filter_message(msgid):
        reports["messages_skipped"].add((msgid, msgsrc))
        return
    if not msgctxt:
        # We do *not* want any "" context!
        msgctxt = settings.DEFAULT_CONTEXT
    # Always unescape keys!
    msgctxt = utils.I18nMessage.do_unescape(msgctxt)
    msgid = utils.I18nMessage.do_unescape(msgid)
    key = (msgctxt, msgid)
    check(check_ctxt, msgs, key, msgsrc, settings)
    msgsrc = settings.PO_COMMENT_PREFIX_SOURCE_CUSTOM + msgsrc
    if key not in msgs:
        msgs[key] = utils.I18nMessage([msgctxt], [msgid], [], [msgsrc], settings=settings)
    else:
        msgs[key].comment_lines.append(msgsrc)


##### RNA ##### 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:22,代碼來源:bl_extract_messages.py

示例2: execute

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def execute(self, context):
        Common.remove_unused_objects()

        # Make sure that the first layer is visible
        if hasattr(context.scene, 'layers'):
            context.scene.layers[0] = True

        # Enable fbx if it isn't enabled yet
        fbx_is_enabled = addon_utils.check('io_scene_fbx')[1]
        if not fbx_is_enabled:
            addon_utils.enable('io_scene_fbx')

        try:
            bpy.ops.import_scene.fbx('INVOKE_DEFAULT',
                                     automatic_bone_orientation=False,
                                     use_prepost_rot=False,
                                     use_anim=False)
        except (TypeError, ValueError):
            bpy.ops.import_scene.fbx('INVOKE_DEFAULT')

        return {'FINISHED'} 
開發者ID:GiveMeAllYourCats,項目名稱:cats-blender-plugin,代碼行數:23,代碼來源:importer.py

示例3: draw

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def draw(self, context):
        layout = self.layout
        col = layout.column()

        # 2.80
        if bpy.app.version_string.startswith('2.8'):
            col.prop(self, "switch_to_cycles")
            col.label(text="This may crash Blender!", icon='ERROR')
            col.separator()

        col.prop(self, "mat_id_algorithm")
        if self.mat_id_algorithm == 'HUE':
            col.prop(self, "mat_id_saturation")
            col.prop(self, "mat_id_value")
        elif self.mat_id_algorithm == 'NAME':
            self.layout.label(
                text="Duplicate colors are possible!", icon='ERROR')

        # # Node Wrangler for Texture Setup
        # if check("node_wrangler"):
        #     col.prop(self, "use_node_wrangler") 
開發者ID:danielenger,項目名稱:Principled-Baker,代碼行數:23,代碼來源:pbaker_prefs.py

示例4: check

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def check(self, context):
			return True 
開發者ID:xavier150,項目名稱:Blender-For-UnrealEngine-Addons,代碼行數:4,代碼來源:__init__.py

示例5: check

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def check(check_ctxt, msgs, key, msgsrc, settings):
    """
    Performs a set of checks over the given key (context, message)...
    """
    if check_ctxt is None:
        return
    multi_rnatip = check_ctxt.get("multi_rnatip")
    multi_lines = check_ctxt.get("multi_lines")
    py_in_rna = check_ctxt.get("py_in_rna")
    not_capitalized = check_ctxt.get("not_capitalized")
    end_point = check_ctxt.get("end_point")
    undoc_ops = check_ctxt.get("undoc_ops")
    spell_checker = check_ctxt.get("spell_checker")
    spell_errors = check_ctxt.get("spell_errors")

    if multi_rnatip is not None:
        if key in msgs and key not in multi_rnatip:
            multi_rnatip.add(key)
    if multi_lines is not None:
        if '\n' in key[1]:
            multi_lines.add(key)
    if py_in_rna is not None:
        if key in py_in_rna[1]:
            py_in_rna[0].add(key)
    if not_capitalized is not None:
        if(key[1] not in settings.WARN_MSGID_NOT_CAPITALIZED_ALLOWED and
           key[1][0].isalpha() and not key[1][0].isupper()):
            not_capitalized.add(key)
    if end_point is not None:
        if (key[1].strip().endswith('.') and not key[1].strip().endswith('...') and
            key[1] not in settings.WARN_MSGID_END_POINT_ALLOWED):
            end_point.add(key)
    if undoc_ops is not None:
        if key[1] == settings.UNDOC_OPS_STR:
            undoc_ops.add(key)
    if spell_checker is not None and spell_errors is not None:
        err = spell_checker.check(key[1])
        if err:
            spell_errors[key] = err 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:41,代碼來源:bl_extract_messages.py

示例6: check_for_smc

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [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

示例7: check

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def check(self, context):
        # Important for changing options
        return True 
開發者ID:GiveMeAllYourCats,項目名稱:cats-blender-plugin,代碼行數:5,代碼來源:atlas.py

示例8: check

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def check(self, context):
        # Important for changing options
        return False 
開發者ID:GiveMeAllYourCats,項目名稱:cats-blender-plugin,代碼行數:5,代碼來源:importer.py

示例9: remesh

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def remesh(self, context):
        lr = self.copiedobject
        hr = self.initialobject

        if self.manifold_method == "print3d":
            isloaded = addon_utils.check("object_print3d_utils")[0]
            if not isloaded:
                addon_utils.enable("object_print3d_utils")
            bpy.ops.mesh.print3d_clean_non_manifold()
            if not isloaded:
                addon_utils.disable("object_print3d_utils")

        elif self.manifold_method == "fill":
            bpy.ops.object.editmode_toggle()
            bpy.ops.mesh.select_mode(type="EDGE")
            bpy.ops.mesh.select_all(action='DESELECT')
            bpy.ops.mesh.select_non_manifold()
            bpy.ops.mesh.fill()
            bpy.ops.object.editmode_toggle()

        elif self.manifold_method == "manifold":
            self.report({"ERROR"}, "Manifold is not implemented yet")
            return {"CANCELLED"}

        elif self.manifold_method == "meshlab":
            self.report({"ERROR"}, "Meshlab manifolding is not implemented yet")
            return {"CANCELLED"}

        return {"FINISHED"} 
開發者ID:norgeotloic,項目名稱:BakeMyScan,代碼行數:31,代碼來源:op_REMESHERS_POST.py

示例10: execute

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def execute(self, context):
			scene = bpy.context.scene
			
			def CheckIfFbxPluginIsActivated():
				is_enabled, is_loaded = addon_utils.check("io_scene_fbx")
				if is_enabled == True and is_enabled == True:
					return True					
				return False

			
			def GetIfOneTypeCheck():
				if (scene.static_export
				or scene.static_collection_export
				or scene.skeletal_export
				or scene.anin_export
				or scene.alembic_export
				or scene.camera_export):
					return True
				else:
					return False
					

			if CheckIfFbxPluginIsActivated() == False:
				self.report({'WARNING'}, 'Add-on FBX format is not activated! Edit > Preferences > Add-ons > And check "FBX format"')
				return {'FINISHED'}	
			
			if GetIfOneTypeCheck():
				#Primary check	if file is saved to avoid windows PermissionError
				if bpy.data.is_saved:
					scene.UnrealExportedAssetsList.clear()
					start_time = time.perf_counter()
					UpdateNameHierarchy()
					bfu_ExportAsset.ExportForUnrealEngine()
					bfu_WriteText.WriteAllTextFiles()

					if len(scene.UnrealExportedAssetsList) > 0:
						self.report({'INFO'}, "Export of "+str(len(scene.UnrealExportedAssetsList))+
						" asset(s) has been finalized in "+str(time.perf_counter()-start_time)+" sec. Look in console for more info.")
						print("========================= Exported asset(s) =========================")
						print("")
						for line in bfu_WriteText.WriteExportLog().splitlines():
							print(line)
						print("")
						print("========================= ... =========================")
					else:
						self.report({'WARNING'}, "Not found assets with \"Export and child\" properties or collection to export.")
				else:
					self.report({'WARNING'}, "Please save this blend file before export")
			else:
				self.report({'WARNING'}, "No asset type is checked.")
				return {'FINISHED'}
			return {'FINISHED'}


	#Categories : 
開發者ID:xavier150,項目名稱:Blender-For-UnrealEngine-Addons,代碼行數:57,代碼來源:__init__.py

示例11: dump_messages

# 需要導入模塊: import addon_utils [as 別名]
# 或者: from addon_utils import check [as 別名]
def dump_messages(do_messages, do_checks, settings):
    bl_ver = "Blender " + bpy.app.version_string
    bl_hash = bpy.app.build_hash
    bl_date = datetime.datetime.strptime(bpy.app.build_date.decode() + "T" + bpy.app.build_time.decode(),
                                         "%Y-%m-%dT%H:%M:%S")
    pot = utils.I18nMessages.gen_empty_messages(settings.PARSER_TEMPLATE_ID, bl_ver, bl_hash, bl_date, bl_date.year,
                                                settings=settings)
    msgs = pot.msgs

    # Enable all wanted addons.
    # For now, enable all official addons, before extracting msgids.
    addons = utils.enable_addons(support={"OFFICIAL"})
    # Note this is not needed if we have been started with factory settings, but just in case...
    utils.enable_addons(support={"COMMUNITY", "TESTING"}, disable=True)

    reports = _gen_reports(_gen_check_ctxt(settings) if do_checks else None)

    # Get strings from RNA.
    dump_rna_messages(msgs, reports, settings)

    # Get strings from UI layout definitions text="..." args.
    dump_py_messages(msgs, reports, addons, settings)

    # Get strings from C source code.
    dump_src_messages(msgs, reports, settings)

    # Get strings from addons' categories.
    for uid, label, tip in bpy.types.WindowManager.addon_filter[1]['items'](bpy.context.window_manager, bpy.context):
        process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
        if tip:
            process_msg(msgs, settings.DEFAULT_CONTEXT, tip, "Add-ons' categories", reports, None, settings)

    # Get strings specific to translations' menu.
    for lng in settings.LANGUAGES:
        process_msg(msgs, settings.DEFAULT_CONTEXT, lng[1], "Languages’ labels from bl_i18n_utils/settings.py",
                    reports, None, settings)
    for cat in settings.LANGUAGES_CATEGORIES:
        process_msg(msgs, settings.DEFAULT_CONTEXT, cat[1],
                    "Language categories’ labels from bl_i18n_utils/settings.py", reports, None, settings)

    #pot.check()
    pot.unescape()  # Strings gathered in py/C source code may contain escaped chars...
    print_info(reports, pot)
    #pot.check()

    if do_messages:
        print("Writing messages…")
        pot.write('PO', settings.FILE_NAME_POT)

    print("Finished extracting UI messages!")

    return pot  # Not used currently, but may be useful later (and to be consistent with dump_addon_messages!). 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:54,代碼來源:bl_extract_messages.py


注:本文中的addon_utils.check方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。