我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用bpy.types.AddonPreferences()。
def dummy(): return #Addon Preferences #https://docs.blender.org/api/blender_python_api_2_67_1/bpy.types.AddonPreferences.html
def update_panel_position_custom(self, context): try: bpy.utils.unregister_class(VIEW3D_TP_Custom_Panel_UI) bpy.utils.unregister_class(VIEW3D_TP_Custom_Panel_TOOLS) except: pass try: bpy.utils.unregister_class(VIEW3D_TP_Custom_Panel_UI) except: pass if context.user_preferences.addons[__name__].preferences.tab_location_custom == 'tools': VIEW3D_TP_Custom_Panel_TOOLS.bl_category = context.user_preferences.addons[__name__].preferences.tools_category_custom bpy.utils.register_class(VIEW3D_TP_Custom_Panel_TOOLS) if context.user_preferences.addons[__name__].preferences.tab_location_custom == 'ui': bpy.utils.register_class(VIEW3D_TP_Custom_Panel_UI) if context.user_preferences.addons[__name__].preferences.tab_location_custom == 'off': pass # AddonPreferences #####################################