WIP: Refactor: Move SculptSession from Object to ObjectRuntime #121230
|
@ -19,6 +19,7 @@ struct CurveCache;
|
|||
struct ID;
|
||||
struct Mesh;
|
||||
struct PoseBackup;
|
||||
struct SculptSession;
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
|
@ -144,6 +145,8 @@ struct ObjectRuntime {
|
|||
uint64_t last_update_transform = 0;
|
||||
uint64_t last_update_geometry = 0;
|
||||
uint64_t last_update_shading = 0;
|
||||
|
||||
SculptSession *sculpt;
|
||||
};
|
||||
|
||||
} // namespace blender::bke
|
||||
|
|
|
@ -576,8 +576,8 @@ static void mesh_calc_modifiers(Depsgraph *depsgraph,
|
|||
/* Sculpt can skip certain modifiers. */
|
||||
const bool has_multires = BKE_sculpt_multires_active(scene, ob) != nullptr;
|
||||
bool multires_applied = false;
|
||||
const bool sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt && !use_render;
|
||||
const bool sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm) && !use_render;
|
||||
const bool sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->runtime->sculpt && !use_render;
|
||||
const bool sculpt_dyntopo = (sculpt_mode && ob->runtime->sculpt->bm) && !use_render;
|
||||
|
||||
/* Modifier evaluation contexts for different types of modifiers. */
|
||||
ModifierApplyFlag apply_render = use_render ? MOD_APPLY_RENDER : ModifierApplyFlag(0);
|
||||
|
@ -1276,7 +1276,7 @@ static void mesh_build_data(Depsgraph *depsgraph,
|
|||
BLI_assert(mesh->key == nullptr || DEG_is_evaluated_id(&mesh->key->id));
|
||||
mesh_eval->key = mesh->key;
|
||||
|
||||
if ((ob->mode & OB_MODE_ALL_SCULPT) && ob->sculpt) {
|
||||
if ((ob->mode & OB_MODE_ALL_SCULPT) && ob->runtime->sculpt) {
|
||||
if (DEG_is_active(depsgraph)) {
|
||||
BKE_sculpt_update_object_after_eval(depsgraph, ob);
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ blender::Array<blender::float3> BKE_multires_create_deformed_base_mesh_vert_coor
|
|||
object_for_eval.runtime = &runtime;
|
||||
|
||||
object_for_eval.data = object->data;
|
||||
object_for_eval.sculpt = nullptr;
|
||||
object_for_eval.runtime->sculpt = nullptr;
|
||||
|
||||
const bool use_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
|
||||
ModifierEvalContext mesh_eval_context = {depsgraph, &object_for_eval, ModifierApplyFlag(0)};
|
||||
|
@ -393,11 +393,13 @@ void multires_mark_as_modified(Depsgraph *depsgraph, Object *object, MultiresMod
|
|||
|
||||
void multires_flush_sculpt_updates(Object *object)
|
||||
{
|
||||
if (object == nullptr || object->sculpt == nullptr || object->sculpt->pbvh == nullptr) {
|
||||
if (object == nullptr || object->runtime->sculpt == nullptr ||
|
||||
object->runtime->sculpt->pbvh == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SculptSession *sculpt_session = object->sculpt;
|
||||
SculptSession *sculpt_session = object->runtime->sculpt;
|
||||
if (BKE_pbvh_type(*sculpt_session->pbvh) != PBVH_GRIDS || !sculpt_session->multires.active ||
|
||||
sculpt_session->multires.modifier == nullptr)
|
||||
{
|
||||
|
@ -449,11 +451,11 @@ void multires_force_sculpt_rebuild(Object *object)
|
|||
using namespace blender;
|
||||
multires_flush_sculpt_updates(object);
|
||||
|
||||
if (object == nullptr || object->sculpt == nullptr) {
|
||||
if (object == nullptr || object->runtime->sculpt == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
SculptSession *ss = object->sculpt;
|
||||
SculptSession *ss = object->runtime->sculpt;
|
||||
bke::pbvh::free(ss->pbvh);
|
||||
}
|
||||
|
||||
|
@ -1196,7 +1198,7 @@ void multires_stitch_grids(Object *ob)
|
|||
if (ob == nullptr) {
|
||||
return;
|
||||
}
|
||||
SculptSession *sculpt_session = ob->sculpt;
|
||||
SculptSession *sculpt_session = ob->runtime->sculpt;
|
||||
if (sculpt_session == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -241,7 +241,6 @@ static void object_copy_data(Main *bmain,
|
|||
BKE_constraints_copy_ex(&ob_dst->constraints, &ob_src->constraints, flag_subdata, true);
|
||||
|
||||
ob_dst->mode = ob_dst->type != OB_GPENCIL_LEGACY ? OB_MODE_OBJECT : ob_dst->mode;
|
||||
ob_dst->sculpt = nullptr;
|
||||
|
||||
if (ob_src->pd) {
|
||||
ob_dst->pd = (PartDeflect *)MEM_dupallocN(ob_src->pd);
|
||||
|
@ -889,12 +888,9 @@ static void object_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
/* in case this value changes in future, clamp else we get undefined behavior */
|
||||
CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
|
||||
|
||||
if (ob->sculpt) {
|
||||
ob->sculpt = nullptr;
|
||||
if (BLO_read_data_is_undo(reader) && (ob->mode & OB_MODE_ALL_SCULPT)) {
|
||||
/* Only create data on undo, otherwise rely on editor mode switching. */
|
||||
if (BLO_read_data_is_undo(reader) && (ob->mode & OB_MODE_ALL_SCULPT)) {
|
||||
BKE_object_sculpt_data_create(ob);
|
||||
}
|
||||
BKE_object_sculpt_data_create(ob);
|
||||
}
|
||||
|
||||
BLO_read_struct(reader, PreviewImage, &ob->preview);
|
||||
|
@ -1871,17 +1867,17 @@ bool BKE_object_has_mode_data(const Object *ob, eObjectMode object_mode)
|
|||
}
|
||||
}
|
||||
else if (object_mode & OB_MODE_VERTEX_PAINT) {
|
||||
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) {
|
||||
if (ob->runtime->sculpt && (ob->runtime->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (object_mode & OB_MODE_WEIGHT_PAINT) {
|
||||
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) {
|
||||
if (ob->runtime->sculpt && (ob->runtime->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (object_mode & OB_MODE_SCULPT) {
|
||||
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) {
|
||||
if (ob->runtime->sculpt && (ob->runtime->sculpt->mode_type == OB_MODE_SCULPT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4079,9 +4075,9 @@ void BKE_object_handle_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
|
|||
|
||||
void BKE_object_sculpt_data_create(Object *ob)
|
||||
{
|
||||
BLI_assert((ob->sculpt == nullptr) && (ob->mode & OB_MODE_ALL_SCULPT));
|
||||
ob->sculpt = MEM_new<SculptSession>(__func__);
|
||||
ob->sculpt->mode_type = (eObjectMode)ob->mode;
|
||||
BLI_assert((ob->runtime->sculpt == nullptr) && (ob->mode & OB_MODE_ALL_SCULPT));
|
||||
ob->runtime->sculpt = MEM_new<SculptSession>(__func__);
|
||||
ob->runtime->sculpt->mode_type = (eObjectMode)ob->mode;
|
||||
}
|
||||
|
||||
bool BKE_object_obdata_texspace_get(Object *ob,
|
||||
|
@ -4884,6 +4880,8 @@ void BKE_object_runtime_reset_on_copy(Object *object, const int /*flag*/)
|
|||
|
||||
runtime->crazyspace_deform_imats = {};
|
||||
runtime->crazyspace_deform_cos = {};
|
||||
|
||||
runtime->sculpt = nullptr;
|
||||
}
|
||||
|
||||
void BKE_object_runtime_free_data(Object *object)
|
||||
|
|
|
@ -1396,7 +1396,7 @@ void BKE_sculptsession_free_vwpaint_data(SculptSession *ss)
|
|||
*/
|
||||
static void sculptsession_bm_to_me_update_data_only(Object *ob, bool reorder)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (ss->bm) {
|
||||
if (ob->data) {
|
||||
|
@ -1412,7 +1412,7 @@ static void sculptsession_bm_to_me_update_data_only(Object *ob, bool reorder)
|
|||
|
||||
void BKE_sculptsession_bm_to_me(Object *ob, bool reorder)
|
||||
{
|
||||
if (ob && ob->sculpt) {
|
||||
if (ob && ob->runtime->sculpt) {
|
||||
sculptsession_bm_to_me_update_data_only(ob, reorder);
|
||||
|
||||
/* Ensure the objects evaluated mesh doesn't hold onto arrays
|
||||
|
@ -1424,7 +1424,7 @@ void BKE_sculptsession_bm_to_me(Object *ob, bool reorder)
|
|||
static void sculptsession_free_pbvh(Object *object)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = object->sculpt;
|
||||
SculptSession *ss = object->runtime->sculpt;
|
||||
if (!ss) {
|
||||
return;
|
||||
}
|
||||
|
@ -1448,8 +1448,8 @@ static void sculptsession_free_pbvh(Object *object)
|
|||
|
||||
void BKE_sculptsession_bm_to_me_for_render(Object *object)
|
||||
{
|
||||
if (object && object->sculpt) {
|
||||
if (object->sculpt->bm) {
|
||||
if (object && object->runtime->sculpt) {
|
||||
if (object->runtime->sculpt->bm) {
|
||||
/* Ensure no points to old arrays are stored in DM
|
||||
*
|
||||
* Apparently, we could not use DEG_id_tag_update
|
||||
|
@ -1470,8 +1470,8 @@ void BKE_sculptsession_bm_to_me_for_render(Object *object)
|
|||
|
||||
void BKE_sculptsession_free(Object *ob)
|
||||
{
|
||||
if (ob && ob->sculpt) {
|
||||
SculptSession *ss = ob->sculpt;
|
||||
if (ob && ob->runtime->sculpt) {
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
BKE_sculpt_attribute_destroy_temporary_all(ob);
|
||||
|
||||
|
@ -1484,7 +1484,7 @@ void BKE_sculptsession_free(Object *ob)
|
|||
|
||||
MEM_delete(ss);
|
||||
|
||||
ob->sculpt = nullptr;
|
||||
ob->runtime->sculpt = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1529,7 +1529,7 @@ static MultiresModifierData *sculpt_multires_modifier_get(const Scene *scene,
|
|||
ModifierData *md;
|
||||
VirtualModifierData virtual_modifier_data;
|
||||
|
||||
if (ob->sculpt && ob->sculpt->bm) {
|
||||
if (ob->runtime->sculpt && ob->runtime->sculpt->bm) {
|
||||
/* Can't combine multires and dynamic topology. */
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1586,7 +1586,7 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
|
|||
Mesh *mesh = (Mesh *)ob->data;
|
||||
VirtualModifierData virtual_modifier_data;
|
||||
|
||||
if (ob->sculpt->bm || BKE_sculpt_multires_active(scene, ob)) {
|
||||
if (ob->runtime->sculpt->bm || BKE_sculpt_multires_active(scene, ob)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1629,7 +1629,7 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
|
|||
*/
|
||||
static void sculpt_update_persistent_base(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
ss->attrs.persistent_co = BKE_sculpt_attribute_get(
|
||||
ob, AttrDomain::Point, CD_PROP_FLOAT3, SCULPT_ATTRIBUTE_NAME(persistent_co));
|
||||
|
@ -1646,7 +1646,7 @@ static void sculpt_update_object(Depsgraph *depsgraph,
|
|||
{
|
||||
Scene *scene = DEG_get_input_scene(depsgraph);
|
||||
Sculpt *sd = scene->toolsettings->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh *mesh_orig = BKE_object_get_original_mesh(ob);
|
||||
Mesh *mesh_eval = BKE_object_get_evaluated_mesh(ob_eval);
|
||||
MultiresModifierData *mmd = sculpt_multires_modifier_get(scene, ob, true);
|
||||
|
@ -1854,7 +1854,7 @@ static void sculpt_update_object(Depsgraph *depsgraph,
|
|||
void BKE_sculpt_update_object_before_eval(Object *ob_eval)
|
||||
{
|
||||
/* Update before mesh evaluation in the dependency graph. */
|
||||
SculptSession *ss = ob_eval->sculpt;
|
||||
SculptSession *ss = ob_eval->runtime->sculpt;
|
||||
|
||||
if (ss && ss->building_vp_handle == false) {
|
||||
if (!ss->cache && !ss->filter_cache && !ss->expand_cache) {
|
||||
|
@ -1863,10 +1863,10 @@ void BKE_sculpt_update_object_before_eval(Object *ob_eval)
|
|||
* topology does not change in the meantime .. weak. */
|
||||
sculptsession_free_pbvh(ob_eval);
|
||||
|
||||
BKE_sculptsession_free_deformMats(ob_eval->sculpt);
|
||||
BKE_sculptsession_free_deformMats(ob_eval->runtime->sculpt);
|
||||
|
||||
/* In vertex/weight paint, force maps to be rebuilt. */
|
||||
BKE_sculptsession_free_vwpaint_data(ob_eval->sculpt);
|
||||
BKE_sculptsession_free_vwpaint_data(ob_eval->runtime->sculpt);
|
||||
}
|
||||
else if (ss->pbvh) {
|
||||
Vector<PBVHNode *> nodes = blender::bke::pbvh::search_gather(*ss->pbvh, {});
|
||||
|
@ -1909,8 +1909,8 @@ void BKE_sculpt_color_layer_create_if_needed(Object *object)
|
|||
DEG_id_tag_update(&orig_me->id, ID_RECALC_GEOMETRY_ALL_MODES);
|
||||
BKE_mesh_tessface_clear(orig_me);
|
||||
|
||||
if (object->sculpt && object->sculpt->pbvh) {
|
||||
BKE_pbvh_update_active_vcol(*object->sculpt->pbvh, orig_me);
|
||||
if (object->runtime->sculpt && object->runtime->sculpt->pbvh) {
|
||||
BKE_pbvh_update_active_vcol(*object->runtime->sculpt->pbvh, orig_me);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1926,7 +1926,7 @@ void BKE_sculpt_update_object_for_edit(Depsgraph *depsgraph, Object *ob_orig, bo
|
|||
void BKE_sculpt_hide_poly_pointer_update(Object &object)
|
||||
{
|
||||
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
|
||||
object.sculpt->hide_poly = static_cast<const bool *>(
|
||||
object.runtime->sculpt->hide_poly = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(&mesh.face_data, CD_PROP_BOOL, ".hide_poly"));
|
||||
}
|
||||
|
||||
|
@ -2054,16 +2054,17 @@ static bool check_sculpt_object_deformed(Object *object, const bool for_construc
|
|||
/* Active modifiers means extra deformation, which can't be handled correct
|
||||
* on birth of PBVH and sculpt "layer" levels, so use PBVH only for internal brush
|
||||
* stuff and show final evaluated mesh so user would see actual object shape. */
|
||||
deformed |= object->sculpt->deform_modifiers_active;
|
||||
deformed |= object->runtime->sculpt->deform_modifiers_active;
|
||||
|
||||
if (for_construction) {
|
||||
deformed |= object->sculpt->shapekey_active != nullptr;
|
||||
deformed |= object->runtime->sculpt->shapekey_active != nullptr;
|
||||
}
|
||||
else {
|
||||
/* As in case with modifiers, we can't synchronize deformation made against
|
||||
* PBVH and non-locked keyblock, so also use PBVH only for brushes and
|
||||
* final DM to give final result to user. */
|
||||
deformed |= object->sculpt->shapekey_active && (object->shapeflag & OB_SHAPE_LOCK) == 0;
|
||||
deformed |= object->runtime->sculpt->shapekey_active &&
|
||||
(object->shapeflag & OB_SHAPE_LOCK) == 0;
|
||||
}
|
||||
|
||||
return deformed;
|
||||
|
@ -2105,10 +2106,10 @@ static std::unique_ptr<PBVH> build_pbvh_for_dynamic_topology(Object *ob)
|
|||
{
|
||||
sculptsession_bmesh_add_layers(ob);
|
||||
|
||||
return pbvh::build_bmesh(ob->sculpt->bm,
|
||||
ob->sculpt->bm_log,
|
||||
ob->sculpt->attrs.dyntopo_node_id_vertex->bmesh_cd_offset,
|
||||
ob->sculpt->attrs.dyntopo_node_id_face->bmesh_cd_offset);
|
||||
return pbvh::build_bmesh(ob->runtime->sculpt->bm,
|
||||
ob->runtime->sculpt->bm_log,
|
||||
ob->runtime->sculpt->attrs.dyntopo_node_id_vertex->bmesh_cd_offset,
|
||||
ob->runtime->sculpt->attrs.dyntopo_node_id_face->bmesh_cd_offset);
|
||||
}
|
||||
|
||||
static std::unique_ptr<PBVH> build_pbvh_from_regular_mesh(Object *ob, const Mesh *me_eval_deform)
|
||||
|
@ -2138,24 +2139,26 @@ static std::unique_ptr<PBVH> build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_c
|
|||
PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
|
||||
{
|
||||
using namespace blender::bke;
|
||||
if (ob->sculpt == nullptr) {
|
||||
if (ob->runtime->sculpt == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (ob->sculpt->pbvh) {
|
||||
SculptSession &ss = *ob->runtime->sculpt;
|
||||
|
||||
if (ss.pbvh) {
|
||||
/* NOTE: It is possible that pointers to grids or other geometry data changed. Need to update
|
||||
* those pointers. */
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ob->sculpt->pbvh);
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss.pbvh);
|
||||
switch (pbvh_type) {
|
||||
case PBVH_FACES: {
|
||||
pbvh::update_mesh_pointers(*ob->sculpt->pbvh, BKE_object_get_original_mesh(ob));
|
||||
pbvh::update_mesh_pointers(*ss.pbvh, BKE_object_get_original_mesh(ob));
|
||||
break;
|
||||
}
|
||||
case PBVH_GRIDS: {
|
||||
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
Mesh *mesh_eval = static_cast<Mesh *>(object_eval->data);
|
||||
if (SubdivCCG *subdiv_ccg = mesh_eval->runtime->subdiv_ccg.get()) {
|
||||
BKE_sculpt_bvh_update_from_ccg(*ob->sculpt->pbvh, subdiv_ccg);
|
||||
BKE_sculpt_bvh_update_from_ccg(*ss.pbvh, subdiv_ccg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2164,44 +2167,44 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
|
|||
}
|
||||
}
|
||||
|
||||
BKE_pbvh_update_active_vcol(*ob->sculpt->pbvh, BKE_object_get_original_mesh(ob));
|
||||
BKE_pbvh_update_active_vcol(*ss.pbvh, BKE_object_get_original_mesh(ob));
|
||||
|
||||
return ob->sculpt->pbvh.get();
|
||||
return ss.pbvh.get();
|
||||
}
|
||||
|
||||
ob->sculpt->islands_valid = false;
|
||||
ss.islands_valid = false;
|
||||
|
||||
if (ob->sculpt->bm != nullptr) {
|
||||
if (ss.bm != nullptr) {
|
||||
/* Sculpting on a BMesh (dynamic-topology) gets a special PBVH. */
|
||||
ob->sculpt->pbvh = build_pbvh_for_dynamic_topology(ob);
|
||||
ss.pbvh = build_pbvh_for_dynamic_topology(ob);
|
||||
}
|
||||
else {
|
||||
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
Mesh *mesh_eval = static_cast<Mesh *>(object_eval->data);
|
||||
if (mesh_eval->runtime->subdiv_ccg != nullptr) {
|
||||
ob->sculpt->pbvh = build_pbvh_from_ccg(ob, mesh_eval->runtime->subdiv_ccg.get());
|
||||
ss.pbvh = build_pbvh_from_ccg(ob, mesh_eval->runtime->subdiv_ccg.get());
|
||||
}
|
||||
else if (ob->type == OB_MESH) {
|
||||
const Mesh *me_eval_deform = BKE_object_get_mesh_deform_eval(object_eval);
|
||||
ob->sculpt->pbvh = build_pbvh_from_regular_mesh(ob, me_eval_deform);
|
||||
ss.pbvh = build_pbvh_from_regular_mesh(ob, me_eval_deform);
|
||||
}
|
||||
}
|
||||
|
||||
sculpt_attribute_update_refs(ob, BKE_pbvh_type(*ob->sculpt->pbvh));
|
||||
return ob->sculpt->pbvh.get();
|
||||
sculpt_attribute_update_refs(ob, BKE_pbvh_type(*ss.pbvh));
|
||||
return ss.pbvh.get();
|
||||
}
|
||||
|
||||
PBVH *BKE_object_sculpt_pbvh_get(Object *object)
|
||||
{
|
||||
if (!object->sculpt) {
|
||||
if (!object->runtime->sculpt) {
|
||||
return nullptr;
|
||||
}
|
||||
return object->sculpt->pbvh.get();
|
||||
return object->runtime->sculpt->pbvh.get();
|
||||
}
|
||||
|
||||
bool BKE_object_sculpt_use_dyntopo(const Object *object)
|
||||
{
|
||||
return object->sculpt && object->sculpt->bm;
|
||||
return object->runtime->sculpt && object->runtime->sculpt->bm;
|
||||
}
|
||||
|
||||
void BKE_sculpt_bvh_update_from_ccg(PBVH &pbvh, SubdivCCG *subdiv_ccg)
|
||||
|
@ -2212,7 +2215,7 @@ void BKE_sculpt_bvh_update_from_ccg(PBVH &pbvh, SubdivCCG *subdiv_ccg)
|
|||
|
||||
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
if (ss == nullptr || ss->pbvh == nullptr || ss->mode_type != OB_MODE_SCULPT) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2264,7 +2267,7 @@ int BKE_sculptsession_vertex_count(const SculptSession *ss)
|
|||
*/
|
||||
static CustomData *sculpt_get_cdata(Object *ob, AttrDomain domain)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (ss->bm) {
|
||||
switch (domain) {
|
||||
|
@ -2299,7 +2302,7 @@ static CustomData *sculpt_get_cdata(Object *ob, AttrDomain domain)
|
|||
|
||||
static int sculpt_attr_elem_count_get(Object *ob, AttrDomain domain)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
switch (domain) {
|
||||
case AttrDomain::Point:
|
||||
|
@ -2441,7 +2444,7 @@ static bool sculpt_attribute_create(SculptSession *ss,
|
|||
|
||||
static bool sculpt_attr_update(Object *ob, SculptAttribute *attr, PBVHType pbvh_type)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
int elem_num = sculpt_attr_elem_count_get(ob, attr->domain);
|
||||
|
||||
bool bad = false;
|
||||
|
@ -2528,7 +2531,7 @@ static SculptAttribute *sculpt_alloc_attr(SculptSession *ss)
|
|||
static SculptAttribute *sculpt_attribute_get_ex(
|
||||
Object *ob, PBVHType pbvhtype, AttrDomain domain, eCustomDataType proptype, const char *name)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
/* See if attribute is cached in ss->temp_attributes. */
|
||||
SculptAttribute *attr = sculpt_get_cached_layer(ss, domain, proptype, name);
|
||||
|
||||
|
@ -2584,7 +2587,7 @@ SculptAttribute *BKE_sculpt_attribute_get(Object *ob,
|
|||
eCustomDataType proptype,
|
||||
const char *name)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
BLI_assert(ss->pbvh != nullptr);
|
||||
|
||||
return sculpt_attribute_get_ex(ob, BKE_pbvh_type(*ss->pbvh), domain, proptype, name);
|
||||
|
@ -2598,7 +2601,7 @@ static SculptAttribute *sculpt_attribute_ensure_ex(Object *ob,
|
|||
PBVHType pbvhtype,
|
||||
bool flat_array_for_bmesh)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
SculptAttribute *attr = sculpt_attribute_get_ex(ob, pbvhtype, domain, proptype, name);
|
||||
|
||||
if (attr) {
|
||||
|
@ -2631,26 +2634,27 @@ SculptAttribute *BKE_sculpt_attribute_ensure(Object *ob,
|
|||
SculptAttributeParams temp_params = *params;
|
||||
|
||||
return sculpt_attribute_ensure_ex(
|
||||
ob, domain, proptype, name, &temp_params, BKE_pbvh_type(*ob->sculpt->pbvh), true);
|
||||
ob, domain, proptype, name, &temp_params, BKE_pbvh_type(*ob->runtime->sculpt->pbvh), true);
|
||||
}
|
||||
|
||||
static void sculptsession_bmesh_attr_update_internal(Object *ob)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
sculptsession_bmesh_add_layers(ob);
|
||||
|
||||
if (ss->pbvh) {
|
||||
bke::pbvh::update_bmesh_offsets(*ss->pbvh,
|
||||
ob->sculpt->attrs.dyntopo_node_id_vertex->bmesh_cd_offset,
|
||||
ob->sculpt->attrs.dyntopo_node_id_face->bmesh_cd_offset);
|
||||
bke::pbvh::update_bmesh_offsets(
|
||||
*ss->pbvh,
|
||||
ob->runtime->sculpt->attrs.dyntopo_node_id_vertex->bmesh_cd_offset,
|
||||
ob->runtime->sculpt->attrs.dyntopo_node_id_face->bmesh_cd_offset);
|
||||
}
|
||||
}
|
||||
|
||||
static void sculptsession_bmesh_add_layers(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
SculptAttributeParams params = {0};
|
||||
|
||||
ss->attrs.dyntopo_node_id_vertex = sculpt_attribute_ensure_ex(
|
||||
|
@ -2674,7 +2678,7 @@ static void sculptsession_bmesh_add_layers(Object *ob)
|
|||
|
||||
void BKE_sculpt_attributes_destroy_temporary_stroke(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
for (int i = 0; i < SCULPT_MAX_ATTRIBUTES; i++) {
|
||||
SculptAttribute *attr = ss->temp_attributes + i;
|
||||
|
@ -2687,7 +2691,7 @@ void BKE_sculpt_attributes_destroy_temporary_stroke(Object *ob)
|
|||
|
||||
static void sculpt_attribute_update_refs(Object *ob, PBVHType pbvhtype)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
/* Run twice, in case sculpt_attr_update had to recreate a layer and messed up #BMesh offsets. */
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
@ -2713,7 +2717,7 @@ static void sculpt_attribute_update_refs(Object *ob, PBVHType pbvhtype)
|
|||
|
||||
void BKE_sculpt_attribute_destroy_temporary_all(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
for (int i = 0; i < SCULPT_MAX_ATTRIBUTES; i++) {
|
||||
SculptAttribute *attr = ss->temp_attributes + i;
|
||||
|
@ -2726,7 +2730,7 @@ void BKE_sculpt_attribute_destroy_temporary_all(Object *ob)
|
|||
|
||||
bool BKE_sculpt_attribute_destroy(Object *ob, SculptAttribute *attr)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
AttrDomain domain = attr->domain;
|
||||
|
||||
BLI_assert(attr->used);
|
||||
|
|
|
@ -707,7 +707,7 @@ void update_id_after_copy(const Depsgraph *depsgraph,
|
|||
Object *object_cow = (Object *)id_cow;
|
||||
const Object *object_orig = (const Object *)id_orig;
|
||||
object_cow->mode = object_orig->mode;
|
||||
object_cow->sculpt = object_orig->sculpt;
|
||||
object_cow->runtime->sculpt = object_orig->runtime->sculpt;
|
||||
object_cow->runtime->data_orig = (ID *)object_cow->data;
|
||||
if (object_cow->type == OB_ARMATURE) {
|
||||
const bArmature *armature_orig = (bArmature *)object_orig->data;
|
||||
|
@ -1007,7 +1007,7 @@ void deg_free_eval_copy_datablock(ID *id_cow)
|
|||
* due to mesh/curve data-block bound-box tagging dirty. */
|
||||
Object *ob_cow = (Object *)id_cow;
|
||||
ob_cow->data = nullptr;
|
||||
ob_cow->sculpt = nullptr;
|
||||
ob_cow->runtime->sculpt = nullptr;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -231,7 +231,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
|
|||
}
|
||||
}
|
||||
|
||||
if (G.debug_value == 889 && ob->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
|
||||
if (G.debug_value == 889 && ob->runtime->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
|
||||
int debug_node_nr = 0;
|
||||
DRW_debug_modelmat(ob->object_to_world().ptr());
|
||||
BKE_pbvh_draw_debug_cb(*BKE_object_sculpt_pbvh_get(ob), DRW_sculpt_debug_cb, &debug_node_nr);
|
||||
|
|
|
@ -835,7 +835,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
|
|||
bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
|
||||
!DRW_state_is_image_render();
|
||||
|
||||
if (ob->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
|
||||
if (ob->runtime->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
|
||||
BKE_pbvh_is_drawing_set(*BKE_object_sculpt_pbvh_get(ob), use_sculpt_pbvh);
|
||||
}
|
||||
|
||||
|
@ -909,7 +909,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
|
|||
}
|
||||
}
|
||||
|
||||
if (G.debug_value == 889 && ob->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
|
||||
if (G.debug_value == 889 && ob->runtime->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
|
||||
int debug_node_nr = 0;
|
||||
DRW_debug_modelmat(ob->object_to_world().ptr());
|
||||
BKE_pbvh_draw_debug_cb(
|
||||
|
|
|
@ -145,7 +145,7 @@ void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob)
|
|||
update = oedata->need_update;
|
||||
|
||||
/* Always update shadow buffers in sculpt modes. */
|
||||
update |= ob->sculpt != nullptr;
|
||||
update |= ob->runtime->sculpt != nullptr;
|
||||
|
||||
oedata->need_update = false;
|
||||
}
|
||||
|
|
|
@ -190,8 +190,8 @@ bool SyncModule::sync_sculpt(Object *ob,
|
|||
* of vertex color arrays from being sent to the GPU (e.g.
|
||||
* when switching from eevee to workbench).
|
||||
*/
|
||||
if (ob_ref.object->sculpt && ob_ref.object->sculpt->pbvh) {
|
||||
BKE_pbvh_is_drawing_set(*ob_ref.object->sculpt->pbvh, pbvh_draw);
|
||||
if (ob_ref.object->runtime->sculpt && ob_ref.object->runtime->sculpt->pbvh) {
|
||||
BKE_pbvh_is_drawing_set(*ob_ref.object->runtime->sculpt->pbvh, pbvh_draw);
|
||||
}
|
||||
|
||||
if (!pbvh_draw) {
|
||||
|
@ -249,7 +249,7 @@ bool SyncModule::sync_sculpt(Object *ob,
|
|||
|
||||
/* Use a valid bounding box. The PBVH module already does its own culling, but a valid */
|
||||
/* bounding box is still needed for directional shadow tile-map bounds computation. */
|
||||
const Bounds<float3> bounds = bke::pbvh::bounds_get(*ob_ref.object->sculpt->pbvh);
|
||||
const Bounds<float3> bounds = bke::pbvh::bounds_get(*ob_ref.object->runtime->sculpt->pbvh);
|
||||
const float3 center = math::midpoint(bounds.min, bounds.max);
|
||||
const float3 half_extent = bounds.max - center + inflate_bounds;
|
||||
inst_.manager->update_handle_bounds(res_handle, center, half_extent);
|
||||
|
|
|
@ -350,8 +350,8 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
|
|||
(is_preview && dupli_parent == draw_ctx->obact &&
|
||||
ob->type == OB_CURVES)) &&
|
||||
(draw_ctx->object_mode & OB_MODE_SCULPT_CURVES);
|
||||
const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != nullptr) &&
|
||||
(ob->sculpt->mode_type == OB_MODE_SCULPT);
|
||||
const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->runtime->sculpt != nullptr) &&
|
||||
(ob->runtime->sculpt->mode_type == OB_MODE_SCULPT);
|
||||
const bool has_surface = ELEM(ob->type,
|
||||
OB_MESH,
|
||||
OB_CURVES_LEGACY,
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "draw_cache_impl.hh"
|
||||
#include "overlay_private.hh"
|
||||
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_subdiv_ccg.hh"
|
||||
|
@ -37,7 +38,7 @@ void OVERLAY_sculpt_cache_populate(OVERLAY_Data *vedata, Object *ob)
|
|||
OVERLAY_PrivateData *pd = vedata->stl->pd;
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
blender::gpu::Batch *sculpt_overlays;
|
||||
PBVH *pbvh = ob->sculpt->pbvh.get();
|
||||
PBVH *pbvh = ob->runtime->sculpt->pbvh.get();
|
||||
|
||||
const bool use_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "BKE_global.hh"
|
||||
#include "BKE_mesh_types.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_particle.h"
|
||||
|
||||
|
@ -285,7 +286,8 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata,
|
|||
|
||||
/* Don't do that in edit Mesh mode, unless there is a modifier preview. */
|
||||
if (use_wire && (!is_mesh || (!is_edit_mode || has_edit_mesh_cage))) {
|
||||
const bool is_sculpt_mode = ((ob->mode & OB_MODE_SCULPT) != 0) && (ob->sculpt != nullptr);
|
||||
const bool is_sculpt_mode = ((ob->mode & OB_MODE_SCULPT) != 0) &&
|
||||
(ob->runtime->sculpt != nullptr);
|
||||
const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
|
||||
!DRW_state_is_image_render();
|
||||
const bool is_instance = (ob->base_flag & BASE_FROM_DUPLI);
|
||||
|
|
|
@ -127,9 +127,9 @@ class Instance {
|
|||
* of vertex color arrays from being sent to the GPU (e.g.
|
||||
* when switching from eevee to workbench).
|
||||
*/
|
||||
if (ob_ref.object->sculpt && ob_ref.object->sculpt->pbvh) {
|
||||
if (ob_ref.object->runtime->sculpt && ob_ref.object->runtime->sculpt->pbvh) {
|
||||
/* TODO(Miguel Pozo): Could this me moved to sculpt_batches_get()? */
|
||||
BKE_pbvh_is_drawing_set(*ob_ref.object->sculpt->pbvh, object_state.sculpt_pbvh);
|
||||
BKE_pbvh_is_drawing_set(*ob_ref.object->runtime->sculpt->pbvh, object_state.sculpt_pbvh);
|
||||
}
|
||||
|
||||
bool is_object_data_visible = (DRW_object_visibility_in_active_context(ob) &
|
||||
|
@ -155,7 +155,7 @@ class Instance {
|
|||
|
||||
if (is_object_data_visible) {
|
||||
if (object_state.sculpt_pbvh) {
|
||||
const Bounds<float3> bounds = bke::pbvh::bounds_get(*ob_ref.object->sculpt->pbvh);
|
||||
const Bounds<float3> bounds = bke::pbvh::bounds_get(*ob_ref.object->runtime->sculpt->pbvh);
|
||||
const float3 center = math::midpoint(bounds.min, bounds.max);
|
||||
const float3 half_extent = bounds.max - center;
|
||||
ResourceHandle handle = manager.resource_handle(ob_ref, nullptr, ¢er, &half_extent);
|
||||
|
|
|
@ -244,7 +244,8 @@ ObjectState::ObjectState(const SceneState &scene_state, Object *ob)
|
|||
}
|
||||
|
||||
if (sculpt_pbvh) {
|
||||
if (color_type == V3D_SHADING_TEXTURE_COLOR && BKE_pbvh_type(*ob->sculpt->pbvh) != PBVH_FACES)
|
||||
if (color_type == V3D_SHADING_TEXTURE_COLOR &&
|
||||
BKE_pbvh_type(*ob->runtime->sculpt->pbvh) != PBVH_FACES)
|
||||
{
|
||||
/* Force use of material color for sculpt. */
|
||||
color_type = V3D_SHADING_MATERIAL_COLOR;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "BKE_modifier.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_deform.h"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_subdiv_modifier.hh"
|
||||
|
@ -584,8 +585,8 @@ static void mesh_batch_cache_init(Object *object, Mesh *mesh)
|
|||
|
||||
cache->is_editmode = mesh->runtime->edit_mesh != nullptr;
|
||||
|
||||
if (object->sculpt && object->sculpt->pbvh) {
|
||||
cache->pbvh_is_drawing = BKE_pbvh_is_drawing(*object->sculpt->pbvh);
|
||||
if (object->runtime->sculpt && object->runtime->sculpt->pbvh) {
|
||||
cache->pbvh_is_drawing = BKE_pbvh_is_drawing(*object->runtime->sculpt->pbvh);
|
||||
}
|
||||
|
||||
if (cache->is_editmode == false) {
|
||||
|
@ -1503,10 +1504,10 @@ void DRW_mesh_batch_cache_create_requested(TaskGraph *task_graph,
|
|||
* Normal updates should be part of the brush loop and only run during the stroke when the
|
||||
* brush needs to sample the surface. The drawing code should only update the normals
|
||||
* per redraw when smooth shading is enabled. */
|
||||
const bool do_update_sculpt_normals = ob->sculpt && ob->sculpt->pbvh;
|
||||
const bool do_update_sculpt_normals = ob->runtime->sculpt && ob->runtime->sculpt->pbvh;
|
||||
if (do_update_sculpt_normals) {
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
bke::pbvh::update_normals(*ob->sculpt->pbvh, mesh->runtime->subdiv_ccg.get());
|
||||
bke::pbvh::update_normals(*ob->runtime->sculpt->pbvh, mesh->runtime->subdiv_ccg.get());
|
||||
}
|
||||
|
||||
cache.batch_ready |= batch_requested;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "BKE_image.h"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_volume.hh"
|
||||
|
@ -1328,7 +1329,7 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd)
|
|||
{
|
||||
using namespace blender;
|
||||
/* PBVH should always exist for non-empty meshes, created by depsgraph eval. */
|
||||
PBVH *pbvh = (scd->ob->sculpt) ? scd->ob->sculpt->pbvh.get() : nullptr;
|
||||
PBVH *pbvh = (scd->ob->runtime->sculpt) ? scd->ob->runtime->sculpt->pbvh.get() : nullptr;
|
||||
if (!pbvh) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_mesh_types.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -42,7 +43,7 @@ static Vector<SculptBatch> sculpt_batches_get_ex(const Object *ob,
|
|||
const Span<pbvh::AttributeRequest> attrs)
|
||||
{
|
||||
/* PBVH should always exist for non-empty meshes, created by depsgraph eval. */
|
||||
PBVH *pbvh = ob->sculpt ? ob->sculpt->pbvh.get() : nullptr;
|
||||
PBVH *pbvh = ob->runtime->sculpt ? ob->runtime->sculpt->pbvh.get() : nullptr;
|
||||
if (!pbvh) {
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_modifier.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_shrinkwrap.hh"
|
||||
|
||||
|
@ -46,7 +47,7 @@ static bool geometry_extract_poll(bContext *C)
|
|||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
if (ob != nullptr && ob->mode == OB_MODE_SCULPT) {
|
||||
if (ob->sculpt->bm) {
|
||||
if (ob->runtime->sculpt->bm) {
|
||||
CTX_wm_operator_poll_msg_set(C, "The geometry cannot be extracted with dyntopo activated");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ static bool ed_object_mode_generic_exit_ex(
|
|||
}
|
||||
}
|
||||
else if (ob->mode & OB_MODE_VERTEX_PAINT) {
|
||||
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) {
|
||||
if (ob->runtime->sculpt && (ob->runtime->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) {
|
||||
if (only_test) {
|
||||
return true;
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static bool ed_object_mode_generic_exit_ex(
|
|||
}
|
||||
}
|
||||
else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
|
||||
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) {
|
||||
if (ob->runtime->sculpt && (ob->runtime->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) {
|
||||
if (only_test) {
|
||||
return true;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ static bool ed_object_mode_generic_exit_ex(
|
|||
}
|
||||
}
|
||||
else if (ob->mode & OB_MODE_SCULPT) {
|
||||
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) {
|
||||
if (ob->runtime->sculpt && (ob->runtime->sculpt->mode_type == OB_MODE_SCULPT)) {
|
||||
if (only_test) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ static bool object_remesh_poll(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (ob->mode == OB_MODE_SCULPT && ob->sculpt->bm) {
|
||||
if (ob->mode == OB_MODE_SCULPT && ob->runtime->sculpt->bm) {
|
||||
CTX_wm_operator_poll_msg_set(C, "The remesher cannot run with dyntopo activated");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "DNA_workspace_types.h"
|
||||
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
|
||||
#include "WM_toolsystem.hh"
|
||||
|
@ -51,7 +52,7 @@ static bool paint_tool_shading_color_follows_last_used(blender::StringRef idname
|
|||
|
||||
void ED_paint_tool_update_sticky_shading_color(bContext *C, Object *ob)
|
||||
{
|
||||
if (ob == nullptr || ob->sculpt == nullptr) {
|
||||
if (ob == nullptr || ob->runtime->sculpt == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -64,12 +65,12 @@ void ED_paint_tool_update_sticky_shading_color(bContext *C, Object *ob)
|
|||
return;
|
||||
}
|
||||
|
||||
ob->sculpt->sticky_shading_color = paint_tool_uses_canvas(tref->idname);
|
||||
ob->runtime->sculpt->sticky_shading_color = paint_tool_uses_canvas(tref->idname);
|
||||
}
|
||||
|
||||
static bool paint_tool_shading_color_follows_last_used_tool(bContext *C, Object *ob)
|
||||
{
|
||||
if (ob == nullptr || ob->sculpt == nullptr) {
|
||||
if (ob == nullptr || ob->runtime->sculpt == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -107,7 +108,7 @@ eV3DShadingColorType ED_paint_shading_color_override(bContext *C,
|
|||
*/
|
||||
if (!ED_paint_tool_use_canvas(C, nullptr) &&
|
||||
!(paint_tool_shading_color_follows_last_used_tool(C, ob) &&
|
||||
ob->sculpt->sticky_shading_color))
|
||||
ob->runtime->sculpt->sticky_shading_color))
|
||||
{
|
||||
return orig_color_type;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "BKE_image.h"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
|
||||
#include "NOD_texture.h"
|
||||
|
@ -1344,7 +1345,7 @@ static bool paint_cursor_context_init(bContext *C,
|
|||
pcontext->outline_alpha = pcontext->brush->add_col[3];
|
||||
|
||||
Object *active_object = pcontext->vc.obact;
|
||||
pcontext->ss = active_object ? active_object->sculpt : nullptr;
|
||||
pcontext->ss = active_object ? active_object->runtime->sculpt : nullptr;
|
||||
|
||||
if (pcontext->ss && pcontext->ss->draw_faded_cursor) {
|
||||
pcontext->outline_alpha = 0.3f;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "BKE_context.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_multires.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_subdiv_ccg.hh"
|
||||
|
@ -57,7 +58,7 @@ namespace blender::ed::sculpt_paint::hide {
|
|||
|
||||
void sync_all_from_faces(Object &object)
|
||||
{
|
||||
SculptSession &ss = *object.sculpt;
|
||||
SculptSession &ss = *object.runtime->sculpt;
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
|
||||
SCULPT_topology_islands_invalidate(&ss);
|
||||
|
@ -150,8 +151,8 @@ void mesh_show_all(Object &object, const Span<PBVHNode *> nodes)
|
|||
void grids_show_all(Depsgraph &depsgraph, Object &object, const Span<PBVHNode *> nodes)
|
||||
{
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
PBVH &pbvh = *object.sculpt->pbvh;
|
||||
SubdivCCG &subdiv_ccg = *object.sculpt->subdiv_ccg;
|
||||
PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
SubdivCCG &subdiv_ccg = *object.runtime->sculpt->subdiv_ccg;
|
||||
const BitGroupVector<> &grid_hidden = subdiv_ccg.grid_hidden;
|
||||
bool any_changed = false;
|
||||
if (!grid_hidden.is_empty()) {
|
||||
|
@ -241,8 +242,8 @@ static void grid_hide_update(Depsgraph &depsgraph,
|
|||
const FunctionRef<void(const int, MutableBoundedBitSpan)> calc_hide)
|
||||
{
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
PBVH &pbvh = *object.sculpt->pbvh;
|
||||
SubdivCCG &subdiv_ccg = *object.sculpt->subdiv_ccg;
|
||||
PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
SubdivCCG &subdiv_ccg = *object.runtime->sculpt->subdiv_ccg;
|
||||
BitGroupVector<> &grid_hidden = BKE_subdiv_ccg_grid_hidden_ensure(subdiv_ccg);
|
||||
|
||||
bool any_changed = false;
|
||||
|
@ -437,7 +438,7 @@ static int hide_show_all_exec(bContext *C, wmOperator *op)
|
|||
/* End undo. */
|
||||
undo::push_end(ob);
|
||||
|
||||
SCULPT_topology_islands_invalidate(ob->sculpt);
|
||||
SCULPT_topology_islands_invalidate(ob->runtime->sculpt);
|
||||
tag_update_visibility(*C);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -475,8 +476,8 @@ static void partialvis_masked_update_grids(Depsgraph &depsgraph,
|
|||
const VisAction action,
|
||||
const Span<PBVHNode *> nodes)
|
||||
{
|
||||
PBVH &pbvh = *object.sculpt->pbvh;
|
||||
SubdivCCG &subdiv_ccg = *object.sculpt->subdiv_ccg;
|
||||
PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
SubdivCCG &subdiv_ccg = *object.runtime->sculpt->subdiv_ccg;
|
||||
|
||||
const bool value = action_to_hide(action);
|
||||
const CCGKey key = *BKE_pbvh_get_grid_key(pbvh);
|
||||
|
@ -555,7 +556,7 @@ static int hide_show_masked_exec(bContext *C, wmOperator *op)
|
|||
/* End undo. */
|
||||
undo::push_end(ob);
|
||||
|
||||
SCULPT_topology_islands_invalidate(ob->sculpt);
|
||||
SCULPT_topology_islands_invalidate(ob->runtime->sculpt);
|
||||
tag_update_visibility(*C);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -637,8 +638,8 @@ static void invert_visibility_grids(Depsgraph &depsgraph,
|
|||
const Span<PBVHNode *> nodes)
|
||||
{
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
PBVH &pbvh = *object.sculpt->pbvh;
|
||||
SubdivCCG &subdiv_ccg = *object.sculpt->subdiv_ccg;
|
||||
PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
SubdivCCG &subdiv_ccg = *object.runtime->sculpt->subdiv_ccg;
|
||||
BitGroupVector<> &grid_hidden = BKE_subdiv_ccg_grid_hidden_ensure(subdiv_ccg);
|
||||
|
||||
threading::parallel_for(nodes.index_range(), 1, [&](const IndexRange range) {
|
||||
|
@ -701,7 +702,7 @@ static int visibility_invert_exec(bContext *C, wmOperator *op)
|
|||
|
||||
undo::push_end(&object);
|
||||
|
||||
SCULPT_topology_islands_invalidate(object.sculpt);
|
||||
SCULPT_topology_islands_invalidate(object.runtime->sculpt);
|
||||
tag_update_visibility(*C);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -739,7 +740,7 @@ static void partialvis_gesture_update_mesh(gesture::GestureData &gesture_data)
|
|||
const VisAction action = operation->action;
|
||||
const Span<PBVHNode *> nodes = gesture_data.nodes;
|
||||
|
||||
PBVH &pbvh = *object->sculpt->pbvh;
|
||||
PBVH &pbvh = *object->runtime->sculpt->pbvh;
|
||||
Mesh *mesh = static_cast<Mesh *>(object->data);
|
||||
bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||
if (action == VisAction::Show && !attributes.contains(".hide_vert")) {
|
||||
|
@ -767,8 +768,8 @@ static void partialvis_gesture_update_grids(Depsgraph &depsgraph,
|
|||
const VisAction action = operation->action;
|
||||
const Span<PBVHNode *> nodes = gesture_data.nodes;
|
||||
|
||||
PBVH &pbvh = *object->sculpt->pbvh;
|
||||
SubdivCCG *subdiv_ccg = object->sculpt->subdiv_ccg;
|
||||
PBVH &pbvh = *object->runtime->sculpt->pbvh;
|
||||
SubdivCCG *subdiv_ccg = object->runtime->sculpt->subdiv_ccg;
|
||||
|
||||
const bool value = action_to_hide(action);
|
||||
const CCGKey key = *BKE_pbvh_get_grid_key(pbvh);
|
||||
|
@ -826,7 +827,7 @@ static void hide_show_apply_for_symmetry_pass(bContext &C, gesture::GestureData
|
|||
}
|
||||
static void hide_show_end(bContext &C, gesture::GestureData &gesture_data)
|
||||
{
|
||||
SCULPT_topology_islands_invalidate(gesture_data.vc.obact->sculpt);
|
||||
SCULPT_topology_islands_invalidate(gesture_data.vc.obact->runtime->sculpt);
|
||||
tag_update_visibility(C);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "BKE_layer.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_multires.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_subdiv_ccg.hh"
|
||||
|
@ -48,7 +49,7 @@
|
|||
namespace blender::ed::sculpt_paint::mask {
|
||||
Array<float> duplicate_mask(const Object &object)
|
||||
{
|
||||
const SculptSession &ss = *object.sculpt;
|
||||
const SculptSession &ss = *object.runtime->sculpt;
|
||||
switch (BKE_pbvh_type(*ss.pbvh)) {
|
||||
case PBVH_FACES: {
|
||||
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
|
||||
|
@ -266,7 +267,7 @@ static void fill_mask_grids(Main &bmain,
|
|||
const float value,
|
||||
const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SubdivCCG &subdiv_ccg = *object.sculpt->subdiv_ccg;
|
||||
SubdivCCG &subdiv_ccg = *object.runtime->sculpt->subdiv_ccg;
|
||||
|
||||
const CCGKey key = BKE_subdiv_ccg_key_top_level(subdiv_ccg);
|
||||
if (value == 0.0f && !key.has_mask) {
|
||||
|
@ -326,7 +327,7 @@ static void fill_mask_grids(Main &bmain,
|
|||
|
||||
static void fill_mask_bmesh(Object &object, const float value, const Span<PBVHNode *> nodes)
|
||||
{
|
||||
BMesh &bm = *object.sculpt->bm;
|
||||
BMesh &bm = *object.runtime->sculpt->bm;
|
||||
const int offset = CustomData_get_offset_named(&bm.vdata, CD_PROP_FLOAT, ".sculpt_mask");
|
||||
if (value == 0.0f && offset == -1) {
|
||||
return;
|
||||
|
@ -359,7 +360,7 @@ static void fill_mask_bmesh(Object &object, const float value, const Span<PBVHNo
|
|||
static void fill_mask(
|
||||
Main &bmain, const Scene &scene, Depsgraph &depsgraph, Object &object, const float value)
|
||||
{
|
||||
PBVH &pbvh = *object.sculpt->pbvh;
|
||||
PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(pbvh, {});
|
||||
switch (BKE_pbvh_type(pbvh)) {
|
||||
case PBVH_FACES:
|
||||
|
@ -409,7 +410,7 @@ static void invert_mask_grids(Main &bmain,
|
|||
Object &object,
|
||||
const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SubdivCCG &subdiv_ccg = *object.sculpt->subdiv_ccg;
|
||||
SubdivCCG &subdiv_ccg = *object.runtime->sculpt->subdiv_ccg;
|
||||
|
||||
MultiresModifierData &mmd = *BKE_sculpt_multires_active(&scene, &object);
|
||||
BKE_sculpt_mask_layers_ensure(&depsgraph, &bmain, &object, &mmd);
|
||||
|
@ -449,7 +450,7 @@ static void invert_mask_grids(Main &bmain,
|
|||
|
||||
static void invert_mask_bmesh(Object &object, const Span<PBVHNode *> nodes)
|
||||
{
|
||||
BMesh &bm = *object.sculpt->bm;
|
||||
BMesh &bm = *object.runtime->sculpt->bm;
|
||||
const int offset = CustomData_get_offset_named(&bm.vdata, CD_PROP_FLOAT, ".sculpt_mask");
|
||||
if (offset == -1) {
|
||||
BLI_assert_unreachable();
|
||||
|
@ -472,8 +473,8 @@ static void invert_mask_bmesh(Object &object, const Span<PBVHNode *> nodes)
|
|||
|
||||
static void invert_mask(Main &bmain, const Scene &scene, Depsgraph &depsgraph, Object &object)
|
||||
{
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(*object.sculpt->pbvh, {});
|
||||
switch (BKE_pbvh_type(*object.sculpt->pbvh)) {
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(*object.runtime->sculpt->pbvh, {});
|
||||
switch (BKE_pbvh_type(*object.runtime->sculpt->pbvh)) {
|
||||
case PBVH_FACES:
|
||||
invert_mask_mesh(object, nodes);
|
||||
break;
|
||||
|
@ -593,7 +594,7 @@ static void mask_gesture_apply_task(gesture::GestureData &gesture_data,
|
|||
const float new_mask = mask_flood_fill_get_new_value_for_elem(
|
||||
prevmask, mask_operation->mode, mask_operation->value);
|
||||
if (prevmask != new_mask) {
|
||||
SCULPT_mask_vert_set(BKE_pbvh_type(*ob->sculpt->pbvh), mask_write, new_mask, vd);
|
||||
SCULPT_mask_vert_set(BKE_pbvh_type(*ob->runtime->sculpt->pbvh), mask_write, new_mask, vd);
|
||||
redraw = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ bool brush_use_accumulate(const VPaint *vp)
|
|||
void init_stroke(Depsgraph *depsgraph, Object *ob)
|
||||
{
|
||||
BKE_sculpt_update_object_for_edit(depsgraph, ob, true);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
/* Ensure ss->cache is allocated. It will mostly be initialized in
|
||||
* vwpaint::update_cache_invariants and vwpaint::update_cache_variants.
|
||||
|
@ -219,9 +219,9 @@ void init_session(Depsgraph *depsgraph, Scene *scene, Object *ob, eObjectMode ob
|
|||
/* Create persistent sculpt mode data */
|
||||
BKE_sculpt_toolsettings_data_ensure(scene);
|
||||
|
||||
BLI_assert(ob->sculpt == nullptr);
|
||||
ob->sculpt = MEM_new<SculptSession>(__func__);
|
||||
ob->sculpt->mode_type = object_mode;
|
||||
BLI_assert(ob->runtime->sculpt == nullptr);
|
||||
ob->runtime->sculpt = MEM_new<SculptSession>(__func__);
|
||||
ob->runtime->sculpt->mode_type = object_mode;
|
||||
BKE_sculpt_update_object_for_edit(depsgraph, ob, true);
|
||||
|
||||
ensure_valid_pivot(ob, scene);
|
||||
|
@ -232,15 +232,15 @@ void init_session_data(const ToolSettings *ts, Object *ob)
|
|||
/* Create maps */
|
||||
SculptVertexPaintGeomMap *gmap = nullptr;
|
||||
if (ob->mode == OB_MODE_VERTEX_PAINT) {
|
||||
gmap = &ob->sculpt->mode.vpaint.gmap;
|
||||
BLI_assert(ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT);
|
||||
gmap = &ob->runtime->sculpt->mode.vpaint.gmap;
|
||||
BLI_assert(ob->runtime->sculpt->mode_type == OB_MODE_VERTEX_PAINT);
|
||||
}
|
||||
else if (ob->mode == OB_MODE_WEIGHT_PAINT) {
|
||||
gmap = &ob->sculpt->mode.wpaint.gmap;
|
||||
BLI_assert(ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT);
|
||||
gmap = &ob->runtime->sculpt->mode.wpaint.gmap;
|
||||
BLI_assert(ob->runtime->sculpt->mode_type == OB_MODE_WEIGHT_PAINT);
|
||||
}
|
||||
else {
|
||||
ob->sculpt->mode_type = (eObjectMode)0;
|
||||
ob->runtime->sculpt->mode_type = (eObjectMode)0;
|
||||
BLI_assert(0);
|
||||
return;
|
||||
}
|
||||
|
@ -253,14 +253,14 @@ void init_session_data(const ToolSettings *ts, Object *ob)
|
|||
/* Create average brush arrays */
|
||||
if (ob->mode == OB_MODE_WEIGHT_PAINT) {
|
||||
if (!vwpaint::brush_use_accumulate(ts->wpaint)) {
|
||||
if (ob->sculpt->mode.wpaint.alpha_weight == nullptr) {
|
||||
ob->sculpt->mode.wpaint.alpha_weight = (float *)MEM_callocN(
|
||||
if (ob->runtime->sculpt->mode.wpaint.alpha_weight == nullptr) {
|
||||
ob->runtime->sculpt->mode.wpaint.alpha_weight = (float *)MEM_callocN(
|
||||
mesh->verts_num * sizeof(float), __func__);
|
||||
}
|
||||
if (ob->sculpt->mode.wpaint.dvert_prev == nullptr) {
|
||||
ob->sculpt->mode.wpaint.dvert_prev = (MDeformVert *)MEM_callocN(
|
||||
if (ob->runtime->sculpt->mode.wpaint.dvert_prev == nullptr) {
|
||||
ob->runtime->sculpt->mode.wpaint.dvert_prev = (MDeformVert *)MEM_callocN(
|
||||
mesh->verts_num * sizeof(MDeformVert), __func__);
|
||||
MDeformVert *dv = ob->sculpt->mode.wpaint.dvert_prev;
|
||||
MDeformVert *dv = ob->runtime->sculpt->mode.wpaint.dvert_prev;
|
||||
for (int i = 0; i < mesh->verts_num; i++, dv++) {
|
||||
/* Use to show this isn't initialized, never apply to the mesh data. */
|
||||
dv->flag = 1;
|
||||
|
@ -268,11 +268,11 @@ void init_session_data(const ToolSettings *ts, Object *ob)
|
|||
}
|
||||
}
|
||||
else {
|
||||
MEM_SAFE_FREE(ob->sculpt->mode.wpaint.alpha_weight);
|
||||
if (ob->sculpt->mode.wpaint.dvert_prev != nullptr) {
|
||||
BKE_defvert_array_free_elems(ob->sculpt->mode.wpaint.dvert_prev, mesh->verts_num);
|
||||
MEM_freeN(ob->sculpt->mode.wpaint.dvert_prev);
|
||||
ob->sculpt->mode.wpaint.dvert_prev = nullptr;
|
||||
MEM_SAFE_FREE(ob->runtime->sculpt->mode.wpaint.alpha_weight);
|
||||
if (ob->runtime->sculpt->mode.wpaint.dvert_prev != nullptr) {
|
||||
BKE_defvert_array_free_elems(ob->runtime->sculpt->mode.wpaint.dvert_prev, mesh->verts_num);
|
||||
MEM_freeN(ob->runtime->sculpt->mode.wpaint.dvert_prev);
|
||||
ob->runtime->sculpt->mode.wpaint.dvert_prev = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ void init_session_data(const ToolSettings *ts, Object *ob)
|
|||
|
||||
Vector<PBVHNode *> pbvh_gather_generic(Object *ob, VPaint *wp, Brush *brush)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const bool use_normal = vwpaint::use_normal(wp);
|
||||
Vector<PBVHNode *> nodes;
|
||||
|
||||
|
@ -343,10 +343,10 @@ void mode_enter_generic(
|
|||
}
|
||||
|
||||
/* Create vertex/weight paint mode session data */
|
||||
if (ob->sculpt) {
|
||||
if (ob->sculpt->cache) {
|
||||
SCULPT_cache_free(ob->sculpt->cache);
|
||||
ob->sculpt->cache = nullptr;
|
||||
if (ob->runtime->sculpt) {
|
||||
if (ob->runtime->sculpt->cache) {
|
||||
SCULPT_cache_free(ob->runtime->sculpt->cache);
|
||||
ob->runtime->sculpt->cache = nullptr;
|
||||
}
|
||||
BKE_sculptsession_free(ob);
|
||||
}
|
||||
|
@ -384,9 +384,9 @@ void mode_exit_generic(Object *ob, const eObjectMode mode_flag)
|
|||
}
|
||||
|
||||
/* If the cache is not released by a cancel or a done, free it now. */
|
||||
if (ob->sculpt && ob->sculpt->cache) {
|
||||
SCULPT_cache_free(ob->sculpt->cache);
|
||||
ob->sculpt->cache = nullptr;
|
||||
if (ob->runtime->sculpt && ob->runtime->sculpt->cache) {
|
||||
SCULPT_cache_free(ob->runtime->sculpt->cache);
|
||||
ob->runtime->sculpt->cache = nullptr;
|
||||
}
|
||||
|
||||
BKE_sculptsession_free(ob);
|
||||
|
@ -509,7 +509,7 @@ void update_cache_variants(bContext *C, VPaint *vp, Object *ob, PointerRNA *ptr)
|
|||
{
|
||||
using namespace blender;
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
StrokeCache *cache = ss->cache;
|
||||
Brush *brush = BKE_paint_brush(&vp->paint);
|
||||
|
||||
|
@ -750,7 +750,7 @@ static void vertex_paint_init_stroke(Scene *scene, Depsgraph *depsgraph, Object
|
|||
{
|
||||
vwpaint::init_stroke(depsgraph, ob);
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
|
||||
/* Allocate scratch array for previous colors if needed. */
|
||||
|
@ -967,9 +967,9 @@ static VPaintData *vpaint_init_vpaint(bContext *C,
|
|||
|
||||
/* Create projection handle */
|
||||
if (vpd->is_texbrush) {
|
||||
ob->sculpt->building_vp_handle = true;
|
||||
ob->runtime->sculpt->building_vp_handle = true;
|
||||
vpd->vp_handle = ED_vpaint_proj_handle_create(depsgraph, scene, ob, &vpd->vertexcosnos);
|
||||
ob->sculpt->building_vp_handle = false;
|
||||
ob->runtime->sculpt->building_vp_handle = false;
|
||||
}
|
||||
|
||||
return vpd;
|
||||
|
@ -983,7 +983,7 @@ static bool vpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
|
|||
VPaint *vp = ts->vpaint;
|
||||
Brush *brush = BKE_paint_brush(&vp->paint);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
|
||||
/* context checks could be a poll() */
|
||||
|
@ -1021,9 +1021,9 @@ static void do_vpaint_brush_blur_loops(bContext *C,
|
|||
Span<PBVHNode *> nodes,
|
||||
GMutableSpan attribute)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const Brush *brush = ob->sculpt->cache->brush;
|
||||
const Brush *brush = ob->runtime->sculpt->cache->brush;
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
|
@ -1171,9 +1171,9 @@ static void do_vpaint_brush_blur_verts(bContext *C,
|
|||
Span<PBVHNode *> nodes,
|
||||
GMutableSpan attribute)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const Brush *brush = ob->sculpt->cache->brush;
|
||||
const Brush *brush = ob->runtime->sculpt->cache->brush;
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
|
@ -1307,7 +1307,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
Span<PBVHNode *> nodes,
|
||||
GMutableSpan attribute)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap;
|
||||
const StrokeCache *cache = ss->cache;
|
||||
|
@ -1317,7 +1317,7 @@ static void do_vpaint_brush_smear(bContext *C,
|
|||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||
|
||||
const Brush *brush = ob->sculpt->cache->brush;
|
||||
const Brush *brush = ob->runtime->sculpt->cache->brush;
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
GMutableSpan g_color_curr = vpd->smear.color_curr;
|
||||
GMutableSpan g_color_prev_smear = vpd->smear.color_prev;
|
||||
|
@ -1504,7 +1504,7 @@ static void calculate_average_color(VPaintData *vpd,
|
|||
const GSpan attribute,
|
||||
Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||
const SculptVertexPaintGeomMap *gmap = &ss->mode.vpaint.gmap;
|
||||
|
@ -1621,10 +1621,10 @@ static void vpaint_do_draw(bContext *C,
|
|||
Span<PBVHNode *> nodes,
|
||||
GMutableSpan attribute)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
|
||||
const Brush *brush = ob->sculpt->cache->brush;
|
||||
const Brush *brush = ob->runtime->sculpt->cache->brush;
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
|
||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||
|
@ -1801,7 +1801,7 @@ static void vpaint_paint_leaves(bContext *C,
|
|||
undo::push_node(*ob, node, undo::Type::Color);
|
||||
}
|
||||
|
||||
const Brush *brush = ob->sculpt->cache->brush;
|
||||
const Brush *brush = ob->runtime->sculpt->cache->brush;
|
||||
|
||||
switch ((eBrushVertexPaintTool)brush->vertexpaint_tool) {
|
||||
case VPAINT_TOOL_AVERAGE:
|
||||
|
@ -1833,7 +1833,7 @@ static void vpaint_do_paint(bContext *C,
|
|||
const int i,
|
||||
const float angle)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
ss->cache->radial_symmetry_pass = i;
|
||||
SCULPT_cache_calc_brushdata_symm(ss->cache, symm, axis, angle);
|
||||
|
||||
|
@ -1873,7 +1873,7 @@ static void vpaint_do_symmetrical_brush_actions(bContext *C,
|
|||
{
|
||||
Brush *brush = BKE_paint_brush(&vp->paint);
|
||||
Mesh *mesh = (Mesh *)ob->data;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
StrokeCache *cache = ss->cache;
|
||||
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
int i = 0;
|
||||
|
@ -1927,7 +1927,7 @@ static void vpaint_stroke_update_step(bContext *C,
|
|||
VPaint *vp = ts->vpaint;
|
||||
ViewContext *vc = &vpd->vc;
|
||||
Object *ob = vc->obact;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
vwpaint::update_cache_variants(C, vp, ob, itemptr);
|
||||
|
||||
|
@ -1973,7 +1973,7 @@ static void vpaint_stroke_done(const bContext *C, PaintStroke *stroke)
|
|||
|
||||
MEM_delete(vpd);
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (ss->cache && ss->cache->alt_smooth) {
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
|
@ -1985,8 +1985,8 @@ static void vpaint_stroke_done(const bContext *C, PaintStroke *stroke)
|
|||
|
||||
undo::push_end(ob);
|
||||
|
||||
SCULPT_cache_free(ob->sculpt->cache);
|
||||
ob->sculpt->cache = nullptr;
|
||||
SCULPT_cache_free(ob->runtime->sculpt->cache);
|
||||
ob->runtime->sculpt->cache = nullptr;
|
||||
}
|
||||
|
||||
static int vpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
@ -2004,8 +2004,8 @@ static int vpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
if (SCULPT_has_loop_colors(ob) && ob->sculpt->pbvh) {
|
||||
BKE_pbvh_ensure_node_loops(*ob->sculpt->pbvh);
|
||||
if (SCULPT_has_loop_colors(ob) && ob->runtime->sculpt->pbvh) {
|
||||
BKE_pbvh_ensure_node_loops(*ob->runtime->sculpt->pbvh);
|
||||
}
|
||||
|
||||
undo::push_begin_ex(ob, "Vertex Paint");
|
||||
|
@ -2044,9 +2044,9 @@ static int vpaint_exec(bContext *C, wmOperator *op)
|
|||
static void vpaint_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
if (ob->sculpt->cache) {
|
||||
SCULPT_cache_free(ob->sculpt->cache);
|
||||
ob->sculpt->cache = nullptr;
|
||||
if (ob->runtime->sculpt->cache) {
|
||||
SCULPT_cache_free(ob->runtime->sculpt->cache);
|
||||
ob->runtime->sculpt->cache = nullptr;
|
||||
}
|
||||
|
||||
paint_stroke_cancel(C, op, (PaintStroke *)op->customdata);
|
||||
|
@ -2244,7 +2244,7 @@ static int vertex_color_set_exec(bContext *C, wmOperator *op)
|
|||
BKE_sculpt_update_object_for_edit(CTX_data_ensure_evaluated_depsgraph(C), obact, true);
|
||||
|
||||
undo::push_begin(obact, op);
|
||||
Vector<PBVHNode *> nodes = blender::bke::pbvh::search_gather(*obact->sculpt->pbvh, {});
|
||||
Vector<PBVHNode *> nodes = blender::bke::pbvh::search_gather(*obact->runtime->sculpt->pbvh, {});
|
||||
for (PBVHNode *node : nodes) {
|
||||
undo::push_node(*obact, node, undo::Type::Color);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "BKE_deform.hh"
|
||||
#include "BKE_geometry_set.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
|
@ -312,7 +313,7 @@ static void transform_active_color(bContext *C,
|
|||
|
||||
undo::push_begin(obact, op);
|
||||
|
||||
Vector<PBVHNode *> nodes = blender::bke::pbvh::search_gather(*obact->sculpt->pbvh, {});
|
||||
Vector<PBVHNode *> nodes = blender::bke::pbvh::search_gather(*obact->runtime->sculpt->pbvh, {});
|
||||
for (PBVHNode *node : nodes) {
|
||||
undo::push_node(*obact, node, undo::Type::Color);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "BKE_mesh_mapping.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_deform.h"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_report.hh"
|
||||
|
||||
|
@ -616,7 +617,7 @@ static void do_weight_paint_vertex_single(
|
|||
}
|
||||
|
||||
if (!vwpaint::brush_use_accumulate(wp)) {
|
||||
MDeformVert *dvert_prev = ob->sculpt->mode.wpaint.dvert_prev;
|
||||
MDeformVert *dvert_prev = ob->runtime->sculpt->mode.wpaint.dvert_prev;
|
||||
MDeformVert *dv_prev = defweight_prev_init(dvert_prev, wpi->dvert.data(), index);
|
||||
if (index_mirr != -1) {
|
||||
defweight_prev_init(dvert_prev, wpi->dvert.data(), index_mirr);
|
||||
|
@ -772,7 +773,7 @@ static void do_weight_paint_vertex_multi(
|
|||
}
|
||||
|
||||
if (!vwpaint::brush_use_accumulate(wp)) {
|
||||
MDeformVert *dvert_prev = ob->sculpt->mode.wpaint.dvert_prev;
|
||||
MDeformVert *dvert_prev = ob->runtime->sculpt->mode.wpaint.dvert_prev;
|
||||
MDeformVert *dv_prev = defweight_prev_init(dvert_prev, wpi->dvert.data(), index);
|
||||
if (index_mirr != -1) {
|
||||
defweight_prev_init(dvert_prev, wpi->dvert.data(), index_mirr);
|
||||
|
@ -877,7 +878,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
|
|||
WPaintVGroupIndex vgroup_index;
|
||||
int defbase_tot, defbase_tot_sel;
|
||||
bool *defbase_sel;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
VPaint *vp = CTX_data_tool_settings(C)->wpaint;
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
|
||||
|
@ -1016,8 +1017,8 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
|
|||
wpd->precomputed_weight = (float *)MEM_mallocN(sizeof(float) * mesh->verts_num, __func__);
|
||||
}
|
||||
|
||||
if (ob->sculpt->mode.wpaint.dvert_prev != nullptr) {
|
||||
MDeformVert *dv = ob->sculpt->mode.wpaint.dvert_prev;
|
||||
if (ob->runtime->sculpt->mode.wpaint.dvert_prev != nullptr) {
|
||||
MDeformVert *dv = ob->runtime->sculpt->mode.wpaint.dvert_prev;
|
||||
for (int i = 0; i < mesh->verts_num; i++, dv++) {
|
||||
/* Use to show this isn't initialized, never apply to the mesh data. */
|
||||
dv->flag = 1;
|
||||
|
@ -1080,7 +1081,7 @@ static void do_wpaint_brush_blur_task(const Scene *scene,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||
const SculptVertexPaintGeomMap *gmap = &ss->mode.wpaint.gmap;
|
||||
|
@ -1175,7 +1176,7 @@ static void do_wpaint_brush_smear_task(const Scene *scene,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||
const SculptVertexPaintGeomMap *gmap = &ss->mode.wpaint.gmap;
|
||||
|
@ -1295,7 +1296,7 @@ static void do_wpaint_brush_draw_task(const Scene *scene,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||
|
||||
|
@ -1371,7 +1372,7 @@ static WPaintAverageAccum do_wpaint_brush_calc_average_weight(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
StrokeCache *cache = ss->cache;
|
||||
const PBVHType pbvh_type = BKE_pbvh_type(*ss->pbvh);
|
||||
const bool has_grids = (pbvh_type == PBVH_GRIDS);
|
||||
|
@ -1469,7 +1470,7 @@ static void wpaint_paint_leaves(bContext *C,
|
|||
Span<PBVHNode *> nodes)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const Brush *brush = ob->sculpt->cache->brush;
|
||||
const Brush *brush = ob->runtime->sculpt->cache->brush;
|
||||
|
||||
/* Use this so average can modify its weight without touching the brush. */
|
||||
float strength = BKE_brush_weight_get(scene, brush);
|
||||
|
@ -1701,7 +1702,7 @@ static void wpaint_do_paint(bContext *C,
|
|||
const int i,
|
||||
const float angle)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
ss->cache->radial_symmetry_pass = i;
|
||||
SCULPT_cache_calc_brushdata_symm(ss->cache, symm, axis, angle);
|
||||
|
||||
|
@ -1733,7 +1734,7 @@ static void wpaint_do_symmetrical_brush_actions(
|
|||
{
|
||||
Brush *brush = BKE_paint_brush(&wp->paint);
|
||||
Mesh *mesh = (Mesh *)ob->data;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
StrokeCache *cache = ss->cache;
|
||||
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
int i = 0;
|
||||
|
@ -1794,7 +1795,7 @@ static void wpaint_stroke_update_step(bContext *C,
|
|||
ViewContext *vc;
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
vwpaint::update_cache_variants(C, wp, ob, itemptr);
|
||||
|
||||
|
@ -1906,7 +1907,7 @@ static void wpaint_stroke_done(const bContext *C, PaintStroke *stroke)
|
|||
MEM_freeN(wpd);
|
||||
}
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (ss->cache->alt_smooth) {
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
|
@ -1930,8 +1931,8 @@ static void wpaint_stroke_done(const bContext *C, PaintStroke *stroke)
|
|||
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
|
||||
|
||||
SCULPT_cache_free(ob->sculpt->cache);
|
||||
ob->sculpt->cache = nullptr;
|
||||
SCULPT_cache_free(ob->runtime->sculpt->cache);
|
||||
ob->runtime->sculpt->cache = nullptr;
|
||||
}
|
||||
|
||||
static int wpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
@ -1980,9 +1981,9 @@ static int wpaint_exec(bContext *C, wmOperator *op)
|
|||
static void wpaint_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
if (ob->sculpt->cache) {
|
||||
SCULPT_cache_free(ob->sculpt->cache);
|
||||
ob->sculpt->cache = nullptr;
|
||||
if (ob->runtime->sculpt->cache) {
|
||||
SCULPT_cache_free(ob->runtime->sculpt->cache);
|
||||
ob->runtime->sculpt->cache = nullptr;
|
||||
}
|
||||
|
||||
paint_stroke_cancel(C, op, (PaintStroke *)op->customdata);
|
||||
|
|
|
@ -109,7 +109,7 @@ float sculpt_calc_radius(ViewContext *vc,
|
|||
|
||||
bool ED_sculpt_report_if_shape_key_is_locked(const Object *ob, ReportList *reports)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
BLI_assert(ss);
|
||||
|
||||
|
@ -932,7 +932,7 @@ PBVHVertRef SCULPT_nearest_vertex_get(Object *ob,
|
|||
{
|
||||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const float max_distance_sq = max_distance * max_distance;
|
||||
|
||||
|
@ -1208,7 +1208,7 @@ void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data,
|
|||
Object *ob,
|
||||
blender::ed::sculpt_paint::undo::Node *unode)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
BMesh *bm = ss->bm;
|
||||
|
||||
memset(data, 0, sizeof(*data));
|
||||
|
@ -1301,7 +1301,7 @@ bool stroke_is_dyntopo(const SculptSession *ss, const Brush *brush)
|
|||
|
||||
static void restore_mask(Object &object, const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
switch (BKE_pbvh_type(*ss->pbvh)) {
|
||||
case PBVH_FACES: {
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
|
@ -1365,7 +1365,7 @@ static void restore_mask(Object &object, const Span<PBVHNode *> nodes)
|
|||
|
||||
static void restore_color(Object &object, const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
const auto restore_generic = [&](PBVHNode *node, undo::Node *unode) {
|
||||
SculptOrigVertData orig_vert_data;
|
||||
SCULPT_orig_vert_data_unode_init(&orig_vert_data, &object, unode);
|
||||
|
@ -1411,7 +1411,7 @@ static void restore_color(Object &object, const Span<PBVHNode *> nodes)
|
|||
|
||||
static void restore_face_set(Object &object, const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
switch (BKE_pbvh_type(*ss->pbvh)) {
|
||||
case PBVH_FACES:
|
||||
case PBVH_GRIDS: {
|
||||
|
@ -1436,7 +1436,7 @@ static void restore_face_set(Object &object, const Span<PBVHNode *> nodes)
|
|||
|
||||
static void restore_position(Object &object, const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
switch (BKE_pbvh_type(*ss->pbvh)) {
|
||||
case PBVH_FACES: {
|
||||
MutableSpan positions = BKE_pbvh_get_vert_positions(*ss->pbvh);
|
||||
|
@ -1496,7 +1496,7 @@ static void restore_position(Object &object, const Span<PBVHNode *> nodes)
|
|||
|
||||
static void restore_from_undo_step(const Sculpt &sd, Object &object)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
const Brush *brush = BKE_paint_brush_for_read(&sd.paint);
|
||||
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(*ss->pbvh, {});
|
||||
|
@ -1540,7 +1540,7 @@ static void sculpt_extend_redraw_rect_previous(Object *ob, rcti *rect)
|
|||
* because redraw rectangle should be the same in both of
|
||||
* optimized PBVH draw function and 3d view redraw, if not -- some
|
||||
* mesh parts could disappear from screen (sergey). */
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (!ss->cache) {
|
||||
return;
|
||||
|
@ -1556,7 +1556,7 @@ static void sculpt_extend_redraw_rect_previous(Object *ob, rcti *rect)
|
|||
bool SCULPT_get_redraw_rect(ARegion *region, RegionView3D *rv3d, Object *ob, rcti *rect)
|
||||
{
|
||||
using namespace blender;
|
||||
PBVH *pbvh = ob->sculpt->pbvh.get();
|
||||
PBVH *pbvh = ob->runtime->sculpt->pbvh.get();
|
||||
if (!pbvh) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1875,7 +1875,7 @@ static void calc_area_normal_and_center_task(Object *ob,
|
|||
{
|
||||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
undo::Node *unode = nullptr;
|
||||
|
@ -2084,7 +2084,7 @@ void SCULPT_calc_area_center(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes, flo
|
|||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const bool has_bm_orco = ss->bm && dyntopo::stroke_is_dyntopo(ss, brush);
|
||||
int n;
|
||||
|
||||
|
@ -2136,7 +2136,7 @@ std::optional<float3> SCULPT_pbvh_calc_area_normal(const Brush *brush,
|
|||
{
|
||||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const bool has_bm_orco = ss->bm && dyntopo::stroke_is_dyntopo(ss, brush);
|
||||
|
||||
bool any_vertex_sampled = false;
|
||||
|
@ -2174,7 +2174,7 @@ void SCULPT_calc_area_normal_and_center(
|
|||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const bool has_bm_orco = ss->bm && dyntopo::stroke_is_dyntopo(ss, brush);
|
||||
int n;
|
||||
|
||||
|
@ -2647,7 +2647,7 @@ namespace blender::ed::sculpt_paint {
|
|||
|
||||
static Vector<PBVHNode *> sculpt_pbvh_gather_cursor_update(Object *ob, bool use_original)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float3 center = ss->cache ? ss->cache->location : ss->cursor_location;
|
||||
return bke::pbvh::search_gather(*ss->pbvh, [&](PBVHNode &node) {
|
||||
return node_in_sphere(node, center, ss->cursor_radius, use_original);
|
||||
|
@ -2658,7 +2658,7 @@ static Vector<PBVHNode *> sculpt_pbvh_gather_cursor_update(Object *ob, bool use_
|
|||
static Vector<PBVHNode *> sculpt_pbvh_gather_generic_intern(
|
||||
Object *ob, const Brush *brush, bool use_original, float radius_scale, PBVHNodeFlags flag)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHNodeFlags leaf_flag = PBVH_Leaf;
|
||||
if (flag & PBVH_TexLeaf) {
|
||||
|
@ -2719,7 +2719,7 @@ static Vector<PBVHNode *> sculpt_pbvh_gather_texpaint(Object *ob,
|
|||
static float3 calc_sculpt_normal(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
const SculptSession *ss = ob->sculpt;
|
||||
const SculptSession *ss = ob->runtime->sculpt;
|
||||
switch (brush->sculpt_plane) {
|
||||
case SCULPT_DISP_DIR_AREA:
|
||||
return SCULPT_calc_area_normal(sd, ob, nodes).value_or(float3(0));
|
||||
|
@ -2739,7 +2739,7 @@ static float3 calc_sculpt_normal(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
static void update_sculpt_normal(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
StrokeCache *cache = ob->sculpt->cache;
|
||||
StrokeCache *cache = ob->runtime->sculpt->cache;
|
||||
/* Grab brush does not update the sculpt normal during a stroke. */
|
||||
const bool update_normal =
|
||||
!(brush->flag & BRUSH_ORIGINAL_NORMAL) && !(brush->sculpt_tool == SCULPT_TOOL_GRAB) &&
|
||||
|
@ -2787,7 +2787,7 @@ static void calc_brush_local_mat(const float rotation,
|
|||
float local_mat[4][4],
|
||||
float local_mat_inv[4][4])
|
||||
{
|
||||
const StrokeCache *cache = ob->sculpt->cache;
|
||||
const StrokeCache *cache = ob->runtime->sculpt->cache;
|
||||
float tmat[4][4];
|
||||
float mat[4][4];
|
||||
float scale[4][4];
|
||||
|
@ -2877,7 +2877,7 @@ void SCULPT_tilt_effective_normal_get(const SculptSession *ss, const Brush *brus
|
|||
static void update_brush_local_mat(Sculpt *sd, Object *ob)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
StrokeCache *cache = ob->sculpt->cache;
|
||||
StrokeCache *cache = ob->runtime->sculpt->cache;
|
||||
|
||||
if (cache->mirror_symmetry_pass == 0 && cache->radial_symmetry_pass == 0) {
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
@ -3049,7 +3049,7 @@ bool SCULPT_tool_needs_all_pbvh_nodes(const Brush *brush)
|
|||
void SCULPT_calc_brush_plane(
|
||||
Sculpt *sd, Object *ob, Span<PBVHNode *> nodes, float r_area_no[3], float r_area_co[3])
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
zero_v3(r_area_co);
|
||||
|
@ -3199,7 +3199,7 @@ static void do_gravity_task(SculptSession *ss,
|
|||
static void do_gravity(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes, float bstrength)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
float offset[3];
|
||||
|
@ -3272,7 +3272,7 @@ static void sculpt_topology_update(Sculpt *sd,
|
|||
UnifiedPaintSettings * /*ups*/,
|
||||
PaintModeSettings * /*paint_mode_settings*/)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
/* Build a list of all nodes that are potentially within the brush's area of influence. */
|
||||
const bool use_original = sculpt_tool_needs_original(brush->sculpt_tool) ? true :
|
||||
|
@ -3332,7 +3332,7 @@ static void sculpt_topology_update(Sculpt *sd,
|
|||
|
||||
static void do_brush_action_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
bool need_coords = ss->cache->supports_gravity;
|
||||
|
||||
|
@ -3371,7 +3371,7 @@ static void do_brush_action(Sculpt *sd,
|
|||
UnifiedPaintSettings *ups,
|
||||
PaintModeSettings *paint_mode_settings)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Vector<PBVHNode *> nodes, texnodes;
|
||||
|
||||
/* Check for unsupported features. */
|
||||
|
@ -3688,7 +3688,7 @@ static void sculpt_combine_proxies_node(Object &object,
|
|||
const bool use_orco,
|
||||
PBVHNode &node)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
|
||||
float(*orco)[3] = nullptr;
|
||||
if (use_orco && !ss->bm) {
|
||||
|
@ -3734,7 +3734,7 @@ static void sculpt_combine_proxies_node(Object &object,
|
|||
|
||||
static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
if (!ss->cache->supports_gravity && sculpt_tool_is_proxy_used(brush->sculpt_tool)) {
|
||||
|
@ -3766,7 +3766,7 @@ void SCULPT_combine_transform_proxies(Sculpt *sd, Object *ob)
|
|||
{
|
||||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::gather_proxies(*ss->pbvh);
|
||||
|
||||
|
@ -3782,7 +3782,7 @@ void SCULPT_combine_transform_proxies(Sculpt *sd, Object *ob)
|
|||
*/
|
||||
static void sculpt_update_keyblock(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
/* Key-block update happens after handling deformation caused by modifiers,
|
||||
* so ss->orig_cos would be updated with new stroke. */
|
||||
|
@ -3798,7 +3798,7 @@ void SCULPT_flush_stroke_deform(Sculpt * /*sd*/, Object *ob, bool is_proxy_used)
|
|||
{
|
||||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (is_proxy_used && ss->deform_modifiers_active) {
|
||||
/* This brushes aren't using proxies, so sculpt_combine_proxies() wouldn't propagate needed
|
||||
|
@ -3911,7 +3911,7 @@ static void do_tiled(Sculpt *sd,
|
|||
PaintModeSettings *paint_mode_settings,
|
||||
BrushActionFunc action)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
StrokeCache *cache = ss->cache;
|
||||
const float radius = cache->radius;
|
||||
const Bounds<float3> bb = *BKE_object_boundbox_get(ob);
|
||||
|
@ -3978,7 +3978,7 @@ static void do_radial_symmetry(Sculpt *sd,
|
|||
const int axis,
|
||||
const float /*feather*/)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
for (int i = 1; i < sd->radial_symm[axis - 'X']; i++) {
|
||||
const float angle = 2.0f * M_PI * i / sd->radial_symm[axis - 'X'];
|
||||
|
@ -3994,7 +3994,7 @@ static void do_radial_symmetry(Sculpt *sd,
|
|||
*/
|
||||
static void sculpt_fix_noise_tear(Sculpt *sd, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
const MTex *mtex = BKE_brush_mask_texture_get(brush, OB_MODE_SCULPT);
|
||||
|
||||
|
@ -4010,7 +4010,7 @@ static void do_symmetrical_brush_actions(Sculpt *sd,
|
|||
PaintModeSettings *paint_mode_settings)
|
||||
{
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
StrokeCache *cache = ss->cache;
|
||||
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
||||
|
@ -4484,7 +4484,7 @@ static bool sculpt_needs_delta_for_tip_orientation(Brush *brush)
|
|||
|
||||
static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Brush *brush)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
StrokeCache *cache = ss->cache;
|
||||
const float mval[2] = {
|
||||
cache->mouse_event[0],
|
||||
|
@ -4691,7 +4691,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, Po
|
|||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
StrokeCache *cache = ss->cache;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
|
@ -4820,7 +4820,7 @@ static bool sculpt_needs_connectivity_info(const Sculpt *sd,
|
|||
void SCULPT_stroke_modifiers_check(const bContext *C, Object *ob, const Brush *brush)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
|
||||
|
@ -4951,7 +4951,8 @@ float SCULPT_raycast_init(ViewContext *vc,
|
|||
ED_view3d_win_to_origin(vc->region, mval, ray_start);
|
||||
mul_m4_v3(obimat, ray_start);
|
||||
|
||||
bke::pbvh::clip_ray_ortho(*ob->sculpt->pbvh, original, ray_start, ray_end, ray_normal);
|
||||
bke::pbvh::clip_ray_ortho(
|
||||
*ob->runtime->sculpt->pbvh, original, ray_start, ray_end, ray_normal);
|
||||
|
||||
dist = len_v3v3(ray_start, ray_end);
|
||||
}
|
||||
|
@ -4978,7 +4979,7 @@ bool SCULPT_cursor_geometry_info_update(bContext *C,
|
|||
ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
ob = vc.obact;
|
||||
ss = ob->sculpt;
|
||||
ss = ob->runtime->sculpt;
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
const Base *base = CTX_data_active_base(C);
|
||||
|
@ -4996,7 +4997,7 @@ bool SCULPT_cursor_geometry_info_update(bContext *C,
|
|||
|
||||
SculptRaycastData srd{};
|
||||
srd.original = original;
|
||||
srd.ss = ob->sculpt;
|
||||
srd.ss = ob->runtime->sculpt;
|
||||
srd.hit = false;
|
||||
if (BKE_pbvh_type(*ss->pbvh) == PBVH_FACES) {
|
||||
const Mesh &mesh = *static_cast<const Mesh *>(ob->data);
|
||||
|
@ -5131,7 +5132,7 @@ bool SCULPT_stroke_get_location_ex(bContext *C,
|
|||
|
||||
ob = vc.obact;
|
||||
|
||||
ss = ob->sculpt;
|
||||
ss = ob->runtime->sculpt;
|
||||
cache = ss->cache;
|
||||
original = force_original || ((cache) ? !cache->accum : false);
|
||||
|
||||
|
@ -5149,7 +5150,7 @@ bool SCULPT_stroke_get_location_ex(bContext *C,
|
|||
bool hit = false;
|
||||
{
|
||||
SculptRaycastData srd;
|
||||
srd.ss = ob->sculpt;
|
||||
srd.ss = ob->runtime->sculpt;
|
||||
srd.ray_start = ray_start;
|
||||
srd.ray_normal = ray_normal;
|
||||
srd.hit = false;
|
||||
|
@ -5185,7 +5186,7 @@ bool SCULPT_stroke_get_location_ex(bContext *C,
|
|||
|
||||
SculptFindNearestToRayData srd{};
|
||||
srd.original = original;
|
||||
srd.ss = ob->sculpt;
|
||||
srd.ss = ob->runtime->sculpt;
|
||||
srd.hit = false;
|
||||
if (BKE_pbvh_type(*ss->pbvh) == PBVH_FACES) {
|
||||
const Mesh &mesh = *static_cast<const Mesh *>(ob->data);
|
||||
|
@ -5242,7 +5243,7 @@ static void sculpt_brush_stroke_init(bContext *C)
|
|||
Object *ob = CTX_data_active_object(C);
|
||||
ToolSettings *tool_settings = CTX_data_tool_settings(C);
|
||||
Sculpt *sd = tool_settings->sculpt;
|
||||
SculptSession *ss = CTX_data_active_object(C)->sculpt;
|
||||
SculptSession *ss = CTX_data_active_object(C)->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
view3d_operator_needs_opengl(C);
|
||||
|
@ -5266,7 +5267,7 @@ static void sculpt_brush_stroke_init(bContext *C)
|
|||
static void sculpt_restore_mesh(Sculpt *sd, Object *ob)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
/* For the cloth brush it makes more sense to not restore the mesh state to keep running the
|
||||
|
@ -5295,7 +5296,7 @@ void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags)
|
|||
using namespace blender;
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
MultiresModifierData *mmd = ss->multires.modifier;
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
|
@ -5379,7 +5380,7 @@ void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags)
|
|||
mesh->tag_positions_changed();
|
||||
}
|
||||
|
||||
mesh->bounds_set_eager(bke::pbvh::bounds_get(*ob->sculpt->pbvh));
|
||||
mesh->bounds_set_eager(bke::pbvh::bounds_get(*ob->runtime->sculpt->pbvh));
|
||||
if (ob->runtime->bounds_eval) {
|
||||
ob->runtime->bounds_eval = mesh->bounds_min_max();
|
||||
}
|
||||
|
@ -5394,7 +5395,7 @@ void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType up
|
|||
* expensive depsgraph tag to update geometry. */
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
RegionView3D *current_rv3d = CTX_wm_region_view3d(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
|
||||
/* Always needed for linked duplicates. */
|
||||
|
@ -5544,7 +5545,7 @@ static bool sculpt_stroke_test_start(bContext *C, wmOperator *op, const float mv
|
|||
* only 'location', see: #52195. */
|
||||
if (((op->flag & OP_IS_INVOKE) == 0) || (mval == nullptr) || over_mesh(C, op, mval)) {
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
ToolSettings *tool_settings = CTX_data_tool_settings(C);
|
||||
|
@ -5585,7 +5586,7 @@ static void sculpt_stroke_update_step(bContext *C,
|
|||
UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
ToolSettings *tool_settings = CTX_data_tool_settings(C);
|
||||
StrokeCache *cache = ss->cache;
|
||||
|
@ -5671,7 +5672,7 @@ static void sculpt_brush_exit_tex(Sculpt *sd)
|
|||
static void sculpt_stroke_done(const bContext *C, PaintStroke * /*stroke*/)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
ToolSettings *tool_settings = CTX_data_tool_settings(C);
|
||||
|
||||
|
@ -5741,10 +5742,10 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (SCULPT_tool_is_paint(brush->sculpt_tool) &&
|
||||
!SCULPT_handles_colors_report(ob->sculpt, op->reports))
|
||||
!SCULPT_handles_colors_report(ob->runtime->sculpt, op->reports))
|
||||
{
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -5814,7 +5815,7 @@ static void sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
|
|||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
|
@ -5957,7 +5958,7 @@ static void do_fake_neighbor_search_task(SculptSession *ss,
|
|||
|
||||
static PBVHVertRef fake_neighbor_search(Object *ob, const PBVHVertRef vertex, float max_distance)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const float3 center = SCULPT_vertex_co_get(ss, vertex);
|
||||
const float max_distance_sq = max_distance * max_distance;
|
||||
|
@ -6012,7 +6013,7 @@ struct SculptTopologyIDFloodFillData {
|
|||
void SCULPT_boundary_info_ensure(Object *object)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = object->sculpt;
|
||||
SculptSession *ss = object->runtime->sculpt;
|
||||
if (!ss->vertex_info.boundary.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -6036,7 +6037,7 @@ void SCULPT_boundary_info_ensure(Object *object)
|
|||
void SCULPT_fake_neighbors_ensure(Object *ob, const float max_dist)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
/* Fake neighbors were already initialized with the same distance, so no need to be
|
||||
|
@ -6067,14 +6068,14 @@ void SCULPT_fake_neighbors_ensure(Object *ob, const float max_dist)
|
|||
|
||||
void SCULPT_fake_neighbors_enable(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
BLI_assert(ss->fake_neighbors.fake_neighbor_index != nullptr);
|
||||
ss->fake_neighbors.use_fake_neighbors = true;
|
||||
}
|
||||
|
||||
void SCULPT_fake_neighbors_disable(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
BLI_assert(ss->fake_neighbors.fake_neighbor_index != nullptr);
|
||||
ss->fake_neighbors.use_fake_neighbors = false;
|
||||
}
|
||||
|
@ -6082,7 +6083,7 @@ void SCULPT_fake_neighbors_disable(Object *ob)
|
|||
void SCULPT_fake_neighbors_free(Object *ob)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
sculpt_pose_fake_neighbors_free(ss);
|
||||
}
|
||||
|
||||
|
@ -6165,13 +6166,13 @@ void SCULPT_stroke_id_next(Object *ob)
|
|||
/* Manually wrap in int32 space to avoid tripping up undefined behavior
|
||||
* sanitizers.
|
||||
*/
|
||||
ob->sculpt->stroke_id = uchar((int(ob->sculpt->stroke_id) + 1) & 255);
|
||||
ob->runtime->sculpt->stroke_id = uchar((int(ob->runtime->sculpt->stroke_id) + 1) & 255);
|
||||
}
|
||||
|
||||
void SCULPT_stroke_id_ensure(Object *ob)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (!ss->attrs.automasking_stroke_id) {
|
||||
SculptAttributeParams params = {0};
|
||||
|
@ -6202,7 +6203,7 @@ void SCULPT_topology_islands_ensure(Object *ob)
|
|||
{
|
||||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (ss->attrs.topology_island_key && ss->islands_valid && BKE_pbvh_type(*ss->pbvh) != PBVH_BMESH)
|
||||
{
|
||||
|
@ -6260,7 +6261,7 @@ void SCULPT_topology_islands_ensure(Object *ob)
|
|||
void SCULPT_cube_tip_init(Sculpt * /*sd*/, Object *ob, Brush *brush, float mat[4][4])
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
float scale[4][4];
|
||||
float tmat[4][4];
|
||||
float unused[4][4];
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "DNA_brush_types.h"
|
||||
|
||||
#include "BKE_colortools.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -433,7 +434,7 @@ static void calc_blurred_cavity(SculptSession *ss,
|
|||
|
||||
int settings_hash(const Object &ob, const Cache &automasking)
|
||||
{
|
||||
const SculptSession *ss = ob.sculpt;
|
||||
const SculptSession *ss = ob.runtime->sculpt;
|
||||
|
||||
int hash;
|
||||
int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
@ -614,7 +615,7 @@ static bool floodfill_cb(SculptSession *ss,
|
|||
|
||||
static void topology_automasking_init(const Sculpt *sd, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const Brush *brush = BKE_paint_brush_for_read(&sd->paint);
|
||||
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
@ -645,7 +646,7 @@ static void topology_automasking_init(const Sculpt *sd, Object *ob)
|
|||
|
||||
static void init_face_sets_masking(const Sculpt *sd, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const Brush *brush = BKE_paint_brush_for_read(&sd->paint);
|
||||
|
||||
if (!is_enabled(sd, ss, brush)) {
|
||||
|
@ -667,7 +668,7 @@ static void init_face_sets_masking(const Sculpt *sd, Object *ob)
|
|||
|
||||
static void init_boundary_masking(Object *ob, eBoundaryAutomaskMode mode, int propagation_steps)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
Array<int> edge_distance(totvert, 0);
|
||||
|
@ -764,7 +765,7 @@ static void normal_occlusion_automasking_fill(Cache &automasking,
|
|||
Object *ob,
|
||||
eAutomasking_flag mode)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
/* No need to build original data since this is only called at the beginning of strokes. */
|
||||
|
@ -808,7 +809,7 @@ std::unique_ptr<Cache> cache_init(const Sculpt *sd, Object *ob)
|
|||
|
||||
std::unique_ptr<Cache> cache_init(const Sculpt *sd, const Brush *brush, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (!is_enabled(sd, ss, brush)) {
|
||||
return nullptr;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "BKE_brush.hh"
|
||||
#include "BKE_ccg.h"
|
||||
#include "BKE_colortools.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -487,7 +488,7 @@ SculptBoundary *data_init(Object *object,
|
|||
const PBVHVertRef initial_vertex,
|
||||
const float radius)
|
||||
{
|
||||
SculptSession *ss = object->sculpt;
|
||||
SculptSession *ss = object->runtime->sculpt;
|
||||
|
||||
if (initial_vertex.i == PBVH_REF_NONE) {
|
||||
return nullptr;
|
||||
|
@ -644,7 +645,7 @@ static float sculpt_boundary_displacement_from_grab_delta_get(SculptSession *ss,
|
|||
|
||||
static void do_boundary_brush_bend_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int symm_area = ss->cache->mirror_symmetry_pass;
|
||||
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
@ -694,7 +695,7 @@ static void do_boundary_brush_bend_task(Object *ob, const Brush *brush, PBVHNode
|
|||
|
||||
static void do_boundary_brush_slide_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int symm_area = ss->cache->mirror_symmetry_pass;
|
||||
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
@ -736,7 +737,7 @@ static void do_boundary_brush_slide_task(Object *ob, const Brush *brush, PBVHNod
|
|||
|
||||
static void do_boundary_brush_inflate_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int symm_area = ss->cache->mirror_symmetry_pass;
|
||||
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
@ -778,7 +779,7 @@ static void do_boundary_brush_inflate_task(Object *ob, const Brush *brush, PBVHN
|
|||
|
||||
static void do_boundary_brush_grab_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int symm_area = ss->cache->mirror_symmetry_pass;
|
||||
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
@ -817,7 +818,7 @@ static void do_boundary_brush_grab_task(Object *ob, const Brush *brush, PBVHNode
|
|||
|
||||
static void do_boundary_brush_twist_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int symm_area = ss->cache->mirror_symmetry_pass;
|
||||
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
@ -867,7 +868,7 @@ static void do_boundary_brush_twist_task(Object *ob, const Brush *brush, PBVHNod
|
|||
|
||||
static void do_boundary_brush_smooth_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int symmetry_pass = ss->cache->mirror_symmetry_pass;
|
||||
const SculptBoundary *boundary = ss->cache->boundaries[symmetry_pass];
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
@ -918,7 +919,7 @@ static void do_boundary_brush_smooth_task(Object *ob, const Brush *brush, PBVHNo
|
|||
|
||||
void do_boundary_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const ePaintSymmetryFlags symm_area = ss->cache->mirror_symmetry_pass;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "BKE_ccg.h"
|
||||
#include "BKE_colortools.hh"
|
||||
#include "BKE_kelvinlet.h"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -94,7 +95,7 @@ static void sculpt_project_v3(const SculptProjectVector *spvc, const float vec[3
|
|||
static void calc_sculpt_plane(
|
||||
Sculpt *sd, Object *ob, Span<PBVHNode *> nodes, float r_area_no[3], float r_area_co[3])
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
if (SCULPT_stroke_is_main_symmetry_pass(ss->cache) &&
|
||||
|
@ -246,7 +247,7 @@ static void sculpt_project_v3_normal_align(SculptSession *ss,
|
|||
static void do_draw_brush_task(Object *ob, const Brush *brush, const float *offset, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
||||
|
@ -303,7 +304,7 @@ static void do_draw_brush_task(Object *ob, const Brush *brush, const float *offs
|
|||
void SCULPT_do_draw_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
float offset[3];
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
|
@ -336,7 +337,7 @@ static void do_fill_brush_task(
|
|||
Object *ob, const Brush *brush, const float *area_no, const float *area_co, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -391,7 +392,7 @@ static void do_fill_brush_task(
|
|||
void SCULPT_do_fill_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const float radius = ss->cache->radius;
|
||||
|
@ -425,7 +426,7 @@ static void do_scrape_brush_task(
|
|||
Object *ob, const Brush *brush, const float *area_no, const float *area_co, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -479,7 +480,7 @@ static void do_scrape_brush_task(
|
|||
void SCULPT_do_scrape_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const float radius = ss->cache->radius;
|
||||
|
@ -524,7 +525,7 @@ static void do_clay_thumb_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -599,7 +600,7 @@ float SCULPT_clay_thumb_get_stabilized_pressure(blender::ed::sculpt_paint::Strok
|
|||
void SCULPT_do_clay_thumb_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
/* Sampled geometry normal and area center. */
|
||||
|
@ -674,7 +675,7 @@ static void do_flatten_brush_task(
|
|||
Object *ob, const Brush *brush, const float *area_no, const float *area_co, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -724,7 +725,7 @@ static void do_flatten_brush_task(
|
|||
void SCULPT_do_flatten_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const float radius = ss->cache->radius;
|
||||
|
@ -770,7 +771,7 @@ static void calc_clay_surface_task_cb(Object *ob,
|
|||
PBVHNode *node,
|
||||
ClaySampleData *csd)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
float plane[4];
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -810,7 +811,7 @@ static void do_clay_brush_task(
|
|||
Object *ob, const Brush *brush, const float *area_no, const float *area_co, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -858,7 +859,7 @@ static void do_clay_brush_task(
|
|||
void SCULPT_do_clay_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const float radius = fabsf(ss->cache->radius);
|
||||
|
@ -917,7 +918,7 @@ static void do_clay_strips_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
SculptBrushTest test;
|
||||
|
@ -972,7 +973,7 @@ static void do_clay_strips_brush_task(Object *ob,
|
|||
void SCULPT_do_clay_strips_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const bool flip = (ss->cache->bstrength < 0.0f);
|
||||
|
@ -1058,7 +1059,7 @@ static void do_snake_hook_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -1160,7 +1161,7 @@ static void do_snake_hook_brush_task(Object *ob,
|
|||
void SCULPT_do_snake_hook_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
float grab_delta[3];
|
||||
|
@ -1192,7 +1193,7 @@ void SCULPT_do_snake_hook_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
static void do_thumb_brush_task(Object *ob, const Brush *brush, const float *cono, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
SculptOrigVertData orig_data;
|
||||
|
@ -1236,7 +1237,7 @@ static void do_thumb_brush_task(Object *ob, const Brush *brush, const float *con
|
|||
void SCULPT_do_thumb_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
float grab_delta[3];
|
||||
float tmp[3], cono[3];
|
||||
|
@ -1256,7 +1257,7 @@ void SCULPT_do_thumb_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
static void do_rotate_brush_task(Object *ob, const Brush *brush, const float angle, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
SculptOrigVertData orig_data;
|
||||
|
@ -1306,7 +1307,7 @@ static void do_rotate_brush_task(Object *ob, const Brush *brush, const float ang
|
|||
void SCULPT_do_rotate_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
static const int flip[8] = {1, -1, -1, 1, -1, 1, 1, -1};
|
||||
|
@ -1322,7 +1323,7 @@ void SCULPT_do_rotate_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
static void do_layer_brush_task(Object *ob, Sculpt *sd, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const bool use_persistent_base = !ss->bm && ss->attrs.persistent_co &&
|
||||
brush->flag & BRUSH_PERSISTENT;
|
||||
|
@ -1411,7 +1412,7 @@ static void do_layer_brush_task(Object *ob, Sculpt *sd, const Brush *brush, PBVH
|
|||
void SCULPT_do_layer_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
if (ss->cache->layer_displacement_factor == nullptr) {
|
||||
|
@ -1429,7 +1430,7 @@ void SCULPT_do_layer_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
static void do_inflate_brush_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -1489,7 +1490,7 @@ void SCULPT_do_inflate_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
static void do_nudge_brush_task(Object *ob, const Brush *brush, const float *cono, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -1528,7 +1529,7 @@ static void do_nudge_brush_task(Object *ob, const Brush *brush, const float *con
|
|||
void SCULPT_do_nudge_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
float grab_delta[3];
|
||||
float tmp[3], cono[3];
|
||||
|
@ -1562,7 +1563,7 @@ static void do_crease_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -1616,7 +1617,7 @@ static void do_crease_brush_task(Object *ob,
|
|||
void SCULPT_do_crease_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const Scene *scene = ss->cache->vc->scene;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
float offset[3];
|
||||
|
@ -1664,7 +1665,7 @@ static void do_pinch_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -1726,7 +1727,7 @@ static void do_pinch_brush_task(Object *ob,
|
|||
void SCULPT_do_pinch_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
float area_no[3];
|
||||
|
@ -1772,7 +1773,7 @@ static void do_grab_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
SculptOrigVertData orig_data;
|
||||
|
@ -1829,7 +1830,7 @@ static void do_grab_brush_task(Object *ob,
|
|||
void SCULPT_do_grab_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
float grab_delta[3];
|
||||
|
||||
|
@ -1852,7 +1853,7 @@ static void do_elastic_deform_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float *location = ss->cache->location;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -1928,7 +1929,7 @@ static void do_elastic_deform_brush_task(Object *ob,
|
|||
void SCULPT_do_elastic_deform_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
float grab_delta[3];
|
||||
|
||||
|
@ -1957,7 +1958,7 @@ static void do_draw_sharp_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
SculptOrigVertData orig_data;
|
||||
|
@ -2000,7 +2001,7 @@ static void do_draw_sharp_brush_task(Object *ob,
|
|||
void SCULPT_do_draw_sharp_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
float offset[3];
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
|
@ -2032,7 +2033,7 @@ void SCULPT_do_draw_sharp_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
static void do_topology_slide_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
SculptOrigVertData orig_data;
|
||||
|
@ -2191,7 +2192,7 @@ void relax_vertex(SculptSession *ss,
|
|||
static void do_topology_relax_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -2238,7 +2239,7 @@ static void do_topology_relax_task(Object *ob, const Brush *brush, PBVHNode *nod
|
|||
void SCULPT_do_slide_relax_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) {
|
||||
|
@ -2275,7 +2276,7 @@ void SCULPT_do_slide_relax_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
static void do_displacement_eraser_brush_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = clamp_f(ss->cache->bstrength, 0.0f, 1.0f);
|
||||
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -2337,7 +2338,7 @@ void SCULPT_do_displacement_eraser_brush(Sculpt *sd, Object *ob, Span<PBVHNode *
|
|||
static void do_displacement_smear_brush_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = clamp_f(ss->cache->bstrength, 0.0f, 1.0f);
|
||||
|
||||
SculptBrushTest test;
|
||||
|
@ -2436,7 +2437,7 @@ void SCULPT_do_displacement_smear_brush(Sculpt *sd, Object *ob, Span<PBVHNode *>
|
|||
{
|
||||
using namespace blender;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
BKE_curvemapping_init(brush->curve);
|
||||
|
||||
|
@ -2478,7 +2479,7 @@ static void do_topology_rake_bmesh_task(
|
|||
Object *ob, Sculpt *sd, const Brush *brush, const float strength, PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
float direction[3];
|
||||
copy_v3_v3(direction, ss->cache->grab_delta_symmetry);
|
||||
|
@ -2571,7 +2572,7 @@ static void do_mask_brush_draw_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -2618,7 +2619,7 @@ void SCULPT_do_mask_brush_draw(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
{
|
||||
using namespace blender;
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
const SculptMaskWriteInfo mask_write = SCULPT_mask_get_for_write(ob->sculpt);
|
||||
const SculptMaskWriteInfo mask_write = SCULPT_mask_get_for_write(ob->runtime->sculpt);
|
||||
threading::parallel_for(nodes.index_range(), 1, [&](const IndexRange range) {
|
||||
for (const int i : range) {
|
||||
do_mask_brush_draw_task(ob, brush, mask_write, nodes[i]);
|
||||
|
@ -2629,7 +2630,7 @@ void SCULPT_do_mask_brush_draw(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
void SCULPT_do_mask_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
switch ((BrushMaskTool)brush->mask_tool) {
|
||||
|
|
|
@ -304,7 +304,7 @@ static void do_cloth_brush_build_constraints_task(Object *ob,
|
|||
float cloth_sim_radius,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const int node_index = POINTER_AS_INT(BLI_ghash_lookup(cloth_sim->node_state_index, node));
|
||||
if (cloth_sim->node_state[node_index] != SCULPT_CLOTH_NODE_UNINITIALIZED) {
|
||||
|
@ -440,7 +440,7 @@ static void do_cloth_brush_apply_forces_task(Object *ob,
|
|||
float *area_co,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
SimulationData *cloth_sim = ss->cache->cloth_sim;
|
||||
|
||||
const bool use_falloff_plane = brush->cloth_force_falloff_type ==
|
||||
|
@ -729,7 +729,7 @@ static void do_cloth_brush_solve_simulation_task(Object *ob,
|
|||
const float time_step,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
||||
|
@ -914,7 +914,7 @@ static void cloth_brush_satisfy_constraints(SculptSession *ss,
|
|||
|
||||
void do_simulation_step(Sculpt *sd, Object *ob, SimulationData *cloth_sim, Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
/* Update the constraints. */
|
||||
|
@ -930,7 +930,7 @@ void do_simulation_step(Sculpt *sd, Object *ob, SimulationData *cloth_sim, Span<
|
|||
|
||||
static void cloth_brush_apply_brush_foces(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
float3 grab_delta;
|
||||
|
@ -1018,7 +1018,7 @@ SimulationData *brush_simulation_create(Object *ob,
|
|||
const bool use_collisions,
|
||||
const bool needs_deform_coords)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totverts = SCULPT_vertex_count_get(ss);
|
||||
SimulationData *cloth_sim = MEM_new<SimulationData>(__func__);
|
||||
|
||||
|
@ -1143,7 +1143,7 @@ static void sculpt_cloth_ensure_constraints_in_simulation_area(Sculpt *sd,
|
|||
Object *ob,
|
||||
Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
const float radius = ss->cache->initial_radius;
|
||||
const float limit = radius + (radius * brush->cloth_sim_limit);
|
||||
|
@ -1154,7 +1154,7 @@ static void sculpt_cloth_ensure_constraints_in_simulation_area(Sculpt *sd,
|
|||
|
||||
void do_cloth_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
/* Brushes that use anchored strokes and restore the mesh can't rely on symmetry passes and steps
|
||||
|
@ -1382,7 +1382,7 @@ static void cloth_filter_apply_forces_task(Object *ob,
|
|||
const float filter_strength,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
SimulationData *cloth_sim = ss->filter_cache->cloth_sim;
|
||||
|
||||
|
@ -1470,7 +1470,7 @@ static int sculpt_cloth_filter_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
int filter_type = RNA_enum_get(op->ptr, "type");
|
||||
float filter_strength = RNA_float_get(op->ptr, "strength");
|
||||
|
@ -1529,7 +1529,7 @@ static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
Object *ob = CTX_data_active_object(C);
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
const Base *base = CTX_data_active_base(C);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "BKE_brush.hh"
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_screen.hh"
|
||||
|
@ -74,7 +75,7 @@ static bool sculpt_and_constant_or_manual_detail_poll(bContext *C)
|
|||
Object *ob = CTX_data_active_object(C);
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
|
||||
return SCULPT_mode_poll(C) && ob->sculpt->bm &&
|
||||
return SCULPT_mode_poll(C) && ob->runtime->sculpt->bm &&
|
||||
(sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | SCULPT_DYNTOPO_DETAIL_MANUAL));
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,7 @@ static bool sculpt_and_dynamic_topology_poll(bContext *C)
|
|||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
||||
return SCULPT_mode_poll(C) && ob->sculpt->bm;
|
||||
return SCULPT_mode_poll(C) && ob->runtime->sculpt->bm;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -95,7 +96,7 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
const Base *base = CTX_data_active_base(C);
|
||||
|
@ -113,7 +114,7 @@ static int sculpt_detail_flood_fill_exec(bContext *C, wmOperator *op)
|
|||
BKE_pbvh_node_mark_topology_update(node);
|
||||
}
|
||||
/* Get the bounding box, its center and size. */
|
||||
const Bounds<float3> bounds = bke::pbvh::bounds_get(*ob->sculpt->pbvh);
|
||||
const Bounds<float3> bounds = bke::pbvh::bounds_get(*ob->runtime->sculpt->pbvh);
|
||||
const float3 center = math::midpoint(bounds.min, bounds.max);
|
||||
const float3 dim = bounds.max - bounds.min;
|
||||
const float size = math::reduce_max(dim);
|
||||
|
@ -185,7 +186,7 @@ static void sample_detail_voxel(bContext *C, ViewContext *vc, const int mval[2])
|
|||
Object *ob = vc->obact;
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
SculptCursorGeometryInfo sgi;
|
||||
SCULPT_vertex_random_access_ensure(ss);
|
||||
|
||||
|
@ -242,7 +243,7 @@ static void sample_detail_dyntopo(bContext *C, ViewContext *vc, const int mval[2
|
|||
isect_ray_tri_watertight_v3_precalc(&srd.isect_precalc, ray_normal);
|
||||
|
||||
bke::pbvh::raycast(
|
||||
*ob->sculpt->pbvh,
|
||||
*ob->runtime->sculpt->pbvh,
|
||||
[&](PBVHNode &node, float *tmin) { sculpt_raycast_detail_cb(node, srd, tmin); },
|
||||
ray_start,
|
||||
ray_normal,
|
||||
|
@ -278,7 +279,7 @@ static int sample_detail(bContext *C, const int event_xy[2], int mode)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
if (!ss->pbvh) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -552,7 +553,7 @@ static void dyntopo_detail_size_edit_draw(const bContext * /*C*/, ARegion * /*re
|
|||
static void dyntopo_detail_size_edit_cancel(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *active_object = CTX_data_active_object(C);
|
||||
SculptSession *ss = active_object->sculpt;
|
||||
SculptSession *ss = active_object->runtime->sculpt;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
DyntopoDetailSizeEditCustomData *cd = static_cast<DyntopoDetailSizeEditCustomData *>(
|
||||
op->customdata);
|
||||
|
@ -585,7 +586,7 @@ static void dyntopo_detail_size_bounds(DyntopoDetailSizeEditCustomData *cd)
|
|||
static void dyntopo_detail_size_sample_from_surface(Object *ob,
|
||||
DyntopoDetailSizeEditCustomData *cd)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const PBVHVertRef active_vertex = SCULPT_active_vertex_get(ss);
|
||||
|
||||
float len_accum = 0;
|
||||
|
@ -682,7 +683,7 @@ static void dyntopo_detail_size_update_header(bContext *C,
|
|||
static int dyntopo_detail_size_edit_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Object *active_object = CTX_data_active_object(C);
|
||||
SculptSession *ss = active_object->sculpt;
|
||||
SculptSession *ss = active_object->runtime->sculpt;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
DyntopoDetailSizeEditCustomData *cd = static_cast<DyntopoDetailSizeEditCustomData *>(
|
||||
op->customdata);
|
||||
|
@ -792,7 +793,7 @@ static int dyntopo_detail_size_edit_invoke(bContext *C, wmOperator *op, const wm
|
|||
copy_v4_v4(cd->outline_col, brush->add_col);
|
||||
op->customdata = cd;
|
||||
|
||||
SculptSession *ss = active_object->sculpt;
|
||||
SculptSession *ss = active_object->runtime->sculpt;
|
||||
dyntopo_detail_size_bounds(cd);
|
||||
cd->radius = ss->cursor_radius;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "BKE_mesh.hh"
|
||||
#include "BKE_modifier.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
@ -45,7 +46,7 @@
|
|||
void SCULPT_pbvh_clear(Object *ob)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
/* Clear out any existing DM and PBVH. */
|
||||
bke::pbvh::free(ss->pbvh);
|
||||
|
||||
|
@ -73,7 +74,7 @@ void triangulate(BMesh *bm)
|
|||
|
||||
void enable_ex(Main *bmain, Depsgraph *depsgraph, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(mesh);
|
||||
|
||||
|
@ -121,7 +122,7 @@ void enable_ex(Main *bmain, Depsgraph *depsgraph, Object *ob)
|
|||
static void SCULPT_dynamic_topology_disable_ex(
|
||||
Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, undo::Node *unode)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
|
||||
if (ss->attrs.dyntopo_node_id_vertex) {
|
||||
|
@ -200,7 +201,7 @@ void disable(bContext *C, undo::Node *unode)
|
|||
|
||||
void disable_with_undo(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
if (ss->bm != nullptr) {
|
||||
/* May be false in background mode. */
|
||||
const bool use_undo = G.background ? (ED_undo_stack_get() != nullptr) : true;
|
||||
|
@ -217,7 +218,7 @@ void disable_with_undo(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *
|
|||
|
||||
static void sculpt_dynamic_topology_enable_with_undo(Main *bmain, Depsgraph *depsgraph, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
if (ss->bm == nullptr) {
|
||||
/* May be false in background mode. */
|
||||
const bool use_undo = G.background ? (ED_undo_stack_get() != nullptr) : true;
|
||||
|
@ -238,7 +239,7 @@ static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator * /*op*/)
|
|||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
WM_cursor_wait(true);
|
||||
|
||||
|
@ -307,7 +308,7 @@ static bool dyntopo_supports_customdata_layers(const Span<CustomDataLayer> layer
|
|||
enum WarnFlag check_attribute_warning(Scene *scene, Object *ob)
|
||||
{
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
WarnFlag flag = WarnFlag(0);
|
||||
|
||||
|
@ -354,7 +355,7 @@ static int sculpt_dynamic_topology_toggle_invoke(bContext *C,
|
|||
const wmEvent * /*event*/)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (!ss->bm) {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "BKE_image.h"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_report.hh"
|
||||
|
@ -411,7 +412,7 @@ static BitVector<> sculpt_expand_boundary_from_enabled(SculptSession *ss,
|
|||
|
||||
static void sculpt_expand_check_topology_islands(Object *ob, eSculptExpandFalloffType falloff_type)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
ss->expand_cache->check_islands = ELEM(falloff_type,
|
||||
SCULPT_EXPAND_FALLOFF_GEODESIC,
|
||||
|
@ -434,7 +435,7 @@ static void sculpt_expand_check_topology_islands(Object *ob, eSculptExpandFallof
|
|||
static PBVHVertRef sculpt_expand_get_vertex_index_for_symmetry_pass(
|
||||
Object *ob, const char symm_it, const PBVHVertRef original_vertex)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVHVertRef symm_vertex = {SCULPT_EXPAND_VERTEX_NONE};
|
||||
|
||||
if (symm_it == 0) {
|
||||
|
@ -489,7 +490,7 @@ static bool expand_topology_floodfill_cb(SculptSession *ss,
|
|||
|
||||
static Array<float> sculpt_expand_topology_falloff_create(Object *ob, const PBVHVertRef v)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
Array<float> dists(totvert, 0.0f);
|
||||
|
||||
|
@ -541,7 +542,7 @@ static Array<float> sculpt_expand_normal_falloff_create(Object *ob,
|
|||
const float edge_sensitivity,
|
||||
const int blur_steps)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
Array<float> dists(totvert, 0.0f);
|
||||
Array<float> edge_factor(totvert, 1.0f);
|
||||
|
@ -589,7 +590,7 @@ static Array<float> sculpt_expand_normal_falloff_create(Object *ob,
|
|||
*/
|
||||
static Array<float> sculpt_expand_spherical_falloff_create(Object *ob, const PBVHVertRef v)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
Array<float> dists(totvert, FLT_MAX);
|
||||
|
@ -621,7 +622,7 @@ static Array<float> sculpt_expand_spherical_falloff_create(Object *ob, const PBV
|
|||
*/
|
||||
static Array<float> sculpt_expand_boundary_topology_falloff_create(Object *ob, const PBVHVertRef v)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
Array<float> dists(totvert, 0.0f);
|
||||
BitVector<> visited_verts(totvert);
|
||||
|
@ -683,7 +684,7 @@ static Array<float> sculpt_expand_boundary_topology_falloff_create(Object *ob, c
|
|||
*/
|
||||
static Array<float> sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertRef v)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
Array<float> dists(totvert, 0.0f);
|
||||
|
||||
|
@ -862,7 +863,7 @@ static void sculpt_expand_geodesics_from_state_boundary(Object *ob,
|
|||
Cache *expand_cache,
|
||||
const BitSpan enabled_verts)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
BLI_assert(BKE_pbvh_type(*ss->pbvh) == PBVH_FACES);
|
||||
|
||||
Set<int> initial_verts;
|
||||
|
@ -890,7 +891,7 @@ static void sculpt_expand_topology_from_state_boundary(Object *ob,
|
|||
{
|
||||
MEM_SAFE_FREE(expand_cache->face_falloff);
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
expand_cache->vert_falloff.reinitialize(totvert);
|
||||
|
@ -920,7 +921,7 @@ static void sculpt_expand_resursion_step_add(Object *ob,
|
|||
Cache *expand_cache,
|
||||
const eSculptExpandRecursionType recursion_type)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
if (BKE_pbvh_type(*ss->pbvh) != PBVH_FACES) {
|
||||
return;
|
||||
}
|
||||
|
@ -960,7 +961,7 @@ static void sculpt_expand_initialize_from_face_set_boundary(Object *ob,
|
|||
const int active_face_set,
|
||||
const bool internal_falloff)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
BitVector<> enabled_verts(totvert);
|
||||
|
@ -1026,7 +1027,7 @@ static void sculpt_expand_falloff_factors_from_vertex_and_symm_create(
|
|||
{
|
||||
expand_cache->falloff_type = falloff_type;
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const bool has_topology_info = BKE_pbvh_type(*ss->pbvh) == PBVH_FACES;
|
||||
|
||||
switch (falloff_type) {
|
||||
|
@ -1143,7 +1144,7 @@ static void sculpt_expand_restore_face_set_data(Object &object, Cache *expand_ca
|
|||
face_sets.span.copy_from(expand_cache->original_face_sets);
|
||||
face_sets.finish();
|
||||
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(*object.sculpt->pbvh, {});
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(*object.runtime->sculpt->pbvh, {});
|
||||
for (PBVHNode *node : nodes) {
|
||||
BKE_pbvh_node_mark_update_face_sets(node);
|
||||
}
|
||||
|
@ -1211,7 +1212,7 @@ static void write_mask_data(SculptSession *ss, const Span<float> mask)
|
|||
* operation. */
|
||||
static void sculpt_expand_restore_original_state(bContext *C, Object *ob, Cache *expand_cache)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
switch (expand_cache->target) {
|
||||
case SCULPT_EXPAND_TARGET_MASK:
|
||||
write_mask_data(ss, expand_cache->original_mask);
|
||||
|
@ -1239,7 +1240,7 @@ static void sculpt_expand_restore_original_state(bContext *C, Object *ob, Cache
|
|||
static void sculpt_expand_cancel(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
sculpt_expand_restore_original_state(C, ob, ss->expand_cache);
|
||||
|
||||
|
@ -1314,7 +1315,7 @@ static void sculpt_expand_face_sets_update(Object &object, Cache *expand_cache)
|
|||
const VArraySpan<bool> hide_poly = *attributes.lookup<bool>(".hide_poly", bke::AttrDomain::Face);
|
||||
for (const int f : face_sets.span.index_range()) {
|
||||
const bool enabled = sculpt_expand_face_state_get(
|
||||
object.sculpt, hide_poly, face_sets.span, expand_cache, f);
|
||||
object.runtime->sculpt, hide_poly, face_sets.span, expand_cache, f);
|
||||
if (!enabled) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1385,7 +1386,7 @@ static void sculpt_expand_colors_update_task(SculptSession *ss, PBVHNode *node)
|
|||
/* Store the original mesh data state in the expand cache. */
|
||||
static void sculpt_expand_original_state_store(Object *ob, Cache *expand_cache)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh &mesh = *static_cast<Mesh *>(ob->data);
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
|
@ -1413,7 +1414,7 @@ static void sculpt_expand_original_state_store(Object *ob, Cache *expand_cache)
|
|||
*/
|
||||
static void sculpt_expand_face_sets_restore(Object &object, Cache *expand_cache)
|
||||
{
|
||||
SculptSession &ss = *object.sculpt;
|
||||
SculptSession &ss = *object.runtime->sculpt;
|
||||
bke::SpanAttributeWriter<int> face_sets = face_set::ensure_face_sets_mesh(object);
|
||||
const int totfaces = ss.totfaces;
|
||||
for (int i = 0; i < totfaces; i++) {
|
||||
|
@ -1431,7 +1432,7 @@ static void sculpt_expand_face_sets_restore(Object &object, Cache *expand_cache)
|
|||
|
||||
static void sculpt_expand_update_for_vertex(bContext *C, Object *ob, const PBVHVertRef vertex)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Cache *expand_cache = ss->expand_cache;
|
||||
|
||||
int vertex_i = BKE_pbvh_vertex_to_index(*ss->pbvh, vertex);
|
||||
|
@ -1489,7 +1490,7 @@ static PBVHVertRef sculpt_expand_target_vertex_update_and_get(bContext *C,
|
|||
Object *ob,
|
||||
const float mval[2])
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
SculptCursorGeometryInfo sgi;
|
||||
if (SCULPT_cursor_geometry_info_update(C, &sgi, mval, false)) {
|
||||
return SCULPT_active_vertex_get(ss);
|
||||
|
@ -1503,7 +1504,7 @@ static PBVHVertRef sculpt_expand_target_vertex_update_and_get(bContext *C,
|
|||
*/
|
||||
static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, Cache *expand_cache)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
|
@ -1560,7 +1561,7 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, Cache *expan
|
|||
static void sculpt_expand_finish(bContext *C)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
undo::push_end(ob);
|
||||
|
||||
/* Tag all nodes to redraw to avoid artifacts after the fast partial updates. */
|
||||
|
@ -1592,7 +1593,7 @@ static void sculpt_expand_finish(bContext *C)
|
|||
static void sculpt_expand_find_active_connected_components_from_vert(
|
||||
Object *ob, Cache *expand_cache, const PBVHVertRef initial_vertex)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
for (int i = 0; i < EXPAND_SYMM_AREAS; i++) {
|
||||
expand_cache->active_connected_islands[i] = EXPAND_ACTIVE_COMPONENT_NONE;
|
||||
}
|
||||
|
@ -1620,7 +1621,7 @@ static void sculpt_expand_set_initial_components_for_mouse(bContext *C,
|
|||
Cache *expand_cache,
|
||||
const float mval[2])
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertRef initial_vertex = sculpt_expand_target_vertex_update_and_get(C, ob, mval);
|
||||
|
||||
|
@ -1683,7 +1684,7 @@ static void sculpt_expand_move_propagation_origin(bContext *C,
|
|||
*/
|
||||
static void sculpt_expand_ensure_sculptsession_data(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
SCULPT_topology_islands_ensure(ob);
|
||||
SCULPT_vertex_random_access_ensure(ss);
|
||||
SCULPT_boundary_info_ensure(ob);
|
||||
|
@ -1716,7 +1717,7 @@ static int sculpt_expand_active_face_set_id_get(SculptSession *ss, Cache *expand
|
|||
static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
/* Skips INBETWEEN_MOUSEMOVE events and other events that may cause unnecessary updates. */
|
||||
if (!ELEM(event->type, MOUSEMOVE, EVT_MODAL_MAP)) {
|
||||
|
@ -2008,7 +2009,7 @@ static void sculpt_expand_cache_initial_config_set(bContext *C,
|
|||
/* Texture and color data from the active Brush. */
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
expand_cache->brush = BKE_paint_brush(&sd->paint);
|
||||
BKE_curvemapping_init(expand_cache->brush->curve);
|
||||
copy_v4_fl(expand_cache->fill_color, 1.0f);
|
||||
|
@ -2025,7 +2026,7 @@ static void sculpt_expand_cache_initial_config_set(bContext *C,
|
|||
*/
|
||||
static void sculpt_expand_undo_push(Object *ob, Cache *expand_cache)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(*ss->pbvh, {});
|
||||
|
||||
switch (expand_cache->target) {
|
||||
|
@ -2049,7 +2050,7 @@ static void sculpt_expand_undo_push(Object *ob, Cache *expand_cache)
|
|||
|
||||
static bool any_nonzero_mask(const Object &object)
|
||||
{
|
||||
const SculptSession &ss = *object.sculpt;
|
||||
const SculptSession &ss = *object.runtime->sculpt;
|
||||
switch (BKE_pbvh_type(*ss.pbvh)) {
|
||||
case PBVH_FACES: {
|
||||
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
|
||||
|
@ -2099,7 +2100,7 @@ static int sculpt_expand_invoke(bContext *C, wmOperator *op, const wmEvent *even
|
|||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "BKE_mesh_fair.hh"
|
||||
#include "BKE_mesh_mapping.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_subdiv_ccg.hh"
|
||||
|
@ -69,7 +70,7 @@ namespace blender::ed::sculpt_paint::face_set {
|
|||
|
||||
int find_next_available_id(Object &object)
|
||||
{
|
||||
SculptSession &ss = *object.sculpt;
|
||||
SculptSession &ss = *object.runtime->sculpt;
|
||||
switch (BKE_pbvh_type(*ss.pbvh)) {
|
||||
case PBVH_FACES:
|
||||
case PBVH_GRIDS: {
|
||||
|
@ -131,7 +132,7 @@ void initialize_none_to_id(Mesh *mesh, const int new_id)
|
|||
|
||||
int active_update_and_get(bContext *C, Object *ob, const float mval[2])
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
if (!ss) {
|
||||
return SCULPT_FACE_SET_NONE;
|
||||
}
|
||||
|
@ -154,7 +155,7 @@ bke::SpanAttributeWriter<int> ensure_face_sets_mesh(Object &object)
|
|||
bke::AttributeInitVArray(VArray<int>::ForSingle(1, mesh.faces_num)));
|
||||
mesh.face_sets_color_default = 1;
|
||||
}
|
||||
object.sculpt->face_sets = static_cast<const int *>(
|
||||
object.runtime->sculpt->face_sets = static_cast<const int *>(
|
||||
CustomData_get_layer_named(&mesh.face_data, CD_PROP_INT32, ".sculpt_face_set"));
|
||||
return attributes.lookup_or_add_for_write_span<int>(".sculpt_face_set", bke::AttrDomain::Face);
|
||||
}
|
||||
|
@ -162,7 +163,7 @@ bke::SpanAttributeWriter<int> ensure_face_sets_mesh(Object &object)
|
|||
int ensure_face_sets_bmesh(Object &object)
|
||||
{
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
SculptSession &ss = *object.sculpt;
|
||||
SculptSession &ss = *object.runtime->sculpt;
|
||||
BMesh &bm = *ss.bm;
|
||||
if (!CustomData_has_layer_named(&bm.pdata, CD_PROP_INT32, ".sculpt_face_set")) {
|
||||
BM_data_layer_add_named(&bm, &bm.pdata, CD_PROP_INT32, ".sculpt_face_set");
|
||||
|
@ -193,7 +194,7 @@ static void do_draw_face_sets_brush_faces(Object *ob,
|
|||
const Brush *brush,
|
||||
const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const Span<float3> positions = SCULPT_mesh_deformed_positions_get(ss);
|
||||
|
||||
Mesh &mesh = *static_cast<Mesh *>(ob->data);
|
||||
|
@ -263,7 +264,7 @@ static void do_draw_face_sets_brush_grids(Object *ob,
|
|||
const Brush *brush,
|
||||
const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
SubdivCCG &subdiv_ccg = *ss->subdiv_ccg;
|
||||
|
||||
|
@ -321,7 +322,7 @@ static void do_draw_face_sets_brush_bmesh(Object *ob,
|
|||
const Brush *brush,
|
||||
const Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
const int cd_offset = ensure_face_sets_bmesh(*ob);
|
||||
|
||||
|
@ -408,7 +409,7 @@ static void do_relax_face_sets_brush_task(Object *ob,
|
|||
const int iteration,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
float bstrength = ss->cache->bstrength;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -455,7 +456,7 @@ static void do_relax_face_sets_brush_task(Object *ob,
|
|||
|
||||
void do_draw_face_sets_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
BKE_curvemapping_init(brush->curve);
|
||||
|
@ -496,7 +497,7 @@ static void face_sets_update(Object &object,
|
|||
const Span<PBVHNode *> nodes,
|
||||
const FunctionRef<void(Span<int>, MutableSpan<int>)> calc_face_sets)
|
||||
{
|
||||
PBVH &pbvh = *object.sculpt->pbvh;
|
||||
PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
const Span<int> tri_faces = mesh.corner_tri_faces();
|
||||
|
||||
|
@ -547,7 +548,7 @@ static void clear_face_sets(Object &object, const Span<PBVHNode *> nodes)
|
|||
if (!attributes.contains(".sculpt_face_set")) {
|
||||
return;
|
||||
}
|
||||
const PBVH &pbvh = *object.sculpt->pbvh;
|
||||
const PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
const Span<int> tri_faces = mesh.corner_tri_faces();
|
||||
const int default_face_set = mesh.face_sets_color_default;
|
||||
const VArraySpan face_sets = *attributes.lookup<int>(".sculpt_face_set", bke::AttrDomain::Face);
|
||||
|
@ -574,7 +575,7 @@ static void clear_face_sets(Object &object, const Span<PBVHNode *> nodes)
|
|||
static int sculpt_face_set_create_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object &object = *CTX_data_active_object(C);
|
||||
SculptSession &ss = *object.sculpt;
|
||||
SculptSession &ss = *object.runtime->sculpt;
|
||||
Depsgraph &depsgraph = *CTX_data_depsgraph_pointer(C);
|
||||
|
||||
const CreateMode mode = CreateMode(RNA_enum_get(op->ptr, "mode"));
|
||||
|
@ -733,7 +734,7 @@ using FaceSetsFloodFillFn = FunctionRef<bool(int from_face, int edge, int to_fac
|
|||
|
||||
static void sculpt_face_sets_init_flood_fill(Object *ob, const FaceSetsFloodFillFn &test_fn)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
|
||||
BitVector<> visited_faces(mesh->faces_num, false);
|
||||
|
@ -803,7 +804,7 @@ Array<int> duplicate_face_sets(const Mesh &mesh)
|
|||
static int sculpt_face_set_init_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
|
||||
const InitMode mode = InitMode(RNA_enum_get(op->ptr, "mode"));
|
||||
|
@ -821,7 +822,7 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
PBVH &pbvh = *ob->sculpt->pbvh;
|
||||
PBVH &pbvh = *ob->runtime->sculpt->pbvh;
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(pbvh, {});
|
||||
|
||||
if (nodes.is_empty()) {
|
||||
|
@ -1000,7 +1001,7 @@ static void face_hide_update(Object &object,
|
|||
const Span<PBVHNode *> nodes,
|
||||
const FunctionRef<void(Span<int>, MutableSpan<bool>)> calc_hide)
|
||||
{
|
||||
PBVH &pbvh = *object.sculpt->pbvh;
|
||||
PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
const Span<int> tri_faces = mesh.corner_tri_faces();
|
||||
bke::MutableAttributeAccessor attributes = mesh.attributes_for_write();
|
||||
|
@ -1045,7 +1046,7 @@ static void face_hide_update(Object &object,
|
|||
|
||||
static void show_all(Depsgraph &depsgraph, Object &object, const Span<PBVHNode *> nodes)
|
||||
{
|
||||
switch (BKE_pbvh_type(*object.sculpt->pbvh)) {
|
||||
switch (BKE_pbvh_type(*object.runtime->sculpt->pbvh)) {
|
||||
case PBVH_FACES:
|
||||
hide::mesh_show_all(object, nodes);
|
||||
break;
|
||||
|
@ -1061,7 +1062,7 @@ static void show_all(Depsgraph &depsgraph, Object &object, const Span<PBVHNode *
|
|||
static int sculpt_face_set_change_visibility_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object &object = *CTX_data_active_object(C);
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
Depsgraph &depsgraph = *CTX_data_depsgraph_pointer(C);
|
||||
|
||||
Mesh *mesh = BKE_object_get_original_mesh(&object);
|
||||
|
@ -1077,7 +1078,7 @@ static int sculpt_face_set_change_visibility_exec(bContext *C, wmOperator *op)
|
|||
|
||||
undo::push_begin(&object, op);
|
||||
|
||||
PBVH &pbvh = *object.sculpt->pbvh;
|
||||
PBVH &pbvh = *object.runtime->sculpt->pbvh;
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(pbvh, {});
|
||||
|
||||
const bke::AttributeAccessor attributes = mesh->attributes();
|
||||
|
@ -1148,7 +1149,7 @@ static int sculpt_face_set_change_visibility_exec(bContext *C, wmOperator *op)
|
|||
bke::pbvh::update_visibility(*ss->pbvh);
|
||||
BKE_sculpt_hide_poly_pointer_update(object);
|
||||
|
||||
SCULPT_topology_islands_invalidate(object.sculpt);
|
||||
SCULPT_topology_islands_invalidate(object.runtime->sculpt);
|
||||
hide::tag_update_visibility(*C);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -1159,7 +1160,7 @@ static int sculpt_face_set_change_visibility_invoke(bContext *C,
|
|||
const wmEvent *event)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
const Base *base = CTX_data_active_base(C);
|
||||
|
@ -1213,7 +1214,7 @@ void SCULPT_OT_face_set_change_visibility(wmOperatorType *ot)
|
|||
static int sculpt_face_sets_randomize_colors_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
const Base *base = CTX_data_active_base(C);
|
||||
|
@ -1226,7 +1227,7 @@ static int sculpt_face_sets_randomize_colors_exec(bContext *C, wmOperator * /*op
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
PBVH &pbvh = *ob->sculpt->pbvh;
|
||||
PBVH &pbvh = *ob->runtime->sculpt->pbvh;
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
const bke::AttributeAccessor attributes = mesh->attributes();
|
||||
|
||||
|
@ -1277,7 +1278,7 @@ static void sculpt_face_set_grow_shrink(Object &object,
|
|||
const bool modify_hidden,
|
||||
wmOperator *op)
|
||||
{
|
||||
SculptSession &ss = *object.sculpt;
|
||||
SculptSession &ss = *object.runtime->sculpt;
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
const OffsetIndices faces = mesh.faces();
|
||||
const Span<int> corner_verts = mesh.corner_verts();
|
||||
|
@ -1414,7 +1415,7 @@ static void sculpt_face_set_edit_fair_face_set(Object *ob,
|
|||
const eMeshFairingDepth fair_order,
|
||||
const float strength)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
|
@ -1449,13 +1450,13 @@ static bool sculpt_face_set_edit_is_operation_valid(const Object &object,
|
|||
const EditMode mode,
|
||||
const bool modify_hidden)
|
||||
{
|
||||
if (BKE_pbvh_type(*object.sculpt->pbvh) == PBVH_BMESH) {
|
||||
if (BKE_pbvh_type(*object.runtime->sculpt->pbvh) == PBVH_BMESH) {
|
||||
/* Dyntopo is not supported. */
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mode == EditMode::DeleteGeometry) {
|
||||
if (BKE_pbvh_type(*object.sculpt->pbvh) == PBVH_GRIDS) {
|
||||
if (BKE_pbvh_type(*object.runtime->sculpt->pbvh) == PBVH_GRIDS) {
|
||||
/* Modification of base mesh geometry requires special remapping of multi-resolution
|
||||
* displacement, which does not happen here.
|
||||
* Disable delete operation. It can be supported in the future by doing similar displacement
|
||||
|
@ -1470,7 +1471,7 @@ static bool sculpt_face_set_edit_is_operation_valid(const Object &object,
|
|||
}
|
||||
|
||||
if (ELEM(mode, EditMode::FairPositions, EditMode::FairTangency)) {
|
||||
if (BKE_pbvh_type(*object.sculpt->pbvh) == PBVH_GRIDS) {
|
||||
if (BKE_pbvh_type(*object.runtime->sculpt->pbvh) == PBVH_GRIDS) {
|
||||
/* TODO: Multi-resolution topology representation using grids and duplicates can't be used
|
||||
* directly by the fair algorithm. Multi-resolution topology needs to be exposed in a
|
||||
* different way or converted to a mesh for this operation. */
|
||||
|
@ -1507,7 +1508,7 @@ static void sculpt_face_set_edit_modify_coordinates(
|
|||
bContext *C, Object *ob, const int active_face_set, const EditMode mode, wmOperator *op)
|
||||
{
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVH &pbvh = *ss->pbvh;
|
||||
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(pbvh, {});
|
||||
|
@ -1591,7 +1592,7 @@ static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
{
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
const Base *base = CTX_data_active_base(C);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -79,7 +80,7 @@ static void color_filter_task(Object *ob,
|
|||
const float *filter_fill_color,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
SculptOrigVertData orig_data;
|
||||
SCULPT_orig_vert_data_init(&orig_data, ob, node, undo::Type::Color);
|
||||
|
@ -270,7 +271,7 @@ static void sculpt_color_presmooth_init(SculptSession *ss)
|
|||
|
||||
static void sculpt_color_filter_apply(bContext *C, wmOperator *op, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const int mode = RNA_enum_get(op->ptr, "type");
|
||||
float filter_strength = RNA_float_get(op->ptr, "strength");
|
||||
|
@ -294,7 +295,7 @@ static void sculpt_color_filter_apply(bContext *C, wmOperator *op, Object *ob)
|
|||
|
||||
static void sculpt_color_filter_end(bContext *C, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
undo::push_end(ob);
|
||||
filter::cache_free(ss);
|
||||
|
@ -304,7 +305,7 @@ static void sculpt_color_filter_end(bContext *C, Object *ob)
|
|||
static int sculpt_color_filter_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
|
||||
sculpt_color_filter_end(C, ob);
|
||||
|
@ -328,7 +329,7 @@ static int sculpt_color_filter_init(bContext *C, wmOperator *op)
|
|||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
|
||||
const Base *base = CTX_data_active_base(C);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -160,8 +161,8 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op)
|
|||
|
||||
BKE_sculpt_update_object_for_edit(depsgraph, ob, false);
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
PBVH &pbvh = *ob->sculpt->pbvh;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVH &pbvh = *ob->runtime->sculpt->pbvh;
|
||||
|
||||
SCULPT_vertex_random_access_ensure(ss);
|
||||
|
||||
|
@ -185,7 +186,7 @@ static int sculpt_mask_filter_exec(bContext *C, wmOperator *op)
|
|||
iterations = int(num_verts / 50000.0f) + 1;
|
||||
}
|
||||
|
||||
const SculptMaskWriteInfo mask_write = SCULPT_mask_get_for_write(ob->sculpt);
|
||||
const SculptMaskWriteInfo mask_write = SCULPT_mask_get_for_write(ob->runtime->sculpt);
|
||||
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
if (ELEM(filter_type, FilterType::Grow, FilterType::Shrink)) {
|
||||
|
|
|
@ -105,8 +105,8 @@ void cache_init(bContext *C,
|
|||
float area_normal_radius,
|
||||
float start_strength)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
PBVH &pbvh = *ob->sculpt->pbvh;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVH &pbvh = *ob->runtime->sculpt->pbvh;
|
||||
|
||||
ss->filter_cache = MEM_new<filter::Cache>(__func__);
|
||||
ss->filter_cache->start_filter_strength = start_strength;
|
||||
|
@ -331,7 +331,7 @@ static void mesh_filter_task(Object *ob,
|
|||
const float filter_strength,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
SculptOrigVertData orig_data;
|
||||
SCULPT_orig_vert_data_init(&orig_data, ob, node, undo::Type::Position);
|
||||
|
@ -636,7 +636,7 @@ static void mesh_filter_surface_smooth_displace_task(Object *ob,
|
|||
const float filter_strength,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVHVertexIter vd;
|
||||
|
||||
auto_mask::NodeData automask_data = auto_mask::node_begin(
|
||||
|
@ -707,7 +707,7 @@ static void sculpt_mesh_update_status_bar(bContext *C, wmOperator *op)
|
|||
static void sculpt_mesh_filter_apply(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
eSculptMeshFilterType filter_type = eSculptMeshFilterType(RNA_enum_get(op->ptr, "type"));
|
||||
float filter_strength = RNA_float_get(op->ptr, "strength");
|
||||
|
@ -762,7 +762,7 @@ static void sculpt_mesh_filter_apply_with_history(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
float2 start_mouse;
|
||||
bool first = true;
|
||||
float initial_strength = ss->filter_cache->start_filter_strength;
|
||||
|
@ -788,7 +788,7 @@ static void sculpt_mesh_filter_apply_with_history(bContext *C, wmOperator *op)
|
|||
static void sculpt_mesh_filter_end(bContext *C)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
cache_free(ss);
|
||||
SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COORDS);
|
||||
|
@ -811,7 +811,7 @@ static int sculpt_mesh_filter_confirm(SculptSession *ss,
|
|||
static void sculpt_mesh_filter_cancel(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (!ss || !ss->pbvh) {
|
||||
return;
|
||||
|
@ -843,7 +843,7 @@ static int sculpt_mesh_filter_modal(bContext *C, wmOperator *op, const wmEvent *
|
|||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const eSculptMeshFilterType filter_type = eSculptMeshFilterType(RNA_enum_get(op->ptr, "type"));
|
||||
|
||||
WM_cursor_modal_set(CTX_wm_window(C), WM_CURSOR_EW_SCROLL);
|
||||
|
@ -970,7 +970,7 @@ static int sculpt_mesh_filter_start(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const eMeshFilterDeformAxis deform_axis = eMeshFilterDeformAxis(
|
||||
RNA_enum_get(op->ptr, "deform_axis"));
|
||||
|
@ -1042,7 +1042,7 @@ static int sculpt_mesh_filter_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if (ret == OPERATOR_PASS_THROUGH) {
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
int iterations = RNA_int_get(op->ptr, "iteration_count");
|
||||
bool has_history = RNA_collection_length(op->ptr, "event_history") > 0;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "BKE_mesh.hh"
|
||||
#include "BKE_mesh_mapping.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -81,7 +82,7 @@ static Array<float> geodesic_mesh_create(Object *ob,
|
|||
const Set<int> &initial_verts,
|
||||
const float limit_radius)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh *mesh = BKE_object_get_original_mesh(ob);
|
||||
|
||||
const int totvert = mesh->verts_num;
|
||||
|
@ -228,7 +229,7 @@ static Array<float> geodesic_mesh_create(Object *ob,
|
|||
* calculate the distance. */
|
||||
static Array<float> geodesic_fallback_create(Object *ob, const Set<int> &initial_verts)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Mesh *mesh = BKE_object_get_original_mesh(ob);
|
||||
const int totvert = mesh->verts_num;
|
||||
Array<float> dists(totvert, 0.0f);
|
||||
|
@ -251,7 +252,7 @@ static Array<float> geodesic_fallback_create(Object *ob, const Set<int> &initial
|
|||
|
||||
Array<float> distances_create(Object *ob, const Set<int> &initial_verts, const float limit_radius)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
switch (BKE_pbvh_type(*ss->pbvh)) {
|
||||
case PBVH_FACES:
|
||||
return geodesic_mesh_create(ob, initial_verts, limit_radius);
|
||||
|
@ -267,7 +268,7 @@ Array<float> distances_create_from_vert_and_symm(Object *ob,
|
|||
const PBVHVertRef vertex,
|
||||
const float limit_radius)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Set<int> initial_verts;
|
||||
|
||||
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "BLI_vector.hh"
|
||||
|
||||
#include "BKE_context.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
|
||||
#include "ED_view3d.hh"
|
||||
|
@ -65,7 +66,7 @@ static void init_common(bContext *C, wmOperator *op, GestureData &gesture_data)
|
|||
gesture_data.selection_type = SelectionType::Inside;
|
||||
|
||||
/* SculptSession */
|
||||
gesture_data.ss = ob->sculpt;
|
||||
gesture_data.ss = ob->runtime->sculpt;
|
||||
|
||||
/* Symmetry. */
|
||||
gesture_data.symm = ePaintSymmetryFlags(SCULPT_mesh_symmetry_xyz_get(ob));
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "BKE_context.hh"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_multires.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -51,7 +52,7 @@ static void mask_init_task(Object *ob,
|
|||
const SculptMaskWriteInfo mask_write,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVHVertexIter vd;
|
||||
undo::push_node(*ob, node, undo::Type::Mask);
|
||||
BKE_pbvh_vertex_iter_begin (*ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
|
||||
|
@ -78,7 +79,7 @@ static void mask_init_task(Object *ob,
|
|||
static int sculpt_mask_init_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
|
@ -94,7 +95,7 @@ static int sculpt_mask_init_exec(bContext *C, wmOperator *op)
|
|||
|
||||
BKE_sculpt_update_object_for_edit(depsgraph, ob, false);
|
||||
|
||||
PBVH &pbvh = *ob->sculpt->pbvh;
|
||||
PBVH &pbvh = *ob->runtime->sculpt->pbvh;
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(pbvh, {});
|
||||
|
||||
if (nodes.is_empty()) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BKE_ccg.h"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -46,7 +47,7 @@ static void calc_multiplane_scrape_surface_task(Object *ob,
|
|||
MultiplaneScrapeSampleData *mssd)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
||||
|
@ -109,7 +110,7 @@ static void do_multiplane_scrape_brush_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
@ -190,7 +191,7 @@ static void do_multiplane_scrape_brush_task(Object *ob,
|
|||
void SCULPT_do_multiplane_scrape_brush(Sculpt *sd, Object *ob, blender::Span<PBVHNode *> nodes)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const bool flip = (ss->cache->bstrength < 0.0f);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "BKE_mesh_mirror.hh"
|
||||
#include "BKE_multires.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_report.hh"
|
||||
|
@ -75,7 +76,7 @@ static int sculpt_set_persistent_base_exec(bContext *C, wmOperator * /*op*/)
|
|||
using namespace blender;
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const View3D *v3d = CTX_wm_view3d(C);
|
||||
const Base *base = CTX_data_active_base(C);
|
||||
|
@ -164,8 +165,8 @@ static void SCULPT_OT_optimize(wmOperatorType *ot)
|
|||
static bool sculpt_no_multires_poll(bContext *C)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
if (SCULPT_mode_poll(C) && ob->sculpt && ob->sculpt->pbvh) {
|
||||
return BKE_pbvh_type(*ob->sculpt->pbvh) != PBVH_GRIDS;
|
||||
if (SCULPT_mode_poll(C) && ob->runtime->sculpt && ob->runtime->sculpt->pbvh) {
|
||||
return BKE_pbvh_type(*ob->runtime->sculpt->pbvh) != PBVH_GRIDS;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -176,7 +177,7 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *op)
|
|||
Main *bmain = CTX_data_main(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
const Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVH *pbvh = ss->pbvh.get();
|
||||
const float dist = RNA_float_get(op->ptr, "merge_tolerance");
|
||||
|
||||
|
@ -283,11 +284,11 @@ static void sculpt_init_session(Main *bmain, Depsgraph *depsgraph, Scene *scene,
|
|||
BKE_sculpt_toolsettings_data_ensure(scene);
|
||||
|
||||
/* Create sculpt mode session data. */
|
||||
if (ob->sculpt != nullptr) {
|
||||
if (ob->runtime->sculpt != nullptr) {
|
||||
BKE_sculptsession_free(ob);
|
||||
}
|
||||
ob->sculpt = MEM_new<SculptSession>(__func__);
|
||||
ob->sculpt->mode_type = OB_MODE_SCULPT;
|
||||
ob->runtime->sculpt = MEM_new<SculptSession>(__func__);
|
||||
ob->runtime->sculpt->mode_type = OB_MODE_SCULPT;
|
||||
|
||||
/* Trigger evaluation of modifier stack to ensure
|
||||
* multires modifier sets .runtime.ccg in
|
||||
|
@ -320,7 +321,7 @@ static void sculpt_init_session(Main *bmain, Depsgraph *depsgraph, Scene *scene,
|
|||
void ensure_valid_pivot(const Object *ob, Scene *scene)
|
||||
{
|
||||
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
|
||||
const SculptSession *ss = ob->sculpt;
|
||||
const SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
/* Account for the case where no objects are evaluated. */
|
||||
if (!ss->pbvh) {
|
||||
|
@ -329,7 +330,7 @@ void ensure_valid_pivot(const Object *ob, Scene *scene)
|
|||
|
||||
/* No valid pivot? Use bounding box center. */
|
||||
if (ups->average_stroke_counter == 0 || !ups->last_stroke_valid) {
|
||||
const Bounds<float3> bounds = bke::pbvh::bounds_get(*ob->sculpt->pbvh);
|
||||
const Bounds<float3> bounds = bke::pbvh::bounds_get(*ob->runtime->sculpt->pbvh);
|
||||
const float3 center = math::midpoint(bounds.min, bounds.max);
|
||||
const float3 location = math::transform_point(ob->object_to_world(), center);
|
||||
|
||||
|
@ -460,7 +461,7 @@ void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scen
|
|||
|
||||
/* Always for now, so leaving sculpt mode always ensures scene is in
|
||||
* a consistent state. */
|
||||
if (true || /* flush_recalc || */ (ob->sculpt && ob->sculpt->bm)) {
|
||||
if (true || /* flush_recalc || */ (ob->runtime->sculpt && ob->runtime->sculpt->bm)) {
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
}
|
||||
|
||||
|
@ -642,7 +643,7 @@ static int sculpt_sample_color_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVHVertRef active_vertex = SCULPT_active_vertex_get(ss);
|
||||
float active_vertex_color[4];
|
||||
|
||||
|
@ -756,7 +757,7 @@ static void do_mask_by_color_contiguous_update_node(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
undo::push_node(*ob, node, undo::Type::Mask);
|
||||
bool update_node = false;
|
||||
|
@ -815,7 +816,7 @@ static void sculpt_mask_by_color_contiguous(Object *object,
|
|||
{
|
||||
using namespace blender;
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = object->sculpt;
|
||||
SculptSession *ss = object->runtime->sculpt;
|
||||
const int totvert = SCULPT_vertex_count_get(ss);
|
||||
|
||||
float *new_mask = MEM_cnew_array<float>(totvert, __func__);
|
||||
|
@ -865,7 +866,7 @@ static void do_mask_by_color_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
undo::push_node(*ob, node, undo::Type::Mask);
|
||||
bool update_node = false;
|
||||
|
@ -904,7 +905,7 @@ static void sculpt_mask_by_color_full_mesh(Object *object,
|
|||
const bool preserve_mask)
|
||||
{
|
||||
using namespace blender;
|
||||
SculptSession *ss = object->sculpt;
|
||||
SculptSession *ss = object->runtime->sculpt;
|
||||
|
||||
Vector<PBVHNode *> nodes = blender::bke::pbvh::search_gather(*ss->pbvh, {});
|
||||
const SculptMaskWriteInfo mask_write = SCULPT_mask_get_for_write(ss);
|
||||
|
@ -921,7 +922,7 @@ static int sculpt_mask_by_color_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
using namespace blender::ed::sculpt_paint;
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
|
||||
{
|
||||
|
@ -1039,7 +1040,7 @@ static void sculpt_bake_cavity_exec_task(Object *ob,
|
|||
PBVHNode *node)
|
||||
{
|
||||
using namespace blender::ed::sculpt_paint;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
PBVHVertexIter vd;
|
||||
|
||||
undo::push_node(*ob, node, undo::Type::Mask);
|
||||
|
@ -1088,7 +1089,7 @@ static int sculpt_bake_cavity_exec(bContext *C, wmOperator *op)
|
|||
using namespace blender::ed::sculpt_paint;
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "BKE_brush.hh"
|
||||
#include "BKE_colorband.hh"
|
||||
#include "BKE_colortools.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -37,7 +38,7 @@ namespace blender::ed::sculpt_paint::color {
|
|||
|
||||
static void do_color_smooth_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -85,7 +86,7 @@ static void do_paint_brush_task(Object *ob,
|
|||
float *wet_mix_sampled_color,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = fabsf(ss->cache->bstrength);
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -247,7 +248,7 @@ void do_paint_brush(PaintModeSettings *paint_mode_settings,
|
|||
}
|
||||
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (!SCULPT_has_colors(ss)) {
|
||||
return;
|
||||
|
@ -332,7 +333,7 @@ void do_paint_brush(PaintModeSettings *paint_mode_settings,
|
|||
|
||||
static void do_smear_brush_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -488,7 +489,7 @@ static void do_smear_store_prev_colors_task(SculptSession *ss,
|
|||
void do_smear_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (!SCULPT_has_colors(ss) || ss->cache->bstrength == 0.0f) {
|
||||
return;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "BKE_brush.hh"
|
||||
#include "BKE_image_wrappers.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
#include "BKE_pbvh_pixels.hh"
|
||||
|
||||
|
@ -331,7 +332,7 @@ static std::vector<bool> init_uv_primitives_brush_test(SculptSession *ss,
|
|||
static void do_paint_pixels(TexturePaintingUserData *data, const int n)
|
||||
{
|
||||
Object *ob = data->ob;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const Brush *brush = data->brush;
|
||||
PBVH &pbvh = *ss->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
|
@ -523,7 +524,7 @@ static void fix_non_manifold_seam_bleeding(PBVH &pbvh,
|
|||
static void fix_non_manifold_seam_bleeding(Object &ob, TexturePaintingUserData &user_data)
|
||||
{
|
||||
Vector<image::TileNumber> dirty_tiles = collect_dirty_tiles(user_data.nodes);
|
||||
fix_non_manifold_seam_bleeding(*ob.sculpt->pbvh, user_data, dirty_tiles);
|
||||
fix_non_manifold_seam_bleeding(*ob.runtime->sculpt->pbvh, user_data, dirty_tiles);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "BKE_brush.hh"
|
||||
#include "BKE_ccg.h"
|
||||
#include "BKE_colortools.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -130,7 +131,7 @@ static void pose_solve_scale_chain(SculptPoseIKChain &ik_chain, const float scal
|
|||
|
||||
static void do_pose_brush_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
SculptPoseIKChain &ik_chain = *ss->cache->pose_ik_chain;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
@ -196,7 +197,7 @@ static void pose_brush_grow_factor_task(Object *ob,
|
|||
PBVHNode *node,
|
||||
PoseGrowFactorData *gftd)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
PBVHVertexIter vd;
|
||||
BKE_pbvh_vertex_iter_begin (*ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
|
||||
|
@ -233,7 +234,7 @@ static void sculpt_pose_grow_pose_factor(Object *ob,
|
|||
float *r_pose_origin,
|
||||
MutableSpan<float> pose_factor)
|
||||
{
|
||||
PBVH &pbvh = *ob->sculpt->pbvh;
|
||||
PBVH &pbvh = *ob->runtime->sculpt->pbvh;
|
||||
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(pbvh, {});
|
||||
|
||||
|
@ -944,7 +945,7 @@ std::unique_ptr<SculptPoseIKChain> ik_chain_init(
|
|||
|
||||
void pose_brush_init(Object *ob, SculptSession *ss, Brush *br)
|
||||
{
|
||||
PBVH &pbvh = *ob->sculpt->pbvh;
|
||||
PBVH &pbvh = *ob->runtime->sculpt->pbvh;
|
||||
|
||||
Vector<PBVHNode *> nodes = bke::pbvh::search_gather(pbvh, {});
|
||||
|
||||
|
@ -1090,7 +1091,7 @@ static void sculpt_pose_align_pivot_local_space(float r_mat[4][4],
|
|||
|
||||
void do_pose_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "DNA_brush_types.h"
|
||||
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -198,7 +199,7 @@ static void do_enhance_details_brush_task(Object *ob,
|
|||
const Brush *brush,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
||||
|
@ -240,7 +241,7 @@ static void do_enhance_details_brush_task(Object *ob,
|
|||
|
||||
static void enhance_details_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
SCULPT_vertex_random_access_ensure(ss);
|
||||
|
@ -273,7 +274,7 @@ static void smooth_mask_node(Object *ob,
|
|||
float bstrength,
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
||||
|
@ -316,7 +317,7 @@ static void smooth_mask_node(Object *ob,
|
|||
|
||||
void do_smooth_mask_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes, float bstrength)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const int max_iterations = 4;
|
||||
|
@ -345,7 +346,7 @@ void do_smooth_mask_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes, float
|
|||
static void smooth_position_node(
|
||||
Object *ob, Sculpt *sd, const Brush *brush, float bstrength, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
PBVHVertexIter vd;
|
||||
|
||||
|
@ -388,7 +389,7 @@ static void smooth_position_node(
|
|||
|
||||
void do_smooth_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes, float bstrength)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
|
||||
const int max_iterations = 4;
|
||||
|
@ -414,7 +415,7 @@ void do_smooth_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes, float bstre
|
|||
|
||||
void do_smooth_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
/* NOTE: The enhance brush needs to initialize its state on the first brush step. The stroke
|
||||
* strength can become 0 during the stroke, but it can not change sign (the sign is determined
|
||||
|
@ -484,7 +485,7 @@ void surface_smooth_displace_step(SculptSession *ss,
|
|||
|
||||
static void do_surface_smooth_brush_laplacian_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
float alpha = brush->surface_smooth_shape_preservation;
|
||||
|
||||
|
@ -529,7 +530,7 @@ static void do_surface_smooth_brush_laplacian_task(Object *ob, const Brush *brus
|
|||
|
||||
static void do_surface_smooth_brush_displace_task(Object *ob, const Brush *brush, PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const float bstrength = ss->cache->bstrength;
|
||||
const float beta = brush->surface_smooth_current_vertex;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "BKE_context.hh"
|
||||
#include "BKE_kelvinlet.h"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_pbvh_api.hh"
|
||||
|
||||
|
@ -42,7 +43,7 @@ namespace blender::ed::sculpt_paint {
|
|||
void init_transform(bContext *C, Object *ob, const float mval_fl[2], const char *undo_name)
|
||||
{
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
|
||||
copy_v3_v3(ss->init_pivot_pos, ss->pivot_pos);
|
||||
|
@ -136,7 +137,7 @@ static void transform_matrices_init(SculptSession *ss,
|
|||
|
||||
static void transform_node(Object *ob, const float transform_mats[8][4][4], PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
SculptOrigVertData orig_data;
|
||||
SCULPT_orig_vert_data_init(&orig_data, ob, node, undo::Type::Position);
|
||||
|
@ -174,7 +175,7 @@ static void transform_node(Object *ob, const float transform_mats[8][4][4], PBVH
|
|||
|
||||
static void sculpt_transform_all_vertices(Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
||||
float transform_mats[8][4][4];
|
||||
|
@ -195,7 +196,7 @@ static void elastic_transform_node(Object *ob,
|
|||
const float elastic_transform_pivot[3],
|
||||
PBVHNode *node)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
const MutableSpan<float3> proxy = BKE_pbvh_node_add_proxy(*ss->pbvh, *node).co;
|
||||
|
||||
|
@ -237,7 +238,7 @@ static void elastic_transform_node(Object *ob,
|
|||
|
||||
static void transform_radius_elastic(Sculpt *sd, Object *ob, const float transform_radius)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
BLI_assert(ss->filter_cache->transform_displacement_mode ==
|
||||
SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL);
|
||||
|
||||
|
@ -276,7 +277,7 @@ static void transform_radius_elastic(Sculpt *sd, Object *ob, const float transfo
|
|||
void update_modal_transform(bContext *C, Object *ob)
|
||||
{
|
||||
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
|
||||
|
||||
SCULPT_vertex_random_access_ensure(ss);
|
||||
|
@ -320,7 +321,7 @@ void update_modal_transform(bContext *C, Object *ob)
|
|||
|
||||
void end_transform(bContext *C, Object *ob)
|
||||
{
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
if (ss->filter_cache) {
|
||||
filter::cache_free(ss);
|
||||
}
|
||||
|
@ -367,7 +368,7 @@ static EnumPropertyItem prop_sculpt_pivot_position_types[] = {
|
|||
static int set_pivot_position_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "BKE_layer.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
|
||||
#include "DNA_modifier_types.h"
|
||||
|
||||
|
@ -448,7 +449,7 @@ static void generate_geometry(gesture::GestureData &gesture_data)
|
|||
static void gesture_begin(bContext &C, gesture::GestureData &gesture_data)
|
||||
{
|
||||
Object *object = gesture_data.vc.obact;
|
||||
SculptSession *ss = object->sculpt;
|
||||
SculptSession *ss = object->runtime->sculpt;
|
||||
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(&C);
|
||||
generate_geometry(gesture_data);
|
||||
|
@ -674,7 +675,7 @@ static bool can_invoke(const bContext &C)
|
|||
static bool can_exec(const bContext &C)
|
||||
{
|
||||
const Object &object = *CTX_data_active_object(&C);
|
||||
const SculptSession &ss = *object.sculpt;
|
||||
const SculptSession &ss = *object.runtime->sculpt;
|
||||
if (BKE_pbvh_type(*ss.pbvh) != PBVH_FACES) {
|
||||
/* Not supported in Multires and Dyntopo. */
|
||||
return false;
|
||||
|
@ -693,7 +694,7 @@ static void initialize_cursor_info(bContext &C,
|
|||
gesture::GestureData &gesture_data)
|
||||
{
|
||||
const Object &ob = *CTX_data_active_object(&C);
|
||||
SculptSession &ss = *ob.sculpt;
|
||||
SculptSession &ss = *ob.runtime->sculpt;
|
||||
|
||||
SCULPT_vertex_random_access_ensure(&ss);
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "BKE_mesh.hh"
|
||||
#include "BKE_multires.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_scene.hh"
|
||||
#include "BKE_subdiv_ccg.hh"
|
||||
|
@ -193,7 +194,8 @@ static void print_sculpt_node(Object *ob, Node *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(object.sculpt ? object.sculpt->bm : nullptr, node->bm_entry);
|
||||
BM_log_print_entry(object.runtime->sculpt ? object.runtime->sculpt->bm : nullptr,
|
||||
node->bm_entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,7 +421,7 @@ static bool restore_coords(bContext *C,
|
|||
Node &unode,
|
||||
MutableSpan<bool> modified_verts)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
|
||||
|
||||
if (unode.mesh_verts_num) {
|
||||
|
@ -523,7 +525,7 @@ static bool restore_coords(bContext *C,
|
|||
|
||||
static bool restore_hidden(Object &object, Node &unode, MutableSpan<bool> modified_vertices)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
|
||||
|
||||
if (unode.mesh_verts_num) {
|
||||
|
@ -592,7 +594,7 @@ static bool restore_hidden_face(Object &object, Node &unode, MutableSpan<bool> m
|
|||
static bool restore_color(Object &object, Node &unode, MutableSpan<bool> modified_vertices)
|
||||
{
|
||||
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
|
||||
bool modified = false;
|
||||
|
||||
|
@ -621,7 +623,7 @@ static bool restore_color(Object &object, Node &unode, MutableSpan<bool> modifie
|
|||
static bool restore_mask(Object &object, Node &unode, MutableSpan<bool> modified_vertices)
|
||||
{
|
||||
Mesh *mesh = BKE_object_get_original_mesh(&object);
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
|
||||
|
||||
if (unode.mesh_verts_num) {
|
||||
|
@ -706,7 +708,7 @@ static void bmesh_restore_generic(Node &unode, Object &object, SculptSession *ss
|
|||
/* Create empty sculpt BMesh and enable logging. */
|
||||
static void bmesh_enable(Object &object, Node &unode)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
Mesh *mesh = static_cast<Mesh *>(object.data);
|
||||
|
||||
SCULPT_pbvh_clear(&object);
|
||||
|
@ -890,7 +892,7 @@ static void restore_list(bContext *C, Depsgraph *depsgraph, UndoSculpt &usculpt)
|
|||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
Object &object = *BKE_view_layer_active_object_get(view_layer);
|
||||
Mesh &mesh = *static_cast<Mesh *>(object.data);
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
|
||||
|
||||
bool clear_automask_cache = false;
|
||||
|
@ -1186,7 +1188,7 @@ static Node *find_or_alloc_node_type(const Object &object, const Type type)
|
|||
static Node *alloc_node(const Object &object, const PBVHNode *node, const Type type)
|
||||
{
|
||||
UndoSculpt *usculpt = get_nodes();
|
||||
const SculptSession *ss = object.sculpt;
|
||||
const SculptSession *ss = object.runtime->sculpt;
|
||||
|
||||
Node *unode = alloc_node_type(object, type);
|
||||
unode->node = node;
|
||||
|
@ -1303,7 +1305,7 @@ static Node *alloc_node(const Object &object, const PBVHNode *node, const Type t
|
|||
|
||||
static void store_coords(const Object &object, Node *unode)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
|
||||
if (!unode->grids.is_empty()) {
|
||||
const SubdivCCG &subdiv_ccg = *ss->subdiv_ccg;
|
||||
|
@ -1383,7 +1385,7 @@ static void store_face_hidden(const Object &object, Node &unode)
|
|||
|
||||
static void store_mask(const Object &object, Node *unode)
|
||||
{
|
||||
const SculptSession *ss = object.sculpt;
|
||||
const SculptSession *ss = object.runtime->sculpt;
|
||||
|
||||
if (!unode->grids.is_empty()) {
|
||||
const SubdivCCG &subdiv_ccg = *ss->subdiv_ccg;
|
||||
|
@ -1418,7 +1420,7 @@ static void store_mask(const Object &object, Node *unode)
|
|||
static void store_color(const Object &object, Node *unode)
|
||||
{
|
||||
const Mesh &mesh = *static_cast<const Mesh *>(object.data);
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
|
||||
BLI_assert(BKE_pbvh_type(*ss->pbvh) == PBVH_FACES);
|
||||
|
||||
|
@ -1468,7 +1470,7 @@ static void store_face_sets(const Mesh &mesh, Node &unode)
|
|||
static Node *bmesh_push(const Object &object, const PBVHNode *node, Type type)
|
||||
{
|
||||
UndoSculpt *usculpt = get_nodes();
|
||||
const SculptSession *ss = object.sculpt;
|
||||
const SculptSession *ss = object.runtime->sculpt;
|
||||
|
||||
Node *unode = usculpt->nodes.is_empty() ? nullptr : usculpt->nodes.first().get();
|
||||
|
||||
|
@ -1551,7 +1553,7 @@ static Node *bmesh_push(const Object &object, const PBVHNode *node, Type type)
|
|||
|
||||
Node *push_node(const Object &object, const PBVHNode *node, Type type)
|
||||
{
|
||||
SculptSession *ss = object.sculpt;
|
||||
SculptSession *ss = object.runtime->sculpt;
|
||||
|
||||
Node *unode;
|
||||
|
||||
|
@ -1774,8 +1776,8 @@ static void set_active_layer(bContext *C, SculptAttrRef *attr)
|
|||
if (layer) {
|
||||
BKE_id_attributes_active_color_set(&mesh->id, layer->name);
|
||||
|
||||
if (ob->sculpt && ob->sculpt->pbvh) {
|
||||
BKE_pbvh_update_active_vcol(*ob->sculpt->pbvh, mesh);
|
||||
if (ob->runtime->sculpt && ob->runtime->sculpt->pbvh) {
|
||||
BKE_pbvh_update_active_vcol(*ob->runtime->sculpt->pbvh, mesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1916,8 +1918,8 @@ static void sculpt_undosys_step_decode(
|
|||
ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, nullptr);
|
||||
}
|
||||
|
||||
if (ob->sculpt) {
|
||||
ob->sculpt->needs_flush_to_id = 1;
|
||||
if (ob->runtime->sculpt) {
|
||||
ob->runtime->sculpt->needs_flush_to_id = 1;
|
||||
}
|
||||
bmain->is_memfile_undo_flush_needed = true;
|
||||
}
|
||||
|
@ -2024,14 +2026,14 @@ static bool use_multires_mesh(bContext *C)
|
|||
}
|
||||
|
||||
Object *object = CTX_data_active_object(C);
|
||||
SculptSession *sculpt_session = object->sculpt;
|
||||
SculptSession *sculpt_session = object->runtime->sculpt;
|
||||
|
||||
return sculpt_session->multires.active;
|
||||
}
|
||||
|
||||
static void push_all_grids(Object *object)
|
||||
{
|
||||
SculptSession *ss = object->sculpt;
|
||||
SculptSession *ss = object->runtime->sculpt;
|
||||
|
||||
/* It is possible that undo push is done from an object state where there is no PBVH. This
|
||||
* happens, for example, when an operation which tagged for geometry update was performed prior
|
||||
|
|
|
@ -357,13 +357,13 @@ static void stats_object_pose(const Object *ob, SceneStats *stats)
|
|||
static bool stats_is_object_dynamic_topology_sculpt(const Object *ob)
|
||||
{
|
||||
BLI_assert(ob->mode & OB_MODE_SCULPT);
|
||||
return (ob->sculpt && ob->sculpt->bm);
|
||||
return (ob->runtime->sculpt && ob->runtime->sculpt->bm);
|
||||
}
|
||||
|
||||
static void stats_object_sculpt(const Object *ob, SceneStats *stats)
|
||||
{
|
||||
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
if (ss == nullptr || ss->pbvh == nullptr) {
|
||||
return;
|
||||
|
@ -375,8 +375,8 @@ static void stats_object_sculpt(const Object *ob, SceneStats *stats)
|
|||
stats->totfacesculpt = ss->totfaces;
|
||||
break;
|
||||
case PBVH_BMESH:
|
||||
stats->totvertsculpt = ob->sculpt->bm->totvert;
|
||||
stats->tottri = ob->sculpt->bm->totface;
|
||||
stats->totvertsculpt = ob->runtime->sculpt->bm->totvert;
|
||||
stats->tottri = ob->runtime->sculpt->bm->totface;
|
||||
break;
|
||||
case PBVH_GRIDS:
|
||||
stats->totvertsculpt = BKE_pbvh_get_grid_num_verts(*ss->pbvh);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_modifier.hh"
|
||||
#include "BKE_nla.h"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_scene.hh"
|
||||
|
||||
#include "ED_particle.hh"
|
||||
|
@ -891,7 +892,7 @@ static TransConvertTypeInfo *convert_type_get(const TransInfo *t, Object **r_obj
|
|||
return &TransConvertType_Cursor3D;
|
||||
}
|
||||
if (!(t->options & CTX_PAINT_CURVE) && (t->spacetype == SPACE_VIEW3D) && ob &&
|
||||
(ob->mode == OB_MODE_SCULPT) && ob->sculpt)
|
||||
(ob->mode == OB_MODE_SCULPT) && ob->runtime->sculpt)
|
||||
{
|
||||
return &TransConvertType_Sculpt;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "BKE_context.hh"
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_report.hh"
|
||||
|
||||
|
@ -40,7 +41,7 @@ static void createTransSculpt(bContext *C, TransInfo *t)
|
|||
|
||||
BKE_view_layer_synced_ensure(t->scene, t->view_layer);
|
||||
Object *ob = BKE_view_layer_active_object_get(t->view_layer);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
|
||||
/* Avoid editing locked shapes. */
|
||||
if (t->mode != TFM_DUMMY && ED_sculpt_report_if_shape_key_is_locked(ob, t->reports)) {
|
||||
|
|
|
@ -887,7 +887,7 @@ static int gizmo_3d_foreach_selected(const bContext *C,
|
|||
else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
|
||||
if (ob->mode & OB_MODE_SCULPT) {
|
||||
totsel = 1;
|
||||
run_coord_with_matrix(ob->sculpt->pivot_pos, false, ob->object_to_world().ptr());
|
||||
run_coord_with_matrix(ob->runtime->sculpt->pivot_pos, false, ob->object_to_world().ptr());
|
||||
}
|
||||
}
|
||||
else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
|
||||
|
@ -1091,8 +1091,8 @@ static bool gizmo_3d_calc_pos(const bContext *C,
|
|||
BKE_view_layer_synced_ensure(scene, view_layer);
|
||||
Object *ob = BKE_view_layer_active_object_get(view_layer);
|
||||
if (ob != nullptr) {
|
||||
if ((ob->mode & OB_MODE_ALL_SCULPT) && ob->sculpt) {
|
||||
SculptSession *ss = ob->sculpt;
|
||||
if ((ob->mode & OB_MODE_ALL_SCULPT) && ob->runtime->sculpt) {
|
||||
SculptSession *ss = ob->runtime->sculpt;
|
||||
copy_v3_v3(r_pivot_pos, ss->pivot_pos);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "BKE_material.h"
|
||||
#include "BKE_multires.hh"
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_object_types.hh"
|
||||
#include "BKE_packedFile.h"
|
||||
#include "BKE_paint.hh"
|
||||
#include "BKE_screen.hh"
|
||||
|
@ -266,8 +267,8 @@ bool ED_editors_flush_edits_for_object_ex(Main *bmain,
|
|||
/* Don't allow flushing while in the middle of a stroke (frees data in use).
|
||||
* Auto-save prevents this from happening but scripts
|
||||
* may cause a flush on saving: #53986. */
|
||||
if (ob->sculpt != nullptr && ob->sculpt->cache == nullptr) {
|
||||
char *needs_flush_ptr = &ob->sculpt->needs_flush_to_id;
|
||||
if (ob->runtime->sculpt != nullptr && ob->runtime->sculpt->cache == nullptr) {
|
||||
char *needs_flush_ptr = &ob->runtime->sculpt->needs_flush_to_id;
|
||||
if (check_needs_flush && (*needs_flush_ptr == 0)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ struct Object;
|
|||
struct PartDeflect;
|
||||
struct Path;
|
||||
struct RigidBodyOb;
|
||||
struct SculptSession;
|
||||
struct SoftBody;
|
||||
struct bGPdata;
|
||||
|
||||
|
@ -204,8 +203,6 @@ typedef struct Object {
|
|||
*/
|
||||
struct DrawDataList drawdata;
|
||||
|
||||
struct SculptSession *sculpt;
|
||||
|
||||
short type; /* #ObjectType */
|
||||
short partype;
|
||||
/** Can be vertex indices. */
|
||||
|
|
|
@ -559,6 +559,7 @@ static const EnumPropertyItem rna_enum_curve_display_handle_items[] = {
|
|||
# include "BKE_idprop.hh"
|
||||
# include "BKE_layer.hh"
|
||||
# include "BKE_nla.h"
|
||||
# include "BKE_object_types.hh"
|
||||
# include "BKE_paint.hh"
|
||||
# include "BKE_preferences.h"
|
||||
# include "BKE_scene.hh"
|
||||
|
@ -1186,7 +1187,7 @@ static void rna_3DViewShading_type_update(Main *bmain, Scene *scene, PointerRNA
|
|||
/* When switching from workbench to render or material mode the geometry of any
|
||||
* active sculpt session needs to be recalculated. */
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->sculpt) {
|
||||
if (ob->runtime->sculpt) {
|
||||
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,8 +225,8 @@ static Mesh *modify_mesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh
|
|||
* stroke: i.e. when exiting blender right after stroke is done.
|
||||
* Annoying and not so much black-boxed as far as sculpting goes, and
|
||||
* surely there is a better way of solving this. */
|
||||
if (ctx->object->sculpt != nullptr) {
|
||||
SculptSession *sculpt_session = ctx->object->sculpt;
|
||||
if (ctx->object->runtime->sculpt != nullptr) {
|
||||
SculptSession *sculpt_session = ctx->object->runtime->sculpt;
|
||||
sculpt_session->subdiv_ccg = result->runtime->subdiv_ccg.get();
|
||||
sculpt_session->multires.active = true;
|
||||
sculpt_session->multires.modifier = mmd;
|
||||
|
|
Loading…
Reference in New Issue