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

Support removing the actor, light, or model from the root #1492

Open
wants to merge 2 commits into
base: sdf14
Choose a base branch
from

Conversation

nkoenig
Copy link
Contributor

@nkoenig nkoenig commented Oct 15, 2024

🎉 New feature

Summary

The Root object didn't have a mechanism to clear/remove the actor, light, or model. This PR adds a Clear function that similar to the other Clear functions.

Test it

Tests have been added.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@github-actions github-actions bot added the 🌱 garden Ignition Garden label Oct 15, 2024
@nkoenig nkoenig changed the base branch from sdf13 to sdf14 October 15, 2024 13:19
Signed-off-by: Nate Koenig <[email protected]>
Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

looks good; I suggested some small, optional improvements to the test

sdf::Actor actor1;
actor1.SetName("actor1");
root.SetActor(actor1);
EXPECT_NE(nullptr, root.Actor());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
EXPECT_NE(nullptr, root.Actor());
EXPECT_NE(nullptr, root.Actor());
EXPECT_EQ(nullptr, root.Light());
EXPECT_EQ(nullptr, root.Model());

let's check all three pointers, expecting at most one to be non-null

root.SetActor(actor1);
EXPECT_NE(nullptr, root.Actor());
root.ClearActorLightModel();
EXPECT_EQ(nullptr, root.Actor());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
EXPECT_EQ(nullptr, root.Actor());
EXPECT_EQ(nullptr, root.Actor());
EXPECT_EQ(nullptr, root.Light());
EXPECT_EQ(nullptr, root.Model());

root.SetModel(model1);
EXPECT_NE(nullptr, root.Model());
root.ClearActorLightModel();
EXPECT_EQ(nullptr, root.Model());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
EXPECT_EQ(nullptr, root.Model());
EXPECT_EQ(nullptr, root.Actor());
EXPECT_EQ(nullptr, root.Light());
EXPECT_EQ(nullptr, root.Model());

root.SetLight(light1);
EXPECT_NE(nullptr, root.Light());
root.ClearActorLightModel();
EXPECT_EQ(nullptr, root.Light());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
EXPECT_EQ(nullptr, root.Light());
EXPECT_EQ(nullptr, root.Actor());
EXPECT_EQ(nullptr, root.Light());
EXPECT_EQ(nullptr, root.Model());

sdf::Light light1;
light1.SetName("light1");
root.SetLight(light1);
EXPECT_NE(nullptr, root.Light());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
EXPECT_NE(nullptr, root.Light());
EXPECT_EQ(nullptr, root.Actor());
EXPECT_NE(nullptr, root.Light());
EXPECT_EQ(nullptr, root.Model());

sdf::Model model1;
model1.SetName("model1");
root.SetModel(model1);
EXPECT_NE(nullptr, root.Model());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
EXPECT_NE(nullptr, root.Model());
EXPECT_EQ(nullptr, root.Actor());
EXPECT_EQ(nullptr, root.Light());
EXPECT_NE(nullptr, root.Model());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

3 participants