Sculpt-dev: fix cloth crash
* Fixed ss->totedges not being set correctly in all cases. Fixes crash in cloth brush. * Fix compile errors in alembic and fluid code. * Remove a couple of debug ATTR_NO_OPTs.
This commit is contained in:
parent
ae555c3219
commit
185ca2912f
|
@ -3319,7 +3319,7 @@ static Mesh *create_liquid_geometry(FluidDomainSettings *fds,
|
|||
|
||||
if (use_speedvectors) {
|
||||
CustomDataLayer *velocity_layer = BKE_id_attribute_new(
|
||||
&me->id, "velocity", CD_PROP_FLOAT3, CD_MASK_PROP_ALL, ATTR_DOMAIN_POINT, NULL);
|
||||
&me->id, "velocity", CD_PROP_FLOAT3, ATTR_DOMAIN_POINT, NULL);
|
||||
velarray = velocity_layer->data;
|
||||
}
|
||||
|
||||
|
|
|
@ -1754,6 +1754,8 @@ static void sculpt_update_object(Depsgraph *depsgraph,
|
|||
ss->totvert = me->totvert;
|
||||
ss->totpoly = me->totpoly;
|
||||
ss->totfaces = me->totpoly;
|
||||
ss->totloops = me->totloop;
|
||||
ss->totedges = me->totedge;
|
||||
ss->mvert = me->mvert;
|
||||
ss->medge = me->medge;
|
||||
ss->mpoly = me->mpoly;
|
||||
|
|
|
@ -1432,9 +1432,9 @@ bool BKE_pbvh_get_color_layer(const Mesh *me, CustomDataLayer **r_layer, Attribu
|
|||
return true;
|
||||
}
|
||||
|
||||
ATTR_NO_OPT static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
|
||||
const int n,
|
||||
const TaskParallelTLS *__restrict UNUSED(tls))
|
||||
static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
|
||||
const int n,
|
||||
const TaskParallelTLS *__restrict UNUSED(tls))
|
||||
{
|
||||
/* Create and update draw buffers. The functions called here must not
|
||||
* do any OpenGL calls. Flags are not cleared immediately, that happens
|
||||
|
|
|
@ -151,7 +151,7 @@ static void pbvh_vertex_color_get_bmesh(const PBVH &pbvh, SculptVertRef vertex,
|
|||
BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
|
||||
float temp[4];
|
||||
|
||||
T *ptr = static_cast<T*>(BM_ELEM_CD_GET_VOID_P(l, pbvh.cd_vcol_offset));
|
||||
T *ptr = static_cast<T *>(BM_ELEM_CD_GET_VOID_P(l, pbvh.cd_vcol_offset));
|
||||
to_float(*ptr, temp);
|
||||
|
||||
add_v4_v4(r_color, temp);
|
||||
|
@ -276,7 +276,7 @@ void BKE_pbvh_swap_colors(PBVH *pbvh,
|
|||
});
|
||||
}
|
||||
|
||||
ATTR_NO_OPT void BKE_pbvh_store_colors(PBVH *pbvh,
|
||||
void BKE_pbvh_store_colors(PBVH *pbvh,
|
||||
const int *indices,
|
||||
const int indices_num,
|
||||
float (*r_colors)[4])
|
||||
|
|
|
@ -7789,10 +7789,10 @@ static void sculpt_cache_dyntopo_settings(BrushChannelSet *chset,
|
|||
r_settings->constant_detail = BRUSHSET_GET_FLOAT(chset, dyntopo_constant_detail, input_data);
|
||||
};
|
||||
|
||||
ATTR_NO_OPT static void sculpt_stroke_update_step(bContext *C,
|
||||
wmOperator *UNUSED(op),
|
||||
struct PaintStroke *stroke,
|
||||
PointerRNA *itemptr)
|
||||
static void sculpt_stroke_update_step(bContext *C,
|
||||
wmOperator *UNUSED(op),
|
||||
struct PaintStroke *stroke,
|
||||
PointerRNA *itemptr)
|
||||
|
||||
{
|
||||
|
||||
|
@ -8864,6 +8864,7 @@ void SCULPT_fake_neighbors_free(Object *ob)
|
|||
void SCULPT_ensure_epmap(SculptSession *ss)
|
||||
{
|
||||
if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH && !ss->epmap) {
|
||||
|
||||
BKE_mesh_edge_poly_map_create(&ss->epmap,
|
||||
&ss->epmap_mem,
|
||||
ss->medge,
|
||||
|
|
|
@ -100,7 +100,8 @@
|
|||
#endif
|
||||
|
||||
typedef enum { CON_LENGTH, CON_BEND } ClothConstraintTypes;
|
||||
struct {
|
||||
|
||||
static struct {
|
||||
int type;
|
||||
int totelem;
|
||||
size_t size;
|
||||
|
@ -811,10 +812,6 @@ static void do_cloth_brush_build_constraints_task_cb_ex(
|
|||
const Brush *brush = data->brush;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
|
||||
if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
|
||||
SCULPT_ensure_epmap(ss);
|
||||
}
|
||||
|
||||
const int node_index = POINTER_AS_INT(BLI_ghash_lookup(data->cloth_sim->node_state_index, node));
|
||||
if (data->cloth_sim->node_state[node_index] != SCULPT_CLOTH_NODE_UNINITIALIZED) {
|
||||
/* The simulation already contains constraints for this node. */
|
||||
|
@ -2004,7 +2001,7 @@ static void cloth_brush_satisfy_constraints_task_cb(void *__restrict userdata,
|
|||
}
|
||||
}
|
||||
|
||||
void cloth_brush_satisfy_constraints(SculptSession *ss,
|
||||
static void cloth_brush_satisfy_constraints(SculptSession *ss,
|
||||
Brush *brush,
|
||||
SculptClothSimulation *cloth_sim)
|
||||
{
|
||||
|
@ -2261,6 +2258,7 @@ void SCULPT_cloth_brush_ensure_nodes_constraints(
|
|||
const float radius)
|
||||
{
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
|
||||
/* TODO: Multi-threaded needs to be disabled for this task until implementing the optimization of
|
||||
* storing the constraints per node. */
|
||||
|
@ -2272,6 +2270,10 @@ void SCULPT_cloth_brush_ensure_nodes_constraints(
|
|||
cloth_sim->created_length_constraints = BLI_edgeset_new("created length constraints");
|
||||
cloth_sim->created_bend_constraints = BLI_edgeset_new("created bend constraints");
|
||||
|
||||
if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
|
||||
SCULPT_ensure_epmap(ss);
|
||||
}
|
||||
|
||||
SculptThreadedTaskData build_constraints_data = {
|
||||
.sd = sd,
|
||||
.ob = ob,
|
||||
|
|
|
@ -654,7 +654,7 @@ static bool sculpt_sample_color_update_from_base(bContext *C,
|
|||
return true;
|
||||
}
|
||||
|
||||
ATTR_NO_OPT static int sculpt_sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int sculpt_sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
|
|
|
@ -100,7 +100,7 @@ static void do_color_smooth_task_cb_exec(void *__restrict userdata,
|
|||
BKE_pbvh_vertex_iter_end;
|
||||
}
|
||||
|
||||
ATTR_NO_OPT static void do_paint_brush_task_cb_ex(void *__restrict userdata,
|
||||
static void do_paint_brush_task_cb_ex(void *__restrict userdata,
|
||||
const int n,
|
||||
const TaskParallelTLS *__restrict tls)
|
||||
{
|
||||
|
|
|
@ -1765,7 +1765,7 @@ static void sculpt_undo_store_mask(Object *ob, SculptUndoNode *unode)
|
|||
BKE_pbvh_vertex_iter_end;
|
||||
}
|
||||
|
||||
ATTR_NO_OPT static void sculpt_undo_store_color(Object *ob, SculptUndoNode *unode)
|
||||
static void sculpt_undo_store_color(Object *ob, SculptUndoNode *unode)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
|
||||
|
|
|
@ -1009,7 +1009,7 @@ struct RaycastObjUserData {
|
|||
/**
|
||||
* \note Duplicate args here are documented at #snapObjectsRay
|
||||
*/
|
||||
ATTR_NO_OPT static void raycast_obj_fn(SnapObjectContext *sctx,
|
||||
static void raycast_obj_fn(SnapObjectContext *sctx,
|
||||
const struct SnapObjectParams *params,
|
||||
Object *ob_eval,
|
||||
const float obmat[4][4],
|
||||
|
@ -2495,7 +2495,7 @@ static short snapMesh(SnapObjectContext *sctx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
ATTR_NO_OPT static short snapEditMesh(SnapObjectContext *sctx,
|
||||
static short snapEditMesh(SnapObjectContext *sctx,
|
||||
const struct SnapObjectParams *params,
|
||||
Object *ob_eval,
|
||||
BMEditMesh *em,
|
||||
|
|
|
@ -458,7 +458,7 @@ static void read_velocity(const V3fArraySamplePtr &velocities,
|
|||
}
|
||||
|
||||
CustomDataLayer *velocity_layer = BKE_id_attribute_new(
|
||||
&config.mesh->id, "velocity", CD_PROP_FLOAT3, CD_MASK_PROP_ALL, ATTR_DOMAIN_POINT, nullptr);
|
||||
&config.mesh->id, "velocity", CD_PROP_FLOAT3, ATTR_DOMAIN_POINT, nullptr);
|
||||
float(*velocity)[3] = (float(*)[3])velocity_layer->data;
|
||||
|
||||
for (int i = 0; i < num_velocity_vectors; i++) {
|
||||
|
|
|
@ -1301,7 +1301,7 @@ static wmOperator *wm_operator_create(wmWindowManager *wm,
|
|||
* This isn't very nice but needed to redraw gizmos which are hidden while tweaking,
|
||||
* See #WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK for details.
|
||||
*/
|
||||
ATTR_NO_OPT static void wm_region_tag_draw_on_gizmo_delay_refresh_for_tweak(wmWindow *win, bScreen *screen)
|
||||
static void wm_region_tag_draw_on_gizmo_delay_refresh_for_tweak(wmWindow *win, bScreen *screen)
|
||||
{
|
||||
ED_screen_areas_iter (win, screen, area) {
|
||||
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
||||
|
|
Loading…
Reference in New Issue