[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60266] branches/soc-2013-paint: Code reorganization:
Antony Riakiotakis
kalast at gmail.com
Fri Sep 20 16:48:47 CEST 2013
Revision: 60266
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60266
Author: psy-fi
Date: 2013-09-20 14:48:47 +0000 (Fri, 20 Sep 2013)
Log Message:
-----------
Code reorganization:
* Move symmetry options to paint instead of Sculpt struct.
* Expose the symmetry options under Projective Paint panel (still
inactive)
Modified Paths:
--------------
branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py
branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c
branches/soc-2013-paint/source/blender/makesdna/DNA_scene_types.h
branches/soc-2013-paint/source/blender/makesrna/intern/rna_sculpt_paint.c
Modified: branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2013-09-20 13:22:45 UTC (rev 60265)
+++ branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2013-09-20 14:48:47 UTC (rev 60266)
@@ -1290,6 +1290,13 @@
col = layout.column()
+ col.label(text="Mirror:")
+ row = col.row(align=True)
+ row.prop(ipaint, "use_symmetry_x", text="X", toggle=True)
+ row.prop(ipaint, "use_symmetry_y", text="Y", toggle=True)
+ row.prop(ipaint, "use_symmetry_z", text="Z", toggle=True)
+
+ col.separator()
col.prop(ipaint, "use_occlude")
col.prop(ipaint, "use_backface_culling")
Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c 2013-09-20 13:22:45 UTC (rev 60265)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/sculpt.c 2013-09-20 14:48:47 UTC (rev 60266)
@@ -722,15 +722,15 @@
/* Uses symm to selectively flip any axis of a coordinate. */
static void flip_v3_v3(float out[3], const float in[3], const char symm)
{
- if (symm & SCULPT_SYMM_X)
+ if (symm & PAINT_SYMM_X)
out[0] = -in[0];
else
out[0] = in[0];
- if (symm & SCULPT_SYMM_Y)
+ if (symm & PAINT_SYMM_Y)
out[1] = -in[1];
else
out[1] = in[1];
- if (symm & SCULPT_SYMM_Z)
+ if (symm & PAINT_SYMM_Z)
out[2] = -in[2];
else
out[2] = in[2];
@@ -780,7 +780,7 @@
static float calc_symmetry_feather(Sculpt *sd, StrokeCache *cache)
{
- if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
+ if (sd->paint.symmetry_flags & PAINT_SYMMETRY_FEATHER) {
float overlap;
int symm = cache->symmetry;
int i;
@@ -3417,7 +3417,7 @@
/* XXX This reduces the length of the grab delta if it approaches the line of symmetry
* XXX However, a different approach appears to be needed */
#if 0
- if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
+ if (sd->paint.symmetry_flags & SCULPT_SYMMETRY_FEATHER) {
float frac = 1.0f / max_overlap_count(sd);
float reduce = (feather - frac) / (1 - frac);
@@ -3477,7 +3477,7 @@
Brush *brush = BKE_paint_brush(&sd->paint);
SculptSession *ss = ob->sculpt;
StrokeCache *cache = ss->cache;
- const char symm = sd->flags & 7;
+ const char symm = sd->paint.symmetry_flags & 7;
int i;
float feather = calc_symmetry_feather(sd, ss->cache);
@@ -5062,7 +5062,7 @@
ts->sculpt = MEM_callocN(sizeof(Sculpt), "sculpt mode data");
/* Turn on X plane mirror symmetry by default */
- ts->sculpt->flags |= SCULPT_SYMM_X;
+ ts->sculpt->paint.symmetry_flags |= PAINT_SYMM_X;
}
if (!ts->sculpt->detail_size)
Modified: branches/soc-2013-paint/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2013-paint/source/blender/makesdna/DNA_scene_types.h 2013-09-20 13:22:45 UTC (rev 60265)
+++ branches/soc-2013-paint/source/blender/makesdna/DNA_scene_types.h 2013-09-20 14:48:47 UTC (rev 60266)
@@ -769,7 +769,7 @@
* smooth the stroke */
int num_input_samples;
- int pad;
+ int symmetry_flags;
} Paint;
/* ------------------------------------------- */
@@ -1573,19 +1573,32 @@
typedef enum {
PAINT_SHOW_BRUSH = (1 << 0),
PAINT_FAST_NAVIGATE = (1 << 1),
- PAINT_SHOW_BRUSH_ON_SURFACE = (1 << 2),
+ PAINT_SHOW_BRUSH_ON_SURFACE = (1 << 2)
} PaintFlags;
+/* Paint.symmetry_flags
+ * (for now just a duplicate of sculpt symmetry flags) */
+typedef enum SymmetryFlags {
+ PAINT_SYMM_X = (1 << 0),
+ PAINT_SYMM_Y = (1 << 1),
+ PAINT_SYMM_Z = (1 << 2),
+ PAINT_SYMMETRY_FEATHER = (1 << 3)
+} SymmetryFlags;
+
/* Sculpt.flags */
/* These can eventually be moved to paint flags? */
typedef enum SculptFlags {
+ /* deprecated, part of paint struct symmetry_flags now
SCULPT_SYMM_X = (1 << 0),
SCULPT_SYMM_Y = (1 << 1),
SCULPT_SYMM_Z = (1 << 2),
+ */
SCULPT_LOCK_X = (1 << 3),
SCULPT_LOCK_Y = (1 << 4),
SCULPT_LOCK_Z = (1 << 5),
- SCULPT_SYMMETRY_FEATHER = (1 << 6),
+ /* deprecated, part of paint struct symmetry_flags now
+ SCULPT_SYMMETRY_FEATHER = (1 << 6)
+ */
SCULPT_USE_OPENMP = (1 << 7),
SCULPT_ONLY_DEFORM = (1 << 8),
SCULPT_SHOW_DIFFUSE = (1 << 9),
Modified: branches/soc-2013-paint/source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
--- branches/soc-2013-paint/source/blender/makesrna/intern/rna_sculpt_paint.c 2013-09-20 13:22:45 UTC (rev 60265)
+++ branches/soc-2013-paint/source/blender/makesrna/intern/rna_sculpt_paint.c 2013-09-20 14:48:47 UTC (rev 60266)
@@ -363,6 +363,23 @@
RNA_def_property_int_sdna(prop, NULL, "num_input_samples");
RNA_def_property_ui_range(prop, 1, PAINT_MAX_INPUT_SAMPLES, 0, -1);
RNA_def_property_ui_text(prop, "Input Samples", "Average multiple input samples together to smooth the brush stroke");
+
+ prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_X);
+ RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis");
+
+ prop = RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Y);
+ RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis");
+
+ prop = RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Z);
+ RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis");
+
+ prop = RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMMETRY_FEATHER);
+ RNA_def_property_ui_text(prop, "Symmetry Feathering",
+ "Reduce the strength of the brush where it overlaps symmetrical daubs");
}
static void rna_def_sculpt(BlenderRNA *brna)
@@ -382,18 +399,6 @@
RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis",
"Number of times to copy strokes across the surface");
- prop = RNA_def_property(srna, "use_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, "use_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, "use_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");
@@ -406,11 +411,6 @@
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, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER);
- RNA_def_property_ui_text(prop, "Symmetry Feathering",
- "Reduce the strength of the brush where it overlaps symmetrical daubs");
-
prop = RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP);
RNA_def_property_ui_text(prop, "Use OpenMP",
More information about the Bf-blender-cvs
mailing list