sculpt-dev: fix merge errors

This commit is contained in:
Joseph Eagar 2022-10-05 20:01:48 -07:00
parent 2aa347b64e
commit e5fcaa293a
23 changed files with 168 additions and 175 deletions

View File

@ -534,8 +534,15 @@ class MESH_UL_attributes(UIList):
flags = []
indices = [i for i in range(len(attributes))]
show_all = _context.tool_settings.save_temp_layers if hasattr(_context, "tool_settings") else False
for item in attributes:
flags.append(self.bitflag_filter_item if item.is_internal else 0)
if show_all:
flags.append(self.bitflag_filter_item)
else:
flags.append(0)
print("items!", list(attributes), flags)
return flags, indices

View File

@ -1412,17 +1412,8 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
col.prop(sculpt, "use_automasking_start_normal", text="Area Normal")
col.prop(sculpt, "use_automasking_view_normal", text="View Normal")
UnifiedPaintPanel.channel_unified(layout.column(),
context,
brush,
"show_origco",
toolsettings_only=True, ui_editing=False)
UnifiedPaintPanel.channel_unified(layout.column(),
context,
brush,
"save_temp_layers",
toolsettings_only=True, ui_editing=False)
layout.prop(context.tool_settings, "show_origco")
layout.prop(context.tool_settings, "save_temp_layers")
col.separator()

View File

