Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a reserved "Default" layer for memberships in InteractionGroups #706

Merged
merged 6 commits into from
Aug 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 37 additions & 34 deletions src/geometry/interaction_groups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ impl InteractionGroups {

impl Default for InteractionGroups {
fn default() -> Self {
Self::all()
Self {
memberships: Group::DEFAULT,
filter: Group::ALL,
}
}
}

Expand All @@ -80,70 +83,70 @@ bitflags::bitflags! {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
pub struct Group: u32 {
/// The default group.
const DEFAULT = 1 << 0;
/// The group n°1.
const GROUP_1 = 1 << 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I agree on shifting those groups though:

  • it makes a tedious migrations for users
  • javascript bindings will have to adapt (not hard, but tedious/error prone again)

the naming becomes a bit inconsistent, I would prefer DEFAULT and GROUP_1 being the same, or straight up removing DEFAULT, and add that's the default as a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya I agree

const GROUP_1 = 1 << 1;
/// The group n°2.
const GROUP_2 = 1 << 1;
const GROUP_2 = 1 << 2;
/// The group n°3.
const GROUP_3 = 1 << 2;
const GROUP_3 = 1 << 3;
/// The group n°4.
const GROUP_4 = 1 << 3;
const GROUP_4 = 1 << 4;
/// The group n°5.
const GROUP_5 = 1 << 4;
const GROUP_5 = 1 << 5;
/// The group n°6.
const GROUP_6 = 1 << 5;
const GROUP_6 = 1 << 6;
/// The group n°7.
const GROUP_7 = 1 << 6;
const GROUP_7 = 1 << 7;
/// The group n°8.
const GROUP_8 = 1 << 7;
const GROUP_8 = 1 << 8;
/// The group n°9.
const GROUP_9 = 1 << 8;
const GROUP_9 = 1 << 9;
/// The group n°10.
const GROUP_10 = 1 << 9;
const GROUP_10 = 1 << 10;
/// The group n°11.
const GROUP_11 = 1 << 10;
const GROUP_11 = 1 << 11;
/// The group n°12.
const GROUP_12 = 1 << 11;
const GROUP_12 = 1 << 12;
/// The group n°13.
const GROUP_13 = 1 << 12;
const GROUP_13 = 1 << 13;
/// The group n°14.
const GROUP_14 = 1 << 13;
const GROUP_14 = 1 << 14;
/// The group n°15.
const GROUP_15 = 1 << 14;
const GROUP_15 = 1 << 15;
/// The group n°16.
const GROUP_16 = 1 << 15;
const GROUP_16 = 1 << 16;
/// The group n°17.
const GROUP_17 = 1 << 16;
const GROUP_17 = 1 << 17;
/// The group n°18.
const GROUP_18 = 1 << 17;
const GROUP_18 = 1 << 18;
/// The group n°19.
const GROUP_19 = 1 << 18;
const GROUP_19 = 1 << 19;
/// The group n°20.
const GROUP_20 = 1 << 19;
const GROUP_20 = 1 << 20;
/// The group n°21.
const GROUP_21 = 1 << 20;
const GROUP_21 = 1 << 21;
/// The group n°22.
const GROUP_22 = 1 << 21;
const GROUP_22 = 1 << 22;
/// The group n°23.
const GROUP_23 = 1 << 22;
const GROUP_23 = 1 << 23;
/// The group n°24.
const GROUP_24 = 1 << 23;
const GROUP_24 = 1 << 24;
/// The group n°25.
const GROUP_25 = 1 << 24;
const GROUP_25 = 1 << 25;
/// The group n°26.
const GROUP_26 = 1 << 25;
const GROUP_26 = 1 << 26;
/// The group n°27.
const GROUP_27 = 1 << 26;
const GROUP_27 = 1 << 27;
/// The group n°28.
const GROUP_28 = 1 << 27;
const GROUP_28 = 1 << 28;
/// The group n°29.
const GROUP_29 = 1 << 28;
const GROUP_29 = 1 << 29;
/// The group n°30.
const GROUP_30 = 1 << 29;
const GROUP_30 = 1 << 30;
/// The group n°31.
const GROUP_31 = 1 << 30;
/// The group n°32.
const GROUP_32 = 1 << 31;
const GROUP_31 = 1 << 31;

/// All of the groups.
const ALL = u32::MAX;
Expand Down
Loading