Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-26 02:31:02 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-26 02:31:02 +0400
commit756488fbe2c0beaf205cb28d6f4ca1e62a64588a (patch)
tree488e0c746833e1eccea3c2488a2198b9b5aa688e /release
parent5d240af42b0199a7832aa2acbc866283cfab49cb (diff)
2.5: Painting
Various fixes for painting, sculpting and particle edit, still much to be done... * Move RNA paint and sculpt structs into rna_sculpt_paint.c, * Added Particle Edit RNA. * Some tweaks to existing Paint RNA. * Put texture paint and particle edit object in context. * Fix some errors in the brush layout, properly doing None checks, fixing some wrong property identifiers. * Added tool enum for texture paint and particle edit in panels. * Allow editing brush textures in the texture buttons, still with a stupid toggle, ideas for how to make the connection better are welcome.
Diffstat (limited to 'release')
-rw-r--r--release/ui/buttons_texture.py72
-rw-r--r--release/ui/space_view3d_toolbar.py202
2 files changed, 150 insertions, 124 deletions
diff --git a/release/ui/buttons_texture.py b/release/ui/buttons_texture.py
index d86cec17d01..80ae503ee6a 100644
--- a/release/ui/buttons_texture.py
+++ b/release/ui/buttons_texture.py
@@ -19,6 +19,7 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
ma = context.material
la = context.lamp
wo = context.world
+ br = context.brush
if ma:
layout.template_preview(tex, parent=ma)
@@ -26,6 +27,8 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
layout.template_preview(tex, parent=la)
elif wo:
layout.template_preview(tex, parent=wo)
+ elif br:
+ layout.template_preview(tex, parent=br)
else:
layout.template_preview(tex)
@@ -34,7 +37,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
__no_header__ = True
def poll(self, context):
- return (context.material or context.world or context.lamp or context.texture)
+ return (context.material or context.world or context.lamp or context.brush or context.texture)
def draw(self, context):
layout = self.layout
@@ -43,10 +46,11 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
ma = context.material
la = context.lamp
wo = context.world
+ br = context.brush
space = context.space_data
slot = context.texture_slot
- if ma or la or wo:
+ if ma or la or wo or br:
row = layout.row()
if ma:
row.template_list(ma, "textures", ma, "active_texture_index", type="ICONS")
@@ -54,21 +58,28 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
row.template_list(la, "textures", la, "active_texture_index", type="ICONS")
elif wo:
row.template_list(wo, "textures", wo, "active_texture_index", type="ICONS")
+ elif br:
+ row.template_list(br, "textures", br, "active_texture_index", type="ICONS")
split = layout.split(percentage=0.65)
- if ma or la or wo:
+ if ma or la or wo or br:
if slot:
split.template_ID(slot, "texture", new="texture.new")
else:
split.itemS()
-
elif tex:
split.template_ID(space, "pin_id")
+
+ if not space.pin_id and \
+ (context.sculpt_object or context.vertex_paint_object or \
+ context.weight_paint_object or context.texture_paint_object):
+ split.itemR(space, "brush_texture", text="Brush", toggle=True)
+ else:
split.itemS()
-
- layout.itemS()
+ layout.itemS()
+
if tex:
split = layout.split(percentage=0.2)
@@ -89,32 +100,34 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
ma = context.material
la = context.lamp
wo = context.world
+ br = context.brush
tex = context.texture_slot
textype = context.texture
- split = layout.split(percentage=0.3)
- col = split.column()
- col.itemL(text="Coordinates:")
- col = split.column()
- col.itemR(tex, "texture_coordinates", text="")
-
- if tex.texture_coordinates == 'ORCO':
- """
- ob = context.object
- if ob and ob.type == 'MESH':
- split = layout.split(percentage=0.3)
- split.itemL(text="Mesh:")
- split.itemR(ob.data, "texco_mesh", text="")
- """
- elif tex.texture_coordinates == 'UV':
+ if not br:
split = layout.split(percentage=0.3)
- split.itemL(text="Layer:")
- split.itemR(tex, "uv_layer", text="")
- elif tex.texture_coordinates == 'OBJECT':
- split = layout.split(percentage=0.3)
- split.itemL(text="Object:")
- split.itemR(tex, "object", text="")
-
+ col = split.column()
+ col.itemL(text="Coordinates:")
+ col = split.column()
+ col.itemR(tex, "texture_coordinates", text="")
+
+ if tex.texture_coordinates == 'ORCO':
+ """
+ ob = context.object
+ if ob and ob.type == 'MESH':
+ split = layout.split(percentage=0.3)
+ split.itemL(text="Mesh:")
+ split.itemR(ob.data, "texco_mesh", text="")
+ """
+ elif tex.texture_coordinates == 'UV':
+ split = layout.split(percentage=0.3)
+ split.itemL(text="Layer:")
+ split.itemR(tex, "uv_layer", text="")
+ elif tex.texture_coordinates == 'OBJECT':
+ split = layout.split(percentage=0.3)
+ split.itemL(text="Object:")
+ split.itemR(tex, "object", text="")
+
if ma:
split = layout.split(percentage=0.3)
col = split.column()
@@ -147,7 +160,7 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
__label__ = "Influence"
def poll(self, context):
- return (context.texture_slot and context.texture and context.texture.type != 'NONE')
+ return (context.texture_slot and context.texture and context.texture.type != 'NONE' and (not context.brush))
def draw(self, context):
layout = self.layout
@@ -155,6 +168,7 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
ma = context.material
la = context.lamp
wo = context.world
+ br = context.brush
textype = context.texture
tex = context.texture_slot
diff --git a/release/ui/space_view3d_toolbar.py b/release/ui/space_view3d_toolbar.py
index 7889827ee7b..af298e6e27b 100644
--- a/release/ui/space_view3d_toolbar.py
+++ b/release/ui/space_view3d_toolbar.py
@@ -9,7 +9,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "objectmode"
class VIEW3D_PT_tools_objectmode(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_objectmode"
__label__ = "Object Tools"
def draw(self, context):
@@ -49,7 +48,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "editmode_mesh"
class VIEW3D_PT_tools_editmode_mesh(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_editmode_mesh"
__label__ = "Mesh Tools"
def draw(self, context):
@@ -97,7 +95,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "editmode_curve"
class VIEW3D_PT_tools_editmode_curve(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_editmode_curve"
__label__ = "Curve Tools"
def draw(self, context):
@@ -132,7 +129,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "editmode_surface"
class VIEW3D_PT_tools_editmode_surface(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_editmode_surface"
__label__ = "Surface Tools"
def draw(self, context):
@@ -167,7 +163,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "editmode_text"
class VIEW3D_PT_tools_editmode_text(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_editmode_text"
__label__ = "Text Tools"
def draw(self, context):
@@ -189,7 +184,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "editmode_armature"
class VIEW3D_PT_tools_editmode_armature(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_editmode_armature"
__label__ = "Armature Tools"
def draw(self, context):
@@ -220,7 +214,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "editmode_mball"
class VIEW3D_PT_tools_editmode_mball(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_editmode_mball"
__label__ = "Meta Tools"
def draw(self, context):
@@ -241,7 +234,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "editmode_lattice"
class VIEW3D_PT_tools_editmode_lattice(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_editmode_lattice"
__label__ = "Lattice Tools"
def draw(self, context):
@@ -262,7 +254,6 @@ class View3DPanel(bpy.types.Panel):
__context__ = "posemode"
class VIEW3D_PT_tools_posemode(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_posemode"
__label__ = "Pose Tools"
def draw(self, context):
@@ -301,102 +292,104 @@ class VIEW3D_PT_tools_posemode(View3DPanel):
# ********** default tools for paint modes ****************
-class VIEW3D_PT_tools_brush(bpy.types.Panel):
+class PaintPanel(bpy.types.Panel):
__space_type__ = "VIEW_3D"
__region_type__ = "TOOLS"
- __label__ = "Brush"
- def brush_src(self, context):
+ def paint_settings(self, context):
ts = context.tool_settings
+
if context.sculpt_object:
return ts.sculpt
- elif context.vpaint_object:
- return ts.vpaint
- elif context.wpaint_object:
- return ts.wpaint
- elif context.tpaint_object:
- return ts.tpaint
+ elif context.vertex_paint_object:
+ return ts.vertex_paint
+ elif context.weight_paint_object:
+ return ts.weight_paint
+ elif context.texture_paint_object:
+ return ts.image_paint
+ elif context.particle_edit_object:
+ return ts.particle_edit
+
return False
+class VIEW3D_PT_tools_brush(PaintPanel):
+ __label__ = "Brush"
+
def poll(self, context):
- return self.brush_src(context)
+ return self.paint_settings(context)
def draw(self, context):
- src = self.brush_src(context)
- brush = src.brush
+ settings = self.paint_settings(context)
+ brush = settings.brush
layout = self.layout
- layout.split().row().template_ID(src, "brush")
-
- if context.sculpt_object:
- layout.column().itemR(brush, "sculpt_tool", expand=True)
-
- split = layout.split()
-
- col = split.column()
- row = col.row(align=True)
- row.itemR(brush, "size", slider=True)
- row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
-
- if context.wpaint_object:
- col.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
+ if context.particle_edit_object:
+ layout.column().itemR(settings, "tool", expand=True)
+ else:
+ layout.split().row().template_ID(settings, "brush")
+
+ if brush and not context.particle_edit_object:
+ if context.sculpt_object:
+ layout.column().itemR(brush, "sculpt_tool", expand=True)
+
+ elif context.texture_paint_object:
+ col = layout.column(align=True)
+ col.item_enumR(settings, "tool", "DRAW")
+ col.item_enumR(settings, "tool", "SOFTEN")
+ if settings.use_projection:
+ col.item_enumR(settings, "tool", "CLONE")
+ else:
+ col.item_enumR(settings, "tool", "SMEAR")
+
+ split = layout.split()
- col.itemR(brush, "strength", slider=True)
- row = col.row(align=True)
- row.itemR(brush, "falloff", slider=True)
- row.itemR(brush, "falloff_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
-
- if context.vpaint_object:
- col.itemR(brush, "color", text="")
- if context.tpaint_object:
+ col = split.column()
row = col.row(align=True)
- row.itemR(brush, "clone_opacity", slider=True, text=Opacity)
- row.itemR(brush, "opacity_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
-
- row = col.row(align=True)
- row.itemR(brush, "space", text="")
- rowsub = row.row(align=True)
- rowsub.active = brush.space
- rowsub.itemR(brush, "spacing", text="Spacing", slider=True)
- rowsub.itemR(brush, "spacing_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
-
- split = layout.split()
- col = split.column()
- col.itemR(brush, "airbrush")
- col.itemR(brush, "anchored")
- col.itemR(brush, "rake")
-
-class VIEW3D_PT_tools_brush_curve(bpy.types.Panel):
- __space_type__ = "VIEW_3D"
- __region_type__ = "TOOLS"
+ row.itemR(brush, "size", slider=True)
+ row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+ if context.weight_paint_object:
+ col.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
+
+ col.itemR(brush, "strength", slider=True)
+ row = col.row(align=True)
+ row.itemR(brush, "falloff", slider=True)
+ row.itemR(brush, "falloff_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+ if context.vertex_paint_object:
+ col.itemR(brush, "color", text="")
+ if context.texture_paint_object:
+ row = col.row(align=True)
+ row.itemR(brush, "clone_opacity", slider=True, text="Opacity")
+ row.itemR(brush, "opacity_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+
+ row = col.row(align=True)
+ row.itemR(brush, "space", text="")
+ rowsub = row.row(align=True)
+ rowsub.active = brush.space
+ rowsub.itemR(brush, "spacing", text="Spacing", slider=True)
+ rowsub.itemR(brush, "spacing_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+
+ split = layout.split()
+ col = split.column()
+ col.itemR(brush, "airbrush")
+ col.itemR(brush, "anchored")
+ col.itemR(brush, "rake")
+
+class VIEW3D_PT_tools_brush_curve(PaintPanel):
__label__ = "Curve"
- def brush_src(self, context):
- ts = context.tool_settings
- if context.sculpt_object:
- return ts.sculpt
- elif context.vpaint_object:
- return ts.vpaint
- elif context.wpaint_object:
- return ts.wpaint
- elif context.tpaint_object:
- return ts.tpaint
- return False
-
def poll(self, context):
- return self.brush_src(context)
+ settings = self.paint_settings(context)
+ return (settings and settings.brush and settings.brush.curve)
def draw(self, context):
- src = self.brush_src(context)
- brush = src.brush
+ settings = self.paint_settings(context)
+ brush = settings.brush
layout = self.layout
split = layout.split()
split.template_curve_mapping(brush.curve)
-class VIEW3D_PT_sculpt_options(bpy.types.Panel):
- __space_type__ = "VIEW_3D"
- __region_type__ = "TOOLS"
+class VIEW3D_PT_sculpt_options(PaintPanel):
__label__ = "Options"
def poll(self, context):
@@ -429,15 +422,14 @@ class VIEW3D_PT_sculpt_options(bpy.types.Panel):
class View3DPanel(bpy.types.Panel):
__space_type__ = "VIEW_3D"
__region_type__ = "TOOLS"
- __context__ = "weightpaint"
+ __context__ = "weight_paint"
-class VIEW3D_PT_weightpaint_options(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_weightpaint"
+class VIEW3D_PT_weight_paint_options(View3DPanel):
__label__ = "Options"
def draw(self, context):
layout = self.layout
- wpaint = context.tool_settings.wpaint
+ wpaint = context.tool_settings.weight_paint
col = layout.column()
col.itemL(text="Blend:")
@@ -459,15 +451,14 @@ class VIEW3D_PT_weightpaint_options(View3DPanel):
class View3DPanel(bpy.types.Panel):
__space_type__ = "VIEW_3D"
__region_type__ = "TOOLS"
- __context__ = "vertexpaint"
-class VIEW3D_PT_vertexpaint_options(View3DPanel):
- __idname__ = "VIEW3D_PT_vertexpaintoptions"
+class VIEW3D_PT_vertex_paint_options(View3DPanel):
+ __context__ = "vertex_paint"
__label__ = "Options"
def draw(self, context):
layout = self.layout
- vpaint = context.tool_settings.vpaint
+ vpaint = context.tool_settings.vertex_paint
col = layout.column()
col.itemL(text="Blend:")
@@ -488,17 +479,36 @@ class VIEW3D_PT_vertexpaint_options(View3DPanel):
class View3DPanel(bpy.types.Panel):
__space_type__ = "VIEW_3D"
__region_type__ = "TOOLS"
- __context__ = "texturepaint"
+ __context__ = "texture_paint"
-class VIEW3D_PT_tools_texturepaint(View3DPanel):
- __idname__ = "VIEW3D_PT_tools_texturepaint"
- __label__ = "Texture Paint Tools"
+class VIEW3D_PT_tools_texture_paint(View3DPanel):
+ __label__ = "Options"
def draw(self, context):
layout = self.layout
layout.itemL(text="Nothing yet")
+# ********** default tools for particle mode ****************
+
+class View3DPanel(bpy.types.Panel):
+ __space_type__ = "VIEW_3D"
+ __region_type__ = "TOOLS"
+ __context__ = "particle_mode"
+
+class VIEW3D_PT_tools_particle_edit(View3DPanel):
+ __label__ = "Options"
+
+ def draw(self, context):
+ layout = self.layout
+ pe = context.tool_settings.particle_edit
+
+ col = layout.column(align=True)
+
+ col.itemR(pe, "emitter_deflect", text="Deflect")
+ sub = col.row()
+ sub.itemR(pe, "emitter_distance", text="Distance")
+ sub.active = pe.emitter_deflect
bpy.types.register(VIEW3D_PT_tools_objectmode)
bpy.types.register(VIEW3D_PT_tools_editmode_mesh)
@@ -512,6 +522,8 @@ bpy.types.register(VIEW3D_PT_tools_posemode)
bpy.types.register(VIEW3D_PT_tools_brush)
bpy.types.register(VIEW3D_PT_tools_brush_curve)
bpy.types.register(VIEW3D_PT_sculpt_options)
-bpy.types.register(VIEW3D_PT_vertexpaint_options)
-bpy.types.register(VIEW3D_PT_weightpaint_options)
-bpy.types.register(VIEW3D_PT_tools_texturepaint)
+bpy.types.register(VIEW3D_PT_vertex_paint_options)
+bpy.types.register(VIEW3D_PT_weight_paint_options)
+bpy.types.register(VIEW3D_PT_tools_texture_paint)
+bpy.types.register(VIEW3D_PT_tools_particle_edit)
+