我们从Python开源项目中,提取了以下18个代码示例,用于说明如何使用bpy.props.IntProperty()。
def register(): bpy.utils.register_class(CatHideUIList) bpy.utils.register_class(CatHidePresetUIList) bpy.utils.register_class(CatHidePanel) bpy.utils.register_class(CathideRefresh) bpy.utils.register_class(CathideApply) bpy.utils.register_class(CathidePresetAdd) bpy.utils.register_class(CathidePresetDelete) bpy.utils.register_class(CathidePresetClear) bpy.utils.register_class(CathideApplyPreset) bpy.utils.register_class(CatHidePanelList) bpy.types.Scene.panel_cathide_list = \ bpy.props.CollectionProperty(type=CatHidePanelList) bpy.types.Scene.cathide_index = IntProperty() bpy.utils.register_class(CatHidePresetList) bpy.types.Scene.preset_cathide_list = \ bpy.props.CollectionProperty(type=CatHidePresetList) bpy.types.Scene.cathide_preset_index = IntProperty() bpy.types.Scene.cathide_show_presetdetails = BoolProperty()
def register(): bpy.utils.register_module(__name__) bpy.types.Scene.animrenderbake_start = IntProperty( name="Start", description="Start frame of the animated bake", default=1) bpy.types.Scene.animrenderbake_end = IntProperty( name="End", description="End frame of the animated bake", default=250) bpy.types.RENDER_PT_bake.prepend(draw) cycles_panel = getattr(bpy.types, "CyclesRender_PT_bake", None) if cycles_panel: cycles_panel.prepend(draw)
def register(): for col_name, type_name in SUPPORTED_COLLECTIONS: type = getattr(bpy.types, type_name) type.id = p.IntProperty(name="unique id", get=_create_id_getter(col_name)) counter_name = col_name + "_id_counter" setattr(bpy.types.Scene, counter_name, p.IntProperty(name="unique id counter", default=1)) handlers.load_post.append(load_file) handlers.scene_update_pre.append(load_file_shim)
def register(): bpy.utils.register_class(ListItem) bpy.utils.register_class(MY_UL_List) bpy.utils.register_class(LIST_OT_NewItem) bpy.utils.register_class(LIST_OT_DeleteItem) bpy.utils.register_class(PT_FiltersList) bpy.types.Scene.my_list = prop.CollectionProperty(type = ListItem) bpy.types.Scene.list_index = prop.IntProperty(name = "Index for my_list", default = 0) bpy.types.Scene.aas=bpy.props.EnumProperty(items=populateFilterSelector, name="2DFilter")
def register(): bpy.utils.register_class(CatHideUIList) bpy.utils.register_class(CatHidePanel) bpy.utils.register_class(CathideRefresh) bpy.utils.register_class(CathideApply) bpy.utils.register_class(CatHidePanelList) bpy.types.Scene.panel_cathide_list = \ bpy.props.CollectionProperty(type=CatHidePanelList) bpy.types.Scene.cathide_index = IntProperty()
def register(): bpy.utils.register_class(CatHideUIList) bpy.utils.register_class(CatHideSpecificUIList) bpy.utils.register_class(CatHidePresetUIList) bpy.utils.register_class(CatHidePanel) bpy.utils.register_class(CathideRefresh) bpy.utils.register_class(CathideApply) bpy.utils.register_class(CathideApplySpecific) bpy.utils.register_class(CathidePresetAdd) bpy.utils.register_class(CathidePresetDelete) bpy.utils.register_class(CathidePresetClear) bpy.utils.register_class(CathideApplyPreset) bpy.utils.register_class(CathideResetCatOnly) bpy.utils.register_class(CathideResetPanelOnly) bpy.utils.register_class(CatHidePanelList) bpy.types.Scene.cathide_panel_list = \ bpy.props.CollectionProperty(type=CatHidePanelList) bpy.types.Scene.cathide_index = IntProperty() bpy.utils.register_class(CatHideSpecificPanelList) bpy.types.Scene.cathide_specific_panel_list = \ bpy.props.CollectionProperty(type=CatHideSpecificPanelList) bpy.types.Scene.cathide_specific_index = IntProperty() bpy.utils.register_class(CatHidePresetList) bpy.types.Scene.cathide_preset_list = \ bpy.props.CollectionProperty(type=CatHidePresetList) bpy.types.Scene.cathide_preset_index = IntProperty() bpy.types.Scene.cathide_show_specific = BoolProperty() bpy.types.Scene.cathide_show_specific_details = BoolProperty() bpy.types.Scene.cathide_show_preset = BoolProperty() bpy.types.Scene.cathide_show_presetcatdetails = BoolProperty() bpy.types.Scene.cathide_show_presetspaneldetails = BoolProperty()
def register(): bpy.utils.register_class(QuickSelectSetListItem) bpy.utils.register_class(QuickSelectSetList) bpy.utils.register_class(QuickSelectSetAssign) bpy.utils.register_class(QuickSelectSetSelect) bpy.utils.register_class(QuickSelectSetListNewItem) bpy.utils.register_class(QuickSelectSetListDeleteItem) bpy.utils.register_class(QuickSelectSetPanel) bpy.types.Object.qss_list = prop.CollectionProperty( type=QuickSelectSetListItem) bpy.types.Object.qss_active_index = prop.IntProperty( name="Index for qss_list", default=0)
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 modifiers_render_on(context): scene = bpy.context.scene bpy.types.Scene.Symplify = IntProperty( name = "Integer",description = "Enter an integer") scene['Simplify'] = 1 selection = bpy.context.selected_objects if not(selection): for obj in bpy.data.objects: for mod in obj.modifiers: mod.show_render = True else: for obj in selection: for mod in obj.modifiers: mod.show_render = True
def shift(): bpy.types.Scene.shift_verts = IntProperty( name="shift_verts", description="shift vertices of smaller object, it can reach maximum (look right), to make patterns", min=0, max=1000, #maxim(), - this cannot be updated default = 0, options={'ANIMATABLE', 'LIBRARY_EDITABLE'}) return
def register(): for cls in classes: bpy.utils.register_class(cls) os.environ['PATH'] = ''.join(('{}\lib;'.format(bLT_utils.getPaths()[1]),os.environ['PATH'])) bpy.types.Scene.locationgroups = CollectionProperty(type=bLT_main.LocationItems) bpy.types.Scene.locationgroups_index = IntProperty(default=-1) bpy.types.Scene.TexturePaintBrushNames = CollectionProperty(type=bLT_main.TexturePaintBrush) dataFolder = bLT_utils.getPaths()[2] import zipfile zip_ref = zipfile.ZipFile('{}\\bLandscapeTools.zip'.format(dataFolder), 'r') zip_ref.extractall('{}\\AppData\\Roaming\\Blender Foundation\\Blender\\{}.{}\\scripts\\startup\\bl_app_templates_user'.format(os.environ['USERPROFILE'],bpy.app.version[0],bpy.app.version[1])) zip_ref.close() bpy.context.user_preferences.filepaths.use_relative_paths = False bpy.context.user_preferences.filepaths.show_thumbnails = True bpy.context.user_preferences.system.use_mipmaps = False bpy.context.user_preferences.view.use_mouse_depth_navigate = True bpy.context.user_preferences.view.use_zoom_to_mouse = True bpy.context.user_preferences.view.use_rotate_around_active = True bpy.context.user_preferences.view.use_auto_perspective = True bpy.context.user_preferences.system.use_select_pick_depth = True bpy.context.user_preferences.system.select_method = 'GL_QUERY'
def register(): nfxtree.register() handlers.register() loadmodules() for module in modules: module.register() print(__name__) bpy.utils.register_module(__name__) bpy.types.Scene.nfxProcessList = CollectionProperty(type=nfxProcessList) bpy.types.Scene.nfxSimulating = BoolProperty() bpy.types.Scene.nfxProcessIndex = IntProperty(default=0)
def register(): bpy.utils.register_class(CatHideUIList) bpy.utils.register_class(CatHideSpecificUIList) bpy.utils.register_class(CatHidePresetUIList) bpy.utils.register_class(CatHideListActions) bpy.utils.register_class(CatHidePanel) bpy.utils.register_class(CathideRefresh) bpy.utils.register_class(CathideApply) bpy.utils.register_class(CathideApplySpecific) bpy.utils.register_class(CathidePresetAdd) bpy.utils.register_class(CathidePresetUpdate) bpy.utils.register_class(CathidePresetDelete) bpy.utils.register_class(CathidePresetClear) bpy.utils.register_class(CathideApplyPreset) bpy.utils.register_class(CathideLoadPreset) bpy.utils.register_class(CathideReset) bpy.utils.register_class(CathideCopyPreset) bpy.utils.register_class(CathideUpdateTemporary) bpy.utils.register_class(CatHideDeleteAllPresetsMenu) bpy.utils.register_class(CatHideCallClearPresetsMenu) bpy.utils.register_class(CatHideUpdatePresetsMenu) bpy.utils.register_class(CatHideCallUpdatePresetsMenu) bpy.utils.register_class(CatHideCopyPresetsMenu) bpy.utils.register_class(CatHidePanelList) bpy.types.Scene.cathide_panel_list = \ bpy.props.CollectionProperty(type=CatHidePanelList) bpy.types.Scene.cathide_index = IntProperty(update=update_specificpanel_list) bpy.utils.register_class(CatHideTemporaryPanelList) bpy.types.Scene.cathide_temporary_panel_list = \ bpy.props.CollectionProperty(type=CatHideTemporaryPanelList) bpy.utils.register_class(CatHideSpecificPanelList) bpy.types.Scene.cathide_specific_panel_list = \ bpy.props.CollectionProperty(type=CatHideSpecificPanelList) bpy.types.Scene.cathide_specific_index = IntProperty() bpy.utils.register_class(CatHidePresetList) bpy.types.Scene.cathide_preset_list = \ bpy.props.CollectionProperty(type=CatHidePresetList) bpy.types.Scene.cathide_preset_index = IntProperty() bpy.types.Scene.cathide_show_specific = BoolProperty() bpy.types.Scene.cathide_show_specific_details = BoolProperty() bpy.types.Scene.cathide_show_preset = BoolProperty() bpy.types.Scene.cathide_show_presetcatdetails = BoolProperty() bpy.types.Scene.cathide_show_presetspaneldetails = BoolProperty() bpy.types.Scene.cathide_show_presetsutility = BoolProperty() bpy.types.Scene.cathide_copyallpresets = BoolProperty(description='If checked, all CatHide Presets will be copied to other Scene') bpy.types.Scene.cathide_show_onlycontext_specific = BoolProperty(description='Hide Context Sensitive items', update=update_specificpanel_list)
def register(): # props bpy.types.Scene.NWBusyDrawing = StringProperty( name="Busy Drawing!", default="", description="An internal property used to store only the first mouse position") bpy.types.Scene.NWLazySource = StringProperty( name="Lazy Source!", default="x", description="An internal property used to store the first node in a Lazy Connect operation") bpy.types.Scene.NWLazyTarget = StringProperty( name="Lazy Target!", default="x", description="An internal property used to store the last node in a Lazy Connect operation") bpy.types.Scene.NWSourceSocket = IntProperty( name="Source Socket!", default=0, description="An internal property used to store the source socket in a Lazy Connect operation") bpy.utils.register_module(__name__) # keymaps addon_keymaps.clear() kc = bpy.context.window_manager.keyconfigs.addon if kc: km = kc.keymaps.new(name='Node Editor', space_type="NODE_EDITOR") for (identifier, key, action, CTRL, SHIFT, ALT, props, nicename) in kmi_defs: kmi = km.keymap_items.new(identifier, key, action, ctrl=CTRL, shift=SHIFT, alt=ALT) if props: for prop, value in props: setattr(kmi.properties, prop, value) addon_keymaps.append((km, kmi)) # menu items bpy.types.NODE_MT_select.append(select_parent_children_buttons) bpy.types.NODE_MT_category_SH_NEW_INPUT.prepend(attr_nodes_menu_func) bpy.types.NODE_PT_category_SH_NEW_INPUT.prepend(attr_nodes_menu_func) bpy.types.NODE_PT_backdrop.append(bgreset_menu_func) bpy.types.NODE_PT_active_node_generic.append(save_viewer_menu_func) bpy.types.NODE_MT_category_SH_NEW_TEXTURE.prepend(multipleimages_menu_func) bpy.types.NODE_PT_category_SH_NEW_TEXTURE.prepend(multipleimages_menu_func) bpy.types.NODE_MT_category_CMP_INPUT.prepend(multipleimages_menu_func) bpy.types.NODE_PT_category_CMP_INPUT.prepend(multipleimages_menu_func) bpy.types.NODE_PT_active_node_generic.prepend(reset_nodes_button) bpy.types.NODE_MT_node.prepend(reset_nodes_button)
def register(): # props bpy.types.Scene.NWBusyDrawing = StringProperty( name="Busy Drawing!", default="", description="An internal property used to store only the first mouse position") bpy.types.Scene.NWLazySource = StringProperty( name="Lazy Source!", default="x", description="An internal property used to store the first node in a Lazy Connect operation") bpy.types.Scene.NWLazyTarget = StringProperty( name="Lazy Target!", default="x", description="An internal property used to store the last node in a Lazy Connect operation") bpy.types.Scene.NWSourceSocket = IntProperty( name="Source Socket!", default=0, description="An internal property used to store the source socket in a Lazy Connect operation") bpy.utils.register_module(__name__) # keymaps addon_keymaps.clear() kc = bpy.context.window_manager.keyconfigs.addon if kc: km = kc.keymaps.new(name='Node Editor', space_type="NODE_EDITOR") for (identifier, key, action, CTRL, SHIFT, ALT, props, nicename) in kmi_defs: kmi = km.keymap_items.new(identifier, key, action, ctrl=CTRL, shift=SHIFT, alt=ALT) if props: for prop, value in props: setattr(kmi.properties, prop, value) addon_keymaps.append((km, kmi)) # menu items bpy.types.NODE_MT_select.append(select_parent_children_buttons) bpy.types.NODE_MT_category_SH_NEW_INPUT.prepend(attr_nodes_menu_func) bpy.types.NODE_PT_category_SH_NEW_INPUT.prepend(attr_nodes_menu_func) bpy.types.NODE_PT_backdrop.append(bgreset_menu_func) bpy.types.NODE_MT_category_SH_NEW_TEXTURE.prepend(multipleimages_menu_func) bpy.types.NODE_PT_category_SH_NEW_TEXTURE.prepend(multipleimages_menu_func) bpy.types.NODE_MT_category_CMP_INPUT.prepend(multipleimages_menu_func) bpy.types.NODE_PT_category_CMP_INPUT.prepend(multipleimages_menu_func)