-
Notifications
You must be signed in to change notification settings - Fork 222
Fix #5309 - ThreeJSForwardTranslator adds unnecessary RenderingColor objects for AirLoopHVAC #5373
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
Conversation
``` 2652: /Users/julien/Software/Others/OpenStudio/src/model/test/ThreeJSForwardTranslator_GTest.cpp:427: Failure 2652: Expected equality of these values: 2652: 1 2652: m.getConcreteModelObjects<RenderingColor>().size() 2652: Which is: 2 ```
… it exists before adding
| EXPECT_TRUE(checkIfMaterialExist(materials, "AirWall")); | ||
| } | ||
|
|
||
| TEST_F(ModelFixture, ThreeJSForwardTranslator_AirLoopHVAC_RenderingColors) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New test that creates an AirLoopHVAC, call modelToThreeJS twice and ensure we don't end up with 2 RenderingColors
| std::string name = getObjectThreeMaterialName(construction); | ||
| boost::optional<RenderingColor> color = construction.renderingColor(); | ||
| if (!color) { | ||
| color = RenderingColor(model); | ||
| color->setName(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all objects, name the rendering color!
| for (auto& airLoopHVAC : model.getConcreteModelObjects<AirLoopHVAC>()) { | ||
| std::string name = getObjectThreeMaterialName(airLoopHVAC); | ||
| boost::optional<RenderingColor> color = RenderingColor(model); | ||
| // AirLoopHVAC does not have a renderingColor method | ||
| boost::optional<RenderingColor> color = model.getConcreteModelObjectByName<RenderingColor>(name); | ||
| if (!color) { | ||
| color = RenderingColor(model); | ||
| color->setName(name); | ||
| } | ||
| addThreeMaterial(materials, materialMap, | ||
| makeThreeMaterial(name, toThreeColor(color->renderingRedValue(), color->renderingBlueValue(), color->renderingGreenValue()), 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For AirLoopHVAC, where we don't have a renderingColor method, we check if the model contains the aptly-named one first before creating.
If we create it, we name it.
all good!
|
CI Results for 2c8b19f:
|
Pull request overview
Pull Request Author
src/model/test)src/energyplus/Test)src/osversion/VersionTranslator.cpp)Labels:
IDDChangeAPIChangePull Request - Ready for CIso that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.