Compare commits

...

34 Commits

Author SHA1 Message Date
450eb4ef6c Merge remote-tracking branch 'origin' into soc-2017-sculpting_brush 2017-12-15 00:17:35 +05:30
31d5262cec Topograb: Trying to solve high density mesh error 2017-07-28 02:38:57 +05:30
5a8e68c726 Topograb: Fixed dyntopo error 2017-07-26 19:08:07 +05:30
023e0526ea Topograb: Fixed runtime warnings 2017-07-26 18:41:20 +05:30
e975c43f5c Topograb: Fixed cenral vertex error 2017-07-26 18:22:38 +05:30
3c4b7e7a5a Topograb: Dynamic array implementation testing 2017-07-25 16:32:51 +05:30
1b960b02c0 Topograb: Dynamic array Implementation check 2017-07-25 09:16:13 +05:30
917427ab33 Topograb: Implementing new ref. central vertex calculation function 2017-07-24 21:22:53 +05:30
d549179379 Topograb: Implementing new normal calculation function 2017-07-24 20:17:44 +05:30
a57841c4b0 Topograb: Tried changing normal for correct grab position. It has become unstable to some extend and crashes a bit in some case. Still works fine in normal mode 2017-07-22 08:03:14 +05:30
bb2b62c48f Topograb: First attempt to implement brush in multires. Testing few things before implementation 2017-07-21 16:25:38 +05:30
321bdff107 Topograb: Tried Fixing dyntopo crash using original coordinates. Dyntopo is working now. Still some error but it does not crashes now! 2017-07-14 20:25:35 +05:30
885f459c18 Topograb: Error in dyntopo fixed a little bit. Crashes when brush is used redundantly in dyntopo mode 2017-07-11 00:06:42 +05:30
6d5886bb90 Topograb: trying to fix dyntopo bug, still in progress. Test commit 2017-07-10 23:08:51 +05:30
2b81ef880f Topograb: Codeclean up 2017-07-04 23:39:10 +05:30
1f65119fd2 Topograb: Update 3 2017-07-04 00:58:34 +05:30
379792196f Added few debug lines 2017-07-02 21:24:13 +05:30
d78a93a59e Working version of topograb: Update 2 2017-06-24 22:36:40 +05:30
1132d60234 Edited minor bug! 2017-06-23 01:49:30 +05:30
1af5ea2f88 Working version of topograb: Update 1 2017-06-22 23:25:44 +05:30
13734ab880 First working version of topograb 2017-06-22 22:01:17 +05:30
3b3c42fd0a Added topograb.png 2017-06-22 01:01:32 +05:30
1204260c92 Topograb final Implementaion Part 1 2017-06-22 00:24:04 +05:30
f1cfe3a328 Topo Grab topo_init done 2017-06-21 22:48:20 +05:30
7bcdcde311 Added topo_init in do_topo_brush 2017-06-20 23:45:28 +05:30
312e1552b8 Modified do_topo_brush 2017-06-19 00:23:28 +05:30
9c3be3335d Topograb Brush Initialization 2017-06-18 13:29:30 +05:30
f691de8b67 Final Implementation of method one with few editing 2017-06-17 00:07:12 +05:30
8e345fec7d Another attempt to make clipping brush 2017-06-13 21:51:06 +05:30
41f1918b2d First approach towards Clip Brush 2017-06-11 16:23:45 +05:30
26a806e430 Added details in brush and few modification in files 2017-06-10 02:08:43 +05:30
d7f98929e0 Added Clip.png in gitignore 2017-06-09 22:46:23 +05:30
8b03dd8e9d Updated files to create Clipping brush 2017-06-05 22:33:10 +05:30
b973068553 Clip brush UI 2017-06-04 23:07:04 +05:30
26 changed files with 1003 additions and 39 deletions

1
.gitignore vendored
View File

@@ -39,3 +39,4 @@ Desktop.ini
/doc/python_api/rst/op_prop.png
/doc/python_api/rst/run_script.png
/doc/python_api/rst/spacebar.png
/release/datafiles/brushicons/clip.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -198,7 +198,7 @@ typedef struct SculptSession {
/* Layer brush persistence between strokes */
float (*layer_co)[3]; /* Copy of the mesh vertices' locations */
int brush_size;
struct SculptStroke *stroke;
struct StrokeCache *cache;
} SculptSession;

View File

