diff options
Diffstat (limited to 'release/scripts/ui/space_view3d_toolbar.py')
-rw-r--r-- | release/scripts/ui/space_view3d_toolbar.py | 150 |
1 files changed, 134 insertions, 16 deletions
diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index a6f3f7e34c2..ec6f8ed1f3f 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -475,7 +475,7 @@ class PaintPanel(): if context.sculpt_object: return ts.sculpt - elif context.vertex_paint_object: + elif context.vertex_paint_object and (not context.vertex_paint_object.data.ptex_edit_mode): return ts.vertex_paint elif context.weight_paint_object: return ts.weight_paint @@ -487,6 +487,39 @@ class PaintPanel(): return None +class VIEW3D_PT_tools_masking(PaintPanel, bpy.types.Panel): + bl_label = "Masking" + bl_default_closed = False + + @classmethod + def poll(cls, context): + return cls.paint_settings(context) and (context.sculpt_object or context.vertex_paint_object) + + def draw(self, context): + layout = self.layout + + settings = self.paint_settings(context) + mesh = context.object.data + + row = layout.row() + + col = row.column() + col.template_list(mesh, "paint_mask_layers", mesh, "active_paint_mask_index", rows=2) + + col = row.column(align=True) + col.operator("paint.mask_layer_add", icon='ZOOMIN', text="") + col.operator("paint.mask_layer_remove", icon='ZOOMOUT', text="") + + row = layout.row(align=True) + row.active = mesh.active_paint_mask_index != -1 + row.operator("paint.mask_set", text="Clear").mode = 'CLEAR' + row.operator("paint.mask_set", text="Fill").mode = 'FILL' + row.operator("paint.mask_set", text="Invert").mode = 'INVERT' + + if row.active: + layout.prop(mesh.paint_mask_layers[mesh.active_paint_mask_index], "strength", slider=True) + + class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel): bl_label = "Brush" @@ -622,6 +655,8 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel): col.prop(brush, "use_accumulate") + col.prop(brush, "mask") + if brush.sculpt_tool == 'LAYER': col.separator() @@ -695,11 +730,17 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel): row.prop(brush, "strength", text="Strength", slider=True) row.prop(brush, "use_pressure_strength", toggle=True, text="") + if brush.vertexpaint_tool == 'ALPHA': + row = col.row(align=True) + row.prop(brush, "direction", expand=True) + # 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, "mask") + class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel): bl_label = "Texture" @@ -709,6 +750,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel): def poll(cls, context): settings = cls.paint_settings(context) return (settings and settings.brush and (context.sculpt_object or + context.vertex_paint_object or context.texture_paint_object)) def draw(self, context): @@ -722,7 +764,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel): col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8) - if context.sculpt_object: + if context.sculpt_object or context.vertex_paint_object: #XXX duplicated from properties_texture.py col.separator() @@ -854,7 +896,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel): col = layout.column() - if context.sculpt_object: + if context.sculpt_object or context.vertex_paint_object: col.label(text="Stroke Method:") col.prop(brush, "stroke_method", text="") @@ -944,7 +986,6 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel): layout = self.layout settings = self.paint_settings(context) - brush = settings.brush layout.template_curve_mapping(brush, "curve", brush=True) @@ -994,20 +1035,23 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel): row.prop(sculpt, "lock_y", text="Y", toggle=True) row.prop(sculpt, "lock_z", text="Z", toggle=True) - -class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel): +class VIEW3D_PT_tools_paint_symmetry(PaintPanel, bpy.types.Panel): bl_label = "Symmetry" bl_options = {'DEFAULT_CLOSED'} @classmethod def poll(cls, context): - return (context.sculpt_object and context.tool_settings.sculpt) + return cls.paint_settings(context) and (context.sculpt_object or context.vertex_paint_object) def draw(self, context): layout = self.layout - sculpt = context.tool_settings.sculpt + if context.sculpt_object: + paint = context.tool_settings.sculpt + elif context.vertex_paint_object: + paint = context.tool_settings.vertex_paint + settings = __class__.paint_settings(context) brush = settings.brush @@ -1016,19 +1060,19 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel): col = split.column() col.label(text="Mirror:") - col.prop(sculpt, "use_symmetry_x", text="X") - col.prop(sculpt, "use_symmetry_y", text="Y") - col.prop(sculpt, "use_symmetry_z", text="Z") + col.prop(paint, "use_symmetry_x", text="X") + col.prop(paint, "use_symmetry_y", text="Y") + col.prop(paint, "use_symmetry_z", text="Z") col = split.column() - col.prop(sculpt, "radial_symmetry", text="Radial") + col.prop(paint, "radial_symmetry", text="Radial") col = layout.column() col.separator() - col.prop(sculpt, "use_symmetry_feather", text="Feather") + col.prop(paint, "use_symmetry_feather", text="Feather") class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): @@ -1037,7 +1081,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): @classmethod def poll(cls, 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) + return cls.paint_settings(context) and ((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 @@ -1122,10 +1166,14 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel): # ********** default tools for vertexpaint **************** -class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel): - bl_context = "vertexpaint" +class VIEW3D_PT_tools_vertexpaint(PaintPanel, bpy.types.Panel): bl_label = "Options" + @classmethod + def poll(cls, context): + settings = cls.paint_settings(context) + return settings and context.vertex_paint_object + def draw(self, context): layout = self.layout @@ -1138,6 +1186,8 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel): col.prop(vpaint, "use_normal") col.prop(vpaint, "use_spray") + col.prop(vpaint, "fast_navigate") + col.label(text="Unified Settings:") col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size") col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength") @@ -1329,6 +1379,74 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel): sub.prop(pe, "fade_frames", slider=True) +class VIEW3D_PT_paint_overlay(PaintPanel, bpy.types.Panel): + bl_label = "Source Image" + bl_default_closed = True + + @classmethod + def poll(cls, context): + settings = cls.paint_settings(context) + return settings and context.vertex_paint_object + + def draw(self, context): + layout = self.layout + + overlay = context.tool_settings.paint_overlay + + layout.prop(overlay, "enabled") + layout.template_ID(overlay, "image", open="image.open") + layout.prop(overlay, "transparency_color") + layout.prop(overlay, "transparency_tolerance") + +class VIEW3D_PT_ptex_edit(View3DPanel, bpy.types.Panel): + bl_label = "Ptex" + bl_default_closed = False + + @classmethod + def poll(cls, context): + ob = context.vertex_paint_object + return ob and ob.data.ptex_edit_mode + + def draw(self, context): + layout = self.layout + + mesh = context.active_object.data + active_ptex = mesh.active_ptex_index + + if active_ptex != -1: + ts = context.tool_settings + + layout.operator("ptex.face_resolution_set", text="Double Selected").operation = 'DOUBLE' + layout.operator("ptex.face_resolution_set", text="Half Selected").operation = 'HALF' + + prop = layout.operator("ptex.face_resolution_set") + prop.operation = 'NUMERIC' + layout.prop(ts, "ptex_u_resolution", text="U") + layout.prop(ts, "ptex_v_resolution", text="V") + + active_face = mesh.faces.active + active_subface = mesh.faces.active_subface + + # display active [sub]face's resolution + if active_face >= 0 and active_subface >= 0: + box = layout.box() + + box.label("Current Resolution:") + + ptex_layer = mesh.ptex_layers[active_ptex] + ptex = ptex_layer.data[active_face] + subface = ptex.subfaces[active_subface] + + ures = subface.resolution[0]; + vres = subface.resolution[1]; + if len(ptex.subfaces) == 4: + ures *= 2 + vres *= 2 + + box.label(str(ures) + " x " + str(vres)) + + + def register(): pass |