diff options
Diffstat (limited to 'release/scripts/ui/space_view3d_toolbar.py')
-rw-r--r-- | release/scripts/ui/space_view3d_toolbar.py | 505 |
1 files changed, 435 insertions, 70 deletions
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 6de4ba6ce34..515fa236fc0 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -19,6 +19,7 @@ # <pep8 compliant> import bpy +narrowui = bpy.context.user_preferences.view.properties_width_check class View3DPanel(bpy.types.Panel): bl_space_type = 'VIEW_3D' @@ -42,6 +43,9 @@ class VIEW3D_PT_tools_objectmode(View3DPanel): col.operator("transform.resize", text="Scale") col = layout.column(align=True) + col.operator("object.origin_set", text="Origin") + + col = layout.column(align=True) col.label(text="Object:") col.operator("object.duplicate_move") col.operator("object.delete") @@ -500,18 +504,26 @@ class VIEW3D_PT_tools_brush(PaintPanel): if not context.particle_edit_object: col = layout.split().column() - row = col.row() - if context.sculpt_object and brush: - defaultbrushes = 8 - elif context.texture_paint_object and brush: - defaultbrushes = 4 + if context.sculpt_object and context.tool_settings.sculpt: + col.template_ID_preview(settings, "brush", new="brush.add", filter="is_sculpt_brush", rows=3, cols=8) + elif context.texture_paint_object and context.tool_settings.image_paint: + col.template_ID_preview(settings, "brush", new="brush.add", filter="is_imapaint_brush", rows=3, cols=8) + elif context.vertex_paint_object and context.tool_settings.vertex_paint: + col.template_ID_preview(settings, "brush", new="brush.add", filter="is_vpaint_brush", rows=3, cols=8) + elif context.weight_paint_object and context.tool_settings.weight_paint: + col.template_ID_preview(settings, "brush", new="brush.add", filter="is_wpaint_brush", rows=3, cols=8) else: - defaultbrushes = 7 + row = col.row() - row.template_list(settings, "brushes", settings, "active_brush_index", rows=2, maxrows=defaultbrushes) + if context.sculpt_object and brush: + defaultbrushes = 8 + elif context.texture_paint_object and brush: + defaultbrushes = 4 + else: + defaultbrushes = 7 - col.template_ID(settings, "brush", new="brush.add") + row.template_list(settings, "brushes", settings, "active_brush_index", rows=2, maxrows=defaultbrushes) # Particle Mode # @@ -523,9 +535,11 @@ class VIEW3D_PT_tools_brush(PaintPanel): if settings.tool != 'NONE': col = layout.column() col.prop(brush, "size", slider=True) - col.prop(brush, "strength", slider=True) + if settings.tool != 'ADD': + col.prop(brush, "strength", slider=True) if settings.tool == 'ADD': + col.prop(brush, "count") col = layout.column() col.prop(settings, "add_interpolate") sub = col.column(align=True) @@ -541,33 +555,150 @@ class VIEW3D_PT_tools_brush(PaintPanel): # Sculpt Mode # elif context.sculpt_object and brush: + edit = context.user_preferences.edit + col = layout.column() + + col.separator() row = col.row(align=True) - row.prop(brush, "size", slider=True) - if brush.sculpt_tool != 'GRAB': - row.prop(brush, "use_size_pressure", toggle=True, text="") + if edit.sculpt_paint_use_unified_size: + if edit.sculpt_paint_unified_lock_brush_size: + row.prop(edit, "sculpt_paint_unified_lock_brush_size", toggle=True, text="", icon='LOCKED') + row.prop(edit, "sculpt_paint_unified_unprojected_radius", text="Unified Radius", slider=True) + else: + row.prop(edit, "sculpt_paint_unified_lock_brush_size", toggle=True, text="", icon='UNLOCKED') + row.prop(edit, "sculpt_paint_unified_size", text="Unified Radius", slider=True) + + else: + if brush.lock_brush_size: + row.prop(brush, "lock_brush_size", toggle=True, text="", icon='LOCKED') + row.prop(brush, "unprojected_radius", text="Radius", slider=True) + else: + row.prop(brush, "lock_brush_size", toggle=True, text="", icon='UNLOCKED') + row.prop(brush, "size", text="Radius", slider=True) + + row.prop(brush, "use_size_pressure", toggle=True, text="") + + + if brush.sculpt_tool not in ('SNAKE_HOOK', 'GRAB', 'ROTATE'): + col.separator() row = col.row(align=True) - row.prop(brush, "strength", slider=True) + + if brush.use_space and brush.sculpt_tool not in ('SMOOTH'): + if brush.use_space_atten: + row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED') + else: + row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED') + + if edit.sculpt_paint_use_unified_strength: + row.prop(edit, "sculpt_paint_unified_strength", text="Unified Strength", slider=True) + else: + row.prop(brush, "strength", text="Strength", slider=True) + row.prop(brush, "use_strength_pressure", text="") - # XXX - TODO - #row = col.row(align=True) - #row.prop(brush, "jitter", slider=True) - #row.prop(brush, "use_jitter_pressure", toggle=True, text="") - col = layout.column() - if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'): - col.row().prop(brush, "direction", expand=True) + if brush.sculpt_tool not in ('SMOOTH'): + col.separator() + + row = col.row(align=True) + row.prop(brush, "autosmooth_factor", slider=True) + row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="") + + + + if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK'): + col.separator() + + row = col.row(align=True) + row.prop(brush, "normal_weight", slider=True) + + + + if brush.sculpt_tool in ('CREASE', 'BLOB'): + col.separator() + + row = col.row(align=True) + row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch") + + if brush.sculpt_tool not in ('PINCH', 'INFLATE', 'SMOOTH'): + row = col.row(align=True) + + col.separator() + + if brush.use_original_normal: + row.prop(brush, "use_original_normal", toggle=True, text="", icon='LOCKED') + else: + row.prop(brush, "use_original_normal", toggle=True, text="", icon='UNLOCKED') + + row.prop(brush, "sculpt_plane", text="") + + #if brush.sculpt_tool in ('CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'): + if brush.sculpt_tool in ('CLAY', 'FLATTEN', 'FILL', 'SCRAPE'): + row = col.row(align=True) + row.prop(brush, "plane_offset", slider=True) + row.prop(brush, "use_offset_pressure", text="") + + col.separator() + + row= col.row() + row.prop(brush, "use_plane_trim", text="Trim") + row= col.row() + row.active=brush.use_plane_trim + row.prop(brush, "plane_trim", slider=True, text="Distance") + + col.separator() + + row= col.row() + row.prop(brush, "use_frontface", text="Front Faces Only") + + #if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'LAYER', 'CLAY', 'CLAY_TUBES'): + if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'LAYER', 'CLAY'): + col.separator() + col.row().prop(brush, "direction", expand=True) + elif brush.sculpt_tool in ('FLATTEN'): + col.separator() + col.row().prop(brush, "flatten_contrast", expand=True) + elif brush.sculpt_tool in ('FILL'): + col.separator() + col.row().prop(brush, "fill_deepen", expand=True) + elif brush.sculpt_tool in ('SCRAPE'): + col.separator() + col.row().prop(brush, "scrape_peaks", expand=True) + elif brush.sculpt_tool in ('INFLATE'): + col.separator() + col.row().prop(brush, "inflate_deflate", expand=True) + elif brush.sculpt_tool in ('PINCH'): + col.separator() + col.row().prop(brush, "pinch_magnify", expand=True) + + + + #if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY', 'CLAY_TUBES'): + if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'): + col.separator() + + col.prop(brush, "use_accumulate") + - if brush.sculpt_tool in ('DRAW', 'INFLATE', 'LAYER'): - col.prop(brush, "use_accumulate") - if brush.sculpt_tool == 'LAYER': + if brush.sculpt_tool == 'LAYER': + col.separator() + + ob = context.sculpt_object + do_persistent = True + + # not supported yet for this case + for md in ob.modifiers: + if md.type == 'MULTIRES': + do_persistent = False + + if do_persistent: col.prop(brush, "use_persistent") col.operator("sculpt.set_persistent_base") @@ -592,6 +723,11 @@ class VIEW3D_PT_tools_brush(PaintPanel): col.prop(brush, "blend", text="Blend") + col = layout.column() + col.active = (brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA')) + col.prop(brush, "use_alpha") + + # Weight Paint Mode # elif context.weight_paint_object and brush: @@ -650,9 +786,88 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel): col = layout.column() - col.template_ID_preview(brush, "texture", new="texture.new", rows=2, cols=4) + col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8) + + if context.sculpt_object: + #XXX duplicated from properties_texture.py + + wide_ui = context.region.width > narrowui + + + col.separator() + + + col.label(text="Brush Mapping:") + row = col.row(align=True) + row.prop(tex_slot, "map_mode", expand=True) + + col.separator() + + col = layout.column() + col.active = tex_slot.map_mode in ('FIXED') + col.label(text="Angle:") + + col = layout.column() + if not brush.use_anchor and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED'): + col.prop(brush, "texture_angle_source", text="") + else: + col.prop(brush, "texture_angle_source_no_random", text="") + + #row = col.row(align=True) + #row.label(text="Angle:") + #row.active = tex_slot.map_mode in ('FIXED', 'TILED') + + #row = col.row(align=True) + + #col = row.column() + #col.active = tex_slot.map_mode in ('FIXED') + #col.prop(brush, "use_rake", toggle=True, icon='PARTICLEMODE', text="") + + col = layout.column() + col.prop(tex_slot, "angle", text="") + col.active = tex_slot.map_mode in ('FIXED', 'TILED') + + #col = layout.column() + #col.prop(brush, "use_random_rotation") + #col.active = (not brush.use_rake) and (not brush.use_anchor) and brush.sculpt_tool not in ('GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE') and tex_slot.map_mode in ('FIXED') + + split = layout.split() + + col = split.column() + col.prop(tex_slot, "offset") + + if wide_ui: + col = split.column() + else: + col.separator() + + col.prop(tex_slot, "size") + + col = layout.column() + + row = col.row(align=True) + row.label(text="Sample Bias:") + row = col.row(align=True) + row.prop(brush, "texture_sample_bias", slider=True, text="") + + row = col.row(align=True) + row.label(text="Overlay:") + row.active = tex_slot.map_mode in ('FIXED', 'TILED') + + row = col.row(align=True) + + col = row.column() + + if brush.use_texture_overlay: + col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_OFF') + else: + col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_ON') + + col.active = tex_slot.map_mode in ('FIXED', 'TILED') - col.row().prop(tex_slot, "map_mode", expand=True) + col = row.column() + col.prop(brush, "texture_overlay_alpha", text="Alpha") + col.active = tex_slot.map_mode in ('FIXED', 'TILED') and brush.use_texture_overlay class VIEW3D_PT_tools_brush_tool(PaintPanel): @@ -676,15 +891,11 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel): col = layout.column(align=True) if context.sculpt_object: - col.prop(brush, "sculpt_tool", expand=True) + col.prop(brush, "sculpt_tool", expand=False, text="") elif context.texture_paint_object: - col.prop(brush, "imagepaint_tool", expand=True) - #col.prop_enum(settings, "tool", 'DRAW') - #col.prop_enum(settings, "tool", 'SOFTEN') - #col.prop_enum(settings, "tool", 'CLONE') - #col.prop_enum(settings, "tool", 'SMEAR') + col.prop(brush, "imagepaint_tool", expand=False, text="") elif context.vertex_paint_object or context.weight_paint_object: - col.prop(brush, "vertexpaint_tool", expand=True) + col.prop(brush, "vertexpaint_tool", expand=False, text="") class VIEW3D_PT_tools_brush_stroke(PaintPanel): @@ -705,29 +916,83 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel): brush = settings.brush texture_paint = context.texture_paint_object + col = layout.column() + if context.sculpt_object: - if brush.sculpt_tool != 'LAYER': - layout.prop(brush, "use_anchor") - layout.prop(brush, "use_rake") + col.label(text="Stroke Method:") + col.prop(brush, "stroke_method", text="") + + if brush.use_anchor: + col.separator() + row = col.row() + row.prop(brush, "edge_to_edge", "Edge To Edge") + + if brush.use_airbrush: + col.separator() + row = col.row() + row.prop(brush, "rate", text="Rate", slider=True) + + if brush.use_space: + col.separator() + row = col.row() + row.active = brush.use_space + row.prop(brush, "spacing", text="Spacing") + + if brush.sculpt_tool not in ('GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE') and (not brush.use_anchor) and (not brush.restore_mesh): + col = layout.column() + col.separator() - layout.prop(brush, "use_airbrush") - col = layout.column() - col.active = brush.use_airbrush - col.prop(brush, "rate", slider=True) + col.prop(brush, "use_smooth_stroke") + + sub = col.column() + sub.active = brush.use_smooth_stroke + sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) + sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) + + col.separator() + + row = col.row(align=True) + row.prop(brush, "jitter", slider=True) + row.prop(brush, "use_jitter_pressure", toggle=True, text="") + + else: + row = col.row() + row.prop(brush, "use_airbrush") + + row = col.row() + row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor) + row.prop(brush, "rate", slider=True) + + col.separator() + + if not texture_paint: + row = col.row() + row.prop(brush, "use_smooth_stroke") + + col = layout.column() + col.active = brush.use_smooth_stroke + col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) + col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) + + col.separator() - if not texture_paint: - layout.prop(brush, "use_smooth_stroke") col = layout.column() - col.active = brush.use_smooth_stroke - col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True) - col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True) + col.active = (not brush.use_anchor) and (brush.sculpt_tool not in ('GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK')) - layout.prop(brush, "use_space") - row = layout.row(align=True) - row.active = brush.use_space - row.prop(brush, "spacing", text="Distance", slider=True) - if texture_paint: - row.prop(brush, "use_spacing_pressure", toggle=True, text="") + row = col.row() + row.prop(brush, "use_space") + + row = col.row() + row.active = brush.use_space + row.prop(brush, "spacing", text="Spacing") + + #col.prop(brush, "use_space_atten", text="Adaptive Strength") + #col.prop(brush, "use_adaptive_space", text="Adaptive Spacing") + + #col.separator() + + #if texture_paint: + # row.prop(brush, "use_spacing_pressure", toggle=True, text="") class VIEW3D_PT_tools_brush_curve(PaintPanel): @@ -745,11 +1010,19 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel): brush = settings.brush layout.template_curve_mapping(brush, "curve", brush=True) - layout.operator_menu_enum("brush.curve_preset", property="shape") + row = layout.row(align=True) + row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH' + row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND' + row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT' + row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP' + row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE' + row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' + row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 'MID9' class VIEW3D_PT_sculpt_options(PaintPanel): bl_label = "Options" + bl_default_closed = True def poll(self, context): return (context.sculpt_object and context.tool_settings.sculpt) @@ -757,25 +1030,100 @@ class VIEW3D_PT_sculpt_options(PaintPanel): def draw(self, context): layout = self.layout + wide_ui = context.region.width > narrowui + sculpt = context.tool_settings.sculpt + settings = self.paint_settings(context) + brush = settings.brush - col = layout.column() - col.prop(sculpt, "show_brush") - col.prop(sculpt, "fast_navigate") + split = layout.split() + + col = split.column() - split = self.layout.split() + edit = context.user_preferences.edit + col.label(text="Unified Settings:") + col.prop(edit, "sculpt_paint_use_unified_size", text="Size") + col.prop(edit, "sculpt_paint_use_unified_strength", text="Strength") + + if wide_ui: + col = split.column() + else: + col.separator() + + col.label(text="Lock:") + row = col.row(align=True) + row.prop(sculpt, "lock_x", text="X", toggle=True) + row.prop(sculpt, "lock_y", text="Y", toggle=True) + row.prop(sculpt, "lock_z", text="Z", toggle=True) + +class VIEW3D_PT_sculpt_symmetry(PaintPanel): + bl_label = "Symmetry" + bl_default_closed = True + + def poll(self, context): + return (context.sculpt_object and context.tool_settings.sculpt) + + def draw(self, context): + wide_ui = context.region.width > narrowui + + layout = self.layout + + sculpt = context.tool_settings.sculpt + settings = self.paint_settings(context) + brush = settings.brush + + split = layout.split() col = split.column() - col.label(text="Symmetry:") + + col.label(text="Mirror:") col.prop(sculpt, "symmetry_x", text="X") col.prop(sculpt, "symmetry_y", text="Y") col.prop(sculpt, "symmetry_z", text="Z") - col = split.column() - col.label(text="Lock:") - col.prop(sculpt, "lock_x", text="X") - col.prop(sculpt, "lock_y", text="Y") - col.prop(sculpt, "lock_z", text="Z") + if wide_ui: + col = split.column() + else: + col.separator() + + col.prop(sculpt, "radial_symm", text="Radial") + + col = layout.column() + + col.separator() + + col.prop(sculpt, "use_symmetry_feather", text="Feather") + +class VIEW3D_PT_tools_brush_appearance(PaintPanel): + bl_label = "Appearance" + bl_default_closed = True + + def poll(self, context): + return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.texture_paint_object and context.tool_settings.image_paint) + + def draw(self, context): + layout = self.layout + + sculpt = context.tool_settings.sculpt + settings = self.paint_settings(context) + brush = settings.brush + + col = layout.column(); + + if context.sculpt_object and context.tool_settings.sculpt: + #if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'CLAY_TUBES', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN'): + if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN'): + col.prop(brush, "add_col", text="Add Color") + col.prop(brush, "sub_col", text="Substract Color") + else: + col.prop(brush, "add_col", text="Color") + + col.separator() + + col = layout.column() + col.label(text="Icon:") + #col.template_ID_preview(brush, "image_icon", open="image.open", filter="is_image_icon", rows=3, cols=8) + col.template_ID_preview(brush, "image_icon", open="image.open", rows=3, cols=8) # ********** default tools for weightpaint **************** @@ -907,6 +1255,18 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel): sub = col.column() sub.prop(ipaint, "seam_bleed") + col.label(text="External Editing") + row = col.split(align=True, percentage=0.55) + row.operator("image.project_edit", text="Quick Edit") + row.operator("image.project_apply", text="Apply") + row = col.row(align=True) + row.prop(ipaint, "screen_grab_size", text="") + + sub = col.column() + sub.operator("paint.project_image", text="Apply Camera Image") + + sub.operator("image.save_dirty", text="Save All Edited") + class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu): bl_label = "Clone Layer" @@ -915,7 +1275,7 @@ class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu): layout = self.layout for i, tex in enumerate(context.active_object.data.uv_textures): prop = layout.operator("wm.context_set_int", text=tex.name) - prop.path = "active_object.data.uv_texture_clone_index" + prop.data_path = "active_object.data.uv_texture_clone_index" prop.value = i @@ -926,7 +1286,7 @@ class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu): layout = self.layout for i, tex in enumerate(context.active_object.data.uv_textures): prop = layout.operator("wm.context_set_int", text=tex.name) - prop.path = "active_object.data.uv_texture_stencil_index" + prop.data_path = "active_object.data.uv_texture_stencil_index" prop.value = i @@ -986,12 +1346,15 @@ class VIEW3D_PT_tools_particlemode(View3DPanel): col.active = pe.editable col.label(text="Draw:") col.prop(pe, "draw_step", text="Path Steps") - if pe.type == 'PARTICLES': - col.prop(pe, "draw_particles", text="Particles") - col.prop(pe, "fade_time") - sub = col.row() - sub.active = pe.fade_time - sub.prop(pe, "fade_frames", slider=True) + if pe.hair: + col.prop(pe, "draw_particles", text="Children") + else: + if pe.type == 'PARTICLES': + col.prop(pe, "draw_particles", text="Particles") + col.prop(pe, "fade_time") + sub = col.row() + sub.active = pe.fade_time + sub.prop(pe, "fade_frames", slider=True) classes = [ @@ -1010,9 +1373,11 @@ classes = [ VIEW3D_PT_tools_posemode_options, VIEW3D_PT_tools_brush, VIEW3D_PT_tools_brush_texture, - VIEW3D_PT_tools_brush_tool, VIEW3D_PT_tools_brush_stroke, VIEW3D_PT_tools_brush_curve, + VIEW3D_PT_tools_brush_appearance, + VIEW3D_PT_tools_brush_tool, + VIEW3D_PT_sculpt_symmetry, VIEW3D_PT_sculpt_options, VIEW3D_PT_tools_vertexpaint, VIEW3D_PT_tools_weightpaint_options, |