mirror of
https://github.com/lubosz/overte.git
synced 2025-08-29 06:06:40 +02:00
cleaning up code
This commit is contained in:
parent
5325b22b01
commit
d381beb213
3 changed files with 7 additions and 12 deletions
|
@ -1450,11 +1450,14 @@ void MyAvatar::clearJointsData() {
|
|||
void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||
_skeletonModelChangeCount++;
|
||||
int skeletonModelChangeCount = _skeletonModelChangeCount;
|
||||
Avatar::setSkeletonModelURL(skeletonModelURL);
|
||||
_skeletonModel->setVisibleInScene(true, qApp->getMain3DScene(), render::ItemKey::TAG_BITS_NONE);
|
||||
_headBoneSet.clear();
|
||||
_cauterizationNeedsUpdate = true;
|
||||
|
||||
std::shared_ptr<QMetaObject::Connection> skeletonConnection = std::make_shared<QMetaObject::Connection>();
|
||||
*skeletonConnection = QObject::connect(_skeletonModel.get(), &SkeletonModel::skeletonLoaded, [this, skeletonModelChangeCount, skeletonConnection]() {
|
||||
qDebug() << "checkingCount " << skeletonModelChangeCount << " -- " << _skeletonModelChangeCount;
|
||||
if (skeletonModelChangeCount == _skeletonModelChangeCount && _skeletonModel->isLoaded()) {
|
||||
qDebug() << "count is the same";
|
||||
if (skeletonModelChangeCount == _skeletonModelChangeCount) {
|
||||
initHeadBones();
|
||||
_skeletonModel->setCauterizeBoneSet(_headBoneSet);
|
||||
_fstAnimGraphOverrideUrl = _skeletonModel->getGeometry()->getAnimGraphOverrideUrl();
|
||||
|
@ -1462,10 +1465,6 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
|||
}
|
||||
QObject::disconnect(*skeletonConnection);
|
||||
});
|
||||
Avatar::setSkeletonModelURL(skeletonModelURL);
|
||||
_skeletonModel->setVisibleInScene(true, qApp->getMain3DScene(), render::ItemKey::TAG_BITS_NONE);
|
||||
_headBoneSet.clear();
|
||||
_cauterizationNeedsUpdate = true;
|
||||
emit skeletonChanged();
|
||||
|
||||
}
|
||||
|
@ -1888,7 +1887,6 @@ void MyAvatar::initAnimGraph() {
|
|||
|
||||
_skeletonModel->getRig().initAnimGraph(graphUrl);
|
||||
_currentAnimGraphUrl.set(graphUrl);
|
||||
qDebug() << "init anim graph";
|
||||
connect(&(_skeletonModel->getRig()), SIGNAL(onLoadComplete()), this, SLOT(animGraphLoaded()));
|
||||
}
|
||||
|
||||
|
|
|
@ -1585,14 +1585,13 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo
|
|||
}
|
||||
|
||||
void Rig::initAnimGraph(const QUrl& url) {
|
||||
if (_animGraphURL != url || (!_animNode && !_animLoading)) {
|
||||
if (_animGraphURL != url || !_animNode) {
|
||||
_animGraphURL = url;
|
||||
|
||||
_animNode.reset();
|
||||
|
||||
// load the anim graph
|
||||
_animLoader.reset(new AnimNodeLoader(url));
|
||||
_animLoading = true;
|
||||
std::weak_ptr<AnimSkeleton> weakSkeletonPtr = _animSkeleton;
|
||||
connect(_animLoader.get(), &AnimNodeLoader::success, [this, weakSkeletonPtr](AnimNode::Pointer nodeIn) {
|
||||
_animNode = nodeIn;
|
||||
|
@ -1617,7 +1616,6 @@ void Rig::initAnimGraph(const QUrl& url) {
|
|||
auto roleState = roleAnimState.second;
|
||||
overrideRoleAnimation(roleState.role, roleState.url, roleState.fps, roleState.loop, roleState.firstFrame, roleState.lastFrame);
|
||||
}
|
||||
_animLoading = false;
|
||||
|
||||
emit onLoadComplete();
|
||||
});
|
||||
|
|
|
@ -283,7 +283,6 @@ protected:
|
|||
std::shared_ptr<AnimNode> _animNode;
|
||||
std::shared_ptr<AnimSkeleton> _animSkeleton;
|
||||
std::unique_ptr<AnimNodeLoader> _animLoader;
|
||||
bool _animLoading { false };
|
||||
AnimVariantMap _animVars;
|
||||
enum class RigRole {
|
||||
Idle = 0,
|
||||
|
|
Loading…
Reference in a new issue