@@ -406,6 +406,11 @@ void BKE_brush_sculpt_reset(Brush *br)
br->sub_col[0] = 0.250000;
br->sub_col[1] = 1.000000;
break;
case SCULPT_TOOL_CLIP:
br->add_col[1] = 1.000000;
br->sub_col[0] = 0.250000;
br->sub_col[1] = 1.000000;
break;
case SCULPT_TOOL_ROTATE:
br->alpha = 1.0;
break;
@@ -417,6 +422,7 @@ void BKE_brush_sculpt_reset(Brush *br)
br->add_col[2] = 0.750000;
break;
case SCULPT_TOOL_GRAB:
case SCULPT_TOOL_TOPO_GRAB:
case SCULPT_TOOL_SNAKE_HOOK:
case SCULPT_TOOL_THUMB:
br->size = 75;

View File

@@ -863,7 +863,7 @@ void BKE_sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
ss->multires = mmd;
ss->totvert = dm->getNumVerts(dm);
ss->totpoly = dm->getNumPolys(dm);
ss->mvert = NULL;
ss->mvert = me->mvert;
ss->mpoly = NULL;
ss->mloop = NULL;
}

View File

@@ -815,6 +815,11 @@ void BKE_scene_init(Scene *sce)
gp_brush->size = 50;
gp_brush->strength = 0.5f; // XXX?
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_CLIP]; /*clipping*/
gp_brush->size = 40;
gp_brush->strength = 0.5f; // XXX?
gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
gp_brush->size = 25;

View File

@@ -144,6 +144,11 @@ void BLO_update_defaults_startup_blend(Main *bmain)
brush->size = 50;
brush->strength = 0.5f; // XXX?
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush = &gset->brush[GP_EDITBRUSH_TYPE_CLIP]; /* clipping */
brush->size = 40;
brush->strength = 0.5f; // XXX?
brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF;
brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE];
brush->size = 25;
@@ -269,6 +274,12 @@ void BLO_update_defaults_startup_blend(Main *bmain)
br->flag |= BRUSH_ORIGINAL_NORMAL;
}
/* use original normal for topo grab brush (otherwise flickers with normal weighting). */
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Topo");
if (br) {
br->flag |= BRUSH_ORIGINAL_NORMAL;
}
/* increase strength, better for smoothing method */
br = (Brush *)BKE_libblock_find_name_ex(bmain, ID_BR, "Blur");
if (br) {

View File

@@ -1031,6 +1031,14 @@ void BM_log_before_all_removed(BMesh *bm, BMLog *log)
/* Get the logged coordinates of a vertex
*
* Does not modify the log or the vertex */
uint BM_log_vert_id_t(BMLog *log, BMVert *v){
return bm_log_vert_id_get(log, v);
}
BMVert *BM_log_id_vert_t(BMLog *log, uint id){
return bm_log_vert_from_id(log, id);
}
const float *BM_log_original_vert_co(BMLog *log, BMVert *v)
{
BMLogEntry *entry = log->current_entry;

View File

@@ -90,6 +90,10 @@ void BM_log_before_all_removed(BMesh *bm, BMLog *log);
/* Get the logged coordinates of a vertex */
const float *BM_log_original_vert_co(BMLog *log, BMVert *v);
uint BM_log_vert_id_t(BMLog *log, BMVert *v);
BMVert *BM_log_id_vert_t(BMLog *log, uint id);
/* Get the logged normal of a vertex */
const short *BM_log_original_vert_no(BMLog *log, BMVert *v);

View File

@@ -270,4 +270,4 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
}
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
}
}

View File

@@ -159,3 +159,11 @@ void BM_mesh_triangulate(
BLI_edgehash_free(pf_ehash, NULL);
}
}
void BM_mesh_clip_project(
BMesh *bm, const int quad_method, const int ngon_method, const bool tag_only,
BMOperator *op, BMOpSlot *slot_facemap_out, BMOpSlot *slot_facemap_double_out)
{
BMIter iter;
BMFace *face;
}

View File

@@ -70,6 +70,7 @@ if(WITH_BLENDER)
data_to_c_simple(../../../../release/datafiles/brushicons/blob.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/blur.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/clay.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/clip.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/claystrips.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/clone.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/crease.png SRC)
@@ -96,6 +97,7 @@ if(WITH_BLENDER)
data_to_c_simple(../../../../release/datafiles/brushicons/texfill.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/texmask.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/thumb.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/topograb.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/twist.png SRC)
data_to_c_simple(../../../../release/datafiles/brushicons/vertexdraw.png SRC)

View File

