Merge branch 'dynamic_casts' into 'master'

Check dynamic cast results

See merge request OpenMW/openmw!3761
ini_importer_tests
psi29a 12 months ago
commit 2836ca2d91

@ -184,11 +184,11 @@ void CSVRender::WorldspaceWidget::selectDefaultNavigationMode()
void CSVRender::WorldspaceWidget::centerOrbitCameraOnSelection() void CSVRender::WorldspaceWidget::centerOrbitCameraOnSelection()
{ {
std::vector<osg::ref_ptr<TagBase>> selection = getSelection(~0u); std::vector<osg::ref_ptr<TagBase>> selection = getSelection(Mask_Reference);
for (std::vector<osg::ref_ptr<TagBase>>::iterator it = selection.begin(); it != selection.end(); ++it) for (std::vector<osg::ref_ptr<TagBase>>::iterator it = selection.begin(); it != selection.end(); ++it)
{ {
if (CSVRender::ObjectTag* objectTag = dynamic_cast<CSVRender::ObjectTag*>(it->get())) if (CSVRender::ObjectTag* objectTag = static_cast<CSVRender::ObjectTag*>(it->get()))
{ {
mOrbitCamControl->setCenter(objectTag->mObject->getPosition().asVec3()); mOrbitCamControl->setCenter(objectTag->mObject->getPosition().asVec3());
} }
@ -757,13 +757,14 @@ void CSVRender::WorldspaceWidget::toggleHiddenInstances()
if (selection.empty()) if (selection.empty())
return; return;
const CSVRender::ObjectTag* firstSelection = dynamic_cast<CSVRender::ObjectTag*>(selection.begin()->get()); const CSVRender::ObjectTag* firstSelection = static_cast<CSVRender::ObjectTag*>(selection.begin()->get());
assert(firstSelection != nullptr);
const CSVRender::Mask firstMask const CSVRender::Mask firstMask
= firstSelection->mObject->getRootNode()->getNodeMask() == Mask_Hidden ? Mask_Reference : Mask_Hidden; = firstSelection->mObject->getRootNode()->getNodeMask() == Mask_Hidden ? Mask_Reference : Mask_Hidden;
for (const auto& object : selection) for (const auto& object : selection)
if (const auto objectTag = dynamic_cast<CSVRender::ObjectTag*>(object.get())) if (const auto objectTag = static_cast<CSVRender::ObjectTag*>(object.get()))
objectTag->mObject->getRootNode()->setNodeMask(firstMask); objectTag->mObject->getRootNode()->setNodeMask(firstMask);
} }

@ -288,6 +288,8 @@ namespace MWRender
pass.mRenderTarget->getAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0) pass.mRenderTarget->getAttachment(osg::FrameBufferObject::BufferComponent::COLOR_BUFFER0)
.getTexture())); .getTexture()));
assert(texture != nullptr);
texture->setTextureSize(w, h); texture->setTextureSize(w, h);
texture->setNumMipmapLevels(pass.mRenderTexture->getNumMipmapLevels()); texture->setNumMipmapLevels(pass.mRenderTexture->getNumMipmapLevels());
texture->dirtyTextureObject(); texture->dirtyTextureObject();

Loading…
Cancel
Save