我们从Python开源项目中,提取了以下21个代码示例,用于说明如何使用bpy.props.BoolProperty()。
def register(): bpy.types.Scene.save_after_render = BoolProperty( name='Save after render', default=True, description='Automatically save rendered images into: //auto_save/') bpy.types.Scene.save_blend = BoolProperty( name = 'with .blend', default=True, description='Also save .blend file into: //auto_save/') bpy.types.Scene.auto_save_format = EnumProperty( name='Auto Save File Format', description='File Format for the auto saves.', items={ ('PNG', 'png', 'Save as png'), ('JPEG', 'jpg', 'Save as jpg'), ('OPEN_EXR_MULTILAYER', 'exr', 'Save as multilayer exr')}, default='PNG') bpy.types.Scene.auto_save_subfolders = BoolProperty( name='subfolder', default=False, description='Save into individual subfolders per blend name') bpy.app.handlers.render_post.append(auto_save_render) bpy.types.RENDER_PT_render.append(auto_save_UI)
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(): from bpy.types import Scene from bpy.props import (BoolProperty, IntProperty, StringProperty, ) Scene.pc_pc2_rotx = BoolProperty(default=True, name="Rotx = 90") Scene.pc_pc2_world_space = BoolProperty(default=True, name="World Space") Scene.pc_pc2_modifiers = BoolProperty(default=True, name="Apply Modifiers") Scene.pc_pc2_subsurf = BoolProperty(default=True, name="Turn Off SubSurf") Scene.pc_pc2_start = IntProperty(default=0, name="Frame Start") Scene.pc_pc2_end = IntProperty(default=100, name="Frame End") Scene.pc_pc2_group = StringProperty() Scene.pc_pc2_folder = StringProperty(default="Set me Please!") Scene.pc_pc2_exclude = StringProperty(default="*") bpy.utils.register_module(__name__) update_panel(None, bpy.context)
def register(): bpy.utils.register_module(__name__) bpy.types.Scene.cloudparticles = BoolProperty( name="Particles", description="Generate Cloud as Particle System", default=False) bpy.types.Scene.cloudsmoothing = BoolProperty( name="Smoothing", description="Smooth Resultant Geometry From Gen Cloud Operation", default=True) bpy.types.Scene.cloud_type = EnumProperty( name="Type", description="Select the type of cloud to create with material settings", items=[("0", "Stratus", "Generate Stratus_foggy Cloud"), ("1", "Cumulous", "Generate Cumulous_puffy Cloud"), ("2", "Cirrus", "Generate Cirrus_wispy Cloud"), ("3", "Explosion", "Generate Explosion"), ], default='0')
def register(): for c in classes: register_class(c) bpy.app.handlers.render_complete.append(slot_handler) bpy.types.Scene.record_settings = BoolProperty( name = "Record Render Settings", description="After eacher render save the render settings in current render slot", default=False) bpy.types.Scene.master_scene = BoolProperty( name = "Master Scene", description="When working with multiple scenes, make this the master scene to copy settings from", default=False) bpy.types.WindowManager.recent_render = StringProperty( name = "Recently Rendered Slot", description = "Shows the most recently rendered slot", default="" ) wm = bpy.context.window_manager km = wm.keyconfigs.addon.keymaps.new(name='Image', space_type='IMAGE_EDITOR') kmi = km.keymap_items.new('scene.render_slot_restore', 'J', 'PRESS', ctrl=True)
def setPropKeys(args): global theProperty if theProperty is None: return (name, tip, value) = theProperty if len(args) >= 2 and not isinstance(value, bool): if "BOOLEAN" in args[1]: value = bool(value) else: tip = tip + "," + args[1].replace(":", "=").replace('"', " ") #expr = "bpy.types.Object.%s = %sProperty(%s)" % (name, proptype, tip) if isinstance(value, bool): prop = BoolProperty(tip) elif isinstance(value, int): prop = IntProperty(tip) elif isinstance(value, float): prop = FloatProperty(tip) elif isinstance(value, string): prop = StringProperty(tip) setattr(bpy.types.Object, name, prop) theProperty = None
def register(): bpy.types.Object.MhxVersionStr = StringProperty(name="Version", default="", maxlen=128) bpy.types.Object.MhAlpha8 = BoolProperty(default=True) bpy.types.Object.MhxMesh = BoolProperty(default=False) bpy.types.Object.MhxRig = StringProperty(default="") bpy.types.Object.MhxVisemeSet = StringProperty(default="") bpy.types.Object.MhxRigify = BoolProperty(default=False) bpy.types.Object.MhxSnapExact = BoolProperty(default=False) bpy.types.Object.MhxShapekeyDrivers = BoolProperty(default=True) bpy.types.Object.MhxStrength = FloatProperty( name = "Expression strength", description = "Multiply expression with this factor", default=1.0, min=-1.0, max=2.0 ) bpy.utils.register_module(__name__) bpy.types.INFO_MT_file_import.append(menu_func)
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_module(__name__) bpy.types.RENDER_PT_render.prepend(ui) bpy.types.Scene.ktx_auto_advance_slot = BoolProperty(default=False, description="Auto Advance to Next Slot after a Render") bpy.types.Scene.ktx_occupied_render_slots = OccupiedSlots bpy.app.handlers.render_post.append(checkslots)
def register(): bpy.utils.register_class(AutoLoftModalOperator) bpy.utils.register_class(OperatorAutoLoftCurves) bpy.types.WindowManager.auto_loft = BoolProperty(default=False, name="Auto Loft", update=run_auto_loft) bpy.context.window_manager.auto_loft = False
def register(): Scene.my_property = BoolProperty(default=True)
def __init__(self, brain, bpyNode): self.brain = brain # type: Brain self.neurons = self.brain.neurons # type: List[Neuron] self.inputs = [] # type: List[str] - strings are names of neurons self.result = None # type: None | ImpulseContainer - Cache for current self.resultLog = [(0, 0, 0), (0, 0, 0)] # type: List[(int, int, int)] self.fillOutput = BoolProperty(default=True) self.bpyNode = bpyNode # type: cm_bpyNodes.LogicNode self.settings = {} # type: Dict[str, bpy.props.*] self.dependantOn = [] # type: List[str] - strings are names of neurons
def register(): bpy.types.Scene.MhFeetOnGround = BoolProperty(name="Feet on Ground", description="Model was exported with feet on ground. Checking this causes\nroot bone location translation to be cleared.", default=False) bpy.types.Scene.MhNoLocation = BoolProperty(name="No Location Translation", description="Some Expressions have bone translation on locked bones.\nChecking this causes it to be cleared. When false,\nALT-G will NOT clear these.", default=False) bpy.types.Scene.MhExprFilterTag = StringProperty(name="Tag:", description="", default="") bpy.utils.register_module(__name__)
def hook_or_not(): bpy.types.Scene.hook_or_not = BoolProperty( name="hook_or_not", description="hook or not new connected vertices to parents objects? it will get spider's web's linkage effect", default = True) return
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 invoke(self, context, event): context.window_manager.fileselect_add(self) return {'RUNNING_MODAL'} # # # filepath = StringProperty(name="Filename", subtype='FILE_PATH') # gazebo = BoolProperty(name="Export Gazebo tags", default=True) # # package_url = BoolProperty(name="Package URL", default=True) # # base_link_name = StringProperty(name="Base link:", default="root_link") # # @RDOperator.OperatorLogger # @RDOperator.Postconditions(ModelSelected, ObjectMode) # def execute(self, context): # """ # Code snipped from `<http://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory>`_ # """ # import zipfile # # if os.path.isdir(self.filepath): # self.logger.debug(self.filepath) # self.report({'ERROR'}, "No File selected!") # return {'FINISHED'} # # def zipdir(path, ziph): # # ziph is zipfile handle # for root, dirs, files in os.walk(path): # self.logger.debug("%s, %s, %s,", root, dirs, files) # for file in files: # file_path = os.path.join(root, file) # ziph.write(file_path, os.path.relpath(file_path, path)) # # with tempfile.TemporaryDirectory() as target: # create_package(self, context, target, self.base_link_name) # # with zipfile.ZipFile(self.filepath, 'w') as zipf: # zipdir(target, zipf) # # return {'FINISHED'} # # def invoke(self, context, event): # context.window_manager.fileselect_add(self) # return {'RUNNING_MODAL'}