我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用bpy.props.PointerProperty()。
def register(): global vars_dict vars_dict = { # spacial tree for segments and points 'seg_tree': None, 'point_tree': None, # keep track of shapely geometry selection sets 'select_polygons': None, 'select_lines': None, 'select_points': None } bpy.utils.register_class(ARCHIPACK_OP_PolyLib_Pick2DPolygons) bpy.utils.register_class(ARCHIPACK_OP_PolyLib_Pick2DLines) bpy.utils.register_class(ARCHIPACK_OP_PolyLib_Pick2DPoints) bpy.utils.register_class(ARCHIPACK_OP_PolyLib_OutputPolygons) bpy.utils.register_class(ARCHIPACK_OP_PolyLib_OutputLines) bpy.utils.register_class(ARCHIPACK_OP_PolyLib_Offset) bpy.utils.register_class(ARCHIPACK_OP_PolyLib_Simplify) bpy.utils.register_class(ARCHIPACK_OP_PolyLib_Detect) bpy.utils.register_class(ARCHIPACK_OP_PolyLib_Solidify) bpy.utils.register_class(archipack_polylib) bpy.types.WindowManager.archipack_polylib = PointerProperty(type=archipack_polylib) bpy.app.handlers.load_post.append(load_handler)
def register(): for cls in classes: bpy.utils.register_class(cls) # Register Cursor Control Structure bpy.types.Scene.cursor_control = PointerProperty( type=CursorControlData, name="" ) bpy.types.Scene.cursor_history = PointerProperty( type=CursorHistoryData, name="" ) bpy.types.Scene.cursor_memory = PointerProperty( type=CursorMemoryData, name="" ) # Register menu bpy.types.VIEW3D_MT_snap.append(menu_callback)
def register(): if DEBUG: print("Urho export register") #bpy.utils.register_module(__name__) bpy.utils.register_class(UrhoAddonPreferences) bpy.utils.register_class(UrhoExportSettings) bpy.utils.register_class(UrhoExportOperator) bpy.utils.register_class(UrhoExportResetOperator) bpy.utils.register_class(UrhoExportResetPathsOperator) bpy.utils.register_class(UrhoExportRenderPanel) bpy.utils.register_class(UrhoReportDialog) bpy.utils.register_class(UrhoComponentsPanel) bpy.utils.register_class(UrhoComponentModelResetOperator) bpy.utils.register_class(UrhoComponentShapeResetOperator) bpy.utils.register_class(UrhoComponentBodyResetOperator) Scene.urho_exportsettings = PointerProperty(type=UrhoExportSettings) bpy.context.user_preferences.filepaths.use_relative_paths = False if not PostLoad in bpy.app.handlers.load_post: bpy.app.handlers.load_post.append(PostLoad) # Note: the script __init__.py is executed only the first time the addons is enabled. After that # disabling or enabling the script will only call unregister() or register(). So in unregister() # delete only objects created with register(), do not delete global objects as they will not be # created re-enabling the addon. # __init__.py is re-executed pressing F8 or randomly(?) enabling the addon. # Called when the addon is disabled. Here we remove our UI classes.
def register(): bpy.utils.register_module(__name__) bpy.types.Object.tissue_tessellate = PointerProperty( type=tessellate_numpy.tissue_tessellate_prop )
def register(): bpy.types.VIEW3D_PT_tools_meshedit.append(interface.panel_start) bpy.types.VIEW3D_PT_tools_object.append(interface.panel_start) bpy.types.VIEW3D_PT_tools_latticeedit.append(interface.panel_finish) register_module(__name__) bpy.types.WindowManager.fast_lattice = PointerProperty( type = properties.fast_lattice, name = 'Fast Lattice', description = 'Storage location for fast lattice settings.' )
def register(): register_module(__name__) bpy.types.WindowManager.namer = PointerProperty( type = properties.namer, name = 'Namer Addon', description = 'Storage location for namer addon options', ) keymap = bpy.context.window_manager.keyconfigs.addon.keymaps.new(name='Window') keymap.keymap_items.new('wm.namer', 'F7', 'PRESS')
def register(): register_module(__name__) bpy.types.Scene.silhouette = PointerProperty( type = properties.silhouette, name = 'Silhouette Addon', description = 'Storage location for silhouette addon.', ) bpy.types.VIEW3D_PT_view3d_shading.append(interface.toggle)
def register(): for c in classes: register_class(c) Scene.rock_gen_props = PointerProperty(type=RockGeneratorProperties)
def register(): bpy.utils.register_module(__name__) bpy.types.Scene.layergroups = CollectionProperty(type=LayerGroup) # Unused, but this is needed for the TemplateList to work... bpy.types.Scene.layergroups_index = IntProperty(default=-1) bpy.types.Scene.namedlayers = PointerProperty(type=NamedLayers) bpy.app.handlers.scene_update_post.append(check_init_data)
def register(): from bpy.props import StringProperty, IntProperty, PointerProperty class ApiNavProps(bpy.types.PropertyGroup): """ Fake module like class. bpy.context.window_manager.api_nav_props """ path = StringProperty(name='path', description='Enter bpy.ops.api_navigator to see the documentation', default='bpy') old_path = StringProperty(name='old_path', default='') filter = StringProperty(name='filter', description='Filter the resulting modules', default='') reduce_to = IntProperty(name='Reduce to ', description='Display a maximum number of x entries by pages', default=10, min=1) pages = IntProperty(name='Pages', description='Display a Page', default=0, min=0) bpy.utils.register_module(__name__) bpy.types.WindowManager.api_nav_props = PointerProperty( type=ApiNavProps, name='API Nav Props', description='') register_keymaps() #print(get_tree_level())
def register(): bpy.utils.register_class(UT_MeshMorpherPanel) bpy.utils.register_class(UT_PackMorphTargetsOperator) bpy.utils.register_class(UT_MeshMorpherProperties) bpy.types.Scene.mesh_morpher_properties = PointerProperty(type = UT_MeshMorpherProperties)
def register(): bpy.utils.register_class(TextCounter_Props) bpy.types.TextCurve.text_counter_props = PointerProperty(type = TextCounter_Props) bpy.utils.register_class(TextCounterPanel) bpy.app.handlers.frame_change_post.append(textcounter_text_update_frame)
def register(self, btype, parent=[]): """ Register the wrapped property group to blender. This needs only be called for property groups directly assigned to a blender type. Nested groups are automatically registered. .. todo:: Register should use the standard registration mechanism of PluginManager. Right now, however, this would break the current registration process. This will be done once the properties for the robot designer have been clarified and migrated to this representation. @param btype: Blender type (e.g. :class:`bpy.types.Object` or :class:`bpy.types.Bone`) @param parent: For traversing nested groups @return: Reference to the generated :class:`bpy.types.PropertyGroup`-derived class (not used by the user). """ if bpy.app.version == 'Mockup': return newPropertyGroup = type(self.__class__.__name__ + "_unwrapped", (bpy.types.PropertyGroup,), {}) for attr in self.__dict__.items(): if isinstance(attr[1], PropertyHandler): attr[1].property[1]['attr'] = attr[0] # print(attr[0], attr[1].d) property=attr[1].property setattr(newPropertyGroup, attr[0], property) # property[0](**property[1])) attr[1].reference = parent + [attr[0]] elif isinstance(attr[1], PropertyGroupHandlerBase): pg = attr[1].register(None, parent + [attr[0]]) print(type(pg), pg.__bases__) p = PointerProperty(type=pg) p[1]['attr'] = attr[0] setattr(newPropertyGroup, attr[0], p) core_logger.debug("Registering generated property group: %s", newPropertyGroup.__name__) bpy.utils.register_class(newPropertyGroup) PluginManager._registered_properties.append((newPropertyGroup,btype)) if btype: setattr(btype,'RobotDesigner', bpy.props.PointerProperty(type=getattr(bpy.types, newPropertyGroup.__name__))) core_logger.debug("Assigning property to: %s", btype) return newPropertyGroup