@Alexander Gavrilov (angavrilov), afaik you wrote this code in the first place.
Is there any special reason for this default for the object_type?
I'm not sure about what impact this change can have on other code.
The bug you solved in when you introduced this code is still solved (T58412).
Details
Diff Detail
- Repository
- rB Blender
- Branch
- flip-active (branched from master)
- Build Status
Buildable 2754 Build 2754: arc lint + arc unit
Event Timeline
The reason for the default is because the original code used the type of the active object, and this default specifically implements it. I'd suggest not changing it without consulting with whoever actually wrote the actual original code.
@Dalai Felinto (dfelinto) or @Campbell Barton (campbellbarton), I guess one of you would know the correct logic for multi-object modes and the active object?
The original (unimplemented) design was to implement a WEIGHT_PAINT mode for the bones as well. To stop this mess of having two edit objects in different modes. What we would have is both armature and mesh object in weight mode.
So although this patch provides a fix, it deviates the code even further from that design.
Anyways, this patch seems to be a valid quick fix. An improvement from what we have in master anyways.
That said I would rather -1 as argument to FOREACH_BASE_IN_MODE_BEGIN to use a define (e.g., ANY_MODE) instead of -1.
@Campbell Barton (campbellbarton) what do you say? Is the whole weightpaint mode for armature still a thing?
Note that this fix looks incorrect:
- It will mix different kinds of object types that share a mode (armature, lattice, meshes ... etc).
- In the case of weight paint mode - only one other pose object is only ever active at once (multi-pose mode doesn't make much sense to mix w/ weight paint mode).
Using BKE_object_pose_base_array_get accounts for this case, we can use this for now.