Remove g++-4.9 requirement
parent
ed7d879311
commit
4fa276c9e2
71
.travis.yml
71
.travis.yml
|
@ -16,21 +16,26 @@ matrix:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
packages:
|
|
||||||
- gcc-4.9
|
|
||||||
- g++-4.9
|
|
||||||
- os: osx
|
- os: osx
|
||||||
compiler: clang
|
compiler: clang
|
||||||
osx_image: xcode8
|
osx_image: xcode8
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
# (Mac) Install CGAL
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew reinstall cgal; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew reinstall cgal; fi
|
||||||
|
|
||||||
|
# (Linux) Prepare build environment
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:beineri/opt-qt591-trusty; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:beineri/opt-qt591-trusty; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gcc-4.9 g++-4.9; fi
|
#- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install gcc-4.9 g++-4.9; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libcgal-dev; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt install cmake; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt install cmake; fi
|
||||||
|
|
||||||
|
# (Linux) Install CGAL
|
||||||
|
# (Linux) First install a maybe old version CGAL to resolve dependencies
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libcgal-dev; fi
|
||||||
|
|
||||||
|
# (Linux) Build from source
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://github.com/CGAL/cgal/releases/download/releases/CGAL-4.11.1/CGAL-4.11.1.zip; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget https://github.com/CGAL/cgal/releases/download/releases/CGAL-4.11.1/CGAL-4.11.1.zip; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then unzip CGAL-4.11.1.zip; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then unzip CGAL-4.11.1.zip; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd CGAL-4.11.1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd CGAL-4.11.1; fi
|
||||||
|
@ -40,15 +45,22 @@ install:
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo make install; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo make install; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd ../../; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd ../../; fi
|
||||||
|
|
||||||
|
# (Mac) Install Qt5
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew reinstall qt5; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew reinstall qt5; fi
|
||||||
|
|
||||||
|
# (Linux) Install Qt5
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install qt59base qt59tools --force-yes; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install qt59base qt59tools --force-yes; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then source /opt/qt59/bin/qt59-env.sh; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then source /opt/qt59/bin/qt59-env.sh; fi
|
||||||
|
|
||||||
|
# Install Rust
|
||||||
- wget -O installrust.sh https://sh.rustup.rs
|
- wget -O installrust.sh https://sh.rustup.rs
|
||||||
- sh installrust.sh -y
|
- sh installrust.sh -y
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="$HOME/.cargo/bin:/usr/local/opt/qt/bin:$(brew --prefix)/bin:$PATH"; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="$HOME/.cargo/bin:/usr/local/opt/qt/bin:$(brew --prefix)/bin:$PATH"; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH="~/.cargo/bin:$PATH"; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH="~/.cargo/bin:$PATH"; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
# Build Meshlite
|
||||||
- git clone https://github.com/huxingyi/meshlite.git || travis_terminate 1
|
- git clone https://github.com/huxingyi/meshlite.git || travis_terminate 1
|
||||||
- cd meshlite
|
- cd meshlite
|
||||||
- cargo build --release
|
- cargo build --release
|
||||||
|
@ -56,22 +68,51 @@ script:
|
||||||
- cp meshlite/include/meshlite.h thirdparty/meshlite/meshlite.h || travis_terminate 1
|
- cp meshlite/include/meshlite.h thirdparty/meshlite/meshlite.h || travis_terminate 1
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp meshlite/target/release/libmeshlite.dylib thirdparty/meshlite/libmeshlite.dylib || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp meshlite/target/release/libmeshlite.dylib thirdparty/meshlite/libmeshlite.dylib || travis_terminate 1; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp meshlite/target/release/libmeshlite.so thirdparty/meshlite/libmeshlite.so || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp meshlite/target/release/libmeshlite.so thirdparty/meshlite/libmeshlite.so || travis_terminate 1; fi
|
||||||
|
|
||||||
|
# Build Dust3D
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then qmake -config release || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then qmake -config release || travis_terminate 1; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then qmake -config release || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then qmake -config release || travis_terminate 1; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make || travis_terminate 1; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make CXX="g++-4.9 -fext-numeric-literals" || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make CXX="g++ -fext-numeric-literals" || travis_terminate 1; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/thirdparty/meshlite || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/thirdparty/meshlite || travis_terminate 1; fi
|
||||||
|
|
||||||
|
# (Mac) Prepare dmg
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mv dust3d.app dust3d_unstable.app || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mv dust3d.app dust3d_unstable.app || travis_terminate 1; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p dust3d_unstable/usr/share/metainfo || travis_terminate 1; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir dust3d_unstable/usr/share/applications || travis_terminate 1; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv ./dust3d dust3d_unstable/dust3d_unstable || travis_terminate 1; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv ./ci/icon.png dust3d_unstable/icon.png || travis_terminate 1; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv ./ci/org.dust3d.appdata.xml dust3d_unstable/usr/share/metainfo/org.dust3d.appdata.xml || travis_terminate 1; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/org.dust3d.desktop dust3d_unstable/usr/share/applications/org.dust3d.desktop || travis_terminate 1; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/org.dust3d.desktop dust3d_unstable/org.dust3d.desktop || travis_terminate 1; fi
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then macdeployqt dust3d_unstable.app -dmg || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then macdeployqt dust3d_unstable.app -dmg || travis_terminate 1; fi
|
||||||
|
|
||||||
|
# (Linux) Prepare AppImage
|
||||||
|
# References:
|
||||||
|
# https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
|
||||||
|
# https://packages.ubuntu.com/search?suite=trusty&arch=amd64&mode=exactfilename&searchon=contents&keywords=libstdc%2B%2B.so.6
|
||||||
|
# https://github.com/darealshinji/AppImageKit-checkrt/issues/1
|
||||||
|
# https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64
|
||||||
|
# https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so
|
||||||
|
# https://github.com/probonopd/audacity/blob/AppImage/.travis.yml
|
||||||
|
# https://discourse.appimage.org/t/im-a-big-fan-of-this-but-graphics-driver-libstdc-conflict/171
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p appdir/usr/share/metainfo || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p appdir/usr/share/applications || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p appdir/usr/bin || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p appdir/usr/optional/libstdc++ || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ldd --version; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ls /usr/lib/x86_64-linux-gnu/ | grep libstdc; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 appdir/usr/optional/libstdc++/libstdc++.so.6 || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/exec-x86_64.so appdir/usr/optional/exec.so || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/icon.png appdir/icon.png || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/dust3d.appdata.xml appdir/usr/share/metainfo/dust3d.appdata.xml || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./dust3d appdir/usr/bin/dust3d || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/dust3d.desktop appdir/usr/share/applications/dust3d.desktop || travis_terminate 1; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x ./ci/linuxdeployqt.AppImage || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x ./ci/linuxdeployqt.AppImage || travis_terminate 1; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./ci/linuxdeployqt.AppImage dust3d_unstable/dust3d_unstable -appimage -bundle-non-qt-libs -verbose=2 || travis_terminate 1; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then unset QTDIR; unset QT_PLUGIN_PATH ; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/thirdparty/meshlite; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv ./Dust3D-x86_64.AppImage ./dust3d_unstable-x86_64.AppImage || travis_terminate 1;fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./ci/linuxdeployqt.AppImage appdir/usr/share/applications/dust3d.desktop -bundle-non-qt-libs -verbose=2 || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then rm appdir/AppRun || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/AppRun-patched-x86_64 appdir/AppRun || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x appdir/AppRun || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./ci/linuxdeployqt.AppImage --appimage-extract || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=$(readlink -f ./squashfs-root/usr/bin):$PATH || travis_terminate 1; fi
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./squashfs-root/usr/bin/appimagetool -g ./appdir/ dust3d_unstable-x86_64.AppImage || travis_terminate 1; fi
|
||||||
|
|
||||||
|
# Distribute
|
||||||
|
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then echo "No distribution on pull request"; fi
|
||||||
|
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then travis_terminate 0; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sh ci/upload-github-release-asset.sh github_api_token=${my_auth_token} branch=$TRAVIS_BRANCH owner=huxingyi repo=dust3d tag=unstable filename=dust3d_unstable.dmg; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sh ci/upload-github-release-asset.sh github_api_token=${my_auth_token} branch=$TRAVIS_BRANCH owner=huxingyi repo=dust3d tag=unstable filename=dust3d_unstable.dmg; fi
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then bash ci/upload-github-release-asset.sh github_api_token=${my_auth_token} branch=$TRAVIS_BRANCH owner=huxingyi repo=dust3d tag=unstable filename=dust3d_unstable-x86_64.AppImage; fi
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then bash ci/upload-github-release-asset.sh github_api_token=${my_auth_token} branch=$TRAVIS_BRANCH owner=huxingyi repo=dust3d tag=unstable filename=dust3d_unstable-x86_64.AppImage; fi
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<component type="desktop-application">
|
<component type="desktop-application">
|
||||||
<id>org.dust3d.desktop</id>
|
<id>dust3d.desktop</id>
|
||||||
<metadata_license>FSFAP</metadata_license>
|
<metadata_license>FSFAP</metadata_license>
|
||||||
<project_license>MIT</project_license>
|
<project_license>MIT</project_license>
|
||||||
<name>Dust3D</name>
|
<name>Dust3D</name>
|
|
@ -2,5 +2,6 @@
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=Dust3D
|
Name=Dust3D
|
||||||
Icon=icon
|
Icon=icon
|
||||||
|
Exec=dust3d
|
||||||
Categories=Graphics;
|
Categories=Graphics;
|
||||||
Comment=A quick 3D modeling tool
|
Comment=A quick 3D modeling tool
|
Binary file not shown.
|
@ -83,7 +83,7 @@ GH_ASSET="https://uploads.github.com/repos/$owner/$repo/releases/$release_id/ass
|
||||||
|
|
||||||
response=$(curl "$GITHUB_OAUTH_BASIC" --data-binary @"$filename" -H "Authorization: token $github_api_token" -H "Content-Type: application/octet-stream" $GH_ASSET)
|
response=$(curl "$GITHUB_OAUTH_BASIC" --data-binary @"$filename" -H "Authorization: token $github_api_token" -H "Content-Type: application/octet-stream" $GH_ASSET)
|
||||||
echo $response
|
echo $response
|
||||||
founderr=$(echo "$response" | grep "errors" | wc -l)
|
founderr=$(echo "$response" | grep "errors\|Error" | wc -l)
|
||||||
if [ "$founderr" -eq "0" ]; then
|
if [ "$founderr" -eq "0" ]; then
|
||||||
echo "Upload success"
|
echo "Upload success"
|
||||||
else
|
else
|
||||||
|
|
|
@ -41,7 +41,7 @@ void CCDIKSolver::solveTo(const QVector3D &position)
|
||||||
qDebug() << "Round:" << i << " distance2:" << distance2;
|
qDebug() << "Round:" << i << " distance2:" << distance2;
|
||||||
if (distance2 <= m_distanceThreshold2)
|
if (distance2 <= m_distanceThreshold2)
|
||||||
break;
|
break;
|
||||||
if (lastDistance2 > 0 && abs(distance2 - lastDistance2) <= m_distanceCeaseThreshold2)
|
if (lastDistance2 > 0 && fabs(distance2 - lastDistance2) <= m_distanceCeaseThreshold2)
|
||||||
break;
|
break;
|
||||||
lastDistance2 = distance2;
|
lastDistance2 = distance2;
|
||||||
iterate();
|
iterate();
|
||||||
|
|
|
@ -36,7 +36,7 @@ int SkeletonDocumentWindow::m_skeletonRenderWidgetInitialX = SkeletonDocumentWin
|
||||||
int SkeletonDocumentWindow::m_skeletonRenderWidgetInitialY = SkeletonDocumentWindow::m_modelRenderWidgetInitialY;
|
int SkeletonDocumentWindow::m_skeletonRenderWidgetInitialY = SkeletonDocumentWindow::m_modelRenderWidgetInitialY;
|
||||||
int SkeletonDocumentWindow::m_skeletonRenderWidgetInitialSize = SkeletonDocumentWindow::m_modelRenderWidgetInitialSize;
|
int SkeletonDocumentWindow::m_skeletonRenderWidgetInitialSize = SkeletonDocumentWindow::m_modelRenderWidgetInitialSize;
|
||||||
|
|
||||||
QPointer<LogBrowser> g_logBrowser;
|
LogBrowser *g_logBrowser = nullptr;
|
||||||
std::set<SkeletonDocumentWindow *> g_documentWindows;
|
std::set<SkeletonDocumentWindow *> g_documentWindows;
|
||||||
QTextBrowser *g_acknowlegementsWidget = nullptr;
|
QTextBrowser *g_acknowlegementsWidget = nullptr;
|
||||||
AboutWidget *g_aboutWidget = nullptr;
|
AboutWidget *g_aboutWidget = nullptr;
|
||||||
|
@ -84,45 +84,45 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
g_logBrowser = new LogBrowser;
|
g_logBrowser = new LogBrowser;
|
||||||
qInstallMessageHandler(&outputMessage);
|
qInstallMessageHandler(&outputMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_documentWindows.insert(this);
|
g_documentWindows.insert(this);
|
||||||
|
|
||||||
m_document = new SkeletonDocument;
|
m_document = new SkeletonDocument;
|
||||||
|
|
||||||
QVBoxLayout *toolButtonLayout = new QVBoxLayout;
|
QVBoxLayout *toolButtonLayout = new QVBoxLayout;
|
||||||
toolButtonLayout->setSpacing(0);
|
toolButtonLayout->setSpacing(0);
|
||||||
toolButtonLayout->setContentsMargins(5, 10, 4, 0);
|
toolButtonLayout->setContentsMargins(5, 10, 4, 0);
|
||||||
|
|
||||||
QPushButton *undoButton = new QPushButton(QChar(fa::undo));
|
QPushButton *undoButton = new QPushButton(QChar(fa::undo));
|
||||||
initAwesomeButton(undoButton);
|
initAwesomeButton(undoButton);
|
||||||
|
|
||||||
QPushButton *addButton = new QPushButton(QChar(fa::plus));
|
QPushButton *addButton = new QPushButton(QChar(fa::plus));
|
||||||
initAwesomeButton(addButton);
|
initAwesomeButton(addButton);
|
||||||
|
|
||||||
QPushButton *selectButton = new QPushButton(QChar(fa::mousepointer));
|
QPushButton *selectButton = new QPushButton(QChar(fa::mousepointer));
|
||||||
initAwesomeButton(selectButton);
|
initAwesomeButton(selectButton);
|
||||||
|
|
||||||
QPushButton *dragButton = new QPushButton(QChar(fa::handrocko));
|
QPushButton *dragButton = new QPushButton(QChar(fa::handrocko));
|
||||||
initAwesomeButton(dragButton);
|
initAwesomeButton(dragButton);
|
||||||
|
|
||||||
QPushButton *zoomInButton = new QPushButton(QChar(fa::searchplus));
|
QPushButton *zoomInButton = new QPushButton(QChar(fa::searchplus));
|
||||||
initAwesomeButton(zoomInButton);
|
initAwesomeButton(zoomInButton);
|
||||||
|
|
||||||
QPushButton *zoomOutButton = new QPushButton(QChar(fa::searchminus));
|
QPushButton *zoomOutButton = new QPushButton(QChar(fa::searchminus));
|
||||||
initAwesomeButton(zoomOutButton);
|
initAwesomeButton(zoomOutButton);
|
||||||
|
|
||||||
m_xlockButton = new QPushButton(QChar('X'));
|
m_xlockButton = new QPushButton(QChar('X'));
|
||||||
initLockButton(m_xlockButton);
|
initLockButton(m_xlockButton);
|
||||||
updateXlockButtonState();
|
updateXlockButtonState();
|
||||||
|
|
||||||
m_ylockButton = new QPushButton(QChar('Y'));
|
m_ylockButton = new QPushButton(QChar('Y'));
|
||||||
initLockButton(m_ylockButton);
|
initLockButton(m_ylockButton);
|
||||||
updateYlockButtonState();
|
updateYlockButtonState();
|
||||||
|
|
||||||
m_zlockButton = new QPushButton(QChar('Z'));
|
m_zlockButton = new QPushButton(QChar('Z'));
|
||||||
initLockButton(m_zlockButton);
|
initLockButton(m_zlockButton);
|
||||||
updateZlockButtonState();
|
updateZlockButtonState();
|
||||||
|
|
||||||
toolButtonLayout->addWidget(undoButton);
|
toolButtonLayout->addWidget(undoButton);
|
||||||
toolButtonLayout->addSpacing(10);
|
toolButtonLayout->addSpacing(10);
|
||||||
toolButtonLayout->addWidget(addButton);
|
toolButtonLayout->addWidget(addButton);
|
||||||
|
@ -134,16 +134,16 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
toolButtonLayout->addWidget(m_xlockButton);
|
toolButtonLayout->addWidget(m_xlockButton);
|
||||||
toolButtonLayout->addWidget(m_ylockButton);
|
toolButtonLayout->addWidget(m_ylockButton);
|
||||||
toolButtonLayout->addWidget(m_zlockButton);
|
toolButtonLayout->addWidget(m_zlockButton);
|
||||||
|
|
||||||
QLabel *verticalLogoLabel = new QLabel;
|
QLabel *verticalLogoLabel = new QLabel;
|
||||||
QImage verticalLogoImage;
|
QImage verticalLogoImage;
|
||||||
verticalLogoImage.load(":/resources/dust3d_vertical.png");
|
verticalLogoImage.load(":/resources/dust3d_vertical.png");
|
||||||
verticalLogoLabel->setPixmap(QPixmap::fromImage(verticalLogoImage));
|
verticalLogoLabel->setPixmap(QPixmap::fromImage(verticalLogoImage));
|
||||||
|
|
||||||
QHBoxLayout *logoLayout = new QHBoxLayout;
|
QHBoxLayout *logoLayout = new QHBoxLayout;
|
||||||
logoLayout->addWidget(verticalLogoLabel);
|
logoLayout->addWidget(verticalLogoLabel);
|
||||||
logoLayout->setContentsMargins(0, 0, 0, 0);
|
logoLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
QVBoxLayout *mainLeftLayout = new QVBoxLayout;
|
QVBoxLayout *mainLeftLayout = new QVBoxLayout;
|
||||||
mainLeftLayout->setSpacing(0);
|
mainLeftLayout->setSpacing(0);
|
||||||
mainLeftLayout->setContentsMargins(0, 0, 0, 0);
|
mainLeftLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
@ -151,10 +151,10 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
mainLeftLayout->addStretch();
|
mainLeftLayout->addStretch();
|
||||||
mainLeftLayout->addLayout(logoLayout);
|
mainLeftLayout->addLayout(logoLayout);
|
||||||
mainLeftLayout->addSpacing(10);
|
mainLeftLayout->addSpacing(10);
|
||||||
|
|
||||||
SkeletonGraphicsWidget *graphicsWidget = new SkeletonGraphicsWidget(m_document);
|
SkeletonGraphicsWidget *graphicsWidget = new SkeletonGraphicsWidget(m_document);
|
||||||
m_graphicsWidget = graphicsWidget;
|
m_graphicsWidget = graphicsWidget;
|
||||||
|
|
||||||
SkeletonGraphicsContainerWidget *containerWidget = new SkeletonGraphicsContainerWidget;
|
SkeletonGraphicsContainerWidget *containerWidget = new SkeletonGraphicsContainerWidget;
|
||||||
containerWidget->setGraphicsWidget(graphicsWidget);
|
containerWidget->setGraphicsWidget(graphicsWidget);
|
||||||
QGridLayout *containerLayout = new QGridLayout;
|
QGridLayout *containerLayout = new QGridLayout;
|
||||||
|
@ -163,38 +163,38 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
containerLayout->addWidget(graphicsWidget);
|
containerLayout->addWidget(graphicsWidget);
|
||||||
containerWidget->setLayout(containerLayout);
|
containerWidget->setLayout(containerLayout);
|
||||||
containerWidget->setMinimumSize(400, 400);
|
containerWidget->setMinimumSize(400, 400);
|
||||||
|
|
||||||
m_modelRenderWidget = new ModelWidget(containerWidget);
|
m_modelRenderWidget = new ModelWidget(containerWidget);
|
||||||
m_modelRenderWidget->setMinimumSize(SkeletonDocumentWindow::m_modelRenderWidgetInitialSize, SkeletonDocumentWindow::m_modelRenderWidgetInitialSize);
|
m_modelRenderWidget->setMinimumSize(SkeletonDocumentWindow::m_modelRenderWidgetInitialSize, SkeletonDocumentWindow::m_modelRenderWidgetInitialSize);
|
||||||
m_modelRenderWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
m_modelRenderWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
m_modelRenderWidget->move(SkeletonDocumentWindow::m_modelRenderWidgetInitialX, SkeletonDocumentWindow::m_modelRenderWidgetInitialY);
|
m_modelRenderWidget->move(SkeletonDocumentWindow::m_modelRenderWidgetInitialX, SkeletonDocumentWindow::m_modelRenderWidgetInitialY);
|
||||||
m_modelRenderWidget->setGraphicsFunctions(graphicsWidget);
|
m_modelRenderWidget->setGraphicsFunctions(graphicsWidget);
|
||||||
|
|
||||||
//m_skeletonRenderWidget = new ModelWidget(containerWidget);
|
//m_skeletonRenderWidget = new ModelWidget(containerWidget);
|
||||||
//m_skeletonRenderWidget->setMinimumSize(SkeletonDocumentWindow::m_skeletonRenderWidgetInitialSize, SkeletonDocumentWindow::m_skeletonRenderWidgetInitialSize);
|
//m_skeletonRenderWidget->setMinimumSize(SkeletonDocumentWindow::m_skeletonRenderWidgetInitialSize, SkeletonDocumentWindow::m_skeletonRenderWidgetInitialSize);
|
||||||
//m_skeletonRenderWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
//m_skeletonRenderWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
//m_skeletonRenderWidget->move(SkeletonDocumentWindow::m_skeletonRenderWidgetInitialX, SkeletonDocumentWindow::m_skeletonRenderWidgetInitialY);
|
//m_skeletonRenderWidget->move(SkeletonDocumentWindow::m_skeletonRenderWidgetInitialX, SkeletonDocumentWindow::m_skeletonRenderWidgetInitialY);
|
||||||
//m_skeletonRenderWidget->setGraphicsFunctions(graphicsWidget);
|
//m_skeletonRenderWidget->setGraphicsFunctions(graphicsWidget);
|
||||||
//m_skeletonRenderWidget->hide();
|
//m_skeletonRenderWidget->hide();
|
||||||
|
|
||||||
QDockWidget *partListDocker = new QDockWidget(QString(), this);
|
QDockWidget *partListDocker = new QDockWidget(QString(), this);
|
||||||
partListDocker->setAllowedAreas(Qt::RightDockWidgetArea);
|
partListDocker->setAllowedAreas(Qt::RightDockWidgetArea);
|
||||||
|
|
||||||
SkeletonPartListWidget *partListWidget = new SkeletonPartListWidget(m_document, partListDocker);
|
SkeletonPartListWidget *partListWidget = new SkeletonPartListWidget(m_document, partListDocker);
|
||||||
//partListWidget->setWindowFlags(Qt::Tool);
|
//partListWidget->setWindowFlags(Qt::Tool);
|
||||||
//partListWidget->move(100, 200);
|
//partListWidget->move(100, 200);
|
||||||
//partListWidget->show();
|
//partListWidget->show();
|
||||||
|
|
||||||
partListDocker->setWidget(partListWidget);
|
partListDocker->setWidget(partListWidget);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, partListDocker);
|
addDockWidget(Qt::RightDockWidgetArea, partListDocker);
|
||||||
|
|
||||||
partListDocker->hide();
|
partListDocker->hide();
|
||||||
|
|
||||||
//QVBoxLayout *mainRightLayout = new QVBoxLayout;
|
//QVBoxLayout *mainRightLayout = new QVBoxLayout;
|
||||||
//mainRightLayout->setSpacing(0);
|
//mainRightLayout->setSpacing(0);
|
||||||
//mainRightLayout->setContentsMargins(0, 0, 0, 0);
|
//mainRightLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
//mainRightLayout->addWidget(partListWidget);
|
//mainRightLayout->addWidget(partListWidget);
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||||
mainLayout->setSpacing(0);
|
mainLayout->setSpacing(0);
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
@ -202,164 +202,164 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
mainLayout->addWidget(containerWidget);
|
mainLayout->addWidget(containerWidget);
|
||||||
mainLayout->addSpacing(3);
|
mainLayout->addSpacing(3);
|
||||||
//mainLayout->addLayout(mainRightLayout);
|
//mainLayout->addLayout(mainRightLayout);
|
||||||
|
|
||||||
QWidget *centralWidget = new QWidget;
|
QWidget *centralWidget = new QWidget;
|
||||||
centralWidget->setLayout(mainLayout);
|
centralWidget->setLayout(mainLayout);
|
||||||
|
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
setWindowTitle(tr("Dust3D"));
|
setWindowTitle(tr("Dust3D"));
|
||||||
|
|
||||||
m_fileMenu = menuBar()->addMenu(tr("File"));
|
m_fileMenu = menuBar()->addMenu(tr("File"));
|
||||||
|
|
||||||
m_newWindowAction = new QAction(tr("New Window"), this);
|
m_newWindowAction = new QAction(tr("New Window"), this);
|
||||||
connect(m_newWindowAction, &QAction::triggered, this, &SkeletonDocumentWindow::newWindow, Qt::QueuedConnection);
|
connect(m_newWindowAction, &QAction::triggered, this, &SkeletonDocumentWindow::newWindow, Qt::QueuedConnection);
|
||||||
m_fileMenu->addAction(m_newWindowAction);
|
m_fileMenu->addAction(m_newWindowAction);
|
||||||
|
|
||||||
m_newDocumentAction = new QAction(tr("New"), this);
|
m_newDocumentAction = new QAction(tr("New"), this);
|
||||||
connect(m_newDocumentAction, &QAction::triggered, this, &SkeletonDocumentWindow::newDocument);
|
connect(m_newDocumentAction, &QAction::triggered, this, &SkeletonDocumentWindow::newDocument);
|
||||||
m_fileMenu->addAction(m_newDocumentAction);
|
m_fileMenu->addAction(m_newDocumentAction);
|
||||||
|
|
||||||
m_openAction = new QAction(tr("Open..."), this);
|
m_openAction = new QAction(tr("Open..."), this);
|
||||||
connect(m_openAction, &QAction::triggered, this, &SkeletonDocumentWindow::open, Qt::QueuedConnection);
|
connect(m_openAction, &QAction::triggered, this, &SkeletonDocumentWindow::open, Qt::QueuedConnection);
|
||||||
m_fileMenu->addAction(m_openAction);
|
m_fileMenu->addAction(m_openAction);
|
||||||
|
|
||||||
m_saveAction = new QAction(tr("Save"), this);
|
m_saveAction = new QAction(tr("Save"), this);
|
||||||
connect(m_saveAction, &QAction::triggered, this, &SkeletonDocumentWindow::save, Qt::QueuedConnection);
|
connect(m_saveAction, &QAction::triggered, this, &SkeletonDocumentWindow::save, Qt::QueuedConnection);
|
||||||
m_fileMenu->addAction(m_saveAction);
|
m_fileMenu->addAction(m_saveAction);
|
||||||
|
|
||||||
m_saveAsAction = new QAction(tr("Save As..."), this);
|
m_saveAsAction = new QAction(tr("Save As..."), this);
|
||||||
connect(m_saveAsAction, &QAction::triggered, this, &SkeletonDocumentWindow::saveAs, Qt::QueuedConnection);
|
connect(m_saveAsAction, &QAction::triggered, this, &SkeletonDocumentWindow::saveAs, Qt::QueuedConnection);
|
||||||
m_fileMenu->addAction(m_saveAsAction);
|
m_fileMenu->addAction(m_saveAsAction);
|
||||||
|
|
||||||
m_saveAllAction = new QAction(tr("Save All"), this);
|
m_saveAllAction = new QAction(tr("Save All"), this);
|
||||||
connect(m_saveAllAction, &QAction::triggered, this, &SkeletonDocumentWindow::saveAll, Qt::QueuedConnection);
|
connect(m_saveAllAction, &QAction::triggered, this, &SkeletonDocumentWindow::saveAll, Qt::QueuedConnection);
|
||||||
m_fileMenu->addAction(m_saveAllAction);
|
m_fileMenu->addAction(m_saveAllAction);
|
||||||
|
|
||||||
m_fileMenu->addSeparator();
|
m_fileMenu->addSeparator();
|
||||||
|
|
||||||
m_exportMenu = m_fileMenu->addMenu(tr("Export"));
|
m_exportMenu = m_fileMenu->addMenu(tr("Export"));
|
||||||
|
|
||||||
m_exportModelAction = new QAction(tr("Wavefront (.obj)..."), this);
|
m_exportModelAction = new QAction(tr("Wavefront (.obj)..."), this);
|
||||||
connect(m_exportModelAction, &QAction::triggered, this, &SkeletonDocumentWindow::exportModelResult, Qt::QueuedConnection);
|
connect(m_exportModelAction, &QAction::triggered, this, &SkeletonDocumentWindow::exportModelResult, Qt::QueuedConnection);
|
||||||
m_exportMenu->addAction(m_exportModelAction);
|
m_exportMenu->addAction(m_exportModelAction);
|
||||||
|
|
||||||
m_exportSkeletonAction = new QAction(tr("GL Transmission Format (.gltf)..."), this);
|
m_exportSkeletonAction = new QAction(tr("GL Transmission Format (.gltf)..."), this);
|
||||||
connect(m_exportSkeletonAction, &QAction::triggered, this, &SkeletonDocumentWindow::showExportPreview, Qt::QueuedConnection);
|
connect(m_exportSkeletonAction, &QAction::triggered, this, &SkeletonDocumentWindow::showExportPreview, Qt::QueuedConnection);
|
||||||
m_exportMenu->addAction(m_exportSkeletonAction);
|
m_exportMenu->addAction(m_exportSkeletonAction);
|
||||||
|
|
||||||
m_changeTurnaroundAction = new QAction(tr("Change Turnaround..."), this);
|
m_changeTurnaroundAction = new QAction(tr("Change Turnaround..."), this);
|
||||||
connect(m_changeTurnaroundAction, &QAction::triggered, this, &SkeletonDocumentWindow::changeTurnaround, Qt::QueuedConnection);
|
connect(m_changeTurnaroundAction, &QAction::triggered, this, &SkeletonDocumentWindow::changeTurnaround, Qt::QueuedConnection);
|
||||||
m_fileMenu->addAction(m_changeTurnaroundAction);
|
m_fileMenu->addAction(m_changeTurnaroundAction);
|
||||||
|
|
||||||
connect(m_fileMenu, &QMenu::aboutToShow, [=]() {
|
connect(m_fileMenu, &QMenu::aboutToShow, [=]() {
|
||||||
m_exportModelAction->setEnabled(m_graphicsWidget->hasItems());
|
m_exportModelAction->setEnabled(m_graphicsWidget->hasItems());
|
||||||
m_exportSkeletonAction->setEnabled(m_graphicsWidget->hasItems());
|
m_exportSkeletonAction->setEnabled(m_graphicsWidget->hasItems());
|
||||||
});
|
});
|
||||||
|
|
||||||
m_editMenu = menuBar()->addMenu(tr("Edit"));
|
m_editMenu = menuBar()->addMenu(tr("Edit"));
|
||||||
|
|
||||||
m_addAction = new QAction(tr("Add..."), this);
|
m_addAction = new QAction(tr("Add..."), this);
|
||||||
connect(m_addAction, &QAction::triggered, [=]() {
|
connect(m_addAction, &QAction::triggered, [=]() {
|
||||||
m_document->setEditMode(SkeletonDocumentEditMode::Add);
|
m_document->setEditMode(SkeletonDocumentEditMode::Add);
|
||||||
});
|
});
|
||||||
m_editMenu->addAction(m_addAction);
|
m_editMenu->addAction(m_addAction);
|
||||||
|
|
||||||
m_undoAction = new QAction(tr("Undo"), this);
|
m_undoAction = new QAction(tr("Undo"), this);
|
||||||
connect(m_undoAction, &QAction::triggered, m_document, &SkeletonDocument::undo);
|
connect(m_undoAction, &QAction::triggered, m_document, &SkeletonDocument::undo);
|
||||||
m_editMenu->addAction(m_undoAction);
|
m_editMenu->addAction(m_undoAction);
|
||||||
|
|
||||||
m_redoAction = new QAction(tr("Redo"), this);
|
m_redoAction = new QAction(tr("Redo"), this);
|
||||||
connect(m_redoAction, &QAction::triggered, m_document, &SkeletonDocument::redo);
|
connect(m_redoAction, &QAction::triggered, m_document, &SkeletonDocument::redo);
|
||||||
m_editMenu->addAction(m_redoAction);
|
m_editMenu->addAction(m_redoAction);
|
||||||
|
|
||||||
m_deleteAction = new QAction(tr("Delete"), this);
|
m_deleteAction = new QAction(tr("Delete"), this);
|
||||||
connect(m_deleteAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::deleteSelected);
|
connect(m_deleteAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::deleteSelected);
|
||||||
m_editMenu->addAction(m_deleteAction);
|
m_editMenu->addAction(m_deleteAction);
|
||||||
|
|
||||||
m_breakAction = new QAction(tr("Break"), this);
|
m_breakAction = new QAction(tr("Break"), this);
|
||||||
connect(m_breakAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::breakSelected);
|
connect(m_breakAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::breakSelected);
|
||||||
m_editMenu->addAction(m_breakAction);
|
m_editMenu->addAction(m_breakAction);
|
||||||
|
|
||||||
m_connectAction = new QAction(tr("Connect"), this);
|
m_connectAction = new QAction(tr("Connect"), this);
|
||||||
connect(m_connectAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::connectSelected);
|
connect(m_connectAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::connectSelected);
|
||||||
m_editMenu->addAction(m_connectAction);
|
m_editMenu->addAction(m_connectAction);
|
||||||
|
|
||||||
m_cutAction = new QAction(tr("Cut"), this);
|
m_cutAction = new QAction(tr("Cut"), this);
|
||||||
connect(m_cutAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::cut);
|
connect(m_cutAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::cut);
|
||||||
m_editMenu->addAction(m_cutAction);
|
m_editMenu->addAction(m_cutAction);
|
||||||
|
|
||||||
m_copyAction = new QAction(tr("Copy"), this);
|
m_copyAction = new QAction(tr("Copy"), this);
|
||||||
connect(m_copyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::copy);
|
connect(m_copyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::copy);
|
||||||
m_editMenu->addAction(m_copyAction);
|
m_editMenu->addAction(m_copyAction);
|
||||||
|
|
||||||
m_pasteAction = new QAction(tr("Paste"), this);
|
m_pasteAction = new QAction(tr("Paste"), this);
|
||||||
connect(m_pasteAction, &QAction::triggered, m_document, &SkeletonDocument::paste);
|
connect(m_pasteAction, &QAction::triggered, m_document, &SkeletonDocument::paste);
|
||||||
m_editMenu->addAction(m_pasteAction);
|
m_editMenu->addAction(m_pasteAction);
|
||||||
|
|
||||||
m_flipHorizontallyAction = new QAction(tr("H Flip"), this);
|
m_flipHorizontallyAction = new QAction(tr("H Flip"), this);
|
||||||
connect(m_flipHorizontallyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::flipHorizontally);
|
connect(m_flipHorizontallyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::flipHorizontally);
|
||||||
m_editMenu->addAction(m_flipHorizontallyAction);
|
m_editMenu->addAction(m_flipHorizontallyAction);
|
||||||
|
|
||||||
m_flipVerticallyAction = new QAction(tr("V Flip"), this);
|
m_flipVerticallyAction = new QAction(tr("V Flip"), this);
|
||||||
connect(m_flipVerticallyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::flipVertically);
|
connect(m_flipVerticallyAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::flipVertically);
|
||||||
m_editMenu->addAction(m_flipVerticallyAction);
|
m_editMenu->addAction(m_flipVerticallyAction);
|
||||||
|
|
||||||
m_rotateClockwiseAction = new QAction(tr("Rotate 90D CW"), this);
|
m_rotateClockwiseAction = new QAction(tr("Rotate 90D CW"), this);
|
||||||
connect(m_rotateClockwiseAction, &QAction::triggered, [=] {
|
connect(m_rotateClockwiseAction, &QAction::triggered, [=] {
|
||||||
m_graphicsWidget->rotateClockwise90Degree();
|
m_graphicsWidget->rotateClockwise90Degree();
|
||||||
});
|
});
|
||||||
m_editMenu->addAction(m_rotateClockwiseAction);
|
m_editMenu->addAction(m_rotateClockwiseAction);
|
||||||
|
|
||||||
m_rotateCounterclockwiseAction = new QAction(tr("Rotate 90D CCW"), this);
|
m_rotateCounterclockwiseAction = new QAction(tr("Rotate 90D CCW"), this);
|
||||||
connect(m_rotateCounterclockwiseAction, &QAction::triggered, [=] {
|
connect(m_rotateCounterclockwiseAction, &QAction::triggered, [=] {
|
||||||
m_graphicsWidget->rotateCounterclockwise90Degree();
|
m_graphicsWidget->rotateCounterclockwise90Degree();
|
||||||
});
|
});
|
||||||
m_editMenu->addAction(m_rotateCounterclockwiseAction);
|
m_editMenu->addAction(m_rotateCounterclockwiseAction);
|
||||||
|
|
||||||
m_switchXzAction = new QAction(tr("Switch XZ"), this);
|
m_switchXzAction = new QAction(tr("Switch XZ"), this);
|
||||||
connect(m_switchXzAction, &QAction::triggered, [=] {
|
connect(m_switchXzAction, &QAction::triggered, [=] {
|
||||||
m_graphicsWidget->switchSelectedXZ();
|
m_graphicsWidget->switchSelectedXZ();
|
||||||
});
|
});
|
||||||
m_editMenu->addAction(m_switchXzAction);
|
m_editMenu->addAction(m_switchXzAction);
|
||||||
|
|
||||||
m_alignToMenu = new QMenu(tr("Align To"));
|
m_alignToMenu = new QMenu(tr("Align To"));
|
||||||
|
|
||||||
m_alignToGlobalCenterAction = new QAction(tr("Global Center"), this);
|
m_alignToGlobalCenterAction = new QAction(tr("Global Center"), this);
|
||||||
connect(m_alignToGlobalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalCenter);
|
connect(m_alignToGlobalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalCenter);
|
||||||
m_alignToMenu->addAction(m_alignToGlobalCenterAction);
|
m_alignToMenu->addAction(m_alignToGlobalCenterAction);
|
||||||
|
|
||||||
m_alignToGlobalVerticalCenterAction = new QAction(tr("Global Vertical Center"), this);
|
m_alignToGlobalVerticalCenterAction = new QAction(tr("Global Vertical Center"), this);
|
||||||
connect(m_alignToGlobalVerticalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalVerticalCenter);
|
connect(m_alignToGlobalVerticalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalVerticalCenter);
|
||||||
m_alignToMenu->addAction(m_alignToGlobalVerticalCenterAction);
|
m_alignToMenu->addAction(m_alignToGlobalVerticalCenterAction);
|
||||||
|
|
||||||
m_alignToGlobalHorizontalCenterAction = new QAction(tr("Global Horizontal Center"), this);
|
m_alignToGlobalHorizontalCenterAction = new QAction(tr("Global Horizontal Center"), this);
|
||||||
connect(m_alignToGlobalHorizontalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalHorizontalCenter);
|
connect(m_alignToGlobalHorizontalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToGlobalHorizontalCenter);
|
||||||
m_alignToMenu->addAction(m_alignToGlobalHorizontalCenterAction);
|
m_alignToMenu->addAction(m_alignToGlobalHorizontalCenterAction);
|
||||||
|
|
||||||
m_alignToLocalCenterAction = new QAction(tr("Local Center"), this);
|
m_alignToLocalCenterAction = new QAction(tr("Local Center"), this);
|
||||||
connect(m_alignToLocalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalCenter);
|
connect(m_alignToLocalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalCenter);
|
||||||
m_alignToMenu->addAction(m_alignToLocalCenterAction);
|
m_alignToMenu->addAction(m_alignToLocalCenterAction);
|
||||||
|
|
||||||
m_alignToLocalVerticalCenterAction = new QAction(tr("Local Vertical Center"), this);
|
m_alignToLocalVerticalCenterAction = new QAction(tr("Local Vertical Center"), this);
|
||||||
connect(m_alignToLocalVerticalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalVerticalCenter);
|
connect(m_alignToLocalVerticalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalVerticalCenter);
|
||||||
m_alignToMenu->addAction(m_alignToLocalVerticalCenterAction);
|
m_alignToMenu->addAction(m_alignToLocalVerticalCenterAction);
|
||||||
|
|
||||||
m_alignToLocalHorizontalCenterAction = new QAction(tr("Local Horizontal Center"), this);
|
m_alignToLocalHorizontalCenterAction = new QAction(tr("Local Horizontal Center"), this);
|
||||||
connect(m_alignToLocalHorizontalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalHorizontalCenter);
|
connect(m_alignToLocalHorizontalCenterAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::alignSelectedToLocalHorizontalCenter);
|
||||||
m_alignToMenu->addAction(m_alignToLocalHorizontalCenterAction);
|
m_alignToMenu->addAction(m_alignToLocalHorizontalCenterAction);
|
||||||
|
|
||||||
m_editMenu->addMenu(m_alignToMenu);
|
m_editMenu->addMenu(m_alignToMenu);
|
||||||
|
|
||||||
m_markAsMenu = new QMenu(tr("Mark As"));
|
m_markAsMenu = new QMenu(tr("Mark As"));
|
||||||
|
|
||||||
m_markAsNoneAction = new QAction(tr("None"), this);
|
m_markAsNoneAction = new QAction(tr("None"), this);
|
||||||
connect(m_markAsNoneAction, &QAction::triggered, [=]() {
|
connect(m_markAsNoneAction, &QAction::triggered, [=]() {
|
||||||
m_graphicsWidget->setSelectedNodesBoneMark(SkeletonBoneMark::None);
|
m_graphicsWidget->setSelectedNodesBoneMark(SkeletonBoneMark::None);
|
||||||
});
|
});
|
||||||
m_markAsMenu->addAction(m_markAsNoneAction);
|
m_markAsMenu->addAction(m_markAsNoneAction);
|
||||||
|
|
||||||
m_markAsMenu->addSeparator();
|
m_markAsMenu->addSeparator();
|
||||||
|
|
||||||
for (int i = 0; i < SKELETON_BONE_MARK_TYPE_NUM; i++) {
|
for (int i = 0; i < SKELETON_BONE_MARK_TYPE_NUM; i++) {
|
||||||
SkeletonBoneMark boneMark = (SkeletonBoneMark)(i + 1);
|
SkeletonBoneMark boneMark = (SkeletonBoneMark)(i + 1);
|
||||||
m_markAsActions[i] = new QAction(MarkIconCreator::createIcon(boneMark), SkeletonBoneMarkToDispName(boneMark), this);
|
m_markAsActions[i] = new QAction(MarkIconCreator::createIcon(boneMark), SkeletonBoneMarkToDispName(boneMark), this);
|
||||||
|
@ -368,21 +368,21 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
});
|
});
|
||||||
m_markAsMenu->addAction(m_markAsActions[i]);
|
m_markAsMenu->addAction(m_markAsActions[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_editMenu->addMenu(m_markAsMenu);
|
m_editMenu->addMenu(m_markAsMenu);
|
||||||
|
|
||||||
m_selectAllAction = new QAction(tr("Select All"), this);
|
m_selectAllAction = new QAction(tr("Select All"), this);
|
||||||
connect(m_selectAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::selectAll);
|
connect(m_selectAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::selectAll);
|
||||||
m_editMenu->addAction(m_selectAllAction);
|
m_editMenu->addAction(m_selectAllAction);
|
||||||
|
|
||||||
m_selectPartAllAction = new QAction(tr("Select Part"), this);
|
m_selectPartAllAction = new QAction(tr("Select Part"), this);
|
||||||
connect(m_selectPartAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::selectPartAll);
|
connect(m_selectPartAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::selectPartAll);
|
||||||
m_editMenu->addAction(m_selectPartAllAction);
|
m_editMenu->addAction(m_selectPartAllAction);
|
||||||
|
|
||||||
m_unselectAllAction = new QAction(tr("Unselect All"), this);
|
m_unselectAllAction = new QAction(tr("Unselect All"), this);
|
||||||
connect(m_unselectAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::unselectAll);
|
connect(m_unselectAllAction, &QAction::triggered, m_graphicsWidget, &SkeletonGraphicsWidget::unselectAll);
|
||||||
m_editMenu->addAction(m_unselectAllAction);
|
m_editMenu->addAction(m_unselectAllAction);
|
||||||
|
|
||||||
connect(m_editMenu, &QMenu::aboutToShow, [=]() {
|
connect(m_editMenu, &QMenu::aboutToShow, [=]() {
|
||||||
m_undoAction->setEnabled(m_document->undoable());
|
m_undoAction->setEnabled(m_document->undoable());
|
||||||
m_redoAction->setEnabled(m_document->redoable());
|
m_redoAction->setEnabled(m_document->redoable());
|
||||||
|
@ -409,14 +409,14 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
m_selectPartAllAction->setEnabled(m_graphicsWidget->hasItems());
|
m_selectPartAllAction->setEnabled(m_graphicsWidget->hasItems());
|
||||||
m_unselectAllAction->setEnabled(m_graphicsWidget->hasSelection());
|
m_unselectAllAction->setEnabled(m_graphicsWidget->hasSelection());
|
||||||
});
|
});
|
||||||
|
|
||||||
m_viewMenu = menuBar()->addMenu(tr("View"));
|
m_viewMenu = menuBar()->addMenu(tr("View"));
|
||||||
|
|
||||||
auto modelIsSitInVisibleArea = [](ModelWidget *modelWidget) {
|
auto modelIsSitInVisibleArea = [](ModelWidget *modelWidget) {
|
||||||
QRect parentRect = QRect(QPoint(0, 0), modelWidget->parentWidget()->size());
|
QRect parentRect = QRect(QPoint(0, 0), modelWidget->parentWidget()->size());
|
||||||
return parentRect.contains(modelWidget->geometry().center());
|
return parentRect.contains(modelWidget->geometry().center());
|
||||||
};
|
};
|
||||||
|
|
||||||
m_resetModelWidgetPosAction = new QAction(tr("Show Model"), this);
|
m_resetModelWidgetPosAction = new QAction(tr("Show Model"), this);
|
||||||
connect(m_resetModelWidgetPosAction, &QAction::triggered, [=]() {
|
connect(m_resetModelWidgetPosAction, &QAction::triggered, [=]() {
|
||||||
if (!modelIsSitInVisibleArea(m_modelRenderWidget)) {
|
if (!modelIsSitInVisibleArea(m_modelRenderWidget)) {
|
||||||
|
@ -424,95 +424,95 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
m_viewMenu->addAction(m_resetModelWidgetPosAction);
|
m_viewMenu->addAction(m_resetModelWidgetPosAction);
|
||||||
|
|
||||||
m_toggleWireframeAction = new QAction(tr("Toggle Wireframe"), this);
|
m_toggleWireframeAction = new QAction(tr("Toggle Wireframe"), this);
|
||||||
connect(m_toggleWireframeAction, &QAction::triggered, [=]() {
|
connect(m_toggleWireframeAction, &QAction::triggered, [=]() {
|
||||||
m_modelRenderWidget->toggleWireframe();
|
m_modelRenderWidget->toggleWireframe();
|
||||||
});
|
});
|
||||||
m_viewMenu->addAction(m_toggleWireframeAction);
|
m_viewMenu->addAction(m_toggleWireframeAction);
|
||||||
|
|
||||||
m_viewMenu->addSeparator();
|
m_viewMenu->addSeparator();
|
||||||
|
|
||||||
m_showPartsListAction = new QAction(tr("Show Parts List"), this);
|
m_showPartsListAction = new QAction(tr("Show Parts List"), this);
|
||||||
connect(m_showPartsListAction, &QAction::triggered, [=]() {
|
connect(m_showPartsListAction, &QAction::triggered, [=]() {
|
||||||
partListDocker->show();
|
partListDocker->show();
|
||||||
});
|
});
|
||||||
m_viewMenu->addAction(m_showPartsListAction);
|
m_viewMenu->addAction(m_showPartsListAction);
|
||||||
|
|
||||||
m_viewMenu->addSeparator();
|
m_viewMenu->addSeparator();
|
||||||
|
|
||||||
m_showAnimationPanelAction = new QAction(tr("Show Animation Panel"), this);
|
m_showAnimationPanelAction = new QAction(tr("Show Animation Panel"), this);
|
||||||
connect(m_showAnimationPanelAction, &QAction::triggered, this, &SkeletonDocumentWindow::showAnimationPanel);
|
connect(m_showAnimationPanelAction, &QAction::triggered, this, &SkeletonDocumentWindow::showAnimationPanel);
|
||||||
m_viewMenu->addAction(m_showAnimationPanelAction);
|
m_viewMenu->addAction(m_showAnimationPanelAction);
|
||||||
|
|
||||||
m_viewMenu->addSeparator();
|
m_viewMenu->addSeparator();
|
||||||
|
|
||||||
m_showDebugDialogAction = new QAction(tr("Show Debug Dialog"), this);
|
m_showDebugDialogAction = new QAction(tr("Show Debug Dialog"), this);
|
||||||
connect(m_showDebugDialogAction, &QAction::triggered, g_logBrowser, &LogBrowser::showDialog);
|
connect(m_showDebugDialogAction, &QAction::triggered, g_logBrowser, &LogBrowser::showDialog);
|
||||||
m_viewMenu->addAction(m_showDebugDialogAction);
|
m_viewMenu->addAction(m_showDebugDialogAction);
|
||||||
|
|
||||||
connect(m_viewMenu, &QMenu::aboutToShow, [=]() {
|
connect(m_viewMenu, &QMenu::aboutToShow, [=]() {
|
||||||
m_showPartsListAction->setEnabled(partListDocker->isHidden());
|
m_showPartsListAction->setEnabled(partListDocker->isHidden());
|
||||||
m_showAnimationPanelAction->setEnabled(nullptr == m_animationPanelWidget || m_animationPanelWidget->isHidden());
|
m_showAnimationPanelAction->setEnabled(nullptr == m_animationPanelWidget || m_animationPanelWidget->isHidden());
|
||||||
m_resetModelWidgetPosAction->setEnabled(!modelIsSitInVisibleArea(m_modelRenderWidget));
|
m_resetModelWidgetPosAction->setEnabled(!modelIsSitInVisibleArea(m_modelRenderWidget));
|
||||||
});
|
});
|
||||||
|
|
||||||
m_helpMenu = menuBar()->addMenu(tr("Help"));
|
m_helpMenu = menuBar()->addMenu(tr("Help"));
|
||||||
|
|
||||||
m_viewSourceAction = new QAction(tr("Fork me on GitHub"), this);
|
m_viewSourceAction = new QAction(tr("Fork me on GitHub"), this);
|
||||||
connect(m_viewSourceAction, &QAction::triggered, this, &SkeletonDocumentWindow::viewSource);
|
connect(m_viewSourceAction, &QAction::triggered, this, &SkeletonDocumentWindow::viewSource);
|
||||||
m_helpMenu->addAction(m_viewSourceAction);
|
m_helpMenu->addAction(m_viewSourceAction);
|
||||||
|
|
||||||
m_helpMenu->addSeparator();
|
m_helpMenu->addSeparator();
|
||||||
|
|
||||||
m_seeReferenceGuideAction = new QAction(tr("Reference Guide"), this);
|
m_seeReferenceGuideAction = new QAction(tr("Reference Guide"), this);
|
||||||
connect(m_seeReferenceGuideAction, &QAction::triggered, this, &SkeletonDocumentWindow::seeReferenceGuide);
|
connect(m_seeReferenceGuideAction, &QAction::triggered, this, &SkeletonDocumentWindow::seeReferenceGuide);
|
||||||
m_helpMenu->addAction(m_seeReferenceGuideAction);
|
m_helpMenu->addAction(m_seeReferenceGuideAction);
|
||||||
|
|
||||||
m_helpMenu->addSeparator();
|
m_helpMenu->addSeparator();
|
||||||
|
|
||||||
m_aboutAction = new QAction(tr("About"), this);
|
m_aboutAction = new QAction(tr("About"), this);
|
||||||
connect(m_aboutAction, &QAction::triggered, this, &SkeletonDocumentWindow::about);
|
connect(m_aboutAction, &QAction::triggered, this, &SkeletonDocumentWindow::about);
|
||||||
m_helpMenu->addAction(m_aboutAction);
|
m_helpMenu->addAction(m_aboutAction);
|
||||||
|
|
||||||
m_reportIssuesAction = new QAction(tr("Report Issues"), this);
|
m_reportIssuesAction = new QAction(tr("Report Issues"), this);
|
||||||
connect(m_reportIssuesAction, &QAction::triggered, this, &SkeletonDocumentWindow::reportIssues);
|
connect(m_reportIssuesAction, &QAction::triggered, this, &SkeletonDocumentWindow::reportIssues);
|
||||||
m_helpMenu->addAction(m_reportIssuesAction);
|
m_helpMenu->addAction(m_reportIssuesAction);
|
||||||
|
|
||||||
m_seeAcknowlegementsAction = new QAction(tr("Acknowlegements"), this);
|
m_seeAcknowlegementsAction = new QAction(tr("Acknowlegements"), this);
|
||||||
connect(m_seeAcknowlegementsAction, &QAction::triggered, this, &SkeletonDocumentWindow::seeAcknowlegements);
|
connect(m_seeAcknowlegementsAction, &QAction::triggered, this, &SkeletonDocumentWindow::seeAcknowlegements);
|
||||||
m_helpMenu->addAction(m_seeAcknowlegementsAction);
|
m_helpMenu->addAction(m_seeAcknowlegementsAction);
|
||||||
|
|
||||||
connect(containerWidget, &SkeletonGraphicsContainerWidget::containerSizeChanged,
|
connect(containerWidget, &SkeletonGraphicsContainerWidget::containerSizeChanged,
|
||||||
graphicsWidget, &SkeletonGraphicsWidget::canvasResized);
|
graphicsWidget, &SkeletonGraphicsWidget::canvasResized);
|
||||||
|
|
||||||
connect(m_document, &SkeletonDocument::turnaroundChanged,
|
connect(m_document, &SkeletonDocument::turnaroundChanged,
|
||||||
graphicsWidget, &SkeletonGraphicsWidget::turnaroundChanged);
|
graphicsWidget, &SkeletonGraphicsWidget::turnaroundChanged);
|
||||||
|
|
||||||
connect(undoButton, &QPushButton::clicked, [=]() {
|
connect(undoButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->undo();
|
m_document->undo();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(addButton, &QPushButton::clicked, [=]() {
|
connect(addButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setEditMode(SkeletonDocumentEditMode::Add);
|
m_document->setEditMode(SkeletonDocumentEditMode::Add);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(selectButton, &QPushButton::clicked, [=]() {
|
connect(selectButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setEditMode(SkeletonDocumentEditMode::Select);
|
m_document->setEditMode(SkeletonDocumentEditMode::Select);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(dragButton, &QPushButton::clicked, [=]() {
|
connect(dragButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setEditMode(SkeletonDocumentEditMode::Drag);
|
m_document->setEditMode(SkeletonDocumentEditMode::Drag);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(zoomInButton, &QPushButton::clicked, [=]() {
|
connect(zoomInButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setEditMode(SkeletonDocumentEditMode::ZoomIn);
|
m_document->setEditMode(SkeletonDocumentEditMode::ZoomIn);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(zoomOutButton, &QPushButton::clicked, [=]() {
|
connect(zoomOutButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setEditMode(SkeletonDocumentEditMode::ZoomOut);
|
m_document->setEditMode(SkeletonDocumentEditMode::ZoomOut);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_xlockButton, &QPushButton::clicked, [=]() {
|
connect(m_xlockButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setXlockState(!m_document->xlocked);
|
m_document->setXlockState(!m_document->xlocked);
|
||||||
});
|
});
|
||||||
|
@ -522,7 +522,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
connect(m_zlockButton, &QPushButton::clicked, [=]() {
|
connect(m_zlockButton, &QPushButton::clicked, [=]() {
|
||||||
m_document->setZlockState(!m_document->zlocked);
|
m_document->setZlockState(!m_document->zlocked);
|
||||||
});
|
});
|
||||||
|
|
||||||
m_partListDockerVisibleSwitchConnection = connect(m_document, &SkeletonDocument::skeletonChanged, [=]() {
|
m_partListDockerVisibleSwitchConnection = connect(m_document, &SkeletonDocument::skeletonChanged, [=]() {
|
||||||
if (m_graphicsWidget->hasItems()) {
|
if (m_graphicsWidget->hasItems()) {
|
||||||
if (partListDocker->isHidden())
|
if (partListDocker->isHidden())
|
||||||
|
@ -530,11 +530,11 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
disconnect(m_partListDockerVisibleSwitchConnection);
|
disconnect(m_partListDockerVisibleSwitchConnection);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_document, &SkeletonDocument::editModeChanged, graphicsWidget, &SkeletonGraphicsWidget::editModeChanged);
|
connect(m_document, &SkeletonDocument::editModeChanged, graphicsWidget, &SkeletonGraphicsWidget::editModeChanged);
|
||||||
|
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::zoomRenderedModelBy, m_modelRenderWidget, &ModelWidget::zoom);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::zoomRenderedModelBy, m_modelRenderWidget, &ModelWidget::zoom);
|
||||||
|
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::addNode, m_document, &SkeletonDocument::addNode);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::addNode, m_document, &SkeletonDocument::addNode);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::scaleNodeByAddRadius, m_document, &SkeletonDocument::scaleNodeByAddRadius);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::scaleNodeByAddRadius, m_document, &SkeletonDocument::scaleNodeByAddRadius);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::moveNodeBy, m_document, &SkeletonDocument::moveNodeBy);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::moveNodeBy, m_document, &SkeletonDocument::moveNodeBy);
|
||||||
|
@ -555,22 +555,22 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::partChecked, m_document, &SkeletonDocument::partChecked);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::partChecked, m_document, &SkeletonDocument::partChecked);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::partUnchecked, m_document, &SkeletonDocument::partUnchecked);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::partUnchecked, m_document, &SkeletonDocument::partUnchecked);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::switchNodeXZ, m_document, &SkeletonDocument::switchNodeXZ);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::switchNodeXZ, m_document, &SkeletonDocument::switchNodeXZ);
|
||||||
|
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartLockState, m_document, &SkeletonDocument::setPartLockState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartLockState, m_document, &SkeletonDocument::setPartLockState);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartVisibleState, m_document, &SkeletonDocument::setPartVisibleState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartVisibleState, m_document, &SkeletonDocument::setPartVisibleState);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartSubdivState, m_document, &SkeletonDocument::setPartSubdivState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartSubdivState, m_document, &SkeletonDocument::setPartSubdivState);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartDisableState, m_document, &SkeletonDocument::setPartDisableState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartDisableState, m_document, &SkeletonDocument::setPartDisableState);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartXmirrorState, m_document, &SkeletonDocument::setPartXmirrorState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartXmirrorState, m_document, &SkeletonDocument::setPartXmirrorState);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartRoundState, m_document, &SkeletonDocument::setPartRoundState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setPartRoundState, m_document, &SkeletonDocument::setPartRoundState);
|
||||||
|
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setXlockState, m_document, &SkeletonDocument::setXlockState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setXlockState, m_document, &SkeletonDocument::setXlockState);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setYlockState, m_document, &SkeletonDocument::setYlockState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setYlockState, m_document, &SkeletonDocument::setYlockState);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::setZlockState, m_document, &SkeletonDocument::setZlockState);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::setZlockState, m_document, &SkeletonDocument::setZlockState);
|
||||||
|
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::changeTurnaround, this, &SkeletonDocumentWindow::changeTurnaround);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::changeTurnaround, this, &SkeletonDocumentWindow::changeTurnaround);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::save, this, &SkeletonDocumentWindow::save);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::save, this, &SkeletonDocumentWindow::save);
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::open, this, &SkeletonDocumentWindow::open);
|
connect(graphicsWidget, &SkeletonGraphicsWidget::open, this, &SkeletonDocumentWindow::open);
|
||||||
|
|
||||||
connect(m_document, &SkeletonDocument::nodeAdded, graphicsWidget, &SkeletonGraphicsWidget::nodeAdded);
|
connect(m_document, &SkeletonDocument::nodeAdded, graphicsWidget, &SkeletonGraphicsWidget::nodeAdded);
|
||||||
connect(m_document, &SkeletonDocument::nodeRemoved, graphicsWidget, &SkeletonGraphicsWidget::nodeRemoved);
|
connect(m_document, &SkeletonDocument::nodeRemoved, graphicsWidget, &SkeletonGraphicsWidget::nodeRemoved);
|
||||||
connect(m_document, &SkeletonDocument::edgeAdded, graphicsWidget, &SkeletonGraphicsWidget::edgeAdded);
|
connect(m_document, &SkeletonDocument::edgeAdded, graphicsWidget, &SkeletonGraphicsWidget::edgeAdded);
|
||||||
|
@ -588,7 +588,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
connect(m_document, &SkeletonDocument::uncheckAll, graphicsWidget, &SkeletonGraphicsWidget::unselectAll);
|
connect(m_document, &SkeletonDocument::uncheckAll, graphicsWidget, &SkeletonGraphicsWidget::unselectAll);
|
||||||
connect(m_document, &SkeletonDocument::checkNode, graphicsWidget, &SkeletonGraphicsWidget::addSelectNode);
|
connect(m_document, &SkeletonDocument::checkNode, graphicsWidget, &SkeletonGraphicsWidget::addSelectNode);
|
||||||
connect(m_document, &SkeletonDocument::checkEdge, graphicsWidget, &SkeletonGraphicsWidget::addSelectEdge);
|
connect(m_document, &SkeletonDocument::checkEdge, graphicsWidget, &SkeletonGraphicsWidget::addSelectEdge);
|
||||||
|
|
||||||
connect(m_document, &SkeletonDocument::partListChanged, partListWidget, &SkeletonPartListWidget::partListChanged);
|
connect(m_document, &SkeletonDocument::partListChanged, partListWidget, &SkeletonPartListWidget::partListChanged);
|
||||||
connect(m_document, &SkeletonDocument::partPreviewChanged, partListWidget, &SkeletonPartListWidget::partPreviewChanged);
|
connect(m_document, &SkeletonDocument::partPreviewChanged, partListWidget, &SkeletonPartListWidget::partPreviewChanged);
|
||||||
connect(m_document, &SkeletonDocument::partLockStateChanged, partListWidget, &SkeletonPartListWidget::partLockStateChanged);
|
connect(m_document, &SkeletonDocument::partLockStateChanged, partListWidget, &SkeletonPartListWidget::partLockStateChanged);
|
||||||
|
@ -603,7 +603,7 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
connect(m_document, &SkeletonDocument::cleanup, partListWidget, &SkeletonPartListWidget::partListChanged);
|
connect(m_document, &SkeletonDocument::cleanup, partListWidget, &SkeletonPartListWidget::partListChanged);
|
||||||
connect(m_document, &SkeletonDocument::partChecked, partListWidget, &SkeletonPartListWidget::partChecked);
|
connect(m_document, &SkeletonDocument::partChecked, partListWidget, &SkeletonPartListWidget::partChecked);
|
||||||
connect(m_document, &SkeletonDocument::partUnchecked, partListWidget, &SkeletonPartListWidget::partUnchecked);
|
connect(m_document, &SkeletonDocument::partUnchecked, partListWidget, &SkeletonPartListWidget::partUnchecked);
|
||||||
|
|
||||||
connect(m_document, &SkeletonDocument::skeletonChanged, m_document, &SkeletonDocument::generateMesh);
|
connect(m_document, &SkeletonDocument::skeletonChanged, m_document, &SkeletonDocument::generateMesh);
|
||||||
connect(m_document, &SkeletonDocument::resultMeshChanged, [=]() {
|
connect(m_document, &SkeletonDocument::resultMeshChanged, [=]() {
|
||||||
if ((m_exportPreviewWidget && m_exportPreviewWidget->isVisible()) ||
|
if ((m_exportPreviewWidget && m_exportPreviewWidget->isVisible()) ||
|
||||||
|
@ -615,30 +615,30 @@ SkeletonDocumentWindow::SkeletonDocumentWindow() :
|
||||||
connect(m_document, &SkeletonDocument::postProcessedResultChanged, m_document, &SkeletonDocument::generateTexture);
|
connect(m_document, &SkeletonDocument::postProcessedResultChanged, m_document, &SkeletonDocument::generateTexture);
|
||||||
connect(m_document, &SkeletonDocument::resultTextureChanged, m_document, &SkeletonDocument::bakeAmbientOcclusionTexture);
|
connect(m_document, &SkeletonDocument::resultTextureChanged, m_document, &SkeletonDocument::bakeAmbientOcclusionTexture);
|
||||||
connect(m_document, &SkeletonDocument::postProcessedResultChanged, m_document, &SkeletonDocument::generateAllAnimationClips);
|
connect(m_document, &SkeletonDocument::postProcessedResultChanged, m_document, &SkeletonDocument::generateAllAnimationClips);
|
||||||
|
|
||||||
connect(m_document, &SkeletonDocument::resultMeshChanged, [=]() {
|
connect(m_document, &SkeletonDocument::resultMeshChanged, [=]() {
|
||||||
m_modelRenderWidget->updateMesh(m_document->takeResultMesh());
|
m_modelRenderWidget->updateMesh(m_document->takeResultMesh());
|
||||||
});
|
});
|
||||||
//connect(m_document, &SkeletonDocument::resultSkeletonChanged, [=]() {
|
//connect(m_document, &SkeletonDocument::resultSkeletonChanged, [=]() {
|
||||||
// m_skeletonRenderWidget->updateMesh(m_document->takeResultSkeletonMesh());
|
// m_skeletonRenderWidget->updateMesh(m_document->takeResultSkeletonMesh());
|
||||||
//});
|
//});
|
||||||
|
|
||||||
connect(graphicsWidget, &SkeletonGraphicsWidget::cursorChanged, [=]() {
|
connect(graphicsWidget, &SkeletonGraphicsWidget::cursorChanged, [=]() {
|
||||||
m_modelRenderWidget->setCursor(graphicsWidget->cursor());
|
m_modelRenderWidget->setCursor(graphicsWidget->cursor());
|
||||||
//m_skeletonRenderWidget->setCursor(graphicsWidget->cursor());
|
//m_skeletonRenderWidget->setCursor(graphicsWidget->cursor());
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_document, &SkeletonDocument::skeletonChanged, this, &SkeletonDocumentWindow::documentChanged);
|
connect(m_document, &SkeletonDocument::skeletonChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||||
connect(m_document, &SkeletonDocument::turnaroundChanged, this, &SkeletonDocumentWindow::documentChanged);
|
connect(m_document, &SkeletonDocument::turnaroundChanged, this, &SkeletonDocumentWindow::documentChanged);
|
||||||
|
|
||||||
connect(m_modelRenderWidget, &ModelWidget::customContextMenuRequested, [=](const QPoint &pos) {
|
connect(m_modelRenderWidget, &ModelWidget::customContextMenuRequested, [=](const QPoint &pos) {
|
||||||
graphicsWidget->showContextMenu(graphicsWidget->mapFromGlobal(m_modelRenderWidget->mapToGlobal(pos)));
|
graphicsWidget->showContextMenu(graphicsWidget->mapFromGlobal(m_modelRenderWidget->mapToGlobal(pos)));
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_document, &SkeletonDocument::xlockStateChanged, this, &SkeletonDocumentWindow::updateXlockButtonState);
|
connect(m_document, &SkeletonDocument::xlockStateChanged, this, &SkeletonDocumentWindow::updateXlockButtonState);
|
||||||
connect(m_document, &SkeletonDocument::ylockStateChanged, this, &SkeletonDocumentWindow::updateYlockButtonState);
|
connect(m_document, &SkeletonDocument::ylockStateChanged, this, &SkeletonDocumentWindow::updateYlockButtonState);
|
||||||
connect(m_document, &SkeletonDocument::zlockStateChanged, this, &SkeletonDocumentWindow::updateZlockButtonState);
|
connect(m_document, &SkeletonDocument::zlockStateChanged, this, &SkeletonDocumentWindow::updateZlockButtonState);
|
||||||
|
|
||||||
connect(this, &SkeletonDocumentWindow::initialized, m_document, &SkeletonDocument::uiReady);
|
connect(this, &SkeletonDocumentWindow::initialized, m_document, &SkeletonDocument::uiReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ void SkeletonDocumentWindow::closeEvent(QCloseEvent *event)
|
||||||
event->accept();
|
event->accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox::StandardButton answer = QMessageBox::question(this,
|
QMessageBox::StandardButton answer = QMessageBox::question(this,
|
||||||
APP_NAME,
|
APP_NAME,
|
||||||
tr("Do you really want to close while there are unsaved changes?"),
|
tr("Do you really want to close while there are unsaved changes?"),
|
||||||
|
@ -769,7 +769,7 @@ void SkeletonDocumentWindow::initLockButton(QPushButton *button)
|
||||||
font.setWeight(QFont::Light);
|
font.setWeight(QFont::Light);
|
||||||
font.setPixelSize(Theme::toolIconFontSize);
|
font.setPixelSize(Theme::toolIconFontSize);
|
||||||
font.setBold(false);
|
font.setBold(false);
|
||||||
|
|
||||||
button->setFont(font);
|
button->setFont(font);
|
||||||
button->setFixedSize(Theme::toolIconSize, Theme::toolIconSize);
|
button->setFixedSize(Theme::toolIconSize, Theme::toolIconSize);
|
||||||
button->setStyleSheet("QPushButton {color: #f7d9c8}");
|
button->setStyleSheet("QPushButton {color: #f7d9c8}");
|
||||||
|
@ -818,7 +818,7 @@ void SkeletonDocumentWindow::save()
|
||||||
void SkeletonDocumentWindow::saveTo(const QString &saveAsFilename)
|
void SkeletonDocumentWindow::saveTo(const QString &saveAsFilename)
|
||||||
{
|
{
|
||||||
QString filename = saveAsFilename;
|
QString filename = saveAsFilename;
|
||||||
|
|
||||||
if (filename.isEmpty()) {
|
if (filename.isEmpty()) {
|
||||||
filename = QFileDialog::getSaveFileName(this, QString(), QString(),
|
filename = QFileDialog::getSaveFileName(this, QString(), QString(),
|
||||||
tr("Dust3D Document (*.ds3)"));
|
tr("Dust3D Document (*.ds3)"));
|
||||||
|
@ -826,11 +826,11 @@ void SkeletonDocumentWindow::saveTo(const QString &saveAsFilename)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
Ds3FileWriter ds3Writer;
|
Ds3FileWriter ds3Writer;
|
||||||
|
|
||||||
QByteArray modelXml;
|
QByteArray modelXml;
|
||||||
QXmlStreamWriter stream(&modelXml);
|
QXmlStreamWriter stream(&modelXml);
|
||||||
SkeletonSnapshot snapshot;
|
SkeletonSnapshot snapshot;
|
||||||
|
@ -838,7 +838,7 @@ void SkeletonDocumentWindow::saveTo(const QString &saveAsFilename)
|
||||||
saveSkeletonToXmlStream(&snapshot, &stream);
|
saveSkeletonToXmlStream(&snapshot, &stream);
|
||||||
if (modelXml.size() > 0)
|
if (modelXml.size() > 0)
|
||||||
ds3Writer.add("model.xml", "model", &modelXml);
|
ds3Writer.add("model.xml", "model", &modelXml);
|
||||||
|
|
||||||
QByteArray imageByteArray;
|
QByteArray imageByteArray;
|
||||||
QBuffer pngBuffer(&imageByteArray);
|
QBuffer pngBuffer(&imageByteArray);
|
||||||
if (!m_document->turnaround.isNull()) {
|
if (!m_document->turnaround.isNull()) {
|
||||||
|
@ -847,11 +847,11 @@ void SkeletonDocumentWindow::saveTo(const QString &saveAsFilename)
|
||||||
if (imageByteArray.size() > 0)
|
if (imageByteArray.size() > 0)
|
||||||
ds3Writer.add("canvas.png", "asset", &imageByteArray);
|
ds3Writer.add("canvas.png", "asset", &imageByteArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds3Writer.save(filename)) {
|
if (ds3Writer.save(filename)) {
|
||||||
setCurrentFilename(filename);
|
setCurrentFilename(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,12 +865,12 @@ void SkeletonDocumentWindow::open()
|
||||||
if (answer != QMessageBox::Yes)
|
if (answer != QMessageBox::Yes)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filename = QFileDialog::getOpenFileName(this, QString(), QString(),
|
QString filename = QFileDialog::getOpenFileName(this, QString(), QString(),
|
||||||
tr("Dust3D Document (*.ds3)"));
|
tr("Dust3D Document (*.ds3)"));
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
Ds3FileReader ds3Reader(filename);
|
Ds3FileReader ds3Reader(filename);
|
||||||
for (int i = 0; i < ds3Reader.items().size(); ++i) {
|
for (int i = 0; i < ds3Reader.items().size(); ++i) {
|
||||||
|
@ -893,7 +893,7 @@ void SkeletonDocumentWindow::open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
setCurrentFilename(filename);
|
setCurrentFilename(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1001,4 +1001,3 @@ void SkeletonDocumentWindow::updateZlockButtonState()
|
||||||
else
|
else
|
||||||
m_zlockButton->setStyleSheet("QPushButton {color: #aaebc4}");
|
m_zlockButton->setStyleSheet("QPushButton {color: #aaebc4}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ using json = basic_json<>;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
|
#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
|
||||||
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900
|
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900
|
||||||
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
|
//#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue