Python bpy.utils() Examples
The following are 30
code examples of bpy.utils().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bpy
, or try the search function
.
Example #1
Source File: __init__.py From Precision-Drawing-Tools with GNU General Public License v3.0 | 6 votes |
def register(): """Register Classes and Create Scene Variables. Operates on the classes list defined above. """ from bpy.utils import register_class for cls in classes: register_class(cls) # OpenGL flag # window_manager = WindowManager # Register Internal OpenGL Property # window_manager.pdt_run_opengl = BoolProperty(default=False) Scene.pdt_pg = PointerProperty(type=PDTSceneProperties)
Example #2
Source File: bpy_types.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def draw_preset(self, context): """ Define these on the subclass: - preset_operator (string) - preset_subdir (string) Optionally: - preset_extensions (set of strings) - preset_operator_defaults (dict of keyword args) """ import bpy ext_valid = getattr(self, "preset_extensions", {".py", ".xml"}) props_default = getattr(self, "preset_operator_defaults", None) self.path_menu(bpy.utils.preset_paths(self.preset_subdir), self.preset_operator, props_default=props_default, filter_ext=lambda ext: ext.lower() in ext_valid)
Example #3
Source File: bpy_types.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def draw_preset(self, context): """ Define these on the subclass: - preset_operator (string) - preset_subdir (string) Optionally: - preset_extensions (set of strings) - preset_operator_defaults (dict of keyword args) """ import bpy ext_valid = getattr(self, "preset_extensions", {".py", ".xml"}) props_default = getattr(self, "preset_operator_defaults", None) self.path_menu(bpy.utils.preset_paths(self.preset_subdir), self.preset_operator, props_default=props_default, filter_ext=lambda ext: ext.lower() in ext_valid)
Example #4
Source File: rigify.py From Blender-rigify-to-ue4 with GNU General Public License v3.0 | 6 votes |
def unregister(): from bpy.utils import unregister_class for cls in reversed(classes): unregister_class(cls) del bpy.types.Scene.uefy_character_objects del bpy.types.Scene.uefy_org_bone_objects del bpy.types.Scene.uefy_epic_bone_objects del bpy.types.Scene.uefy_character_name del bpy.types.Scene.uefy_uemann_name del bpy.types.Scene.uefy_metarig_name del bpy.types.Scene.uefy_character_type del bpy.types.Scene.uefy_axis_type del bpy.types.Scene.uefy_fix_metarig del bpy.types.Scene.uefy_remove_face del bpy.types.Scene.uefy_remove_extras_chest del bpy.types.Scene.uefy_remove_extras_pelvis del bpy.types.Scene.uefy_add_face del bpy.types.Scene.uefy_add_extras_chest del bpy.types.Scene.uefy_add_extras_pelvis del bpy.types.Scene.uefy_add_twist del bpy.types.Scene.uefy_add_second_twist del bpy.types.Scene.uefy_move_thigh_twist
Example #5
Source File: __init__.py From ArmAToolbox with GNU General Public License v3.0 | 6 votes |
def unregister(): bpy.types.DATA_PT_vertex_groups.remove(vgroupExtra) try: del bpy.types.WindowManager.armatoolbox except: pass bpy.types.TOPBAR_MT_file_export.remove(ArmaToolboxExportMenuFunc) bpy.types.TOPBAR_MT_file_import.remove(ArmaToolboxImportMenuFunc) bpy.types.TOPBAR_MT_file_import.remove(ArmaToolboxImportASCMenuFunc) bpy.types.TOPBAR_MT_file_export.remove(ArmaToolboxExportASCMenuFunc) #bpy.utils.unregister_class(ArmaToolboxAddNewProxy) #bpy.types.TOPBAR_MT_file_import.remove(ArmaToolboxAddProxyMenuFunc) bpy.types.TOPBAR_MT_file_export.remove(ArmaToolboxExportRTMMenuFunc) from bpy.utils import unregister_class from . import properties,panels,lists,operators lists.unregister() panels.unregister() operators.unregister() properties.unregister() for cls in reversed(classes): unregister_class(cls)
Example #6
Source File: __init__.py From Precision-Drawing-Tools with GNU General Public License v3.0 | 6 votes |
def unregister(): """Unregister Classes and Delete Scene Variables. Operates on the classes list defined above. """ from bpy.utils import unregister_class # remove OpenGL data pdt_pivot_point.PDT_OT_ModalDrawOperator.handle_remove( pdt_pivot_point.PDT_OT_ModalDrawOperator, bpy.context ) window_manager = bpy.context.window_manager pdt_wm = "pdt_run_opengl" if pdt_wm in window_manager: del window_manager[pdt_wm] for cls in reversed(classes): unregister_class(cls) del Scene.pdt_pg
Example #7
Source File: supporter.py From cats-blender-plugin with MIT License | 6 votes |
def load_other_icons(): # Note that preview collections returned by bpy.utils.previews # are regular py objects - you can use them to store custom data. pcoll = bpy.utils.previews.new() # path to the folder where the icon is # the path is calculated relative to this py file inside the addon folder icons_dir = os.path.join(resources_dir, "icons") icons_other_dir = os.path.join(icons_dir, "other") # load a preview thumbnail of a file and store in the previews collection pcoll.load('heart1', os.path.join(icons_other_dir, 'heart1.png'), 'IMAGE') pcoll.load('discord1', os.path.join(icons_other_dir, 'discord1.png'), 'IMAGE') pcoll.load('cats1', os.path.join(icons_other_dir, 'cats1.png'), 'IMAGE') pcoll.load('empty', os.path.join(icons_other_dir, 'empty.png'), 'IMAGE') pcoll.load('UP_ARROW', os.path.join(icons_other_dir, 'blender_up_arrow.png'), 'IMAGE') # pcoll.load('TRANSLATE', os.path.join(icons_other_dir, 'translate.png'), 'IMAGE') preview_collections['custom_icons'] = pcoll
Example #8
Source File: supporter.py From cats-blender-plugin with MIT License | 6 votes |
def reload_supporters(): # Read the support file readJson() # Get existing preview collection or create new one if preview_collections.get('supporter_icons'): pcoll = preview_collections['supporter_icons'] else: pcoll = bpy.utils.previews.new() # load the supporters and news icons load_icons(pcoll) if not preview_collections.get('supporter_icons'): preview_collections['supporter_icons'] = pcoll unregister_dynamic_buttons() register_dynamic_buttons() # Finish reloading finish_reloading() print('Updated supporter list.')
Example #9
Source File: jv_properties.py From JARCH-Vis with GNU General Public License v3.0 | 5 votes |
def register(): from bpy.utils import register_class from bpy.types import Object register_class(BisectingPlane) register_class(Cutout) register_class(FaceGroup) register_class(JVProperties) Object.jv_properties = PointerProperty( type=JVProperties, name="jv_properties", description="All possible properties for any JARCH Vis object" )
Example #10
Source File: __init__.py From se-blender with GNU General Public License v2.0 | 5 votes |
def register(): from bpy.utils import register_class register_class(utils.MessageOperator) register_class(types.SEAddonPreferences) register_class(types.SESceneProperties) register_class(types.SEObjectProperties) register_class(types.SEMaterialProperties) bpy.types.Object.space_engineers = bpy.props.PointerProperty(type=types.SEObjectProperties) bpy.types.Object.space_engineers_mirroring = mirroring.mirroringProperty bpy.types.Scene.space_engineers = bpy.props.PointerProperty(type=types.SESceneProperties) bpy.types.Material.space_engineers = bpy.props.PointerProperty(type=types.SEMaterialProperties) register_class(types.NODE_PT_spceng_nodes) register_class(types.NODE_PT_spceng_nodes_mat) register_class(types.DATA_PT_spceng_scene) register_class(types.DATA_PT_spceng_empty) register_class(types.DATA_PT_spceng_material) types.register() pbr_node_group.register() register_class(types.CheckVersionOnline) operators.register() bpy.types.INFO_MT_file_export.append(menu_func_export) nodes.register() register_class(SEView3DToolsPanel) mount_points.enable_draw_callback()
Example #11
Source File: nodes.py From se-blender with GNU General Public License v2.0 | 5 votes |
def draw(self, context): self.path_menu( bpy.utils.preset_paths(self.preset_subdir) + [join(dirname(__file__), 'presets', 'mwm_exporter')], 'script.execute_preset', props_default=None, filter_ext=lambda ext: ext.lower() == '.py')
Example #12
Source File: __init__.py From se-blender with GNU General Public License v2.0 | 5 votes |
def unregister(): from bpy.utils import unregister_class mount_points.disable_draw_callback() unregister_class(SEView3DToolsPanel) nodes.unregister() bpy.types.INFO_MT_file_export.remove(menu_func_export) operators.unregister() unregister_class(types.CheckVersionOnline) pbr_node_group.unregister() types.unregister() unregister_class(types.DATA_PT_spceng_material) unregister_class(types.DATA_PT_spceng_empty) unregister_class(types.DATA_PT_spceng_scene) unregister_class(types.NODE_PT_spceng_nodes_mat) unregister_class(types.NODE_PT_spceng_nodes) del bpy.types.Material.space_engineers del bpy.types.Object.space_engineers del bpy.types.Object.space_engineers_mirroring del bpy.types.Scene.space_engineers unregister_class(types.SEMaterialProperties) unregister_class(types.SEObjectProperties) unregister_class(types.SESceneProperties) unregister_class(types.SEAddonPreferences) unregister_class(utils.MessageOperator)
Example #13
Source File: jv_operators.py From JARCH-Vis with GNU General Public License v3.0 | 5 votes |
def register(): from bpy.utils import register_class for cls in classes: register_class(cls)
Example #14
Source File: jv_properties.py From JARCH-Vis with GNU General Public License v3.0 | 5 votes |
def unregister(): from bpy.utils import unregister_class from bpy.types import Object del Object.jv_properties unregister_class(JVProperties) unregister_class(FaceGroup) unregister_class(Cutout) unregister_class(BisectingPlane)
Example #15
Source File: __init__.py From Bligify with GNU General Public License v3.0 | 5 votes |
def register(): initprop() from bpy.utils import register_class for cls in classes: register_class(cls)
Example #16
Source File: __init__.py From Bligify with GNU General Public License v3.0 | 5 votes |
def unregister(): from bpy.utils import unregister_class for cls in reversed(classes): unregister_class(cls)
Example #17
Source File: operators.py From ArmAToolbox with GNU General Public License v3.0 | 5 votes |
def unregister(): from bpy.utils import unregister_class for c in op_classes: unregister_class(c)
Example #18
Source File: operators.py From ArmAToolbox with GNU General Public License v3.0 | 5 votes |
def register(): from bpy.utils import register_class for c in op_classes: register_class(c)
Example #19
Source File: automask.py From AutoMask with MIT License | 5 votes |
def unregister(): from bpy.utils import unregister_class for cls in reversed(classes): unregister_class(cls) del bpy.types.Scene.settings remove_handler()
Example #20
Source File: panels.py From ArmAToolbox with GNU General Public License v3.0 | 5 votes |
def unregister(): from bpy.utils import unregister_class for c in panel_classes: unregister_class(c)
Example #21
Source File: panels.py From ArmAToolbox with GNU General Public License v3.0 | 5 votes |
def register(): from bpy.utils import register_class for c in panel_classes: register_class(c)
Example #22
Source File: lists.py From ArmAToolbox with GNU General Public License v3.0 | 5 votes |
def register(): from bpy.utils import register_class for c in list_classes: register_class(c)
Example #23
Source File: __init__.py From ArmAToolbox with GNU General Public License v3.0 | 5 votes |
def register(): print ("Arma Toolbox registering") from bpy.utils import register_class print("Internal classes...") for c in classes: register_class(c) from . import properties print("properties") properties.register() properties.addCustomProperties() from . import operators print("operators") operators.register() from . import panels print("panels") panels.register() from . import lists print("lists") lists.register() bpy.types.TOPBAR_MT_file_export.append(ArmaToolboxExportMenuFunc) bpy.types.TOPBAR_MT_file_import.append(ArmaToolboxImportMenuFunc) bpy.types.TOPBAR_MT_file_import.append(ArmaToolboxImportASCMenuFunc) bpy.types.TOPBAR_MT_file_export.append(ArmaToolboxExportASCMenuFunc) #bpy.types.INFO_MT_mesh_add.append(ArmaToolboxAddProxyMenuFunc) bpy.types.TOPBAR_MT_file_export.append(ArmaToolboxExportRTMMenuFunc) if load_handler not in bpy.app.handlers.load_post: bpy.app.handlers.load_post.append(load_handler) bpy.types.DATA_PT_vertex_groups.append(vgroupExtra) print("Register done")
Example #24
Source File: properties.py From ArmAToolbox with GNU General Public License v3.0 | 5 votes |
def unregister(): from bpy.utils import unregister_class for cls in prpclasses: unregister_class(cls)
Example #25
Source File: properties.py From ArmAToolbox with GNU General Public License v3.0 | 5 votes |
def register(): print ("registering properties") from bpy.utils import register_class for cls in prpclasses: register_class(cls)
Example #26
Source File: supporter.py From cats-blender-plugin with MIT License | 5 votes |
def load_supporters(): # Read existing supporter list readJson() # Note that preview collections returned by bpy.utils.previews # are regular py objects - you can use them to store custom data. pcoll = bpy.utils.previews.new() # load the supporters and news icons load_icons(pcoll) if preview_collections.get('supporter_icons'): bpy.utils.previews.remove(preview_collections['supporter_icons']) preview_collections['supporter_icons'] = pcoll
Example #27
Source File: supporter.py From cats-blender-plugin with MIT License | 5 votes |
def unregister_dynamic_buttons(): for button in button_list: try: bpy.utils.unregister_class(button) except RuntimeError: pass button_list.clear()
Example #28
Source File: supporter.py From cats-blender-plugin with MIT License | 5 votes |
def register_dynamic_buttons(): if not supporter_data: return temp_idnames = [] for supporter in supporter_data.get('supporters'): if supporter.get('disabled'): continue name = supporter.get('displayname') idname = 'support.' + ''.join(filter(str.isalpha, name.lower())) description = name + ' is an awesome supporter' if supporter.get('description'): # description = name + ' says:\n\n' + supporter.get('description') + '\n' description = supporter.get('description') website = None if supporter.get('website'): website = supporter.get('website') while idname in temp_idnames: idname += '2' button = type('DynOp_' + name, (DynamicPatronButton, ), {'bl_idname': idname, 'bl_label': name, 'bl_description': description, 'bl_options': {'INTERNAL'}, 'website': website }) button_list.append(button) supporter['idname'] = idname temp_idnames.append(idname) bpy.utils.register_class(button)
Example #29
Source File: __init__.py From BlenderExporter with Apache License 2.0 | 5 votes |
def unregister(): from bpy.utils import unregister_class for cls in reversed(classes): unregister_class(cls) bpy.types.TOPBAR_MT_file_export.remove(menu_func) # Registration the calling of the INFO_MT_file_export file selector
Example #30
Source File: __init__.py From BlenderExporter with Apache License 2.0 | 5 votes |
def register(): from bpy.utils import register_class for cls in classes: register_class(cls) bpy.types.TOPBAR_MT_file_export.append(menu_func)