Page MenuHome

Fix T87228: Precision fix when selecting random objects
Needs ReviewPublic

Authored by Brennen Green (dreymatic) on Apr 19 2021, 7:54 PM.

Details

Summary

Implemented similar logic to https://developer.blender.org/rB9c202281287743494fd7d81a13970053bc8a33b5 to support the accurate selection of a random number of items given a percentage.

As in the MEST_OT_select_random implementation, this will allow the random selection to select a precise number of items equal to a percentage of the total items rather than use an RNG engine to decide whether an item is selected or not.

Note: This still needs to be implemented for the other selection operators (currently would only be implemented for MESH_OT and OBJECT_OT)

Diff Detail

Repository
rB Blender

Event Timeline

Campbell Barton (campbellbarton) requested changes to this revision.Apr 20 2021, 2:06 AM

This loops over two different kinds of context types selectable_bases and visible_bases, it should loop over selectable_bases.

To simplify logic, use: CTX_data_collection_get to access the objects, this can be counted and used to populate the array.

This revision now requires changes to proceed.Apr 20 2021, 2:06 AM

Simplified logic using CTX_data_collection_get to count and populate the array as suggested by @Campbell Barton (campbellbarton)

Fixed bad double initialization of i variable in previous revision.

@Campbell Barton (campbellbarton) Just seeing if you had any updated suggestions for this revision.