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


Python bpy.app方法代码示例

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


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

示例1: updater_run_success_popup_handler

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def updater_run_success_popup_handler(scene):
	global ran_update_sucess_popup
	ran_update_sucess_popup = True

	# in case of error importing updater
	if updater.invalidupdater == True:
		return

	try:
		bpy.app.handlers.scene_update_post.remove(
				updater_run_success_popup_handler)
	except:
		pass

	atr = addon_updater_updated_successful.bl_idname.split(".")
	getattr(getattr(bpy.ops, atr[0]),atr[1])('INVOKE_DEFAULT') 
开发者ID:blenderskool,项目名称:kaleidoscope,代码行数:18,代码来源:addon_updater_ops.py

示例2: background_update_callback

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def background_update_callback(update_ready):
	"""Passed into the updater, background thread updater"""
	global ran_autocheck_install_popup

	# in case of error importing updater
	if updater.invalidupdater == True:
		return
	if updater.showpopups == False:
		return
	if update_ready != True:
		return
	if updater_run_install_popup_handler not in \
				bpy.app.handlers.scene_update_post and \
				ran_autocheck_install_popup==False:
		bpy.app.handlers.scene_update_post.append(
				updater_run_install_popup_handler)
		ran_autocheck_install_popup = True 
开发者ID:blenderskool,项目名称:kaleidoscope,代码行数:19,代码来源:addon_updater_ops.py

示例3: updater_run_success_popup_handler

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def updater_run_success_popup_handler(scene):
	global ran_update_sucess_popup
	ran_update_sucess_popup = True

	# in case of error importing updater
	if updater.invalidupdater == True:
		return

	try:
		if "scene_update_post" in dir(bpy.app.handlers):
			bpy.app.handlers.scene_update_post.remove(
					updater_run_success_popup_handler)
		else:
			bpy.app.handlers.depsgraph_update_post.remove(
					updater_run_success_popup_handler)
	except:
		pass

	atr = addon_updater_updated_successful.bl_idname.split(".")
	getattr(getattr(bpy.ops, atr[0]),atr[1])('INVOKE_DEFAULT') 
开发者ID:CGCookie,项目名称:blender-addon-updater,代码行数:22,代码来源:addon_updater_ops.py

示例4: bv28

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def bv28():
	"""Check if blender 2.8, for layouts, UI, and properties. """
	global BV_IS_28
	if not BV_IS_28:
		BV_IS_28 = hasattr(bpy.app, "version") and bpy.app.version >= (2, 80)
	return BV_IS_28 
开发者ID:TheDuckCow,项目名称:Blender_Effectors,代码行数:8,代码来源:effector.py

示例5: make_annotations

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def make_annotations(cls):
	"""Add annotation attribute to class fields to avoid Blender 2.8 warnings"""
	if not hasattr(bpy.app, "version") or bpy.app.version < (2, 80):
		return cls
	bl_props = {k: v for k, v in cls.__dict__.items() if isinstance(v, tuple)}
	if bl_props:
		if '__annotations__' not in cls.__dict__:
			setattr(cls, '__annotations__', {})
		annotations = cls.__dict__['__annotations__']
		for k, v in bl_props.items():
			annotations[k] = v
			delattr(cls, k)
	return cls 
开发者ID:TheDuckCow,项目名称:Blender_Effectors,代码行数:15,代码来源:effector.py

示例6: layout_split

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def layout_split(layout, factor=0.0, align=False):
	"""Intermediate method for pre and post blender 2.8 split UI function"""
	if not hasattr(bpy.app, "version") or bpy.app.version < (2, 80):
		return layout.split(percentage=factor, align=align)
	return layout.split(factor=factor, align=align) 
开发者ID:blenderskool,项目名称:kaleidoscope,代码行数:7,代码来源:addon_updater_ops.py

