[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39360] branches/soc-2011-onion: Revision: 31123
Jason Wilkins
Jason.A.Wilkins at gmail.com
Sat Aug 13 14:53:39 CEST 2011
Revision: 39360
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39360
Author: jwilkins
Date: 2011-08-13 12:53:37 +0000 (Sat, 13 Aug 2011)
Log Message:
-----------
Revision: 31123
Author: nicholasbishop
Date: 2:51:23 PM, Friday, August 06, 2010
Message:
== Paint ==
Paint overlay
* Added a new vpaint input that samples an image rather than using the
brush color
* The image is displayed as a translucent overlay in vpaint mode
** Can be toggled on and off in the UI or with IKEY
* A color can be marked as transparent so that it will not affect the
brush color
** There's a tolerance value to set how close colors have to be to the
transparency color
* The image overlay can be moved with G/S/R when its enabled
* For now only enabled in vpaint mode, should be enabled for texpaint too
----
Modified : /branches/soc-2010-nicolasbishop/release/scripts/ui/space_view3d_toolbar.py
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenloader/intern/readfile.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_intern.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_ops.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_stroke.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/sculpt.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/space_view3d/view3d_draw.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_scene_types.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_scene.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/makesrna/intern/rna_sculpt_paint.c
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/include/ED_sculpt.h
Added : /branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_overlay.c
Revision: 31124
Author: nicholasbishop
Date: 3:04:37 PM, Friday, August 06, 2010
Message:
== Paint ==
* Missed a few things in my last commit
----
Modified : /branches/soc-2010-nicolasbishop/source/blender/makesdna/DNA_scene_types.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/editors/include/ED_sculpt.h
Modified Paths:
--------------
branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
branches/soc-2011-onion/source/blender/blenlib/BLI_math_matrix.h
branches/soc-2011-onion/source/blender/blenlib/intern/math_matrix.c
branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c
branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c
branches/soc-2011-onion/source/blender/editors/include/ED_sculpt.h
branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt
branches/soc-2011-onion/source/blender/editors/sculpt_paint/SConscript
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_bspace.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_controls.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_intern.h
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_ops.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_stroke.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/ptex.c
branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_draw.c
branches/soc-2011-onion/source/blender/editors/space_view3d/view3d_view.c
branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c
branches/soc-2011-onion/source/blender/makesdna/DNA_scene_types.h
branches/soc-2011-onion/source/blender/makesrna/intern/rna_scene.c
branches/soc-2011-onion/source/blender/makesrna/intern/rna_sculpt_paint.c
Added Paths:
-----------
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_overlay.c
Modified: branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2011-08-13 12:53:37 UTC (rev 39360)
@@ -1557,5 +1557,26 @@
sub.active = pe.use_fade_time
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):
+ #return (context.vertex_paint_object or context.texture_paint_object)
+ return (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")
+
+
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)
Modified: branches/soc-2011-onion/source/blender/blenlib/BLI_math_matrix.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/BLI_math_matrix.h 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/source/blender/blenlib/BLI_math_matrix.h 2011-08-13 12:53:37 UTC (rev 39360)
@@ -147,6 +147,7 @@
void translate_m4(float mat[4][4], float tx, float ty, float tz);
void rotate_m4(float mat[4][4], const char axis, const float angle);
+void rotate_m3(float mat[3][3], const char axis, const float angle);
void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[][3]);
Modified: branches/soc-2011-onion/source/blender/blenlib/intern/math_matrix.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/intern/math_matrix.c 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/source/blender/blenlib/intern/math_matrix.c 2011-08-13 12:53:37 UTC (rev 39360)
@@ -1084,7 +1084,7 @@
for(col=0 ; col<4 ; col++)
temp[col] = cosine*mat[1][col] + sine*mat[2][col];
for(col=0 ; col<4 ; col++) {
- mat[2][col] = - sine*mat[1][col] + cosine*mat[2][col];
+ mat[2][col] = - sine*mat[1][col] + cosine*mat[2][col];
mat[1][col] = temp[col];
}
break;
@@ -1109,6 +1109,46 @@
}
}
+void rotate_m3(float mat[][3], const char axis, const float angle)
+{
+ int col;
+ float temp[3]= {0.0f, 0.0f, 0.0f};
+ float cosine, sine;
+
+ assert(axis >= 'X' && axis <= 'Z');
+
+ cosine = (float)cos(angle);
+ sine = (float)sin(angle);
+ switch(axis){
+ case 'X':
+ for(col=0 ; col<3 ; col++)
+ temp[col] = cosine*mat[1][col] + sine*mat[2][col];
+ for(col=0 ; col<3 ; col++) {
+ mat[2][col] = - sine*mat[1][col] + cosine*mat[2][col];
+ mat[1][col] = temp[col];
+ }
+ break;
+
+ case 'Y':
+ for(col=0 ; col<3 ; col++)
+ temp[col] = cosine*mat[0][col] - sine*mat[2][col];
+ for(col=0 ; col<3 ; col++) {
+ mat[2][col] = sine*mat[0][col] + cosine*mat[2][col];
+ mat[0][col] = temp[col];
+ }
+ break;
+
+ case 'Z':
+ for(col=0 ; col<3 ; col++)
+ temp[col] = cosine*mat[0][col] + sine*mat[1][col];
+ for(col=0 ; col<3 ; col++) {
+ mat[1][col] = - sine*mat[0][col] + cosine*mat[1][col];
+ mat[0][col] = temp[col];
+ }
+ break;
+ }
+}
+
void blend_m3_m3m3(float out[][3], float dst[][3], float src[][3], const float srcweight)
{
float srot[3][3], drot[3][3];
Modified: branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c 2011-08-13 12:53:37 UTC (rev 39360)
@@ -24,7 +24,7 @@
* \ingroup bli
*/
-#define ENABLE_PTEX 1
+#define ENABLE_PTEX 0
#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
Modified: branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/source/blender/blenloader/intern/readfile.c 2011-08-13 12:53:37 UTC (rev 39360)
@@ -4455,13 +4455,26 @@
sce->world= newlibadr_us(fd, sce->id.lib, sce->world);
sce->set= newlibadr(fd, sce->id.lib, sce->set);
sce->gpd= newlibadr_us(fd, sce->id.lib, sce->gpd);
-
- link_paint(fd, sce, &sce->toolsettings->sculpt->paint);
- link_paint(fd, sce, &sce->toolsettings->vpaint->paint);
- link_paint(fd, sce, &sce->toolsettings->wpaint->paint);
- link_paint(fd, sce, &sce->toolsettings->imapaint.paint);
- link_paint(fd, sce, &sce->toolsettings->uvsmooth->paint);
+ {
+ ToolSettings *ts = sce->toolsettings;
+
+ if(ts) {
+ link_paint(fd, sce, &ts->sculpt->paint);
+ link_paint(fd, sce, &ts->vpaint->paint);
+ link_paint(fd, sce, &ts->wpaint->paint);
+ link_paint(fd, sce, &ts->imapaint.paint);
+ link_paint(fd, sce, &ts->uvsmooth->paint);
+
+ if(ts->paint_overlay.img) {
+ ts->paint_overlay.img=
+ newlibadr_us(fd, sce->id.lib, ts->paint_overlay.img);
+ }
+
+ ts->paint_overlay.gltex = 0;
+ }
+ }
+
sce->toolsettings->skgen_template = newlibadr(fd, sce->id.lib, sce->toolsettings->skgen_template);
for(base= sce->base.first; base; base= next) {
Modified: branches/soc-2011-onion/source/blender/editors/include/ED_sculpt.h
===================================================================
--- branches/soc-2011-onion/source/blender/editors/include/ED_sculpt.h 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/source/blender/editors/include/ED_sculpt.h 2011-08-13 12:53:37 UTC (rev 39360)
@@ -55,10 +55,9 @@
void paint_get_redraw_planes(float planes[4][4], struct ARegion *ar,
struct RegionView3D *rv3d, struct Object *ob);
-
-void ED_draw_paint_overlay(const struct bContext *C, struct ARegion *ar);
+void ED_draw_paint_overlay(const struct bContext *C, struct ARegion *ar); // XXX: texcache overlay
void ED_draw_on_surface_cursor(float modelview[16], float projection[16], float col[3], float alpha, float size[3], int viewport[4], float location[3], float inner_radius, float outer_radius, int brush_size);
-void ED_draw_fixed_overlay_on_surface(float modelview[16], float projection[16], float size[3], int viewport[4], float location[3], float outer_radius, struct Sculpt *sd, struct Brush *brush, struct ViewContext *vc, float t, float b, float l, float r, float angle);
+void ED_draw_fixed_overlay_on_surface(float modelview[16], float projection[16], float size[3], int viewport[4], float location[3], float outer_radius, struct Sculpt *sd, struct Brush *brush, struct ARegion *ar, struct rctf *quad, float angle);
float *ED_paint_get_last_stroke(struct Object *ob);
@@ -75,4 +74,8 @@
struct MultiresModifierData *ED_paint_mesh_get_active_multires(const struct bContext *C);
+/* paint_vertex.c */
+void ED_paint_overlay_draw(const struct bContext *C, struct ARegion *ar); // XXX: vpaint overlay
+void ED_paint_update_overlay(struct PaintOverlay *overlay);
+
#endif
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/CMakeLists.txt 2011-08-13 12:53:37 UTC (rev 39360)
@@ -56,6 +56,7 @@
paint_texcache.c
paint_uv.c
paint_brushlib.cpp
+ paint_overlay.c
sculpt.c
sculpt_tools.c
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/SConscript
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/SConscript 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/SConscript 2011-08-13 12:53:37 UTC (rev 39360)
@@ -18,6 +18,7 @@
sources.append('paint_meshcache.c')
sources.append('paint_texcache.c')
sources.append('paint_brushlib.cpp')
+sources.append('paint_overlay.c')
sources.append('sculpt.c')
sources.append('sculpt_tools.c')
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_bspace.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_bspace.c 2011-08-13 11:09:42 UTC (rev 39359)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_bspace.c 2011-08-13 12:53:37 UTC (rev 39360)
@@ -209,17 +209,17 @@
static void calc_radial_symmetry(struct BrushSpace *bspace, char radial_axis, float radial_angle)
{
if (radial_angle != 0 && radial_axis >= 'X' && radial_axis <= 'Z') {
- rotate_m4(bspace->radial_m4, radial_axis, radial_angle);
+ rotate_m3(bspace->radial_m3, radial_axis, radial_angle);
/* rotate points and vectors */
- mul_m4_v3(bspace->radial_m4, bspace->location);
- mul_m4_v3(bspace->radial_m4, bspace->grab_delta);
- mul_m4_v3(bspace->radial_m4, bspace->grab_total);
- mul_m4_v3(bspace->radial_m4, bspace->view_vector);
- mul_m4_v3(bspace->radial_m4, bspace->area_normal);
- mul_m4_v3(bspace->radial_m4, bspace->area_centroid);
- mul_m4_v3(bspace->radial_m4, bspace->disp_vector);
- mul_m4_v3(bspace->radial_m4, bspace->cull_vector);
+ mul_m3_v3(bspace->radial_m3, bspace->location);
+ mul_m3_v3(bspace->radial_m3, bspace->grab_delta);
+ mul_m3_v3(bspace->radial_m3, bspace->grab_total);
+ mul_m3_v3(bspace->radial_m3, bspace->view_vector);
+ mul_m3_v3(bspace->radial_m3, bspace->area_normal);
+ mul_m3_v3(bspace->radial_m3, bspace->area_centroid);
+ mul_m3_v3(bspace->radial_m3, bspace->disp_vector);
+ mul_m3_v3(bspace->radial_m3, bspace->cull_vector);
/* rotate the object=>brush matrix */
rotate_m4(bspace->object_to_brush_m4, radial_axis, radial_angle);
@@ -316,7 +316,7 @@
{
bspace->mirror_pass= 0;
- unit_m4(bspace->radial_m4);
+ unit_m3(bspace->radial_m3);
bspace->angle_flip= 1;
}
@@ -493,6 +493,25 @@
return bspace_curr->hit;
}
+void paint_bspace_project(
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list