@ -444,6 +444,7 @@ typedef struct SculptClothSimulation {
float (*pos)[3];
float (*init_pos)[3];
float (*init_no)[3];
float (*softbody_pos)[3];
/* Position anchors for deformation brushes. These positions are modified by the brush and the

View File

@ -663,6 +663,7 @@ void BKE_pbvh_node_mark_update(PBVHNode *node);
void BKE_pbvh_node_mark_update_mask(PBVHNode *node);
void BKE_pbvh_node_mark_update_color(PBVHNode *node);
void BKE_pbvh_vert_tag_update_normal_visibility(PBVHNode *node);
void BKE_pbvh_node_mark_update_visibility(PBVHNode *node);
void BKE_pbvh_node_mark_rebuild_draw(PBVHNode *node);
void BKE_pbvh_node_mark_redraw(PBVHNode *node);
void BKE_pbvh_node_mark_normals_update(PBVHNode *node);

View File

@ -203,8 +203,6 @@ MAKE_ENUM(blend,"Blending Mode","Brush blending mode",IMB_BLEND_MIX,{\
MAKE_FLOAT(hardness,"Hardness","Brush falloff hardness",0.0f,0.0f,1.0f)
MAKE_FLOAT(tip_roundness,"Tip Roundness","",1.0f,0.0f,1.0f)
MAKE_BOOL(accumulate,"Accumulate","",false)
MAKE_BOOL_EX(show_origco,"Show OrigCo","",false,BRUSH_CHANNEL_INHERIT)
MAKE_BOOL_EX(save_temp_layers,"Save Temp Layers","Developer option; save temporary vertex attributes",false,BRUSH_CHANNEL_INHERIT)
MAKE_ENUM(direction,"Direction","",0,{\
{0, "ADD", "ADD", "Add", "Add effect of brush"},
{1, "SUBTRACT", "REMOVE", "Subtract", "Subtract effect of brush"},

View File

@ -2085,7 +2085,7 @@ void BKE_brush_channelset_read(BlendDataReader *reader, BrushChannelSet *chset)
ch->def = BKE_brush_builtin_channel_def_find(ch->idname);
if (!ch->def) {
printf("failed to find brush definition for %s\n", ch->idname);
//printf("failed to find brush definition for %s\n", ch->idname);
ch->def = BKE_brush_default_channel_def();
}
else {

View File

@ -1167,8 +1167,6 @@ void BKE_brush_builtin_patch(Brush *brush, int tool)
}
ADDCH(sharp_mode);
ADDCH(show_origco);
ADDCH(save_temp_layers);
ADDCH(use_surface_falloff);
@ -2151,9 +2149,6 @@ void BKE_brush_check_toolsettings(Sculpt *sd)
ADDCH(radius_unit);
ADDCH(unprojected_radius);
ADDCH(show_origco);
ADDCH(save_temp_layers);
ADDCH(smooth_strength_factor);
ADDCH(smooth_strength_projection);

View File

@ -1763,8 +1763,8 @@ static void sculpt_update_object(
ss->building_vp_handle = false;
ss->scene = scene;
if (sd->channels) {
ss->save_temp_layers = BRUSHSET_GET_INT(sd->channels, save_temp_layers, NULL);
if (sd->channels && scene->toolsettings) {
ss->save_temp_layers = scene->toolsettings->save_temp_layers;
}
ss->boundary_symmetry = (int)BKE_get_fset_boundary_symflag(ob);
@ -3277,8 +3277,9 @@ static bool sculpt_attribute_create(SculptSession *ss,
BM_data_layer_add_named(ss->bm, cdata, proptype, name);
int index = CustomData_get_named_layer_index(cdata, proptype, name);
if (!permanent) {
if (!permanent && !ss->save_temp_layers) {
cdata->layers[index].flag |= CD_FLAG_TEMPORARY | CD_FLAG_NOCOPY;
out->params.permanent = true;
}
out->data = nullptr;
@ -3309,7 +3310,8 @@ static bool sculpt_attribute_create(SculptSession *ss,
CustomData_add_layer_named(cdata, proptype, CD_SET_DEFAULT, nullptr, totelem, name);
int index = CustomData_get_named_layer_index(cdata, proptype, name);
if (!permanent) {
if (!permanent && !ss->save_temp_layers) {
out->params.permanent = true;
cdata->layers[index].flag |= CD_FLAG_TEMPORARY | CD_FLAG_NOCOPY;
}

View File

@ -649,6 +649,7 @@ static void pbvh_draw_args_init(PBVH *pbvh, PBVH_GPU_Args *args, PBVHNode *node)
args->flat_vcol_shading = pbvh->flat_vcol_shading;
args->show_orig = pbvh_show_orig_co;
args->updategen = node->updategen;
args->msculptverts = pbvh->msculptverts;
if (ELEM(pbvh->header.type, PBVH_FACES, PBVH_GRIDS)) {
args->hide_poly = pbvh->pdata ?
@ -1589,7 +1590,7 @@ void BKE_pbvh_set_flat_vcol_shading(PBVH *pbvh, bool value)
pbvh->flat_vcol_shading = value;
}
void pbvh_free_draw_buffers(PBVH *UNUSED(pbvh), PBVHNode *node)
ATTR_NO_OPT void pbvh_free_draw_buffers(PBVH *UNUSED(pbvh), PBVHNode *node)
{
if (node->draw_batches) {
DRW_pbvh_node_free(node->draw_batches);
@ -2033,6 +2034,12 @@ void BKE_pbvh_mark_rebuild_pixels(PBVH *pbvh)
}
}
void BKE_pbvh_node_mark_update_visibility(PBVHNode *node)
{
node->flag |= PBVH_UpdateVisibility | PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers |
PBVH_UpdateRedraw;
}
void BKE_pbvh_vert_tag_update_normal_visibility(PBVHNode *node)
{
node->flag |= PBVH_UpdateVisibility | PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers |

View File

@ -240,6 +240,8 @@ static void pbvh_bmesh_node_finalize(PBVH *pbvh,
PBVHNode *n = &pbvh->nodes[node_index];
bool has_visible = false;
n->draw_batches = NULL;
/* Create vert hash sets */
if (!n->bm_unique_verts) {
n->bm_unique_verts = BLI_table_gset_new("bm_unique_verts");
@ -409,6 +411,7 @@ static void pbvh_bmesh_node_split(
/* Initialize children */
PBVHNode *c1 = &pbvh->nodes[children], *c2 = &pbvh->nodes[children + 1];
c1->draw_batches = c2->draw_batches = NULL;
c1->depth = c2->depth = n->depth + 1;
c1->flag |= PBVH_Leaf;
@ -509,6 +512,7 @@ static void pbvh_bmesh_node_split(
if (n->draw_batches) {
DRW_pbvh_node_free(n->draw_batches);
n->draw_batches = NULL;
}
n->flag &= ~PBVH_Leaf;
@ -3311,6 +3315,7 @@ static void pbvh_bmesh_compact_tree(PBVH *bvh)
n3->bm_other_verts = BLI_table_gset_new("bm_other_verts");
n3->bm_faces = BLI_table_gset_new("bm_faces");
n3->tribuf = NULL;
n3->draw_batches = NULL;
}
else if ((n1->flag & PBVH_Delete) && (n2->flag & PBVH_Delete)) {
n->children_offset = 0;
@ -3322,6 +3327,7 @@ static void pbvh_bmesh_compact_tree(PBVH *bvh)
n->bm_other_verts = BLI_table_gset_new("bm_other_verts");
n->bm_faces = BLI_table_gset_new("bm_faces");
n->tribuf = NULL;
n->draw_batches = NULL;
}
}
}
@ -3692,7 +3698,7 @@ static void pbvh_bmesh_balance_tree(PBVH *pbvh)
MEM_SAFE_FREE(depthmap);
}
static void pbvh_bmesh_join_nodes(PBVH *bvh)
ATTR_NO_OPT static void pbvh_bmesh_join_nodes(PBVH *bvh)
{
if (bvh->totnode < 2) {
return;
@ -3706,13 +3712,13 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
for (int i = 0; i < bvh->totnode; i++) {
PBVHNode *n = bvh->nodes + i;
if (!(n->flag & PBVH_Delete)) {
if (0 && !(n->flag & PBVH_Delete)) {
if (!(n->flag & PBVH_Leaf)) {
PBVHNode *n1 = bvh->nodes + n->children_offset;
PBVHNode *n2 = bvh->nodes + n->children_offset + 1;
if ((n1->flag & PBVH_Delete) != (n2->flag & PBVH_Delete)) {
printf("un-deleting an empty node\n");
printf("%s: Un-deleting an empty node!\n", __func__);
PBVHNode *n3 = n1->flag & PBVH_Delete ? n1 : n2;
n3->flag = PBVH_Leaf | PBVH_UpdateTris;
@ -3720,6 +3726,7 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
n3->bm_other_verts = BLI_table_gset_new("bm_other_verts");
n3->bm_faces = BLI_table_gset_new("bm_faces");
n3->tribuf = NULL;
n3->draw_batches = NULL;
}
else if ((n1->flag & PBVH_Delete) && (n2->flag & PBVH_Delete)) {
n->children_offset = 0;
@ -3730,8 +3737,10 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
n->bm_unique_verts = BLI_table_gset_new("bm_unique_verts");
n->bm_other_verts = BLI_table_gset_new("bm_other_verts");
n->bm_faces = BLI_table_gset_new("bm_faces");
n->tribuf = NULL;
}
n->tribuf = NULL;
n->draw_batches = NULL;
}
}
@ -3741,6 +3750,20 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
int *map = MEM_callocN(sizeof(int) * bvh->totnode, "bmesh map temp");
for (int i = 0; i < bvh->totnode; i++) {
for (int j = 0; j < bvh->totnode; j++) {
if (i == j || !bvh->nodes[i].draw_batches) {
continue;
}
if (bvh->nodes[i].draw_batches == bvh->nodes[j].draw_batches) {
printf("%s: error %d %d\n", __func__, i, j);
bvh->nodes[j].draw_batches = NULL;
}
}
}
// build idx map for child offsets
int j = 0;
for (int i = 0; i < bvh->totnode; i++) {
@ -3749,7 +3772,7 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
if (!(n->flag & PBVH_Delete)) {
map[i] = j++;
}
else if (1) {
else {
if (n->layer_disp) {
MEM_freeN(n->layer_disp);
n->layer_disp = NULL;
@ -3796,7 +3819,7 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
for (int i = 0; i < bvh->totnode; i++) {
if (!(bvh->nodes[i].flag & PBVH_Delete)) {
if (bvh->nodes[i].children_offset >= bvh->totnode - 1) {
printf("error %i %i\n", i, bvh->nodes[i].children_offset);
printf("%s: error %i %i\n", __func__, i, bvh->nodes[i].children_offset);
continue;
}
@ -3804,7 +3827,8 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
int i2 = map[bvh->nodes[i].children_offset + 1];
if (bvh->nodes[i].children_offset >= bvh->totnode) {
printf("bad child node reference %d->%d, totnode: %d\n",
printf("%s: Bad child node reference %d->%d, totnode: %d\n",
__func__,
i,
bvh->nodes[i].children_offset,
bvh->totnode);
@ -3823,7 +3847,7 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
}
if (j != totnode) {
printf("pbvh error: %s", __func__);
printf("%s: pbvh error.", __func__);
}
if (bvh->totnode != j) {
@ -3842,7 +3866,7 @@ static void pbvh_bmesh_join_nodes(PBVH *bvh)
}
if (!n->bm_unique_verts) {
printf("ERROR!\n");
printf("%s: ERROR!\n", __func__);
n->bm_unique_verts = BLI_table_gset_new("bleh");
n->bm_other_verts = BLI_table_gset_new("bleh");
n->bm_faces = BLI_table_gset_new("bleh");

View File

@ -30,6 +30,7 @@ struct PBVHTriBuf;
struct CustomData;
struct MVert;
struct MEdge;
struct MSculptVert;
struct MLoop;
struct MPoly;
struct SubdivCCG;
@ -78,6 +79,7 @@ typedef struct PBVH_GPU_Args {
int cd_mask_layer;
struct PBVHTriBuf *tribuf, *tri_buffers;
int tot_tri_buffers, updategen;
struct MSculptVert *msculptverts;
} PBVH_GPU_Args;
typedef struct PBVHGPUFormat PBVHGPUFormat;

View File

@ -7,6 +7,8 @@
* \brief Simple API to draw debug shapes in the viewport.
*/
#define DRAW_DEBUG
#include "BKE_object.h"
#include "BLI_link_utils.h"
#include "GPU_batch.h"

View File

@ -155,6 +155,7 @@ struct PBVHBatches {
bool needs_tri_index = false;
int material_index = 0;
bool freed = false;
int count_faces(PBVH_GPU_Args *args)
{
@ -198,7 +199,7 @@ struct PBVHBatches {
}
}
~PBVHBatches()
ATTR_NO_OPT ~PBVHBatches()
{
for (PBVHBatch &batch : batches.values()) {
GPU_BATCH_DISCARD_SAFE(batch.tris);
@ -211,6 +212,8 @@ struct PBVHBatches {
GPU_INDEXBUF_DISCARD_SAFE(tri_index);
GPU_INDEXBUF_DISCARD_SAFE(lines_index);
freed = true;
}
string build_key(PBVHAttrReq *attrs, int attrs_num)
@ -528,10 +531,20 @@ struct PBVHBatches {
switch (vbo.type) {
case CD_PBVH_CO_TYPE:
foreach_faces(
[&](int /*buffer_i*/, int /*tri_i*/, int vertex_i, const MLoopTri * /*tri*/) {
*static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = args->mvert[vertex_i].co;
});
if (args->show_orig) {
foreach_faces(
[&](int /*buffer_i*/, int /*tri_i*/, int vertex_i, const MLoopTri * /*tri*/) {
MSculptVert *mv = args->msculptverts + vertex_i;
*static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = mv->origco;
});
}
else {
foreach_faces(
[&](int /*buffer_i*/, int /*tri_i*/, int vertex_i, const MLoopTri * /*tri*/) {
*static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = args->mvert[vertex_i].co;
});
}
break;
case CD_PBVH_NO_TYPE:
fill_vbo_normal_faces(vbo, args, foreach_faces, &access);
@ -907,8 +920,21 @@ struct PBVHBatches {
break;
}
case CD_PBVH_CO_TYPE:
foreach_bmesh(
[&](BMLoop *l) { *static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = l->v->co; });
if (args->show_orig) {
int cd_sculpt_vert = CustomData_get_offset(&args->bm->vdata, CD_DYNTOPO_VERT);
foreach_bmesh([&](BMLoop *l) {
MSculptVert *mv = static_cast<MSculptVert *>(
BM_ELEM_CD_GET_VOID_P(l->v, cd_sculpt_vert));
*static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = mv->origco;
});
}
else {
foreach_bmesh([&](BMLoop *l) {
*static_cast<float3 *>(GPU_vertbuf_raw_step(&access)) = l->v->co;
});
}
break;
case CD_PBVH_NO_TYPE:
@ -938,11 +964,26 @@ struct PBVHBatches {
break;
}
case CD_PBVH_FSET_TYPE: {
uchar3 white(UCHAR_MAX, UCHAR_MAX, UCHAR_MAX);
int cd_fset = CustomData_get_offset_named(
&args->bm->pdata, CD_PROP_INT32, ".sculpt_face_set");
foreach_bmesh([&](BMLoop * /*l*/) {
*static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = white;
});
if (cd_fset == -1) {
uchar3 white(UCHAR_MAX, UCHAR_MAX, UCHAR_MAX);
foreach_bmesh([&](BMLoop * /*l*/) {
*static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = white;
});
}
else {
foreach_bmesh([&](BMLoop *l) {
uchar face_set_color[4];
int fset = BM_ELEM_CD_GET_INT(l->f, cd_fset);
BKE_paint_face_set_overlay_color_get(fset, args->face_sets_color_seed, face_set_color);
*static_cast<uchar3 *>(GPU_vertbuf_raw_step(&access)) = face_set_color;
});
}
}
}
}

View File

@ -28,6 +28,8 @@
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "PIL_time.h"
#include "DNA_brush_types.h"
#include "DNA_customdata_types.h"
#include "DNA_listBase.h"
@ -55,8 +57,11 @@
#include "BKE_multires.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_pbvh.h"
#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_subsurf.h"
@ -96,6 +101,8 @@
#include "bmesh_log.h"
#include "bmesh_tools.h"
#include "UI_resources.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
@ -872,10 +879,8 @@ bool SCULPT_vertex_all_faces_visible_get(const SculptSession *ss, PBVHVertRef ve
return true;
}
case PBVH_BMESH: {
BMIter iter;
BMVert *v = (BMVert *)vertex.i;
BMEdge *e = v->e;
BMLoop *l;
int cd_hide_poly = ss->attrs.hide_poly->bmesh_cd_offset;
if (!e) {
@ -1139,7 +1144,6 @@ void sculpt_vertex_faceset_update_bmesh(SculptSession *ss, PBVHVertRef vert)
BMVert *v = (BMVert *)vert.i;
BMEdge *e = v->e;
bool ok = false;
const int cd_faceset_offset = ss->cd_faceset_offset;
const int cd_hide_poly = ss->attrs.hide_poly->bmesh_cd_offset;
if (!e) {
@ -1197,7 +1201,8 @@ void SCULPT_visibility_sync_all_from_faces(Object *ob)
case PBVH_BMESH: {
BMIter iter;
BMFace *f;
int cd_hide_poly = CustomData_get_layer_named(&ss->bm->pdata, CD_PROP_INT32, ".hide_poly");
int cd_hide_poly = CustomData_get_offset_named(&ss->bm->pdata, CD_PROP_INT32, ".hide_poly");
/* Hide all verts and edges attached to faces.*/
BM_ITER_MESH (f, &iter, ss->bm, BM_FACES_OF_MESH) {
@ -1461,7 +1466,6 @@ static void sculpt_vertex_neighbors_get_faces(const SculptSession *ss,
PBVHVertRef vertex,
SculptVertexNeighborIter *iter)
{
const MeshElemMap *vert_map = &ss->pmap->pmap[vertex.i];
iter->size = 0;
iter->num_duplicates = 0;
iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY;
@ -3854,7 +3858,7 @@ static void calc_cubic_uv_v3(const float cubic[4][3], const float co[3], float r
float start = t - dt;
float end = t;
float mid;
float mid = t;
for (int j = 0; j < binary_steps; j++) {
mid = (start + end) * 0.5f;
@ -5995,7 +5999,7 @@ void sculpt_combine_proxies(Sculpt *sd, Object *ob)
int totnode;
if (!ss->cache ||
!ss->cache->supports_gravity && sculpt_tool_is_proxy_used(brush->sculpt_tool)) {
(!ss->cache->supports_gravity && sculpt_tool_is_proxy_used(brush->sculpt_tool))) {
/* First line is tools that don't support proxies. */
return;
}
@ -7648,7 +7652,7 @@ bool SCULPT_cursor_geometry_info_update(bContext *C,
/* Update the active vertex of the SculptSession. */
ss->active_vertex = srd.active_vertex;
if (ss->pbvh && BKE_pbvh_type(ss->pbvh) == PBVH_BMESH && ss->active_vertex.i == 0) {
printf("%s: error!\n");
printf("%s: error!\n", __func__);
}
copy_v3_v3(out->active_vertex_co, SCULPT_active_vertex_co_get(ss));
@ -8306,7 +8310,7 @@ static void sculpt_stroke_update_step(bContext *C,
// bad debug global
extern bool pbvh_show_orig_co;
pbvh_show_orig_co = BRUSHSET_GET_INT(ss->cache->channels_final, show_origco, NULL);
pbvh_show_orig_co = ts->show_origco;
ss->cache->use_plane_trim = BRUSHSET_GET_INT(
ss->cache->channels_final, use_plane_trim, &ss->cache->input_mapping);
@ -8640,7 +8644,6 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent
BKE_sculpt_mask_layers_ensure(ob, mmd);
}
if (SCULPT_tool_is_face_sets(brush->sculpt_tool)) {
Mesh *mesh = BKE_object_get_original_mesh(ob);
ss->face_sets = BKE_sculpt_face_sets_ensure(ob);
}
@ -9544,7 +9547,8 @@ bool SCULPT_vertex_is_occluded(SculptSession *ss, PBVHVertRef vertex, bool origi
ED_view3d_project_float_v2_m4(ss->cache->vc->region, co, mouse, ss->cache->projection_mat);
int depth = SCULPT_raycast_init(ss->cache->vc, mouse, ray_end, ray_start, ray_normal, original);
float depth = SCULPT_raycast_init(
ss->cache->vc, mouse, ray_end, ray_start, ray_normal, original);
negate_v3(ray_normal);

View File

@ -13,6 +13,7 @@
#include "BLI_rand.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "BLI_hash.h"
#include "DNA_brush_types.h"
#include "DNA_customdata_types.h"
@ -29,6 +30,12 @@
#include "BKE_modifier.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_subdiv.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_kelvinlet.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"

View File

@ -37,6 +37,7 @@
#include "BKE_pbvh.h"
#include "BKE_pointcache.h"
#include "BKE_scene.h"
#include "BKE_mesh_mapping.h"
#include "DEG_depsgraph.h"

View File

@ -1535,7 +1535,7 @@ enum eSculptFaceSetEditMode {
SCULPT_FACE_SET_EDIT_FILL_COMPONENT = 6,
SCULPT_FACE_SET_EDIT_EXTRUDE = 7,
SCULPT_FACE_SET_EDIT_FAIR_ALL_TANGENCY = 8,
} eSculptFaceSetEditMode;
};
static EnumPropertyItem prop_sculpt_face_sets_edit_types[] = {
{

View File

@ -11,6 +11,8 @@
#include "BLI_math_color_blend.h"
#include "BLI_rand.h"
#include "BLI_task.h"
#include "BLI_hash.h"
#include "PIL_time.h"
#include "DNA_meshdata_types.h"

View File

@ -27,6 +27,8 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "UI_interface.h"
#include "bmesh.h"
#include <math.h>

View File

@ -9,8 +9,11 @@
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLI_array.h"
#include "BLI_alloca.h"
#include "BLI_gsqueue.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
@ -44,6 +47,7 @@
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "IMB_colormanagement.h"
@ -63,13 +67,18 @@
#include "paint_intern.h"
#include "sculpt_intern.h"
#include "RNA_prototypes.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_prototypes.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "GPU_immediate.h"
#include "GPU_state.h"
#include "GPU_vertex_buffer.h"
#include "GPU_vertex_format.h"
#include "bmesh.h"
#include "bmesh_log.h"
#include "bmesh_tools.h"
@ -1917,7 +1926,7 @@ static int sculpt_reveal_all_exec(bContext *C, wmOperator *op)
const int cd_mask = CustomData_get_offset(&ss->bm->vdata, CD_PAINT_MASK);
BM_ITER_MESH (v, &iter, ss->bm, BM_VERTS_OF_MESH) {
BM_log_vert_before_modified(ss->bm_log, v, cd_mask);
BM_log_vert_before_modified(ss->bm_log, v, cd_mask, true);
}
BM_ITER_MESH (f, &iter, ss->bm, BM_FACES_OF_MESH) {
BM_log_face_modified(ss->bm_log, f);

View File

@ -171,120 +171,6 @@ static bool sculpt_attribute_ref_equals(SculptAttrRef *a, SculptAttrRef *b);
static void sculpt_save_active_attribute(Object *ob, SculptAttrRef *attr);
static UndoSculpt *sculpt_undosys_step_get_nodes(UndoStep *us_p);
#ifdef SCULPT_UNDO_DEBUG
# ifdef _
# undef _
# endif
# define _(type) \
case type: \
return #type;
static char *undo_type_to_str(int type)
{
switch (type) {
_(SCULPT_UNDO_DYNTOPO_BEGIN)
_(SCULPT_UNDO_DYNTOPO_END)
_(SCULPT_UNDO_COORDS)
_(SCULPT_UNDO_GEOMETRY)
_(SCULPT_UNDO_DYNTOPO_SYMMETRIZE)
_(SCULPT_UNDO_FACE_SETS)
_(SCULPT_UNDO_HIDDEN)
_(SCULPT_UNDO_MASK)
_(SCULPT_UNDO_COLOR)
default:
return "unknown node type";
}
}
# undef _
static int nodeidgen = 1;
static void print_sculpt_node(Object *ob, SculptUndoNode *node)
{
printf(" %s:%s {applied=%d}\n", undo_type_to_str(node->type), node->idname, node->applied);
if (node->bm_entry) {
BM_log_print_entry(ob->sculpt ? ob->sculpt->bm : NULL, node->bm_entry);
}
}
static void print_sculpt_undo_step(Object *ob, UndoStep *us, UndoStep *active, int i)
{
SculptUndoNode *node;
if (us->type != BKE_UNDOSYS_TYPE_SCULPT) {
printf("%d %s (non-sculpt): '%s', type:%s, use_memfile_step:%s\n",
i,
us == active ? "->" : " ",
us->name,
us->type->name,
us->use_memfile_step ? "true" : "false");
return;
}
int id = -1;
SculptUndoStep *su = (SculptUndoStep *)us;
if (!su->id) {
su->id = nodeidgen++;
}
id = su->id;
printf("id=%d %s %d %s (use_memfile_step=%s)\n",
id,
us == active ? "->" : " ",
i,
us->name,
us->use_memfile_step ? "true" : "false");
if (us->type == BKE_UNDOSYS_TYPE_SCULPT) {
UndoSculpt *usculpt = sculpt_undosys_step_get_nodes(us);
for (node = usculpt->nodes.first; node; node = node->next) {
print_sculpt_node(ob, node);
}
}
}
void sculpt_undo_print_nodes(Object *ob, void *active)
{
printf("=================== Sculpt undo steps ==============\n");
UndoStack *ustack = ED_undo_stack_get();
UndoStep *us = ustack->steps.first;
if (active == NULL) {
active = ustack->step_active;
}
if (!us) {
return;
}
printf("\n");
if (ustack->step_init) {
printf("===Undo initialization stepB===\n");
print_sculpt_undo_step(ob, ustack->step_init, active, -1);
printf("===============\n");
}
int i = 0, act_i = -1;
for (; us; us = us->next, i++) {
if (active == us) {
act_i = i;
}
print_sculpt_undo_step(ob, us, active, i);
}
if (ustack->step_active) {
printf("\n\n==Active step:==\n");
print_sculpt_undo_step(ob, ustack->step_active, active, act_i);
}
}
#else
# define sculpt_undo_print_nodes(ob, active) while (0)
#endif
static void update_unode_bmesh_memsize(SculptUndoNode *unode);
static UndoSculpt *sculpt_undo_get_nodes(void);
void sculpt_undo_print_nodes(void *active);
@ -2613,7 +2499,7 @@ void SCULPT_undo_push_end_ex(struct Object *ob, const bool use_nested_undo)
sculpt_save_active_attribute(ob, &us->active_attr_end);
sculpt_save_active_attribute_color(ob, &us->active_color_end);
sculpt_undo_print_nodes(ob, NULL);
sculpt_undo_print_nodes(NULL);
}
/* -------------------------------------------------------------------- */

View File

@ -1598,7 +1598,9 @@ typedef struct ToolSettings {
/* Normal Editing */
float normal_vector[3];
char _pad6[4];
char save_temp_layers, show_origco;
char _pad6[2];
/* Custom Curve Profile for bevel tool:
* Temporary until there is a proper preset system that stores the profiles or maybe stores

View File

@ -3053,6 +3053,15 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
RNA_def_struct_ui_text(srna, "Tool Settings", "");
prop = RNA_def_property(srna, "save_temp_layers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "save_temp_layers", 1);
RNA_def_property_ui_text(prop, "Save Temp Layers", "");
prop = RNA_def_property(srna, "show_origco", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "show_origco", 1);
RNA_def_property_ui_text(prop, "Show Original", "");
prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Sculpt");
RNA_def_property_ui_text(prop, "Sculpt", "");