class NODE_OT_SynchroniseTextBlocks(types.Operator): bl_idname = "hive.synchronise_text_blocks" bl_label = "Reload From Text Block" node_id = props.IntProperty() mouse_x = props.FloatProperty() mouse_y = props.FloatProperty() @classmethod def poll(cls, context): return True def execute(self, context): node_tree = context.space_data.edit_tree blend_manager.reload_node_tree_from_source(node_tree) return {'FINISHED'}
class EXPORT_OT_lol(bpy.types.Operator, ExportHelper): '''Export a mesh as a League of Legends .skn file''' bl_idname = "export.lol" bl_label = "Export .skn" VERSION = props.IntProperty(name='Version No.', description='.SKN version number', default=4) OUTPUT_FILE = props.StringProperty( name='Export File', description='File to which model will be exported') BASE_ON_IMPORT = props.BoolProperty( name='Base On Imported SKN', description='Base writing on an imported SKN of choice', default=True) INPUT_FILE = props.StringProperty( name='Import File', description='File to import certain metadata from') MODEL_DIR = props.StringProperty() filename_ext = '.skn' def draw(self, context): layout = self.layout fileProps = context.space_data.params self.MODEL_DIR = fileProps.directory selectedFileExt = path.splitext(fileProps.filename)[-1].lower() self.OUTPUT_FILE = fileProps.filename box = layout.box() box.prop(self.properties, 'VERSION') box.prop(self.properties, 'OUTPUT_FILE') box.prop(self.properties, 'BASE_ON_IMPORT') box.prop(self.properties, 'INPUT_FILE') def execute(self, context): export_char(MODEL_DIR=self.MODEL_DIR, OUTPUT_FILE=self.OUTPUT_FILE, INPUT_FILE=self.INPUT_FILE, BASE_ON_IMPORT=self.BASE_ON_IMPORT, VERSION=self.VERSION) return {'FINISHED'}
class NODE_OT_GrabHiveNode(types.Operator): bl_idname = "hive.grab_hive_node" bl_label = "Grab Hive Node" node_id = props.IntProperty() mouse_x = props.FloatProperty() mouse_y = props.FloatProperty() @classmethod def poll(cls, context): return True def invoke(self, context, event): context.window_manager.modal_handler_add(self) return {'RUNNING_MODAL'} def modal(self, context, event): node_tree = context.space_data.edit_tree gui_node_manager = blend_manager.get_gui_manager_for_node_tree( node_tree) node_manager = gui_node_manager.node_manager # Get nodes node = gui_node_manager.gui_node_id_to_node[self.node_id] if event.type == 'MOUSEMOVE': mouse_x, mouse_y = context.space_data.cursor_location position = mouse_x / LOCATION_DIVISOR, mouse_y / LOCATION_DIVISOR node_manager.reposition_node(node, position) elif event.type in ('LEFTMOUSE', 'RETURN'): return {'FINISHED'} elif event.type == 'RIGHTMOUSE': node_manager.reposition_node(node, (0, 0)) return {'FINISHED'} elif event.type == 'ESC': return {'CANCELLED'} return {'RUNNING_MODAL'}
class EXPORT_OT_lolanm(bpy.types.Operator, ImportHelper): bl_label = "Export LoL Animation" bl_idname = "export.lolanm" OUTPUT_FILE = props.StringProperty( name='Export File', description='File to which animation will be exported') INPUT_FILE = props.StringProperty( name='Import File', description='File to import certain metadata from') OVERWRITE_FILE_VERSION = props.BoolProperty( name='Overwrite File Version', description='Write a version different from the imported file', default=False) VERSION = props.IntProperty(name='File Version', description='Overwrite file version', default=3) filename_ext = '.anm' def draw(self, context): layout = self.layout fileProps = context.space_data.params self.MODEL_DIR = fileProps.directory selectedFileExt = path.splitext(fileProps.filename)[-1].lower() self.OUTPUT_FILE = fileProps.filename box = layout.box() box.prop(self.properties, 'OUTPUT_FILE') box.prop(self.properties, 'INPUT_FILE') box.prop(self.properties, 'OVERWRITE_FILE_VERSION') if self.OVERWRITE_FILE_VERSION: box.prop(self.properties, 'VERSION') def execute(self, context): export_animation(MODEL_DIR=self.MODEL_DIR, OUTPUT_FILE=self.OUTPUT_FILE, INPUT_FILE=self.INPUT_FILE, OVERWRITE_FILE_VERSION=self.OVERWRITE_FILE_VERSION, VERSION=self.VERSION) return {'FINISHED'}
class LOGIC_OT_show_states(types.Operator): """Read currently visible states from mask for this netmode""" bl_idname = "network.show_states" bl_label = "Set the states for this netmode visible" index = props.IntProperty() @classmethod def poll(cls, context): return context.active_object is not None def execute(self, context): obj = context.active_object active_state_group = obj.states[self.index] obj.game.states_visible = active_state_group.states for area in context.screen.areas: if area.type != 'LOGIC_EDITOR': continue area.tag_redraw() return {'FINISHED'}
class _PieMenu(ExecuteString): # {idname: index, ...} _last_item_index = {} idname = props.StringProperty(name="ID Name", get=prop_idname_get, set=prop_idname_set) active = props.BoolProperty(name="Active", description="Activate or deactivate menu", default=True) show_expanded = props.BoolProperty() poll_string = props.StringProperty( name="Poll", description="e.g.\nreturn context.mode == 'EDIT_MESH'", ) init_string = props.StringProperty(name="Init", ) label = props.StringProperty( name="Label", description="Menu title", ) draw_type = props.EnumProperty(name="Draw Type", items=[('SIMPLE', "Simple", ""), ('BOX', "Box", ""), ('CIRCLE', "Circle", "")], default='BOX', get=prop_draw_type_get, set=prop_draw_type_set) icon_scale = props.FloatProperty( name="Icon Scale", default=1.0, min=1.0, max=10.0, ) icon_expand = props.FloatProperty( name="Icon Expand", default=0.0, min=-1.0, max=1.0, ) radius = props.IntProperty(name="Radius", description="Pie menu size in pixels", min=0, default=0, get=prop_radius_get, set=prop_radius_set) quick_action = props.EnumProperty( name="Quick Action", items=[('NONE', "None", ""), ('LAST', "Last", ""), ('FIXED', "Fixed", "")], default='NONE', ) quick_action_index = props.IntProperty( name="Quick Action Index", description="", min=0, max=16, default=0, ) highlight = props.EnumProperty( name="Highlight", items=[('NONE', "None", ""), ('LAST', "Last", ""), ('FIXED', "Fixed", "")], default='NONE', ) highlight_index = props.IntProperty( name="Highlight Index", description="", min=0, max=16, default=0, ) translate = props.BoolProperty( name="Translate", default=True, ) items_num = props.EnumProperty( name="Number of Items", items=[('4', "4", ""), ('8', "8", ""), ('16', "16", "")], default='8', ) # menu_items = props.CollectionProperty( # name="Items", type=PieMenuItem) menu_items = [] # ↑継承で上書きする場合に問題が発生する item_order = props.EnumProperty( name="Item Order", items=[ ('CW', "Clockwise", "[0, 1, 2, 3, 4, 5, 6, 7]"), ('CW6', "Clockwise 6", "[4, 5, 6, 7, 0, 1, 2, 3] Start from six o'clock"), ('OFFICIAL', "Official", "[3, 5, 1, 7, 2, 6, 0, 4]"), ('MODIFIED', "Modified", "[3, 7, 1, 5, 2, 4, 0, 6]"), ], default='OFFICIAL', ) next = props.StringProperty( name="Next Menu", description="Shortcut: wheel down", ) prev = props.StringProperty( name="Previous Menu", description="Shortcut: wheel up", ) # 上書き radius_ = props.IntProperty() quick_action_index_ = props.IntProperty() highlight_index_ = props.IntProperty() # 描画時に使用 active_index = props.IntProperty(default=-1) active_item_index = props.IntProperty(default=-1) # -1: None is_valid_click = props.BoolProperty(default=True) co = props.FloatVectorProperty(subtype='XYZ', size=2) current_items_type = props.StringProperty( ) # "", "shift", "ctrl", "alt", "oskey" @property def item_boundary_angles(self): return self["item_boundary_angles"] @item_boundary_angles.setter def item_boundary_angles(self, value): self["item_boundary_angles"] = value @property def current_items(self): mod = self.current_items_type items = [] for item in self.menu_items: if item.active: if mod == "shift" and item.shift.active: items.append(item.shift) elif mod == "ctrl" and item.ctrl.active: items.append(item.ctrl) else: items.append(item) ls = [] for i in self["current_items_indices"]: if i == -1: ls.append(None) else: item = items[i] if item.type == 'SPACER': ls.append(None) else: ls.append(item) return ls def poll(self, context, event=None): if self.poll_string: return bool(self.exec_string("poll_string", context, event)) else: return True def init(self, context): if self.init_string: self.exec_string("init_string", context, None) @staticmethod def calc_item_indices(item_order, num): def sort_cw(): for n in (4, 8, 16): if num <= n: return list(range(num)) + [-1] * (n - num) def sort_cw6(): indices = sort_cw() n = int(len(indices) / 2) indices = indices[n:] + indices[:n] return indices def sort_official_modified(modified=False): if modified: if num <= 4: order = [3, 1, 2, 0] elif num <= 8: order = [3, 7, 1, 5, 2, 4, 0, 6] else: # if num <= 16: order = [ 3, 15, 7, 11, 1, 9, 5, 13, 2, 12, 4, 8, 0, 10, 6, 14 ] else: if num <= 4: order = [3, 1, 2, 0] elif num <= 8: order = [3, 5, 1, 7, 2, 6, 0, 4] else: # if num <= 16: order = [ 3, 15, 5, 11, 1, 9, 7, 13, 2, 12, 6, 8, 0, 10, 4, 14 ] indices = list(range(num)) + [-1] * (len(order) - num) return [indices[i] for i in order] if num > 16: raise ValueError() if item_order == 'CW': indices = sort_cw() elif item_order == 'CW6': indices = sort_cw6() elif item_order == 'OFFICIAL': indices = sort_official_modified() else: # elif self.item_order == 'MODIFIED': indices = sort_official_modified(True) return indices def update_current_items(self, context, op): mod = op.last_modifier() self.current_items_type = mod items = [] for item in self.menu_items: if item.active: if mod == "shift" and item.shift.active: items.append(item.shift) elif mod == "ctrl" and item.ctrl.active: items.append(item.ctrl) else: items.append(item) items = items[:16] num = len(items) indices = self.calc_item_indices(self.item_order, num) self["current_items_indices"] = indices # quick_action_index, highlight_index if num <= 4: n = 4 elif num <= 8: n = 8 else: # if num <= 16: n = 16 indices_ = self.calc_item_indices(self.item_order, n) for attr in ["quick_action_index", "highlight_index"]: index = getattr(self, attr) if 0 <= index < num: setattr(self, attr + "_", indices_.index(index)) # poll() for i in indices: if i != -1: item = items[i] item.enabled = item.poll(context) # calc boundaries num = len(indices) pie_angle = math.pi * 2 / num item_boundary_angles = [[0.0, 0.0] for i in range(num)] current_items = self.current_items for i, item in enumerate(current_items): if not item: continue angle = math.pi * 0.5 - pie_angle * i if angle < -1e-5: angle += math.pi * 2 # CCW side for k in range(1, num + 1): if current_items[i - k]: ang = angle + pie_angle * k * 0.5 item_boundary_angles[i][0] = ang break # CW side for k in range(1, num + 1): if current_items[(i + k) % num]: ang = angle - pie_angle * k * 0.5 item_boundary_angles[i][1] = ang break self.item_boundary_angles = item_boundary_angles def correct_radius(self): """Item同士が重ならないようにMenu半径を大きくする。 値は redius_ に格納する """ addon_prefs = pie_menu.addon_preferences radius = self.get("radius", addon_prefs.menu_radius) current_items = self.current_items if len(current_items) == 0: return pie_angle = math.pi * 2 / len(current_items) widget_unit = vawm.widget_unit() if self.draw_type == 'SIMPLE': n = len(current_items) / 4 r = widget_unit * (n - 0.5) + addon_prefs.item_min_space * n self.radius_ = max(r, radius) else: icon_box_size = widget_unit * self.icon_scale if self.draw_type == 'CIRCLE': # >>> (r + icon_size / 2) * math.sin(pie_angle / 2) = \ # (icon_size + item_min_space) / 2 r = (icon_box_size + addon_prefs.item_min_space) / 2 / \ math.sin(pie_angle / 2) - icon_box_size / 2 self.radius_ = max(r, radius) else: # 'BOX' # >>> (r + icon_size / 2) * math.sin(pie_angle) = \ # icon_size + item_min_space r = (icon_box_size + addon_prefs.item_min_space) / \ math.sin(pie_angle) - icon_box_size / 2 self.radius_ = max(r, radius) def calc_active(self, mco): """:rtype: (int, int)""" addon_prefs = pie_menu.addon_preferences current_items = self.current_items if not current_items: return -1, -1 vec = mco - self.co if vec.length < addon_prefs.menu_radius_center: active_index = -1 else: idx = 0 for i, item in enumerate(current_items): if not item: continue idx = i a1, a2 = self.item_boundary_angles[i] a1 += 1e-4 a2 -= 1e-4 v1 = (math.cos(a1), math.sin(a1)) v2 = (math.cos(a2), math.sin(a2)) if cross2d(v2, vec) >= 0 and cross2d(vec, v1) >= 0: active_index = i break else: active_index = idx active_item_index = -1 if active_index == -1: if self.quick_action == 'LAST': last_item_index = self.get_last_item_index() if 0 <= last_item_index < len(current_items): item = current_items[last_item_index] if item: active_item_index = last_item_index elif self.quick_action == 'FIXED': if 0 <= self.quick_action_index_ < len(current_items): item = current_items[self.quick_action_index_] if item: active_item_index = self.quick_action_index_ else: item = current_items[active_index] if item: active_item_index = active_index return active_index, active_item_index def update_active(self, mco, mco_press): """active_indexとactive_itemを更新。 """ self.active_index, self.active_item_index = self.calc_active(mco) if mco_press is not None: i, _ = self.calc_active(mco_press) self.is_valid_click = i == self.active_index else: self.is_valid_click = True def get_last_item_index(self): return self._last_item_index.get(self.idname, -1) def set_last_item_index(self, index): self._last_item_index[self.idname] = index def clear_last_item_idnex(self): if self.idname in self._last_item_index: del self._last_item_index[self.idname] def draw_ui(self, context, layout): if self.show_expanded: main_layout = layout.box().column() else: main_layout = layout.column() main_layout.context_pointer_set("pie_menu", self) row = main_layout.row() icon = 'TRIA_DOWN' if self.show_expanded else 'TRIA_RIGHT' sub = row.row() sub.alignment = 'LEFT' sub.prop(self, "show_expanded", text="", icon=icon, emboss=False) sub.prop(self, "active", text="") sub = row.row() if not self.active: sub.active = False sub.prop(self, "label", text="") sub2 = sub.row() """:type: bpy.types.UILayout""" if not self.idname: sub2.alert = True sub2.prop(self, "name", text="ID Name") sub = row.row(align=True) sub.alignment = 'RIGHT' sub1 = sub.row(align=True) op = sub1.operator(ops.WM_OT_pie_menu_menu_copy.bl_idname, text="", icon='COPYDOWN') sub2 = sub.row(align=True) op = sub2.operator(ops.WM_OT_pie_menu_menu_paste.bl_idname, text="", icon='PASTEDOWN') sub1 = sub.row(align=True) op = sub1.operator(ops.WM_OT_pie_menu_menu_move.bl_idname, text="", icon='TRIA_UP') op.direction = -1 sub2 = sub.row(align=True) op = sub2.operator(ops.WM_OT_pie_menu_menu_move.bl_idname, text="", icon='TRIA_DOWN') op.direction = 1 sub.operator(ops.WM_OT_pie_menu_menu_remove.bl_idname, text="", icon='X') if not self.show_expanded: return column = main_layout.column() row = column.row() split = row.split() sp_column1 = split.column() sp_column2 = split.column() draw_property(sp_column1, self, "draw_type", unset=True, context_attr="pie_menu") draw_property(sp_column1, self, "icon_scale") draw_property(sp_column1, self, "icon_expand") draw_property(sp_column1, self, "radius", unset=True, context_attr="pie_menu") draw_property(sp_column1, self, "translate") draw_property(sp_column1, self, "item_order") sp_column2.label("Quick Action:") draw_property(sp_column2, self, "quick_action", text="", context_attr="pie_menu") sub = sp_column2.row() if self.quick_action != 'FIXED': sub.active = False draw_property(sub, self, "quick_action_index", context_attr="pie_menu") sp_column2.label("Highlight:") draw_property(sp_column2, self, "highlight", text="", context_attr="pie_menu") sub = sp_column2.row() if self.highlight != 'FIXED': sub.active = False draw_property(sub, self, "highlight_index", context_attr="pie_menu") draw_separator(column) draw_property(column, self, "poll_string", "Poll Function", paste=True, context_attr="pie_menu") draw_property(column, self, "init_string", "Init Function", paste=True, context_attr="pie_menu") draw_separator(column) column = main_layout.column() for i, item in enumerate(self.menu_items): col = column.column() item.draw_ui(context, col, self, i) row = column.row() row.alignment = 'LEFT' op = row.operator(ops.WM_OT_pie_menu_item_add.bl_idname, text="Add Item", icon='ZOOMIN')
class ParallelRenderPropertyGroup(types.PropertyGroup): def update(self, context): addon_props = context.user_preferences.addons[__name__].preferences if not addon_props.ffmpeg_valid and self.concatenate: LOGGER.info( "ParallelRenderPropertyGroup forcing concatenate to false") self.concatenate = False self.clean_up_parts = False if not self.concatenate: self.clean_up_parts = False last_run_result = props.EnumProperty( items=[ # (identifier, name, description, icon, number) ('done', '', ''), ('pending', '', ''), ('failed', '', ''), ], name="Render Batch Size") batch_type = props.EnumProperty( items=[ # (identifier, name, description, icon, number) ('parts', 'No. parts', 'Render in given number of batches (automatically splits it)'), ('fixed', 'Fixed', 'Render in fixed size batches'), ], name="Render Batch Size") max_parallel = props.IntProperty( name="Number of background worker Blender instances", min=1, default=cpu_count() - 1, max=10000) overwrite = props.BoolProperty( name="Overwrite existing files", default=True, ) mixdown = props.BoolProperty( name="Mixdown sound", default=True, ) concatenate = props.BoolProperty( name="Concatenate output files into one", update=lambda self, context: self.update(context), ) clean_up_parts = props.BoolProperty( name="Clean up partial files (after successful concatenation)", ) fixed = props.IntProperty(name="Number of frames per batch", min=1, default=300, max=10000) parts = props.IntProperty(name="Number of batches", min=1, default=cpu_count() * 2, max=10000)
class ParallelRenderPropertyGroup(types.PropertyGroup): def update(self, context): addon_props = context.preferences.addons[__name__].preferences if not addon_props.ffmpeg_valid and self.concatenate: LOGGER.info( "ParallelRenderPropertyGroup forcing concatenate to false") self.concatenate = False self.clean_up_parts = False if not self.concatenate: self.clean_up_parts = False last_run_result: props.EnumProperty( items=[ # (identifier, name, description, icon, number) ('done', '', ''), ('pending', '', ''), ('failed', '', ''), ], name="Render Batch Size") batch_type: props.EnumProperty( items=[ # (identifier, name, description, icon, number) ('parts', 'Parts', 'Render in given number of batches (automatically splits it)'), ('fixed', 'Fixed', 'Render in fixed size batches'), ], name="Render Batch Size") max_parallel: props.IntProperty(name="Blender Instances", min=1, default=cpu_count() - 1, max=10000) overwrite: props.BoolProperty( name="Overwrite Existing Files", default=True, ) mixdown: props.BoolProperty( name="Mixdown Sound", default=True, ) concatenate: props.BoolProperty( name="Concatenate Output Files", update=lambda self, context: self.update(context), ) clean_up_parts: props.BoolProperty(name="Clean Up Partial Files", ) fixed: props.IntProperty(name="Number of Frames per Batch", min=1, default=300, max=10000) parts: props.IntProperty(name="Number of Parts", min=1, default=(cpu_count() - 1) * 2, max=10000)
class RF_OT_Reflow(bpy.types.Operator): bl_idname = "keys.reflow" bl_label = "Change fps for animations" bl_description = "Recalculate animations for a different fps" bl_options = {"REGISTER", "UNDO"} # Settings # ------------------------------------------------------------------------- fps_source = prop.IntProperty(name="Source FPS", min=1, default=24, description="Original FPS to convert from") fps_dest = prop.IntProperty(name="Destination FPS", min=1, default=60, description="Final FPS to convert to") do_actions = prop.BoolProperty( name="Change actions", description="Move keyframes in actions", default=True, ) do_nla = prop.BoolProperty( name="Fix NLA Tracks", description=("Change Start and End frames" " For NLA Tracks"), default=True, ) do_markers = prop.BoolProperty( name="Change Markers", description="Move markers' frames", default=True, ) do_markers_name = prop.BoolProperty( name="Change Marker Names", description=("Try to change markers" " default names"), default=True, ) do_fix_endframe = prop.BoolProperty( name="Change end frame", description=("Change scene's end" " end frame"), default=True, ) # Loop Methods # ------------------------------------------------------------------------- def keyframe_resample(self, curve): """ Resample every keyframe in a curve """ for keyframe in curve.keyframe_points: frame_original = keyframe.co[0] if frame_original != 0: keyframe.co[0] = frame_original // self.diff def fix_nla_length(self, track): """ Fix start and end frames for NLA tracks """ for strip in track.strips: strip.action_frame_start //= self.diff strip.action_frame_end //= self.diff # Main Methods # ------------------------------------------------------------------------- @classmethod def poll(cls, context): return len(bpy.data.actions) > 0 def invoke(self, context, event): """ Show settings dialog """ # Set default FPS from current FPS self.fps_source = context.scene.render.fps return context.window_manager.invoke_props_dialog(self) def draw(self, context): """ Draw settings dialog """ self.layout.separator() row = self.layout.row() row.prop(self, "fps_source") row.label("", icon="FORWARD") row.prop(self, "fps_dest") self.layout.separator() row = self.layout.row() row.label("Settings", icon="SCRIPTWIN") row = self.layout.row() row.prop(self, "do_nla") row = self.layout.row() row.prop(self, "do_actions") row = self.layout.row() row.prop(self, "do_markers") row = self.layout.row() row.prop(self, "do_markers_name") row = self.layout.row() row.prop(self, "do_fix_endframe") self.layout.separator() def execute(self, context): """ Resample animation data """ # Init # --------------------------------------------------------------------- render = context.scene.render actions = bpy.data.actions markers = context.scene.timeline_markers objects = bpy.data.objects self.diff = self.fps_source / self.fps_dest if self.diff == 1: self.report({"WARNING"}, "Source and Destination FPS are the same.") return {"CANCELLED"} # Set new FPS in scene properties render.fps = self.fps_dest # Fix endframe # --------------------------------------------------------------------- if self.do_fix_endframe: scene.frame_end = scene.frame_end // self.diff # Fix actions # --------------------------------------------------------------------- if self.do_actions: for action in actions: for curve in action.fcurves: self.keyframe_resample(curve) # Fix NLA tracks # --------------------------------------------------------------------- if self.do_nla: for obj in objects: if obj.animation_data and obj.animation_data.use_nla: for track in obj.animation_data.nla_tracks: self.fix_nla_length(track) # Fix Markers # --------------------------------------------------------------------- if self.do_markers: for mark in markers: if mark.frame != 0: new_frame = mark.frame // self.diff mark.frame = new_frame if self.do_markers_name: regex = re.match('^F_[0-9]*$', mark.name) if regex: mark.name = 'F_{0}'.format(new_frame) return {'FINISHED'}
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 ProbeProperties(bpy.types.PropertyGroup): name = p.StringProperty(name="Probe Name", default="") theta_res = p.IntProperty(name="Theta Samples", default=10) phi_res = p.IntProperty(name="Phi Samples", default=20) samples = p.IntProperty(name="Bake samples", default=1000)
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)
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)