[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56414] branches/soc-2011-tomato: Merging r56410 through r56413 from trunk into soc-2011-tomato
Sergey Sharybin
sergey.vfx at gmail.com
Tue Apr 30 14:20:31 CEST 2013
Revision: 56414
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56414
Author: nazgul
Date: 2013-04-30 12:20:31 +0000 (Tue, 30 Apr 2013)
Log Message:
-----------
Merging r56410 through r56413 from trunk into soc-2011-tomato
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56410
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56413
Modified Paths:
--------------
branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_paint_common.py
branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py
branches/soc-2011-tomato/source/blender/blenkernel/BKE_brush.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/brush.c
branches/soc-2011-tomato/source/blender/editors/interface/interface_handlers.c
branches/soc-2011-tomato/source/blender/editors/sculpt_paint/paint_image_2d.c
branches/soc-2011-tomato/source/blender/editors/sculpt_paint/paint_ops.c
branches/soc-2011-tomato/source/blender/imbuf/intern/util.c
branches/soc-2011-tomato/source/blender/quicktime/apple/qtkit_import.m
branches/soc-2011-tomato/source/blender/quicktime/apple/quicktime_import.c
Property Changed:
----------------
branches/soc-2011-tomato/
branches/soc-2011-tomato/source/blender/editors/interface/interface.c
branches/soc-2011-tomato/source/blender/editors/space_outliner/
Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-56408
+ /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-56413
Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_paint_common.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_paint_common.py 2013-04-30 12:18:09 UTC (rev 56413)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_paint_common.py 2013-04-30 12:20:31 UTC (rev 56414)
@@ -84,7 +84,9 @@
layout.separator()
if tex_slot.map_mode == 'STENCIL':
- layout.operator("brush.stencil_fit_image_aspect")
+ if brush.texture and brush.texture.type == 'IMAGE':
+ layout.operator("brush.stencil_fit_image_aspect")
+ layout.operator("brush.stencil_reset_transform")
# angle and texture_angle_source
col = layout.column()
@@ -127,7 +129,9 @@
layout.separator()
if mask_tex_slot.map_mode == 'STENCIL':
- layout.operator("brush.stencil_fit_image_aspect").mask = True
+ if brush.mask_texture and brush.mask_texture.type == 'IMAGE':
+ layout.operator("brush.stencil_fit_image_aspect").mask = True
+ layout.operator("brush.stencil_reset_transform")
if brush.mask_texture:
layout.label(text="Mask Mapping:")
Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py 2013-04-30 12:18:09 UTC (rev 56413)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_image.py 2013-04-30 12:20:31 UTC (rev 56414)
@@ -696,9 +696,11 @@
if brush:
col = layout.column()
- col.template_color_picker(brush, "color", value_slider=True)
- col.prop(brush, "color", text="")
+ if brush.image_tool == 'DRAW' and brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'):
+ col.template_color_picker(brush, "color", value_slider=True)
+ col.prop(brush, "color", text="")
+
row = col.row(align=True)
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_brush.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_brush.h 2013-04-30 12:18:09 UTC (rev 56413)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_brush.h 2013-04-30 12:20:31 UTC (rev 56414)
@@ -38,6 +38,7 @@
struct ImBuf;
struct ImagePool;
struct Main;
+struct rctf;
struct Scene;
struct wmOperator;
// enum CurveMappingPreset;
@@ -77,12 +78,12 @@
/* sampling */
float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float point[3],
float rgba[4], const int thread, struct ImagePool *pool);
-float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2],
- float rgba[4]);
float BKE_brush_sample_masktex(const Scene *scene, struct Brush *br, const float point[3],
const int thread, struct ImagePool *pool);
-void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size,
- struct ImBuf **imbuf, bool use_color_correction, bool use_brush_alpha);
+void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt,
+ short texfalloff, int size, struct ImBuf **imbuf,
+ bool use_color_correction, bool use_brush_alpha,
+ struct ImagePool *pool, struct rctf *mapping);
/* texture */
unsigned int *BKE_brush_gen_texture_cache(struct Brush *br, int half_side);
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/brush.c 2013-04-30 12:18:09 UTC (rev 56413)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/brush.c 2013-04-30 12:20:31 UTC (rev 56414)
@@ -38,6 +38,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_rand.h"
+#include "BLI_rect.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
@@ -757,87 +758,27 @@
return intensity;
}
-/* Brush Sampling for 2D brushes. when we unify the brush systems this will be
- * necessarily a separate function.
- *
- * rgba outputs straight alpha. */
-float BKE_brush_sample_tex_2D(const Scene *scene, Brush *brush, const float xy[2], float rgba[4])
+static void brush_imbuf_tex_co(rctf *mapping, int x, int y, float texco[3])
{
- UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
- MTex *mtex = &brush->mtex;
-
- if (mtex && mtex->tex) {
- float co[3], tin, tr, tg, tb, ta;
- float x = xy[0], y = xy[1];
- int hasrgb;
- int radius = BKE_brush_size_get(scene, brush);
- float rotation = -mtex->rot;
-
- if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
- rotation += ups->brush_rotation;
- radius = ups->pixel_radius;
- }
- else if (mtex->brush_map_mode == MTEX_MAP_MODE_RANDOM) {
- rotation += ups->brush_rotation;
- /* these contain a random coordinate */
- x -= ups->tex_mouse[0];
- y -= ups->tex_mouse[1];
-
- radius = ups->pixel_radius;
- }
-
- x /= radius;
- y /= radius;
-
- if (rotation > 0.001f || rotation < -0.001f) {
- const float angle = atan2f(y, x) + rotation;
- const float flen = sqrtf(x * x + y * y);
-
- x = flen * cosf(angle);
- y = flen * sinf(angle);
- }
-
- x *= brush->mtex.size[0];
- y *= brush->mtex.size[1];
-
- co[0] = x + brush->mtex.ofs[0];
- co[1] = y + brush->mtex.ofs[1];
- co[2] = 0.0f;
-
- hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, 0, NULL);
-
- if (hasrgb) {
- rgba[0] = tr;
- rgba[1] = tg;
- rgba[2] = tb;
- rgba[3] = ta;
- }
- else {
- rgba[0] = tin;
- rgba[1] = tin;
- rgba[2] = tin;
- rgba[3] = 1.0f;
- }
- return tin;
- }
- else {
- rgba[0] = rgba[1] = rgba[2] = rgba[3] = 1.0f;
- return 1.0;
- }
+ texco[0] = mapping->xmin + x*mapping->xmax;
+ texco[1] = mapping->ymin + y*mapping->ymax;
+ texco[2] = 0.0f;
}
/* TODO, use define for 'texfall' arg
* NOTE: only used for 2d brushes currently! */
void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, int bufsize,
- ImBuf **outbuf, bool use_color_correction, bool use_brush_alpha)
+ ImBuf **outbuf, bool use_color_correction, bool use_brush_alpha,
+ struct ImagePool *pool, rctf *mapping)
{
ImBuf *ibuf;
- float xy[2], rgba[4], *dstf;
+ float xy[2], texco[3], rgba[4], *dstf;
int x, y, rowbytes, xoff, yoff, imbflag;
const int radius = BKE_brush_size_get(scene, brush);
unsigned char *dst, crgb[3];
const float alpha = (use_brush_alpha)? BKE_brush_alpha_get(scene, brush): 1.0f;
- float brush_rgb[3];
+ float brush_rgb[3] = {1.0f, 1.0f, 1.0f};
+ int thread = 0;
imbflag = (flt) ? IB_rectfloat : IB_rect;
xoff = -bufsize / 2.0f + 0.5f;
@@ -850,9 +791,11 @@
ibuf = IMB_allocImBuf(bufsize, bufsize, 32, imbflag);
if (flt) {
- copy_v3_v3(brush_rgb, brush->rgb);
- if (use_color_correction) {
- srgb_to_linearrgb_v3_v3(brush_rgb, brush_rgb);
+ if (brush->imagepaint_tool == PAINT_TOOL_DRAW) {
+ copy_v3_v3(brush_rgb, brush->rgb);
+ if (use_color_correction) {
+ srgb_to_linearrgb_v3_v3(brush_rgb, brush_rgb);
+ }
}
for (y = 0; y < ibuf->y; y++) {
@@ -867,15 +810,19 @@
dstf[3] = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
}
else if (texfall == 1) {
- BKE_brush_sample_tex_2D(scene, brush, xy, dstf);
+ brush_imbuf_tex_co(mapping, x, y, texco);
+ BKE_brush_sample_tex_3D(scene, brush, texco, dstf, thread, pool);
}
else if (texfall == 2) {
- BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
+ brush_imbuf_tex_co(mapping, x, y, texco);
+ BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool);
+
mul_v3_v3v3(dstf, rgba, brush_rgb);
dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
}
else {
- BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
+ brush_imbuf_tex_co(mapping, x, y, texco);
+ BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool);
copy_v3_v3(dstf, brush_rgb);
dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
}
@@ -889,8 +836,12 @@
}
else {
float alpha_f; /* final float alpha to convert to char */
- rgb_float_to_uchar(crgb, brush->rgb);
+ if (brush->imagepaint_tool == PAINT_TOOL_DRAW)
+ rgb_float_to_uchar(crgb, brush->rgb);
+ else
+ rgb_float_to_uchar(crgb, brush_rgb);
+
for (y = 0; y < ibuf->y; y++) {
dst = (unsigned char *)ibuf->rect + y * rowbytes;
@@ -907,11 +858,13 @@
dst[3] = FTOCHAR(alpha_f);
}
else if (texfall == 1) {
- BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
+ brush_imbuf_tex_co(mapping, x, y, texco);
+ BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool);
rgba_float_to_uchar(dst, rgba);
}
else if (texfall == 2) {
- BKE_brush_sample_tex_2D(scene, brush, xy, rgba);
+ brush_imbuf_tex_co(mapping, x, y, texco);
+ BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, pool);
mul_v3_v3(rgba, brush->rgb);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list