WIP: Rewrite asset browser as separate editor #104978
|
@ -598,12 +598,8 @@ void BKE_modifier_deform_vertsEM(ModifierData *md,
|
|||
* e.g. second operand for boolean modifier.
|
||||
* Note that modifiers in stack always get fully evaluated COW ID pointers,
|
||||
* never original ones. Makes things simpler.
|
||||
*
|
||||
* \param get_cage_mesh: Return evaluated mesh with only deforming modifiers applied
|
||||
* (i.e. mesh topology remains the same as original one, a.k.a. 'cage' mesh).
|
||||
*/
|
||||
struct Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(struct Object *ob_eval,
|
||||
bool get_cage_mesh);
|
||||
struct Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(struct Object *ob_eval);
|
||||
|
||||
void BKE_modifier_check_uuids_unique_and_report(const struct Object *object);
|
||||
|
||||
|
|
|
@ -1410,7 +1410,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
|
|||
BKE_mesh_remap_calc_source_cddata_masks_from_map_modes(
|
||||
map_vert_mode, map_edge_mode, map_loop_mode, map_poly_mode, &me_src_mask);
|
||||
if (is_modifier) {
|
||||
me_src = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_src, false);
|
||||
me_src = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_src);
|
||||
|
||||
if (me_src == NULL ||
|
||||
!CustomData_MeshMasks_are_matching(&ob_src->runtime.last_data_mask, &me_src_mask)) {
|
||||
|
|
|
@ -27,8 +27,8 @@ static void geometry_set_collect_recursive_collection(const Collection &collecti
|
|||
|
||||
static void add_final_mesh_as_geometry_component(const Object &object, GeometrySet &geometry_set)
|
||||
{
|
||||
Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(&const_cast<Object &>(object),
|
||||
false);
|
||||
Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(
|
||||
&const_cast<Object &>(object));
|
||||
|
||||
if (mesh != nullptr) {
|
||||
BKE_mesh_wrapper_ensure_mdata(mesh);
|
||||
|
|
|
@ -95,7 +95,7 @@ void BKE_gpencil_cache_data_init(Depsgraph *depsgraph, Object *ob)
|
|||
MEM_SAFE_FREE(mmd->cache_data);
|
||||
}
|
||||
Object *ob_target = DEG_get_evaluated_object(depsgraph, ob);
|
||||
Mesh *target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
|
||||
Mesh *target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target);
|
||||
mmd->cache_data = MEM_callocN(sizeof(ShrinkwrapTreeData), __func__);
|
||||
if (BKE_shrinkwrap_init_tree(
|
||||
mmd->cache_data, target, mmd->shrink_type, mmd->shrink_mode, false)) {
|
||||
|
|
|
@ -207,7 +207,7 @@ static void main_namemap_populate(UniqueName_Map *name_map, struct Main *bmain,
|
|||
|
||||
/* Insert the full name into the set. */
|
||||
UniqueName_Key key;
|
||||
strncpy(key.name, id->name + 2, MAX_NAME);
|
||||
BLI_strncpy(key.name, id->name + 2, MAX_NAME);
|
||||
type_map->full_names.add(key);
|
||||
|
||||
/* Get the name and number parts ("name.number"). */
|
||||
|
@ -255,7 +255,7 @@ bool BKE_main_namemap_get_name(struct Main *bmain, struct ID *id, char *name)
|
|||
UniqueName_Key key;
|
||||
while (true) {
|
||||
/* Check if the full original name has a duplicate. */
|
||||
strncpy(key.name, name, MAX_NAME);
|
||||
BLI_strncpy(key.name, name, MAX_NAME);
|
||||
const bool has_dup = type_map->full_names.contains(key);
|
||||
|
||||
/* Get the name and number parts ("name.number"). */
|
||||
|
@ -275,7 +275,7 @@ bool BKE_main_namemap_get_name(struct Main *bmain, struct ID *id, char *name)
|
|||
val.mark_used(number);
|
||||
|
||||
if (!has_dup) {
|
||||
strncpy(key.name, name, MAX_NAME);
|
||||
BLI_strncpy(key.name, name, MAX_NAME);
|
||||
type_map->full_names.add(key);
|
||||
}
|
||||
return is_name_changed;
|
||||
|
@ -310,7 +310,7 @@ bool BKE_main_namemap_get_name(struct Main *bmain, struct ID *id, char *name)
|
|||
BLI_assert(number_to_use >= MIN_NUMBER);
|
||||
if (id_name_final_build(name, key.name, base_name_len, number_to_use)) {
|
||||
/* All good, add final name to the set. */
|
||||
strncpy(key.name, name, MAX_NAME);
|
||||
BLI_strncpy(key.name, name, MAX_NAME);
|
||||
type_map->full_names.add(key);
|
||||
break;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ void BKE_main_namemap_remove_name(struct Main *bmain, struct ID *id, const char
|
|||
|
||||
UniqueName_Key key;
|
||||
/* Remove full name from the set. */
|
||||
strncpy(key.name, name, MAX_NAME);
|
||||
BLI_strncpy(key.name, name, MAX_NAME);
|
||||
type_map->full_names.remove(key);
|
||||
|
||||
int number = MIN_NUMBER;
|
||||
|
|
|
@ -1035,8 +1035,7 @@ void BKE_modifier_deform_vertsEM(ModifierData *md,
|
|||
|
||||
/* end modifier callback wrappers */
|
||||
|
||||
Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval,
|
||||
const bool get_cage_mesh)
|
||||
Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval)
|
||||
{
|
||||
Mesh *me = NULL;
|
||||
|
||||
|
@ -1045,17 +1044,11 @@ Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(Object *ob_eval,
|
|||
BMEditMesh *em = BKE_editmesh_from_object(ob_eval);
|
||||
/* 'em' might not exist yet in some cases, just after loading a .blend file, see T57878. */
|
||||
if (em != NULL) {
|
||||
Mesh *editmesh_eval_final = BKE_object_get_editmesh_eval_final(ob_eval);
|
||||
Mesh *editmesh_eval_cage = BKE_object_get_editmesh_eval_cage(ob_eval);
|
||||
|
||||
me = (get_cage_mesh && editmesh_eval_cage != NULL) ? editmesh_eval_cage :
|
||||
editmesh_eval_final;
|
||||
me = BKE_object_get_editmesh_eval_final(ob_eval);
|
||||
}
|
||||
}
|
||||
if (me == NULL) {
|
||||
me = (get_cage_mesh && ob_eval->runtime.mesh_deform_eval != NULL) ?
|
||||
ob_eval->runtime.mesh_deform_eval :
|
||||
BKE_object_get_evaluated_mesh(ob_eval);
|
||||
me = BKE_object_get_evaluated_mesh(ob_eval);
|
||||
}
|
||||
|
||||
return me;
|
||||
|
|
|
@ -666,7 +666,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
|
|||
}
|
||||
|
||||
if (calc->aux_target) {
|
||||
auxMesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(calc->aux_target, false);
|
||||
auxMesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(calc->aux_target);
|
||||
if (!auxMesh) {
|
||||
return;
|
||||
}
|
||||
|
@ -1397,7 +1397,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd,
|
|||
|
||||
if (smd->target != NULL) {
|
||||
Object *ob_target = DEG_get_evaluated_object(ctx->depsgraph, smd->target);
|
||||
calc.target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
|
||||
calc.target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target);
|
||||
|
||||
/* TODO: there might be several "bugs" with non-uniform scales matrices
|
||||
* because it will no longer be nearest surface, not sphere projection
|
||||
|
|
|
@ -36,8 +36,6 @@ class AbstractGridViewItem : public AbstractViewItem {
|
|||
friend class AbstractGridView;
|
||||
friend class GridViewLayoutBuilder;
|
||||
|
||||
const AbstractGridView *view_;
|
||||
|
||||
protected:
|
||||
/** Reference to a string that uniquely identifies this item in the view. */
|
||||
StringRef identifier_{};
|
||||
|
|
|
@ -29,9 +29,8 @@ AbstractGridViewItem &AbstractGridView::add_item(std::unique_ptr<AbstractGridVie
|
|||
items_.append(std::move(item));
|
||||
|
||||
AbstractGridViewItem &added_item = *items_.last();
|
||||
added_item.view_ = this;
|
||||
|
||||
item_map_.add(added_item.identifier_, &added_item);
|
||||
register_item(added_item);
|
||||
|
||||
return added_item;
|
||||
}
|
||||
|
@ -180,7 +179,7 @@ const AbstractGridView &AbstractGridViewItem::get_view() const
|
|||
throw std::runtime_error(
|
||||
"Invalid state, item must be added through AbstractGridView::add_item()");
|
||||
}
|
||||
return *view_;
|
||||
return dynamic_cast<AbstractGridView &>(*view_);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
@ -412,7 +412,7 @@ GeometrySet spreadsheet_get_display_geometry_set(const SpaceSpreadsheet *sspread
|
|||
}
|
||||
else {
|
||||
if (object_eval->mode == OB_MODE_EDIT && object_eval->type == OB_MESH) {
|
||||
Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(object_eval, false);
|
||||
Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(object_eval);
|
||||
if (mesh == nullptr) {
|
||||
return geometry_set;
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ void createTransEdge(TransInfo *t)
|
|||
td->ext = NULL;
|
||||
|
||||
fl_ptr = BM_ELEM_CD_GET_VOID_P(eed, cd_edge_float_offset);
|
||||
td->val = fl_ptr;
|
||||
td->ival = *fl_ptr;
|
||||
td->loc = fl_ptr;
|
||||
td->iloc[0] = *fl_ptr;
|
||||
|
||||
td++;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ static void bakeModifier(Main *UNUSED(bmain),
|
|||
MEM_SAFE_FREE(mmd->cache_data);
|
||||
}
|
||||
Object *ob_target = DEG_get_evaluated_object(depsgraph, mmd->target);
|
||||
Mesh *target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
|
||||
Mesh *target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target);
|
||||
mmd->cache_data = MEM_callocN(sizeof(ShrinkwrapTreeData), __func__);
|
||||
if (BKE_shrinkwrap_init_tree(
|
||||
mmd->cache_data, target, mmd->shrink_type, mmd->shrink_mode, false)) {
|
||||
|
|
|
@ -402,7 +402,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
|
|||
start_cap_ob, ctx->object, &vgroup_start_cap_remap_len);
|
||||
}
|
||||
|
||||
start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob, false);
|
||||
start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob);
|
||||
if (start_cap_mesh) {
|
||||
start_cap_nverts = start_cap_mesh->totvert;
|
||||
start_cap_nedges = start_cap_mesh->totedge;
|
||||
|
@ -417,7 +417,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
|
|||
end_cap_ob, ctx->object, &vgroup_end_cap_remap_len);
|
||||
}
|
||||
|
||||
end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(end_cap_ob, false);
|
||||
end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(end_cap_ob);
|
||||
if (end_cap_mesh) {
|
||||
end_cap_nverts = end_cap_mesh->totvert;
|
||||
end_cap_nedges = end_cap_mesh->totedge;
|
||||
|
|
|
@ -429,7 +429,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd,
|
|||
}
|
||||
|
||||
if (bmd->flag & eBooleanModifierFlag_Object) {
|
||||
Mesh *mesh_operand = BKE_modifier_get_evaluated_mesh_from_evaluated_object(bmd->object, false);
|
||||
Mesh *mesh_operand = BKE_modifier_get_evaluated_mesh_from_evaluated_object(bmd->object);
|
||||
if (!mesh_operand) {
|
||||
return mesh;
|
||||
}
|
||||
|
@ -444,7 +444,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd,
|
|||
if (collection) {
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) {
|
||||
if (ob->type == OB_MESH && ob != ctx->object) {
|
||||
Mesh *collection_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob, false);
|
||||
Mesh *collection_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob);
|
||||
if (!collection_mesh) {
|
||||
continue;
|
||||
}
|
||||
|
@ -505,8 +505,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
|
||||
Object *operand_ob = bmd->object;
|
||||
|
||||
Mesh *mesh_operand_ob = BKE_modifier_get_evaluated_mesh_from_evaluated_object(operand_ob,
|
||||
false);
|
||||
Mesh *mesh_operand_ob = BKE_modifier_get_evaluated_mesh_from_evaluated_object(operand_ob);
|
||||
|
||||
if (mesh_operand_ob) {
|
||||
/* XXX This is utterly non-optimal, we may go from a bmesh to a mesh back to a bmesh!
|
||||
|
@ -540,8 +539,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
|
||||
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, operand_ob) {
|
||||
if (operand_ob->type == OB_MESH && operand_ob != ctx->object) {
|
||||
Mesh *mesh_operand_ob = BKE_modifier_get_evaluated_mesh_from_evaluated_object(operand_ob,
|
||||
false);
|
||||
Mesh *mesh_operand_ob = BKE_modifier_get_evaluated_mesh_from_evaluated_object(operand_ob);
|
||||
|
||||
if (mesh_operand_ob == nullptr) {
|
||||
continue;
|
||||
|
|
|
@ -128,7 +128,7 @@ static Volume *mesh_to_volume(ModifierData *md,
|
|||
if (object_to_convert == nullptr) {
|
||||
return input_volume;
|
||||
}
|
||||
Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(object_to_convert, false);
|
||||
Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(object_to_convert);
|
||||
if (mesh == nullptr) {
|
||||
return input_volume;
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ static void meshdeformModifier_do(ModifierData *md,
|
|||
* We'll support this case once granular dependency graph is landed.
|
||||
*/
|
||||
Object *ob_target = mmd->object;
|
||||
cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
|
||||
cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target);
|
||||
if (cagemesh == NULL) {
|
||||
BKE_modifier_set_error(ctx->object, md, "Cannot get mesh from cage object");
|
||||
return;
|
||||
|
|
|
@ -1449,7 +1449,7 @@ static void surfacedeformModifier_do(ModifierData *md,
|
|||
}
|
||||
|
||||
Object *ob_target = smd->target;
|
||||
target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target, false);
|
||||
target = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_target);
|
||||
if (!target) {
|
||||
BKE_modifier_set_error(ob, md, "No valid target mesh");
|
||||
return;
|
||||
|
|
|
@ -544,7 +544,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
const bool use_trgt_faces = (wmd->proximity_flags & MOD_WVG_PROXIMITY_GEOM_FACES) != 0;
|
||||
|
||||
if (use_trgt_verts || use_trgt_edges || use_trgt_faces) {
|
||||
Mesh *target_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(obr, false);
|
||||
Mesh *target_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(obr);
|
||||
|
||||
/* We must check that we do have a valid target_mesh! */
|
||||
if (target_mesh != NULL) {
|
||||
|
|
|
@ -248,8 +248,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
else {
|
||||
surface_mesh_orig = &surface_object_data;
|
||||
}
|
||||
Mesh *surface_mesh_eval = BKE_modifier_get_evaluated_mesh_from_evaluated_object(surface_ob_eval,
|
||||
false);
|
||||
Mesh *surface_mesh_eval = BKE_modifier_get_evaluated_mesh_from_evaluated_object(surface_ob_eval);
|
||||
if (surface_mesh_eval == nullptr) {
|
||||
pass_through_input();
|
||||
params.error_message_add(NodeWarningType::Error, "Surface has no mesh");
|
||||
|
|
|
@ -1072,7 +1072,7 @@ static void separate_mesh_selection(GeometrySet &geometry_set,
|
|||
evaluator.evaluate();
|
||||
const VArray<bool> selection = evaluator.get_evaluated<bool>(0);
|
||||
/* Check if there is anything to delete. */
|
||||
if (selection.is_single() && selection.get_internal_single()) {
|
||||
if (selection.is_empty() || (selection.is_single() && selection.get_internal_single())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue