Check if pick result is null when building visual pick result

This commit is contained in:
sabrina-shanman 2018-09-25 09:56:11 -07:00
parent 8dd36e465b
commit 660bdf36d0
3 changed files with 9 additions and 0 deletions

View file

@ -36,6 +36,9 @@ void LaserPointer::editRenderStatePath(const std::string& state, const QVariant&
}
PickResultPointer LaserPointer::getPickResultCopy(const PickResultPointer& pickResult) const {
if (!pickResult) {
std::make_shared<RayPickResult>();
}
auto rayPickResult = std::static_pointer_cast<RayPickResult>(pickResult);
return std::make_shared<RayPickResult>(*rayPickResult.get());
}

View file

@ -31,6 +31,9 @@ ParabolaPointer::ParabolaPointer(const QVariant& rayProps, const RenderStateMap&
}
PickResultPointer ParabolaPointer::getPickResultCopy(const PickResultPointer& pickResult) const {
if (!pickResult) {
std::make_shared<ParabolaPickResult>();
}
auto stylusPickResult = std::static_pointer_cast<ParabolaPickResult>(pickResult);
return std::make_shared<ParabolaPickResult>(*stylusPickResult.get());
}

View file

@ -148,6 +148,9 @@ bool StylusPointer::shouldTrigger(const PickResultPointer& pickResult) {
}
PickResultPointer StylusPointer::getPickResultCopy(const PickResultPointer& pickResult) const {
if (!pickResult) {
std::make_shared<StylusPickResult>();
}
auto stylusPickResult = std::static_pointer_cast<StylusPickResult>(pickResult);
return std::make_shared<StylusPickResult>(*stylusPickResult.get());
}