@@ -105,6 +105,9 @@ extern char datatoc_flatten_png[];
extern int datatoc_grab_png_size;
extern char datatoc_grab_png[];
extern int datatoc_clip_png_size;
extern char datatoc_clip_png[];
extern int datatoc_inflate_png_size;
extern char datatoc_inflate_png[];
@@ -156,6 +159,9 @@ extern char datatoc_texfill_png[];
extern int datatoc_texmask_png_size;
extern char datatoc_texmask_png[];
extern int datatoc_topograb_png_size;
extern char datatoc_topograb_png[];
extern int datatoc_thumb_png_size;
extern char datatoc_thumb_png[];

View File

@@ -950,6 +950,7 @@ DEF_ICON(BRUSH_BLOB)
DEF_ICON(BRUSH_BLUR)
DEF_ICON(BRUSH_CLAY)
DEF_ICON(BRUSH_CLAY_STRIPS)
DEF_ICON(BRUSH_CLIP)
DEF_ICON(BRUSH_CLONE)
DEF_ICON(BRUSH_CREASE)
DEF_ICON(BRUSH_DARKEN)
@@ -973,6 +974,7 @@ DEF_ICON(BRUSH_SOFTEN)
DEF_ICON(BRUSH_SUBTRACT)
DEF_ICON(BRUSH_TEXDRAW)
DEF_ICON(BRUSH_TEXFILL)
DEF_ICON(BRUSH_TOPO_GRAB)
DEF_ICON(BRUSH_TEXMASK)
DEF_ICON(BRUSH_THUMB)
DEF_ICON(BRUSH_ROTATE)

View File

@@ -374,6 +374,7 @@ static void init_brush_icons(void)
INIT_BRUSH_ICON(ICON_BRUSH_FILL, fill);
INIT_BRUSH_ICON(ICON_BRUSH_FLATTEN, flatten);
INIT_BRUSH_ICON(ICON_BRUSH_GRAB, grab);
INIT_BRUSH_ICON(ICON_BRUSH_CLIP, clip);
INIT_BRUSH_ICON(ICON_BRUSH_INFLATE, inflate);
INIT_BRUSH_ICON(ICON_BRUSH_LAYER, layer);
INIT_BRUSH_ICON(ICON_BRUSH_LIGHTEN, lighten);
@@ -390,6 +391,7 @@ static void init_brush_icons(void)
INIT_BRUSH_ICON(ICON_BRUSH_SUBTRACT, subtract);
INIT_BRUSH_ICON(ICON_BRUSH_TEXDRAW, texdraw);
INIT_BRUSH_ICON(ICON_BRUSH_TEXFILL, texfill);
INIT_BRUSH_ICON(ICON_BRUSH_TOPO_GRAB, topograb);
INIT_BRUSH_ICON(ICON_BRUSH_TEXMASK, texmask);
INIT_BRUSH_ICON(ICON_BRUSH_THUMB, thumb);
INIT_BRUSH_ICON(ICON_BRUSH_ROTATE, twist);

View File

@@ -1592,11 +1592,13 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_PINCH, PKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_INFLATE, IKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_GRAB, GKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLIP, YKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_LAYER, LKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_FLATTEN, TKEY, KM_SHIFT);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLAY, CKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CREASE, CKEY, KM_SHIFT);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_SNAKE_HOOK, KKEY, 0);
keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_TOPO_GRAB, OKEY, 0);
kmi = keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_MASK, MKEY, 0);
RNA_boolean_set(kmi->ptr, "toggle", 1);
RNA_boolean_set(kmi->ptr, "create_missing", 1);

View File

