From db292ba7aca6d417db59067558dfdf6bd09e17e7 Mon Sep 17 00:00:00 2001 From: ack-err Date: Mon, 2 Sep 2013 16:39:52 +0000 Subject: * Tweaked the layout of the toolbar panels, added a compact representation for brush and texture previews, and slightly tweaked the organisation of regions in the view3d. --- .../startup/bl_ui/properties_paint_common.py | 44 +++-- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 194 ++++++++++----------- source/blender/blenloader/intern/readfile.c | 12 +- source/blender/editors/include/UI_interface.h | 2 +- .../editors/interface/interface_templates.c | 15 +- source/blender/editors/space_view3d/space_view3d.c | 14 +- .../blender/editors/space_view3d/view3d_toolbar.c | 15 ++ source/blender/makesrna/intern/rna_ui_api.c | 2 +- 8 files changed, 157 insertions(+), 141 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index b3335f32231..cf76f03733d 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -73,39 +73,45 @@ class UnifiedPaintPanel(): def brush_texture_settings(layout, brush, sculpt): tex_slot = brush.texture_slot - layout.label(text="Brush Mapping:") + col = layout.column(align=True) + row = col.row() + row.label(text="Mapping:") # map_mode if sculpt: - layout.row().prop(tex_slot, "map_mode", text="") - layout.separator() + row.prop(tex_slot, "map_mode", text="") else: - layout.row().prop(tex_slot, "tex_paint_map_mode", text="") - layout.separator() + row.prop(tex_slot, "tex_paint_map_mode", text="") - if tex_slot.map_mode == 'STENCIL': - if brush.texture and brush.texture.type == 'IMAGE': - layout.operator("brush.stencil_fit_image_aspect") - layout.operator("brush.stencil_reset_transform") + col.separator() # angle and texture_angle_source - col = layout.column() - col.active = brush.brush_capabilities.has_texture_angle_source - col.label(text="Angle:") + row = col.row() + row.active = brush.brush_capabilities.has_texture_angle_source + row.label(text="Angle:") + sub = row.column() if brush.brush_capabilities.has_random_texture_angle: if sculpt: if brush.sculpt_capabilities.has_random_texture_angle: - col.prop(brush, "texture_angle_source_random", text="") + sub.prop(brush, "texture_angle_source_random", text="") else: - col.prop(brush, "texture_angle_source_no_random", text="") + sub.prop(brush, "texture_angle_source_no_random", text="") else: - col.prop(brush, "texture_angle_source_random", text="") + sub.prop(brush, "texture_angle_source_random", text="") else: - col.prop(brush, "texture_angle_source_no_random", text="") - col = layout.column() - col.active = brush.brush_capabilities.has_texture_angle - col.prop(tex_slot, "angle", text="") + sub.prop(brush, "texture_angle_source_no_random", text="") + # row = layout.column() + sub.active = brush.brush_capabilities.has_texture_angle + sub.prop(tex_slot, "angle", text="") + + col = layout.column(align=True) + col.separator() + + if tex_slot.map_mode == 'STENCIL': + if brush.texture and brush.texture.type == 'IMAGE': + col.operator("brush.stencil_fit_image_aspect") + col.operator("brush.stencil_reset_transform") # scale and offset split = layout.split() diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index becacf1936d..73db86b9af7 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -98,9 +98,9 @@ class VIEW3D_PT_tools_objectmode_adjust(View3DPanel, Panel): VIEW3D_PT_tools_objectmode_history = history_panel("objectmode") -class VIEW3D_PT_tools_objectmode_keyframes(View3DPanel, Panel): +class VIEW3D_PT_tools_objectmode_animation(View3DPanel, Panel): bl_context = "objectmode" - bl_label = "Keyframes" + bl_label = "Animation" def draw(self, context): layout = self.layout @@ -251,6 +251,7 @@ VIEW3D_PT_tools_editmode_history = history_panel("mesh_edit") class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel): bl_context = "mesh_edit" bl_label = "Mesh Options" + bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): @@ -562,7 +563,8 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): if not context.particle_edit_object: col = layout.split().column() - col.template_ID_preview_brush(settings, "brush", new="brush.add", rows=5, cols=8) + # col.template_ID_preview_compact(settings, "brush", new="brush.add", rows=5, cols=8) + col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8) # Particle Mode # if context.particle_edit_object: @@ -571,7 +573,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): layout.column().prop(settings, "tool", expand=True) if tool != 'NONE': - col = layout.column() + col = layout.column(align=True) col.prop(brush, "size", slider=True) if tool != 'ADD': col.prop(brush, "strength", slider=True) @@ -595,7 +597,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): elif context.sculpt_object and brush: capabilities = brush.sculpt_capabilities - col = layout.column() + col = layout.column(align=True) col.separator() @@ -614,7 +616,6 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): # strength, use_strength_pressure, and use_strength_attenuation if capabilities.has_strength: - col.separator() row = col.row(align=True) if capabilities.has_space_attenuation: @@ -628,28 +629,23 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): # auto_smooth_factor and use_inverse_smooth_pressure if capabilities.has_auto_smooth: - col.separator() - row = col.row(align=True) row.prop(brush, "auto_smooth_factor", slider=True) row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="") # normal_weight if capabilities.has_normal_weight: - col.separator() row = col.row(align=True) row.prop(brush, "normal_weight", slider=True) # crease_pinch_factor if capabilities.has_pinch_factor: - col.separator() row = col.row(align=True) row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch") # use_original_normal and sculpt_plane if capabilities.has_sculpt_plane: row = col.row(align=True) - col.separator() if brush.use_original_normal: row.prop(brush, "use_original_normal", toggle=True, text="", icon='LOCKED') @@ -663,7 +659,6 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): # plane_offset, use_offset_pressure, use_plane_trim, plane_trim if capabilities.has_plane_offset: - row = col.row(align=True) row.prop(brush, "plane_offset", slider=True) row.prop(brush, "use_offset_pressure", text="") @@ -713,14 +708,11 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): col.operator("sculpt.set_persistent_base") col = layout.column(align=True) - col.label(text="Overlay:") - + row = col.row() - if brush.use_cursor_overlay: - row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF') - else: - row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON') - + row.prop(brush, "use_cursor_overlay", toggle=True, text="", + icon=('RESTRICT_VIEW_OFF' if brush.use_cursor_overlay else 'RESTRICT_VIEW_ON')) + sub = row.row() sub.prop(brush, "cursor_overlay_alpha", text="Alpha") sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA') @@ -734,6 +726,8 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): col.template_color_picker(brush, "color", value_slider=True) col.prop(brush, "color", text="") + col = layout.column(align=True) + row = col.row(align=True) self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius") self.prop_unified_size(row, context, brush, "use_pressure_size") @@ -744,29 +738,26 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): row = col.row(align=True) - col.prop(brush, "blend", text="Blend") + col.prop(brush, "blend", text="") col = layout.column() col.active = (brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'}) - col.prop(brush, "use_alpha") + col.prop(brush, "use_alpha", text="Use Alpha") col = layout.column(align=True) - col.label(text="Overlay:") row = col.row() - if brush.use_cursor_overlay: - row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF') - else: - row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON') - + row.prop(brush, "use_cursor_overlay", toggle=True, text="", + icon=('RESTRICT_VIEW_OFF' if brush.use_cursor_overlay else 'RESTRICT_VIEW_ON')) + sub = row.row() - sub.prop(brush, "cursor_overlay_alpha", text="Alpha") + sub.prop(brush, "cursor_overlay_alpha", text="Overlay") sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA') # Weight Paint Mode # elif context.weight_paint_object and brush: - col = layout.column() + col = layout.column(align=True) row = col.row(align=True) self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight") @@ -781,18 +772,19 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): row = col.row(align=True) - col.prop(brush, "vertex_tool", text="Blend") + col.prop(brush, "vertex_tool", text="") - col = layout.column() + col = layout.column(align=True) col.prop(toolsettings, "use_auto_normalize", text="Auto Normalize") col.prop(toolsettings, "use_multipaint", text="Multi-Paint") # Vertex Paint Mode # elif context.vertex_paint_object and brush: col = layout.column() - # col.template_color_picker(brush, "color", value_slider=False) + col.template_color_picker(brush, "color", value_slider=True) col.prop(brush, "color", text="") + col = layout.column(align=True) row = col.row(align=True) self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius") self.prop_unified_size(row, context, brush, "use_pressure_size") @@ -801,24 +793,22 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel): self.prop_unified_strength(row, context, brush, "strength", text="Strength") self.prop_unified_strength(row, context, brush, "use_pressure_strength") + col.prop(brush, "vertex_tool", text="") + # XXX - TODO #row = col.row(align=True) #row.prop(brush, "jitter", slider=True) #row.prop(brush, "use_pressure_jitter", toggle=True, text="") - col.prop(brush, "vertex_tool", text="Blend") - col = layout.column(align=True) - col.label(text="Overlay:") + # col.label(text="Overlay:") row = col.row() - if brush.use_cursor_overlay: - row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF') - else: - row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON') - + row.prop(brush, "use_cursor_overlay", toggle=True, text="", + icon=('RESTRICT_VIEW_OFF' if brush.use_cursor_overlay else 'RESTRICT_VIEW_ON')) + sub = row.row() - sub.prop(brush, "cursor_overlay_alpha", text="Alpha") + sub.prop(brush, "cursor_overlay_alpha", text="Overlay") sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA') class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel): @@ -840,63 +830,26 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel): col = layout.column() - col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8) + col.template_ID_preview_compact(brush, "texture", new="texture.new", rows=3, cols=8) + + col.separator() brush_texture_settings(col, brush, context.sculpt_object) # use_texture_overlay and texture_overlay_alpha col = layout.column(align=True) col.active = brush.brush_capabilities.has_overlay - col.label(text="Overlay:") - + row = col.row() if tex_slot.map_mode != 'STENCIL': - if brush.use_primary_overlay: - row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF') - else: - row.prop(brush, "use_primary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON') + row.prop(brush, "use_primary_overlay", toggle=True, text="", + icon='RESTRICT_VIEW_OFF' if brush.use_primary_overlay else 'RESTRICT_VIEW_ON') + sub = row.row() - sub.prop(brush, "texture_overlay_alpha", text="Alpha") + sub.prop(brush, "texture_overlay_alpha", text="Overlay") sub.prop(brush, "use_primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA') -class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel): - bl_context = "imagepaint" - bl_label = "Texture Mask" - bl_options = {'DEFAULT_CLOSED'} - - @classmethod - def poll(cls, context): - brush = context.tool_settings.image_paint.brush - return (context.image_paint_object and brush) - - def draw(self, context): - layout = self.layout - - brush = context.tool_settings.image_paint.brush - tex_slot_alpha = brush.mask_texture_slot - - col = layout.column() - - col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8) - - brush_mask_texture_settings(col, brush) - - col = layout.column(align=True) - col.active = brush.brush_capabilities.has_overlay - col.label(text="Overlay:") - - row = col.row() - if tex_slot_alpha.map_mode != 'STENCIL': - if brush.use_secondary_overlay: - row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF') - else: - row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON') - - sub = row.row() - sub.prop(brush, "mask_overlay_alpha", text="Alpha") - sub.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA') - class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel): bl_label = "Stroke" bl_options = {'DEFAULT_CLOSED'} @@ -919,31 +872,34 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel): col = layout.column() - col.label(text="Stroke Method:") + row = col.row() + row.label(text="Method:") if context.sculpt_object: - col.prop(brush, "sculpt_stroke_method", text="") + row.prop(brush, "sculpt_stroke_method", text="") else: - col.prop(brush, "stroke_method", text="") + row.prop(brush, "stroke_method", text="") + + col = layout.column(align=True) if brush.use_anchor: - col.separator() + # col.separator() col.prop(brush, "use_edge_to_edge", "Edge To Edge") if brush.use_airbrush: - col.separator() + # col.separator() col.prop(brush, "rate", text="Rate", slider=True) if brush.use_space: - col.separator() + # col.separator() row = col.row(align=True) row.active = brush.use_space row.prop(brush, "spacing", text="Spacing") row.prop(brush, "use_pressure_spacing", toggle=True, text="") + # col.separator() if context.sculpt_object: if brush.sculpt_capabilities.has_jitter: - col.separator() row = col.row(align=True) if brush.use_relative_jitter: @@ -954,9 +910,9 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel): row.prop(brush, "jitter_absolute") row.prop(brush, "use_pressure_jitter", toggle=True, text="") if brush.sculpt_capabilities.has_smooth_stroke: - col = layout.column() + # smooth stroke + col = layout.column(align=True) col.separator() - col.prop(brush, "use_smooth_stroke") sub = col.column() @@ -964,8 +920,6 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel): sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) else: - col.separator() - row = col.row(align=True) if brush.use_relative_jitter: row.prop(brush, "use_relative_jitter", text="", icon='LOCKED') @@ -975,7 +929,8 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel): row.prop(brush, "jitter_absolute") row.prop(brush, "use_pressure_jitter", toggle=True, text="") - col = layout.column() + # smooth stroke + col = layout.column(align=True) col.separator() col.prop(brush, "use_smooth_stroke") @@ -1011,6 +966,43 @@ class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel): row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE' row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX' +class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel): + bl_context = "imagepaint" + bl_label = "Texture Mask" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + brush = context.tool_settings.image_paint.brush + return (context.image_paint_object and brush) + + def draw(self, context): + layout = self.layout + + brush = context.tool_settings.image_paint.brush + tex_slot_alpha = brush.mask_texture_slot + + col = layout.column() + + col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8) + + brush_mask_texture_settings(col, brush) + + col = layout.column(align=True) + col.active = brush.brush_capabilities.has_overlay + col.label(text="Overlay:") + + row = col.row() + if tex_slot_alpha.map_mode != 'STENCIL': + if brush.use_secondary_overlay: + row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF') + else: + row.prop(brush, "use_secondary_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON') + + sub = row.row() + sub.prop(brush, "mask_overlay_alpha", text="Alpha") + sub.prop(brush, "use_secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA') + class VIEW3D_PT_sculpt_topology(Panel, View3DPaintPanel): bl_label = "Topology" bl_options = {'DEFAULT_CLOSED'} @@ -1147,7 +1139,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel): ob = context.active_object - col = layout.column() + col = layout.column(align=True) col.active = ob.vertex_groups.active is not None col.operator("object.vertex_group_normalize_all", text="Normalize All") col.operator("object.vertex_group_normalize", text="Normalize") @@ -1164,6 +1156,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel): class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel): bl_context = "weightpaint" bl_label = "Options" + bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout @@ -1197,9 +1190,10 @@ class VIEW3D_PT_tools_weightpaint_options(Panel, View3DPaintPanel): # ********** default tools for vertex-paint **************** -class VIEW3D_PT_tools_vertexpaint(Panel, View3DPaintPanel): +class VIEW3D_PT_tools_vertexpaint_options(Panel, View3DPaintPanel): bl_context = "vertexpaint" bl_label = "Options" + bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0425ba0d20b..0f5b69b0b1a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9559,16 +9559,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sa = sc->areabase.first; sa; sa = sa->next) { SpaceLink *sl; ARegion *ar; - ARegion *after = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS); + ARegion *before = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS); - if (after && sa->spacetype == SPACE_VIEW3D) { + if (before && sa->spacetype == SPACE_VIEW3D) { /* add operators menubar */ ar = BKE_area_find_region_type(sa, RGN_TYPE_MENU_BAR); if (ar == NULL) { ar = MEM_callocN(sizeof(ARegion), "tool operators menu bar for view3d"); - BLI_insertlinkafter(&sa->regionbase, after, ar); + BLI_insertlinkbefore(&sa->regionbase, before, ar); ar->regiontype = RGN_TYPE_MENU_BAR; ar->alignment = RGN_ALIGN_TOP; } @@ -9576,16 +9576,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (sl = sa->spacedata.first; sl; sl = sl->next) { - ARegion *after = BKE_spacelink_find_region_type(sl, RGN_TYPE_TOOLS); + ARegion *before = BKE_spacelink_find_region_type(sl, RGN_TYPE_TOOLS); - if (after && sl->spacetype == SPACE_VIEW3D) { + if (before && sl->spacetype == SPACE_VIEW3D) { /* add operators menubar */ ar = BKE_spacelink_find_region_type(sl, RGN_TYPE_MENU_BAR); if (ar == NULL) { ar = MEM_callocN(sizeof(ARegion), "tool operators menu bar for view3d"); - BLI_insertlinkafter(&sl->regionbase, after, ar); + BLI_insertlinkbefore(&sl->regionbase, before, ar); ar->regiontype = RGN_TYPE_MENU_BAR; ar->alignment = RGN_ALIGN_TOP; } diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 8893b9c9741..8a50c51f082 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -829,7 +829,7 @@ void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA const char *newop, const char *openop, const char *unlinkop); void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols); -void uiTemplateIDPreviewBrush(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, +void uiTemplateIDPreviewCompact(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols); void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *proptypename, const char *text); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 47cea6f3fac..34950cac717 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -607,7 +607,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str uiBlockEndAlign(block); } -static void template_ID_brush(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag, + +static void template_ID_compact(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, short idcode, int flag, const char *newop, const char *UNUSED(openop), const char *unlinkop) { uiBut *but; @@ -669,7 +670,7 @@ static void template_ID_brush(bContext *C, uiLayout *layout, TemplateID *templat BLI_snprintf(numstr, sizeof(numstr), "%d", id->us); - but = uiDefBut(block, BUT, 0, numstr, 0, 0, 6 * UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y, + but = uiDefBut(block, BUT, 0, numstr, 0, 0, UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Display number of users of this data (click to make a single-user copy)")); @@ -688,7 +689,7 @@ static void template_ID_brush(bContext *C, uiLayout *layout, TemplateID *templat if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT); if (id->lib == NULL && !(ELEM5(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) { - uiDefButR(block, TOG, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL); + uiDefButR(block, TOG, 0, "F", 0, 0, 6 * UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL); } } @@ -767,7 +768,7 @@ static void template_ID_brush(bContext *C, uiLayout *layout, TemplateID *templat } static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, - const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols, int brush) + const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols, int compact) { TemplateID *template; PropertyRNA *prop; @@ -801,8 +802,8 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const */ if (template->idlb) { uiLayoutRow(layout, TRUE); - if (brush) { - template_ID_brush(C, layout, template, type, idcode, flag, newop, openop, unlinkop); + if (compact) { + template_ID_compact(C, layout, template, type, idcode, flag, newop, openop, unlinkop); } else { template_ID(C, layout, template, type, idcode, flag, newop, openop, unlinkop); @@ -833,7 +834,7 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const c UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS, rows, cols, FALSE); } -void uiTemplateIDPreviewBrush(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, +void uiTemplateIDPreviewCompact(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols) { ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index de57a410536..d82e35c0cf1 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -296,13 +296,6 @@ static SpaceLink *view3d_new(const bContext *C) ar->regiontype = RGN_TYPE_HEADER; ar->alignment = RGN_ALIGN_BOTTOM; - /* tool shelf */ - ar = MEM_callocN(sizeof(ARegion), "toolshelf for view3d"); - - BLI_addtail(&v3d->regionbase, ar); - ar->regiontype = RGN_TYPE_TOOLS; - ar->alignment = RGN_ALIGN_LEFT; - /* operators menubar */ ar = MEM_callocN(sizeof(ARegion), "tool operators menu bar for view3d"); @@ -310,6 +303,13 @@ static SpaceLink *view3d_new(const bContext *C) ar->regiontype = RGN_TYPE_MENU_BAR; ar->alignment = RGN_ALIGN_TOP; + /* tool shelf */ + ar = MEM_callocN(sizeof(ARegion), "toolshelf for view3d"); + + BLI_addtail(&v3d->regionbase, ar); + ar->regiontype = RGN_TYPE_TOOLS; + ar->alignment = RGN_ALIGN_LEFT; + /* object properties sidebar right */ ar = MEM_callocN(sizeof(ARegion), "buttons for view3d"); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 52843702eda..8b5be1f919e 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -283,6 +283,20 @@ void view3d_tool_props_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } +static int view3d_grease_pencil_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +{ + return ELEM9(CTX_data_mode_enum(C), + CTX_MODE_EDIT_MESH, + CTX_MODE_EDIT_CURVE, + CTX_MODE_EDIT_SURFACE, + CTX_MODE_EDIT_TEXT, + CTX_MODE_EDIT_ARMATURE, + CTX_MODE_EDIT_METABALL, + CTX_MODE_EDIT_LATTICE, + CTX_MODE_POSE, + CTX_MODE_OBJECT); +} + void view3d_grease_register(ARegionType *art) { PanelType *pt; @@ -293,6 +307,7 @@ void view3d_grease_register(ARegionType *art) strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw_header = gpencil_panel_standard_header; pt->draw = gpencil_panel_standard; + pt->poll = view3d_grease_pencil_panel_poll; BLI_addtail(&art->paneltypes, pt); } diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index b9cbd7028b3..342db5bed86 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -650,7 +650,7 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX); RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX); - func = RNA_def_function(srna, "template_ID_preview_brush", "uiTemplateIDPreviewBrush"); + func = RNA_def_function(srna, "template_ID_preview_compact", "uiTemplateIDPreviewCompact"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block"); -- cgit v1.2.3