GPv3: Weight Paint tools (Draw, Blur, Average, Smear, Sample weight) #118347
|
@ -335,7 +335,9 @@ Vector<Vector<MutableDrawingInfo>> retrieve_editable_drawings_per_frame(
|
|||
BKE_curvemapping_init(toolsettings->gp_sculpt.cur_falloff);
|
||||
}
|
||||
|
||||
/* Get set of unique frame numbers with editable drawings on them. */
|
||||
/* Get set of unique frame numbers with editable drawings on them.
|
||||
* Note: we want an ordered list here, so we use `set` from STL, not the unordered Set from
|
||||
* Blender. */
|
||||
std::set<int> selected_frames;
|
||||
Span<const Layer *> layers = grease_pencil.layers();
|
||||
for (const int layer_i : layers.index_range()) {
|
||||
|
|
|
@ -35,9 +35,6 @@ namespace blender::ed::greasepencil {
|
|||
|
||||
int create_vertex_group_in_object(Object *ob)
|
||||
SietseB marked this conversation as resolved
Outdated
|
||||
{
|
||||
int def_nr = 0;
|
||||
bool named_by_bone = false;
|
||||
|
||||
/* Look for an active bone in armature to name the vertex group after. */
|
||||
Object *ob_armature = BKE_modifiers_is_deformed_by_armature(ob);
|
||||
if (ob_armature != nullptr) {
|
||||
|
@ -48,28 +45,23 @@ int create_vertex_group_in_object(Object *ob)
|
|||
const int channel_def_nr = BKE_object_defgroup_name_index(ob, pchan->name);
|
||||
if (channel_def_nr == -1) {
|
||||
BKE_object_defgroup_add_name(ob, pchan->name);
|
||||
def_nr = BKE_object_defgroup_active_index_get(ob) - 1;
|
||||
return (BKE_object_defgroup_active_index_get(ob) - 1);
|
||||
}
|
||||
else {
|
||||
SietseB marked this conversation as resolved
Outdated
Hans Goudey
commented
else after return is unnecessary else after return is unnecessary
|
||||
def_nr = channel_def_nr;
|
||||
return channel_def_nr;
|
||||
}
|
||||
named_by_bone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a vertex group with a general name. */
|
||||
if (!named_by_bone) {
|
||||
BKE_object_defgroup_add(ob);
|
||||
}
|
||||
BKE_object_defgroup_add(ob);
|
||||
|
||||
return def_nr;
|
||||
return 0;
|
||||
}
|
||||
SietseB marked this conversation as resolved
Falk David
commented
`get_bone_deformed_vertex_group_names`
|
||||
|
||||
Set<std::string> get_bone_deformed_vertex_groups(Object &object)
|
||||
{
|
||||
Set<std::string> bone_deformed_vgroups;
|
||||
|
||||
/* Get all vertex group names in the object. */
|
||||
const ListBase *defbase = BKE_object_defgroup_list(&object);
|
||||
Set<std::string> defgroups;
|
||||
|
@ -78,6 +70,7 @@ Set<std::string> get_bone_deformed_vertex_groups(Object &object)
|
|||
}
|
||||
|
||||
/* Lambda function for finding deforming bones with a name matching a vertex group. */
|
||||
Set<std::string> bone_deformed_vgroups;
|
||||
SietseB marked this conversation as resolved
Outdated
Falk David
commented
Would be a bit more readable if this loop was outside the lambda. Would be a bit more readable if this loop was outside the lambda.
|
||||
const auto find_pose_channels = [&](ModifierData *md) {
|
||||
for (; md; md->next) {
|
||||
if (!(md->mode & (eModifierMode_Realtime | eModifierMode_Virtual)) ||
|
||||
|
|
Loading…
Reference in New Issue
This function does multiple things that are not obvious when looking at its name. It should be split.
This function can take a
name
and just do:Then finding the active bone channel name can be it's own function, e.g. (
find_active_bone_channel_name
).