@@ -196,7 +196,7 @@ static bool paint_tool_require_location(Brush *brush, PaintMode mode)
{
switch (mode) {
case ePaintSculpt:
if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_TOPO_GRAB, SCULPT_TOOL_CLIP, SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB))
{
return false;
@@ -763,6 +763,8 @@ static bool sculpt_is_grab_tool(Brush *br)
{
return ELEM(br->sculpt_tool,
SCULPT_TOOL_GRAB,
SCULPT_TOOL_TOPO_GRAB,
SCULPT_TOOL_CLIP,
SCULPT_TOOL_THUMB,
SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK);

File diff suppressed because it is too large Load Diff

View File

@@ -252,7 +252,9 @@ typedef enum BrushSculptTool {
SCULPT_TOOL_CREASE = 16,
SCULPT_TOOL_BLOB = 17,
SCULPT_TOOL_CLAY_STRIPS = 18,
SCULPT_TOOL_MASK = 19
SCULPT_TOOL_MASK = 19,
SCULPT_TOOL_CLIP = 20,
SCULPT_TOOL_TOPO_GRAB = 21
} BrushSculptTool;
/** When #BRUSH_ACCUMULATE is used */
@@ -270,6 +272,7 @@ typedef enum BrushSculptTool {
#define SCULPT_TOOL_HAS_NORMAL_WEIGHT(t) ELEM(t, \
SCULPT_TOOL_GRAB, \
SCULPT_TOOL_TOPO_GRAB, \
SCULPT_TOOL_SNAKE_HOOK \
)
@@ -280,6 +283,7 @@ typedef enum BrushSculptTool {
#define SCULPT_TOOL_HAS_DYNTOPO(t) (ELEM(t, \
/* These brushes, as currently coded, cannot support dynamic topology */ \
SCULPT_TOOL_GRAB, \
SCULPT_TOOL_TOPO_GRAB, \
SCULPT_TOOL_ROTATE, \
SCULPT_TOOL_THUMB, \
SCULPT_TOOL_LAYER, \

View File

@@ -1191,7 +1191,7 @@ typedef enum eGP_EditBrush_Types {
GP_EDITBRUSH_TYPE_SIMPLIFY = 8,
GP_EDITBRUSH_TYPE_CLONE = 9,
GP_EDITBRUSH_TYPE_STRENGTH = 10,
GP_EDITBRUSH_TYPE_CLIP = 11,
/* !!! Update GP_EditBrush_Data brush[###]; below !!! */
TOT_GP_EDITBRUSH_TYPES
} eGP_EditBrush_Types;
@@ -1229,7 +1229,7 @@ typedef enum eGP_EditBrush_Flag {
/* GPencil Stroke Sculpting Settings */
typedef struct GP_BrushEdit_Settings {
GP_EditBrush_Data brush[11]; /* TOT_GP_EDITBRUSH_TYPES */
GP_EditBrush_Data brush[12]; /* TOT_GP_EDITBRUSH_TYPES */
void *paintcursor; /* runtime */
int brushtype; /* eGP_EditBrush_Types */

View File

@@ -71,6 +71,7 @@ EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
{SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
{SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
{SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
{SCULPT_TOOL_CLIP, "CLIP", ICON_BRUSH_CLIP, "Clip", ""},
{SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
{SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
{SCULPT_TOOL_MASK, "MASK", ICON_BRUSH_MASK, "Mask", ""},
@@ -80,6 +81,7 @@ EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
{SCULPT_TOOL_SCRAPE, "SCRAPE", ICON_BRUSH_SCRAPE, "Scrape", ""},
{SCULPT_TOOL_SIMPLIFY, "SIMPLIFY", ICON_BRUSH_SUBTRACT /* icon TODO */, "Simplify", ""},
{SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""},
{SCULPT_TOOL_TOPO_GRAB, "TOPO_GRAB", ICON_BRUSH_TOPO_GRAB, "Topo", "" },
{SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""},
{SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
{0, NULL, 0, NULL, NULL}
@@ -144,7 +146,7 @@ static int rna_SculptToolCapabilities_has_jitter_get(PointerRNA *ptr)
return (!(br->flag & BRUSH_ANCHORED) &&
!(br->flag & BRUSH_DRAG_DOT) &&
!ELEM(br->sculpt_tool,
SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
SCULPT_TOOL_GRAB, SCULPT_TOOL_TOPO_GRAB, SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
}
@@ -192,7 +194,7 @@ static int rna_SculptToolCapabilities_has_random_texture_angle_get(PointerRNA *p
{
Brush *br = (Brush *)ptr->data;
return (!ELEM(br->sculpt_tool,
SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
SCULPT_TOOL_GRAB, SCULPT_TOOL_TOPO_GRAB, SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
}
@@ -255,7 +257,7 @@ static int rna_SculptToolCapabilities_has_space_attenuation_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return ((br->flag & (BRUSH_SPACE | BRUSH_LINE | BRUSH_CURVE)) &&
!ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
!ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_TOPO_GRAB, SCULPT_TOOL_ROTATE,
SCULPT_TOOL_SMOOTH, SCULPT_TOOL_SNAKE_HOOK));
}
@@ -275,7 +277,7 @@ static int rna_BrushCapabilities_has_spacing_get(PointerRNA *ptr)
static int rna_SculptToolCapabilities_has_strength_pressure_get(PointerRNA *ptr)
{
Brush *br = (Brush *)ptr->data;
return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_TOPO_GRAB, SCULPT_TOOL_SNAKE_HOOK);
}
static int rna_TextureCapabilities_has_texture_angle_get(PointerRNA *ptr)