本文整理汇总了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 #####
示例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'}
示例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")
示例4: check
# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import check [as 别名]
def check(self, context):
return True
示例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
示例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='')
示例7: check
# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import check [as 别名]
def check(self, context):
# Important for changing options
return True
示例8: check
# 需要导入模块: import addon_utils [as 别名]
# 或者: from addon_utils import check [as 别名]
def check(self, context):
# Important for changing options
return False
示例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"}
示例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 :
示例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!).