class NODE_OT_ConfigHiveNode(types.Operator): bl_idname = "hive.config_and_add_node" bl_label = "Configure Hive Node" import_path = props.StringProperty(name="Import path") arguments_index = props.IntProperty() arguments = props.CollectionProperty(type=ArgumentGroup) parameters_index = props.IntProperty() parameters = props.CollectionProperty(type=ParameterGroup) def draw(self, context): layout = self.layout layout.label("Parameters") layout.template_list("HIVE_UL_parameters", "", self, "parameters", self, "parameters_index") layout.label("Class Arguments") layout.template_list("HIVE_UL_arguments", "", self, "arguments", self, "arguments_index") def execute(self, context): params = {} for parameter in self.parameters: params[parameter.name] = parameter.value for argument in self.arguments: params[argument.name] = eval(argument.value_repr) add_hive_node(context, self.import_path, params) return {'FINISHED'} def invoke(self, context, event): hive_cls = import_from_path(self.import_path) init_info = get_pre_init_info(hive_cls) for name, info in init_info['parameters'].items(): argument = self.parameters.add() argument.data_type = info['data_type'][0] argument.name = name argument.value = info['start_value'] for name, info in init_info['cls_args'].items(): argument = self.arguments.add() argument.name = name argument.value_repr = '' wm = context.window_manager return wm.invoke_props_dialog(self)
def register(): for cls in classes: bpy.utils.register_class(cls) bpy.types.Scene.pano_list = prop.CollectionProperty(type=PANOListItem) bpy.types.Scene.pano_list_index = prop.IntProperty( name="Index for my_list", default=0) bpy.types.Scene.PANO_file = StringProperty( name="TXT", default="", description="Define the path to the PANO file", subtype='FILE_PATH') bpy.types.Scene.PANO_dir = StringProperty( name="DIR", default="", description="Define the path to the PANO file", subtype='DIR_PATH') bpy.types.Scene.PANO_cam_lens = IntProperty( name="Cam Lens", default=21, description="Define the lens of the cameras", # subtype = 'FILE_PATH' )
class PieMenuSubItem(_PieMenuItem, bpy.types.PropertyGroup): active = props.BoolProperty( name="Active", description="Activate or deactivate item", default=False, ) operator_arguments = props.CollectionProperty(type=OperatorArgument)
class TemplateClass(types.PropertyGroup): """PropertyGroup for Template items""" import_path = props.StringProperty(description="Import Path") defaults = props.CollectionProperty(type=TemplateAttributeDefault) defaults_active = props.IntProperty()
def register(): bpy.utils.register_class(PANOToolsPanel) bpy.utils.register_class(PANO_import) bpy.utils.register_class(PANOListItem) bpy.utils.register_class(PANO_UL_List) bpy.utils.register_class(VIEW_pano) bpy.utils.register_class(REMOVE_pano) bpy.utils.register_class(VIEW_alignquad) bpy.utils.register_class(VIEW_setlens) # here I register the PANO element list bpy.types.Scene.pano_list = prop.CollectionProperty(type=PANOListItem) bpy.types.Scene.pano_list_index = prop.IntProperty( name="Index for my_list", default=0) bpy.types.Scene.PANO_file = StringProperty( name="TXT", default="", description="Define the path to the PANO file", subtype='FILE_PATH') bpy.types.Scene.PANO_dir = StringProperty( name="DIR", default="", description="Define the path to the PANO file", subtype='DIR_PATH') bpy.types.Scene.PANO_cam_lens = IntProperty( name="Cam Lens", default=21, description="Define the lens of the cameras", # subtype = 'FILE_PATH' )
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")
class IMPORT_OT_egg(bpy.types.Operator, ImportHelper): """Import .egg Operator""" bl_idname = "import_scene.egg" bl_label = "Import .egg" bl_description = "Import a Panda3D .egg file" bl_options = {'REGISTER', 'UNDO'} filename_ext = ".egg" filter_glob = props.StringProperty(default="*.egg;*.egg.pz;*.egg.gz", options={'HIDDEN'}) directory = props.StringProperty(name="Directory", options={'HIDDEN'}) files = props.CollectionProperty(type=bpy.types.OperatorFileListElement, options={'HIDDEN'}) load_external = props.BoolProperty( name="Load external references", description= "Loads other .egg files referenced by this file as separate scenes, and instantiates them using DupliGroups." ) def execute(self, context): context = importer.EggContext() context.info = lambda msg: self.report({'INFO'}, msg) context.warn = lambda msg: self.report({'WARNING'}, msg) context.error = lambda msg: self.report({'ERROR'}, msg) context.search_dir = self.directory roots = [] for file in self.files: path = os.path.join(self.directory, file.name) root = context.read_file(path) roots.append(root) for root in roots: root.build_tree(context) context.assign_vertex_groups() if self.load_external: context.load_external_references() context.final_report() return {'FINISHED'} def invoke(self, context, event): wm = context.window_manager wm.fileselect_add(self) return {'RUNNING_MODAL'} def draw(self, context): layout = self.layout row = layout.row() row.prop(self, "load_external")
def sub_registration(): # bpy.utils.register_class(ListItem) # bpy.utils.register_class(MY_UL_List) # bpy.utils.register_class(LIST_OT_NewItem) # bpy.utils.register_class(AssetManagerSettings) # bpy.utils.register_class(testbtn) 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.AssetManager_settings = PointerProperty(type=AssetManagerSettings) bpy.app.handlers.load_post.append(load_post_handler)
class RPCGroup(types.PropertyGroup): """PropertyGroup for RPC calls""" name = props.StringProperty("name", default="RPC", description="Name of RPC call") reliable = props.BoolProperty(default=False, description="Guarantee delivery of RPC call") simulated = props.BoolProperty( default=False, description="Allow execution for simulated proxies") target = props.EnumProperty(items=NETWORK_ENUMS, description="Netmode of RPC target") arguments = props.CollectionProperty(type=RPCArgumentGroup) arguments_index = props.IntProperty()
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 new_classes(): class OperatorArgument(_OperatorArgument, bpy.types.PropertyGroup): pass class PieMenuSubItem(_PieMenuItem, bpy.types.PropertyGroup): active = props.BoolProperty( name="Active", description="Activate or deactivate item", default=False, ) operator_arguments = props.CollectionProperty(type=OperatorArgument) class PieMenuItem(_PieMenuItem, bpy.types.PropertyGroup): operator_arguments = props.CollectionProperty(type=OperatorArgument) shift = props.PointerProperty(type=PieMenuSubItem) ctrl = props.PointerProperty(type=PieMenuSubItem) namespace = OrderedDict([ ("menu_items", props.CollectionProperty(name="Items", type=PieMenuItem)), ]) PieMenu = type("PieMenu", (_PieMenu, bpy.types.PropertyGroup), namespace) return OperatorArgument, PieMenuSubItem, PieMenuItem, PieMenu
class BatchStripPropertyCopy(types.Operator): """Batch Strip Property Copy""" bl_idname = "sequencer.batch_strip_property_copy" bl_label = "Batch Set Strip Properties" bl_options = {'REGISTER', 'UNDO'} set_proxy = props.EnumProperty( items = TRIBOOL, default = 'NO_CHANGE', ) proxy_sizes = props.CollectionProperty( name='Set proxy', type=ProxySettingsProperty, description='Select properties to copy from active strip to all selected', ) def check(self, event): return True def _selected_strips(self, context): editor = context.scene.sequence_editor return [ seq for seq in editor.sequences_all if seq.select ] def _selected_move_strips(self, context): return [ seq for seq in self._selected_strips(context) if seq.type == 'MOVIE' ] def draw(self, context): layout = self.layout enabled = str(self.set_proxy) == 'SET' self.selected_all = self._selected_strips(context) self.selected_movie_strips = self._selected_move_strips(context) layout.label( 'Slected movie strips: {}/{}'.format( len(self.selected_movie_strips), len(self.selected_all) ) ) row = layout.row() row.label('Set Proxy') row.prop(self, 'set_proxy', expand=True) proxy_counts = {size: 0 for size in PROXY_SIZES} for seq in self.selected_movie_strips: if seq.use_proxy: for size in PROXY_SIZES: if getattr(seq.proxy, 'build_{}'.format(size)): proxy_counts[size] += 1 for size, prop in zip(PROXY_SIZES, self.proxy_sizes): row = layout.row() row.enabled = enabled row.separator() row.label('{}%'.format(size)) row.prop(prop, 'action', expand=True) row.label('{}/{}'.format(proxy_counts[size], len(self.selected_movie_strips))) def execute(self, context): if self.set_proxy == 'SET': for seq in self.selected_movie_strips: seq.use_proxy = True for size, prop in zip(PROXY_SIZES, self.proxy_sizes): if prop.action == 'SET': setattr(seq.proxy, 'build_{}'.format(size), True) elif prop.action == 'UNSET': setattr(seq.proxy, 'build_{}'.format(size), False) elif self.set_proxy == 'UNSET': for seq in self.selected_movie_strips: seq.use_proxy = False return {'FINISHED'} def invoke(self, context, event): wm = context.window_manager for size in PROXY_SIZES: self.proxy_sizes.add() editor = context.scene.sequence_editor if not editor: return {'FINISHED'} return wm.invoke_props_dialog(self)
class PieMenuItem(_PieMenuItem, bpy.types.PropertyGroup): operator_arguments = props.CollectionProperty(type=OperatorArgument) shift = props.PointerProperty(type=PieMenuSubItem) ctrl = props.PointerProperty(type=PieMenuSubItem)
class PieMenu(_PieMenu, bpy.types.PropertyGroup): menu_items = props.CollectionProperty(name="Items", type=PieMenuItem) @classmethod def new_class(cls): type("PieMenu", (_PieMenu, bpy.types.PropertyGroup), {})
def register(): bpy.utils.register_module(__name__) bpy.types.Scene.my_list = prop.CollectionProperty(type=ListItem) bpy.types.Scene.list_index = prop.IntProperty(name="Index for my_list", default=0)
def register(): addon_updater_ops.register(bl_info) for cls in classes: bpy.utils.register_class(cls) bpy.types.WindowManager.export_vars = bpy.props.PointerProperty(type = ExportVars) bpy.types.WindowManager.export_tables_vars = bpy.props.PointerProperty(type = ExportTablesVars) bpy.types.Scene.emviq_error_list = prop.CollectionProperty(type = EMviqListErrors) bpy.types.Scene.emviq_error_list_index = prop.IntProperty(name = "Index for my_list", default = 0, update = functions.switch_paradata_lists) bpy.types.Scene.em_list = prop.CollectionProperty(type = EMListItem) bpy.types.Scene.em_list_index = prop.IntProperty(name = "Index for my_list", default = 0, update = functions.switch_paradata_lists) bpy.types.Scene.em_reused = prop.CollectionProperty(type = EMreusedUS) bpy.types.Scene.epoch_list = prop.CollectionProperty(type = EPOCHListItem) bpy.types.Scene.epoch_list_index = prop.IntProperty(name = "Index for epoch_list", default = 0) bpy.types.Scene.edges_list = prop.CollectionProperty(type = EDGESListItem) bpy.types.Scene.em_sources_list = prop.CollectionProperty(type = EMListParadata) bpy.types.Scene.em_sources_list_index = prop.IntProperty(name = "Index for sources list", default = 0) bpy.types.Scene.em_properties_list = prop.CollectionProperty(type = EMListParadata) bpy.types.Scene.em_properties_list_index = prop.IntProperty(name = "Index for properties list", default = 0) bpy.types.Scene.em_extractors_list = prop.CollectionProperty(type = EMListParadata) bpy.types.Scene.em_extractors_list_index = prop.IntProperty(name = "Index for extractors list", default = 0) bpy.types.Scene.em_combiners_list = prop.CollectionProperty(type = EMListParadata) bpy.types.Scene.em_combiners_list_index = prop.IntProperty(name = "Index for combiners list", default = 0) bpy.types.Scene.em_v_sources_list = prop.CollectionProperty(type = EMListParadata) bpy.types.Scene.em_v_sources_list_index = prop.IntProperty(name = "Index for sources list", default = 0) bpy.types.Scene.em_v_properties_list = prop.CollectionProperty(type = EMListParadata) bpy.types.Scene.em_v_properties_list_index = prop.IntProperty(name = "Index for properties list", default = 0, update = functions.stream_properties) bpy.types.Scene.em_v_extractors_list = prop.CollectionProperty(type = EMListParadata) bpy.types.Scene.em_v_extractors_list_index = prop.IntProperty(name = "Index for extractors list", default = 0, update = functions.stream_extractors) bpy.types.Scene.em_v_combiners_list = prop.CollectionProperty(type = EMListParadata) bpy.types.Scene.em_v_combiners_list_index = prop.IntProperty(name = "Index for combiners list", default = 0, update = functions.stream_combiners) bpy.types.Scene.enable_image_compression = BoolProperty(name="Tex compression", description = "Use compression settings for textures. If disabled, original images (size and compression) will be used.",default=True) bpy.types.Scene.paradata_streaming_mode = BoolProperty(name="Paradata streaming mode", description = "Enable/disable tables streaming mode",default=True, update = functions.switch_paradata_lists) bpy.types.Scene.prop_paradata_streaming_mode = BoolProperty(name="Properties Paradata streaming mode", description = "Enable/disable property table streaming mode",default=True, update = functions.stream_properties) bpy.types.Scene.comb_paradata_streaming_mode = BoolProperty(name="Combiners Paradata streaming mode", description = "Enable/disable combiner table streaming mode",default=True, update = functions.stream_combiners) bpy.types.Scene.extr_paradata_streaming_mode = BoolProperty(name="Extractors Paradata streaming mode", description = "Enable/disable extractor table streaming mode",default=True, update = functions.stream_extractors) bpy.types.Scene.proxy_shader_mode = BoolProperty(name="Proxy shader mode", description = "Enable additive shader for proxies",default=True, update = functions.proxy_shader_mode_function) bpy.types.Scene.EM_file = StringProperty( name = "EM GraphML file", default = "", description = "Define the path to the EM GraphML file", subtype = 'FILE_PATH' ) bpy.types.Scene.EMviq_folder = StringProperty( name="EMviq collection export folder", default="", description="Define the path to export the EMviq collection", subtype='DIR_PATH' ) bpy.types.Scene.EMviq_scene_folder = StringProperty( name="EMviq scene export folder", default="", description="Define the path to export the EMviq scene", subtype='DIR_PATH' ) bpy.types.Scene.EMviq_project_name = StringProperty( name="EMviq project name", default="", description="Define the name of the EMviq project"#, #subtype='DIR_PATH' ) bpy.types.Scene.EMviq_user_name = StringProperty( name="EMviq user name", default="", description="Define the name of the EMviq user"#, #subtype='DIR_PATH' ) bpy.types.Scene.EMviq_user_password = StringProperty( name="EMviq user name", default="", description="Define the name of the EMviq user", subtype='PASSWORD' ) bpy.types.Scene.ATON_path = StringProperty( name="ATON path", default="", description="Define the path to the ATON framework (root folder)", subtype='DIR_PATH' ) bpy.types.Scene.EMviq_model_author_name = StringProperty( name="Name of the author(s) of the models", default="", description="Define the nameof the author(s) of the models"#, #subtype='DIR_PATH' ) ###################################################################################################### #per epoch manager ################## bpy.types.Scene.em_settings = PointerProperty(type=EM_Other_Settings) bpy.types.Scene.rm_settings = PointerProperty(type=EM_Other_Settings) bpy.types.Scene.proxy_display_mode = StringProperty( name = "Proxy display mode", default = "EM", description = "EM proxy current display mode" ) bpy.types.Scene.proxy_blend_mode = StringProperty( name = "Proxy blend mode", default = "BLEND", description = "EM proxy blend mode for current display mode" ) bpy.types.Scene.proxy_display_alpha = FloatProperty( name="alpha", description="The alphavalue for proxies", min=0, max=1, default=0.5, update = functions.update_display_mode ) bpy.types.VIEW3D_MT_mesh_add.append(menu_func) bpy.types.Object.EM_ep_belong_ob = CollectionProperty(type=EM_epochs_belonging_ob) bpy.types.Object.EM_ep_belong_ob_index = IntProperty() bpy.types.Scene.EM_gltf_export_quality = IntProperty( name="export quality", default=100, description="Define the quality of the output images. 100 is maximum quality but at a cost of bigger weight (no optimization); 80 is compressed with near lossless quality but still hight in weight; 60 is a good middle way; 40 is hardly optimized with some evident loss in quality (sometimes it can work).", ) bpy.types.Scene.EM_gltf_export_maxres = IntProperty( name="export max resolution", default=4096, description="Define the maximum resolution of the bigger side (it depends if it is a squared landscape or portrait image) of the output images", )
class PieMenuPreferences(addongroup.AddonGroup, bpy.types.PropertyGroup if "." in __name__ else bpy.types.AddonPreferences): bl_idname = __package__ submodules = None menus = props.CollectionProperty(type=PieMenu) font_id = props.IntProperty(name="Font ID", default=0, min=0, get=font_id_get) # 読み込み専用 font_id_mono = props.IntProperty(name="Font ID Mono", default=1, min=0) # 読み込み専用 # 中心からアイコンの円の境界まで menu_radius = props.IntProperty(name="Menu Radius", default=30, min=10) menu_radius_center = props.IntProperty(name="Menu Radius Center", default=10, min=0) # submenuに切り替えた際に中心を変えない lock_menu_location = props.BoolProperty(name="Lock Menu Location", default=False) # Itemの上下の隙間がこれより狭いならmenu_radiusを広げる item_min_space = props.IntProperty(name="MenuItem Min Space", default=4, min=0) colors = props.PointerProperty(type=PieMenu_PG_Colors) """:type: PieMenu_PG_Colors""" draw_type = props.EnumProperty(name="Draw Type", description="Default draw type", items=[('SIMPLE', "Simple", ""), ('BOX', "Box", ""), ('CIRCLE', "Circle", ""), ('SIMPLE_BOX', "Simple - Box", ""), ('SIMPLE_CIRCLE', "Simple - Circle", "")], default='BOX') def reset_menus(self): self.menus.clear() pass def draw(self, context): layout = self.layout draw_install = False try: import pie_menu except: draw_install = True else: try: mod = importlib.import_module(".".join( __name__.split(".")[:-1])) except: draw_install = True else: if pie_menu.VERSION != mod.bl_info["version"]: draw_install = True if draw_install: dst = ops.WM_OT_pie_menu_module_install.install_path() row = layout.row() row.operator(ops.WM_OT_pie_menu_module_install.bl_idname, text="Install Module") row = layout.row() row.label("Install Path: " + dst) if ops.module_installed: row = layout.row() row.label("Restart Blender !", icon='ERROR') layout.separator() super().draw(context) return colors = self.colors column = layout.column() sp = column.split() col = sp.column() col.prop(self, "draw_type") col.prop(self, "menu_radius") col.prop(self, "menu_radius_center") col = sp.column() col.prop(self, "lock_menu_location") # col.prop(self, "item_min_space") # わざわざ設定する人もいないだろう col.prop(colors, "use_theme", "Use Current Theme") split = layout.split() column = split.column() sub = column.box().column() sub.prop(colors, "line") sub.prop(colors, "separator") sub.prop(colors, "pointer") sub.prop(colors, "pointer_outline") sub.prop(colors, "pie_sel") sub.prop(colors, "item_highlight") column = split.column() sub = column.box().column() sub.active = not colors.use_theme sub.label("Menu Back:") sub.prop(colors, "menu_inner", text="Inner") sub.prop(colors, "menu_show_shaded") sub2 = sub.column(align=True) sub2.active = colors.menu_show_shaded sub2.prop(colors, "menu_shadetop") sub2.prop(colors, "menu_shadedown") sub.prop(colors, "text") column = split.column() sub = column.box().column() sub.active = not colors.use_theme sub.label("Title:") sub.prop(colors, "title_outline", text="Outline") sub.prop(colors, "title_inner", text="Inner") sub.prop(colors, "title_inner_sel", text="Inner Sel") sub.prop(colors, "title_text", text="Text") sub.prop(colors, "title_text_sel", text="Text Sel") sub.prop(colors, "title_show_shaded") sub2 = sub.column(align=True) sub2.active = colors.title_show_shaded sub2.prop(colors, "title_shadetop") sub2.prop(colors, "title_shadedown") column = split.column() sub = column.box().column() sub.active = not colors.use_theme sub.label("Item:") sub.prop(colors, "item_outline", text="Outline") sub.prop(colors, "item_inner", text="Inner") sub.prop(colors, "item_inner_sel", text="Inner Sel") sub.prop(colors, "item_text", text="Text") sub.prop(colors, "item_text_sel", text="Text Sel") sub.prop(colors, "item_show_shaded") sub2 = sub.column(align=True) sub2.active = colors.item_show_shaded sub2.prop(colors, "item_shadetop") sub2.prop(colors, "item_shadedown") column = split.column() sub = column.box().column() sub.active = not colors.use_theme sub.label("Tooltip:") sub.prop(colors, "tooltip_outline", text="Outline") sub.prop(colors, "tooltip_inner", text="Inner") sub.prop(colors, "tooltip_text", text="Text") sub.prop(colors, "tooltip_show_shaded") sub2 = sub.column(align=True) sub2.active = colors.tooltip_show_shaded sub2.prop(colors, "tooltip_shadetop") sub2.prop(colors, "tooltip_shadedown") draw_separator(layout) # Menus row = layout.row() row.label("Menus:") draw_menus(self, context, layout) draw_separator(layout) super().draw(context)