From 756488fbe2c0beaf205cb28d6f4ca1e62a64588a Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 25 Jul 2009 22:31:02 +0000 Subject: [PATCH] 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. --- release/ui/buttons_texture.py | 70 ++-- release/ui/space_view3d_toolbar.py | 202 +++++----- source/blender/blenkernel/intern/image.c | 51 +-- source/blender/blenlib/BLI_arithb.h | 3 + source/blender/blenlib/intern/arithb.c | 14 +- source/blender/editors/physics/editparticle.c | 23 +- .../blender/editors/screen/screen_context.c | 21 +- .../editors/space_buttons/buttons_context.c | 79 +++- .../editors/space_view3d/view3d_toolbar.c | 12 +- source/blender/makesdna/DNA_brush_types.h | 1 + source/blender/makesdna/DNA_scene_types.h | 5 +- source/blender/makesdna/DNA_space_types.h | 1 + source/blender/makesrna/RNA_access.h | 4 +- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_brush.c | 2 +- source/blender/makesrna/intern/rna_define.c | 2 +- source/blender/makesrna/intern/rna_internal.h | 2 +- source/blender/makesrna/intern/rna_scene.c | 144 +------ .../makesrna/intern/rna_sculpt_paint.c | 363 ++++++++++++++++++ source/blender/makesrna/intern/rna_vpaint.c | 90 ----- 20 files changed, 674 insertions(+), 417 deletions(-) create mode 100644 source/blender/makesrna/intern/rna_sculpt_paint.c delete mode 100644 source/blender/makesrna/intern/rna_vpaint.c 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 not br: + 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': + 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="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="") - + 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" + + def paint_settings(self, context): + ts = context.tool_settings + + if context.sculpt_object: + return ts.sculpt + 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 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) + 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.particle_edit_object: + layout.column().itemR(settings, "tool", expand=True) + else: + layout.split().row().template_ID(settings, "brush") - if context.sculpt_object: - layout.column().itemR(brush, "sculpt_tool", expand=True) + if brush and not context.particle_edit_object: + 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) + 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="") + 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") + 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" +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) + diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 93924d1ea0d..62af05fbc9a 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -456,19 +456,19 @@ static ImBuf *add_ibuf_size(int width, int height, char *name, int floatbuf, sho * easy to tweak like this, speed isn't really that much of an issue in this situation... */ /* checkers */ - for(y=0; yy; y++) { - dark = pow(-1, floor(y / checkerwidth)); + for(y=0; yx; x++) { + for(x=0; x 0) { - rect_float[0] = rect_float[1] = rect_float[2] = 0.25; - rect_float[3] = 1.0; + rect_float[0] = rect_float[1] = rect_float[2] = 0.25f; + rect_float[3] = 1.0f; } else { - rect_float[0] = rect_float[1] = rect_float[2] = 0.58; - rect_float[3] = 1.0; + rect_float[0] = rect_float[1] = rect_float[2] = 0.58f; + rect_float[3] = 1.0f; } rect_float+=4; } @@ -489,11 +489,11 @@ static ImBuf *add_ibuf_size(int width, int height, char *name, int floatbuf, sho if (floatbuf) rect_float= (float*)ibuf->rect_float; else rect= (unsigned char*)ibuf->rect; - for(y=0; yy; y++) { - hoffs = 0.125 * floor(y / checkerwidth); + for(y=0; yx; x++) { - h = 0.125 * floor(x / checkerwidth); + for(x=0; xy; y++) { - for(x=0; xx; x++) { + char ccol[4]; + + ccol[0]= (char)(color[0]*255.0f); + ccol[1]= (char)(color[1]*255.0f); + ccol[2]= (char)(color[2]*255.0f); + ccol[3]= (char)(color[3]*255.0f); + + for(y=0; y1.0e-35F) { + if(d>1.0e-35f) { d= (float)sqrt(d); n[0]/=d; n[1]/=d; n[2]/=d; } else { - n[0]=n[1]=n[2]= 0.0; - d= 0.0; + n[0]=n[1]=n[2]= 0.0f; + d= 0.0f; } return d; } @@ -3334,7 +3334,7 @@ float Normalize2(float *n) d= n[0]*n[0]+n[1]*n[1]; - if(d>1.0e-35F) { + if(d>1.0e-35f) { d= (float)sqrt(d); n[0]/=d; n[1]/=d; @@ -3352,15 +3352,15 @@ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b) h *= 360.0f; - if(s==0.0) { + if(s==0.0f) { *r = v; *g = v; *b = v; } else { - if(h==360) h = 0; + if(h== 360.0f) h = 0.0f; - h /= 60; + h /= 60.0f; i = (int)floor(h); f = h - i; p = v*(1.0f-s); diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c index f414297dab4..20033c747f9 100644 --- a/source/blender/editors/physics/editparticle.c +++ b/source/blender/editors/physics/editparticle.c @@ -271,6 +271,7 @@ typedef struct PEData { float smoothfac; float weightfac; float growfac; + int totrekey; int invert; int tot; @@ -1748,7 +1749,6 @@ static void rekey_particle(PEData *data, int pa_index) ParticleSystem *psys= data->psys; ParticleData *pa= &psys->particles[pa_index]; ParticleEdit *edit= psys->edit; - ParticleEditSettings *pset= PE_settings(data->scene); ParticleKey state; HairKey *key, *new_keys; ParticleEditKey *ekey; @@ -1757,19 +1757,19 @@ static void rekey_particle(PEData *data, int pa_index) pa->flag |= PARS_REKEY; - key= new_keys= MEM_callocN(pset->totrekey * sizeof(HairKey),"Hair re-key keys"); + key= new_keys= MEM_callocN(data->totrekey * sizeof(HairKey),"Hair re-key keys"); /* root and tip stay the same */ VECCOPY(key->co, pa->hair->co); - VECCOPY((key + pset->totrekey - 1)->co, (pa->hair + pa->totkey - 1)->co); + VECCOPY((key + data->totrekey - 1)->co, (pa->hair + pa->totkey - 1)->co); sta= key->time= pa->hair->time; - end= (key + pset->totrekey - 1)->time= (pa->hair + pa->totkey - 1)->time; - dval= (end - sta) / (float)(pset->totrekey - 1); + end= (key + data->totrekey - 1)->time= (pa->hair + pa->totkey - 1)->time; + dval= (end - sta) / (float)(data->totrekey - 1); /* interpolate new keys from old ones */ - for(k=1,key++; ktotrekey-1; k++,key++) { - state.time= (float)k / (float)(pset->totrekey-1); + for(k=1,key++; ktotrekey-1; k++,key++) { + state.time= (float)k / (float)(data->totrekey-1); psys_get_particle_on_path(data->scene, data->ob, psys, pa_index, &state, 0); VECCOPY(key->co, state.co); key->time= sta + k * dval; @@ -1780,7 +1780,7 @@ static void rekey_particle(PEData *data, int pa_index) MEM_freeN(pa->hair); pa->hair= new_keys; - pa->totkey=pset->totrekey; + pa->totkey=data->totrekey; if(edit->keys[pa_index]) MEM_freeN(edit->keys[pa_index]); @@ -1798,14 +1798,11 @@ static void rekey_particle(PEData *data, int pa_index) static int rekey_exec(bContext *C, wmOperator *op) { PEData data; - ParticleEditSettings *pset; PE_set_data(C, &data); - pset= PE_settings(data.scene); - pset->totrekey= RNA_int_get(op->ptr, "keys"); - - data.dval= 1.0f / (float)(pset->totrekey-1); + data.dval= 1.0f / (float)(data.totrekey-1); + data.totrekey= RNA_int_get(op->ptr, "keys"); foreach_selected_particle(&data, rekey_particle); diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 2dc2cf9f293..3842dd3d62f 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -50,7 +50,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult "scene", "selected_objects", "selected_bases", "selected_editable_objects", "selected_editable_bases" "active_base", "active_object", "edit_object", - "sculpt_object", "vpaint_object", "wpaint_object", NULL}; + "sculpt_object", "vertex_paint_object", "weight_paint_object", + "texture_paint_object", "brush", "particle_edit_object", NULL}; CTX_data_dir_set(result, dir); return 1; @@ -116,19 +117,31 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult return 1; } - else if(CTX_data_equals(member, "vpaint_object")) { + else if(CTX_data_equals(member, "vertex_paint_object")) { if(G.f & G_VERTEXPAINT && scene->basact) CTX_data_id_pointer_set(result, &scene->basact->object->id); return 1; } - else if(CTX_data_equals(member, "wpaint_object")) { + else if(CTX_data_equals(member, "weight_paint_object")) { if(G.f & G_WEIGHTPAINT && scene->basact) CTX_data_id_pointer_set(result, &scene->basact->object->id); return 1; } - + else if(CTX_data_equals(member, "texture_paint_object")) { + if(G.f & G_TEXTUREPAINT && scene->basact) + CTX_data_id_pointer_set(result, &scene->basact->object->id); + + return 1; + } + else if(CTX_data_equals(member, "particle_edit_object")) { + if(G.f & G_PARTICLEEDIT && scene->basact) + CTX_data_id_pointer_set(result, &scene->basact->object->id); + + return 1; + } + return 0; } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 3a3f5bd83ee..1bc663a789b 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -31,6 +31,7 @@ #include "MEM_guardedalloc.h" #include "DNA_armature_types.h" +#include "DNA_brush_types.h" #include "DNA_lamp_types.h" #include "DNA_material_types.h" #include "DNA_modifier_types.h" @@ -45,6 +46,7 @@ #include "BLI_listbase.h" #include "BKE_context.h" +#include "BKE_global.h" #include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_particle.h" @@ -65,7 +67,7 @@ typedef struct ButsContextPath { PointerRNA ptr[8]; int len; - int worldtex; + int flag; } ButsContextPath; static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type) @@ -302,10 +304,48 @@ static int buttons_context_path_particle(ButsContextPath *path) return 0; } +static int buttons_context_path_brush(ButsContextPath *path) +{ + Scene *scene; + ToolSettings *ts; + Brush *br= NULL; + PointerRNA *ptr= &path->ptr[path->len-1]; + + /* if we already have a (pinned) brush, we're done */ + if(RNA_struct_is_a(ptr->type, &RNA_Brush)) { + return 1; + } + /* if we have a scene, use the toolsettings brushes */ + else if(buttons_context_path_scene(path)) { + scene= path->ptr[path->len-1].data; + ts= scene->toolsettings; + + if(G.f & G_SCULPTMODE) + br= ts->sculpt->brush; + else if(G.f & G_VERTEXPAINT) + br= ts->vpaint->brush; + else if(G.f & G_WEIGHTPAINT) + br= ts->wpaint->brush; + else if(G.f & G_TEXTUREPAINT) + br= ts->imapaint.brush; + + if(br) { + RNA_id_pointer_create(&br->id, &path->ptr[path->len]); + path->len++; + + return 1; + } + } + + /* no path to a world possible */ + return 0; +} + static int buttons_context_path_texture(ButsContextPath *path) { Material *ma; Lamp *la; + Brush *br; World *wo; MTex *mtex; Tex *tex; @@ -315,8 +355,21 @@ static int buttons_context_path_texture(ButsContextPath *path) if(RNA_struct_is_a(ptr->type, &RNA_Texture)) { return 1; } + /* try brush */ + else if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) { + br= path->ptr[path->len-1].data; + + if(br) { + mtex= br->mtex[(int)br->texact]; + tex= (mtex)? mtex->tex: NULL; + + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } + } /* try world */ - else if(path->worldtex && buttons_context_path_world(path)) { + else if((path->flag & SB_WORLD_TEX) && buttons_context_path_world(path)) { wo= path->ptr[path->len-1].data; if(wo) { @@ -354,21 +407,21 @@ static int buttons_context_path_texture(ButsContextPath *path) return 1; } } - /* TODO: material nodes, brush */ + /* TODO: material nodes */ - /* no path to a particle system possible */ + /* no path to a texture possible */ return 0; } -static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int worldtex) +static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag) { SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); ID *id; int found; memset(path, 0, sizeof(*path)); - path->worldtex= worldtex; + path->flag= flag; /* if some ID datablock is pinned, set the root pointer */ if(sbuts->pinid) { @@ -431,18 +484,18 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) { ButsContextPath *path; PointerRNA *ptr; - int a, worldtex, flag= 0; + int a, pflag, flag= 0; if(!sbuts->path) sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath"); path= sbuts->path; - worldtex= (sbuts->flag & SB_WORLD_TEX); + pflag= (sbuts->flag & (SB_WORLD_TEX|SB_BRUSH_TEX)); /* for each context, see if we can compute a valid path to it, if * this is the case, we know we have to display the button */ for(a=0; amainb, worldtex); + buttons_context_path(C, path, sbuts->mainb, pflag); if(!(flag & (1 << sbuts->mainb))) { if(flag & (1 << BCONTEXT_OBJECT)) @@ -505,7 +558,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r "world", "object", "mesh", "armature", "lattice", "curve", "meta_ball", "lamp", "camera", "material", "material_slot", "texture", "texture_slot", "bone", "edit_bone", "particle_system", - "cloth", "soft_body", "fluid", "collision", NULL}; + "cloth", "soft_body", "fluid", "collision", "brush", NULL}; CTX_data_dir_set(result, dir); return 1; @@ -648,6 +701,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } } + else if(CTX_data_equals(member, "brush")) { + set_pointer_type(path, result, &RNA_Brush); + return 1; + } return 0; } diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 89a6d659d67..1564fcb169b 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -175,12 +175,12 @@ char *view3d_context_string(const bContext *C) else { Object *ob = CTX_data_active_object(C); - if(ob && (ob->flag & OB_POSEMODE)) return "posemode"; - else if (G.f & G_SCULPTMODE) return "sculptmode"; - else if (G.f & G_WEIGHTPAINT) return "weightpaint"; - else if (G.f & G_VERTEXPAINT) return "vertexpaint"; - else if (G.f & G_TEXTUREPAINT) return "texturepaint"; - else if(G.f & G_PARTICLEEDIT) return "particlemode"; + if(ob && (ob->flag & OB_POSEMODE)) return "pose_mode"; + else if (G.f & G_SCULPTMODE) return "sculpt_mode"; + else if (G.f & G_WEIGHTPAINT) return "weight_paint"; + else if (G.f & G_VERTEXPAINT) return "vertex_paint"; + else if (G.f & G_TEXTUREPAINT) return "texture_paint"; + else if(G.f & G_PARTICLEEDIT) return "particle_mode"; } return "objectmode"; diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 93a974c1180..f88d3b68ebf 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -111,6 +111,7 @@ typedef struct Brush { #define SCULPT_TOOL_FLATTEN 7 #define SCULPT_TOOL_CLAY 8 +/* ImagePaintSettings.tool */ #define PAINT_TOOL_DRAW 0 #define PAINT_TOOL_SOFTEN 1 #define PAINT_TOOL_SMEAR 2 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index c8d0fc9ff5e..28da3ba1316 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -434,7 +434,7 @@ typedef struct ImagePaintSettings { short flag, tool; /* for projection painting only */ - short seam_bleed,normal_angle; + short seam_bleed, normal_angle; void *paintcursor; /* wm handle */ } ImagePaintSettings; @@ -960,11 +960,10 @@ typedef enum SculptFlags { SCULPT_LOCK_Z = 256 } SculptFlags; -/* toolsettings->imagepaint_flag */ +/* ImagePaintSettings.flag */ #define IMAGEPAINT_DRAWING 1 #define IMAGEPAINT_DRAW_TOOL 2 #define IMAGEPAINT_DRAW_TOOL_DRAWING 4 - /* projection painting only */ #define IMAGEPAINT_PROJECT_DISABLE 8 /* Non projection 3D painting */ #define IMAGEPAINT_PROJECT_XRAY 16 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 3db97112090..007ea6ef51f 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -577,6 +577,7 @@ typedef struct SpaceConsole { #define SB_PRV_OSA 1 #define SB_PIN_CONTEXT 2 #define SB_WORLD_TEX 4 +#define SB_BRUSH_TEX 8 /* sbuts->align */ #define BUT_FREE 0 diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index d4532e78239..64a4887701b 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -221,7 +221,7 @@ extern StructRNA RNA_ID; extern StructRNA RNA_IDProperty; extern StructRNA RNA_IDPropertyGroup; extern StructRNA RNA_Image; -extern StructRNA RNA_ImagePaintSettings; +extern StructRNA RNA_ImagePaint; extern StructRNA RNA_ImageSequence; extern StructRNA RNA_ImageTexture; extern StructRNA RNA_ImageUser; @@ -478,7 +478,7 @@ extern StructRNA RNA_UserPreferencesLanguage; extern StructRNA RNA_UserPreferencesSystem; extern StructRNA RNA_UserPreferencesView; extern StructRNA RNA_UserSolidLight; -extern StructRNA RNA_VPaint; +extern StructRNA RNA_VertexPaint; extern StructRNA RNA_VectorFont; extern StructRNA RNA_VertexGroup; extern StructRNA RNA_VertexGroupElement; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 40bcb4dabbb..0b7fa0e4634 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1938,6 +1938,7 @@ RNAProcessItem PROCESS_ITEMS[]= { {"rna_render.c", NULL, RNA_def_render}, {"rna_scene.c", NULL, RNA_def_scene}, {"rna_screen.c", NULL, RNA_def_screen}, + {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, {"rna_sensor.c", NULL, RNA_def_sensor}, {"rna_sequence.c", NULL, RNA_def_sequence}, {"rna_space.c", NULL, RNA_def_space}, @@ -1947,7 +1948,6 @@ RNAProcessItem PROCESS_ITEMS[]= { {"rna_ui.c", "rna_ui_api.c", RNA_def_ui}, {"rna_userdef.c", NULL, RNA_def_userdef}, {"rna_vfont.c", NULL, RNA_def_vfont}, - {"rna_vpaint.c", NULL, RNA_def_vpaint}, {"rna_wm.c", "rna_wm_api.c", RNA_def_wm}, {"rna_world.c", NULL, RNA_def_world}, {NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 8089d2e8b38..e064fd7f935 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -179,7 +179,7 @@ void rna_def_brush(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TORUS); RNA_def_property_ui_text(prop, "Wrap", "Enable torus wrapping while painting."); - prop= RNA_def_property(srna, "alpha_pressure", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "opacity_pressure", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE); RNA_def_property_ui_text(prop, "Opacity Pressure", "Enable tablet pressure sensitivity for opacity."); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index d5d21ddb053..42c6f74b6ec 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -723,7 +723,7 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct break; if(!srnafrom) { - fprintf(stderr, "RNA_def_struct_nested: struct %s not found.\n", structname); + fprintf(stderr, "RNA_def_struct_nested: struct %s not found for %s.\n", structname, srna->identifier); DefRNA.error= 1; } diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index a1d32d5be78..ed0395ede23 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -151,6 +151,7 @@ void RNA_def_render(struct BlenderRNA *brna); void RNA_def_rna(struct BlenderRNA *brna); void RNA_def_scene(struct BlenderRNA *brna); void RNA_def_screen(struct BlenderRNA *brna); +void RNA_def_sculpt_paint(struct BlenderRNA *brna); void RNA_def_sensor(struct BlenderRNA *brna); void RNA_def_sequence(struct BlenderRNA *brna); void RNA_def_space(struct BlenderRNA *brna); @@ -161,7 +162,6 @@ void RNA_def_sound(struct BlenderRNA *brna); void RNA_def_ui(struct BlenderRNA *brna); void RNA_def_userdef(struct BlenderRNA *brna); void RNA_def_vfont(struct BlenderRNA *brna); -void RNA_def_vpaint(struct BlenderRNA *brna); void RNA_def_wm(struct BlenderRNA *brna); void RNA_def_world(struct BlenderRNA *brna); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1d712fbd88d..22f6bff2cc4 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -323,128 +323,6 @@ static void rna_SceneRenderLayer_pass_update(bContext *C, PointerRNA *ptr) #else -static void rna_def_tpaint(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - static EnumPropertyItem texture_paint_items[] = { - {PAINT_TOOL_DRAW, "DRAW", 0, "Draw", "Draw brush"}, - {PAINT_TOOL_SOFTEN, "SOFTEN", 0, "Soften", "Soften brush"}, - {PAINT_TOOL_SMEAR, "SMEAR", 0, "Smear", "Smear brush"}, - {0, NULL, 0, NULL, NULL}}; - - static EnumPropertyItem projection_paint_items[] = { - {PAINT_TOOL_DRAW, "DRAW", 0, "Draw", "Draw brush"}, - {PAINT_TOOL_SMEAR, "SMEAR", 0, "Smear", "Smear brush"}, - {PAINT_TOOL_CLONE, "CLONE", 0, "Clone", "Clone brush, use RMB to drag source image"}, - {0, NULL, 0, NULL, NULL}}; - - srna= RNA_def_struct(brna, "ImagePaintSettings", NULL); - RNA_def_struct_nested(brna, srna, "Scene"); - RNA_def_struct_ui_text(srna, "Texture Painting", ""); - - prop= RNA_def_property(srna, "texture_paint_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "tool"); - RNA_def_property_enum_items(prop, texture_paint_items); - RNA_def_property_ui_text(prop, "Paint Mode", ""); - - /********** Projection Painting **********/ - - prop= RNA_def_property(srna, "projection_paint_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "tool"); - RNA_def_property_enum_items(prop, projection_paint_items); - RNA_def_property_ui_text(prop, "Paint Mode", ""); - - /* Boolean */ - - prop= RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE); - RNA_def_property_ui_text(prop, "Project Paint", "Use projection painting for improved consistency in the brush strokes"); - - prop= RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY); - RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)"); - - prop= RNA_def_property(srna, "use_cull", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE); - RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)"); - - prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT); - RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view"); - - prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_MASK); - RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV layer buttons"); - - prop= RNA_def_property(srna, "invert_mask", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_MASK_INV); - RNA_def_property_ui_text(prop, "Invert", "Invert the mask"); - - prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); - RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); - - /* Integer */ - - prop= RNA_def_property(srna, "normal_angle", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "normal_angle"); - RNA_def_property_range(prop, 10, 90); - RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view acording to this angle"); - - prop= RNA_def_property(srna, "bleed", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "seam_bleed"); - RNA_def_property_range(prop, 0, 8); - RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)"); -} - -static void rna_def_sculpt(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna= RNA_def_struct(brna, "Sculpt", NULL); - RNA_def_struct_nested(brna, srna, "Scene"); - RNA_def_struct_ui_text(srna, "Sculpt", ""); - - prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Brush"); - RNA_def_property_ui_text(prop, "Brush", ""); - - prop= RNA_def_property(srna, "symmetry_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X); - RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis."); - - prop= RNA_def_property(srna, "symmetry_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y); - RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis."); - - prop= RNA_def_property(srna, "symmetry_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z); - RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis."); - - prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X); - RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices."); - - prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y); - RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices."); - - prop= RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z); - RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices."); - - prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DRAW_BRUSH); - RNA_def_property_ui_text(prop, "Show Brush", ""); - - prop= RNA_def_property(srna, "partial_redraw", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DRAW_FAST); - RNA_def_property_ui_text(prop, "Partial Redraw", "Optimize sculpting by only refreshing modified faces."); -} - static void rna_def_tool_settings(BlenderRNA *brna) { StructRNA *srna; @@ -484,14 +362,22 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Sculpt"); RNA_def_property_ui_text(prop, "Sculpt", ""); - prop= RNA_def_property(srna, "vpaint", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "VPaint"); + prop= RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "vpaint"); RNA_def_property_ui_text(prop, "Vertex Paint", ""); - prop= RNA_def_property(srna, "wpaint", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "VPaint"); + prop= RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "wpaint"); RNA_def_property_ui_text(prop, "Weight Paint", ""); + prop= RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "imapaint"); + RNA_def_property_ui_text(prop, "Image Paint", ""); + + prop= RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "particle"); + RNA_def_property_ui_text(prop, "Particle Edit", ""); + /* Transform */ prop= RNA_def_property(srna, "proportional_editing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "proportional", 0); @@ -555,12 +441,6 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "vgroup_weight"); RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups."); - - /* Sculpt */ - rna_def_sculpt(brna); - - /* Texture Paint */ - rna_def_tpaint(brna); } void rna_def_render_layer_common(StructRNA *srna, int scene) diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c new file mode 100644 index 00000000000..df40663fa02 --- /dev/null +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -0,0 +1,363 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "DNA_scene_types.h" + +#ifdef RNA_RUNTIME + +static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr) +{ + ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data; + ParticleBrushData *brush= NULL;; + + if(pset->brushtype != PE_BRUSH_NONE) + brush= &pset->brush[pset->brushtype]; + + return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush); +} + +static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr) +{ + return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL); +} + +#else + +static void rna_def_sculpt(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "Sculpt", NULL); + RNA_def_struct_ui_text(srna, "Sculpt", ""); + + prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Brush"); + RNA_def_property_ui_text(prop, "Brush", ""); + + prop= RNA_def_property(srna, "symmetry_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X); + RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis."); + + prop= RNA_def_property(srna, "symmetry_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y); + RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis."); + + prop= RNA_def_property(srna, "symmetry_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z); + RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis."); + + prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X); + RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices."); + + prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y); + RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices."); + + prop= RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z); + RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices."); + + prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DRAW_BRUSH); + RNA_def_property_ui_text(prop, "Show Brush", ""); + + prop= RNA_def_property(srna, "partial_redraw", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DRAW_FAST); + RNA_def_property_ui_text(prop, "Partial Redraw", "Optimize sculpting by only refreshing modified faces."); +} + +static void rna_def_vertex_paint(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + static EnumPropertyItem prop_mode_items[] = { + {0, "MIX", 0, "Mix", "Use mix blending mode while painting."}, + {1, "ADD", 0, "Add", "Use add blending mode while painting."}, + {2, "SUB", 0, "Subtract", "Use subtract blending mode while painting."}, + {3, "MUL", 0, "Multiply", "Use multiply blending mode while painting."}, + {4, "BLUR", 0, "Blur", "Blur the color with surrounding values"}, + {5, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting."}, + {6, "DARKEN", 0, "Darken", "Use darken blending mode while painting."}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "VertexPaint", NULL); + RNA_def_struct_sdna(srna, "VPaint"); + RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode."); + + prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Brush"); + RNA_def_property_ui_text(prop, "Brush", ""); + + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_mode_items); + RNA_def_property_ui_text(prop, "Brush Mode", "Mode in which color is painted."); + + prop= RNA_def_property(srna, "all_faces", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA); + RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush."); + + prop= RNA_def_property(srna, "vertex_dist", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SOFT); + RNA_def_property_ui_text(prop, "Vertex Dist", "Use distances to vertices (instead of paint entire faces)."); + + prop= RNA_def_property(srna, "normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS); + RNA_def_property_ui_text(prop, "Normals", "Applies the vertex normal before painting."); + + prop= RNA_def_property(srna, "spray", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY); + RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse."); + + prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.1f, 5.0f); + RNA_def_property_ui_text(prop, "Gamma", "Vertex paint Gamma."); + + prop= RNA_def_property(srna, "mul", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.1f, 50.0f); + RNA_def_property_ui_text(prop, "Mul", "Vertex paint Mul."); +} + +static void rna_def_image_paint(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem tool_items[] = { + {PAINT_TOOL_DRAW, "DRAW", 0, "Draw", ""}, + {PAINT_TOOL_SOFTEN, "SOFTEN", 0, "Soften", ""}, + {PAINT_TOOL_SMEAR, "SMEAR", 0, "Smear", ""}, + {PAINT_TOOL_CLONE, "CLONE", 0, "Clone", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "ImagePaint", NULL); + RNA_def_struct_sdna(srna, "ImagePaintSettings"); + RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode."); + + prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Brush"); + RNA_def_property_ui_text(prop, "Brush", ""); + + prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, tool_items); + RNA_def_property_ui_text(prop, "Tool", ""); + + /* booleans */ + + prop= RNA_def_property(srna, "show_brush_draw", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_DRAW_TOOL); + RNA_def_property_ui_text(prop, "Show Brush Draw", "Enables brush shape while drawing."); + + prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_DRAW_TOOL_DRAWING); + RNA_def_property_ui_text(prop, "Show Brush", "Enables brush shape while not drawing."); + + prop= RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE); + RNA_def_property_ui_text(prop, "Project Paint", "Use projection painting for improved consistency in the brush strokes."); + + prop= RNA_def_property(srna, "occlude", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY); + RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)"); + + prop= RNA_def_property(srna, "cull", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE); + RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)"); + + prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT); + RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view"); + + prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_MASK); + RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV layer buttons"); + + prop= RNA_def_property(srna, "invert_mask", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_MASK_INV); + RNA_def_property_ui_text(prop, "Invert", "Invert the mask"); + + prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); + RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); + + /* integers */ + + prop= RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_UNSIGNED); + RNA_def_property_ui_range(prop, 0, 8, 0, 0); + RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)."); + + prop= RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED); + RNA_def_property_range(prop, 0, 90); + RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view acording to this angle."); +} + +static void rna_def_particle_edit(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem tool_items[] = { + {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush."}, + {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs."}, + {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs."}, + {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Assign weight to hairs."}, + {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs."}, + {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter."}, + {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up."}, + {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs."}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem select_mode_items[] = { + {SCE_SELECT_PATH, "PATH", ICON_EDGESEL, "Path", ""}, // XXX icon + {SCE_SELECT_POINT, "POINT", ICON_VERTEXSEL, "Point", ""}, // XXX icon + {SCE_SELECT_END, "END", ICON_FACESEL, "End", "E"}, // XXX icon + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem puff_mode[] = { + {0, "ADD", 0, "Add", "Make hairs more puffy."}, + {1, "SUB", 0, "Sub", "Make hairs less puffy."}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem length_mode[] = { + {0, "GROW", 0, "Grow", "Make hairs longer."}, + {1, "SHRINK", 0, "Shrink", "Make hairs shorter."}, + {0, NULL, 0, NULL, NULL}}; + + /* edit */ + + srna= RNA_def_struct(brna, "ParticleEdit", NULL); + RNA_def_struct_sdna(srna, "ParticleEditSettings"); + RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode."); + + prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "brushtype"); + RNA_def_property_enum_items(prop, tool_items); + RNA_def_property_ui_text(prop, "Tool", ""); + + prop= RNA_def_property(srna, "selection_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode"); + RNA_def_property_enum_items(prop, select_mode_items); + RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode."); + + prop= RNA_def_property(srna, "keep_lengths", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS); + RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant."); + + prop= RNA_def_property(srna, "keep_root", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST); + RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified."); + + prop= RNA_def_property(srna, "emitter_deflect", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER); + RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter."); + + prop= RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "emitterdist"); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3); + RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter."); + + prop= RNA_def_property(srna, "show_time", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_SHOW_TIME); + RNA_def_property_ui_text(prop, "Show Time", "Show time values of the baked keys."); + + prop= RNA_def_property(srna, "show_children", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_SHOW_CHILD); + RNA_def_property_ui_text(prop, "Show Children", "Show child particles."); + + prop= RNA_def_property(srna, "mirror_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_X_MIRROR); + RNA_def_property_ui_text(prop, "X-Axis Mirror", "Mirror operations over the X axis while editing."); + + prop= RNA_def_property(srna, "add_interpolate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED); + RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones."); + + prop= RNA_def_property(srna, "add_keys", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "totaddkey"); + RNA_def_property_range(prop, 2, INT_MAX); + RNA_def_property_ui_range(prop, 2, 20, 10, 3); + RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with."); + + prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ParticleBrush"); + RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Brush", ""); + + /* brush */ + + srna= RNA_def_struct(brna, "ParticleBrush", NULL); + RNA_def_struct_sdna(srna, "ParticleBrushData"); + RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush."); + + prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_ui_range(prop, 1, 100, 10, 3); + RNA_def_property_ui_text(prop, "Size", "Brush size."); + + prop= RNA_def_property(srna, "strength", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_ui_range(prop, 1, 100, 10, 3); + RNA_def_property_ui_text(prop, "Strength", "Brush strength."); + + prop= RNA_def_property(srna, "steps", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "step"); + RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_ui_range(prop, 1, 50, 10, 3); + RNA_def_property_ui_text(prop, "Steps", "Brush steps."); + + prop= RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "invert"); + RNA_def_property_enum_items(prop, puff_mode); + RNA_def_property_ui_text(prop, "Puff Mode", ""); + + prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "invert"); + RNA_def_property_enum_items(prop, length_mode); + RNA_def_property_ui_text(prop, "Length Mode", ""); + + /* dummy */ + prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "CurveMapping"); + RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Curve", ""); +} + +void RNA_def_sculpt_paint(BlenderRNA *brna) +{ + rna_def_sculpt(brna); + rna_def_vertex_paint(brna); + rna_def_image_paint(brna); + rna_def_particle_edit(brna); +} + +#endif + diff --git a/source/blender/makesrna/intern/rna_vpaint.c b/source/blender/makesrna/intern/rna_vpaint.c deleted file mode 100644 index bf6b70dab23..00000000000 --- a/source/blender/makesrna/intern/rna_vpaint.c +++ /dev/null @@ -1,90 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Contributor(s): Campbell Barton - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include - -#include "RNA_define.h" -#include "RNA_types.h" - -#include "rna_internal.h" - -#include "DNA_scene_types.h" - -#ifdef RNA_RUNTIME - -#else - -void RNA_def_vpaint(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - static EnumPropertyItem prop_mode_items[] = { - {0, "MIX", 0, "Mix", "Use mix blending mode while painting."}, - {1, "ADD", 0, "Add", "Use add blending mode while painting."}, - {2, "SUB", 0, "Subtract", "Use subtract blending mode while painting."}, - {3, "MUL", 0, "Multiply", "Use multiply blending mode while painting."}, - {4, "BLUR", 0, "Blur", "Blur the color with surrounding values"}, - {5, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting."}, - {6, "DARKEN", 0, "Darken", "Use darken blending mode while painting."}, - {0, NULL, 0, NULL, NULL}}; - - srna= RNA_def_struct(brna, "VPaint", NULL); - RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of the Vpaint tool."); - - prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Brush"); - RNA_def_property_ui_text(prop, "Brush", ""); - - prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_mode_items); - RNA_def_property_ui_text(prop, "Brush Mode", "The Mode in which color is painted."); - - prop= RNA_def_property(srna, "all_faces", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA); - RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush."); - - prop= RNA_def_property(srna, "vertex_dist", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SOFT); - RNA_def_property_ui_text(prop, "Vertex Dist", "Use distances to vertices (instead of paint entire faces)."); - - prop= RNA_def_property(srna, "normals", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS); - RNA_def_property_ui_text(prop, "Normals", "Applies the vertex normal before painting."); - - prop= RNA_def_property(srna, "spray", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY); - RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse."); - - prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.1f, 5.0f); - RNA_def_property_ui_text(prop, "Gamma", "Vpaint Gamma."); - - prop= RNA_def_property(srna, "mul", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.1f, 50.0f); - RNA_def_property_ui_text(prop, "Mul", "Vpaint Mul."); - -} - -#endif -