def draw(self, context): layout = self.layout st = context.space_data text = st.text row = layout.row(align=True) row.template_header() TEXT_MT_editor_menus.draw_collapsible(context, layout) if text and text.is_modified: sub = row.row(align=True) sub.alert = True sub.operator("text.resolve_conflict", text="", icon='HELP') row = layout.row(align=True) row.template_ID(st, "text", new="text.new", unlink="text.unlink", open="text.open") if text: osl = text.name.endswith(".osl") or text.name.endswith(".oso") if not osl: row = layout.row() row.operator("text.run_script") if context.scene.mv.ui.use_default_blender_interface: row = layout.row(align=True) row.prop(st, "show_line_numbers", text="") row.prop(st, "show_word_wrap", text="") row.prop(st, "show_syntax_highlight", text="") if text: osl = text.name.endswith(".osl") or text.name.endswith(".oso") if osl: row = layout.row() row.operator("node.shader_script_update") else: row = layout.row() row.operator("text.run_script") row = layout.row() row.active = text.name.endswith(".py") row.prop(text, "use_module") if text: row = layout.row() if text.filepath: if text.is_dirty: row.label("(unsaved)",icon='ERROR') row.label(text=iface_("File: *%r") % text.filepath, translate=False) else: row.label(text=iface_("File: %r") % text.filepath, translate=False) else: row.label(text="Text: External" if text.library else "Text: Internal")
def draw(self, context): layout = self.layout scene = context.scene frame_current = scene.frame_current strip = act_strip(context) split = layout.split(percentage=0.3) split.label(text="Name:") split.prop(strip, "name", text="") split = layout.split(percentage=0.3) split.label(text="Type:") split.prop(strip, "type", text="") if strip.type not in {'SOUND'}: split = layout.split(percentage=0.3) split.label(text="Blend:") split.prop(strip, "blend_type", text="") row = layout.row(align=True) sub = row.row(align=True) sub.active = (not strip.mute) sub.prop(strip, "blend_alpha", text="Opacity", slider=True) row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="") row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="") col = layout.column() sub = col.column() sub.enabled = not strip.lock sub.prop(strip, "channel") sub.prop(strip, "frame_start") sub.prop(strip, "frame_final_duration") col = layout.column(align=True) row = col.row(align=True) row.label(text=iface_("Final Length: %s") % bpy.utils.smpte_from_frame(strip.frame_final_duration), translate=False) row = col.row(align=True) row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration) row.label(text=iface_("Playhead: %d") % (frame_current - strip.frame_start), translate=False) col.label(text=iface_("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end), translate=False) col.label(text=iface_("Frame Still %d:%d") % (strip.frame_still_start, strip.frame_still_end), translate=False) elem = False if strip.type == 'IMAGE': elem = strip.strip_elem_from_frame(frame_current) elif strip.type == 'MOVIE': elem = strip.elements[0] if elem and elem.orig_width > 0 and elem.orig_height > 0: col.label(text=iface_("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False) else: col.label(text="Original Dimension: None")
def draw(self, context): layout = self.layout st = context.space_data text = st.text row = layout.row(align=True) row.template_header() if context.area.show_menus: row.menu("TEXT_MT_view") row.menu("TEXT_MT_text") if text: row.menu("TEXT_MT_edit") row.menu("TEXT_MT_format") row.menu("TEXT_MT_templates") if text and text.is_modified: sub = row.row() sub.alert = True sub.operator("text.resolve_conflict", text="", icon='HELP') row.template_ID(st, "text", new="text.new", unlink="text.unlink") row = layout.row(align=True) row.prop(st, "show_line_numbers", text="") row.prop(st, "show_word_wrap", text="") row.prop(st, "show_syntax_highlight", text="") if text: osl = text.name.endswith(".osl") or text.name.endswith(".oso") if osl: row = layout.row() row.operator("node.shader_script_update") else: row = layout.row() row.operator("text.run_script") row = layout.row() row.active = text.name.endswith(".py") row.prop(text, "use_module") row = layout.row() if text.filepath: if text.is_dirty: row.label(text=iface_("File: *%r (unsaved)") % text.filepath, translate=False) else: row.label(text=iface_("File: %r") % text.filepath, translate=False) else: row.label(text="Text: External" if text.library else "Text: Internal")
def draw(self, context): layout = self.layout st = context.space_data is_preview = st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'} is_sequencer_view = st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'} if st.view_type == 'PREVIEW': # Specifying the REGION_PREVIEW context is needed in preview-only # mode, else the lookup for the shortcut will fail in # wm_keymap_item_find_props() (see #32595). layout.operator_context = 'INVOKE_REGION_PREVIEW' layout.operator("sequencer.properties", icon='MENU_PANEL') layout.operator_context = 'INVOKE_DEFAULT' layout.separator() if is_sequencer_view: layout.operator("sequencer.view_all", text="View all Sequences") layout.operator("sequencer.view_selected") if is_preview: layout.operator_context = 'INVOKE_REGION_PREVIEW' layout.operator("sequencer.view_all_preview", text="Fit preview in window") layout.separator() ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) for a, b in ratios: layout.operator("sequencer.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b layout.separator() layout.operator_context = 'INVOKE_DEFAULT' # # XXX, invokes in the header view # layout.operator("sequencer.view_ghost_border", text="Overlay Border") if is_sequencer_view: layout.prop(st, "show_seconds") layout.prop(st, "show_frame_indicator") layout.prop(st, "show_strip_offset") layout.prop_menu_enum(st, "waveform_draw_type") if is_preview: if st.display_mode == 'IMAGE': layout.prop(st, "show_safe_areas") elif st.display_mode == 'WAVEFORM': layout.prop(st, "show_separate_color") layout.separator() if is_sequencer_view: layout.prop(st, "use_marker_sync") layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area", text="Toggle Maximize Area") layout.operator("screen.screen_full_area").use_hide_panels = True
def DECIMATE(self, layout, ob, md): decimate_type = md.decimate_type row = layout.row() row.prop(md, "decimate_type", expand=True) if decimate_type == 'COLLAPSE': layout.prop(md, "ratio") split = layout.split() row = split.row(align=True) row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') split.prop(md, "use_collapse_triangulate") elif decimate_type == 'UNSUBDIV': layout.prop(md, "iterations") else: # decimate_type == 'DISSOLVE': layout.prop(md, "angle_limit") layout.prop(md, "use_dissolve_boundaries") layout.label("Delimit:") row = layout.row() row.prop(md, "delimit") layout.label(text=iface_("Face Count: %d") % md.face_count, translate=False)
def draw(self, context): layout = self.layout strip = act_strip(context) layout.template_ID(strip, "scene") scene = strip.scene layout.prop(strip, "use_sequence") if not strip.use_sequence: layout.label(text="Camera Override") layout.template_ID(strip, "scene_camera") layout.prop(strip, "use_grease_pencil", text="Show Grease Pencil") if scene: layout.prop(scene, "audio_volume", text="Audio Volume") if not strip.use_sequence: if scene: # Warning, this is not a good convention to follow. # Expose here because setting the alpha from the 'Render' menu is very inconvenient. layout.label("Preview") layout.prop(scene.render, "alpha_mode") if scene: sta = scene.frame_start end = scene.frame_end layout.label(text=iface_("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
def draw(self, context): layout = self.layout sima = context.space_data uv = sima.uv_editor toolsettings = context.tool_settings paint = toolsettings.image_paint show_uvedit = sima.show_uvedit show_render = sima.show_render layout.operator("image.properties", icon='MENU_PANEL') layout.operator("image.toolshelf", icon='MENU_PANEL') layout.separator() layout.prop(sima, "use_realtime_update") if show_uvedit: layout.prop(toolsettings, "show_uv_local_view") layout.prop(uv, "show_other_objects") layout.prop(uv, "show_metadata") if paint.brush and (context.image_paint_object or sima.mode == 'PAINT'): layout.prop(uv, "show_texpaint") layout.prop(toolsettings, "show_uv_local_view", text="Show same material") layout.separator() layout.operator("image.view_zoom_in") layout.operator("image.view_zoom_out") layout.separator() ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) for a, b in ratios: layout.operator("image.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b layout.separator() if show_uvedit: layout.operator("image.view_selected") layout.operator("image.view_all") layout.operator("image.view_all", text="View Fit").fit_view = True layout.separator() if show_render: layout.operator("image.cycle_render_slot", text="Render Slot Cycle Next") layout.operator("image.cycle_render_slot", text="Render Slot Cycle Previous").reverse = True layout.operator("image.clear_render_border", text = "Clear Render Border") layout.operator("image.render_border", text = "Render Border") layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area", text="Toggle Maximize Area") layout.operator("screen.screen_full_area").use_hide_panels = True
def draw(self, context): layout = self.layout st = context.space_data text = st.text row = layout.row(align=True) ALL_MT_editormenu.draw_hidden(context, layout) # bfa - show hide the editormenu TEXT_MT_editor_menus.draw_collapsible(context, layout) if text and text.is_modified: sub = row.row(align=True) sub.alert = True sub.operator("text.resolve_conflict", text="", icon='HELP') row = layout.row(align=True) row.template_ID(st, "text", new="text.new", unlink="text.unlink", open="text.open") if text: osl = text.name.endswith(".osl") or text.name.endswith(".oso") if osl: row = layout.row() row.operator("node.shader_script_update") else: row = layout.row() row.operator("text.run_script") row = layout.row() row.active = text.name.endswith(".py") row.prop(text, "use_module") row = layout.row() if text.filepath: if text.is_dirty: row.label(text=iface_("File: *%r (unsaved)") % text.filepath, translate=False) else: row.label(text=iface_("File: %r") % text.filepath, translate=False) else: row.label(text="Text: External" if text.library else "Text: Internal")
def draw_layers(self, context, layout, gpd): row = layout.row() col = row.column() if len(gpd.layers) >= 2: layer_rows = 5 else: layer_rows = 3 col.template_list("GPENCIL_UL_annotation_layer", "", gpd, "layers", gpd.layers, "active_index", rows=layer_rows, sort_reverse=True, sort_lock=True) col = row.column() sub = col.column(align=True) sub.operator("gpencil.layer_add", icon='ADD', text="") sub.operator("gpencil.layer_remove", icon='REMOVE', text="") gpl = context.active_gpencil_layer if gpl: if len(gpd.layers) > 1: col.separator() sub = col.column(align=True) sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP' sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN' tool_settings = context.tool_settings if gpd and gpl: layout.prop(gpl, "thickness") else: layout.prop(tool_settings, "annotation_thickness", text="Thickness") if gpl: # Full-Row - Frame Locking (and Delete Frame) row = layout.row(align=True) row.active = not gpl.lock if gpl.active_frame: lock_status = iface_("Locked") if gpl.lock_frame else iface_("Unlocked") lock_label = iface_("Frame: %d (%s)") % (gpl.active_frame.frame_number, lock_status) else: lock_label = iface_("Lock Frame") row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED') row.operator("gpencil.active_frame_delete", text="", icon='X')
def draw(self, context): layout = self.layout mat = context.material # don't use node material halo = mat.halo def number_but(layout, toggle, number, name, color): row = layout.row(align=True) row.prop(halo, toggle, text="") sub = row.column(align=True) sub.active = getattr(halo, toggle) sub.prop(halo, number, text=name, translate=False) if not color == "": sub.prop(mat, color, text="") split = layout.split() col = split.column() col.prop(mat, "alpha") col.prop(mat, "diffuse_color", text="") col.prop(halo, "seed") col = split.column() col.prop(halo, "size") col.prop(halo, "hardness") col.prop(halo, "add") layout.label(text="Options:") split = layout.split() col = split.column() col.prop(halo, "use_texture") col.prop(halo, "use_vertex_normal") col.prop(halo, "use_extreme_alpha") col.prop(halo, "use_shaded") col.prop(halo, "use_soft") col = split.column() number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color") number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_color") number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "")
def draw(self, context): layout = self.layout mat = context.material # don't use node material halo = mat.halo def number_but(layout, toggle, number, name, color): row = layout.row(align=True) row.prop(halo, toggle, text="") sub = row.column(align=True) sub.active = getattr(halo, toggle) sub.prop(halo, number, text=name, translate=False) if not color == "": sub.prop(mat, color, text="") split = layout.split() col = split.column() col.prop(mat, "alpha") col.prop(mat, "diffuse_color", text="") col = split.column() col.prop(halo, "size") col.prop(halo, "hardness") layout.label(text=_("Options:")) number_but(layout, "use_ring", "ring_count", iface_(_("Rings")), "mirror_color") number_but(layout, "use_lines", "line_count", iface_(_("Lines")), "specular_color") number_but(layout, "use_star", "star_tip_count", iface_(_("Star Tips")), "") row = layout.row() row.prop(mat, "b4w_halo_sky_stars", text = _("Special: Stars")); if mat.b4w_halo_sky_stars: row = layout.row() row.prop(mat, "b4w_halo_stars_blend_height", text = _("Blending Height")); row = layout.row() row.prop(mat, "b4w_halo_stars_min_height", text = _("Minimum Height"));
def draw_km(display_keymaps, kc, km, children, layout, level): km = km.active() layout.context_pointer_set("keymap", km) col = _indented_layout(layout, level) row = col.row(align=True) row.prop(km, "show_expanded_children", text="", emboss=False) row.label(text=km.name, text_ctxt=i18n_contexts.id_windowmanager) if km.is_user_modified or km.is_modal: subrow = row.row() subrow.alignment = 'RIGHT' if km.is_user_modified: subrow.operator("wm.keymap_restore", text="Restore") if km.is_modal: subrow.label(text="", icon='LINKED') del subrow if km.show_expanded_children: if children: # Put the Parent key map's entries in a 'global' sub-category # equal in hierarchy to the other children categories subcol = _indented_layout(col, level + 1) subrow = subcol.row(align=True) subrow.prop(km, "show_expanded_items", text="", emboss=False) subrow.label(text=iface_("%s (Global)") % km.name, translate=False) else: km.show_expanded_items = True # Key Map items if km.show_expanded_items: kmi_level = level + 3 if children else level + 1 for kmi in km.keymap_items: draw_kmi(display_keymaps, kc, km, kmi, col, kmi_level) # "Add New" at end of keymap item list subcol = _indented_layout(col, kmi_level) subcol = subcol.split(percentage=0.2).column() subcol.operator("wm.keyitem_add", text="Add New", text_ctxt=i18n_contexts.id_windowmanager, icon='ZOOMIN') col.separator() # Child key maps if children: for entry in children: draw_entry(display_keymaps, entry, col, level + 1) col.separator()
def draw(self, context): layout = self.layout strip = act_strip(context) layout.template_ID(strip, "mask") mask = strip.mask if mask: sta = mask.frame_start end = mask.frame_end layout.label(text=iface_("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
def draw(self, _context): layout = self.layout ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) for i, (a, b) in enumerate(ratios): if i in {3, 4}: # Draw separators around Zoom 1:1. layout.separator() layout.operator( "image.view_zoom_ratio", text=iface_(f"Zoom {a:d}:{b:d}"), translate=False, ).ratio = a / b
def draw(self, context): layout = self.layout sima = context.space_data uv = sima.uv_editor toolsettings = context.tool_settings show_uvedit = sima.show_uvedit show_render = sima.show_render layout.operator("image.properties", icon='MENU_PANEL') layout.operator("image.scopes", icon='MENU_PANEL') layout.separator() layout.prop(sima, "use_realtime_update") if show_uvedit: layout.prop(toolsettings, "show_uv_local_view") layout.prop(uv, "show_other_objects") layout.separator() layout.operator("image.view_zoom_in") layout.operator("image.view_zoom_out") layout.separator() ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) for a, b in ratios: layout.operator("image.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b layout.separator() if show_uvedit: layout.operator("image.view_selected") layout.operator("image.view_all") layout.separator() if show_render: layout.operator("image.cycle_render_slot", text="Render Slot Cycle Next") layout.operator("image.cycle_render_slot", text="Render Slot Cycle Previous").reverse = True layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area")
def draw(self, context): layout = self.layout i18n_sett = context.window_manager.i18n_update_svn_settings if not i18n_sett.is_init and bpy.ops.ui.i18n_updatetranslation_svn_init_settings.poll(): bpy.ops.ui.i18n_updatetranslation_svn_init_settings() if not i18n_sett.is_init: layout.label(text="Could not init languages data!") layout.label(text="Please edit the preferences of the UI Translate add-on") else: split = layout.split(0.75) split.template_list("UI_UL_i18n_languages", "", i18n_sett, "langs", i18n_sett, "active_lang", rows=8) col = split.column() col.operator("ui.i18n_updatetranslation_svn_init_settings", text="Reset Settings") deselect = any(l.use for l in i18n_sett.langs) op = col.operator("ui.i18n_updatetranslation_svn_settings_select", text="Deselect All" if deselect else "Select All") op.use_invert = False op.use_select = not deselect col.operator("ui.i18n_updatetranslation_svn_settings_select", text="Invert Selection").use_invert = True col.separator() col.operator("ui.i18n_updatetranslation_svn_branches", text="Update Branches") col.operator("ui.i18n_updatetranslation_svn_trunk", text="Update Trunk") col.operator("ui.i18n_updatetranslation_svn_statistics", text="Statistics") if i18n_sett.active_lang >= 0 and i18n_sett.active_lang < len(i18n_sett.langs): lng = i18n_sett.langs[i18n_sett.active_lang] col = layout.column() col.active = lng.use row = col.row() row.label(text="[{}]: \"{}\" ({})".format(lng.uid, iface_(lng.name), lng.num_id), translate=False) row.prop(lng, "use", text="") col.prop(lng, "po_path") col.prop(lng, "po_path_trunk") col.prop(lng, "mo_path_trunk") col.prop(lng, "po_path_git") layout.separator() layout.prop(i18n_sett, "pot_path") layout.separator() layout.label("Add-ons:") row = layout.row() op = row.operator("ui.i18n_addon_translation_invoke", text="Refresh I18n Data...") op.op_id = "ui.i18n_addon_translation_update" op = row.operator("ui.i18n_addon_translation_invoke", text="Export PO...") op.op_id = "ui.i18n_addon_translation_export" op = row.operator("ui.i18n_addon_translation_invoke", text="Import PO...") op.op_id = "ui.i18n_addon_translation_import"
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.MaterialSlot) ob = data slot = item ma = slot.material if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.label(text=ma.name if ma else "", translate=False, icon_value=icon) if ma and not context.scene.render.use_shading_nodes: manode = ma.active_node_material if manode: layout.label(text=iface_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode)) elif ma.use_nodes: layout.label(text="Node <none>") elif self.layout_type in {'GRID'}: layout.alignment = 'CENTER' layout.label(text="", icon_value=icon)
def draw(self, context): layout = self.layout strip = act_strip(context) layout.template_ID(strip, "scene") scene = strip.scene layout.label(text="Camera Override") layout.template_ID(strip, "scene_camera") if scene: sta = scene.frame_start end = scene.frame_end layout.label(text=iface_("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
def draw(self, context): layout = self.layout md = context.fluid fluid = md.settings row = layout.row(align=True) row.alignment = 'RIGHT' row.label(text="Cache Path") layout.prop(fluid, "filepath", text="") # odd formatting here so translation script can extract string layout.operator( "fluid.bake", text=iface_("Bake (Req. Memory: %s)") % fluid.memory_estimate, translate=False, icon='MOD_FLUIDSIM' )
def draw(self, context): layout = self.layout sc = context.space_data if sc.view == 'CLIP': layout.operator("clip.properties", icon='MENU_PANEL') layout.operator("clip.tools", icon='MENU_PANEL') layout.separator() layout.operator("clip.view_selected") layout.operator("clip.view_all") layout.operator("clip.view_all", text="View Fit").fit_view = True layout.separator() layout.operator("clip.view_zoom_in") layout.operator("clip.view_zoom_out") layout.separator() layout.prop(sc, "show_metadata") layout.separator() ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) text = iface_("Zoom %d:%d") for a, b in ratios: layout.operator("clip.view_zoom_ratio", text=text % (a, b), translate=False).ratio = a / b else: if sc.view == 'GRAPH': layout.operator_context = 'INVOKE_REGION_PREVIEW' layout.operator("clip.graph_center_current_frame") layout.operator("clip.graph_view_all") layout.operator_context = 'INVOKE_DEFAULT' layout.prop(sc, "show_seconds") layout.prop(sc, "show_locked_time") layout.separator() layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area") layout.operator("screen.screen_full_area", text="Toggle Fullscreen Area").use_hide_panels = True
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.MaterialSlot) # ob = data slot = item ma = slot.material if self.layout_type in {"DEFAULT", "COMPACT"}: if ma: layout.prop(ma, "name", text="", emboss=False, icon_value=icon) else: layout.label(text="", icon_value=icon) if ma and not context.scene.render.use_shading_nodes: manode = ma.active_node_material if manode: layout.label(text=iface_("Node %s") % manode.name, translate=False, icon_value=layout.icon(manode)) elif ma.use_nodes: layout.label(text="Node <none>") elif self.layout_type == "GRID": layout.alignment = "CENTER" layout.label(text="", icon_value=icon)
def draw(self, context): layout = self.layout node = context.active_node # set "node" context pointer for the panel layout layout.context_pointer_set("node", node) if hasattr(node, "draw_buttons_ext"): node.draw_buttons_ext(context, layout) elif hasattr(node, "draw_buttons"): node.draw_buttons(context, layout) # XXX this could be filtered further to exclude socket types which don't have meaningful input values (e.g. cycles shader) value_inputs = [socket for socket in node.inputs if socket.enabled and not socket.is_linked] if value_inputs: layout.separator() layout.label("Inputs:") for socket in value_inputs: row = layout.row() socket.draw(context, row, node, iface_(socket.name, socket.bl_rna.translation_context))
def DECIMATE(self, layout, ob, md): decimate_type = md.decimate_type row = layout.row() row.prop(md, "decimate_type", expand=True) if decimate_type == 'COLLAPSE': has_vgroup = bool(md.vertex_group) layout.prop(md, "ratio") split = layout.split() col = split.column() row = col.row(align=True) row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') layout_info = col col = split.column() row = col.row() row.active = has_vgroup row.prop(md, "vertex_group_factor") col.prop(md, "use_collapse_triangulate") row = col.split(percentage=0.75) row.prop(md, "use_symmetry") row.prop(md, "symmetry_axis", text="") elif decimate_type == 'UNSUBDIV': layout.prop(md, "iterations") layout_info = layout else: # decimate_type == 'DISSOLVE': layout.prop(md, "angle_limit") layout.prop(md, "use_dissolve_boundaries") layout.label("Delimit:") row = layout.row() row.prop(md, "delimit") layout_info = layout layout_info.label(text=iface_("Faces: %d") % md.face_count, translate=False)
def draw(self, context): layout = self.layout strip = act_strip(context) layout.template_ID(strip, "scene") scene = strip.scene layout.label(text="Camera Override") layout.template_ID(strip, "scene_camera") layout.prop(strip, "use_grease_pencil", text="Show Grease Pencil") if scene: layout.prop(scene, "audio_volume", text="Audio Volume") sta = scene.frame_start end = scene.frame_end layout.label(text=iface_("Original frame range: %d-%d (%d)") % (sta, end, end - sta + 1), translate=False)
def draw(self, context): layout = self.layout sc = context.space_data if sc.view == "CLIP": layout.operator("clip.properties", icon="MENU_PANEL") layout.operator("clip.tools", icon="MENU_PANEL") layout.separator() layout.operator("clip.view_selected") layout.operator("clip.view_all") layout.separator() layout.operator("clip.view_zoom_in") layout.operator("clip.view_zoom_out") layout.separator() ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) text = iface_("Zoom %d:%d") for a, b in ratios: layout.operator("clip.view_zoom_ratio", text=text % (a, b), translate=False).ratio = a / b else: if sc.view == "GRAPH": layout.operator_context = "INVOKE_REGION_PREVIEW" layout.operator("clip.graph_center_current_frame") layout.operator("clip.graph_view_all") layout.operator_context = "INVOKE_DEFAULT" layout.prop(sc, "show_seconds") layout.separator() layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area")
def draw(self, context): layout = self.layout obj = context.object view = context.space_data props = context.scene.lowpoly_tools_props addon_prefs = get_addon_prefs() shading = view.shading overlay = view.overlay # Basic if addon_prefs.show_undo: row = layout.row(align=True) row.operator('ed.undo') row.operator('ed.redo') # Tools row = layout.row(align=True) row.prop(props, 'disp_tools', text="", icon='TRIA_DOWN' if props.disp_tools else 'TRIA_RIGHT', emboss=False) row.label(text="Tools:") if addon_prefs.show_select: row = row.row(align=True) row.scale_x = 3 row.operator('mesh.select_random', text="", icon='RNDCURVE') row.operator('mesh.select_face_by_sides', text="", icon='VERTEXSEL') row.operator('mesh.edges_select_sharp', text="", icon='EDGESEL') row.operator('mesh.faces_select_linked_flat', text="", icon='FACESEL') row.menu('VIEW3D_MT_edit_mesh_select_similar', text="", icon='GROUP') if props.disp_tools: col = layout.column(align=True) col.operator_menu_enum('mesh.origin_set', 'type', icon='ORIENTATION_GLOBAL') if addon_prefs.show_xyz: row = col.row(align=True) row.operator('mesh.face_align_x', text="X", icon='SNAP_INCREMENT') row.operator('mesh.face_align_y', text="Y", icon='SNAP_INCREMENT') row.operator('mesh.face_align_z', text="Z", icon='SNAP_INCREMENT') if addon_prefs.show_rotate: row = col.row(align=True) row.operator('mesh.edge_rotate', text="Edge Rotate", icon='EDGESEL') row.operator('mesh.face_rotate', icon='FACESEL') row = col.row(align=True) row.operator('mesh.bridge_edge_loops', text="Bridge", icon='PARTICLE_PATH') row.operator('mesh.fill_grid', icon='OUTLINER_OB_LATTICE') row = col.row(align=True) ope_prop = row.operator('mesh.vertices_smooth', text="Smooth", icon='SPHERECURVE') ope_prop.factor = 0.5 row.operator('mesh.laprelax', text="LapRelax", icon='SMOOTHCURVE') if addon_prefs.show_symmetry: col.separator() row = col.row(align=True) row.operator('mesh.symmetrize_merge', text="Symmetrize", icon='MOD_MIRROR') row.operator('mesh.symmetry_snap_x', text="Snap", icon='ARROW_LEFTRIGHT') col.operator( 'mesh.toggle_merge_vertices', icon='SNAP_ON' if context.scene.tool_settings.use_mesh_automerge else 'SNAP_OFF') # LoopTools if hasattr(bpy.types, 'VIEW3D_PT_tools_looptools'): row = layout.row(align=True) row.prop( props, 'disp_looptools', text="", icon='TRIA_DOWN' if props.disp_looptools else 'TRIA_RIGHT', emboss=False) row.label(text="LoopTools:") if props.disp_looptools: col = layout.column(align=True) if addon_prefs.show_flatten: row = col.row(align=True) row.operator('mesh.looptools_flatten', text="Flatten", icon='MESH_PLANE') row.operator('mesh.looptools_circle', text=" Circle ", icon='MESH_CIRCLE') row = col.row(align=True) row.operator('mesh.looptools_curve', text="Curve", icon='OUTLINER_DATA_CURVE') row.operator('mesh.looptools_relax', text="Relax", icon='SMOOTHCURVE') if addon_prefs.show_gstretch: row = col.row(align=True) row.operator('mesh.looptools_space', text="Space", icon='ALIGN_JUSTIFY') row.operator('mesh.looptools_gstretch', text=iface_("Gstretch"), icon='GREASEPENCIL') # Easy Lattice if hasattr(bpy.types, 'EasyLattice_layout'): row = layout.row(align=True) row.prop( props, 'disp_easy_lattice', text="", icon='TRIA_DOWN' if props.disp_easy_lattice else 'TRIA_RIGHT', emboss=False) row.label(text="Easy Lattice:") if props.disp_easy_lattice: bpy.types.EasyLattice_layout.draw(self, context) # Mark Edge row = layout.row(align=True) row.prop(props, 'disp_mark_edge', text="", icon='TRIA_DOWN' if props.disp_mark_edge else 'TRIA_RIGHT', emboss=False) row.label(text="Mark Edge:") if props.disp_mark_edge: col = layout.column(align=True) row = col.row(align=True) row.operator('mesh.mark_sharp', text="Sharp", icon='X').clear = True row.operator('mesh.mark_sharp', text="Sharp", icon='IPO_CONSTANT') row = col.row(align=True) row.operator('mesh.mark_seam', text="Seam", icon='X').clear = True row.operator('mesh.mark_seam', text="Seam", icon='IPO_CIRC') # Shading row = layout.row(align=True) row.prop(props, 'disp_shading', text="", icon='TRIA_DOWN' if props.disp_shading else 'TRIA_RIGHT', emboss=False) row.label(text="Shading:") if props.disp_shading: col = layout.column(align=True) col.operator('object.wire_all', icon='MESH_UVSPHERE') row = col.row(align=True) row.operator('mesh.set_smooth', text="Flat", icon='MESH_ICOSPHERE').clear = True row.operator('mesh.set_smooth', text="Smooth", icon='MATSPHERE') row = col.row(align=True) row.prop(shading, 'light') row = layout.row(align=True) row.label(text="Display:") # Properties split = layout.split() col = split.column() #col.prop(obj.data, 'show_edge_sharp', text="Sharp") col.prop(overlay, 'show_edge_sharp', text="Sharp") #col.prop(obj.data, 'show_edge_seams', text="Seam") col.prop(overlay, 'show_edge_seams', text="Seam") col.prop(obj, 'show_in_front', text="In Front") #col.prop(obj, 'show_name', text="Name") col = split.column() #col.prop(obj.data, 'show_edge_crease', text="Crease") col.prop(overlay, 'show_edge_crease', text="Crease") col.prop(obj.data, 'use_mirror_x') col.prop(shading, 'show_backface_culling')
def draw(self, context): layout = self.layout st = context.space_data is_preview = st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'} is_sequencer_view = st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'} if st.view_type == 'PREVIEW': # Specifying the REGION_PREVIEW context is needed in preview-only # mode, else the lookup for the shortcut will fail in # wm_keymap_item_find_props() (see #32595). layout.operator_context = 'INVOKE_REGION_PREVIEW' layout.operator("sequencer.properties", icon='MENU_PANEL') layout.operator_context = 'INVOKE_DEFAULT' layout.separator() if is_sequencer_view: layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("sequencer.view_all", text="View all Sequences") layout.operator("sequencer.view_selected") layout.operator_context = 'INVOKE_DEFAULT' if is_preview: layout.operator_context = 'INVOKE_REGION_PREVIEW' layout.operator("sequencer.view_all_preview", text="Fit preview in window") layout.separator() ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) for a, b in ratios: layout.operator("sequencer.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b layout.separator() layout.operator_context = 'INVOKE_DEFAULT' # # XXX, invokes in the header view # layout.operator("sequencer.view_ghost_border", text="Overlay Border") if is_sequencer_view: layout.prop(st, "show_seconds") layout.prop(st, "show_frame_indicator") layout.prop(st, "show_strip_offset") layout.prop_menu_enum(st, "waveform_draw_type") if is_preview: if st.display_mode == 'IMAGE': layout.prop(st, "show_safe_areas") layout.prop(st, "show_metadata") elif st.display_mode == 'WAVEFORM': layout.prop(st, "show_separate_color") layout.separator() if is_sequencer_view: layout.prop(st, "use_marker_sync") layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area", text="Toggle Maximize Area") layout.operator("screen.screen_full_area").use_hide_panels = True
def draw(self, context): layout = self.layout scene = context.scene frame_current = scene.frame_current strip = act_strip(context) split = layout.split(percentage=0.3) split.label(text="Name:") split.prop(strip, "name", text="") split = layout.split(percentage=0.3) split.label(text="Type:") split.prop(strip, "type", text="") if strip.type != 'SOUND': split = layout.split(percentage=0.3) split.label(text="Blend:") split.prop(strip, "blend_type", text="") row = layout.row(align=True) sub = row.row(align=True) sub.active = (not strip.mute) sub.prop(strip, "blend_alpha", text="Opacity", slider=True) row.prop(strip, "mute", toggle=True, icon_only=True) row.prop(strip, "lock", toggle=True, icon_only=True) else: row = layout.row(align=True) row.prop(strip, "mute", toggle=True, icon_only=True) row.prop(strip, "lock", toggle=True, icon_only=True) col = layout.column() sub = col.column() sub.enabled = not strip.lock sub.prop(strip, "channel") sub.prop(strip, "frame_start") sub.prop(strip, "frame_final_duration") col = layout.column(align=True) row = col.row(align=True) row.label(text=iface_("Final Length: %s") % bpy.utils.smpte_from_frame(strip.frame_final_duration), translate=False) row = col.row(align=True) row.active = ( frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration) row.label(text=iface_("Playhead: %d") % (frame_current - strip.frame_start), translate=False) col.label(text=iface_("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end), translate=False) col.label(text=iface_("Frame Still %d:%d") % (strip.frame_still_start, strip.frame_still_end), translate=False) elem = False if strip.type == 'IMAGE': elem = strip.strip_elem_from_frame(frame_current) elif strip.type == 'MOVIE': elem = strip.elements[0] if elem and elem.orig_width > 0 and elem.orig_height > 0: col.label(text=iface_("Original Dimension: %dx%d") % (elem.orig_width, elem.orig_height), translate=False) else: col.label(text="Original Dimension: None")
def execute(self, context): arm_obj = context.active_object arm_obj.data.layers[6] = True active_bone = get_active_bone(self, context) if active_bone is None: return {'CANCELLED'} # if has parent? parent_bone = active_bone.parent if parent_bone is None: self.report({'ERROR'}, iface_("'%s' No parent bone found") % active_bone.name) return {'CANCELLED'} active_name = active_bone.name parent_name = parent_bone.name # japanese name? auto = " auto" for c in active_name: try: if ord(c) > 255: auto = "自動" break except TypeError: pass LR = active_name[-2:] if active_name[-2:] in GV.TextLR else "" auto_name = active_name.rstrip(LR) + auto + LR vec = active_bone.tail - active_bone.head bone_length = vec * 0.3 # calc bone location pos = active_bone.head # recalculate roll bpy.ops.b2pmxem.calculate_roll() # deselect bone bpy.ops.armature.select_all(action='DESELECT') # add auto_bone(edit_bone) eb = arm_obj.data.edit_bones.new(auto_name) eb.select = True eb.use_connect = False eb.parent = arm_obj.data.edit_bones[parent_name] eb.head = pos eb.tail = pos + bone_length eb.layers = [False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] bone_name = eb.name # recalculate roll bpy.ops.b2pmxem.calculate_roll() bpy.ops.object.mode_set(mode='POSE') # Add COPY_ROTATION pb = arm_obj.pose.bones[bone_name] pb.lock_location = [True, True, True] autoInfluence = context.preferences.addons[GV.FolderName].preferences.autoInfluence add_copy_rotation(context, active=pb, target_name=active_name, influence=autoInfluence) # Custom Shape set_custom_shape(context, pb, shape=GV.ShapeAuto) # set active arm_obj.data.bones.active = arm_obj.data.bones[bone_name] bpy.ops.object.mode_set(mode='EDIT') return {'FINISHED'}
def draw(self, context): layout = self.layout theme = context.user_preferences.themes[0] split_themes = layout.split(percentage=0.2) sub = split_themes.column() sub.label(text="Presets:") subrow = sub.row(align=True) subrow.menu("USERPREF_MT_interface_theme_presets", text=USERPREF_MT_interface_theme_presets.bl_label) subrow.operator("wm.interface_theme_preset_add", text="", icon='ZOOMIN') subrow.operator("wm.interface_theme_preset_add", text="", icon='ZOOMOUT').remove_active = True sub.separator() sub.prop(theme, "theme_area", expand=True) split = layout.split(percentage=0.4) layout.separator() layout.separator() split = split_themes.split() if theme.theme_area == 'USER_INTERFACE': col = split.column() ui = theme.user_interface col.label(text="Regular:") self._theme_widget_style(col, ui.wcol_regular) col.label(text="Tool:") self._theme_widget_style(col, ui.wcol_tool) col.label(text="Radio Buttons:") self._theme_widget_style(col, ui.wcol_radio) col.label(text="Text:") self._theme_widget_style(col, ui.wcol_text) col.label(text="Option:") self._theme_widget_style(col, ui.wcol_option) col.label(text="Toggle:") self._theme_widget_style(col, ui.wcol_toggle) col.label(text="Number Field:") self._theme_widget_style(col, ui.wcol_num) col.label(text="Value Slider:") self._theme_widget_style(col, ui.wcol_numslider) col.label(text="Box:") self._theme_widget_style(col, ui.wcol_box) col.label(text="Menu:") self._theme_widget_style(col, ui.wcol_menu) col.label(text="Pulldown:") self._theme_widget_style(col, ui.wcol_pulldown) col.label(text="Menu Back:") self._theme_widget_style(col, ui.wcol_menu_back) col.label(text="Tooltip:") self._theme_widget_style(col, ui.wcol_tooltip) col.label(text="Menu Item:") self._theme_widget_style(col, ui.wcol_menu_item) col.label(text="Scroll Bar:") self._theme_widget_style(col, ui.wcol_scroll) col.label(text="Progress Bar:") self._theme_widget_style(col, ui.wcol_progress) col.label(text="List Item:") self._theme_widget_style(col, ui.wcol_list_item) ui_state = theme.user_interface.wcol_state col.label(text="State:") row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui_state, "inner_anim") colsub.row().prop(ui_state, "inner_anim_sel") colsub.row().prop(ui_state, "inner_driven") colsub.row().prop(ui_state, "inner_driven_sel") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui_state, "inner_key") colsub.row().prop(ui_state, "inner_key_sel") colsub.row().prop(ui_state, "blend") col.separator() col.separator() col.label("Menu Shadow:") row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "menu_shadow_fac") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "menu_shadow_width") col.separator() col.separator() col.label("Icons:") row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() # Not working yet. #~ colsub.active = False #~ colsub.row().prop(ui, "icon_file") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "icon_alpha") col.separator() col.separator() col.label("Axis Colors:") row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "axis_x") colsub.row().prop(ui, "axis_y") colsub.row().prop(ui, "axis_z") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() layout.separator() layout.separator() elif theme.theme_area == 'BONE_COLOR_SETS': col = split.column() for i, ui in enumerate(theme.bone_color_sets): col.label(text=iface_("Color Set %d:") % (i + 1), translate=False) # i starts from 0 row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "normal") colsub.row().prop(ui, "select") colsub.row().prop(ui, "active") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "show_colored_constraints") elif theme.theme_area == 'STYLE': col = split.column() style = context.user_preferences.ui_styles[0] col.label(text="Panel Title:") self._ui_font_style(col, style.panel_title) col.separator() col.label(text="Widget:") self._ui_font_style(col, style.widget) col.separator() col.label(text="Widget Label:") self._ui_font_style(col, style.widget_label) else: self._theme_generic(split, getattr(theme, theme.theme_area.lower()))
def draw(self, context): layout = self.layout ob = context.object psys = context.particle_system pset = None if ob: row = layout.row() row.template_list("PARTICLE_UL_particle_systems", "particle_systems", ob, "particle_systems", ob.particle_systems, "active_index", rows=1) col = row.column(align=True) col.operator("object.particle_system_add", icon='ZOOMIN', text=_("")) col.operator("object.particle_system_remove", icon='ZOOMOUT', text=_("")) col.menu("PARTICLE_MT_specials", icon='DOWNARROW_HLT', text=_("")) if psys is None: pset = particle_get_settings(context) layout.operator("object.particle_system_add", icon='ZOOMIN', text=_("New")) if pset is None: return layout.template_ID(context.space_data, "pin_id") if pset.is_fluid: layout.label(text=_("Settings used for fluid")) return layout.prop(pset, "type", text=_("Type")) elif not psys.settings: split = layout.split(percentage=0.32) col = split.column() col.label(text=_("Settings:")) col = split.column() col.template_ID(psys, "settings", new="particle.new") else: pset = psys.settings split = layout.split(percentage=0.32) col = split.column() if pset.is_fluid is False: col.label(text=_("Settings:")) col.label(text=_("Type:")) col = split.column() if pset.is_fluid is False: row = col.row() row.enabled = particle_panel_enabled(context, psys) row.template_ID(psys, "settings", new="particle.new") if pset.is_fluid: layout.label( text=iface_(_("%d fluid particles for this frame")) % pset.count, translate=False) return row = col.row() row.enabled = particle_panel_enabled(context, psys) row.prop(pset, "type", text=_("")) row.prop(psys, "seed") if pset: if pset.type == 'HAIR': split = layout.split(percentage=0.65) if psys is not None and psys.is_edited: split.operator("particle.edited_clear", text=_("Free Edit")) else: row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(pset, "regrow_hair") row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(pset, "hair_step") if psys is not None and psys.is_edited: if psys.is_global_hair: layout.operator("particle.connect_hair") else: layout.operator("particle.disconnect_hair") else: layout.label(text=_( "Enable emission with Object->Animation->Apply default animation." ))
def draw(self, context): layout = self.layout i18n_sett = context.window_manager.i18n_update_svn_settings if not i18n_sett.is_init and bpy.ops.ui.i18n_updatetranslation_svn_init_settings.poll( ): # Cannot call the operator from here, this code might run while `pyrna_write_check()` returns False # (which prevents any operator call from Python), during initialization of Blender. UI_OT_i18n_updatetranslation_svn_init_settings.execute_static( context, settings.settings) if not i18n_sett.is_init: layout.label(text="Could not init languages data!") layout.label( text="Please edit the preferences of the UI Translate add-on") layout.operator("ui.i18n_updatetranslation_svn_init_settings", text="Init Settings") else: split = layout.split(factor=0.75) split.template_list("UI_UL_i18n_languages", "", i18n_sett, "langs", i18n_sett, "active_lang", rows=8) col = split.column() col.operator("ui.i18n_updatetranslation_svn_init_settings", text="Reset Settings") deselect = any(l.use for l in i18n_sett.langs) op = col.operator( "ui.i18n_updatetranslation_svn_settings_select", text="Deselect All" if deselect else "Select All") op.use_invert = False op.use_select = not deselect col.operator("ui.i18n_updatetranslation_svn_settings_select", text="Invert Selection").use_invert = True col.separator() col.operator("ui.i18n_updatetranslation_svn_branches", text="Update Branches") col.operator("ui.i18n_updatetranslation_svn_trunk", text="Update Trunk") col.separator() col.operator("ui.i18n_cleanuptranslation_svn_branches", text="Clean up Branches") col.operator("ui.i18n_updatetranslation_svn_statistics", text="Statistics") if i18n_sett.active_lang >= 0 and i18n_sett.active_lang < len( i18n_sett.langs): lng = i18n_sett.langs[i18n_sett.active_lang] col = layout.column() col.active = lng.use row = col.row() row.label(text="[{}]: \"{}\" ({})".format( lng.uid, iface_(lng.name), lng.num_id), translate=False) row.prop(lng, "use", text="") col.prop(lng, "po_path") col.prop(lng, "po_path_trunk") col.prop(lng, "mo_path_trunk") col.prop(lng, "po_path_git") layout.separator() layout.prop(i18n_sett, "pot_path") layout.separator() layout.label(text="Add-ons:") row = layout.row() op = row.operator("ui.i18n_addon_translation_invoke", text="Refresh I18n Data...") op.op_id = "ui.i18n_addon_translation_update" op = row.operator("ui.i18n_addon_translation_invoke", text="Export PO...") op.op_id = "ui.i18n_addon_translation_export" op = row.operator("ui.i18n_addon_translation_invoke", text="Import PO...") op.op_id = "ui.i18n_addon_translation_import"
def execute(self, context): active_bone = get_active_bone(self, context) if active_bone is None: return {'CANCELLED'} # get master name name_list = active_bone.name.rsplit('_') if len(name_list) != 4: self.report({'ERROR'}, iface_("Bone name format incorrect (e.g. %s)") % "skirt_0_0_L") return {'FINISHED'} name_base = name_list[0] threshold = context.preferences.addons[GV.FolderName].preferences.threshold # get max bone num bone_max = 0 bone_list = [] is_center = False for bone in context.object.data.edit_bones: name_list = bone.name.rsplit('_') if len(name_list) not in (3, 4): continue temp_base = name_list[0] if temp_base == name_base: # select bone.select = bone.select_head = bone.select_tail = True if len(name_list) == 4: bone_list.append(bone) if name_list[1] == '0': bone_max += 1 if name_list[2] == '0': if abs(bone.head[0]) < threshold: is_center = True LR = 'R' if self.reverse else 'L' quot, rem = divmod(bone_max, 2) for bone in bone_list: name_list = bone.name.rsplit('_') # 'L' (reverse == False) if name_list[3] == LR: bone.name = bone.name.rstrip('_' + LR) # 'R' (center ON) elif is_center: bone.name = '_'.join([name_list[0], name_list[1], str(bone_max - int(name_list[2]))]) # (center OFF) else: bone.name = '_'.join([name_list[0], name_list[1], str(bone_max - 1 - int(name_list[2]))]) return {'FINISHED'}
def draw(self, context): layout = self.layout space = context.space_data obj = context.active_object object_mode = 'OBJECT' if obj is None else obj.mode layout.operator("outliner.id_copy", text="Copy", icon='COPYDOWN') layout.operator("outliner.id_paste", text="Paste", icon='PASTEDOWN') layout.separator() layout.operator("outliner.delete", text="Delete", icon='X') layout.operator("outliner.delete", text="Delete Hierarchy").hierarchy = True layout.separator() layout.operator("outliner.object_operation", text="Select", icon='RESTRICT_SELECT_OFF').type = 'SELECT' layout.operator("outliner.object_operation", text="Select Hierarchy").type = 'SELECT_HIERARCHY' layout.operator("outliner.object_operation", text="Deselect").type = 'DESELECT' layout.separator() if object_mode in {'EDIT', 'POSE'}: name = bpy.types.Object.bl_rna.properties["mode"].enum_items[ object_mode].name layout.operator( "outliner.object_operation", text=iface_("%s Set", i18n_contexts.operator_default) % name).type = 'OBJECT_MODE_ENTER' layout.operator( "outliner.object_operation", text=iface_("%s Clear", i18n_contexts.operator_default) % name).type = 'OBJECT_MODE_EXIT' del name layout.separator() if not (space.display_mode == 'VIEW_LAYER' and not space.use_filter_collection): layout.operator("outliner.id_operation", text="Unlink").type = 'UNLINK' layout.separator() layout.operator("outliner.collection_new", text="New Collection").nested = True layout.separator() layout.operator_menu_enum("outliner.id_operation", "type", text="ID Data") layout.separator() OUTLINER_MT_context_menu.draw_common_operators(layout)
def draw_layer(self, context, layout, gpl): row = layout.row(align=True) row.prop(gpl, "opacity", text="Opacity", slider=True) # Layer options split = layout.split(percentage=0.5) split.active = not gpl.lock split.prop(gpl, "show_x_ray") split.prop(gpl, "show_points") # Offsets + Parenting (where available) if context.space_data.type == 'VIEW_3D': split = layout.split(percentage=0.5) else: split = layout.column( ) # parenting is not available in 2D editors... split.active = not gpl.lock # Offsets - Color Tint col = split.column() subcol = col.column(align=True) subcol.label("Tint") subcol.enabled = not gpl.lock subcol.prop(gpl, "tint_color", text="") subcol.prop(gpl, "tint_factor", text="Factor", slider=True) # Offsets - Thickness row = col.row(align=True) row.prop(gpl, "line_change", text="Thickness Change", slider=True) row.operator("gpencil.stroke_apply_thickness", icon='STYLUS_PRESSURE', text="") # Parenting if context.space_data.type == 'VIEW_3D': col = split.column(align=True) col.label(text="Parent:") col.prop(gpl, "parent", text="") sub = col.column() sub.prop(gpl, "parent_type", text="") parent = gpl.parent if parent and gpl.parent_type == 'BONE' and parent.type == 'ARMATURE': sub.prop_search(gpl, "parent_bone", parent.data, "bones", text="") layout.separator() # Full-Row - Frame Locking (and Delete Frame) row = layout.row(align=True) row.active = not gpl.lock if gpl.active_frame: lock_status = iface_("Locked") if gpl.lock_frame else iface_( "Unlocked") lock_label = iface_("Frame: %d (%s)") % ( gpl.active_frame.frame_number, lock_status) else: lock_label = iface_("Lock Frame") row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED') row.operator("gpencil.active_frame_delete", text="", icon='X') layout.separator() # Onion skinning col = layout.column(align=True) col.active = not gpl.lock row = col.row() row.prop(gpl, "use_onion_skinning") sub = row.row(align=True) icon = 'RESTRICT_RENDER_OFF' if gpl.use_ghosts_always else 'RESTRICT_RENDER_ON' sub.prop(gpl, "use_ghosts_always", text="", icon=icon) sub.prop(gpl, "use_ghost_custom_colors", text="", icon='COLOR') split = col.split(percentage=0.5) split.active = gpl.use_onion_skinning # - Before Frames sub = split.column(align=True) row = sub.row(align=True) row.active = gpl.use_ghost_custom_colors row.prop(gpl, "before_color", text="") sub.prop(gpl, "ghost_before_range", text="Before") # - After Frames sub = split.column(align=True) row = sub.row(align=True) row.active = gpl.use_ghost_custom_colors row.prop(gpl, "after_color", text="") sub.prop(gpl, "ghost_after_range", text="After")
def execute(self, context): active_bone = get_active_bone(self, context) if active_bone is None: return {'CANCELLED'} # get master name name_list = active_bone.name.rsplit('_') if len(name_list) != 3: self.report({'ERROR'}, iface_("Bone name format incorrect (e.g. %s)") % "skirt_0_0") return {'FINISHED'} name_base = name_list[0] threshold = context.preferences.addons[GV.FolderName].preferences.threshold # get max bone num bone_max = 0 bone_list = [] is_center = False for bone in context.object.data.edit_bones: name_list = bone.name.rsplit('_') if len(name_list) != 3: continue temp_base = name_list[0] if temp_base == name_base: # select bone.select = bone.select_head = bone.select_tail = True bone_list.append(bone) if name_list[1] == '0': bone_max += 1 if name_list[2] == '0': if abs(bone.head[0]) < threshold: is_center = True quot, rem = divmod(bone_max, 2) for bone in bone_list: name_list = bone.name.rsplit('_') LR = 'R' if bone.head[0] < 0 else 'L' if is_center: if name_list[2] == '0': continue # center ON and odd number if rem == 1: if int(name_list[2]) <= quot: bone.name = bone.name + '_' + LR else: bone.name = '_'.join([name_list[0], name_list[1], str(bone_max - int(name_list[2])), LR]) # center ON and even number else: if int(name_list[2]) == quot: continue if int(name_list[2]) < quot: bone.name = bone.name + '_' + LR else: bone.name = '_'.join([name_list[0], name_list[1], str(bone_max - int(name_list[2])), LR]) else: # (center OFF and odd number) if rem == 1: if int(name_list[2]) == quot: continue if int(name_list[2]) < quot: bone.name = bone.name + '_' + LR else: bone.name = '_'.join([name_list[0], name_list[1], str(bone_max - 1 - int(name_list[2])), LR]) return {'FINISHED'}
def draw(self, context): layout = self.layout if context.scene.render.engine == 'BLENDER_GAME': layout.label("Not available in the Game Engine") return ob = context.object psys = context.particle_system part = 0 if ob: row = layout.row() row.template_list("UI_UL_list", "particle_systems", ob, "particle_systems", ob.particle_systems, "active_index", rows=1) col = row.column(align=True) col.operator("object.particle_system_add", icon='ZOOMIN', text="") col.operator("object.particle_system_remove", icon='ZOOMOUT', text="") if psys is None: part = particle_get_settings(context) if part is None: return layout.template_ID(context.space_data, "pin_id") if part.is_fluid: layout.label(text="Settings used for fluid") return layout.prop(part, "type", text="Type") elif not psys.settings: split = layout.split(percentage=0.32) col = split.column() col.label(text="Settings:") col = split.column() col.template_ID(psys, "settings", new="particle.new") else: part = psys.settings split = layout.split(percentage=0.32) col = split.column() if part.is_fluid is False: col.label(text="Settings:") col.label(text="Type:") col = split.column() if part.is_fluid is False: row = col.row() row.enabled = particle_panel_enabled(context, psys) row.template_ID(psys, "settings", new="particle.new") if part.is_fluid: layout.label(text=iface_("%d fluid particles for this frame") % part.count, translate=False) return row = col.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "type", text="") row.prop(psys, "seed") if part: split = layout.split(percentage=0.65) if part.type == 'HAIR': if psys is not None and psys.is_edited: split.operator("particle.edited_clear", text="Free Edit") else: row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "regrow_hair") row.prop(part, "use_advanced_hair") row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "hair_step") if psys is not None and psys.is_edited: if psys.is_global_hair: layout.operator("particle.connect_hair") else: layout.operator("particle.disconnect_hair") elif psys is not None and part.type == 'REACTOR': split.enabled = particle_panel_enabled(context, psys) split.prop(psys, "reactor_target_object") split.prop(psys, "reactor_target_particle_system", text="Particle System")
def draw(self, context): layout = self.layout sima = context.space_data uv = sima.uv_editor toolsettings = context.tool_settings paint = toolsettings.image_paint show_uvedit = sima.show_uvedit show_render = sima.show_render layout.operator("image.properties", icon='MENU_PANEL') layout.operator("image.toolshelf", icon='MENU_PANEL') layout.separator() layout.prop(sima, "use_realtime_update") if show_uvedit: layout.prop(toolsettings, "show_uv_local_view") layout.prop(uv, "show_other_objects") layout.prop(uv, "show_metadata") if paint.brush and (context.image_paint_object or sima.mode == 'PAINT'): layout.prop(uv, "show_texpaint") layout.prop(toolsettings, "show_uv_local_view", text="Show Same Material") layout.separator() layout.operator("image.view_zoom_in") layout.operator("image.view_zoom_out") layout.separator() ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1)) for a, b in ratios: layout.operator("image.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b layout.separator() if show_uvedit: layout.operator("image.view_selected") layout.operator("image.view_all") layout.operator("image.view_all", text="View Fit").fit_view = True layout.separator() if show_render: layout.operator("image.render_border") layout.operator("image.clear_render_border") layout.separator() layout.operator("image.cycle_render_slot", text="Render Slot Cycle Next") layout.operator("image.cycle_render_slot", text="Render Slot Cycle Previous").reverse = True layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area") layout.operator("screen.screen_full_area", text="Toggle Fullscreen Area").use_hide_panels = True
def draw_layer(self, context, layout, gpl): row = layout.row(align=True) row.prop(gpl, "opacity", text="Opacity", slider=True) # Layer options split = layout.split(percentage=0.5) split.active = not gpl.lock split.prop(gpl, "show_x_ray") split.prop(gpl, "show_points") # Offsets + Parenting (where available) if context.space_data.type == 'VIEW_3D': split = layout.split(percentage=0.5) else: split = layout.column() # parenting is not available in 2D editors... split.active = not gpl.lock # Offsets - Color Tint col = split.column() subcol = col.column(align=True) subcol.label("Tint") subcol.enabled = not gpl.lock subcol.prop(gpl, "tint_color", text="") subcol.prop(gpl, "tint_factor", text="Factor", slider=True) # Offsets - Thickness row = col.row(align=True) row.prop(gpl, "line_change", text="Thickness Change", slider=True) row.operator("gpencil.stroke_apply_thickness", icon='STYLUS_PRESSURE', text="") # Parenting if context.space_data.type == 'VIEW_3D': col = split.column(align=True) col.label(text="Parent:") col.prop(gpl, "parent", text="") sub = col.column() sub.prop(gpl, "parent_type", text="") parent = gpl.parent if parent and gpl.parent_type == 'BONE' and parent.type == 'ARMATURE': sub.prop_search(gpl, "parent_bone", parent.data, "bones", text="") layout.separator() # Full-Row - Frame Locking (and Delete Frame) row = layout.row(align=True) row.active = not gpl.lock if gpl.active_frame: lock_status = iface_("Locked") if gpl.lock_frame else iface_("Unlocked") lock_label = iface_("Frame: %d (%s)") % (gpl.active_frame.frame_number, lock_status) else: lock_label = iface_("Lock Frame") row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED') row.operator("gpencil.active_frame_delete", text="", icon='X') layout.separator() # Onion skinning col = layout.column(align=True) col.active = not gpl.lock row = col.row() row.prop(gpl, "use_onion_skinning") sub = row.row(align=True) icon = 'RESTRICT_RENDER_OFF' if gpl.use_ghosts_always else 'RESTRICT_RENDER_ON' sub.prop(gpl, "use_ghosts_always", text="", icon=icon) sub.prop(gpl, "use_ghost_custom_colors", text="", icon='COLOR') split = col.split(percentage=0.5) split.active = gpl.use_onion_skinning # - Before Frames sub = split.column(align=True) row = sub.row(align=True) row.active = gpl.use_ghost_custom_colors row.prop(gpl, "before_color", text="") sub.prop(gpl, "ghost_before_range", text="Before") # - After Frames sub = split.column(align=True) row = sub.row(align=True) row.active = gpl.use_ghost_custom_colors row.prop(gpl, "after_color", text="") sub.prop(gpl, "ghost_after_range", text="After")
def draw(self, context): layout = self.layout st = context.space_data text = st.text row = layout.row(align=True) row.template_header() TEXT_MT_editor_menus.draw_collapsible(context, layout) if text and text.is_modified: sub = row.row(align=True) sub.alert = True sub.operator("text.resolve_conflict", text="", icon='HELP') row = layout.row(align=True) row.template_ID(st, "text", new="text.new", unlink="text.unlink", open="text.open") if text: osl = text.name.endswith(".osl") or text.name.endswith(".oso") if not osl: row = layout.row() row.operator("text.run_script") if context.scene.mv.ui.use_default_blender_interface: row = layout.row(align=True) row.prop(st, "show_line_numbers", text="") row.prop(st, "show_word_wrap", text="") row.prop(st, "show_syntax_highlight", text="") if text: osl = text.name.endswith(".osl") or text.name.endswith(".oso") if osl: row = layout.row() row.operator("node.shader_script_update") else: row = layout.row() row.operator("text.run_script") row = layout.row() row.active = text.name.endswith(".py") row.prop(text, "use_module") if text: row = layout.row() if text.filepath: if text.is_dirty: row.label("(unsaved)", icon='ERROR') row.label(text=iface_("File: *%r") % text.filepath, translate=False) else: row.label(text=iface_("File: %r") % text.filepath, translate=False) else: row.label(text="Text: External" if text. library else "Text: Internal")
def draw(self, context): layout = self.layout md = context.fluid fluid = md.settings col = layout.column() if not bpy.app.build_options.mod_fluid: col.label("Built without fluids") return col.prop(fluid, "type") if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}: col.prop(fluid, "use") layout = layout.column() if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}: layout.active = fluid.use if fluid.type == 'DOMAIN': # odd formatting here so translation script can extract string layout.operator("fluid.bake", text=iface_("Bake (Req. Memory: %s)") % fluid.memory_estimate, translate=False, icon='MOD_FLUIDSIM') if bpy.app.build_options.openmp: layout.prop(fluid, "threads", text="Simulation Threads") split = layout.split() col = split.column() col.label(text="Resolution:") col.prop(fluid, "resolution", text="Final") col.label(text="Render Display:") col.prop(fluid, "render_display_mode", text="") col = split.column() col.label() col.prop(fluid, "preview_resolution", text="Preview") col.label(text="Viewport Display:") col.prop(fluid, "viewport_display_mode", text="") split = layout.split() col = split.column() col.label(text="Time:") sub = col.column(align=True) sub.prop(fluid, "start_time", text="Start") sub.prop(fluid, "end_time", text="End") col.prop(fluid, "simulation_rate", text="Speed") col = split.column() col.label() sub = col.column(align=True) sub.prop(fluid, "use_speed_vectors") sub.prop(fluid, "use_reverse_frames") col.prop(fluid, "frame_offset", text="Offset") layout.prop(fluid, "filepath", text="") elif fluid.type == 'FLUID': split = layout.split() col = split.column() col.label(text="Volume Initialization:") col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "use_animated_mesh") col = split.column() col.label(text="Initial Velocity:") col.prop(fluid, "initial_velocity", text="") elif fluid.type == 'OBSTACLE': split = layout.split() col = split.column() col.label(text="Volume Initialization:") col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "use_animated_mesh") col = split.column() subsplit = col.split() subcol = subsplit.column() if fluid.use_animated_mesh: subcol.enabled = False subcol.label(text="Slip Type:") subcol.prop(fluid, "slip_type", text="") if fluid.slip_type == 'PARTIALSLIP': subcol.prop(fluid, "partial_slip_factor", slider=True, text="Amount") col.label(text="Impact:") col.prop(fluid, "impact_factor", text="Factor") elif fluid.type == 'INFLOW': split = layout.split() col = split.column() col.label(text="Volume Initialization:") col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "use_animated_mesh") row = col.row() row.active = not fluid.use_animated_mesh row.prop(fluid, "use_local_coords") col = split.column() col.label(text="Inflow Velocity:") col.prop(fluid, "inflow_velocity", text="") elif fluid.type == 'OUTFLOW': col = layout.column() col.label(text="Volume Initialization:") col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "use_animated_mesh") elif fluid.type == 'PARTICLE': split = layout.split() col = split.column() col.label(text="Influence:") col.prop(fluid, "particle_influence", text="Size") col.prop(fluid, "alpha_influence", text="Alpha") col = split.column() col.label(text="Type:") col.prop(fluid, "use_drops") col.prop(fluid, "use_floats") col.prop(fluid, "show_tracer") layout.prop(fluid, "filepath", text="") elif fluid.type == 'CONTROL': split = layout.split() col = split.column() col.label(text="") col.prop(fluid, "quality", slider=True) col.prop(fluid, "use_reverse_frames") col = split.column() col.label(text="Time:") sub = col.column(align=True) sub.prop(fluid, "start_time", text="Start") sub.prop(fluid, "end_time", text="End") split = layout.split() col = split.column() col.label(text="Attraction Force:") sub = col.column(align=True) sub.prop(fluid, "attraction_strength", text="Strength") sub.prop(fluid, "attraction_radius", text="Radius") col = split.column() col.label(text="Velocity Force:") sub = col.column(align=True) sub.prop(fluid, "velocity_strength", text="Strength") sub.prop(fluid, "velocity_radius", text="Radius")
def draw_layers(self, context, layout, gpd): row = layout.row() col = row.column() if len(gpd.layers) >= 2: layer_rows = 5 else: layer_rows = 3 col.template_list("GPENCIL_UL_annotation_layer", "", gpd, "layers", gpd.layers, "active_index", rows=layer_rows, sort_reverse=True, sort_lock=True) col = row.column() sub = col.column(align=True) sub.operator("gpencil.layer_annotation_add", icon='ADD', text="") sub.operator("gpencil.layer_annotation_remove", icon='REMOVE', text="") gpl = context.active_annotation_layer if gpl: if len(gpd.layers) > 1: col.separator() sub = col.column(align=True) sub.operator("gpencil.layer_annotation_move", icon='TRIA_UP', text="").type = 'UP' sub.operator("gpencil.layer_annotation_move", icon='TRIA_DOWN', text="").type = 'DOWN' tool_settings = context.tool_settings if gpd and gpl: layout.prop(gpl, "thickness") else: layout.prop(tool_settings, "annotation_thickness", text="Thickness") if gpl: # Full-Row - Frame Locking (and Delete Frame) row = layout.row(align=True) row.active = not gpl.lock if gpl.active_frame: lock_status = iface_("Locked") if gpl.lock_frame else iface_( "Unlocked") lock_label = iface_("Frame: %d (%s)") % ( gpl.active_frame.frame_number, lock_status) else: lock_label = iface_("Lock Frame") row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED') row.operator("gpencil.annotation_active_frame_delete", text="", icon='X')
def draw(self, context): layout = self.layout if context.scene.render.engine == 'BLENDER_GAME': layout.label("Not available in the Game Engine") return ob = context.object psys = context.particle_system part = 0 if ob: row = layout.row() row.template_list("UI_UL_list", "particle_systems", ob, "particle_systems", ob.particle_systems, "active_index", rows=2) col = row.column(align=True) col.operator("object.particle_system_add", icon='ZOOMIN', text="") col.operator("object.particle_system_remove", icon='ZOOMOUT', text="") if psys is None: part = particle_get_settings(context) if part is None: return layout.template_ID(context.space_data, "pin_id") if part.is_fluid: layout.label(text="Settings used for fluid") return layout.prop(part, "type", text="Type") elif not psys.settings: split = layout.split(percentage=0.32) col = split.column() col.label(text="Name:") col.label(text="Settings:") col = split.column() col.prop(psys, "name", text="") col.template_ID(psys, "settings", new="particle.new") else: part = psys.settings split = layout.split(percentage=0.32) col = split.column() col.label(text="Name:") if part.is_fluid is False: col.label(text="Settings:") col.label(text="Type:") col = split.column() col.prop(psys, "name", text="") if part.is_fluid is False: row = col.row() row.enabled = particle_panel_enabled(context, psys) row.template_ID(psys, "settings", new="particle.new") #row = layout.row() #row.label(text="Viewport") #row.label(text="Render") if part.is_fluid: layout.label(text=iface_("%d fluid particles for this frame") % part.count, translate=False) return row = col.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "type", text="") row.prop(psys, "seed") if part: split = layout.split(percentage=0.65) if part.type == 'HAIR': if psys is not None and psys.is_edited: split.operator("particle.edited_clear", text="Free Edit") else: row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "regrow_hair") row.prop(part, "use_advanced_hair") row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "hair_step") if psys is not None and psys.is_edited: if psys.is_global_hair: layout.operator("particle.connect_hair") else: layout.operator("particle.disconnect_hair") elif psys is not None and part.type == 'REACTOR': split.enabled = particle_panel_enabled(context, psys) split.prop(psys, "reactor_target_object") split.prop(psys, "reactor_target_particle_system", text="Particle System")
def draw(self, context): layout = self.layout ob = context.object psys = context.particle_system pset = None if ob: row = layout.row() row.template_list("PARTICLE_UL_particle_systems", "particle_systems", ob, "particle_systems", ob.particle_systems, "active_index", rows=1) col = row.column(align=True) col.operator("object.particle_system_add", icon='ZOOMIN', text="") col.operator("object.particle_system_remove", icon='ZOOMOUT', text="") col.menu("PARTICLE_MT_specials", icon='DOWNARROW_HLT', text="") if psys is None: pset = particle_get_settings(context) layout.operator("object.particle_system_add", icon='ZOOMIN', text=_("New")) if pset is None: return layout.template_ID(context.space_data, "pin_id") if pset.is_fluid: layout.label(text=_("Settings used for fluid")) return layout.prop(pset, "type", text=_("Type")) elif not psys.settings: split = layout.split(percentage=0.32) col = split.column() col.label(text=_("Settings:")) col = split.column() col.template_ID(psys, "settings", new="particle.new") else: pset = psys.settings split = layout.split(percentage=0.32) col = split.column() if pset.is_fluid is False: col.label(text=_("Settings:")) col.label(text=_("Type:")) col = split.column() if pset.is_fluid is False: row = col.row() row.enabled = particle_panel_enabled(context, psys) row.template_ID(psys, "settings", new="particle.new") if pset.is_fluid: layout.label(text=iface_(_("%d fluid particles for this frame")) % pset.count, translate=False) return row = col.row() row.enabled = particle_panel_enabled(context, psys) row.prop(pset, "type", text="") row.prop(psys, "seed") if pset: if pset.type == 'HAIR': split = layout.split(percentage=0.65) if psys is not None and psys.is_edited: split.operator("particle.edited_clear", text=_("Free Edit")) else: row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(pset, "regrow_hair") row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(pset, "hair_step") if psys is not None and psys.is_edited: if psys.is_global_hair: layout.operator("particle.connect_hair") else: layout.operator("particle.disconnect_hair") else: if not ob.b4w_use_default_animation: layout.label(text=_("Particle emission is disabled."), icon="ERROR") layout.label(text=_("Enable it with Object->Animation->Apply default animation."))
def execute(self, context): # deselect bone bpy.ops.armature.select_all(action='DESELECT') arm_obj = context.active_object arm_obj.data.layers[2] = True bones = arm_obj.data.edit_bones parent_name = None # L # arm_L -------------------------------------- bone = Get_Edit_Bone(bones, "腕_L", "arm_L") if bone is not None: # if has parent? if bone.parent is None or len(bone.children) == 0: self.report( {'ERROR'}, iface_("'%s' No parent bone and child bone found") % bone.name) else: parent_name = self.add_sleeve(context, bone) # elbow_L -------------------------------------- bone = Get_Edit_Bone(bones, "ひじ_L", "elbow_L") if bone is not None: # if has parent? if bone.parent is None or len(bone.children) == 0: self.report( {'ERROR'}, iface_("'%s' No parent bone and child bone found") % bone.name) else: self.add_sleeve(context, bone, parent_name) parent_name = None # R # arm_R -------------------------------------- bone = Get_Edit_Bone(bones, "腕_R", "arm_R") if bone is not None: # if has parent? if bone.parent is None or len(bone.children) == 0: self.report( {'ERROR'}, iface_("'%s' No parent bone and child bone found") % bone.name) else: parent_name = self.add_sleeve(context, bone) # elbow_R -------------------------------------- bone = Get_Edit_Bone(bones, "ひじ_R", "elbow_R") if bone is not None: # if has parent? if bone.parent is None or len(bone.children) == 0: self.report( {'ERROR'}, iface_("'%s' No parent bone and child bone found") % bone.name) else: self.add_sleeve(context, bone, parent_name) # recalculate roll bpy.ops.b2pmxem.calculate_roll() return {'FINISHED'}
def draw(self, context): layout = self.layout i18n_sett = context.window_manager.i18n_update_svn_settings if not i18n_sett.is_init and bpy.ops.ui.i18n_updatetranslation_svn_init_settings.poll( ): bpy.ops.ui.i18n_updatetranslation_svn_init_settings() if not i18n_sett.is_init: layout.label(text="Could not init languages data!") layout.label( text="Please edit the preferences of the UI Translate addon") else: split = layout.split(0.75) split.template_list("UI_UL_i18n_languages", "", i18n_sett, "langs", i18n_sett, "active_lang", rows=8) col = split.column() col.operator("ui.i18n_updatetranslation_svn_init_settings", text="Reset Settings") deselect = any(l.use for l in i18n_sett.langs) op = col.operator( "ui.i18n_updatetranslation_svn_settings_select", text="Deselect All" if deselect else "Select All") op.use_invert = False op.use_select = not deselect col.operator("ui.i18n_updatetranslation_svn_settings_select", text="Invert Selection").use_invert = True col.separator() col.operator("ui.i18n_updatetranslation_svn_branches", text="Update Branches") col.operator("ui.i18n_updatetranslation_svn_trunk", text="Update Trunk") col.operator("ui.i18n_updatetranslation_svn_statistics", text="Statistics") if i18n_sett.active_lang >= 0 and i18n_sett.active_lang < len( i18n_sett.langs): lng = i18n_sett.langs[i18n_sett.active_lang] col = layout.column() col.active = lng.use row = col.row() row.label(text="[{}]: \"{}\" ({})".format( lng.uid, iface_(lng.name), lng.num_id), translate=False) row.prop(lng, "use", text="") col.prop(lng, "po_path") col.prop(lng, "po_path_trunk") col.prop(lng, "mo_path_trunk") layout.separator() layout.prop(i18n_sett, "pot_path") layout.separator() layout.label("Addons:") row = layout.row() op = row.operator("ui.i18n_addon_translation_invoke", text="Refresh I18n Data...") op.op_id = "ui.i18n_addon_translation_update" op = row.operator("ui.i18n_addon_translation_invoke", text="Export PO...") op.op_id = "ui.i18n_addon_translation_export" op = row.operator("ui.i18n_addon_translation_invoke", text="Import PO...") op.op_id = "ui.i18n_addon_translation_import"
def draw(self, context): layout = self.layout md = context.fluid fluid = md.settings col = layout.column() if not bpy.app.build_options.mod_fluid: col.label("Built without fluids") return col.prop(fluid, "type") if fluid.type not in { 'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE' }: col.prop(fluid, "use") layout = layout.column() if fluid.type not in { 'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE' }: layout.active = fluid.use if fluid.type == 'DOMAIN': # odd formatting here so translation script can extract string layout.operator("fluid.bake", text=iface_("Bake (Req. Memory: %s)") % fluid.memory_estimate, translate=False, icon='MOD_FLUIDSIM') if bpy.app.build_options.openmp: layout.prop(fluid, "threads", text="Simulation Threads") split = layout.split() col = split.column() col.label(text="Resolution:") col.prop(fluid, "resolution", text="Final") col.label(text="Render Display:") col.prop(fluid, "render_display_mode", text="") col = split.column() col.label() col.prop(fluid, "preview_resolution", text="Preview") col.label(text="Viewport Display:") col.prop(fluid, "viewport_display_mode", text="") split = layout.split() col = split.column() col.label(text="Time:") sub = col.column(align=True) sub.prop(fluid, "start_time", text="Start") sub.prop(fluid, "end_time", text="End") col.prop(fluid, "simulation_rate", text="Speed") col = split.column() col.label() sub = col.column(align=True) sub.prop(fluid, "use_speed_vectors") sub.prop(fluid, "use_reverse_frames") col.prop(fluid, "frame_offset", text="Offset") layout.prop(fluid, "filepath", text="") elif fluid.type == 'FLUID': split = layout.split() col = split.column() col.label(text="Volume Initialization:") col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "use_animated_mesh") col = split.column() col.label(text="Initial Velocity:") col.prop(fluid, "initial_velocity", text="") elif fluid.type == 'OBSTACLE': split = layout.split() col = split.column() col.label(text="Volume Initialization:") col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "use_animated_mesh") col = split.column() subsplit = col.split() subcol = subsplit.column() #if fluid.use_animated_mesh: # subcol.enabled = False subcol.label(text="Slip Type:") subcol.prop(fluid, "slip_type", text="") if fluid.slip_type == 'PARTIALSLIP': subcol.prop(fluid, "partial_slip_factor", slider=True, text="Amount") col.label(text="Impact:") col.prop(fluid, "impact_factor", text="Factor") elif fluid.type == 'INFLOW': split = layout.split() col = split.column() col.label(text="Volume Initialization:") col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "use_animated_mesh") row = col.row() row.active = not fluid.use_animated_mesh row.prop(fluid, "use_local_coords") col = split.column() col.label(text="Inflow Velocity:") col.prop(fluid, "inflow_velocity", text="") elif fluid.type == 'OUTFLOW': col = layout.column() col.label(text="Volume Initialization:") col.prop(fluid, "volume_initialization", text="") col.prop(fluid, "use_animated_mesh") elif fluid.type == 'PARTICLE': split = layout.split() col = split.column() col.label(text="Influence:") col.prop(fluid, "particle_influence", text="Size") col.prop(fluid, "alpha_influence", text="Alpha") col = split.column() col.label(text="Type:") col.prop(fluid, "use_drops") col.prop(fluid, "use_floats") col.prop(fluid, "show_tracer") layout.prop(fluid, "filepath", text="") elif fluid.type == 'CONTROL': split = layout.split() col = split.column() col.label(text="") col.prop(fluid, "quality", slider=True) col.prop(fluid, "use_reverse_frames") col = split.column() col.label(text="Time:") sub = col.column(align=True) sub.prop(fluid, "start_time", text="Start") sub.prop(fluid, "end_time", text="End") split = layout.split() col = split.column() col.label(text="Attraction Force:") sub = col.column(align=True) sub.prop(fluid, "attraction_strength", text="Strength") sub.prop(fluid, "attraction_radius", text="Radius") col = split.column() col.label(text="Velocity Force:") sub = col.column(align=True) sub.prop(fluid, "velocity_strength", text="Strength") sub.prop(fluid, "velocity_radius", text="Radius")
def draw(self, context): layout = self.layout wm = context.window_manager layout.use_property_decorate = False st = context.space_data text = st.text if text: if wm.toggle_find_search: row = layout.row() if text.filepath: if text.is_dirty: row.label( text=iface_(f"File: *{text.filepath:s} (unsaved)"), translate=False, ) else: row.label( text=iface_("File: {text.filepath:s}"), translate=False, ) else: row.label( text="Text: External" if text.library else "Text: Internal", ) else: layout = self.layout st = context.space_data # find col = layout.column() #col = col.scale_x = 1.6 row = col.row(align=True) row.operator("text.find_set_selected", text="", icon='EYEDROPPER') subrow = row.split() subrow.scale_x = 1.6 subrow.prop(st, "find_text", text="") subrow.activate_init = True row.operator("text.find", text="Find Next") layout.separator_spacer() # replace col = layout.column() row = col.row(align=True) row.operator("text.replace_set_selected", text="", icon='EYEDROPPER') subrow = row.split() subrow.scale_x = 1.6 subrow.prop(st, "replace_text", text="") row.operator("text.replace", text="Replace") layout.separator_spacer() # settings row = layout.row(align=False) if not st.text: row.active = False row.prop(st, "use_match_case", text="", toggle=True, icon="SMALL_CAPS") # case row.prop(st, "use_find_wrap", text="", toggle=True, icon="LOOP_BACK") # warp row.prop(st, "use_find_all", text="", toggle=True, icon="DUPLICATE") # all layout.separator_spacer() col = layout.column() row = col.row(align=False) row.prop(wm, 'toggle_find_search', text="", icon="X", toggle=True)
def draw(self, context): layout = self.layout theme = context.user_preferences.themes[0] split_themes = layout.split(percentage=0.2) sub = split_themes.column() sub.label(text="Presets:") subrow = sub.row(align=True) subrow.menu("USERPREF_MT_interface_theme_presets", text=USERPREF_MT_interface_theme_presets.bl_label) subrow.operator("wm.interface_theme_preset_add", text="", icon='ZOOMIN') subrow.operator("wm.interface_theme_preset_add", text="", icon='ZOOMOUT').remove_active = True sub.separator() sub.prop(theme, "theme_area", expand=True) split = layout.split(percentage=0.4) layout.separator() layout.separator() split = split_themes.split() if theme.theme_area == 'USER_INTERFACE': col = split.column() ui = theme.user_interface col.label(text="Regular:") self._theme_widget_style(col, ui.wcol_regular) col.label(text="Tool:") self._theme_widget_style(col, ui.wcol_tool) col.label(text="Radio Buttons:") self._theme_widget_style(col, ui.wcol_radio) col.label(text="Text:") self._theme_widget_style(col, ui.wcol_text) col.label(text="Option:") self._theme_widget_style(col, ui.wcol_option) col.label(text="Toggle:") self._theme_widget_style(col, ui.wcol_toggle) col.label(text="Number Field:") self._theme_widget_style(col, ui.wcol_num) col.label(text="Value Slider:") self._theme_widget_style(col, ui.wcol_numslider) col.label(text="Box:") self._theme_widget_style(col, ui.wcol_box) col.label(text="Menu:") self._theme_widget_style(col, ui.wcol_menu) col.label(text="Pie Menu:") self._theme_widget_style(col, ui.wcol_pie_menu) col.label(text="Pulldown:") self._theme_widget_style(col, ui.wcol_pulldown) col.label(text="Menu Back:") self._theme_widget_style(col, ui.wcol_menu_back) col.label(text="Tooltip:") self._theme_widget_style(col, ui.wcol_tooltip) col.label(text="Menu Item:") self._theme_widget_style(col, ui.wcol_menu_item) col.label(text="Scroll Bar:") self._theme_widget_style(col, ui.wcol_scroll) col.label(text="Progress Bar:") self._theme_widget_style(col, ui.wcol_progress) col.label(text="List Item:") self._theme_widget_style(col, ui.wcol_list_item) ui_state = theme.user_interface.wcol_state col.label(text="State:") row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui_state, "inner_anim") colsub.row().prop(ui_state, "inner_anim_sel") colsub.row().prop(ui_state, "inner_driven") colsub.row().prop(ui_state, "inner_driven_sel") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui_state, "inner_key") colsub.row().prop(ui_state, "inner_key_sel") colsub.row().prop(ui_state, "blend") col.separator() col.separator() col.label("Menu Shadow:") row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "menu_shadow_fac") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "menu_shadow_width") col.separator() col.separator() col.label("Icons:") row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() # Not working yet. #~ colsub.active = False #~ colsub.row().prop(ui, "icon_file") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "icon_alpha") col.separator() col.separator() col.label("Axis Colors:") row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "axis_x") colsub.row().prop(ui, "axis_y") colsub.row().prop(ui, "axis_z") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() layout.separator() layout.separator() elif theme.theme_area == 'BONE_COLOR_SETS': col = split.column() for i, ui in enumerate(theme.bone_color_sets): col.label(text=iface_("Color Set %d:") % (i + 1), translate=False) # i starts from 0 row = col.row() subsplit = row.split(percentage=0.95) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "normal") colsub.row().prop(ui, "select") colsub.row().prop(ui, "active") subsplit = row.split(percentage=0.85) padding = subsplit.split(percentage=0.15) colsub = padding.column() colsub = padding.column() colsub.row().prop(ui, "show_colored_constraints") elif theme.theme_area == 'STYLE': col = split.column() style = context.user_preferences.ui_styles[0] col.label(text="Panel Title:") self._ui_font_style(col, style.panel_title) col.separator() col.label(text="Widget:") self._ui_font_style(col, style.widget) col.separator() col.label(text="Widget Label:") self._ui_font_style(col, style.widget_label) else: self._theme_generic(split, getattr(theme, theme.theme_area.lower()))