Merge branch 'blender-v3.0-release'
This commit is contained in:
commit
0bedd5d14f
|
@ -50,6 +50,10 @@ void BKE_object_defgroup_active_index_set(struct Object *ob, const int new_index
|
|||
const struct ListBase *BKE_id_defgroup_list_get(const struct ID *id);
|
||||
struct ListBase *BKE_id_defgroup_list_get_mutable(struct ID *id);
|
||||
int BKE_id_defgroup_name_index(const struct ID *id, const char *name);
|
||||
bool BKE_id_defgroup_name_find(const struct ID *id,
|
||||
const char *name,
|
||||
int *r_index,
|
||||
struct bDeformGroup **r_group);
|
||||
|
||||
struct bDeformGroup *BKE_object_defgroup_new(struct Object *ob, const char *name);
|
||||
void BKE_defgroup_copy_list(struct ListBase *outbase, const struct ListBase *inbase);
|
||||
|
|
|
@ -557,11 +557,35 @@ bDeformGroup *BKE_object_defgroup_find_name(const Object *ob, const char *name)
|
|||
|
||||
int BKE_id_defgroup_name_index(const ID *id, const char *name)
|
||||
{
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
int index;
|
||||
if (!BKE_id_defgroup_name_find(id, name, &index, NULL)) {
|
||||
return -1;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
bool BKE_id_defgroup_name_find(const struct ID *id,
|
||||
const char *name,
|
||||
int *r_index,
|
||||
struct bDeformGroup **r_group)
|
||||
{
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
return false;
|
||||
}
|
||||
const ListBase *defbase = BKE_id_defgroup_list_get(id);
|
||||
return BLI_findstringindex(defbase, name, offsetof(bDeformGroup, name));
|
||||
int index;
|
||||
LISTBASE_FOREACH_INDEX (bDeformGroup *, group, defbase, index) {
|
||||
if (STREQ(name, group->name)) {
|
||||
if (r_index != NULL) {
|
||||
*r_index = index;
|
||||
}
|
||||
if (r_group != NULL) {
|
||||
*r_group = group;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const ListBase *BKE_object_defgroup_list(const Object *ob)
|
||||
|
|
|
@ -1127,16 +1127,19 @@ class VertexGroupsAttributeProvider final : public DynamicAttributesProvider {
|
|||
}
|
||||
|
||||
const std::string name = attribute_id.name();
|
||||
const int vertex_group_index = BLI_findstringindex(
|
||||
&mesh->vertex_group_names, name.c_str(), offsetof(bDeformGroup, name));
|
||||
if (vertex_group_index < 0) {
|
||||
|
||||
int index;
|
||||
bDeformGroup *group;
|
||||
if (!BKE_id_defgroup_name_find(&mesh->id, name.c_str(), &index, &group)) {
|
||||
return false;
|
||||
}
|
||||
BLI_remlink(&mesh->vertex_group_names, group);
|
||||
MEM_freeN(group);
|
||||
if (mesh->dvert == nullptr) {
|
||||
return true;
|
||||
}
|
||||
for (MDeformVert &dvert : MutableSpan(mesh->dvert, mesh->totvert)) {
|
||||
MDeformWeight *weight = BKE_defvert_find_index(&dvert, vertex_group_index);
|
||||
MDeformWeight *weight = BKE_defvert_find_index(&dvert, index);
|
||||
BKE_defvert_remove_group(&dvert, weight);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -205,10 +205,10 @@ class RaycastFunction : public fn::MultiFunction {
|
|||
std::unique_ptr<FieldEvaluator> target_evaluator_;
|
||||
const GVArray *target_data_ = nullptr;
|
||||
|
||||
/* Always evaluate the target domain data on the point domain. Eventually this could be
|
||||
* exposed as an option or determined automatically from the field inputs in order to avoid
|
||||
* losing information if the target field is on a different domain. */
|
||||
const AttributeDomain domain_ = ATTR_DOMAIN_POINT;
|
||||
/* Always evaluate the target domain data on the face corner domain because it contains the most
|
||||
* information. Eventually this could be exposed as an option or determined automatically from
|
||||
* the field inputs for better performance. */
|
||||
const AttributeDomain domain_ = ATTR_DOMAIN_CORNER;
|
||||
|
||||
fn::MFSignature signature_;
|
||||
|
||||
|
|
Loading…
Reference in New Issue