示例7: updater_run_install_popup_handler

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def updater_run_install_popup_handler(scene):
	global ran_autocheck_install_popup
	ran_autocheck_install_popup = True

	# in case of error importing updater
	if updater.invalidupdater == True:
		return

	try:
		bpy.app.handlers.scene_update_post.remove(
				updater_run_install_popup_handler)
	except:
		pass

	if "ignore" in updater.json and updater.json["ignore"] == True:
		return # don't do popup if ignore pressed
	# elif type(updater.update_version) != type((0,0,0)):
	# 	# likely was from master or another branch, shouldn't trigger popup
	# 	updater.json_reset_restore()
	# 	return
	elif "version_text" in updater.json and "version" in updater.json["version_text"]:
		version = updater.json["version_text"]["version"]
		ver_tuple = updater.version_tuple_from_text(version)

		if ver_tuple < updater.current_version:
			# user probably manually installed to get the up to date addon
			# in here. Clear out the update flag using this function
			if updater.verbose:
				print("{} updater: appears user updated, clearing flag".format(\
						updater.addon))
			updater.json_reset_restore()
			return
	atr = addon_updater_install_popup.bl_idname.split(".")
	getattr(getattr(bpy.ops, atr[0]),atr[1])('INVOKE_DEFAULT') 
开发者ID:blenderskool,项目名称:kaleidoscope,代码行数:36,代码来源:addon_updater_ops.py

示例8: showReloadPopup

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def showReloadPopup():
	"""For use in register only, to show popup after re-enabling the addon

	Must be enabled by developer
	"""
	if updater.invalidupdater == True:
		return
	saved_state = updater.json
	global ran_update_sucess_popup

	a = saved_state != None
	b = "just_updated" in saved_state
	c = saved_state["just_updated"]

	if a and b and c:
		updater.json_reset_postupdate() # so this only runs once

		# no handlers in this case
		if updater.auto_reload_post_update == False: return

		if updater_run_success_popup_handler not in \
					bpy.app.handlers.scene_update_post \
					and ran_update_sucess_popup==False:
			bpy.app.handlers.scene_update_post.append(
					updater_run_success_popup_handler)
			ran_update_sucess_popup = True


# -----------------------------------------------------------------------------
# Example UI integrations
# ----------------------------------------------------------------------------- 
开发者ID:blenderskool,项目名称:kaleidoscope,代码行数:33,代码来源:addon_updater_ops.py

示例9: bv28

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def bv28():
    """Check if blender 2.8, for layouts, UI, and properties. """
    global BV_IS_28
    if not BV_IS_28:
        BV_IS_28 = hasattr(bpy.app, "version") and bpy.app.version >= (2, 80)
    return BV_IS_28 
开发者ID:TheDuckCow,项目名称:pose-tools,代码行数:8,代码来源:pose-tools.py

示例10: updater_run_install_popup_handler

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def updater_run_install_popup_handler(scene):
	global ran_autocheck_install_popup
	ran_autocheck_install_popup = True

	# in case of error importing updater
	if updater.invalidupdater == True:
		return

	try:
		if "scene_update_post" in dir(bpy.app.handlers):
			bpy.app.handlers.scene_update_post.remove(
					updater_run_install_popup_handler)
		else:
			bpy.app.handlers.depsgraph_update_post.remove(
					updater_run_install_popup_handler)
	except:
		pass

	if "ignore" in updater.json and updater.json["ignore"] == True:
		return # don't do popup if ignore pressed
	# elif type(updater.update_version) != type((0,0,0)):
	# 	# likely was from master or another branch, shouldn't trigger popup
	# 	updater.json_reset_restore()
	# 	return
	elif "version_text" in updater.json and "version" in updater.json["version_text"]:
		version = updater.json["version_text"]["version"]
		ver_tuple = updater.version_tuple_from_text(version)

		if ver_tuple < updater.current_version:
			# user probably manually installed to get the up to date addon
			# in here. Clear out the update flag using this function
			if updater.verbose:
				print("{} updater: appears user updated, clearing flag".format(\
						updater.addon))
			updater.json_reset_restore()
			return
	atr = addon_updater_install_popup.bl_idname.split(".")
	getattr(getattr(bpy.ops, atr[0]),atr[1])('INVOKE_DEFAULT') 
开发者ID:CGCookie,项目名称:blender-addon-updater,代码行数:40,代码来源:addon_updater_ops.py

示例11: background_update_callback

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def background_update_callback(update_ready):
	"""Passed into the updater, background thread updater"""
	global ran_autocheck_install_popup

	# in case of error importing updater
	if updater.invalidupdater == True:
		return
	if updater.showpopups == False:
		return
	if update_ready != True:
		return

	# see if we need add to the update handler to trigger the popup
	handlers = []
	if "scene_update_post" in dir(bpy.app.handlers): # 2.7x
		handlers = bpy.app.handlers.scene_update_post
	else: # 2.8x
		handlers = bpy.app.handlers.depsgraph_update_post
	in_handles = updater_run_install_popup_handler in handlers

	if in_handles or ran_autocheck_install_popup:
		return

	if "scene_update_post" in dir(bpy.app.handlers): # 2.7x
		bpy.app.handlers.scene_update_post.append(
				updater_run_install_popup_handler)
	else: # 2.8x
		bpy.app.handlers.depsgraph_update_post.append(
				updater_run_install_popup_handler)
	ran_autocheck_install_popup = True 
开发者ID:CGCookie,项目名称:blender-addon-updater,代码行数:32,代码来源:addon_updater_ops.py

示例12: make_annotations

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def make_annotations(cls):
    if not hasattr(bpy.app, "version") or bpy.app.version < (2, 80):
        return cls
    bl_props = {k: v for k, v in cls.__dict__.items() if isinstance(v, tuple)}
    if bl_props:
        if '__annotations__' not in cls.__dict__:
            setattr(cls, '__annotations__', {})
        annotations = cls.__dict__['__annotations__']
        for k, v in bl_props.items():
            annotations[k] = v
            delattr(cls, k)
    return cls 
开发者ID:Grim-es,项目名称:material-combiner-addon,代码行数:14,代码来源:addon_updater_ops.py

示例13: layout_split

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def layout_split(layout, factor=0.0, align=False):
    if not hasattr(bpy.app, "version") or bpy.app.version < (2, 80):
        return layout.split(percentage=factor, align=align)
    return layout.split(factor=factor, align=align) 
开发者ID:Grim-es,项目名称:material-combiner-addon,代码行数:6,代码来源:addon_updater_ops.py

示例14: get_update_post

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def get_update_post():
    if hasattr(bpy.app.handlers, 'scene_update_post'):
        return bpy.app.handlers.scene_update_post
    else:
        return bpy.app.handlers.depsgraph_update_post 
开发者ID:Grim-es,项目名称:material-combiner-addon,代码行数:7,代码来源:addon_updater_ops.py

示例15: execute

# 需要导入模块: import bpy [as 别名]
# 或者: from bpy import app [as 别名]
def execute(self, context):
        if Updater.invalidupdater is True:
            return {'CANCELLED'}

        if Updater.async_checking is True and Updater.error is None:
            return {'CANCELLED'}

        settings = get_user_preferences(context)
        if not settings:
            if Updater.verbose:
                print("Could not get {} preferences, update check skipped".format(__package__))
            return {'CANCELLED'}
        Updater.set_check_interval(enable=settings.auto_check_update,
                                   months=settings.updater_intrval_months,
                                   days=settings.updater_intrval_days,
                                   hours=settings.updater_intrval_hours,
                                   minutes=settings.updater_intrval_minutes)
        Updater.check_for_update_now(ui_refresh)
        try:
            import pip
            call([bpy.app.binary_path_python, '-m', 'pip', 'install', 'pip', '--user', '--upgrade'], shell=True)
            call([bpy.app.binary_path_python, '-m', 'pip', 'install', 'Pillow', '--user', '--upgrade'], shell=True)
        except ImportError:
            call([bpy.app.binary_path_python, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'operators',
                                                           'get-pip.py'), '--user'], shell=True)
            call([bpy.app.binary_path_python, '-m', 'pip', 'install', 'Pillow', '--user', '--upgrade'], shell=True)
        return {'FINISHED'} 
开发者ID:Grim-es,项目名称:material-combiner-addon,代码行数:29,代码来源:addon_updater_ops.py


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