mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 09:05:57 -05:00
Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af188b55df | ||
|
|
f287a1041d | ||
|
|
fda9b1c3ea | ||
|
|
9eb7f58525 | ||
|
|
abd6fd6b7e | ||
|
|
2909b1300e | ||
|
|
d1331a60b9 | ||
|
|
d5fc3befb8 | ||
|
|
80f9c79907 | ||
|
|
e4bd1fc180 | ||
|
|
59c87ca027 | ||
|
|
eda161de39 | ||
|
|
6033426a6e | ||
|
|
caea16c6ad | ||
|
|
e3a39a5df7 | ||
|
|
38b7e08711 | ||
|
|
7349841758 | ||
|
|
5d58269b02 | ||
|
|
8a4aef0f50 | ||
|
|
4b877d865c | ||
|
|
82503286ea | ||
|
|
16ee789c82 | ||
|
|
d040a01016 | ||
|
|
eb952afe58 | ||
|
|
34cff925fc | ||
|
|
016d963598 | ||
|
|
d31ae77176 | ||
|
|
2c1b97e5cd | ||
|
|
c498d1509a | ||
|
|
2d61189655 | ||
|
|
82c20b871b | ||
|
|
bd52ef8e84 | ||
|
|
59e1ddd31e | ||
|
|
a320d78a08 | ||
|
|
ce5730428c | ||
|
|
f7b9795014 | ||
|
|
3417fc5407 | ||
|
|
2649efe8b3 | ||
|
|
3af5897427 | ||
|
|
92877a6b30 | ||
|
|
fbdaffcbf6 | ||
|
|
ba111c6caa | ||
|
|
5c8760ac0a | ||
|
|
e0cca2a0d4 | ||
|
|
d69aba8ab7 | ||
|
|
a2ba7adc56 | ||
|
|
0881146a25 | ||
|
|
5224d6589e | ||
|
|
15eeec8ebf | ||
|
|
ed7f375d64 |
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
35
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Logs**
|
||||||
|
Please provide a log of your issue with verbose logging enabled (See General tab of the plugin).
|
||||||
|
See [here](https://obsproject.com/forum/threads/please-post-a-log-with-your-issue-heres-how.23074/) for a description where to find the log files and how to share them.
|
||||||
|
Please share the currently used plugin settings by exporting them them to a file (See General tab of the plugin).
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Version information**
|
||||||
|
- OS: [e.g. Windows 10]
|
||||||
|
- OBS Version [e.g. 27.1.3]
|
||||||
|
- Plugin Version [e.g. 1.17.1]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
86
.github/workflows/build-debian.yml
vendored
86
.github/workflows/build-debian.yml
vendored
@@ -4,46 +4,52 @@ on: [push, pull_request]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
submodules: "recursive"
|
||||||
- name: check_libobs_revision
|
- name: check_libobs_revision
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install libobs-dev
|
sudo apt install libobs-dev
|
||||||
mkdir source
|
mkdir source
|
||||||
cd source
|
cd source
|
||||||
dpkg -l libobs-dev | tr -s " "| grep libobs | cut -d" " -f3 > libobs.rev
|
dpkg -l libobs-dev | tr -s " "| grep libobs | cut -d" " -f3 > libobs.rev
|
||||||
- name: install_frontend_header
|
- name: install_frontend_header
|
||||||
run: |
|
run: |
|
||||||
[ -e /usr/include/obs/obs-frontend-api.h ] && { echo "ERROR: obs-frontend-api.h already in system. Maybe the package libobs-dev is installing it."; exit 1; }
|
[ -e /usr/include/obs/obs-frontend-api.h ] && { echo "ERROR: obs-frontend-api.h already in system. Maybe the package libobs-dev is installing it."; exit 1; }
|
||||||
cd source
|
cd source
|
||||||
LIBOBSREV=$(cat libobs.rev)
|
LIBOBSREV=$(cat libobs.rev)
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install devscripts
|
sudo apt install devscripts
|
||||||
dget -u http://archive.ubuntu.com/ubuntu/pool/universe/o/obs-studio/obs-studio_$LIBOBSREV.dsc
|
dget -u http://archive.ubuntu.com/ubuntu/pool/universe/o/obs-studio/obs-studio_$LIBOBSREV.dsc
|
||||||
cd ..
|
cd ..
|
||||||
sudo find -name obs-frontend-api.h -exec cp {} /usr/include/obs/ \;
|
sudo find -name obs-frontend-api.h -exec cp {} /usr/include/obs/ \;
|
||||||
egrep '#include <obs.h>' /usr/include/obs/obs-frontend-api.h || { echo "ERROR: check if the sed commands are needed from now."; exit 1; }
|
egrep '#include <obs.h>' /usr/include/obs/obs-frontend-api.h || { echo "ERROR: check if the sed commands are needed from now."; exit 1; }
|
||||||
sudo sed -i 's/#include <obs.h>/#include <obs\/obs.h>/' /usr/include/obs/obs-frontend-api.h
|
sudo sed -i 's/#include <obs.h>/#include <obs\/obs.h>/' /usr/include/obs/obs-frontend-api.h
|
||||||
sudo sed -i 's/#include <util\/darray.h>/#include <obs\/util\/darray.h>/' /usr/include/obs/obs-frontend-api.h
|
sudo sed -i 's/#include <util\/darray.h>/#include <obs\/util\/darray.h>/' /usr/include/obs/obs-frontend-api.h
|
||||||
- name: create_tarball
|
- name: create_tarball
|
||||||
run: |
|
run: |
|
||||||
cd ..
|
cd ..
|
||||||
tar --exclude=.git -cvzf obs-scene-switcher_0.1+testonly.orig.tar.gz SceneSwitcher
|
tar --exclude=.git -cvzf obs-scene-switcher_0.1+testonly.orig.tar.gz SceneSwitcher
|
||||||
- name: create_debian_dir
|
- name: create_debian_dir
|
||||||
run: |
|
run: |
|
||||||
cp -a CI/linux/debian .
|
cp -a CI/linux/debian .
|
||||||
- name: install_dependencies
|
- name: install_dependencies
|
||||||
run: |
|
run: |
|
||||||
# devscripts and libobs-dev are needed but they were already installed
|
# devscripts and libobs-dev are needed but they were already installed
|
||||||
# from check_libobs_revision and install_frontend_header sections.
|
# from check_libobs_revision and install_frontend_header sections.
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install cmake debhelper libcurl4-openssl-dev libxss-dev libxtst-dev qtbase5-dev libopencv-dev libprocps-dev
|
sudo apt install cmake debhelper libcurl4-openssl-dev libxss-dev libxtst-dev qtbase5-dev libopencv-dev libprocps-dev
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
debuild --no-lintian --no-sign
|
debuild --no-lintian --no-sign
|
||||||
|
mv ../*.deb .
|
||||||
|
- name: Publish
|
||||||
|
if: success()
|
||||||
|
uses: actions/upload-artifact@v2.2.1
|
||||||
|
with:
|
||||||
|
name: "obs-scene-switcher.deb"
|
||||||
|
path: ${{ github.workspace }}/*.deb
|
||||||
|
|||||||
100
.github/workflows/build.yml
vendored
100
.github/workflows/build.yml
vendored
@@ -12,25 +12,25 @@ jobs:
|
|||||||
name: "macOS 64-bit"
|
name: "macOS 64-bit"
|
||||||
runs-on: [macos-latest]
|
runs-on: [macos-latest]
|
||||||
env:
|
env:
|
||||||
QT_VERSION: '5.15.2'
|
QT_VERSION: "5.15.2"
|
||||||
MACOS_DEPS_VERSION: '2020-12-11'
|
MACOS_DEPS_VERSION: "2020-12-11"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
with:
|
with:
|
||||||
repository: obsproject/obs-studio
|
repository: obsproject/obs-studio
|
||||||
submodules: 'recursive'
|
submodules: "recursive"
|
||||||
ref: 'refs/tags/${{ env.OBS_TAG }}'
|
ref: "refs/tags/${{ env.OBS_TAG }}"
|
||||||
- name: "Checkout plugin"
|
- name: "Checkout plugin"
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
with:
|
with:
|
||||||
path: UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
path: UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
||||||
submodules: 'recursive'
|
submodules: "recursive"
|
||||||
- name: Fetch Git Tags
|
- name: Fetch Git Tags
|
||||||
run: |
|
run: |
|
||||||
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
||||||
git fetch --prune --tags --unshallow
|
git fetch --prune --tags --unshallow
|
||||||
- name: 'Install prerequisites (Homebrew)'
|
- name: "Install prerequisites (Homebrew)"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [ -d /usr/local/opt/openssl@1.0.2t ]; then
|
if [ -d /usr/local/opt/openssl@1.0.2t ]; then
|
||||||
@@ -42,20 +42,20 @@ jobs:
|
|||||||
brew untap local/python2
|
brew untap local/python2
|
||||||
fi
|
fi
|
||||||
brew bundle --file ./CI/scripts/macos/Brewfile
|
brew bundle --file ./CI/scripts/macos/Brewfile
|
||||||
- name: 'Install prerequisite: Pre-built dependencies'
|
- name: "Install prerequisite: Pre-built dependencies"
|
||||||
if: steps.deps-cache.outputs.cache-hit != 'true'
|
if: steps.deps-cache.outputs.cache-hit != 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
curl -L -O https://github.com/obsproject/obs-deps/releases/download/${{ env.MACOS_DEPS_VERSION }}/macos-deps-${{ env.MACOS_DEPS_VERSION }}.tar.gz
|
curl -L -O https://github.com/obsproject/obs-deps/releases/download/${{ env.MACOS_DEPS_VERSION }}/macos-deps-${{ env.MACOS_DEPS_VERSION }}.tar.gz
|
||||||
tar -xf ./macos-deps-${{ env.MACOS_DEPS_VERSION }}.tar.gz -C "/tmp"
|
tar -xf ./macos-deps-${{ env.MACOS_DEPS_VERSION }}.tar.gz -C "/tmp"
|
||||||
- name: 'Install prerequisite: Pre-built dependency Qt'
|
- name: "Install prerequisite: Pre-built dependency Qt"
|
||||||
if: steps.deps-qt-cache.outputs.cache-hit != 'true'
|
if: steps.deps-qt-cache.outputs.cache-hit != 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
curl -L -O https://github.com/obsproject/obs-deps/releases/download/${{ env.MACOS_DEPS_VERSION }}/macos-qt-${{ env.QT_VERSION }}-${{ env.MACOS_DEPS_VERSION }}.tar.gz
|
curl -L -O https://github.com/obsproject/obs-deps/releases/download/${{ env.MACOS_DEPS_VERSION }}/macos-qt-${{ env.QT_VERSION }}-${{ env.MACOS_DEPS_VERSION }}.tar.gz
|
||||||
tar -xf ./macos-qt-${{ env.QT_VERSION }}-${{ env.MACOS_DEPS_VERSION }}.tar.gz -C "/tmp"
|
tar -xf ./macos-qt-${{ env.QT_VERSION }}-${{ env.MACOS_DEPS_VERSION }}.tar.gz -C "/tmp"
|
||||||
xattr -r -d com.apple.quarantine /tmp/obsdeps
|
xattr -r -d com.apple.quarantine /tmp/obsdeps
|
||||||
- name: 'Build prerequisite: OpenCV'
|
- name: "Build prerequisite: OpenCV"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}/deps/opencv
|
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}/deps/opencv
|
||||||
@@ -79,7 +79,7 @@ jobs:
|
|||||||
cd ./build
|
cd ./build
|
||||||
make -j4
|
make -j4
|
||||||
cd -
|
cd -
|
||||||
- name: 'Install prerequisite: Packages app'
|
- name: "Install prerequisite: Packages app"
|
||||||
if: success()
|
if: success()
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -90,12 +90,16 @@ jobs:
|
|||||||
if: success()
|
if: success()
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
fix_linker_paths() {
|
||||||
|
install_name_tool -change @rpath/libobs-frontend-api.dylib @executable_path/../Frameworks/libobs-frontend-api.dylib $1
|
||||||
|
install_name_tool -change @rpath/libobs.0.dylib @executable_path/../Frameworks/libobs.0.dylib $1
|
||||||
|
install_name_tool -change /tmp/obsdeps/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets $1
|
||||||
|
install_name_tool -change /tmp/obsdeps/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui $1
|
||||||
|
install_name_tool -change /tmp/obsdeps/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore $1
|
||||||
|
}
|
||||||
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
||||||
install_name_tool -change @rpath/libobs-frontend-api.dylib @executable_path/../Frameworks/libobs-frontend-api.dylib ../../../build/UI/frontend-plugins/SceneSwitcher/advanced-scene-switcher.so
|
fix_linker_paths ../../../build/UI/frontend-plugins/SceneSwitcher/advanced-scene-switcher.so
|
||||||
install_name_tool -change @rpath/libobs.0.dylib @executable_path/../Frameworks/libobs.0.dylib ../../../build/UI/frontend-plugins/SceneSwitcher/advanced-scene-switcher.so
|
fix_linker_paths ../../../build/UI/frontend-plugins/SceneSwitcher/src/external-macro-modules/opencv/advanced-scene-switcher-opencv.so
|
||||||
install_name_tool -change /tmp/obsdeps/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets ../../../build/UI/frontend-plugins/SceneSwitcher/advanced-scene-switcher.so
|
|
||||||
install_name_tool -change /tmp/obsdeps/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui ../../../build/UI/frontend-plugins/SceneSwitcher/advanced-scene-switcher.so
|
|
||||||
install_name_tool -change /tmp/obsdeps/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore ../../../build/UI/frontend-plugins/SceneSwitcher/advanced-scene-switcher.so
|
|
||||||
FILE_DATE=$(date +%Y-%m-%d)
|
FILE_DATE=$(date +%Y-%m-%d)
|
||||||
FILE_NAME=${{ env.PLUGIN_NAME }}-$FILE_DATE-${{ github.sha }}-macos.pkg
|
FILE_NAME=${{ env.PLUGIN_NAME }}-$FILE_DATE-${{ github.sha }}-macos.pkg
|
||||||
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV
|
echo "FILE_NAME=${FILE_NAME}" >> $GITHUB_ENV
|
||||||
@@ -107,23 +111,23 @@ jobs:
|
|||||||
if: success()
|
if: success()
|
||||||
uses: actions/upload-artifact@v2.2.1
|
uses: actions/upload-artifact@v2.2.1
|
||||||
with:
|
with:
|
||||||
name: '${{ env.FILE_NAME }}'
|
name: "${{ env.FILE_NAME }}"
|
||||||
path: ./nightly/*.pkg
|
path: ./nightly/*.pkg
|
||||||
ubuntu64:
|
ubuntu64:
|
||||||
name: 'Linux/Ubuntu 64-bit'
|
name: "Linux/Ubuntu 64-bit"
|
||||||
runs-on: [ubuntu-latest]
|
runs-on: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
with:
|
with:
|
||||||
repository: obsproject/obs-studio
|
repository: obsproject/obs-studio
|
||||||
submodules: 'recursive'
|
submodules: "recursive"
|
||||||
ref: 'refs/tags/${{ env.OBS_TAG }}'
|
ref: "refs/tags/${{ env.OBS_TAG }}"
|
||||||
- name: "Checkout plugin"
|
- name: "Checkout plugin"
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
with:
|
with:
|
||||||
path: UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
path: UI/frontend-plugins/${{ env.PLUGIN_NAME }}
|
||||||
submodules: 'recursive'
|
submodules: "recursive"
|
||||||
- name: Add plugin to obs cmake
|
- name: Add plugin to obs cmake
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "add_subdirectory(${{ env.PLUGIN_NAME }})" >> UI/frontend-plugins/CMakeLists.txt
|
run: echo "add_subdirectory(${{ env.PLUGIN_NAME }})" >> UI/frontend-plugins/CMakeLists.txt
|
||||||
@@ -181,17 +185,17 @@ jobs:
|
|||||||
libxcb-xfixes0-dev \
|
libxcb-xfixes0-dev \
|
||||||
libopencv-dev \
|
libopencv-dev \
|
||||||
libprocps-dev
|
libprocps-dev
|
||||||
- name: 'Configure'
|
- name: "Configure"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir ./build
|
mkdir ./build
|
||||||
cd ./build
|
cd ./build
|
||||||
cmake -DENABLE_PIPEWIRE=OFF -DUNIX_STRUCTURE=0 -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/obs-studio-portable" -DWITH_RTMPS=OFF -DBUILD_BROWSER=OFF ..
|
cmake -DENABLE_PIPEWIRE=OFF -DUNIX_STRUCTURE=0 -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/obs-studio-portable" -DWITH_RTMPS=OFF -DBUILD_BROWSER=OFF ..
|
||||||
- name: 'Build'
|
- name: "Build"
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{ github.workspace }}/build
|
working-directory: ${{ github.workspace }}/build
|
||||||
run: make -j4
|
run: make -j4
|
||||||
- name: 'Package'
|
- name: "Package"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
FILE_DATE=$(date +%Y-%m-%d)
|
FILE_DATE=$(date +%Y-%m-%d)
|
||||||
@@ -201,12 +205,16 @@ jobs:
|
|||||||
strip -d ./build/UI/frontend-plugins/${{ env.PLUGIN_NAME }}/${{ env.LIB_NAME }}.so
|
strip -d ./build/UI/frontend-plugins/${{ env.PLUGIN_NAME }}/${{ env.LIB_NAME }}.so
|
||||||
mv ./build/UI/frontend-plugins/${{ env.PLUGIN_NAME }}/${{ env.LIB_NAME }}.so ./${{ env.LIB_NAME }}/bin/64bit/${{ env.LIB_NAME }}.so
|
mv ./build/UI/frontend-plugins/${{ env.PLUGIN_NAME }}/${{ env.LIB_NAME }}.so ./${{ env.LIB_NAME }}/bin/64bit/${{ env.LIB_NAME }}.so
|
||||||
mv ./UI/frontend-plugins/${{ env.PLUGIN_NAME }}/data ./${{ env.LIB_NAME }}/data
|
mv ./UI/frontend-plugins/${{ env.PLUGIN_NAME }}/data ./${{ env.LIB_NAME }}/data
|
||||||
|
# Macro modules
|
||||||
|
mkdir -p ./${{ env.LIB_NAME }}/bin/64bit/adv-ss-plugins
|
||||||
|
strip -d ./build/UI/frontend-plugins/${{ env.PLUGIN_NAME }}/src/external-macro-modules/opencv/advanced-scene-switcher-opencv.so
|
||||||
|
mv ./build/UI/frontend-plugins/${{ env.PLUGIN_NAME }}/src/external-macro-modules/opencv/advanced-scene-switcher-opencv.so ./${{ env.LIB_NAME }}/bin/64bit/adv-ss-plugins
|
||||||
tar -cvzf "${FILE_NAME}" ${{ env.LIB_NAME }}
|
tar -cvzf "${FILE_NAME}" ${{ env.LIB_NAME }}
|
||||||
- name: 'Publish'
|
- name: "Publish"
|
||||||
uses: actions/upload-artifact@v2.2.1
|
uses: actions/upload-artifact@v2.2.1
|
||||||
with:
|
with:
|
||||||
name: '${{ env.FILE_NAME }}'
|
name: "${{ env.FILE_NAME }}"
|
||||||
path: '*.tar.gz'
|
path: "*.tar.gz"
|
||||||
windows:
|
windows:
|
||||||
name: Windows
|
name: Windows
|
||||||
runs-on: [windows-latest]
|
runs-on: [windows-latest]
|
||||||
@@ -214,10 +222,10 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
arch: [32, 64]
|
arch: [32, 64]
|
||||||
env:
|
env:
|
||||||
QT_VERSION: 5.10.1
|
QT_VERSION: 5.15.2
|
||||||
CMAKE_GENERATOR: "Visual Studio 16 2019"
|
CMAKE_GENERATOR: "Visual Studio 16 2019"
|
||||||
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
|
CMAKE_SYSTEM_VERSION: "10.0.18363.657"
|
||||||
WINDOWS_DEPS_VERSION: '2019'
|
WINDOWS_DEPS_VERSION: "2019"
|
||||||
steps:
|
steps:
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
uses: microsoft/setup-msbuild@v1.0.2
|
||||||
@@ -225,27 +233,27 @@ jobs:
|
|||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
with:
|
with:
|
||||||
repository: obsproject/obs-studio
|
repository: obsproject/obs-studio
|
||||||
submodules: 'recursive'
|
submodules: "recursive"
|
||||||
ref: 'refs/tags/${{ env.OBS_TAG }}'
|
ref: "refs/tags/${{ env.OBS_TAG }}"
|
||||||
- name: Checkout plugin
|
- name: Checkout plugin
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
with:
|
with:
|
||||||
path: UI/frontend-plugins/${{ env.PLUGIN_NAME}}
|
path: UI/frontend-plugins/${{ env.PLUGIN_NAME}}
|
||||||
submodules: 'recursive'
|
submodules: "recursive"
|
||||||
- name: Add plugin to obs cmake
|
- name: Add plugin to obs cmake
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: echo add_subdirectory(${{ env.PLUGIN_NAME }}) >> UI/frontend-plugins/CMakeLists.txt
|
run: echo add_subdirectory(${{ env.PLUGIN_NAME }}) >> UI/frontend-plugins/CMakeLists.txt
|
||||||
- name: Fetch Git Tags
|
- name: Fetch Git Tags
|
||||||
run: git fetch --prune --tags --unshallow
|
run: git fetch --prune --tags --unshallow
|
||||||
- name: 'Install prerequisite: QT'
|
- name: "Install prerequisite: QT"
|
||||||
run: |
|
run: |
|
||||||
curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_${{ env.QT_VERSION }}.7z -f --retry 5 -C -
|
curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_${{ env.QT_VERSION }}.7z -f --retry 5 -C -
|
||||||
7z x Qt_${{ env.QT_VERSION }}.7z -o"${{ github.workspace }}/cmbuild/QT"
|
7z x Qt_${{ env.QT_VERSION }}.7z -o"${{ github.workspace }}/cmbuild/QT"
|
||||||
- name: 'Install prerequisite: Pre-built dependencies'
|
- name: "Install prerequisite: Pre-built dependencies"
|
||||||
run: |
|
run: |
|
||||||
curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -f --retry 5 -C -
|
curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -f --retry 5 -C -
|
||||||
7z x dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -o"${{ github.workspace }}/cmbuild/deps"
|
7z x dependencies${{ env.WINDOWS_DEPS_VERSION }}.zip -o"${{ github.workspace }}/cmbuild/deps"
|
||||||
- name: 'Build prerequisite: OpenCV'
|
- name: "Build prerequisite: OpenCV"
|
||||||
run: |
|
run: |
|
||||||
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}/deps/opencv
|
cd UI/frontend-plugins/${{ env.PLUGIN_NAME }}/deps/opencv
|
||||||
mkdir build
|
mkdir build
|
||||||
@@ -268,11 +276,11 @@ jobs:
|
|||||||
Get-Location
|
Get-Location
|
||||||
if ( ${{ matrix.arch }} -eq 32 )
|
if ( ${{ matrix.arch }} -eq 32 )
|
||||||
{
|
{
|
||||||
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"Win32" -DOpenCV_DIR="${{ github.workspace }}/UI/frontend-plugins/SceneSwitcher/deps/opencv/build/" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=false -DBUILD_CAPTIONS=false -DCOMPILE_D3D12_HOOK=false -DDepsPath="${{ github.workspace }}/cmbuild/deps/win32" -DQTDIR="${{ github.workspace }}/cmbuild/QT/${{ env.QT_VERSION }}/msvc2017" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
|
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"Win32" -DOpenCV_DIR="${{ github.workspace }}/UI/frontend-plugins/SceneSwitcher/deps/opencv/build/" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=false -DBUILD_CAPTIONS=false -DCOMPILE_D3D12_HOOK=false -DDepsPath="${{ github.workspace }}/cmbuild/deps/win32" -DQTDIR="${{ github.workspace }}/cmbuild/QT/${{ env.QT_VERSION }}/msvc2019" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"x64" -DOpenCV_DIR="${{ github.workspace }}/UI/frontend-plugins/SceneSwitcher/deps/opencv/build/" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=false -DBUILD_CAPTIONS=false -DCOMPILE_D3D12_HOOK=false -DDepsPath="${{ github.workspace }}/cmbuild/deps/win64" -DQTDIR="${{ github.workspace }}/cmbuild/QT/${{ env.QT_VERSION }}/msvc2017_64" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
|
cmake -G"${{ env.CMAKE_GENERATOR }}" -A"x64" -DOpenCV_DIR="${{ github.workspace }}/UI/frontend-plugins/SceneSwitcher/deps/opencv/build/" -DCMAKE_SYSTEM_VERSION="${{ env.CMAKE_SYSTEM_VERSION }}" -DBUILD_BROWSER=false -DBUILD_CAPTIONS=false -DCOMPILE_D3D12_HOOK=false -DDepsPath="${{ github.workspace }}/cmbuild/deps/win64" -DQTDIR="${{ github.workspace }}/cmbuild/QT/${{ env.QT_VERSION }}/msvc2019_64" -DCOPIED_DEPENDENCIES=FALSE -DCOPY_DEPENDENCIES=TRUE ..
|
||||||
}
|
}
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
@@ -283,19 +291,21 @@ jobs:
|
|||||||
$env:FILE_DATE=(Get-Date -UFormat "%F")
|
$env:FILE_DATE=(Get-Date -UFormat "%F")
|
||||||
$env:FILE_NAME="${{ env.PLUGIN_NAME }}-${env:FILE_DATE}-${{ github.sha }}-windows"
|
$env:FILE_NAME="${{ env.PLUGIN_NAME }}-${env:FILE_DATE}-${{ github.sha }}-windows"
|
||||||
echo "FILE_NAME=${env:FILE_NAME}" >> ${env:GITHUB_ENV}
|
echo "FILE_NAME=${env:FILE_NAME}" >> ${env:GITHUB_ENV}
|
||||||
robocopy .\build${{ matrix.arch }}\rundir\RelWithDebInfo\obs-plugins\${{ matrix.arch }}bit\ .\package\obs-plugins\${{ matrix.arch }}bit ${{ env.LIB_NAME }}.* /E /XF .gitignore
|
robocopy .\build${{ matrix.arch }}\rundir\RelWithDebInfo\obs-plugins\${{ matrix.arch }}bit\ .\package\obs-plugins\${{ matrix.arch }}bit ${{ env.LIB_NAME }}* /E /XF .gitignore
|
||||||
|
robocopy .\build${{ matrix.arch }}\rundir\RelWithDebInfo\obs-plugins\${{ matrix.arch }}bit\ .\package\obs-plugins\${{ matrix.arch }}bit adv-ss-plugins /E /XF .gitignore
|
||||||
robocopy .\build${{ matrix.arch }}\rundir\RelWithDebInfo\data\obs-plugins\${{ env.LIB_NAME }}\ .\package\data\obs-plugins\${{ env.LIB_NAME }}\ /E /XF .gitignore
|
robocopy .\build${{ matrix.arch }}\rundir\RelWithDebInfo\data\obs-plugins\${{ env.LIB_NAME }}\ .\package\data\obs-plugins\${{ env.LIB_NAME }}\ /E /XF .gitignore
|
||||||
cp UI/frontend-plugins/${{ env.PLUGIN_NAME }}/deps/opencv/build/bin/Release/*dll package/obs-plugins/${{ matrix.arch }}bit
|
cp UI/frontend-plugins/${{ env.PLUGIN_NAME }}/deps/opencv/build/bin/Release/*dll package/obs-plugins/${{ matrix.arch }}bit/adv-ss-plugins
|
||||||
|
cp UI/frontend-plugins/${{ env.PLUGIN_NAME }}/deps/openvr/bin/win${{ matrix.arch }}/*dll package/obs-plugins/${{ matrix.arch }}bit/adv-ss-plugins
|
||||||
exit 0
|
exit 0
|
||||||
- name: Publish zip
|
- name: Publish zip
|
||||||
if: success()
|
if: success()
|
||||||
uses: actions/upload-artifact@v2.2.1
|
uses: actions/upload-artifact@v2.2.1
|
||||||
with:
|
with:
|
||||||
name: '${{ env.FILE_NAME }}-${{ matrix.arch }}bit'
|
name: "${{ env.FILE_NAME }}-${{ matrix.arch }}bit"
|
||||||
path: package/*
|
path: package/*
|
||||||
windows-installer:
|
windows-installer:
|
||||||
needs: [windows]
|
needs: [windows]
|
||||||
name: 'Create Windows Installer'
|
name: "Create Windows Installer"
|
||||||
runs-on: [windows-latest]
|
runs-on: [windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout plugin"
|
- name: "Checkout plugin"
|
||||||
@@ -332,12 +342,12 @@ jobs:
|
|||||||
if: success()
|
if: success()
|
||||||
uses: actions/upload-artifact@v2.2.0
|
uses: actions/upload-artifact@v2.2.0
|
||||||
with:
|
with:
|
||||||
name: '${{ env.FILE_NAME }}-installer'
|
name: "${{ env.FILE_NAME }}-installer"
|
||||||
path: build/CI/windows/Output/*.exe
|
path: build/CI/windows/Output/*.exe
|
||||||
release:
|
release:
|
||||||
needs: [macos64, ubuntu64, windows, windows-installer]
|
needs: [macos64, ubuntu64, windows, windows-installer]
|
||||||
name: 'Create Release'
|
name: "Create Release"
|
||||||
runs-on: [ubuntu-18.04]
|
runs-on: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout plugin"
|
- name: "Checkout plugin"
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
@@ -347,7 +357,7 @@ jobs:
|
|||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts
|
||||||
- name: 'Package'
|
- name: "Package"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${{ env.PLUGIN_NAME }}/Linux ${{ env.PLUGIN_NAME }}/MacOs ${{ env.PLUGIN_NAME }}/Windows
|
mkdir -p ${{ env.PLUGIN_NAME }}/Linux ${{ env.PLUGIN_NAME }}/MacOs ${{ env.PLUGIN_NAME }}/Windows
|
||||||
@@ -366,4 +376,4 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v2.2.1
|
uses: actions/upload-artifact@v2.2.1
|
||||||
with:
|
with:
|
||||||
name: "Release"
|
name: "Release"
|
||||||
path: '*.zip'
|
path: "*.zip"
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -7,3 +7,6 @@
|
|||||||
[submodule "deps/opencv"]
|
[submodule "deps/opencv"]
|
||||||
path = deps/opencv
|
path = deps/opencv
|
||||||
url = https://github.com/opencv/opencv.git
|
url = https://github.com/opencv/opencv.git
|
||||||
|
[submodule "deps/openvr"]
|
||||||
|
path = deps/openvr
|
||||||
|
url = https://github.com/ValveSoftware/openvr.git
|
||||||
|
|||||||
@@ -30,6 +30,327 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>CHILDREN</key>
|
<key>CHILDREN</key>
|
||||||
<array>
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../../../../build/UI/frontend-plugins/SceneSwitcher/src/external-macro-modules/opencv/advanced-scene-switcher-opencv.so</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_objdetect.4.5.3.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_features2d.4.5.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_core.4.5.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_calib3d.4.5.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_calib3d.4.5.3.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_imgproc.4.5.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_features2d.4.5.3.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_core.4.5.3.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_flann.4.5.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_calib3d.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_objdetect.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_imgproc.4.5.3.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_flann.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_imgproc.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_flann.4.5.3.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_features2d.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_core.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CHILDREN</key>
|
||||||
|
<array/>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>../../deps/opencv/build/lib/libopencv_objdetect.4.5.dylib</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>3</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>GID</key>
|
||||||
|
<integer>80</integer>
|
||||||
|
<key>PATH</key>
|
||||||
|
<string>adv-ss-plugins</string>
|
||||||
|
<key>PATH_TYPE</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>PERMISSIONS</key>
|
||||||
|
<integer>493</integer>
|
||||||
|
<key>TYPE</key>
|
||||||
|
<integer>2</integer>
|
||||||
|
<key>UID</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>CHILDREN</key>
|
<key>CHILDREN</key>
|
||||||
<array/>
|
<array/>
|
||||||
@@ -46,294 +367,6 @@
|
|||||||
<key>UID</key>
|
<key>UID</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_objdetect.4.5.3.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_features2d.4.5.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_core.4.5.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_calib3d.4.5.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_calib3d.4.5.3.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_imgproc.4.5.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_features2d.4.5.3.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_core.4.5.3.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_flann.4.5.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_calib3d.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_objdetect.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_imgproc.4.5.3.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_flann.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_imgproc.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_flann.4.5.3.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_features2d.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_core.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
<dict>
|
|
||||||
<key>CHILDREN</key>
|
|
||||||
<array/>
|
|
||||||
<key>GID</key>
|
|
||||||
<integer>80</integer>
|
|
||||||
<key>PATH</key>
|
|
||||||
<string>../../deps/opencv/build/lib/libopencv_objdetect.4.5.dylib</string>
|
|
||||||
<key>PATH_TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>PERMISSIONS</key>
|
|
||||||
<integer>493</integer>
|
|
||||||
<key>TYPE</key>
|
|
||||||
<integer>3</integer>
|
|
||||||
<key>UID</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
</array>
|
</array>
|
||||||
<key>GID</key>
|
<key>GID</key>
|
||||||
<integer>80</integer>
|
<integer>80</integer>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ AppVersion={#MyAppVersion}
|
|||||||
AppPublisherURL={#MyAppURL}
|
AppPublisherURL={#MyAppURL}
|
||||||
AppSupportURL={#MyAppURL}
|
AppSupportURL={#MyAppURL}
|
||||||
AppUpdatesURL={#MyAppURL}
|
AppUpdatesURL={#MyAppURL}
|
||||||
DefaultDirName={code:GetDirName}
|
DefaultDirName={code:GetDefaultDirectory}
|
||||||
DefaultGroupName={#MyAppName}
|
DefaultGroupName={#MyAppName}
|
||||||
AllowNoIcons=yes
|
AllowNoIcons=yes
|
||||||
; Uncomment the following line to run in non administrative install mode (install for current user only.)
|
; Uncomment the following line to run in non administrative install mode (install for current user only.)
|
||||||
@@ -38,18 +38,18 @@ Source: "@ISS_PLUGIN_FILES_DIR@\*"; DestDir: "{app}"; Flags: ignoreversion recur
|
|||||||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
// credit where it's due:
|
function GetDefaultDirectory(Value: String): String;
|
||||||
// following function comes from https://github.com/Xaymar/obs-studio_amf-encoder-plugin/blob/master/%23Resources/Installer.in.iss#L45
|
|
||||||
function GetDirName(Value: string): string;
|
|
||||||
var
|
var
|
||||||
InstallPath: string;
|
sInstallPath: String;
|
||||||
begin
|
begin
|
||||||
// initialize default path, which will be returned when the following registry
|
sInstallPath := Value;
|
||||||
// key queries fail due to missing keys or for some different reason
|
if (sInstallPath = '') then
|
||||||
Result := ExpandConstant('{pf}\obs-studio');
|
RegQueryStringValue(HKLM64, 'SOFTWARE\OBS Studio', '', sInstallPath);
|
||||||
// query the first registry value; if this succeeds, return the obtained value
|
if (sInstallPath = '') then
|
||||||
if RegQueryStringValue(HKLM32, 'SOFTWARE\OBS Studio', '', InstallPath) then
|
RegQueryStringValue(HKCU64, 'SOFTWARE\OBS Studio', '', sInstallPath);
|
||||||
Result := InstallPath
|
if (sInstallPath = '') then
|
||||||
|
sInstallPath := ExpandConstant('{commonpf}\obs-studio');
|
||||||
|
Result := sInstallPath
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CurStepChanged(CurStep: TSetupStep);
|
procedure CurStepChanged(CurStep: TSetupStep);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ endif()
|
|||||||
# Compiler settings
|
# Compiler settings
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||||
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC
|
if(CMAKE_COMPILER_IS_GNUCC
|
||||||
OR CMAKE_COMPILER_IS_GNUCXX
|
OR CMAKE_COMPILER_IS_GNUCXX
|
||||||
@@ -110,6 +111,7 @@ endif()
|
|||||||
|
|
||||||
# Platform specific settings
|
# Platform specific settings
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
|
||||||
find_library(COCOA Cocoa)
|
find_library(COCOA Cocoa)
|
||||||
if(BUILD_OUT_OF_TREE)
|
if(BUILD_OUT_OF_TREE)
|
||||||
find_package(Qt5MacExtras REQUIRED)
|
find_package(Qt5MacExtras REQUIRED)
|
||||||
@@ -197,16 +199,19 @@ set(advanced-scene-switcher_HEADERS
|
|||||||
src/headers/macro-action-media.hpp
|
src/headers/macro-action-media.hpp
|
||||||
src/headers/macro-action-plugin-state.hpp
|
src/headers/macro-action-plugin-state.hpp
|
||||||
src/headers/macro-action-preview-scene.hpp
|
src/headers/macro-action-preview-scene.hpp
|
||||||
|
src/headers/macro-action-profile.hpp
|
||||||
src/headers/macro-action-random.hpp
|
src/headers/macro-action-random.hpp
|
||||||
src/headers/macro-action-recording.hpp
|
src/headers/macro-action-recording.hpp
|
||||||
src/headers/macro-action-replay-buffer.hpp
|
src/headers/macro-action-replay-buffer.hpp
|
||||||
src/headers/macro-action-run.hpp
|
src/headers/macro-action-run.hpp
|
||||||
|
src/headers/macro-action-scene-collection.hpp
|
||||||
src/headers/macro-action-scene-order.hpp
|
src/headers/macro-action-scene-order.hpp
|
||||||
src/headers/macro-action-scene-swap.hpp
|
src/headers/macro-action-scene-swap.hpp
|
||||||
src/headers/macro-action-scene-switch.hpp
|
src/headers/macro-action-scene-switch.hpp
|
||||||
src/headers/macro-action-scene-transform.hpp
|
src/headers/macro-action-scene-transform.hpp
|
||||||
src/headers/macro-action-scene-visibility.hpp
|
src/headers/macro-action-scene-visibility.hpp
|
||||||
src/headers/macro-action-screenshot.hpp
|
src/headers/macro-action-screenshot.hpp
|
||||||
|
src/headers/macro-action-sequence.hpp
|
||||||
src/headers/macro-action-source.hpp
|
src/headers/macro-action-source.hpp
|
||||||
src/headers/macro-action-streaming.hpp
|
src/headers/macro-action-streaming.hpp
|
||||||
src/headers/macro-action-systray.hpp
|
src/headers/macro-action-systray.hpp
|
||||||
@@ -234,9 +239,9 @@ set(advanced-scene-switcher_HEADERS
|
|||||||
src/headers/macro-condition-scene.hpp
|
src/headers/macro-condition-scene.hpp
|
||||||
src/headers/macro-condition-source.hpp
|
src/headers/macro-condition-source.hpp
|
||||||
src/headers/macro-condition-streaming.hpp
|
src/headers/macro-condition-streaming.hpp
|
||||||
|
src/headers/macro-condition-studio-mode.hpp
|
||||||
src/headers/macro-condition-timer.hpp
|
src/headers/macro-condition-timer.hpp
|
||||||
src/headers/macro-condition-transition.hpp
|
src/headers/macro-condition-transition.hpp
|
||||||
src/headers/macro-condition-video.hpp
|
|
||||||
src/headers/macro-condition-virtual-cam.hpp
|
src/headers/macro-condition-virtual-cam.hpp
|
||||||
src/headers/macro-condition-window.hpp
|
src/headers/macro-condition-window.hpp
|
||||||
src/headers/macro.hpp
|
src/headers/macro.hpp
|
||||||
@@ -245,6 +250,7 @@ set(advanced-scene-switcher_HEADERS
|
|||||||
src/headers/macro-selection.hpp
|
src/headers/macro-selection.hpp
|
||||||
src/headers/curl-helper.hpp
|
src/headers/curl-helper.hpp
|
||||||
src/headers/hotkey.hpp
|
src/headers/hotkey.hpp
|
||||||
|
src/headers/scene-item-selection.hpp
|
||||||
src/headers/scene-selection.hpp
|
src/headers/scene-selection.hpp
|
||||||
src/headers/screenshot-helper.hpp
|
src/headers/screenshot-helper.hpp
|
||||||
src/headers/transition-selection.hpp
|
src/headers/transition-selection.hpp
|
||||||
@@ -252,6 +258,7 @@ set(advanced-scene-switcher_HEADERS
|
|||||||
src/headers/duration-control.hpp
|
src/headers/duration-control.hpp
|
||||||
src/headers/file-selection.hpp
|
src/headers/file-selection.hpp
|
||||||
src/headers/section.hpp
|
src/headers/section.hpp
|
||||||
|
src/headers/status-control.hpp
|
||||||
src/headers/platform-funcs.hpp
|
src/headers/platform-funcs.hpp
|
||||||
src/headers/utility.hpp
|
src/headers/utility.hpp
|
||||||
src/headers/volume-control.hpp
|
src/headers/volume-control.hpp
|
||||||
@@ -292,16 +299,19 @@ set(advanced-scene-switcher_SOURCES
|
|||||||
src/macro-action-media.cpp
|
src/macro-action-media.cpp
|
||||||
src/macro-action-plugin-state.cpp
|
src/macro-action-plugin-state.cpp
|
||||||
src/macro-action-preview-scene.cpp
|
src/macro-action-preview-scene.cpp
|
||||||
|
src/macro-action-profile.cpp
|
||||||
src/macro-action-random.cpp
|
src/macro-action-random.cpp
|
||||||
src/macro-action-recording.cpp
|
src/macro-action-recording.cpp
|
||||||
src/macro-action-replay-buffer.cpp
|
src/macro-action-replay-buffer.cpp
|
||||||
src/macro-action-run.cpp
|
src/macro-action-run.cpp
|
||||||
|
src/macro-action-scene-collection.cpp
|
||||||
src/macro-action-scene-order.cpp
|
src/macro-action-scene-order.cpp
|
||||||
src/macro-action-scene-swap.cpp
|
src/macro-action-scene-swap.cpp
|
||||||
src/macro-action-scene-switch.cpp
|
src/macro-action-scene-switch.cpp
|
||||||
src/macro-action-scene-transform.cpp
|
src/macro-action-scene-transform.cpp
|
||||||
src/macro-action-scene-visibility.cpp
|
src/macro-action-scene-visibility.cpp
|
||||||
src/macro-action-screenshot.cpp
|
src/macro-action-screenshot.cpp
|
||||||
|
src/macro-action-sequence.cpp
|
||||||
src/macro-action-source.cpp
|
src/macro-action-source.cpp
|
||||||
src/macro-action-streaming.cpp
|
src/macro-action-streaming.cpp
|
||||||
src/macro-action-systray.cpp
|
src/macro-action-systray.cpp
|
||||||
@@ -329,9 +339,9 @@ set(advanced-scene-switcher_SOURCES
|
|||||||
src/macro-condition-scene.cpp
|
src/macro-condition-scene.cpp
|
||||||
src/macro-condition-source.cpp
|
src/macro-condition-source.cpp
|
||||||
src/macro-condition-streaming.cpp
|
src/macro-condition-streaming.cpp
|
||||||
|
src/macro-condition-studio-mode.cpp
|
||||||
src/macro-condition-timer.cpp
|
src/macro-condition-timer.cpp
|
||||||
src/macro-condition-transition.cpp
|
src/macro-condition-transition.cpp
|
||||||
src/macro-condition-video.cpp
|
|
||||||
src/macro-condition-virtual-cam.cpp
|
src/macro-condition-virtual-cam.cpp
|
||||||
src/macro-condition-window.cpp
|
src/macro-condition-window.cpp
|
||||||
src/macro.cpp
|
src/macro.cpp
|
||||||
@@ -340,32 +350,18 @@ set(advanced-scene-switcher_SOURCES
|
|||||||
src/macro-selection.cpp
|
src/macro-selection.cpp
|
||||||
src/macro-tab.cpp
|
src/macro-tab.cpp
|
||||||
src/curl-helper.cpp
|
src/curl-helper.cpp
|
||||||
|
src/scene-item-selection.cpp
|
||||||
src/scene-selection.cpp
|
src/scene-selection.cpp
|
||||||
src/screenshot-helper.cpp
|
src/screenshot-helper.cpp
|
||||||
src/transition-selection.cpp
|
src/transition-selection.cpp
|
||||||
src/name-dialog.cpp
|
src/name-dialog.cpp
|
||||||
src/duration-control.cpp
|
src/duration-control.cpp
|
||||||
|
src/status-control.cpp
|
||||||
src/section.cpp
|
src/section.cpp
|
||||||
src/utility.cpp
|
src/utility.cpp
|
||||||
src/volume-control.cpp
|
src/volume-control.cpp
|
||||||
src/version.cpp)
|
src/version.cpp)
|
||||||
|
|
||||||
# opencv
|
|
||||||
find_package(OpenCV)
|
|
||||||
if(OpenCV_FOUND)
|
|
||||||
include_directories("${OpenCV_INCLUDE_DIRS}")
|
|
||||||
else()
|
|
||||||
set(OpenCV_LIBRARIES "")
|
|
||||||
message(
|
|
||||||
WARNING
|
|
||||||
"OpenCV not found! Functionality relying on OpenCV will be disabled!\nOpenCV sources are available under: ${CMAKE_CURRENT_SOURCE_DIR}/deps/opencv"
|
|
||||||
)
|
|
||||||
list(REMOVE_ITEM advanced-scene-switcher_SOURCES
|
|
||||||
src/macro-condition-video.cpp)
|
|
||||||
list(REMOVE_ITEM advanced-scene-switcher_HEADERS
|
|
||||||
src/headers/macro-condition-video.hpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Backwards compatability checks with older OBS versions
|
# Backwards compatability checks with older OBS versions
|
||||||
if(DEFINED LibObs_VERSION_MAJOR)
|
if(DEFINED LibObs_VERSION_MAJOR)
|
||||||
if(LibObs_VERSION_MAJOR GREATER_EQUAL 27)
|
if(LibObs_VERSION_MAJOR GREATER_EQUAL 27)
|
||||||
@@ -391,7 +387,7 @@ if(DEFINED LibObs_VERSION_MAJOR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(
|
add_library(
|
||||||
advanced-scene-switcher MODULE
|
advanced-scene-switcher SHARED
|
||||||
${advanced-scene-switcher_HEADERS}
|
${advanced-scene-switcher_HEADERS}
|
||||||
${advanced-scene-switcher_SOURCES}
|
${advanced-scene-switcher_SOURCES}
|
||||||
${advanced-scene-switcher_UI_HEADERS}
|
${advanced-scene-switcher_UI_HEADERS}
|
||||||
@@ -401,13 +397,8 @@ add_library(
|
|||||||
# Out of tree build
|
# Out of tree build
|
||||||
if(BUILD_OUT_OF_TREE)
|
if(BUILD_OUT_OF_TREE)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
advanced-scene-switcher
|
advanced-scene-switcher ${advanced-scene-switcher_PLATFORM_LIBS}
|
||||||
${advanced-scene-switcher_PLATFORM_LIBS}
|
${LIBOBS_LIB} ${LIBOBS_FRONTEND_API_LIB} Qt5::Core Qt5::Widgets)
|
||||||
${OpenCV_LIBRARIES}
|
|
||||||
${LIBOBS_LIB}
|
|
||||||
${LIBOBS_FRONTEND_API_LIB}
|
|
||||||
Qt5::Core
|
|
||||||
Qt5::Widgets)
|
|
||||||
|
|
||||||
# Additional commands to install the module in the correct place. Find all the
|
# Additional commands to install the module in the correct place. Find all the
|
||||||
# translation files so we can copy them to the correct place later on.
|
# translation files so we can copy them to the correct place later on.
|
||||||
@@ -438,6 +429,8 @@ else()
|
|||||||
# In tree build
|
# In tree build
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
advanced-scene-switcher ${advanced-scene-switcher_PLATFORM_LIBS}
|
advanced-scene-switcher ${advanced-scene-switcher_PLATFORM_LIBS}
|
||||||
${OpenCV_LIBRARIES} obs-frontend-api Qt5::Widgets libobs)
|
obs-frontend-api Qt5::Widgets libobs)
|
||||||
install_obs_plugin_with_data(advanced-scene-switcher data)
|
install_obs_plugin_with_data(advanced-scene-switcher data)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(src/external-macro-modules)
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ AdvSceneSwitcher.macroTab.name="Name:"
|
|||||||
AdvSceneSwitcher.macroTab.run="Run macro"
|
AdvSceneSwitcher.macroTab.run="Run macro"
|
||||||
AdvSceneSwitcher.macroTab.runFail="Running \"%1\" failed!\nEither one of the actions failed or the macro is running already."
|
AdvSceneSwitcher.macroTab.runFail="Running \"%1\" failed!\nEither one of the actions failed or the macro is running already."
|
||||||
AdvSceneSwitcher.macroTab.runInParallel="Run macro in parallel to other macros"
|
AdvSceneSwitcher.macroTab.runInParallel="Run macro in parallel to other macros"
|
||||||
|
AdvSceneSwitcher.macroTab.onChange="Perform actions only on condition change"
|
||||||
AdvSceneSwitcher.macroTab.defaultname="Macro %1"
|
AdvSceneSwitcher.macroTab.defaultname="Macro %1"
|
||||||
AdvSceneSwitcher.macroTab.exists="Macro name exists already"
|
AdvSceneSwitcher.macroTab.exists="Macro name exists already"
|
||||||
AdvSceneSwitcher.macroTab.copy="Create copy"
|
AdvSceneSwitcher.macroTab.copy="Create copy"
|
||||||
@@ -87,9 +88,14 @@ AdvSceneSwitcher.logic.not="If not"
|
|||||||
|
|
||||||
; Macro Conditions
|
; Macro Conditions
|
||||||
AdvSceneSwitcher.condition.audio="Audio"
|
AdvSceneSwitcher.condition.audio="Audio"
|
||||||
AdvSceneSwitcher.condition.audio.state.below="Below"
|
AdvSceneSwitcher.condition.audio.state.below="below"
|
||||||
AdvSceneSwitcher.condition.audio.state.above="Above"
|
AdvSceneSwitcher.condition.audio.state.exact="exactly"
|
||||||
AdvSceneSwitcher.condition.audio.entry="Volume of {{audioSources}} is {{condition}} {{volume}}"
|
AdvSceneSwitcher.condition.audio.state.above="above"
|
||||||
|
AdvSceneSwitcher.condition.audio.state.mute="muted"
|
||||||
|
AdvSceneSwitcher.condition.audio.state.unmute="unmuted"
|
||||||
|
AdvSceneSwitcher.condition.audio.type.output="Output volume"
|
||||||
|
AdvSceneSwitcher.condition.audio.type.volume="Configured volume level"
|
||||||
|
AdvSceneSwitcher.condition.audio.entry="{{checkType}} of {{audioSources}} is {{condition}} {{volume}}"
|
||||||
AdvSceneSwitcher.condition.cursor="Cursor"
|
AdvSceneSwitcher.condition.cursor="Cursor"
|
||||||
AdvSceneSwitcher.condition.cursor.type.region="is in region"
|
AdvSceneSwitcher.condition.cursor.type.region="is in region"
|
||||||
AdvSceneSwitcher.condition.cursor.type.moving="is moving"
|
AdvSceneSwitcher.condition.cursor.type.moving="is moving"
|
||||||
@@ -102,8 +108,9 @@ AdvSceneSwitcher.condition.scene.type.current="Current scene is"
|
|||||||
AdvSceneSwitcher.condition.scene.type.previous="Previous scene is"
|
AdvSceneSwitcher.condition.scene.type.previous="Previous scene is"
|
||||||
AdvSceneSwitcher.condition.scene.type.changed="Scene changed"
|
AdvSceneSwitcher.condition.scene.type.changed="Scene changed"
|
||||||
AdvSceneSwitcher.condition.scene.type.notChanged="Scene has not changed"
|
AdvSceneSwitcher.condition.scene.type.notChanged="Scene has not changed"
|
||||||
AdvSceneSwitcher.condition.scene.waitForTransition="Wait for transition to complete"
|
AdvSceneSwitcher.condition.scene.currentSceneTransitionBehaviour="During transition check for transition target scene"
|
||||||
AdvSceneSwitcher.condition.scene.entry="{{sceneType}} {{scenes}} {{waitForTransition}}"
|
AdvSceneSwitcher.condition.scene.entry.line1="{{sceneType}} {{scenes}}"
|
||||||
|
AdvSceneSwitcher.condition.scene.entry.line2="{{useTransitionTargetScene}}"
|
||||||
AdvSceneSwitcher.condition.window="Window"
|
AdvSceneSwitcher.condition.window="Window"
|
||||||
AdvSceneSwitcher.condition.window.entry.line1="{{windows}} exist and ..."
|
AdvSceneSwitcher.condition.window.entry.line1="{{windows}} exist and ..."
|
||||||
AdvSceneSwitcher.condition.window.entry.line2="... is {{fullscreen}} fullscreen {{maximized}} maximized {{focused}} focused {{windowFocusChanged}} foreground window changed"
|
AdvSceneSwitcher.condition.window.entry.line2="... is {{fullscreen}} fullscreen {{maximized}} maximized {{focused}} focused {{windowFocusChanged}} foreground window changed"
|
||||||
@@ -214,11 +221,12 @@ AdvSceneSwitcher.condition.sceneOrder.type.above="Is above"
|
|||||||
AdvSceneSwitcher.condition.sceneOrder.type.below="Is below"
|
AdvSceneSwitcher.condition.sceneOrder.type.below="Is below"
|
||||||
AdvSceneSwitcher.condition.sceneOrder.type.position="Is at position"
|
AdvSceneSwitcher.condition.sceneOrder.type.position="Is at position"
|
||||||
AdvSceneSwitcher.condition.sceneOrder.positionInfo="The position value starts at the bottom with 0 and increases by one for each scene item including the ones in scene groups"
|
AdvSceneSwitcher.condition.sceneOrder.positionInfo="The position value starts at the bottom with 0 and increases by one for each scene item including the ones in scene groups"
|
||||||
AdvSceneSwitcher.condition.sceneOrder.entry="On {{scenes}} {{sources}} {{conditions}} {{sources2}} {{position}}"
|
AdvSceneSwitcher.condition.sceneOrder.entry="On{{scenes}}{{sources}}{{conditions}}{{sources2}}{{position}}"
|
||||||
AdvSceneSwitcher.condition.hotkey="Hotkey"
|
AdvSceneSwitcher.condition.hotkey="Hotkey"
|
||||||
AdvSceneSwitcher.condition.hotkey.name="Macro trigger hotkey"
|
AdvSceneSwitcher.condition.hotkey.name="Macro trigger hotkey"
|
||||||
AdvSceneSwitcher.condition.hotkey.tip="Note: You can configure the keybindings for this hotkey in the OBS settings window"
|
AdvSceneSwitcher.condition.hotkey.tip="Note: You can configure the keybindings for this hotkey in the OBS settings window"
|
||||||
AdvSceneSwitcher.condition.hotkey.entry="Name: {{name}}"
|
AdvSceneSwitcher.condition.hotkey.entry.line1="Hotkey is pressed"
|
||||||
|
AdvSceneSwitcher.condition.hotkey.entry.line2="Name: {{name}}"
|
||||||
AdvSceneSwitcher.condition.replay="Replay buffer"
|
AdvSceneSwitcher.condition.replay="Replay buffer"
|
||||||
AdvSceneSwitcher.condition.replay.state.stopped="Replay buffer stopped"
|
AdvSceneSwitcher.condition.replay.state.stopped="Replay buffer stopped"
|
||||||
AdvSceneSwitcher.condition.replay.state.started="Replay buffer started"
|
AdvSceneSwitcher.condition.replay.state.started="Replay buffer started"
|
||||||
@@ -234,7 +242,7 @@ AdvSceneSwitcher.condition.date.entry.line2="{{repeat}} Repeat every {{duration}
|
|||||||
AdvSceneSwitcher.condition.sceneTransform="Scene item transform"
|
AdvSceneSwitcher.condition.sceneTransform="Scene item transform"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.getTransform="Get transform"
|
AdvSceneSwitcher.condition.sceneTransform.getTransform="Get transform"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.regex="Use regular expressions"
|
AdvSceneSwitcher.condition.sceneTransform.regex="Use regular expressions"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line1="On {{scenes}} {{sources}} matches transform"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line1="On{{scenes}}{{sources}}matches transform"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line2="{{settings}}"
|
||||||
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
AdvSceneSwitcher.condition.sceneTransform.entry.line3="{{regex}} {{getSettings}}"
|
||||||
AdvSceneSwitcher.condition.transition="Transition"
|
AdvSceneSwitcher.condition.transition="Transition"
|
||||||
@@ -249,11 +257,22 @@ AdvSceneSwitcher.condition.transition.entry="{{conditions}}{{transitions}}{{scen
|
|||||||
AdvSceneSwitcher.condition.sceneVisibility="Scene item visibility"
|
AdvSceneSwitcher.condition.sceneVisibility="Scene item visibility"
|
||||||
AdvSceneSwitcher.condition.sceneVisibility.type.shown="Shown"
|
AdvSceneSwitcher.condition.sceneVisibility.type.shown="Shown"
|
||||||
AdvSceneSwitcher.condition.sceneVisibility.type.hidden="Hidden"
|
AdvSceneSwitcher.condition.sceneVisibility.type.hidden="Hidden"
|
||||||
AdvSceneSwitcher.condition.sceneVisibility.entry="On {{scenes}} {{sources}} is {{conditions}} "
|
AdvSceneSwitcher.condition.sceneVisibility.entry="On{{scenes}}{{sources}}is{{conditions}}"
|
||||||
|
AdvSceneSwitcher.condition.studioMode="Studio mode"
|
||||||
|
AdvSceneSwitcher.condition.studioMode.state.active="Studio mode is active"
|
||||||
|
AdvSceneSwitcher.condition.studioMode.state.notActive="Studio mode is not active"
|
||||||
|
AdvSceneSwitcher.condition.studioMode.state.previewScene="Preview scene is"
|
||||||
|
AdvSceneSwitcher.condition.studioMode.entry="{{conditions}}{{scenes}}"
|
||||||
|
AdvSceneSwitcher.condition.openvr="OpenVR"
|
||||||
|
AdvSceneSwitcher.condition.errorStatus="OpenVR error: "
|
||||||
|
AdvSceneSwitcher.condition.openvr.entry.line1="HMD is in ..."
|
||||||
|
AdvSceneSwitcher.condition.openvr.entry.line2="{{controls}}"
|
||||||
|
AdvSceneSwitcher.condition.openvr.entry.line3="HMD is currently at {{xPos}} x {{yPos}} x {{zPos}}"
|
||||||
|
|
||||||
; Macro Actions
|
; Macro Actions
|
||||||
AdvSceneSwitcher.action.switchScene="Switch scene"
|
AdvSceneSwitcher.action.switchScene="Switch scene"
|
||||||
AdvSceneSwitcher.action.scene.entry="Switch to scene {{scenes}} using {{transitions}} with a duration of {{duration}} seconds"
|
AdvSceneSwitcher.action.scene.entry="Switch to scene {{scenes}} using {{transitions}} with a duration of {{duration}} seconds"
|
||||||
|
AdvSceneSwitcher.action.scene.blockUntilTransitionDone="Wait until transition to target scene is complete"
|
||||||
AdvSceneSwitcher.action.wait="Wait"
|
AdvSceneSwitcher.action.wait="Wait"
|
||||||
AdvSceneSwitcher.action.wait.type.fixed="fixed"
|
AdvSceneSwitcher.action.wait.type.fixed="fixed"
|
||||||
AdvSceneSwitcher.action.wait.type.random="random"
|
AdvSceneSwitcher.action.wait.type.random="random"
|
||||||
@@ -292,7 +311,7 @@ AdvSceneSwitcher.action.sceneVisibility.type.show="Show"
|
|||||||
AdvSceneSwitcher.action.sceneVisibility.type.hide="Hide"
|
AdvSceneSwitcher.action.sceneVisibility.type.hide="Hide"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.source="Source"
|
AdvSceneSwitcher.action.sceneVisibility.type.source="Source"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Any"
|
AdvSceneSwitcher.action.sceneVisibility.type.sourceGroup="Any"
|
||||||
AdvSceneSwitcher.action.sceneVisibility.entry="On {{scenes}} {{actions}} {{sourceTypes}} {{sources}}"
|
AdvSceneSwitcher.action.sceneVisibility.entry="On{{scenes}}{{actions}}{{sourceTypes}}{{sources}}{{sourceGroups}}"
|
||||||
AdvSceneSwitcher.action.filter="Filter"
|
AdvSceneSwitcher.action.filter="Filter"
|
||||||
AdvSceneSwitcher.action.filter.type.enable="Enable"
|
AdvSceneSwitcher.action.filter.type.enable="Enable"
|
||||||
AdvSceneSwitcher.action.filter.type.disable="Disable"
|
AdvSceneSwitcher.action.filter.type.disable="Disable"
|
||||||
@@ -319,11 +338,14 @@ AdvSceneSwitcher.action.macro.type.pause="Pause"
|
|||||||
AdvSceneSwitcher.action.macro.type.unpause="Unpause"
|
AdvSceneSwitcher.action.macro.type.unpause="Unpause"
|
||||||
AdvSceneSwitcher.action.macro.type.resetCounter="Reset counter"
|
AdvSceneSwitcher.action.macro.type.resetCounter="Reset counter"
|
||||||
AdvSceneSwitcher.action.macro.type.run="Run"
|
AdvSceneSwitcher.action.macro.type.run="Run"
|
||||||
|
AdvSceneSwitcher.action.macro.type.stop="Stop"
|
||||||
AdvSceneSwitcher.action.macro.entry="{{actions}} {{macros}}"
|
AdvSceneSwitcher.action.macro.entry="{{actions}} {{macros}}"
|
||||||
AdvSceneSwitcher.action.pluginState="Plugin state"
|
AdvSceneSwitcher.action.pluginState="Plugin state"
|
||||||
AdvSceneSwitcher.action.pluginState.type.stop="Stop the Advanced Scene Switcher plugin"
|
AdvSceneSwitcher.action.pluginState.type.stop="Stop the Advanced Scene Switcher plugin"
|
||||||
AdvSceneSwitcher.action.pluginState.type.noMatch="Change the no-match behaviour:"
|
AdvSceneSwitcher.action.pluginState.type.noMatch="Change the no-match behaviour:"
|
||||||
AdvSceneSwitcher.action.pluginState.entry="{{actions}} {{values}} {{scenes}}"
|
AdvSceneSwitcher.action.pluginState.type.import="Import settings from"
|
||||||
|
AdvSceneSwitcher.action.pluginState.importWarning="Note: Action will be ignored while settings window is opened."
|
||||||
|
AdvSceneSwitcher.action.pluginState.entry="{{actions}}{{values}}{{scenes}}{{settings}}{{settingsWarning}}"
|
||||||
AdvSceneSwitcher.action.virtualCamera="Virtual camera"
|
AdvSceneSwitcher.action.virtualCamera="Virtual camera"
|
||||||
AdvSceneSwitcher.action.virtualCamera.type.stop="Stop virtual camera"
|
AdvSceneSwitcher.action.virtualCamera.type.stop="Stop virtual camera"
|
||||||
AdvSceneSwitcher.action.virtualCamera.type.start="Start virtual camera"
|
AdvSceneSwitcher.action.virtualCamera.type.start="Start virtual camera"
|
||||||
@@ -346,10 +368,10 @@ AdvSceneSwitcher.action.sceneOrder.type.moveDown="Move down"
|
|||||||
AdvSceneSwitcher.action.sceneOrder.type.moveTop="Move to top"
|
AdvSceneSwitcher.action.sceneOrder.type.moveTop="Move to top"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.moveBottom="Move to bottom"
|
AdvSceneSwitcher.action.sceneOrder.type.moveBottom="Move to bottom"
|
||||||
AdvSceneSwitcher.action.sceneOrder.type.movePosition="Move to position"
|
AdvSceneSwitcher.action.sceneOrder.type.movePosition="Move to position"
|
||||||
AdvSceneSwitcher.action.sceneOrder.entry="On {{scenes}} {{actions}} {{sources}} {{position}}"
|
AdvSceneSwitcher.action.sceneOrder.entry="On{{scenes}}{{actions}}{{sources}}{{position}}"
|
||||||
AdvSceneSwitcher.action.sceneTransform="Scene item transform"
|
AdvSceneSwitcher.action.sceneTransform="Scene item transform"
|
||||||
AdvSceneSwitcher.action.sceneTransform.getTransform="Get transform"
|
AdvSceneSwitcher.action.sceneTransform.getTransform="Get transform"
|
||||||
AdvSceneSwitcher.action.sceneTransform.entry="On {{scenes}} transform {{sources}}"
|
AdvSceneSwitcher.action.sceneTransform.entry="On{{scenes}}transform{{sources}}"
|
||||||
AdvSceneSwitcher.action.file="File"
|
AdvSceneSwitcher.action.file="File"
|
||||||
AdvSceneSwitcher.action.file.type.write="Write"
|
AdvSceneSwitcher.action.file.type.write="Write"
|
||||||
AdvSceneSwitcher.action.file.type.append="Append"
|
AdvSceneSwitcher.action.file.type.append="Append"
|
||||||
@@ -374,6 +396,17 @@ AdvSceneSwitcher.action.systray.entry="Show notification: {{message}}"
|
|||||||
AdvSceneSwitcher.action.screenshot="Screenshot"
|
AdvSceneSwitcher.action.screenshot="Screenshot"
|
||||||
AdvSceneSwitcher.action.screenshot.mainOutput="OBS's main output"
|
AdvSceneSwitcher.action.screenshot.mainOutput="OBS's main output"
|
||||||
AdvSceneSwitcher.action.screenshot.entry="Screenshot {{sources}}"
|
AdvSceneSwitcher.action.screenshot.entry="Screenshot {{sources}}"
|
||||||
|
AdvSceneSwitcher.action.profile="Profile"
|
||||||
|
AdvSceneSwitcher.action.profile.entry="Switch active profile to {{profiles}}"
|
||||||
|
AdvSceneSwitcher.action.sceneCollection="Scene collection"
|
||||||
|
AdvSceneSwitcher.action.sceneCollection.entry="Switch active scene collection to {{sceneCollections}}"
|
||||||
|
AdvSceneSwitcher.action.sceneCollection.warning="Note: Any actions following after this will not be executed as the changing scene collection will also reload the scene switcher settings.\nThe scene collection action will be ignored while the settings window is opened."
|
||||||
|
AdvSceneSwitcher.action.sequence="Sequence"
|
||||||
|
AdvSceneSwitcher.action.sequence.entry="Each time this action is performed run the next macro in the list (paused macros are ignored)"
|
||||||
|
AdvSceneSwitcher.action.sequence.status="Last executed macro: %1 - Next macro to be executed: %2"
|
||||||
|
AdvSceneSwitcher.action.sequence.status.none="none"
|
||||||
|
AdvSceneSwitcher.action.sequence.restart="Restart from beginning once end of list is reached"
|
||||||
|
AdvSceneSwitcher.action.sequence.continueFrom="Continue with selected item"
|
||||||
|
|
||||||
; Transition Tab
|
; Transition Tab
|
||||||
AdvSceneSwitcher.transitionTab.title="Transition"
|
AdvSceneSwitcher.transitionTab.title="Transition"
|
||||||
@@ -643,16 +676,22 @@ AdvSceneSwitcher.selectProcess="--select process--"
|
|||||||
AdvSceneSwitcher.selectFilter="--select filter--"
|
AdvSceneSwitcher.selectFilter="--select filter--"
|
||||||
AdvSceneSwitcher.selectMacro="--select macro--"
|
AdvSceneSwitcher.selectMacro="--select macro--"
|
||||||
AdvSceneSwitcher.selectItem="--select item--"
|
AdvSceneSwitcher.selectItem="--select item--"
|
||||||
|
AdvSceneSwitcher.selectProfile="--select profile--"
|
||||||
|
AdvSceneSwitcher.selectSceneCollection="--select scene collection--"
|
||||||
AdvSceneSwitcher.enterPath="--enter path--"
|
AdvSceneSwitcher.enterPath="--enter path--"
|
||||||
AdvSceneSwitcher.enterText="--enter text--"
|
AdvSceneSwitcher.enterText="--enter text--"
|
||||||
AdvSceneSwitcher.invaildEntriesWillNotBeSaved="invalid entries will not be saved"
|
AdvSceneSwitcher.invaildEntriesWillNotBeSaved="invalid entries will not be saved"
|
||||||
AdvSceneSwitcher.selectWindowTip="Use \"OBS\" to specify OBS window\nUse \"Task Switching\"to specify ALT + TAB"
|
AdvSceneSwitcher.selectWindowTip="Use \"OBS\" to specify OBS window\nUse \"Task Switching\"to specify ALT + TAB"
|
||||||
|
AdvSceneSwitcher.sceneItemSelection.all="All"
|
||||||
|
AdvSceneSwitcher.sceneItemSelection.any="Any"
|
||||||
|
|
||||||
AdvSceneSwitcher.status.active="Active"
|
AdvSceneSwitcher.status.active="Active"
|
||||||
AdvSceneSwitcher.status.inactive="Inactive"
|
AdvSceneSwitcher.status.inactive="Inactive"
|
||||||
AdvSceneSwitcher.running="Plugin running"
|
AdvSceneSwitcher.running="Plugin running"
|
||||||
AdvSceneSwitcher.stopped="Plugin stopped"
|
AdvSceneSwitcher.stopped="Plugin stopped"
|
||||||
|
|
||||||
|
AdvSceneSwitcher.firstBootMessage="<html><head/><body><p>This seems to be the first time the Advanced Scene Switcher was started.<br>Please have a look at the <a href=\"https://github.com/WarmUpTill/SceneSwitcher/wiki\"><span style=\" text-decoration: underline; color:#268bd2;\">Wiki</span></a> for a list of guides and examples.<br>Do not hesitate to ask questions in the plugin's <a href=\"https://obsproject.com/forum/threads/advanced-scene-switcher.48264\"><span style=\" text-decoration: underline; color:#268bd2;\">thread</span></a> on the OBS forums!</p></body></html>"
|
||||||
|
|
||||||
AdvSceneSwitcher.unit.milliseconds="milliseconds"
|
AdvSceneSwitcher.unit.milliseconds="milliseconds"
|
||||||
AdvSceneSwitcher.unit.secends="seconds"
|
AdvSceneSwitcher.unit.secends="seconds"
|
||||||
AdvSceneSwitcher.unit.minutes="minutes"
|
AdvSceneSwitcher.unit.minutes="minutes"
|
||||||
|
|||||||
1
deps/openvr
vendored
Submodule
1
deps/openvr
vendored
Submodule
Submodule deps/openvr added at 4c85abcb7f
@@ -56,10 +56,30 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="statusLayout">
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QComboBox" name="autoStartEvent"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_64">
|
||||||
|
<property name="text">
|
||||||
|
<string>AdvSceneSwitcher.generalTab.status.onStartup</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QComboBox" name="startupBehavior"/>
|
<widget class="QComboBox" name="startupBehavior"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QWidget" name="placeholder" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>AdvSceneSwitcher.generalTab.status.autoStart</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="checkInterval">
|
<widget class="QSpinBox" name="checkInterval">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -82,6 +102,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>AdvSceneSwitcher.generalTab.status.hotkeytips</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -90,66 +117,10 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QPushButton" name="toggleStartButton">
|
<widget class="QWidget" name="placeholder2" native="true"/>
|
||||||
<property name="text">
|
|
||||||
<string>AdvSceneSwitcher.generalTab.status.start</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_47">
|
<widget class="QWidget" name="placeholder3" native="true"/>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="pluginRunningText">
|
|
||||||
<property name="text">
|
|
||||||
<string>AdvSceneSwitcher.status.inactive</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="label_13">
|
|
||||||
<property name="text">
|
|
||||||
<string>AdvSceneSwitcher.generalTab.status.hotkeytips</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_64">
|
|
||||||
<property name="text">
|
|
||||||
<string>AdvSceneSwitcher.generalTab.status.onStartup</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>AdvSceneSwitcher.generalTab.status.currentStatus</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="label_10">
|
|
||||||
<property name="text">
|
|
||||||
<string>AdvSceneSwitcher.generalTab.status.autoStart</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QComboBox" name="autoStartEvent"/>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@@ -550,6 +521,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>AdvSceneSwitcher.macroTab.priorityWarning</string>
|
<string>AdvSceneSwitcher.macroTab.priorityWarning</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -729,7 +703,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_34">
|
<layout class="QVBoxLayout" name="verticalLayout_34">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0,0,0">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_20">
|
<widget class="QLabel" name="label_20">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -754,6 +728,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="runMacroOnChange">
|
||||||
|
<property name="text">
|
||||||
|
<string>AdvSceneSwitcher.macroTab.onChange</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_13">
|
<spacer name="horizontalSpacer_13">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@@ -783,7 +764,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>767</width>
|
<width>792</width>
|
||||||
<height>218</height>
|
<height>218</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -882,7 +863,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>767</width>
|
<width>792</width>
|
||||||
<height>218</height>
|
<height>218</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QDirIterator>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
@@ -8,11 +9,16 @@
|
|||||||
#include <obs-frontend-api.h>
|
#include <obs-frontend-api.h>
|
||||||
|
|
||||||
#include "headers/advanced-scene-switcher.hpp"
|
#include "headers/advanced-scene-switcher.hpp"
|
||||||
|
#include "headers/status-control.hpp"
|
||||||
#include "headers/curl-helper.hpp"
|
#include "headers/curl-helper.hpp"
|
||||||
#include "headers/utility.hpp"
|
#include "headers/utility.hpp"
|
||||||
#include "headers/version.h"
|
#include "headers/version.h"
|
||||||
|
|
||||||
SwitcherData *switcher = nullptr;
|
SwitcherData *switcher = nullptr;
|
||||||
|
SwitcherData *GetSwitcher()
|
||||||
|
{
|
||||||
|
return switcher;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Create the Advanced Scene Switcher settings window
|
* Create the Advanced Scene Switcher settings window
|
||||||
@@ -81,6 +87,7 @@ void AdvSceneSwitcher::loadUI()
|
|||||||
|
|
||||||
setTabOrder();
|
setTabOrder();
|
||||||
restoreWindowGeo();
|
restoreWindowGeo();
|
||||||
|
checkFirstTimeSetup();
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
@@ -100,7 +107,6 @@ static void SaveSceneSwitcher(obs_data_t *save_data, bool saving, void *)
|
|||||||
} else {
|
} else {
|
||||||
// Stop the scene switcher at least once to
|
// Stop the scene switcher at least once to
|
||||||
// avoid scene duplication issues with scene collection changes
|
// avoid scene duplication issues with scene collection changes
|
||||||
bool start = !switcher->stop;
|
|
||||||
switcher->Stop();
|
switcher->Stop();
|
||||||
|
|
||||||
switcher->m.lock();
|
switcher->m.lock();
|
||||||
@@ -116,7 +122,7 @@ static void SaveSceneSwitcher(obs_data_t *save_data, bool saving, void *)
|
|||||||
obs_data_release(obj);
|
obs_data_release(obj);
|
||||||
switcher->m.unlock();
|
switcher->m.unlock();
|
||||||
|
|
||||||
if (start) {
|
if (!switcher->stop) {
|
||||||
switcher->Start();
|
switcher->Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -414,6 +420,7 @@ void SwitcherData::Stop()
|
|||||||
cv.notify_all();
|
cv.notify_all();
|
||||||
abortMacroWait = true;
|
abortMacroWait = true;
|
||||||
macroWaitCv.notify_all();
|
macroWaitCv.notify_all();
|
||||||
|
macroTransitionCv.notify_all();
|
||||||
th->wait();
|
th->wait();
|
||||||
delete th;
|
delete th;
|
||||||
th = nullptr;
|
th = nullptr;
|
||||||
@@ -552,6 +559,7 @@ void setTranstionEnd()
|
|||||||
{
|
{
|
||||||
switcher->lastTransitionEndTime =
|
switcher->lastTransitionEndTime =
|
||||||
std::chrono::high_resolution_clock::now();
|
std::chrono::high_resolution_clock::now();
|
||||||
|
switcher->macroTransitionCv.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStreamStarting()
|
void setStreamStarting()
|
||||||
@@ -616,6 +624,34 @@ static void OBSEvent(enum obs_frontend_event event, void *switcher)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadPlugins()
|
||||||
|
{
|
||||||
|
QFileInfo libPath(
|
||||||
|
QString(obs_get_module_binary_path(obs_current_module())));
|
||||||
|
QString pluginDir(libPath.absolutePath() + "/adv-ss-plugins");
|
||||||
|
#ifdef _WIN32
|
||||||
|
QString libPattern = "*.dll";
|
||||||
|
SetDllDirectory(pluginDir.toStdWString().c_str());
|
||||||
|
#else
|
||||||
|
QString libPattern = "*.so";
|
||||||
|
#endif
|
||||||
|
QDirIterator it(pluginDir, QStringList() << libPattern, QDir::Files);
|
||||||
|
while (it.hasNext()) {
|
||||||
|
auto file = it.next();
|
||||||
|
blog(LOG_INFO, "attempting to load \"%s\"",
|
||||||
|
file.toStdString().c_str());
|
||||||
|
auto lib = new QLibrary(file, nullptr);
|
||||||
|
if (lib->load()) {
|
||||||
|
blog(LOG_INFO, "successfully loaded \"%s\"",
|
||||||
|
file.toStdString().c_str());
|
||||||
|
} else {
|
||||||
|
blog(LOG_WARNING, "failed to load \"%s\": %s",
|
||||||
|
file.toStdString().c_str(),
|
||||||
|
lib->errorString().toStdString().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AdvSceneSwitcher *ssWindow;
|
AdvSceneSwitcher *ssWindow;
|
||||||
|
|
||||||
extern "C" void InitSceneSwitcher()
|
extern "C" void InitSceneSwitcher()
|
||||||
@@ -623,9 +659,6 @@ extern "C" void InitSceneSwitcher()
|
|||||||
blog(LOG_INFO, "version: %s", g_GIT_TAG);
|
blog(LOG_INFO, "version: %s", g_GIT_TAG);
|
||||||
blog(LOG_INFO, "version: %s", g_GIT_SHA1);
|
blog(LOG_INFO, "version: %s", g_GIT_SHA1);
|
||||||
|
|
||||||
QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction(
|
|
||||||
obs_module_text("AdvSceneSwitcher.pluginName"));
|
|
||||||
|
|
||||||
switcher = new SwitcherData;
|
switcher = new SwitcherData;
|
||||||
|
|
||||||
if (loadCurl() && f_curl_init) {
|
if (loadCurl() && f_curl_init) {
|
||||||
@@ -633,6 +666,8 @@ extern "C" void InitSceneSwitcher()
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlatformInit();
|
PlatformInit();
|
||||||
|
LoadPlugins();
|
||||||
|
SetupDock();
|
||||||
|
|
||||||
auto cb = []() {
|
auto cb = []() {
|
||||||
if (switcher->settingsWindowOpened) {
|
if (switcher->settingsWindowOpened) {
|
||||||
@@ -640,8 +675,9 @@ extern "C" void InitSceneSwitcher()
|
|||||||
ssWindow->raise();
|
ssWindow->raise();
|
||||||
ssWindow->activateWindow();
|
ssWindow->activateWindow();
|
||||||
} else {
|
} else {
|
||||||
ssWindow = new AdvSceneSwitcher(
|
ssWindow =
|
||||||
(QMainWindow *)obs_frontend_get_main_window());
|
new AdvSceneSwitcher(static_cast<QMainWindow *>(
|
||||||
|
obs_frontend_get_main_window()));
|
||||||
ssWindow->setAttribute(Qt::WA_DeleteOnClose);
|
ssWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ssWindow->show();
|
ssWindow->show();
|
||||||
}
|
}
|
||||||
@@ -650,5 +686,7 @@ extern "C" void InitSceneSwitcher()
|
|||||||
obs_frontend_add_save_callback(SaveSceneSwitcher, nullptr);
|
obs_frontend_add_save_callback(SaveSceneSwitcher, nullptr);
|
||||||
obs_frontend_add_event_callback(OBSEvent, switcher);
|
obs_frontend_add_event_callback(OBSEvent, switcher);
|
||||||
|
|
||||||
|
QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction(
|
||||||
|
obs_module_text("AdvSceneSwitcher.pluginName"));
|
||||||
action->connect(action, &QAction::triggered, cb);
|
action->connect(action, &QAction::triggered, cb);
|
||||||
}
|
}
|
||||||
|
|||||||
59
src/external-macro-modules/CMakeLists.txt
Normal file
59
src/external-macro-modules/CMakeLists.txt
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Helper function to install plugins to correct location
|
||||||
|
function(install_advss_plugin target)
|
||||||
|
set(plugin_folder "adv-ss-plugins")
|
||||||
|
if(APPLE)
|
||||||
|
set(_bit_suffix "")
|
||||||
|
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(_bit_suffix "64bit/")
|
||||||
|
else()
|
||||||
|
set(_bit_suffix "32bit/")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(${target} PROPERTIES PREFIX "")
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS ${target}
|
||||||
|
LIBRARY DESTINATION "${OBS_PLUGIN_DESTINATION}/${plugin_folder}"
|
||||||
|
RUNTIME DESTINATION "${OBS_PLUGIN_DESTINATION}/${plugin_folder}")
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${target}
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND
|
||||||
|
"${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:${target}>"
|
||||||
|
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/obs-plugins/${_bit_suffix}/${plugin_folder}/$<TARGET_FILE_NAME:${target}>"
|
||||||
|
VERBATIM)
|
||||||
|
|
||||||
|
if(DEFINED ENV{obsInstallerTempDir})
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${target}
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND
|
||||||
|
"${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:${target}>"
|
||||||
|
"$ENV{obsInstallerTempDir}/${OBS_PLUGIN_DESTINATION}/${plugin_folder}/$<TARGET_FILE_NAME:${target}>"
|
||||||
|
VERBATIM)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
obs_debug_copy_helper(
|
||||||
|
${target}
|
||||||
|
"${OBS_OUTPUT_DIR}/$<CONFIGURATION>/obs-plugins/${_bit_suffix}/${plugin_folder}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(DEFINED ENV{obsInstallerTempDir})
|
||||||
|
obs_debug_copy_helper(
|
||||||
|
${target}
|
||||||
|
"$ENV{obsInstallerTempDir}/${OBS_PLUGIN_DESTINATION}/${plugin_folder}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(
|
||||||
|
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pdbs/"
|
||||||
|
DESTINATION "${OBS_PLUGIN_DESTINATION}/${plugin_folder}"
|
||||||
|
CONFIGURATIONS Debug RelWithDebInfo)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Add macro conditions or actions which have dependencies to external libraries
|
||||||
|
# or other components which might potentially not be fulfilled by the user and
|
||||||
|
# thus cause issues.
|
||||||
|
add_subdirectory(opencv)
|
||||||
|
add_subdirectory(openvr)
|
||||||
51
src/external-macro-modules/opencv/CMakeLists.txt
Normal file
51
src/external-macro-modules/opencv/CMakeLists.txt
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
project(advanced-scene-switcher-opencv)
|
||||||
|
|
||||||
|
add_definitions(-DADVSS_MODULE)
|
||||||
|
|
||||||
|
find_package(OpenCV)
|
||||||
|
if(OpenCV_FOUND)
|
||||||
|
include_directories("${OpenCV_INCLUDE_DIRS}")
|
||||||
|
else()
|
||||||
|
set(OpenCV_LIBRARIES "")
|
||||||
|
message(
|
||||||
|
WARNING
|
||||||
|
"OpenCV not found! Functionality relying on OpenCV will be disabled!\nOpenCV sources are available under: ${CMAKE_CURRENT_SOURCE_DIR}/deps/opencv"
|
||||||
|
)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../headers")
|
||||||
|
set(module_SOURCES macro-condition-video.cpp macro-condition-video.hpp)
|
||||||
|
add_library(advanced-scene-switcher-opencv MODULE ${module_SOURCES})
|
||||||
|
|
||||||
|
if(BUILD_OUT_OF_TREE)
|
||||||
|
target_link_libraries(
|
||||||
|
advanced-scene-switcher-opencv
|
||||||
|
advanced-scene-switcher
|
||||||
|
${LIBOBS_LIB}
|
||||||
|
${LIBOBS_FRONTEND_API_LIB}
|
||||||
|
${OpenCV_LIBRARIES}
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Widgets)
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
if(NOT LIB_OUT_DIR)
|
||||||
|
set(LIB_OUT_DIR "/lib/obs-plugins")
|
||||||
|
endif()
|
||||||
|
set_target_properties(advanced-scene-switcher-opencv PROPERTIES PREFIX "")
|
||||||
|
install(
|
||||||
|
TARGETS advanced-scene-switcher-opencv
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_OUT_DIR}/adv-ss-plugins)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
target_link_libraries(
|
||||||
|
advanced-scene-switcher-opencv
|
||||||
|
advanced-scene-switcher
|
||||||
|
obs-frontend-api
|
||||||
|
${OpenCV_LIBRARIES}
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Widgets
|
||||||
|
libobs)
|
||||||
|
install_advss_plugin(advanced-scene-switcher-opencv)
|
||||||
|
endif()
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
#include "headers/macro-condition-edit.hpp"
|
#include "macro-condition-video.hpp"
|
||||||
#include "headers/macro-condition-video.hpp"
|
|
||||||
#include "headers/utility.hpp"
|
#include <advanced-scene-switcher.hpp>
|
||||||
#include "headers/advanced-scene-switcher.hpp"
|
#include <macro-condition-edit.hpp>
|
||||||
|
#include <switcher-data-structs.hpp>
|
||||||
|
#include <utility.hpp>
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
@@ -450,9 +452,9 @@ MacroConditionVideoEdit::MacroConditionVideoEdit(
|
|||||||
|
|
||||||
_throttleEnable = new QCheckBox();
|
_throttleEnable = new QCheckBox();
|
||||||
_throttleCount = new QSpinBox();
|
_throttleCount = new QSpinBox();
|
||||||
_throttleCount->setMinimum(1 * switcher->interval);
|
_throttleCount->setMinimum(1 * GetSwitcher()->interval);
|
||||||
_throttleCount->setMaximum(10 * switcher->interval);
|
_throttleCount->setMaximum(10 * GetSwitcher()->interval);
|
||||||
_throttleCount->setSingleStep(switcher->interval);
|
_throttleCount->setSingleStep(GetSwitcher()->interval);
|
||||||
_showMatch = new QPushButton(
|
_showMatch = new QPushButton(
|
||||||
obs_module_text("AdvSceneSwitcher.condition.video.showMatch"));
|
obs_module_text("AdvSceneSwitcher.condition.video.showMatch"));
|
||||||
|
|
||||||
@@ -595,7 +597,7 @@ void MacroConditionVideoEdit::SourceChanged(const QString &text)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_videoSource = GetWeakSourceByQString(text);
|
_entryData->_videoSource = GetWeakSourceByQString(text);
|
||||||
_entryData->ResetLastMatch();
|
_entryData->ResetLastMatch();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
@@ -608,7 +610,7 @@ void MacroConditionVideoEdit::ConditionChanged(int cond)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_condition = static_cast<VideoCondition>(cond);
|
_entryData->_condition = static_cast<VideoCondition>(cond);
|
||||||
_entryData->ResetLastMatch();
|
_entryData->ResetLastMatch();
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
@@ -634,7 +636,7 @@ void MacroConditionVideoEdit::ImagePathChanged(const QString &text)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_file = text.toUtf8().constData();
|
_entryData->_file = text.toUtf8().constData();
|
||||||
_entryData->ResetLastMatch();
|
_entryData->ResetLastMatch();
|
||||||
if (_entryData->LoadImageFromFile()) {
|
if (_entryData->LoadImageFromFile()) {
|
||||||
@@ -712,7 +714,7 @@ void MacroConditionVideoEdit::UsePatternForChangedCheckChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_usePatternForChangedCheck = value;
|
_entryData->_usePatternForChangedCheck = value;
|
||||||
_patternThreshold->setVisible(value);
|
_patternThreshold->setVisible(value);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
@@ -724,7 +726,7 @@ void MacroConditionVideoEdit::PatternThresholdChanged(double value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_patternThreshold = value;
|
_entryData->_patternThreshold = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,7 +736,7 @@ void MacroConditionVideoEdit::UseAlphaAsMaskChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_useAlphaAsMask = value;
|
_entryData->_useAlphaAsMask = value;
|
||||||
_entryData->LoadImageFromFile();
|
_entryData->LoadImageFromFile();
|
||||||
}
|
}
|
||||||
@@ -745,7 +747,7 @@ void MacroConditionVideoEdit::ObjectScaleThresholdChanged(double value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_scaleFactor = value;
|
_entryData->_scaleFactor = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,7 +757,7 @@ void MacroConditionVideoEdit::MinNeighborsChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_minNeighbors = value;
|
_entryData->_minNeighbors = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -765,7 +767,7 @@ void MacroConditionVideoEdit::MinSizeXChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_minSizeX = value;
|
_entryData->_minSizeX = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,7 +777,7 @@ void MacroConditionVideoEdit::MinSizeYChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_minSizeY = value;
|
_entryData->_minSizeY = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,7 +787,7 @@ void MacroConditionVideoEdit::MaxSizeXChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_maxSizeX = value;
|
_entryData->_maxSizeX = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -795,7 +797,7 @@ void MacroConditionVideoEdit::MaxSizeYChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_maxSizeY = value;
|
_entryData->_maxSizeY = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -805,7 +807,7 @@ void MacroConditionVideoEdit::ThrottleEnableChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_throttleEnabled = value;
|
_entryData->_throttleEnabled = value;
|
||||||
_throttleCount->setEnabled(value);
|
_throttleCount->setEnabled(value);
|
||||||
}
|
}
|
||||||
@@ -816,8 +818,8 @@ void MacroConditionVideoEdit::ThrottleCountChanged(int value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
_entryData->_throttleCount = value / switcher->interval;
|
_entryData->_throttleCount = value / GetSwitcher()->interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage markPatterns(cv::Mat &matchResult, QImage &image, QImage &pattern)
|
QImage markPatterns(cv::Mat &matchResult, QImage &image, QImage &pattern)
|
||||||
@@ -907,7 +909,7 @@ void MacroConditionVideoEdit::ModelPathChanged(const QString &text)
|
|||||||
|
|
||||||
bool dataLoaded = false;
|
bool dataLoaded = false;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
std::string path = text.toStdString();
|
std::string path = text.toStdString();
|
||||||
dataLoaded = _entryData->LoadModelData(path);
|
dataLoaded = _entryData->LoadModelData(path);
|
||||||
}
|
}
|
||||||
@@ -1003,6 +1005,6 @@ void MacroConditionVideoEdit::UpdateEntryData()
|
|||||||
_maxSizeY->setValue(_entryData->_maxSizeY);
|
_maxSizeY->setValue(_entryData->_maxSizeY);
|
||||||
_throttleEnable->setChecked(_entryData->_throttleEnabled);
|
_throttleEnable->setChecked(_entryData->_throttleEnabled);
|
||||||
_throttleCount->setValue(_entryData->_throttleCount *
|
_throttleCount->setValue(_entryData->_throttleCount *
|
||||||
switcher->interval);
|
GetSwitcher()->interval);
|
||||||
SetWidgetVisibility();
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro.hpp"
|
#include <macro.hpp>
|
||||||
#include "screenshot-helper.hpp"
|
#include <screenshot-helper.hpp>
|
||||||
#include "file-selection.hpp"
|
#include <file-selection.hpp>
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
@@ -32,15 +32,16 @@ constexpr int maxMinNeighbors = 6;
|
|||||||
|
|
||||||
class MacroConditionVideo : public MacroCondition {
|
class MacroConditionVideo : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionVideo(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
QImage GetMatchImage() { return _matchImage; };
|
QImage GetMatchImage() { return _matchImage; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionVideo>();
|
return std::make_shared<MacroConditionVideo>(m);
|
||||||
}
|
}
|
||||||
void GetScreenshot();
|
void GetScreenshot();
|
||||||
bool LoadImageFromFile();
|
bool LoadImageFromFile();
|
||||||
90
src/external-macro-modules/openvr/CMakeLists.txt
Normal file
90
src/external-macro-modules/openvr/CMakeLists.txt
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
project(advanced-scene-switcher-openvr)
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
message(
|
||||||
|
WARNING "OpenVR condition is only supported on Windows builds for now.")
|
||||||
|
return()
|
||||||
|
endif(NOT WIN32)
|
||||||
|
|
||||||
|
add_definitions(-DADVSS_MODULE)
|
||||||
|
|
||||||
|
# openvr
|
||||||
|
if(NOT OpenVR_DIR)
|
||||||
|
set(OpenVR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../deps/openvr)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(EXISTS ${OpenVR_DIR})
|
||||||
|
set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P})
|
||||||
|
if((NOT APPLE) AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
|
||||||
|
set(PROCESSOR_ARCH "64")
|
||||||
|
else()
|
||||||
|
set(PROCESSOR_ARCH "32")
|
||||||
|
endif()
|
||||||
|
if(WIN32)
|
||||||
|
set(PLATFORM_NAME "win")
|
||||||
|
elseif(UNIX AND NOT APPLE)
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
|
||||||
|
set(PLATFORM_NAME "linux")
|
||||||
|
endif()
|
||||||
|
elseif(APPLE)
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*" OR CMAKE_SYSTEM_NAME MATCHES
|
||||||
|
".*MacOS.*")
|
||||||
|
set(PLATFORM_NAME "osx")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
set(OpenVR_INCLUDE_DIRS ${OpenVR_DIR}/headers)
|
||||||
|
set(OpenVR_BINARIES
|
||||||
|
${OpenVR_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH}/${CMAKE_SHARED_LIBRARY_PREFIX}openvr_api${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||||
|
)
|
||||||
|
set(OpenVR_LIBRARIES
|
||||||
|
${OpenVR_DIR}/lib/${PLATFORM_NAME}${PROCESSOR_ARCH}/${CMAKE_SHARED_LIBRARY_PREFIX}openvr_api${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||||
|
)
|
||||||
|
set(OpenVR_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OpenVR_FOUND)
|
||||||
|
include_directories("${OpenVR_INCLUDE_DIRS}")
|
||||||
|
else()
|
||||||
|
set(OpenVR_LIBRARIES "")
|
||||||
|
message(
|
||||||
|
WARNING
|
||||||
|
"OpenVR not found! Functionality relying on OpenVR will be disabled!\nOpenVR sources are available under: ${CMAKE_CURRENT_SOURCE_DIR}/deps/openvr"
|
||||||
|
return
|
||||||
|
())
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../headers")
|
||||||
|
set(module_SOURCES macro-condition-openvr.cpp macro-condition-openvr.hpp)
|
||||||
|
add_library(advanced-scene-switcher-openvr MODULE ${module_SOURCES})
|
||||||
|
|
||||||
|
if(BUILD_OUT_OF_TREE)
|
||||||
|
target_link_libraries(
|
||||||
|
advanced-scene-switcher-openvr
|
||||||
|
advanced-scene-switcher
|
||||||
|
${LIBOBS_LIB}
|
||||||
|
${LIBOBS_FRONTEND_API_LIB}
|
||||||
|
${OpenVR_LIBRARIES}
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Widgets)
|
||||||
|
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
if(NOT LIB_OUT_DIR)
|
||||||
|
set(LIB_OUT_DIR "/lib/obs-plugins")
|
||||||
|
endif()
|
||||||
|
set_target_properties(advanced-scene-switcher-openvr PROPERTIES PREFIX "")
|
||||||
|
install(
|
||||||
|
TARGETS advanced-scene-switcher-openvr
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_OUT_DIR}/adv-ss-plugins)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
target_link_libraries(
|
||||||
|
advanced-scene-switcher-openvr
|
||||||
|
advanced-scene-switcher
|
||||||
|
obs-frontend-api
|
||||||
|
${OpenVR_LIBRARIES}
|
||||||
|
Qt5::Core
|
||||||
|
Qt5::Widgets
|
||||||
|
libobs)
|
||||||
|
install_advss_plugin(advanced-scene-switcher-openvr)
|
||||||
|
endif()
|
||||||
297
src/external-macro-modules/openvr/macro-condition-openvr.cpp
Normal file
297
src/external-macro-modules/openvr/macro-condition-openvr.cpp
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
#include "macro-condition-openvr.hpp"
|
||||||
|
|
||||||
|
#include <macro-condition-edit.hpp>
|
||||||
|
#include <utility.hpp>
|
||||||
|
#include <advanced-scene-switcher.hpp>
|
||||||
|
#include <openvr.h>
|
||||||
|
|
||||||
|
const std::string MacroConditionOpenVR::id = "openvr";
|
||||||
|
|
||||||
|
bool MacroConditionOpenVR::_registered = MacroConditionFactory::Register(
|
||||||
|
MacroConditionOpenVR::id,
|
||||||
|
{MacroConditionOpenVR::Create, MacroConditionOpenVREdit::Create,
|
||||||
|
"AdvSceneSwitcher.condition.openvr"});
|
||||||
|
|
||||||
|
static vr::IVRSystem *openvrSystem;
|
||||||
|
std::mutex openvrMutex;
|
||||||
|
std::condition_variable openvrCV;
|
||||||
|
|
||||||
|
void processOpenVREvents()
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(openvrMutex);
|
||||||
|
vr::VREvent_t event;
|
||||||
|
while (true) {
|
||||||
|
if (openvrSystem->PollNextEvent(&event, sizeof(event)) &&
|
||||||
|
event.eventType == vr::VREvent_Quit) {
|
||||||
|
openvrSystem->AcknowledgeQuit_Exiting();
|
||||||
|
vr::VR_Shutdown();
|
||||||
|
openvrSystem = nullptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
openvrCV.wait_for(lock, std::chrono::milliseconds(100));
|
||||||
|
}
|
||||||
|
blog(LOG_INFO, "stop handling openVR events");
|
||||||
|
}
|
||||||
|
|
||||||
|
void initOpenVR(vr::EVRInitError &err)
|
||||||
|
{
|
||||||
|
openvrSystem = vr::VR_Init(&err, vr::VRApplication_Background);
|
||||||
|
if (openvrSystem) {
|
||||||
|
// Don't kill OBS if SteamVR is exiting
|
||||||
|
std::thread t(processOpenVREvents);
|
||||||
|
t.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TrackingData {
|
||||||
|
float x, y, z;
|
||||||
|
bool valid = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
TrackingData getOpenVRPos(vr::EVRInitError &err)
|
||||||
|
{
|
||||||
|
TrackingData data;
|
||||||
|
std::unique_lock<std::mutex> lock(openvrMutex);
|
||||||
|
if (!openvrSystem) {
|
||||||
|
initOpenVR(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (openvrSystem && vr::VRCompositor() &&
|
||||||
|
openvrSystem->IsTrackedDeviceConnected(0)) {
|
||||||
|
vr::TrackedDevicePose_t poses[vr::k_unMaxTrackedDeviceCount];
|
||||||
|
openvrSystem->GetDeviceToAbsoluteTrackingPose(
|
||||||
|
vr::TrackingUniverseStanding, 0.0, poses,
|
||||||
|
vr::k_unMaxTrackedDeviceCount);
|
||||||
|
auto hmdPose = poses[vr::k_unTrackedDeviceIndex_Hmd];
|
||||||
|
auto mat = hmdPose.mDeviceToAbsoluteTracking.m;
|
||||||
|
data.x = mat[0][3];
|
||||||
|
data.y = mat[1][3];
|
||||||
|
data.z = mat[2][3];
|
||||||
|
data.valid = true;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroConditionOpenVR::CheckCondition()
|
||||||
|
{
|
||||||
|
vr::EVRInitError err;
|
||||||
|
TrackingData data = getOpenVRPos(err);
|
||||||
|
if (!data.valid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.x >= _minX && data.y >= _minY && data.z >= _minZ &&
|
||||||
|
data.x <= _maxX && data.y <= _maxY && data.z <= _maxZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroConditionOpenVR::Save(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroCondition::Save(obj);
|
||||||
|
obs_data_set_double(obj, "minX", _minX);
|
||||||
|
obs_data_set_double(obj, "minY", _minY);
|
||||||
|
obs_data_set_double(obj, "minZ", _minZ);
|
||||||
|
obs_data_set_double(obj, "maxX", _maxX);
|
||||||
|
obs_data_set_double(obj, "maxY", _maxY);
|
||||||
|
obs_data_set_double(obj, "maxZ", _maxZ);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroConditionOpenVR::Load(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroCondition::Load(obj);
|
||||||
|
_minX = obs_data_get_double(obj, "minX");
|
||||||
|
_minY = obs_data_get_double(obj, "minY");
|
||||||
|
_minZ = obs_data_get_double(obj, "minZ");
|
||||||
|
_maxX = obs_data_get_double(obj, "maxX");
|
||||||
|
_maxY = obs_data_get_double(obj, "maxY");
|
||||||
|
_maxZ = obs_data_get_double(obj, "maxZ");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
MacroConditionOpenVREdit::MacroConditionOpenVREdit(
|
||||||
|
QWidget *parent, std::shared_ptr<MacroConditionOpenVR> entryData)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
_minX = new QDoubleSpinBox();
|
||||||
|
_minY = new QDoubleSpinBox();
|
||||||
|
_minZ = new QDoubleSpinBox();
|
||||||
|
_maxX = new QDoubleSpinBox();
|
||||||
|
_maxY = new QDoubleSpinBox();
|
||||||
|
_maxZ = new QDoubleSpinBox();
|
||||||
|
_xPos = new QLabel("-");
|
||||||
|
_yPos = new QLabel("-");
|
||||||
|
_zPos = new QLabel("-");
|
||||||
|
_errLabel = new QLabel();
|
||||||
|
_errLabel->setVisible(false);
|
||||||
|
|
||||||
|
_minX->setPrefix("Min X: ");
|
||||||
|
_minY->setPrefix("Min Y: ");
|
||||||
|
_minZ->setPrefix("Min Z: ");
|
||||||
|
_maxX->setPrefix("Max X: ");
|
||||||
|
_maxY->setPrefix("Max Y: ");
|
||||||
|
_maxZ->setPrefix("Max Z: ");
|
||||||
|
|
||||||
|
_minX->setMinimum(-99);
|
||||||
|
_minY->setMinimum(-99);
|
||||||
|
_minZ->setMinimum(-99);
|
||||||
|
_maxX->setMinimum(-99);
|
||||||
|
_maxY->setMinimum(-99);
|
||||||
|
_maxZ->setMinimum(-99);
|
||||||
|
|
||||||
|
_minX->setMaximum(99);
|
||||||
|
_minY->setMaximum(99);
|
||||||
|
_minZ->setMaximum(99);
|
||||||
|
_maxX->setMaximum(99);
|
||||||
|
_maxY->setMaximum(99);
|
||||||
|
_maxZ->setMaximum(99);
|
||||||
|
|
||||||
|
QWidget::connect(_minX, SIGNAL(valueChanged(double)), this,
|
||||||
|
SLOT(MinXChanged(double)));
|
||||||
|
QWidget::connect(_minY, SIGNAL(valueChanged(double)), this,
|
||||||
|
SLOT(MinYChanged(double)));
|
||||||
|
QWidget::connect(_minZ, SIGNAL(valueChanged(double)), this,
|
||||||
|
SLOT(MinZChanged(double)));
|
||||||
|
QWidget::connect(_maxX, SIGNAL(valueChanged(double)), this,
|
||||||
|
SLOT(MaxXChanged(double)));
|
||||||
|
QWidget::connect(_maxY, SIGNAL(valueChanged(double)), this,
|
||||||
|
SLOT(MaxYChanged(double)));
|
||||||
|
QWidget::connect(_maxZ, SIGNAL(valueChanged(double)), this,
|
||||||
|
SLOT(MaxZChanged(double)));
|
||||||
|
|
||||||
|
QGridLayout *controlsLayout = new QGridLayout;
|
||||||
|
controlsLayout->addWidget(_minX, 0, 0);
|
||||||
|
controlsLayout->addWidget(_minY, 0, 1);
|
||||||
|
controlsLayout->addWidget(_minZ, 0, 2);
|
||||||
|
controlsLayout->addWidget(_maxX, 1, 0);
|
||||||
|
controlsLayout->addWidget(_maxY, 1, 1);
|
||||||
|
controlsLayout->addWidget(_maxZ, 1, 2);
|
||||||
|
QWidget *controls = new QWidget;
|
||||||
|
controls->setLayout(controlsLayout);
|
||||||
|
controls->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
|
||||||
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
|
{"{{controls}}", controls},
|
||||||
|
{"{{xPos}}", _xPos},
|
||||||
|
{"{{yPos}}", _yPos},
|
||||||
|
{"{{zPos}}", _zPos},
|
||||||
|
};
|
||||||
|
QHBoxLayout *line1 = new QHBoxLayout;
|
||||||
|
placeWidgets(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.openvr.entry.line1"),
|
||||||
|
line1, widgetPlaceholders);
|
||||||
|
QHBoxLayout *line2 = new QHBoxLayout;
|
||||||
|
placeWidgets(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.openvr.entry.line2"),
|
||||||
|
line2, widgetPlaceholders);
|
||||||
|
QHBoxLayout *line3 = new QHBoxLayout;
|
||||||
|
placeWidgets(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.openvr.entry.line3"),
|
||||||
|
line3, widgetPlaceholders);
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addLayout(line1);
|
||||||
|
mainLayout->addLayout(line2);
|
||||||
|
mainLayout->addLayout(line3);
|
||||||
|
mainLayout->addWidget(_errLabel);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
connect(&_timer, &QTimer::timeout, this,
|
||||||
|
&MacroConditionOpenVREdit::UpdateOpenVRPos);
|
||||||
|
_timer.start(1000);
|
||||||
|
|
||||||
|
_entryData = entryData;
|
||||||
|
UpdateEntryData();
|
||||||
|
_loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionOpenVREdit::MinXChanged(double pos)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
|
_entryData->_minX = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionOpenVREdit::MinYChanged(double pos)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
|
_entryData->_minY = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionOpenVREdit::MinZChanged(double pos)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
|
_entryData->_minZ = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionOpenVREdit::MaxXChanged(double pos)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
|
_entryData->_maxX = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionOpenVREdit::MaxYChanged(double pos)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
|
_entryData->_maxY = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionOpenVREdit::MaxZChanged(double pos)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(GetSwitcher()->m);
|
||||||
|
_entryData->_maxZ = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionOpenVREdit::UpdateOpenVRPos()
|
||||||
|
{
|
||||||
|
vr::EVRInitError err;
|
||||||
|
TrackingData data = getOpenVRPos(err);
|
||||||
|
if (data.valid) {
|
||||||
|
_xPos->setText(QString::number(data.x));
|
||||||
|
_yPos->setText(QString::number(data.y));
|
||||||
|
_zPos->setText(QString::number(data.z));
|
||||||
|
} else {
|
||||||
|
_xPos->setText("-");
|
||||||
|
_yPos->setText("-");
|
||||||
|
_zPos->setText("-");
|
||||||
|
_errLabel->setText(
|
||||||
|
QString(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.errorStatus")) +
|
||||||
|
QString(vr::VR_GetVRInitErrorAsEnglishDescription(err)));
|
||||||
|
}
|
||||||
|
_errLabel->setVisible(!data.valid);
|
||||||
|
adjustSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionOpenVREdit::UpdateEntryData()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_minX->setValue(_entryData->_minX);
|
||||||
|
_minY->setValue(_entryData->_minY);
|
||||||
|
_maxX->setValue(_entryData->_maxX);
|
||||||
|
_maxY->setValue(_entryData->_maxY);
|
||||||
|
}
|
||||||
69
src/external-macro-modules/openvr/macro-condition-openvr.hpp
Normal file
69
src/external-macro-modules/openvr/macro-condition-openvr.hpp
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <macro.hpp>
|
||||||
|
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
class MacroConditionOpenVR : public MacroCondition {
|
||||||
|
public:
|
||||||
|
MacroConditionOpenVR(Macro *m) : MacroCondition(m) {}
|
||||||
|
bool CheckCondition();
|
||||||
|
bool Save(obs_data_t *obj);
|
||||||
|
bool Load(obs_data_t *obj);
|
||||||
|
std::string GetId() { return id; };
|
||||||
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
|
{
|
||||||
|
return std::make_shared<MacroConditionOpenVR>(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
double _minX = 0, _minY = 0, _minZ = 0, _maxX = 0, _maxY = 0, _maxZ = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool _registered;
|
||||||
|
static const std::string id;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroConditionOpenVREdit : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroConditionOpenVREdit(
|
||||||
|
QWidget *parent,
|
||||||
|
std::shared_ptr<MacroConditionOpenVR> cond = nullptr);
|
||||||
|
void UpdateEntryData();
|
||||||
|
static QWidget *Create(QWidget *parent,
|
||||||
|
std::shared_ptr<MacroCondition> cond)
|
||||||
|
{
|
||||||
|
return new MacroConditionOpenVREdit(
|
||||||
|
parent,
|
||||||
|
std::dynamic_pointer_cast<MacroConditionOpenVR>(cond));
|
||||||
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void MinXChanged(double pos);
|
||||||
|
void MinYChanged(double pos);
|
||||||
|
void MinZChanged(double pos);
|
||||||
|
void MaxXChanged(double pos);
|
||||||
|
void MaxYChanged(double pos);
|
||||||
|
void MaxZChanged(double pos);
|
||||||
|
void UpdateOpenVRPos();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QDoubleSpinBox *_minX;
|
||||||
|
QDoubleSpinBox *_minY;
|
||||||
|
QDoubleSpinBox *_minZ;
|
||||||
|
QDoubleSpinBox *_maxX;
|
||||||
|
QDoubleSpinBox *_maxY;
|
||||||
|
QDoubleSpinBox *_maxZ;
|
||||||
|
QLabel *_xPos;
|
||||||
|
QLabel *_yPos;
|
||||||
|
QLabel *_zPos;
|
||||||
|
QLabel *_errLabel;
|
||||||
|
std::shared_ptr<MacroConditionOpenVR> _entryData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTimer _timer;
|
||||||
|
bool _loading = true;
|
||||||
|
};
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
#include "headers/advanced-scene-switcher.hpp"
|
#include "headers/advanced-scene-switcher.hpp"
|
||||||
|
#include "headers/status-control.hpp"
|
||||||
#include "headers/utility.hpp"
|
#include "headers/utility.hpp"
|
||||||
#include "headers/version.h"
|
#include "headers/version.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QGuiApplication>
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
QMetaObject::Connection inactivePluse;
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_close_clicked()
|
void AdvSceneSwitcher::on_close_clicked()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
@@ -147,41 +145,6 @@ void AdvSceneSwitcher::on_checkInterval_valueChanged(int value)
|
|||||||
switcher->interval = value;
|
switcher->interval = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::SetStarted()
|
|
||||||
{
|
|
||||||
ui->toggleStartButton->setText(
|
|
||||||
obs_module_text("AdvSceneSwitcher.generalTab.status.stop"));
|
|
||||||
ui->pluginRunningText->setText(
|
|
||||||
obs_module_text("AdvSceneSwitcher.status.active"));
|
|
||||||
ui->pluginRunningText->disconnect(inactivePluse);
|
|
||||||
currentStatusActive = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::SetStopped()
|
|
||||||
{
|
|
||||||
ui->toggleStartButton->setText(
|
|
||||||
obs_module_text("AdvSceneSwitcher.generalTab.status.start"));
|
|
||||||
ui->pluginRunningText->setText(
|
|
||||||
obs_module_text("AdvSceneSwitcher.status.inactive"));
|
|
||||||
if (!switcher->disableHints) {
|
|
||||||
inactivePluse = PulseWidget(ui->pluginRunningText,
|
|
||||||
QColor(Qt::red), QColor(0, 0, 0, 0),
|
|
||||||
"QLabel ");
|
|
||||||
}
|
|
||||||
currentStatusActive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_toggleStartButton_clicked()
|
|
||||||
{
|
|
||||||
if (switcher->th && switcher->th->isRunning()) {
|
|
||||||
switcher->Stop();
|
|
||||||
SetStopped();
|
|
||||||
} else {
|
|
||||||
switcher->Start();
|
|
||||||
SetStarted();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::closeEvent(QCloseEvent *)
|
void AdvSceneSwitcher::closeEvent(QCloseEvent *)
|
||||||
{
|
{
|
||||||
if (!switcher) {
|
if (!switcher) {
|
||||||
@@ -436,11 +399,6 @@ void AdvSceneSwitcher::setTabOrder()
|
|||||||
connect(bar, &QTabBar::tabMoved, this, &AdvSceneSwitcher::on_tabMoved);
|
connect(bar, &QTabBar::tabMoved, this, &AdvSceneSwitcher::on_tabMoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool windowPosValid(QPoint pos)
|
|
||||||
{
|
|
||||||
return !!QGuiApplication::screenAt(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::restoreWindowGeo()
|
void AdvSceneSwitcher::restoreWindowGeo()
|
||||||
{
|
{
|
||||||
if (switcher->saveWindowGeo && windowPosValid(switcher->windowPos)) {
|
if (switcher->saveWindowGeo && windowPosValid(switcher->windowPos)) {
|
||||||
@@ -449,6 +407,14 @@ void AdvSceneSwitcher::restoreWindowGeo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdvSceneSwitcher::checkFirstTimeSetup()
|
||||||
|
{
|
||||||
|
if (switcher->firstBoot && !switcher->disableHints) {
|
||||||
|
DisplayMessage(
|
||||||
|
obs_module_text("AdvSceneSwitcher.firstBootMessage"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_tabMoved(int from, int to)
|
void AdvSceneSwitcher::on_tabMoved(int from, int to)
|
||||||
{
|
{
|
||||||
if (loading) {
|
if (loading) {
|
||||||
@@ -458,10 +424,8 @@ void AdvSceneSwitcher::on_tabMoved(int from, int to)
|
|||||||
std::swap(switcher->tabOrder[from], switcher->tabOrder[to]);
|
std::swap(switcher->tabOrder[from], switcher->tabOrder[to]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::on_tabWidget_currentChanged(int index)
|
void AdvSceneSwitcher::on_tabWidget_currentChanged(int)
|
||||||
{
|
{
|
||||||
UNUSED_PARAMETER(index);
|
|
||||||
|
|
||||||
switcher->showFrame = false;
|
switcher->showFrame = false;
|
||||||
clearFrames(ui->screenRegionSwitches);
|
clearFrames(ui->screenRegionSwitches);
|
||||||
SetShowFrames();
|
SetShowFrames();
|
||||||
@@ -788,21 +752,6 @@ void populateAutoStartEventSelection(QComboBox *cb)
|
|||||||
"AdvSceneSwitcher.generalTab.status.autoStart.recordingAndStreaming"));
|
"AdvSceneSwitcher.generalTab.status.autoStart.recordingAndStreaming"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvSceneSwitcher::updateStatus()
|
|
||||||
{
|
|
||||||
if (switcher->th && switcher->th->isRunning()) {
|
|
||||||
if (currentStatusActive) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SetStarted();
|
|
||||||
} else {
|
|
||||||
if (!currentStatusActive) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SetStopped();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdvSceneSwitcher::setupGeneralTab()
|
void AdvSceneSwitcher::setupGeneralTab()
|
||||||
{
|
{
|
||||||
populateSceneSelection(ui->noMatchSwitchScene, false);
|
populateSceneSelection(ui->noMatchSwitchScene, false);
|
||||||
@@ -923,17 +872,17 @@ void AdvSceneSwitcher::setupGeneralTab()
|
|||||||
ui->autoStartEvent->setCurrentIndex(
|
ui->autoStartEvent->setCurrentIndex(
|
||||||
static_cast<int>(switcher->autoStartEvent));
|
static_cast<int>(switcher->autoStartEvent));
|
||||||
|
|
||||||
if (switcher->th && switcher->th->isRunning()) {
|
// Set up status control
|
||||||
SetStarted();
|
auto statusControl = new StatusControl(this, true);
|
||||||
} else {
|
ui->statusLayout->addWidget(statusControl->StatusPrefixLabel(), 1, 0);
|
||||||
SetStopped();
|
auto tmp = new QHBoxLayout;
|
||||||
}
|
tmp->addWidget(statusControl->StatusLabel());
|
||||||
|
tmp->addStretch();
|
||||||
// Updates the UI status element if the status changed externally
|
ui->statusLayout->addLayout(tmp, 1, 1);
|
||||||
// (e.g. via hotkeys)
|
ui->statusLayout->addWidget(statusControl->Button(), 2, 1);
|
||||||
QTimer *statusTimer = new QTimer(this);
|
// Hide the now empty invisible shell of the statusControl widget
|
||||||
connect(statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
// as otherwise it could block user input
|
||||||
statusTimer->start(1000);
|
statusControl->hide();
|
||||||
|
|
||||||
setWindowTitle(windowTitle() + " - " + g_GIT_TAG);
|
setWindowTitle(windowTitle() + " - " + g_GIT_TAG);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifdef BUILD_OUT_OF_TREE
|
#ifdef BUILD_OUT_OF_TREE
|
||||||
#include "../../forms/ui_advanced-scene-switcher.h"
|
#include "../../forms/ui_advanced-scene-switcher.h"
|
||||||
|
#elif defined ADVSS_MODULE
|
||||||
|
#include "../../../ui_advanced-scene-switcher.h"
|
||||||
#else
|
#else
|
||||||
#include "ui_advanced-scene-switcher.h"
|
#include "ui_advanced-scene-switcher.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -26,7 +28,6 @@ class AdvSceneSwitcher : public QDialog {
|
|||||||
public:
|
public:
|
||||||
std::unique_ptr<Ui_AdvSceneSwitcher> ui;
|
std::unique_ptr<Ui_AdvSceneSwitcher> ui;
|
||||||
bool loading = true;
|
bool loading = true;
|
||||||
bool currentStatusActive = false;
|
|
||||||
|
|
||||||
AdvSceneSwitcher(QWidget *parent);
|
AdvSceneSwitcher(QWidget *parent);
|
||||||
~AdvSceneSwitcher();
|
~AdvSceneSwitcher();
|
||||||
@@ -34,9 +35,6 @@ public:
|
|||||||
void reject() override;
|
void reject() override;
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
void SetStarted();
|
|
||||||
void SetStopped();
|
|
||||||
|
|
||||||
void SetShowFrames();
|
void SetShowFrames();
|
||||||
void SetHideFrames();
|
void SetHideFrames();
|
||||||
void clearFrames(QListWidget *list);
|
void clearFrames(QListWidget *list);
|
||||||
@@ -81,6 +79,7 @@ public:
|
|||||||
void setupMacroTab();
|
void setupMacroTab();
|
||||||
void setTabOrder();
|
void setTabOrder();
|
||||||
void restoreWindowGeo();
|
void restoreWindowGeo();
|
||||||
|
void checkFirstTimeSetup();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void MacroAdded(const QString &name);
|
void MacroAdded(const QString &name);
|
||||||
@@ -106,7 +105,6 @@ public slots:
|
|||||||
void on_autoStartEvent_currentIndexChanged(int index);
|
void on_autoStartEvent_currentIndexChanged(int index);
|
||||||
void on_noMatchSwitchScene_currentTextChanged(const QString &text);
|
void on_noMatchSwitchScene_currentTextChanged(const QString &text);
|
||||||
void on_checkInterval_valueChanged(int value);
|
void on_checkInterval_valueChanged(int value);
|
||||||
void on_toggleStartButton_clicked();
|
|
||||||
void on_tabMoved(int from, int to);
|
void on_tabMoved(int from, int to);
|
||||||
void on_tabWidget_currentChanged(int index);
|
void on_tabWidget_currentChanged(int index);
|
||||||
|
|
||||||
@@ -117,6 +115,7 @@ public slots:
|
|||||||
void on_macroName_editingFinished();
|
void on_macroName_editingFinished();
|
||||||
void on_runMacro_clicked();
|
void on_runMacro_clicked();
|
||||||
void on_runMacroInParallel_stateChanged(int value);
|
void on_runMacroInParallel_stateChanged(int value);
|
||||||
|
void on_runMacroOnChange_stateChanged(int value);
|
||||||
void on_macros_currentRowChanged(int idx);
|
void on_macros_currentRowChanged(int idx);
|
||||||
void on_macros_itemChanged(QListWidgetItem *);
|
void on_macros_itemChanged(QListWidgetItem *);
|
||||||
void on_conditionAdd_clicked();
|
void on_conditionAdd_clicked();
|
||||||
@@ -268,7 +267,6 @@ public slots:
|
|||||||
void on_threadPriority_currentTextChanged(const QString &text);
|
void on_threadPriority_currentTextChanged(const QString &text);
|
||||||
|
|
||||||
void updateScreenRegionCursorPos();
|
void updateScreenRegionCursorPos();
|
||||||
void updateStatus();
|
|
||||||
|
|
||||||
void on_close_clicked();
|
void on_close_clicked();
|
||||||
|
|
||||||
@@ -297,3 +295,4 @@ void AskForBackup(obs_data_t *obj);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
struct SwitcherData;
|
struct SwitcherData;
|
||||||
extern SwitcherData *switcher;
|
extern SwitcherData *switcher;
|
||||||
|
SwitcherData *GetSwitcher();
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public:
|
|||||||
void SetValue(double value);
|
void SetValue(double value);
|
||||||
void SetUnit(DurationUnit u);
|
void SetUnit(DurationUnit u);
|
||||||
void SetDuration(Duration d);
|
void SetDuration(Duration d);
|
||||||
|
QDoubleSpinBox *SpinBox() { return _duration; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void _DurationChanged(double value);
|
void _DurationChanged(double value);
|
||||||
|
|||||||
@@ -15,15 +15,16 @@ enum class AudioAction {
|
|||||||
|
|
||||||
class MacroActionAudio : public MacroAction {
|
class MacroActionAudio : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionAudio(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionAudio>();
|
return std::make_shared<MacroActionAudio>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSWeakSource _audioSource;
|
OBSWeakSource _audioSource;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "macro.hpp"
|
#include "macro.hpp"
|
||||||
|
|
||||||
struct MacroActionInfo {
|
struct MacroActionInfo {
|
||||||
using TCreateMethod = std::shared_ptr<MacroAction> (*)();
|
using TCreateMethod = std::shared_ptr<MacroAction> (*)(Macro *m);
|
||||||
using TCreateWidgetMethod = QWidget *(*)(QWidget *parent,
|
using TCreateWidgetMethod = QWidget *(*)(QWidget *parent,
|
||||||
std::shared_ptr<MacroAction>);
|
std::shared_ptr<MacroAction>);
|
||||||
TCreateMethod _createFunc = nullptr;
|
TCreateMethod _createFunc = nullptr;
|
||||||
@@ -14,7 +14,8 @@ class MacroActionFactory {
|
|||||||
public:
|
public:
|
||||||
MacroActionFactory() = delete;
|
MacroActionFactory() = delete;
|
||||||
static bool Register(const std::string &id, MacroActionInfo);
|
static bool Register(const std::string &id, MacroActionInfo);
|
||||||
static std::shared_ptr<MacroAction> Create(const std::string &id);
|
static std::shared_ptr<MacroAction> Create(const std::string &id,
|
||||||
|
Macro *m);
|
||||||
static QWidget *CreateWidget(const std::string &id, QWidget *parent,
|
static QWidget *CreateWidget(const std::string &id, QWidget *parent,
|
||||||
std::shared_ptr<MacroAction> action);
|
std::shared_ptr<MacroAction> action);
|
||||||
static auto GetActionTypes() { return _methods; }
|
static auto GetActionTypes() { return _methods; }
|
||||||
|
|||||||
@@ -11,15 +11,16 @@ enum class FileAction {
|
|||||||
|
|
||||||
class MacroActionFile : public MacroAction {
|
class MacroActionFile : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionFile(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionFile>();
|
return std::make_shared<MacroActionFile>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string _file = obs_module_text("AdvSceneSwitcher.enterPath");
|
std::string _file = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||||
|
|||||||
@@ -11,15 +11,16 @@ enum class FilterAction {
|
|||||||
|
|
||||||
class MacroActionFilter : public MacroAction {
|
class MacroActionFilter : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionFilter(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionFilter>();
|
return std::make_shared<MacroActionFilter>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSWeakSource _source;
|
OBSWeakSource _source;
|
||||||
|
|||||||
@@ -8,14 +8,15 @@
|
|||||||
|
|
||||||
class MacroActionHotkey : public MacroAction {
|
class MacroActionHotkey : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionHotkey(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionHotkey>();
|
return std::make_shared<MacroActionHotkey>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSWeakSource _HotkeySource;
|
OBSWeakSource _HotkeySource;
|
||||||
|
|||||||
@@ -9,19 +9,21 @@ enum class PerformMacroAction {
|
|||||||
UNPAUSE,
|
UNPAUSE,
|
||||||
RESET_COUNTER,
|
RESET_COUNTER,
|
||||||
RUN,
|
RUN,
|
||||||
|
STOP,
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroActionMacro : public MacroRefAction {
|
class MacroActionMacro : public MacroRefAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionMacro(Macro *m) : MacroRefAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionMacro>();
|
return std::make_shared<MacroActionMacro>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformMacroAction _action = PerformMacroAction::PAUSE;
|
PerformMacroAction _action = PerformMacroAction::PAUSE;
|
||||||
|
|||||||
@@ -15,15 +15,16 @@ enum class MediaAction {
|
|||||||
|
|
||||||
class MacroActionMedia : public MacroAction {
|
class MacroActionMedia : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionMedia(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionMedia>();
|
return std::make_shared<MacroActionMedia>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSWeakSource _mediaSource;
|
OBSWeakSource _mediaSource;
|
||||||
|
|||||||
@@ -1,28 +1,32 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
|
#include "file-selection.hpp"
|
||||||
|
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
#include <QHBoxLayout>
|
#include <QLabel>
|
||||||
|
|
||||||
enum class PluginStateAction {
|
enum class PluginStateAction {
|
||||||
STOP,
|
STOP,
|
||||||
NO_MATCH_BEHAVIOUR,
|
NO_MATCH_BEHAVIOUR,
|
||||||
|
IMPORT_SETTINGS,
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroActionPluginState : public MacroAction {
|
class MacroActionPluginState : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionPluginState(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionPluginState>();
|
return std::make_shared<MacroActionPluginState>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginStateAction _action = PluginStateAction::STOP;
|
PluginStateAction _action = PluginStateAction::STOP;
|
||||||
int _value = 0;
|
int _value = 0;
|
||||||
|
std::string _settingsPath;
|
||||||
OBSWeakSource _scene;
|
OBSWeakSource _scene;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -51,15 +55,17 @@ private slots:
|
|||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
void ValueChanged(int value);
|
void ValueChanged(int value);
|
||||||
void SceneChanged(const QString &text);
|
void SceneChanged(const QString &text);
|
||||||
|
void PathChanged(const QString &text);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
QComboBox *_values;
|
QComboBox *_values;
|
||||||
QComboBox *_scenes;
|
QComboBox *_scenes;
|
||||||
|
FileSelection *_settings;
|
||||||
|
QLabel *_settingsWarning;
|
||||||
std::shared_ptr<MacroActionPluginState> _entryData;
|
std::shared_ptr<MacroActionPluginState> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetWidgetVisibility(PluginStateAction, int);
|
void SetWidgetVisibility();
|
||||||
QHBoxLayout *_mainLayout;
|
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,15 +4,16 @@
|
|||||||
|
|
||||||
class MacroActionPreviewScene : public MacroAction {
|
class MacroActionPreviewScene : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionPreviewScene(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionPreviewScene>();
|
return std::make_shared<MacroActionPreviewScene>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
|
|||||||
52
src/headers/macro-action-profile.hpp
Normal file
52
src/headers/macro-action-profile.hpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "macro-action-edit.hpp"
|
||||||
|
|
||||||
|
class MacroActionProfile : public MacroAction {
|
||||||
|
public:
|
||||||
|
MacroActionProfile(Macro *m) : MacroAction(m) {}
|
||||||
|
bool PerformAction();
|
||||||
|
void LogAction();
|
||||||
|
bool Save(obs_data_t *obj);
|
||||||
|
bool Load(obs_data_t *obj);
|
||||||
|
std::string GetShortDesc();
|
||||||
|
std::string GetId() { return id; };
|
||||||
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
|
{
|
||||||
|
return std::make_shared<MacroActionProfile>(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string _profile;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool _registered;
|
||||||
|
static const std::string id;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroActionProfileEdit : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroActionProfileEdit(
|
||||||
|
QWidget *parent,
|
||||||
|
std::shared_ptr<MacroActionProfile> entryData = nullptr);
|
||||||
|
void UpdateEntryData();
|
||||||
|
static QWidget *Create(QWidget *parent,
|
||||||
|
std::shared_ptr<MacroAction> action)
|
||||||
|
{
|
||||||
|
return new MacroActionProfileEdit(
|
||||||
|
parent,
|
||||||
|
std::dynamic_pointer_cast<MacroActionProfile>(action));
|
||||||
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ProfileChanged(const QString &text);
|
||||||
|
signals:
|
||||||
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QComboBox *_profiles;
|
||||||
|
std::shared_ptr<MacroActionProfile> _entryData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _loading = true;
|
||||||
|
};
|
||||||
@@ -4,19 +4,19 @@
|
|||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QDialog>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
class MacroActionRandom : public MultiMacroRefAction {
|
class MacroActionRandom : public MultiMacroRefAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionRandom(Macro *m) : MultiMacroRefAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionRandom>();
|
return std::make_shared<MacroActionRandom>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add weights to each macro ...
|
// TODO: add weights to each macro ...
|
||||||
@@ -28,17 +28,6 @@ private:
|
|||||||
static const std::string id;
|
static const std::string id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroDialog : public QDialog {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
MacroDialog(QWidget *parent);
|
|
||||||
static bool AskForMacro(QWidget *parent, std::string ¯oName);
|
|
||||||
|
|
||||||
private:
|
|
||||||
MacroSelection *_macroSelection;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MacroActionRandomEdit : public QWidget {
|
class MacroActionRandomEdit : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
@@ -13,14 +13,15 @@ enum class RecordAction {
|
|||||||
|
|
||||||
class MacroActionRecord : public MacroAction {
|
class MacroActionRecord : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionRecord(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionRecord>();
|
return std::make_shared<MacroActionRecord>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordAction _action = RecordAction::STOP;
|
RecordAction _action = RecordAction::STOP;
|
||||||
|
|||||||
@@ -14,14 +14,15 @@ enum class ReplayBufferAction {
|
|||||||
|
|
||||||
class MacroActionReplayBuffer : public MacroAction {
|
class MacroActionReplayBuffer : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionReplayBuffer(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionReplayBuffer>();
|
return std::make_shared<MacroActionReplayBuffer>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReplayBufferAction _action = ReplayBufferAction::STOP;
|
ReplayBufferAction _action = ReplayBufferAction::STOP;
|
||||||
|
|||||||
@@ -9,15 +9,16 @@
|
|||||||
|
|
||||||
class MacroActionRun : public MacroAction {
|
class MacroActionRun : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionRun(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionRun>();
|
return std::make_shared<MacroActionRun>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string _path = obs_module_text("AdvSceneSwitcher.enterPath");
|
std::string _path = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||||
|
|||||||
53
src/headers/macro-action-scene-collection.hpp
Normal file
53
src/headers/macro-action-scene-collection.hpp
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "macro-action-edit.hpp"
|
||||||
|
|
||||||
|
class MacroActionSceneCollection : public MacroAction {
|
||||||
|
public:
|
||||||
|
MacroActionSceneCollection(Macro *m) : MacroAction(m) {}
|
||||||
|
bool PerformAction();
|
||||||
|
void LogAction();
|
||||||
|
bool Save(obs_data_t *obj);
|
||||||
|
bool Load(obs_data_t *obj);
|
||||||
|
std::string GetShortDesc();
|
||||||
|
std::string GetId() { return id; };
|
||||||
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
|
{
|
||||||
|
return std::make_shared<MacroActionSceneCollection>(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string _sceneCollection;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool _registered;
|
||||||
|
static const std::string id;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroActionSceneCollectionEdit : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroActionSceneCollectionEdit(
|
||||||
|
QWidget *parent,
|
||||||
|
std::shared_ptr<MacroActionSceneCollection> entryData = nullptr);
|
||||||
|
void UpdateEntryData();
|
||||||
|
static QWidget *Create(QWidget *parent,
|
||||||
|
std::shared_ptr<MacroAction> action)
|
||||||
|
{
|
||||||
|
return new MacroActionSceneCollectionEdit(
|
||||||
|
parent,
|
||||||
|
std::dynamic_pointer_cast<MacroActionSceneCollection>(
|
||||||
|
action));
|
||||||
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void SceneCollectionChanged(const QString &text);
|
||||||
|
signals:
|
||||||
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QComboBox *_sceneCollections;
|
||||||
|
std::shared_ptr<MacroActionSceneCollection> _entryData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _loading = true;
|
||||||
|
};
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <QSpinBox>
|
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "scene-selection.hpp"
|
#include "scene-selection.hpp"
|
||||||
|
#include "scene-item-selection.hpp"
|
||||||
|
|
||||||
|
#include <QSpinBox>
|
||||||
|
|
||||||
enum class SceneOrderAction {
|
enum class SceneOrderAction {
|
||||||
MOVE_UP,
|
MOVE_UP,
|
||||||
@@ -13,19 +15,20 @@ enum class SceneOrderAction {
|
|||||||
|
|
||||||
class MacroActionSceneOrder : public MacroAction {
|
class MacroActionSceneOrder : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionSceneOrder(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionSceneOrder>();
|
return std::make_shared<MacroActionSceneOrder>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
OBSWeakSource _source;
|
SceneItemSelection _source;
|
||||||
SceneOrderAction _action = SceneOrderAction::MOVE_UP;
|
SceneOrderAction _action = SceneOrderAction::MOVE_UP;
|
||||||
int _position = 0;
|
int _position = 0;
|
||||||
|
|
||||||
@@ -53,7 +56,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void SourceChanged(const QString &text);
|
void SourceChanged(const SceneItemSelection &);
|
||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
void PositionChanged(int value);
|
void PositionChanged(int value);
|
||||||
signals:
|
signals:
|
||||||
@@ -61,7 +64,7 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
QComboBox *_sources;
|
SceneItemSelectionWidget *_sources;
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
QSpinBox *_position;
|
QSpinBox *_position;
|
||||||
std::shared_ptr<MacroActionSceneOrder> _entryData;
|
std::shared_ptr<MacroActionSceneOrder> _entryData;
|
||||||
|
|||||||
@@ -3,14 +3,15 @@
|
|||||||
|
|
||||||
class MacroActionSceneSwap : public MacroAction {
|
class MacroActionSceneSwap : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionSceneSwap(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionSceneSwap>();
|
return std::make_shared<MacroActionSceneSwap>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "switch-generic.hpp"
|
#include "scene-selection.hpp"
|
||||||
|
#include "transition-selection.hpp"
|
||||||
#include "duration-control.hpp"
|
#include "duration-control.hpp"
|
||||||
|
|
||||||
// TODO: Switch to using SceneSelection class and widget instead
|
#include <QCheckBox>
|
||||||
|
|
||||||
class MacroActionSwitchScene : public MacroAction, public SceneSwitcherEntry {
|
class MacroActionSwitchScene : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionSwitchScene(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
@@ -14,11 +16,14 @@ public:
|
|||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
|
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionSwitchScene>();
|
return std::make_shared<MacroActionSwitchScene>(m);
|
||||||
}
|
}
|
||||||
|
SceneSelection _scene;
|
||||||
|
TransitionSelection _transition;
|
||||||
Duration _duration;
|
Duration _duration;
|
||||||
|
bool _blockUntilTransitionDone = true;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *getType() { return "MacroActionSwitchScene"; }
|
const char *getType() { return "MacroActionSwitchScene"; }
|
||||||
@@ -27,7 +32,7 @@ private:
|
|||||||
static const std::string id;
|
static const std::string id;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroActionSwitchSceneEdit : public SwitchWidget {
|
class MacroActionSwitchSceneEdit : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -44,12 +49,21 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void SceneChanged(const SceneSelection &);
|
||||||
|
void TransitionChanged(const TransitionSelection &);
|
||||||
void DurationChanged(double seconds);
|
void DurationChanged(double seconds);
|
||||||
void ChangeHeaderInfo(const QString &);
|
void BlockUntilTransitionDoneChanged(int state);
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
SceneSelectionWidget *_scenes;
|
||||||
|
TransitionSelectionWidget *_transitions;
|
||||||
DurationSelection *_duration;
|
DurationSelection *_duration;
|
||||||
|
QCheckBox *_blockUntilTransitionDone;
|
||||||
|
|
||||||
std::shared_ptr<MacroActionSwitchScene> _entryData;
|
std::shared_ptr<MacroActionSwitchScene> _entryData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,26 +1,29 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "scene-selection.hpp"
|
#include "scene-selection.hpp"
|
||||||
|
#include "scene-item-selection.hpp"
|
||||||
|
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
class MacroActionSceneTransform : public MacroAction {
|
class MacroActionSceneTransform : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionSceneTransform(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionSceneTransform>();
|
return std::make_shared<MacroActionSceneTransform>(m);
|
||||||
}
|
}
|
||||||
std::string GetSettings();
|
std::string GetSettings();
|
||||||
void SetSettings(std::string &);
|
void SetSettings(std::string &);
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
OBSWeakSource _source;
|
SceneItemSelection _source;
|
||||||
struct obs_transform_info _info = {};
|
struct obs_transform_info _info = {};
|
||||||
struct obs_sceneitem_crop _crop = {};
|
struct obs_sceneitem_crop _crop = {};
|
||||||
|
|
||||||
@@ -48,7 +51,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void SourceChanged(const QString &text);
|
void SourceChanged(const SceneItemSelection &);
|
||||||
void GetSettingsClicked();
|
void GetSettingsClicked();
|
||||||
void SettingsChanged();
|
void SettingsChanged();
|
||||||
signals:
|
signals:
|
||||||
@@ -56,7 +59,7 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
QComboBox *_sources;
|
SceneItemSelectionWidget *_sources;
|
||||||
QPushButton *_getSettings;
|
QPushButton *_getSettings;
|
||||||
QPlainTextEdit *_settings;
|
QPlainTextEdit *_settings;
|
||||||
std::shared_ptr<MacroActionSceneTransform> _entryData;
|
std::shared_ptr<MacroActionSceneTransform> _entryData;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <QSpinBox>
|
|
||||||
#include "macro-action-edit.hpp"
|
#include "macro-action-edit.hpp"
|
||||||
#include "scene-selection.hpp"
|
#include "scene-selection.hpp"
|
||||||
|
#include "scene-item-selection.hpp"
|
||||||
|
|
||||||
|
#include <QSpinBox>
|
||||||
|
|
||||||
enum class SceneVisibilityAction {
|
enum class SceneVisibilityAction {
|
||||||
SHOW,
|
SHOW,
|
||||||
@@ -15,20 +17,21 @@ enum class SceneItemSourceType {
|
|||||||
|
|
||||||
class MacroActionSceneVisibility : public MacroAction {
|
class MacroActionSceneVisibility : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionSceneVisibility(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionSceneVisibility>();
|
return std::make_shared<MacroActionSceneVisibility>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
SceneItemSourceType _sourceType = SceneItemSourceType::SOURCE;
|
SceneItemSourceType _sourceType = SceneItemSourceType::SOURCE;
|
||||||
OBSWeakSource _source;
|
SceneItemSelection _source;
|
||||||
std::string _sourceGroup = "";
|
std::string _sourceGroup = "";
|
||||||
SceneVisibilityAction _action = SceneVisibilityAction::SHOW;
|
SceneVisibilityAction _action = SceneVisibilityAction::SHOW;
|
||||||
|
|
||||||
@@ -57,7 +60,8 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void SourceTypeChanged(int value);
|
void SourceTypeChanged(int value);
|
||||||
void SourceChanged(const QString &text);
|
void SourceChanged(const SceneItemSelection &);
|
||||||
|
void SourceGroupChanged(const QString &text);
|
||||||
void ActionChanged(int value);
|
void ActionChanged(int value);
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
@@ -65,11 +69,14 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
QComboBox *_sourceTypes;
|
QComboBox *_sourceTypes;
|
||||||
QComboBox *_sources;
|
SceneItemSelectionWidget *_sources;
|
||||||
|
QComboBox *_sourceGroups;
|
||||||
QComboBox *_actions;
|
QComboBox *_actions;
|
||||||
std::shared_ptr<MacroActionSceneVisibility> _entryData;
|
std::shared_ptr<MacroActionSceneVisibility> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
QHBoxLayout *_mainLayout;
|
QHBoxLayout *_mainLayout;
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
|
|
||||||
class MacroActionScreenshot : public MacroAction {
|
class MacroActionScreenshot : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionScreenshot(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionScreenshot>();
|
return std::make_shared<MacroActionScreenshot>(m);
|
||||||
}
|
}
|
||||||
OBSWeakSource _source;
|
OBSWeakSource _source;
|
||||||
|
|
||||||
|
|||||||
77
src/headers/macro-action-sequence.hpp
Normal file
77
src/headers/macro-action-sequence.hpp
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "macro-action-edit.hpp"
|
||||||
|
#include "macro-selection.hpp"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
class MacroActionSequence : public MultiMacroRefAction {
|
||||||
|
public:
|
||||||
|
MacroActionSequence(Macro *m) : MultiMacroRefAction(m) {}
|
||||||
|
bool PerformAction();
|
||||||
|
void LogAction();
|
||||||
|
bool Save(obs_data_t *obj);
|
||||||
|
bool Load(obs_data_t *obj);
|
||||||
|
std::string GetId() { return id; };
|
||||||
|
MacroRef GetNextMacro(bool advance = true);
|
||||||
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
|
{
|
||||||
|
return std::make_shared<MacroActionSequence>(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _restart = true;
|
||||||
|
MacroRef _lastSequenceMacro;
|
||||||
|
int _lastIdx = -1;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool _registered;
|
||||||
|
static const std::string id;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroActionSequenceEdit : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroActionSequenceEdit(
|
||||||
|
QWidget *parent,
|
||||||
|
std::shared_ptr<MacroActionSequence> entryData = nullptr);
|
||||||
|
void UpdateEntryData();
|
||||||
|
static QWidget *Create(QWidget *parent,
|
||||||
|
std::shared_ptr<MacroAction> action)
|
||||||
|
{
|
||||||
|
return new MacroActionSequenceEdit(
|
||||||
|
parent,
|
||||||
|
std::dynamic_pointer_cast<MacroActionSequence>(action));
|
||||||
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void MacroRemove(const QString &name);
|
||||||
|
void MacroRename(const QString &oldName, const QString &newName);
|
||||||
|
void Add();
|
||||||
|
void Remove();
|
||||||
|
void Up();
|
||||||
|
void Down();
|
||||||
|
void ContinueFromClicked();
|
||||||
|
void RestartChanged(int state);
|
||||||
|
void UpdateStatusLine();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::shared_ptr<MacroActionSequence> _entryData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int FindEntry(const std::string ¯o);
|
||||||
|
void SetMacroListSize();
|
||||||
|
|
||||||
|
QListWidget *_macroList;
|
||||||
|
QPushButton *_add;
|
||||||
|
QPushButton *_remove;
|
||||||
|
QPushButton *_up;
|
||||||
|
QPushButton *_down;
|
||||||
|
QPushButton *_continueFrom;
|
||||||
|
QCheckBox *_restart;
|
||||||
|
QLabel *_statusLine;
|
||||||
|
QTimer _statusTimer;
|
||||||
|
bool _loading = true;
|
||||||
|
};
|
||||||
@@ -14,15 +14,16 @@ enum class SourceAction {
|
|||||||
|
|
||||||
class MacroActionSource : public MacroAction {
|
class MacroActionSource : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionSource(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionSource>();
|
return std::make_shared<MacroActionSource>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSWeakSource _source;
|
OBSWeakSource _source;
|
||||||
|
|||||||
@@ -13,14 +13,15 @@ enum class StreamAction {
|
|||||||
|
|
||||||
class MacroActionStream : public MacroAction {
|
class MacroActionStream : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionStream(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionStream>();
|
return std::make_shared<MacroActionStream>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamAction _action = StreamAction::STOP;
|
StreamAction _action = StreamAction::STOP;
|
||||||
|
|||||||
@@ -5,14 +5,15 @@
|
|||||||
|
|
||||||
class MacroActionSystray : public MacroAction {
|
class MacroActionSystray : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionSystray(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionSystray>();
|
return std::make_shared<MacroActionSystray>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string _msg = "";
|
std::string _msg = "";
|
||||||
|
|||||||
@@ -15,15 +15,16 @@ enum class TimerAction {
|
|||||||
|
|
||||||
class MacroActionTimer : public MacroRefAction {
|
class MacroActionTimer : public MacroRefAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionTimer(Macro *m) : MacroRefAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionTimer>();
|
return std::make_shared<MacroActionTimer>(m);
|
||||||
}
|
}
|
||||||
Duration _duration;
|
Duration _duration;
|
||||||
TimerAction _actionType = TimerAction::PAUSE;
|
TimerAction _actionType = TimerAction::PAUSE;
|
||||||
|
|||||||
@@ -8,15 +8,16 @@
|
|||||||
|
|
||||||
class MacroActionTransition : public MacroAction {
|
class MacroActionTransition : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionTransition(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionTransition>();
|
return std::make_shared<MacroActionTransition>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _setDuration = true;
|
bool _setDuration = true;
|
||||||
|
|||||||
@@ -13,14 +13,15 @@ enum class VCamAction {
|
|||||||
|
|
||||||
class MacroActionVCam : public MacroAction {
|
class MacroActionVCam : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionVCam(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
void LogAction();
|
void LogAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionVCam>();
|
return std::make_shared<MacroActionVCam>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
VCamAction _action = VCamAction::STOP;
|
VCamAction _action = VCamAction::STOP;
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ enum class WaitType {
|
|||||||
|
|
||||||
class MacroActionWait : public MacroAction {
|
class MacroActionWait : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroActionWait(Macro *m) : MacroAction(m) {}
|
||||||
bool PerformAction();
|
bool PerformAction();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroAction> Create()
|
static std::shared_ptr<MacroAction> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroActionWait>();
|
return std::make_shared<MacroActionWait>(m);
|
||||||
}
|
}
|
||||||
Duration _duration;
|
Duration _duration;
|
||||||
Duration _duration2;
|
Duration _duration2;
|
||||||
|
|||||||
@@ -6,22 +6,39 @@
|
|||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
enum class AudioCondition {
|
enum class AudioConditionCheckType {
|
||||||
|
OUTPUT_VOLUME,
|
||||||
|
CONFIGURED_VOLUME,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class AudioOutputCondition {
|
||||||
ABOVE,
|
ABOVE,
|
||||||
BELOW,
|
BELOW,
|
||||||
|
// TODO: To be removed
|
||||||
|
MUTE,
|
||||||
|
UNMUTE,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class AudioVolumeCondition {
|
||||||
|
ABOVE,
|
||||||
|
EXACT,
|
||||||
|
BELOW,
|
||||||
|
MUTE,
|
||||||
|
UNMUTE,
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroConditionAudio : public MacroCondition {
|
class MacroConditionAudio : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionAudio(Macro *m) : MacroCondition(m) {}
|
||||||
~MacroConditionAudio();
|
~MacroConditionAudio();
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionAudio>();
|
return std::make_shared<MacroConditionAudio>(m);
|
||||||
}
|
}
|
||||||
static void SetVolumeLevel(void *data,
|
static void SetVolumeLevel(void *data,
|
||||||
const float magnitude[MAX_AUDIO_CHANNELS],
|
const float magnitude[MAX_AUDIO_CHANNELS],
|
||||||
@@ -31,10 +48,16 @@ public:
|
|||||||
|
|
||||||
OBSWeakSource _audioSource;
|
OBSWeakSource _audioSource;
|
||||||
int _volume = 0;
|
int _volume = 0;
|
||||||
AudioCondition _condition = AudioCondition::ABOVE;
|
AudioConditionCheckType _checkType =
|
||||||
|
AudioConditionCheckType::OUTPUT_VOLUME;
|
||||||
|
AudioOutputCondition _outputCondition = AudioOutputCondition::ABOVE;
|
||||||
|
AudioVolumeCondition _volumeCondition = AudioVolumeCondition::ABOVE;
|
||||||
obs_volmeter_t *_volmeter = nullptr;
|
obs_volmeter_t *_volmeter = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool CheckOutputCondition();
|
||||||
|
bool CheckVolumeCondition();
|
||||||
|
|
||||||
float _peak = -std::numeric_limits<float>::infinity();
|
float _peak = -std::numeric_limits<float>::infinity();
|
||||||
static bool _registered;
|
static bool _registered;
|
||||||
static const std::string id;
|
static const std::string id;
|
||||||
@@ -61,10 +84,13 @@ private slots:
|
|||||||
void SourceChanged(const QString &text);
|
void SourceChanged(const QString &text);
|
||||||
void VolumeThresholdChanged(int vol);
|
void VolumeThresholdChanged(int vol);
|
||||||
void ConditionChanged(int cond);
|
void ConditionChanged(int cond);
|
||||||
|
void CheckTypeChanged(int cond);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
QComboBox *_checkTypes;
|
||||||
QComboBox *_audioSources;
|
QComboBox *_audioSources;
|
||||||
QComboBox *_condition;
|
QComboBox *_condition;
|
||||||
QSpinBox *_volume;
|
QSpinBox *_volume;
|
||||||
@@ -72,5 +98,7 @@ protected:
|
|||||||
std::shared_ptr<MacroConditionAudio> _entryData;
|
std::shared_ptr<MacroConditionAudio> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SetWidgetVisibility();
|
||||||
|
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,13 +14,14 @@ enum class CursorCondition {
|
|||||||
|
|
||||||
class MacroConditionCursor : public MacroCondition {
|
class MacroConditionCursor : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionCursor(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionCursor>();
|
return std::make_shared<MacroConditionCursor>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorCondition _condition = CursorCondition::REGION;
|
CursorCondition _condition = CursorCondition::REGION;
|
||||||
|
|||||||
@@ -15,14 +15,15 @@ enum class DateCondition {
|
|||||||
|
|
||||||
class MacroConditionDate : public MacroCondition {
|
class MacroConditionDate : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionDate(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionDate>();
|
return std::make_shared<MacroConditionDate>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime _dateTime;
|
QDateTime _dateTime;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "macro.hpp"
|
#include "macro.hpp"
|
||||||
|
|
||||||
struct MacroConditionInfo {
|
struct MacroConditionInfo {
|
||||||
using TCreateMethod = std::shared_ptr<MacroCondition> (*)();
|
using TCreateMethod = std::shared_ptr<MacroCondition> (*)(Macro *m);
|
||||||
using TCreateWidgetMethod =
|
using TCreateWidgetMethod =
|
||||||
QWidget *(*)(QWidget *parent, std::shared_ptr<MacroCondition>);
|
QWidget *(*)(QWidget *parent, std::shared_ptr<MacroCondition>);
|
||||||
TCreateMethod _createFunc = nullptr;
|
TCreateMethod _createFunc = nullptr;
|
||||||
@@ -15,7 +15,8 @@ class MacroConditionFactory {
|
|||||||
public:
|
public:
|
||||||
MacroConditionFactory() = delete;
|
MacroConditionFactory() = delete;
|
||||||
static bool Register(const std::string &, MacroConditionInfo);
|
static bool Register(const std::string &, MacroConditionInfo);
|
||||||
static std::shared_ptr<MacroCondition> Create(const std::string &);
|
static std::shared_ptr<MacroCondition> Create(const std::string &,
|
||||||
|
Macro *m);
|
||||||
static QWidget *CreateWidget(const std::string &id, QWidget *parent,
|
static QWidget *CreateWidget(const std::string &id, QWidget *parent,
|
||||||
std::shared_ptr<MacroCondition>);
|
std::shared_ptr<MacroCondition>);
|
||||||
static auto GetConditionTypes() { return _methods; }
|
static auto GetConditionTypes() { return _methods; }
|
||||||
|
|||||||
@@ -17,14 +17,15 @@ enum class FileType {
|
|||||||
|
|
||||||
class MacroConditionFile : public MacroCondition {
|
class MacroConditionFile : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionFile(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionFile>();
|
return std::make_shared<MacroConditionFile>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string _file = obs_module_text("AdvSceneSwitcher.enterPath");
|
std::string _file = obs_module_text("AdvSceneSwitcher.enterPath");
|
||||||
|
|||||||
@@ -14,14 +14,15 @@ enum class FilterCondition {
|
|||||||
|
|
||||||
class MacroConditionFilter : public MacroCondition {
|
class MacroConditionFilter : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionFilter(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionFilter>();
|
return std::make_shared<MacroConditionFilter>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSWeakSource _source;
|
OBSWeakSource _source;
|
||||||
|
|||||||
@@ -5,15 +5,15 @@
|
|||||||
|
|
||||||
class MacroConditionHotkey : public MacroCondition {
|
class MacroConditionHotkey : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
MacroConditionHotkey();
|
MacroConditionHotkey(Macro *m);
|
||||||
~MacroConditionHotkey();
|
~MacroConditionHotkey();
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionHotkey>();
|
return std::make_shared<MacroConditionHotkey>(m);
|
||||||
}
|
}
|
||||||
void SetPressed() { _pressed = true; }
|
void SetPressed() { _pressed = true; }
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,14 @@
|
|||||||
|
|
||||||
class MacroConditionIdle : public MacroCondition {
|
class MacroConditionIdle : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionIdle(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionIdle>();
|
return std::make_shared<MacroConditionIdle>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration _duration;
|
Duration _duration;
|
||||||
|
|||||||
@@ -21,14 +21,15 @@ enum class CounterCondition {
|
|||||||
|
|
||||||
class MacroConditionMacro : public MacroRefCondition {
|
class MacroConditionMacro : public MacroRefCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionMacro(Macro *m) : MacroRefCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionMacro>();
|
return std::make_shared<MacroConditionMacro>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroConditionMacroType _type = MacroConditionMacroType::STATE;
|
MacroConditionMacroType _type = MacroConditionMacroType::STATE;
|
||||||
|
|||||||
@@ -43,15 +43,16 @@ enum class MediaSourceType {
|
|||||||
|
|
||||||
class MacroConditionMedia : public MacroCondition {
|
class MacroConditionMedia : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionMedia(Macro *m) : MacroCondition(m) {}
|
||||||
~MacroConditionMedia();
|
~MacroConditionMedia();
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionMedia>();
|
return std::make_shared<MacroConditionMedia>(m);
|
||||||
}
|
}
|
||||||
void ClearSignalHandler();
|
void ClearSignalHandler();
|
||||||
void ResetSignalHandler();
|
void ResetSignalHandler();
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ enum class PluginStateCondition {
|
|||||||
|
|
||||||
class MacroConditionPluginState : public MacroCondition {
|
class MacroConditionPluginState : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionPluginState(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionPluginState>();
|
return std::make_shared<MacroConditionPluginState>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginStateCondition _condition = PluginStateCondition::SCENESWITCHED;
|
PluginStateCondition _condition = PluginStateCondition::SCENESWITCHED;
|
||||||
|
|||||||
@@ -6,14 +6,15 @@
|
|||||||
|
|
||||||
class MacroConditionProcess : public MacroCondition {
|
class MacroConditionProcess : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionProcess(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionProcess>();
|
return std::make_shared<MacroConditionProcess>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string _process;
|
std::string _process;
|
||||||
|
|||||||
@@ -11,13 +11,14 @@ enum class RecordState {
|
|||||||
|
|
||||||
class MacroConditionRecord : public MacroCondition {
|
class MacroConditionRecord : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionRecord(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionRecord>();
|
return std::make_shared<MacroConditionRecord>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordState _recordState = RecordState::STOP;
|
RecordState _recordState = RecordState::STOP;
|
||||||
|
|||||||
@@ -13,13 +13,14 @@ enum class ReplayBufferState {
|
|||||||
|
|
||||||
class MacroConditionReplayBuffer : public MacroCondition {
|
class MacroConditionReplayBuffer : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionReplayBuffer(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionReplayBuffer>();
|
return std::make_shared<MacroConditionReplayBuffer>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReplayBufferState _state = ReplayBufferState::STOP;
|
ReplayBufferState _state = ReplayBufferState::STOP;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro.hpp"
|
#include "macro.hpp"
|
||||||
#include "scene-selection.hpp"
|
#include "scene-selection.hpp"
|
||||||
|
#include "scene-item-selection.hpp"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
@@ -13,19 +14,20 @@ enum class SceneOrderCondition {
|
|||||||
|
|
||||||
class MacroConditionSceneOrder : public MacroCondition {
|
class MacroConditionSceneOrder : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionSceneOrder(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionSceneOrder>();
|
return std::make_shared<MacroConditionSceneOrder>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
OBSWeakSource _source;
|
SceneItemSelection _source;
|
||||||
OBSWeakSource _source2;
|
SceneItemSelection _source2;
|
||||||
int _position = 0;
|
int _position = 0;
|
||||||
SceneOrderCondition _condition = SceneOrderCondition::ABOVE;
|
SceneOrderCondition _condition = SceneOrderCondition::ABOVE;
|
||||||
|
|
||||||
@@ -53,8 +55,8 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void SourceChanged(const QString &text);
|
void SourceChanged(const SceneItemSelection &);
|
||||||
void Source2Changed(const QString &text);
|
void Source2Changed(const SceneItemSelection &);
|
||||||
void ConditionChanged(int cond);
|
void ConditionChanged(int cond);
|
||||||
void PositionChanged(int cond);
|
void PositionChanged(int cond);
|
||||||
signals:
|
signals:
|
||||||
@@ -63,8 +65,8 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
QComboBox *_conditions;
|
QComboBox *_conditions;
|
||||||
QComboBox *_sources;
|
SceneItemSelectionWidget *_sources;
|
||||||
QComboBox *_sources2;
|
SceneItemSelectionWidget *_sources2;
|
||||||
QSpinBox *_position;
|
QSpinBox *_position;
|
||||||
QLabel *_posInfo;
|
QLabel *_posInfo;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro.hpp"
|
#include "macro.hpp"
|
||||||
#include "scene-selection.hpp"
|
#include "scene-selection.hpp"
|
||||||
|
#include "scene-item-selection.hpp"
|
||||||
|
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
@@ -8,18 +9,19 @@
|
|||||||
|
|
||||||
class MacroConditionSceneTransform : public MacroCondition {
|
class MacroConditionSceneTransform : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionSceneTransform(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionSceneTransform>();
|
return std::make_shared<MacroConditionSceneTransform>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
OBSWeakSource _source;
|
SceneItemSelection _source;
|
||||||
bool _regex = false;
|
bool _regex = false;
|
||||||
std::string _settings = "";
|
std::string _settings = "";
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void SourceChanged(const QString &text);
|
void SourceChanged(const SceneItemSelection &);
|
||||||
void GetSettingsClicked();
|
void GetSettingsClicked();
|
||||||
void SettingsChanged();
|
void SettingsChanged();
|
||||||
void RegexChanged(int);
|
void RegexChanged(int);
|
||||||
@@ -57,7 +59,7 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
QComboBox *_sources;
|
SceneItemSelectionWidget *_sources;
|
||||||
QPushButton *_getSettings;
|
QPushButton *_getSettings;
|
||||||
QPlainTextEdit *_settings;
|
QPlainTextEdit *_settings;
|
||||||
QCheckBox *_regex;
|
QCheckBox *_regex;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "macro.hpp"
|
#include "macro.hpp"
|
||||||
#include "scene-selection.hpp"
|
#include "scene-selection.hpp"
|
||||||
|
#include "scene-item-selection.hpp"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
@@ -11,18 +12,19 @@ enum class SceneVisibilityCondition {
|
|||||||
|
|
||||||
class MacroConditionSceneVisibility : public MacroCondition {
|
class MacroConditionSceneVisibility : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionSceneVisibility(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionSceneVisibility>();
|
return std::make_shared<MacroConditionSceneVisibility>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
OBSWeakSource _source;
|
SceneItemSelection _source;
|
||||||
SceneVisibilityCondition _condition = SceneVisibilityCondition::SHOWN;
|
SceneVisibilityCondition _condition = SceneVisibilityCondition::SHOWN;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -49,14 +51,14 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void SourceChanged(const QString &text);
|
void SourceChanged(const SceneItemSelection &);
|
||||||
void ConditionChanged(int cond);
|
void ConditionChanged(int cond);
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
QComboBox *_sources;
|
SceneItemSelectionWidget *_sources;
|
||||||
QComboBox *_conditions;
|
QComboBox *_conditions;
|
||||||
|
|
||||||
std::shared_ptr<MacroConditionSceneVisibility> _entryData;
|
std::shared_ptr<MacroConditionSceneVisibility> _entryData;
|
||||||
|
|||||||
@@ -15,22 +15,23 @@ enum class SceneType {
|
|||||||
|
|
||||||
class MacroConditionScene : public MacroCondition {
|
class MacroConditionScene : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionScene(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionScene>();
|
return std::make_shared<MacroConditionScene>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This option is to be removed in a future version and be replaced by
|
|
||||||
// transition specific conditions
|
|
||||||
bool _waitForTransition = true;
|
|
||||||
|
|
||||||
SceneSelection _scene;
|
SceneSelection _scene;
|
||||||
SceneType _type = SceneType::CURRENT;
|
SceneType _type = SceneType::CURRENT;
|
||||||
|
// During a transition "current" scene could either stand for the scene
|
||||||
|
// being transitioned to or the scene still being transitioned away
|
||||||
|
// from.
|
||||||
|
bool _useTransitionTargetScene = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::chrono::high_resolution_clock::time_point _lastSceneChangeTime{};
|
std::chrono::high_resolution_clock::time_point _lastSceneChangeTime{};
|
||||||
@@ -57,14 +58,14 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void SceneChanged(const SceneSelection &);
|
void SceneChanged(const SceneSelection &);
|
||||||
void TypeChanged(int value);
|
void TypeChanged(int value);
|
||||||
void WaitForTransitionChanged(int state);
|
void UseTransitionTargetSceneChanged(int state);
|
||||||
signals:
|
signals:
|
||||||
void HeaderInfoChanged(const QString &);
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SceneSelectionWidget *_scenes;
|
SceneSelectionWidget *_scenes;
|
||||||
QComboBox *_sceneType;
|
QComboBox *_sceneType;
|
||||||
QCheckBox *_waitForTransition;
|
QCheckBox *_useTransitionTargetScene;
|
||||||
std::shared_ptr<MacroConditionScene> _entryData;
|
std::shared_ptr<MacroConditionScene> _entryData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -14,14 +14,15 @@ enum class SourceCondition {
|
|||||||
|
|
||||||
class MacroConditionSource : public MacroCondition {
|
class MacroConditionSource : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionSource(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionSource>();
|
return std::make_shared<MacroConditionSource>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSWeakSource _source = nullptr;
|
OBSWeakSource _source = nullptr;
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ enum class StreamState {
|
|||||||
|
|
||||||
class MacroConditionStream : public MacroCondition {
|
class MacroConditionStream : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionStream(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionStream>();
|
return std::make_shared<MacroConditionStream>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamState _streamState = StreamState::STOP;
|
StreamState _streamState = StreamState::STOP;
|
||||||
|
|||||||
66
src/headers/macro-condition-studio-mode.hpp
Normal file
66
src/headers/macro-condition-studio-mode.hpp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "macro.hpp"
|
||||||
|
#include "scene-selection.hpp"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QComboBox>
|
||||||
|
|
||||||
|
enum class StudioModeCondition {
|
||||||
|
STUDIO_MODE_ACTIVE,
|
||||||
|
STUDIO_MODE_NOT_ACTIVE,
|
||||||
|
PREVIEW_SCENE,
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroConditionStudioMode : public MacroCondition {
|
||||||
|
public:
|
||||||
|
MacroConditionStudioMode(Macro *m) : MacroCondition(m) {}
|
||||||
|
bool CheckCondition();
|
||||||
|
bool Save(obs_data_t *obj);
|
||||||
|
bool Load(obs_data_t *obj);
|
||||||
|
std::string GetShortDesc();
|
||||||
|
std::string GetId() { return id; };
|
||||||
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
|
{
|
||||||
|
return std::make_shared<MacroConditionStudioMode>(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
StudioModeCondition _condition =
|
||||||
|
StudioModeCondition::STUDIO_MODE_ACTIVE;
|
||||||
|
SceneSelection _scene;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static bool _registered;
|
||||||
|
static const std::string id;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroConditionStudioModeEdit : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroConditionStudioModeEdit(
|
||||||
|
QWidget *parent,
|
||||||
|
std::shared_ptr<MacroConditionStudioMode> cond = nullptr);
|
||||||
|
void UpdateEntryData();
|
||||||
|
static QWidget *Create(QWidget *parent,
|
||||||
|
std::shared_ptr<MacroCondition> cond)
|
||||||
|
{
|
||||||
|
return new MacroConditionStudioModeEdit(
|
||||||
|
parent,
|
||||||
|
std::dynamic_pointer_cast<MacroConditionStudioMode>(
|
||||||
|
cond));
|
||||||
|
}
|
||||||
|
private slots:
|
||||||
|
void ConditionChanged(int cond);
|
||||||
|
void SceneChanged(const SceneSelection &);
|
||||||
|
signals:
|
||||||
|
void HeaderInfoChanged(const QString &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QComboBox *_condition;
|
||||||
|
SceneSelectionWidget *_scenes;
|
||||||
|
std::shared_ptr<MacroConditionStudioMode> _entryData;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetWidgetVisibility();
|
||||||
|
bool _loading = true;
|
||||||
|
};
|
||||||
@@ -17,13 +17,14 @@ enum class TimerType {
|
|||||||
|
|
||||||
class MacroConditionTimer : public MacroCondition {
|
class MacroConditionTimer : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionTimer(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionTimer>();
|
return std::make_shared<MacroConditionTimer>(m);
|
||||||
}
|
}
|
||||||
void Pause();
|
void Pause();
|
||||||
void Continue();
|
void Continue();
|
||||||
|
|||||||
@@ -18,14 +18,15 @@ enum class TransitionCondition {
|
|||||||
|
|
||||||
class MacroConditionTransition : public MacroCondition {
|
class MacroConditionTransition : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionTransition(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionTransition>();
|
return std::make_shared<MacroConditionTransition>(m);
|
||||||
}
|
}
|
||||||
void ConnectToTransitionSignals();
|
void ConnectToTransitionSignals();
|
||||||
void DisconnectTransitionSignals();
|
void DisconnectTransitionSignals();
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ enum class VCamState {
|
|||||||
|
|
||||||
class MacroConditionVCam : public MacroCondition {
|
class MacroConditionVCam : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionVCam(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionVCam>();
|
return std::make_shared<MacroConditionVCam>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
VCamState _state = VCamState::STOP;
|
VCamState _state = VCamState::STOP;
|
||||||
|
|||||||
@@ -6,14 +6,15 @@
|
|||||||
|
|
||||||
class MacroConditionWindow : public MacroCondition {
|
class MacroConditionWindow : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroConditionWindow(Macro *m) : MacroCondition(m) {}
|
||||||
bool CheckCondition();
|
bool CheckCondition();
|
||||||
bool Save(obs_data_t *obj);
|
bool Save(obs_data_t *obj);
|
||||||
bool Load(obs_data_t *obj);
|
bool Load(obs_data_t *obj);
|
||||||
std::string GetShortDesc();
|
std::string GetShortDesc();
|
||||||
std::string GetId() { return id; };
|
std::string GetId() { return id; };
|
||||||
static std::shared_ptr<MacroCondition> Create()
|
static std::shared_ptr<MacroCondition> Create(Macro *m)
|
||||||
{
|
{
|
||||||
return std::make_shared<MacroConditionWindow>();
|
return std::make_shared<MacroConditionWindow>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -2,8 +2,12 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <obs.hpp>
|
#include <obs.hpp>
|
||||||
|
|
||||||
|
class Macro;
|
||||||
|
|
||||||
class MacroSegment {
|
class MacroSegment {
|
||||||
public:
|
public:
|
||||||
|
MacroSegment(Macro *m) : _macro(m) {}
|
||||||
|
Macro *GetMacro() { return _macro; }
|
||||||
void SetIndex(int idx) { _idx = idx; }
|
void SetIndex(int idx) { _idx = idx; }
|
||||||
int GetIndex() { return _idx; }
|
int GetIndex() { return _idx; }
|
||||||
void SetCollapsed(bool collapsed) { _collapsed = collapsed; }
|
void SetCollapsed(bool collapsed) { _collapsed = collapsed; }
|
||||||
@@ -16,6 +20,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
int _idx = 0;
|
int _idx = 0;
|
||||||
bool _collapsed = false;
|
bool _collapsed = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Macro *_macro = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Section;
|
class Section;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
class Macro;
|
class Macro;
|
||||||
|
|
||||||
@@ -9,9 +10,22 @@ class MacroSelection : public QComboBox {
|
|||||||
public:
|
public:
|
||||||
MacroSelection(QWidget *parent);
|
MacroSelection(QWidget *parent);
|
||||||
void SetCurrentMacro(Macro *);
|
void SetCurrentMacro(Macro *);
|
||||||
|
void HideSelectedMacro(); // Macro currently being edited
|
||||||
|
void ShowAllMacros();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void MacroAdd(const QString &name);
|
void MacroAdd(const QString &name);
|
||||||
void MacroRemove(const QString &name);
|
void MacroRemove(const QString &name);
|
||||||
void MacroRename(const QString &oldName, const QString &newName);
|
void MacroRename(const QString &oldName, const QString &newName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MacroSelectionDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MacroSelectionDialog(QWidget *parent);
|
||||||
|
static bool AskForMacro(QWidget *parent, std::string ¯oName);
|
||||||
|
|
||||||
|
private:
|
||||||
|
MacroSelection *_macroSelection;
|
||||||
|
};
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ struct LogicTypeInfo {
|
|||||||
|
|
||||||
class MacroCondition : public MacroSegment {
|
class MacroCondition : public MacroSegment {
|
||||||
public:
|
public:
|
||||||
|
MacroCondition(Macro *m) : MacroSegment(m) {}
|
||||||
virtual bool CheckCondition() = 0;
|
virtual bool CheckCondition() = 0;
|
||||||
virtual bool Save(obs_data_t *obj) = 0;
|
virtual bool Save(obs_data_t *obj) = 0;
|
||||||
virtual bool Load(obs_data_t *obj) = 0;
|
virtual bool Load(obs_data_t *obj) = 0;
|
||||||
@@ -61,6 +62,7 @@ private:
|
|||||||
|
|
||||||
class MacroAction : public MacroSegment {
|
class MacroAction : public MacroSegment {
|
||||||
public:
|
public:
|
||||||
|
MacroAction(Macro *m) : MacroSegment(m) {}
|
||||||
virtual bool PerformAction() = 0;
|
virtual bool PerformAction() = 0;
|
||||||
virtual bool Save(obs_data_t *obj) = 0;
|
virtual bool Save(obs_data_t *obj) = 0;
|
||||||
virtual bool Load(obs_data_t *obj) = 0;
|
virtual bool Load(obs_data_t *obj) = 0;
|
||||||
@@ -73,7 +75,8 @@ public:
|
|||||||
virtual ~Macro();
|
virtual ~Macro();
|
||||||
|
|
||||||
bool CeckMatch();
|
bool CeckMatch();
|
||||||
bool PerformAction(bool forceParallel = false);
|
bool PerformAction(bool forceParallel = false,
|
||||||
|
bool ignorePause = false);
|
||||||
bool Matched() { return _matched; }
|
bool Matched() { return _matched; }
|
||||||
std::string Name() { return _name; }
|
std::string Name() { return _name; }
|
||||||
void SetName(const std::string &name);
|
void SetName(const std::string &name);
|
||||||
@@ -81,8 +84,11 @@ public:
|
|||||||
bool RunInParallel() { return _runInParallel; }
|
bool RunInParallel() { return _runInParallel; }
|
||||||
void SetPaused(bool pause = true);
|
void SetPaused(bool pause = true);
|
||||||
bool Paused() { return _paused; }
|
bool Paused() { return _paused; }
|
||||||
|
void SetMatchOnChange(bool onChange) { _matchOnChange = onChange; }
|
||||||
|
bool MatchOnChange() { return _matchOnChange; }
|
||||||
int GetCount() { return _count; };
|
int GetCount() { return _count; };
|
||||||
void ResetCount() { _count = 0; };
|
void ResetCount() { _count = 0; };
|
||||||
|
void Stop() { _stop = true; }
|
||||||
std::deque<std::shared_ptr<MacroCondition>> &Conditions()
|
std::deque<std::shared_ptr<MacroCondition>> &Conditions()
|
||||||
{
|
{
|
||||||
return _conditions;
|
return _conditions;
|
||||||
@@ -105,20 +111,23 @@ private:
|
|||||||
void ClearHotkeys();
|
void ClearHotkeys();
|
||||||
void SetHotkeysDesc();
|
void SetHotkeysDesc();
|
||||||
void ResetTimers();
|
void ResetTimers();
|
||||||
void RunActions(bool &ret);
|
void RunActions(bool &ret, bool ignorePause);
|
||||||
void RunActions();
|
void RunActions(bool ignorePause);
|
||||||
|
|
||||||
std::string _name = "";
|
std::string _name = "";
|
||||||
std::deque<std::shared_ptr<MacroCondition>> _conditions;
|
std::deque<std::shared_ptr<MacroCondition>> _conditions;
|
||||||
std::deque<std::shared_ptr<MacroAction>> _actions;
|
std::deque<std::shared_ptr<MacroAction>> _actions;
|
||||||
bool _runInParallel = false;
|
bool _runInParallel = false;
|
||||||
bool _matched = false;
|
bool _matched = false;
|
||||||
|
bool _lastMatched = false;
|
||||||
|
bool _matchOnChange = false;
|
||||||
bool _paused = false;
|
bool _paused = false;
|
||||||
int _count = 0;
|
int _count = 0;
|
||||||
obs_hotkey_id _pauseHotkey = OBS_INVALID_HOTKEY_ID;
|
obs_hotkey_id _pauseHotkey = OBS_INVALID_HOTKEY_ID;
|
||||||
obs_hotkey_id _unpauseHotkey = OBS_INVALID_HOTKEY_ID;
|
obs_hotkey_id _unpauseHotkey = OBS_INVALID_HOTKEY_ID;
|
||||||
obs_hotkey_id _togglePauseHotkey = OBS_INVALID_HOTKEY_ID;
|
obs_hotkey_id _togglePauseHotkey = OBS_INVALID_HOTKEY_ID;
|
||||||
|
|
||||||
|
bool _die = false;
|
||||||
bool _stop = false;
|
bool _stop = false;
|
||||||
bool _done = true;
|
bool _done = true;
|
||||||
std::thread _thread;
|
std::thread _thread;
|
||||||
@@ -146,18 +155,21 @@ private:
|
|||||||
|
|
||||||
class MacroRefCondition : public MacroCondition {
|
class MacroRefCondition : public MacroCondition {
|
||||||
public:
|
public:
|
||||||
|
MacroRefCondition(Macro *m) : MacroCondition(m) {}
|
||||||
void ResolveMacroRef();
|
void ResolveMacroRef();
|
||||||
MacroRef _macro;
|
MacroRef _macro;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MacroRefAction : public MacroAction {
|
class MacroRefAction : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MacroRefAction(Macro *m) : MacroAction(m) {}
|
||||||
void ResolveMacroRef();
|
void ResolveMacroRef();
|
||||||
MacroRef _macro;
|
MacroRef _macro;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MultiMacroRefAction : public MacroAction {
|
class MultiMacroRefAction : public MacroAction {
|
||||||
public:
|
public:
|
||||||
|
MultiMacroRefAction(Macro *m) : MacroAction(m) {}
|
||||||
void ResolveMacroRef();
|
void ResolveMacroRef();
|
||||||
std::vector<MacroRef> _macros;
|
std::vector<MacroRef> _macros;
|
||||||
};
|
};
|
||||||
|
|||||||
59
src/headers/scene-item-selection.hpp
Normal file
59
src/headers/scene-item-selection.hpp
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <obs-data.h>
|
||||||
|
|
||||||
|
#include "scene-selection.hpp"
|
||||||
|
#include "utility.hpp"
|
||||||
|
|
||||||
|
class SceneItemSelection {
|
||||||
|
public:
|
||||||
|
void Save(obs_data_t *obj, const char *name = "sceneItem",
|
||||||
|
const char *targetName = "sceneItemTarget",
|
||||||
|
const char *idxName = "sceneItemIdx");
|
||||||
|
void Load(obs_data_t *obj, const char *name = "sceneItem",
|
||||||
|
const char *targetName = "sceneItemTarget",
|
||||||
|
const char *idxName = "sceneItemIdx");
|
||||||
|
|
||||||
|
enum class Target { ALL, ANY, INDIVIDUAL };
|
||||||
|
Target GetType() { return _target; }
|
||||||
|
std::vector<obs_scene_item *> GetSceneItems(SceneSelection &s);
|
||||||
|
std::string ToString();
|
||||||
|
|
||||||
|
private:
|
||||||
|
OBSWeakSource _sceneItem;
|
||||||
|
Target _target = Target::ALL;
|
||||||
|
int _idx = 0;
|
||||||
|
friend class SceneItemSelectionWidget;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SceneItemSelectionWidget : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum class AllSelectionType { ALL, ANY };
|
||||||
|
SceneItemSelectionWidget(
|
||||||
|
QWidget *parent, bool allSelection = true,
|
||||||
|
AllSelectionType allType = AllSelectionType::ALL);
|
||||||
|
void SetSceneItem(const SceneItemSelection &);
|
||||||
|
void SetScene(const SceneSelection &);
|
||||||
|
void SetShowAll(bool);
|
||||||
|
void SetShowAllSelectionType(AllSelectionType t);
|
||||||
|
signals:
|
||||||
|
void SceneItemChanged(const SceneItemSelection &);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void SceneChanged(const SceneSelection &);
|
||||||
|
void SelectionChanged(const QString &name);
|
||||||
|
void IdxChanged(int);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetupIdxSelection(int);
|
||||||
|
|
||||||
|
QComboBox *_sceneItems;
|
||||||
|
QComboBox *_idx;
|
||||||
|
|
||||||
|
SceneSelection _scene;
|
||||||
|
OBSWeakSource _sceneItem;
|
||||||
|
bool _showAll = false;
|
||||||
|
AllSelectionType _allType = AllSelectionType::ALL;
|
||||||
|
};
|
||||||
41
src/headers/status-control.hpp
Normal file
41
src/headers/status-control.hpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QDockWidget>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <obs-data.h>
|
||||||
|
|
||||||
|
class StatusControl : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
StatusControl(QWidget *parent = 0, bool noLayout = false);
|
||||||
|
QPushButton *Button() { return _button; }
|
||||||
|
QLabel *StatusLabel() { return _status; }
|
||||||
|
QLabel *StatusPrefixLabel() { return _statusPrefix; }
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ButtonClicked();
|
||||||
|
void UpdateStatus();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetStopped();
|
||||||
|
void SetStarted();
|
||||||
|
|
||||||
|
QPushButton *_button;
|
||||||
|
QLabel *_status;
|
||||||
|
QLabel *_statusPrefix;
|
||||||
|
QTimer _timer;
|
||||||
|
QMetaObject::Connection _pulse;
|
||||||
|
|
||||||
|
bool _setToStopped = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
class StatusDock : public QDockWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
StatusDock(QWidget *parent = 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
void SetupDock();
|
||||||
@@ -12,6 +12,8 @@ Most of this code is based on https://github.com/Palakis/obs-websocket
|
|||||||
#include <QtCore/QThreadPool>
|
#include <QtCore/QThreadPool>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
#include <functional>
|
||||||
|
#include <QRunnable>
|
||||||
|
|
||||||
#include <websocketpp/config/asio_no_tls_client.hpp>
|
#include <websocketpp/config/asio_no_tls_client.hpp>
|
||||||
#include <websocketpp/config/asio_no_tls.hpp>
|
#include <websocketpp/config/asio_no_tls.hpp>
|
||||||
@@ -117,3 +119,16 @@ enum class ClientStatus {
|
|||||||
CONNECTED,
|
CONNECTED,
|
||||||
FAIL,
|
FAIL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace Compatability {
|
||||||
|
// Reimplement QRunnable for std::function. Retrocompatability for Qt < 5.15
|
||||||
|
class StdFunctionRunnable : public QRunnable {
|
||||||
|
std::function<void()> cb;
|
||||||
|
|
||||||
|
public:
|
||||||
|
StdFunctionRunnable(std::function<void()> func);
|
||||||
|
void run() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
QRunnable *CreateFunctionRunnable(std::function<void()> func);
|
||||||
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ struct SwitcherData {
|
|||||||
SwitcherThread *th = nullptr;
|
SwitcherThread *th = nullptr;
|
||||||
|
|
||||||
bool settingsWindowOpened = false;
|
bool settingsWindowOpened = false;
|
||||||
|
bool firstBoot = true;
|
||||||
|
|
||||||
std::condition_variable cv;
|
std::condition_variable cv;
|
||||||
std::mutex m;
|
std::mutex m;
|
||||||
@@ -117,6 +118,7 @@ struct SwitcherData {
|
|||||||
std::deque<std::shared_ptr<Macro>> macros;
|
std::deque<std::shared_ptr<Macro>> macros;
|
||||||
std::condition_variable macroWaitCv;
|
std::condition_variable macroWaitCv;
|
||||||
std::atomic_bool abortMacroWait = {false};
|
std::atomic_bool abortMacroWait = {false};
|
||||||
|
std::condition_variable macroTransitionCv;
|
||||||
bool macroSceneSwitched = false;
|
bool macroSceneSwitched = false;
|
||||||
bool replayBufferSaved = false;
|
bool replayBufferSaved = false;
|
||||||
|
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ std::string getSourceSettings(OBSWeakSource ws);
|
|||||||
void setSourceSettings(obs_source_t *s, const std::string &settings);
|
void setSourceSettings(obs_source_t *s, const std::string &settings);
|
||||||
bool compareSourceSettings(const OBSWeakSource &source,
|
bool compareSourceSettings(const OBSWeakSource &source,
|
||||||
const std::string &settings, bool regex);
|
const std::string &settings, bool regex);
|
||||||
std::vector<obs_scene_item *> getSceneItemsWithName(OBSScene scene,
|
std::vector<obs_scene_item *> getSceneItemsWithName(obs_scene_t *scene,
|
||||||
std::string &name);
|
std::string &name);
|
||||||
std::string getDataFilePath(const std::string &file);
|
std::string getDataFilePath(const std::string &file);
|
||||||
bool matchJson(const std::string &json1, const std::string &json2,
|
bool matchJson(const std::string &json1, const std::string &json2,
|
||||||
bool useRegex);
|
bool useRegex);
|
||||||
QString formatJsonString(std::string);
|
QString formatJsonString(std::string);
|
||||||
QString formatJsonString(const char *);
|
QString formatJsonString(QString);
|
||||||
QString escapeForRegex(QString &s);
|
QString escapeForRegex(QString &s);
|
||||||
void loadTransformState(obs_data_t *obj, struct obs_transform_info &info,
|
void loadTransformState(obs_data_t *obj, struct obs_transform_info &info,
|
||||||
struct obs_sceneitem_crop &crop);
|
struct obs_sceneitem_crop &crop);
|
||||||
@@ -81,4 +81,5 @@ void populateFilterSelection(QComboBox *list,
|
|||||||
void populateSceneItemSelection(QComboBox *list,
|
void populateSceneItemSelection(QComboBox *list,
|
||||||
OBSWeakSource sceneWeakSource = nullptr);
|
OBSWeakSource sceneWeakSource = nullptr);
|
||||||
void populateSceneItemSelection(QComboBox *list, SceneSelection &s);
|
void populateSceneItemSelection(QComboBox *list, SceneSelection &s);
|
||||||
void populateSourceTypeSelection(QComboBox *list);
|
void populateSourceGroupSelection(QComboBox *list);
|
||||||
|
bool windowPosValid(QPoint pos);
|
||||||
|
|||||||
@@ -4,13 +4,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
void startHotkeyFunc(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey,
|
void startHotkeyFunc(void *, obs_hotkey_id, obs_hotkey_t *, bool pressed)
|
||||||
bool pressed)
|
|
||||||
{
|
{
|
||||||
UNUSED_PARAMETER(id);
|
|
||||||
UNUSED_PARAMETER(data);
|
|
||||||
UNUSED_PARAMETER(hotkey);
|
|
||||||
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
if (!(switcher->th && switcher->th->isRunning())) {
|
if (!(switcher->th && switcher->th->isRunning())) {
|
||||||
switcher->Start();
|
switcher->Start();
|
||||||
@@ -18,13 +13,8 @@ void startHotkeyFunc(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopHotkeyFunc(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey,
|
void stopHotkeyFunc(void *, obs_hotkey_id, obs_hotkey_t *, bool pressed)
|
||||||
bool pressed)
|
|
||||||
{
|
{
|
||||||
UNUSED_PARAMETER(id);
|
|
||||||
UNUSED_PARAMETER(data);
|
|
||||||
UNUSED_PARAMETER(hotkey);
|
|
||||||
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
if (switcher->th && switcher->th->isRunning()) {
|
if (switcher->th && switcher->th->isRunning()) {
|
||||||
switcher->Stop();
|
switcher->Stop();
|
||||||
@@ -32,13 +22,9 @@ void stopHotkeyFunc(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void startStopToggleHotkeyFunc(void *data, obs_hotkey_id id,
|
void startStopToggleHotkeyFunc(void *, obs_hotkey_id, obs_hotkey_t *,
|
||||||
obs_hotkey_t *hotkey, bool pressed)
|
bool pressed)
|
||||||
{
|
{
|
||||||
UNUSED_PARAMETER(id);
|
|
||||||
UNUSED_PARAMETER(data);
|
|
||||||
UNUSED_PARAMETER(hotkey);
|
|
||||||
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
if (switcher->th && switcher->th->isRunning()) {
|
if (switcher->th && switcher->th->isRunning()) {
|
||||||
switcher->Stop();
|
switcher->Stop();
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ bool MacroActionAudio::PerformAction()
|
|||||||
obs_source_set_muted(s, false);
|
obs_source_set_muted(s, false);
|
||||||
break;
|
break;
|
||||||
case AudioAction::SOURCE_VOLUME:
|
case AudioAction::SOURCE_VOLUME:
|
||||||
if (_fade) {
|
if (_fade && _duration.seconds != 0) {
|
||||||
startSourceFade(_duration, (float)_volume / 100.0f,
|
startSourceFade(_duration, (float)_volume / 100.0f,
|
||||||
_audioSource);
|
_audioSource);
|
||||||
} else {
|
} else {
|
||||||
@@ -125,7 +125,7 @@ bool MacroActionAudio::PerformAction()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AudioAction::MASTER_VOLUME:
|
case AudioAction::MASTER_VOLUME:
|
||||||
if (_fade) {
|
if (_fade && _duration.seconds != 0) {
|
||||||
startMasterFade(_duration, (float)_volume / 100.0f);
|
startMasterFade(_duration, (float)_volume / 100.0f);
|
||||||
} else {
|
} else {
|
||||||
obs_set_master_volume((float)_volume / 100.0f);
|
obs_set_master_volume((float)_volume / 100.0f);
|
||||||
@@ -259,6 +259,7 @@ void MacroActionAudioEdit::SetWidgetVisibility()
|
|||||||
setLayoutVisible(_fadeLayout, hasVolumeControl(_entryData->_action));
|
setLayoutVisible(_fadeLayout, hasVolumeControl(_entryData->_action));
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionAudioEdit::UpdateEntryData()
|
void MacroActionAudioEdit::UpdateEntryData()
|
||||||
{
|
{
|
||||||
if (!_entryData) {
|
if (!_entryData) {
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ bool MacroActionFactory::Register(const std::string &id, MacroActionInfo info)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<MacroAction> MacroActionFactory::Create(const std::string &id)
|
std::shared_ptr<MacroAction> MacroActionFactory::Create(const std::string &id,
|
||||||
|
Macro *m)
|
||||||
{
|
{
|
||||||
if (auto it = _methods.find(id); it != _methods.end())
|
if (auto it = _methods.find(id); it != _methods.end())
|
||||||
return it->second._createFunc();
|
return it->second._createFunc(m);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -57,6 +58,7 @@ static inline void populateActionSelection(QComboBox *list)
|
|||||||
for (auto entry : MacroActionFactory::GetActionTypes()) {
|
for (auto entry : MacroActionFactory::GetActionTypes()) {
|
||||||
list->addItem(obs_module_text(entry.second._name.c_str()));
|
list->addItem(obs_module_text(entry.second._name.c_str()));
|
||||||
}
|
}
|
||||||
|
list->model()->sort(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroActionEdit::MacroActionEdit(QWidget *parent,
|
MacroActionEdit::MacroActionEdit(QWidget *parent,
|
||||||
@@ -93,12 +95,13 @@ void MacroActionEdit::ActionSelectionChanged(const QString &text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto idx = _entryData->get()->GetIndex();
|
auto idx = _entryData->get()->GetIndex();
|
||||||
|
auto macro = _entryData->get()->GetMacro();
|
||||||
std::string id = MacroActionFactory::GetIdByName(text);
|
std::string id = MacroActionFactory::GetIdByName(text);
|
||||||
HeaderInfoChanged("");
|
HeaderInfoChanged("");
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->reset();
|
_entryData->reset();
|
||||||
*_entryData = MacroActionFactory::Create(id);
|
*_entryData = MacroActionFactory::Create(id, macro);
|
||||||
(*_entryData)->SetIndex(idx);
|
(*_entryData)->SetIndex(idx);
|
||||||
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
||||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||||
@@ -140,12 +143,12 @@ void AdvSceneSwitcher::AddMacroAction(int idx)
|
|||||||
if (idx - 1 >= 0) {
|
if (idx - 1 >= 0) {
|
||||||
id = macro->Actions().at(idx - 1)->GetId();
|
id = macro->Actions().at(idx - 1)->GetId();
|
||||||
} else {
|
} else {
|
||||||
MacroActionSwitchScene temp;
|
MacroActionSwitchScene temp(nullptr);
|
||||||
id = temp.GetId();
|
id = temp.GetId();
|
||||||
}
|
}
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
macro->Actions().emplace(macro->Actions().begin() + idx,
|
macro->Actions().emplace(macro->Actions().begin() + idx,
|
||||||
MacroActionFactory::Create(id));
|
MacroActionFactory::Create(id, macro));
|
||||||
if (idx - 1 >= 0) {
|
if (idx - 1 >= 0) {
|
||||||
auto data = obs_data_create();
|
auto data = obs_data_create();
|
||||||
macro->Actions().at(idx - 1)->Save(data);
|
macro->Actions().at(idx - 1)->Save(data);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const static std::map<PerformMacroAction, std::string> actionTypes = {
|
|||||||
{PerformMacroAction::RESET_COUNTER,
|
{PerformMacroAction::RESET_COUNTER,
|
||||||
"AdvSceneSwitcher.action.macro.type.resetCounter"},
|
"AdvSceneSwitcher.action.macro.type.resetCounter"},
|
||||||
{PerformMacroAction::RUN, "AdvSceneSwitcher.action.macro.type.run"},
|
{PerformMacroAction::RUN, "AdvSceneSwitcher.action.macro.type.run"},
|
||||||
|
{PerformMacroAction::STOP, "AdvSceneSwitcher.action.macro.type.stop"},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MacroActionMacro::PerformAction()
|
bool MacroActionMacro::PerformAction()
|
||||||
@@ -37,6 +38,9 @@ bool MacroActionMacro::PerformAction()
|
|||||||
case PerformMacroAction::RUN:
|
case PerformMacroAction::RUN:
|
||||||
_macro->PerformAction();
|
_macro->PerformAction();
|
||||||
break;
|
break;
|
||||||
|
case PerformMacroAction::STOP:
|
||||||
|
_macro->Stop();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -63,6 +67,9 @@ void MacroActionMacro::LogAction()
|
|||||||
vblog(LOG_INFO, "run nested macro \"%s\"",
|
vblog(LOG_INFO, "run nested macro \"%s\"",
|
||||||
_macro->Name().c_str());
|
_macro->Name().c_str());
|
||||||
break;
|
break;
|
||||||
|
case PerformMacroAction::STOP:
|
||||||
|
vblog(LOG_INFO, "stopped macro \"%s\"", _macro->Name().c_str());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -137,6 +144,10 @@ void MacroActionMacroEdit::UpdateEntryData()
|
|||||||
}
|
}
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
_macros->SetCurrentMacro(_entryData->_macro.get());
|
_macros->SetCurrentMacro(_entryData->_macro.get());
|
||||||
|
if (_entryData->_action == PerformMacroAction::RUN ||
|
||||||
|
_entryData->_action == PerformMacroAction::STOP) {
|
||||||
|
_macros->HideSelectedMacro();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMacroEdit::MacroChanged(const QString &text)
|
void MacroActionMacroEdit::MacroChanged(const QString &text)
|
||||||
@@ -159,11 +170,17 @@ void MacroActionMacroEdit::ActionChanged(int value)
|
|||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_action = static_cast<PerformMacroAction>(value);
|
_entryData->_action = static_cast<PerformMacroAction>(value);
|
||||||
|
|
||||||
|
if (_entryData->_action == PerformMacroAction::RUN ||
|
||||||
|
_entryData->_action == PerformMacroAction::STOP) {
|
||||||
|
_macros->HideSelectedMacro();
|
||||||
|
} else {
|
||||||
|
_macros->ShowAllMacros();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionMacroEdit::MacroRemove(const QString &name)
|
void MacroActionMacroEdit::MacroRemove(const QString &)
|
||||||
{
|
{
|
||||||
UNUSED_PARAMETER(name);
|
|
||||||
if (_entryData) {
|
if (_entryData) {
|
||||||
_entryData->_macro.UpdateRef();
|
_entryData->_macro.UpdateRef();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ const static std::map<PluginStateAction, std::string> actionTypes = {
|
|||||||
"AdvSceneSwitcher.action.pluginState.type.stop"},
|
"AdvSceneSwitcher.action.pluginState.type.stop"},
|
||||||
{PluginStateAction::NO_MATCH_BEHAVIOUR,
|
{PluginStateAction::NO_MATCH_BEHAVIOUR,
|
||||||
"AdvSceneSwitcher.action.pluginState.type.noMatch"},
|
"AdvSceneSwitcher.action.pluginState.type.noMatch"},
|
||||||
|
{PluginStateAction::IMPORT_SETTINGS,
|
||||||
|
"AdvSceneSwitcher.action.pluginState.type.import"},
|
||||||
};
|
};
|
||||||
|
|
||||||
const static std::map<NoMatch, std::string> noMatchValues = {
|
const static std::map<NoMatch, std::string> noMatchValues = {
|
||||||
@@ -33,6 +35,19 @@ void stopPlugin()
|
|||||||
t.detach();
|
t.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void importSettings(const std::string &path)
|
||||||
|
{
|
||||||
|
if (switcher->settingsWindowOpened) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
obs_data_t *obj = obs_data_create_from_json_file(path.c_str());
|
||||||
|
if (!obj) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switcher->loadSettings(obj);
|
||||||
|
obs_data_release(obj);
|
||||||
|
}
|
||||||
|
|
||||||
void setNoMatchBehaviour(int value, OBSWeakSource &scene)
|
void setNoMatchBehaviour(int value, OBSWeakSource &scene)
|
||||||
{
|
{
|
||||||
switcher->switchIfNotMatching = static_cast<NoMatch>(value);
|
switcher->switchIfNotMatching = static_cast<NoMatch>(value);
|
||||||
@@ -50,6 +65,11 @@ bool MacroActionPluginState::PerformAction()
|
|||||||
case PluginStateAction::NO_MATCH_BEHAVIOUR:
|
case PluginStateAction::NO_MATCH_BEHAVIOUR:
|
||||||
setNoMatchBehaviour(_value, _scene);
|
setNoMatchBehaviour(_value, _scene);
|
||||||
break;
|
break;
|
||||||
|
case PluginStateAction::IMPORT_SETTINGS:
|
||||||
|
importSettings(_settingsPath);
|
||||||
|
// There is no point in continuing
|
||||||
|
// The settings will be invalid
|
||||||
|
return false;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -62,6 +82,13 @@ void MacroActionPluginState::LogAction()
|
|||||||
case PluginStateAction::STOP:
|
case PluginStateAction::STOP:
|
||||||
blog(LOG_INFO, "stop() called by macro");
|
blog(LOG_INFO, "stop() called by macro");
|
||||||
break;
|
break;
|
||||||
|
case PluginStateAction::NO_MATCH_BEHAVIOUR:
|
||||||
|
vblog(LOG_INFO, "setting no match to %d", _value);
|
||||||
|
break;
|
||||||
|
case PluginStateAction::IMPORT_SETTINGS:
|
||||||
|
vblog(LOG_INFO, "importing settings from %s",
|
||||||
|
_settingsPath.c_str());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
blog(LOG_WARNING, "ignored unknown pluginState action %d",
|
blog(LOG_WARNING, "ignored unknown pluginState action %d",
|
||||||
static_cast<int>(_action));
|
static_cast<int>(_action));
|
||||||
@@ -75,6 +102,7 @@ bool MacroActionPluginState::Save(obs_data_t *obj)
|
|||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
obs_data_set_int(obj, "value", _value);
|
obs_data_set_int(obj, "value", _value);
|
||||||
obs_data_set_string(obj, "scene", GetWeakSourceName(_scene).c_str());
|
obs_data_set_string(obj, "scene", GetWeakSourceName(_scene).c_str());
|
||||||
|
obs_data_set_string(obj, "settingsPath", _settingsPath.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +114,7 @@ bool MacroActionPluginState::Load(obs_data_t *obj)
|
|||||||
_value = obs_data_get_int(obj, "value");
|
_value = obs_data_get_int(obj, "value");
|
||||||
const char *sceneName = obs_data_get_string(obj, "scene");
|
const char *sceneName = obs_data_get_string(obj, "scene");
|
||||||
_scene = GetWeakSourceByName(sceneName);
|
_scene = GetWeakSourceByName(sceneName);
|
||||||
|
_settingsPath = obs_data_get_string(obj, "settingsPath");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +142,9 @@ MacroActionPluginStateEdit::MacroActionPluginStateEdit(
|
|||||||
_actions = new QComboBox();
|
_actions = new QComboBox();
|
||||||
_values = new QComboBox();
|
_values = new QComboBox();
|
||||||
_scenes = new QComboBox();
|
_scenes = new QComboBox();
|
||||||
|
_settings = new FileSelection();
|
||||||
|
_settingsWarning = new QLabel(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.pluginState.importWarning"));
|
||||||
|
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
populateSceneSelection(_scenes);
|
populateSceneSelection(_scenes);
|
||||||
@@ -123,12 +155,16 @@ MacroActionPluginStateEdit::MacroActionPluginStateEdit(
|
|||||||
SLOT(ValueChanged(int)));
|
SLOT(ValueChanged(int)));
|
||||||
QWidget::connect(_scenes, SIGNAL(currentTextChanged(const QString &)),
|
QWidget::connect(_scenes, SIGNAL(currentTextChanged(const QString &)),
|
||||||
this, SLOT(SceneChanged(const QString &)));
|
this, SLOT(SceneChanged(const QString &)));
|
||||||
|
QWidget::connect(_settings, SIGNAL(PathChanged(const QString &)), this,
|
||||||
|
SLOT(PathChanged(const QString &)));
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{actions}}", _actions},
|
{"{{actions}}", _actions},
|
||||||
{"{{values}}", _values},
|
{"{{values}}", _values},
|
||||||
{"{{scenes}}", _scenes},
|
{"{{scenes}}", _scenes},
|
||||||
|
{"{{settings}}", _settings},
|
||||||
|
{"{{settingsWarning}}", _settingsWarning},
|
||||||
};
|
};
|
||||||
placeWidgets(
|
placeWidgets(
|
||||||
obs_module_text("AdvSceneSwitcher.action.pluginState.entry"),
|
obs_module_text("AdvSceneSwitcher.action.pluginState.entry"),
|
||||||
@@ -149,7 +185,8 @@ void MacroActionPluginStateEdit::UpdateEntryData()
|
|||||||
populateValueSelection(_values, _entryData->_action);
|
populateValueSelection(_values, _entryData->_action);
|
||||||
_values->setCurrentIndex(_entryData->_value);
|
_values->setCurrentIndex(_entryData->_value);
|
||||||
_scenes->setCurrentText(GetWeakSourceName(_entryData->_scene).c_str());
|
_scenes->setCurrentText(GetWeakSourceName(_entryData->_scene).c_str());
|
||||||
SetWidgetVisibility(_entryData->_action, _entryData->_value);
|
_settings->SetPath(QString::fromStdString(_entryData->_settingsPath));
|
||||||
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionPluginStateEdit::ActionChanged(int value)
|
void MacroActionPluginStateEdit::ActionChanged(int value)
|
||||||
@@ -161,7 +198,7 @@ void MacroActionPluginStateEdit::ActionChanged(int value)
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_action = static_cast<PluginStateAction>(value);
|
_entryData->_action = static_cast<PluginStateAction>(value);
|
||||||
SetWidgetVisibility(_entryData->_action, _entryData->_value);
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
_values->clear();
|
_values->clear();
|
||||||
@@ -176,7 +213,7 @@ void MacroActionPluginStateEdit::ValueChanged(int value)
|
|||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_value = value;
|
_entryData->_value = value;
|
||||||
SetWidgetVisibility(_entryData->_action, _entryData->_value);
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionPluginStateEdit::SceneChanged(const QString &text)
|
void MacroActionPluginStateEdit::SceneChanged(const QString &text)
|
||||||
@@ -189,15 +226,40 @@ void MacroActionPluginStateEdit::SceneChanged(const QString &text)
|
|||||||
_entryData->_scene = GetWeakSourceByQString(text);
|
_entryData->_scene = GetWeakSourceByQString(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionPluginStateEdit::SetWidgetVisibility(PluginStateAction action,
|
void MacroActionPluginStateEdit::PathChanged(const QString &text)
|
||||||
int value)
|
|
||||||
{
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_settingsPath = text.toStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionPluginStateEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_values->hide();
|
_values->hide();
|
||||||
_scenes->hide();
|
_scenes->hide();
|
||||||
if (action == PluginStateAction::NO_MATCH_BEHAVIOUR) {
|
_settings->hide();
|
||||||
|
_settingsWarning->hide();
|
||||||
|
switch (_entryData->_action) {
|
||||||
|
case PluginStateAction::STOP:
|
||||||
|
break;
|
||||||
|
case PluginStateAction::NO_MATCH_BEHAVIOUR:
|
||||||
_values->show();
|
_values->show();
|
||||||
if ((NoMatch)value == SWITCH) {
|
if ((NoMatch)_entryData->_value == SWITCH) {
|
||||||
_scenes->show();
|
_scenes->show();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case PluginStateAction::IMPORT_SETTINGS:
|
||||||
|
_settings->show();
|
||||||
|
_settingsWarning->show();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
99
src/macro-action-profile.cpp
Normal file
99
src/macro-action-profile.cpp
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
#include "headers/macro-action-profile.hpp"
|
||||||
|
#include "headers/advanced-scene-switcher.hpp"
|
||||||
|
#include "headers/utility.hpp"
|
||||||
|
|
||||||
|
const std::string MacroActionProfile::id = "profile";
|
||||||
|
|
||||||
|
bool MacroActionProfile::_registered = MacroActionFactory::Register(
|
||||||
|
MacroActionProfile::id,
|
||||||
|
{MacroActionProfile::Create, MacroActionProfileEdit::Create,
|
||||||
|
"AdvSceneSwitcher.action.profile"});
|
||||||
|
|
||||||
|
bool MacroActionProfile::PerformAction()
|
||||||
|
{
|
||||||
|
obs_frontend_set_current_profile(_profile.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionProfile::LogAction()
|
||||||
|
{
|
||||||
|
vblog(LOG_INFO, "set profile type to \"%s\"", _profile.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionProfile::Save(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroAction::Save(obj);
|
||||||
|
obs_data_set_string(obj, "profile", _profile.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionProfile::Load(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroAction::Load(obj);
|
||||||
|
_profile = obs_data_get_string(obj, "profile");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string MacroActionProfile::GetShortDesc()
|
||||||
|
{
|
||||||
|
return _profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
void populateProfileSelection(QComboBox *box)
|
||||||
|
{
|
||||||
|
auto profiles = obs_frontend_get_profiles();
|
||||||
|
char **temp = profiles;
|
||||||
|
while (*temp) {
|
||||||
|
const char *name = *temp;
|
||||||
|
box->addItem(name);
|
||||||
|
temp++;
|
||||||
|
}
|
||||||
|
bfree(profiles);
|
||||||
|
box->model()->sort(0);
|
||||||
|
addSelectionEntry(
|
||||||
|
box, obs_module_text("AdvSceneSwitcher.selectProfile"), false);
|
||||||
|
box->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
MacroActionProfileEdit::MacroActionProfileEdit(
|
||||||
|
QWidget *parent, std::shared_ptr<MacroActionProfile> entryData)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
_profiles = new QComboBox();
|
||||||
|
populateProfileSelection(_profiles);
|
||||||
|
QWidget::connect(_profiles, SIGNAL(currentTextChanged(const QString &)),
|
||||||
|
this, SLOT(ProfileChanged(const QString &)));
|
||||||
|
|
||||||
|
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||||
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
|
{"{{profiles}}", _profiles},
|
||||||
|
};
|
||||||
|
placeWidgets(obs_module_text("AdvSceneSwitcher.action.profile.entry"),
|
||||||
|
mainLayout, widgetPlaceholders);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
_entryData = entryData;
|
||||||
|
UpdateEntryData();
|
||||||
|
_loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionProfileEdit::UpdateEntryData()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_profiles->setCurrentText(QString::fromStdString(_entryData->_profile));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionProfileEdit::ProfileChanged(const QString &text)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_profile = text.toStdString();
|
||||||
|
emit HeaderInfoChanged(
|
||||||
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
#include "headers/macro-action-random.hpp"
|
#include "headers/macro-action-random.hpp"
|
||||||
#include "headers/advanced-scene-switcher.hpp"
|
#include "headers/advanced-scene-switcher.hpp"
|
||||||
#include "headers/name-dialog.hpp"
|
|
||||||
#include "headers/utility.hpp"
|
#include "headers/utility.hpp"
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
const std::string MacroActionRandom::id = "random";
|
const std::string MacroActionRandom::id = "random";
|
||||||
@@ -13,8 +11,8 @@ bool MacroActionRandom::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionRandom::Create, MacroActionRandomEdit::Create,
|
{MacroActionRandom::Create, MacroActionRandomEdit::Create,
|
||||||
"AdvSceneSwitcher.action.random"});
|
"AdvSceneSwitcher.action.random"});
|
||||||
|
|
||||||
std::vector<MacroRef> getPossibleMacros(std::vector<MacroRef> ¯os,
|
std::vector<MacroRef> getNextMacro(std::vector<MacroRef> ¯os,
|
||||||
MacroRef &lastRandomMacro)
|
MacroRef &lastRandomMacro)
|
||||||
{
|
{
|
||||||
std::vector<MacroRef> res;
|
std::vector<MacroRef> res;
|
||||||
if (macros.size() == 1) {
|
if (macros.size() == 1) {
|
||||||
@@ -40,7 +38,7 @@ bool MacroActionRandom::PerformAction()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto macros = getPossibleMacros(_macros, lastRandomMacro);
|
auto macros = getNextMacro(_macros, lastRandomMacro);
|
||||||
if (macros.size() == 0) {
|
if (macros.size() == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -190,7 +188,7 @@ void MacroActionRandomEdit::AddMacro()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string macroName;
|
std::string macroName;
|
||||||
bool accepted = MacroDialog::AskForMacro(this, macroName);
|
bool accepted = MacroSelectionDialog::AskForMacro(this, macroName);
|
||||||
|
|
||||||
if (!accepted || macroName.empty()) {
|
if (!accepted || macroName.empty()) {
|
||||||
return;
|
return;
|
||||||
@@ -262,47 +260,3 @@ void MacroActionRandomEdit::SetMacroListSize()
|
|||||||
setHeightToContentHeight(_macroList);
|
setHeightToContentHeight(_macroList);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroDialog::MacroDialog(QWidget *)
|
|
||||||
{
|
|
||||||
setModal(true);
|
|
||||||
setWindowModality(Qt::WindowModality::ApplicationModal);
|
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
||||||
setMinimumWidth(350);
|
|
||||||
setMinimumHeight(70);
|
|
||||||
|
|
||||||
QDialogButtonBox *buttonbox = new QDialogButtonBox(
|
|
||||||
QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
|
||||||
|
|
||||||
buttonbox->setCenterButtons(true);
|
|
||||||
connect(buttonbox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
|
||||||
connect(buttonbox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
|
||||||
|
|
||||||
_macroSelection = new MacroSelection(window());
|
|
||||||
auto *selectionLayout = new QHBoxLayout;
|
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
|
||||||
{"{{macroSelection}}", _macroSelection},
|
|
||||||
};
|
|
||||||
placeWidgets(obs_module_text("AdvSceneSwitcher.askForMacro"),
|
|
||||||
selectionLayout, widgetPlaceholders);
|
|
||||||
auto *layout = new QVBoxLayout();
|
|
||||||
layout->addLayout(selectionLayout);
|
|
||||||
layout->addWidget(buttonbox);
|
|
||||||
setLayout(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MacroDialog::AskForMacro(QWidget *parent, std::string ¯oName)
|
|
||||||
{
|
|
||||||
MacroDialog dialog(parent);
|
|
||||||
dialog.setWindowTitle(obs_module_text("AdvSceneSwitcher.windowTitle"));
|
|
||||||
|
|
||||||
if (dialog.exec() != DialogCode::Accepted) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
macroName = dialog._macroSelection->currentText().toUtf8().constData();
|
|
||||||
if (macroName == obs_module_text("AdvSceneSwitcher.selectMacro")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|||||||
117
src/macro-action-scene-collection.cpp
Normal file
117
src/macro-action-scene-collection.cpp
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
#include "headers/macro-action-scene-collection.hpp"
|
||||||
|
#include "headers/advanced-scene-switcher.hpp"
|
||||||
|
#include "headers/utility.hpp"
|
||||||
|
|
||||||
|
const std::string MacroActionSceneCollection::id = "scene_collection";
|
||||||
|
|
||||||
|
bool MacroActionSceneCollection::_registered = MacroActionFactory::Register(
|
||||||
|
MacroActionSceneCollection::id,
|
||||||
|
{MacroActionSceneCollection::Create,
|
||||||
|
MacroActionSceneCollectionEdit::Create,
|
||||||
|
"AdvSceneSwitcher.action.sceneCollection"});
|
||||||
|
|
||||||
|
bool MacroActionSceneCollection::PerformAction()
|
||||||
|
{
|
||||||
|
// Changing the scene collection will also reload the settings of the
|
||||||
|
// scene switcher, so to avoid issues of not being able to change
|
||||||
|
// settings ignore this action if the settings dialog is opened.
|
||||||
|
if (switcher->settingsWindowOpened) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
obs_frontend_set_current_scene_collection(_sceneCollection.c_str());
|
||||||
|
// It does not make sense to continue as the current settings will be
|
||||||
|
// invalid after switching scene collection.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneCollection::LogAction()
|
||||||
|
{
|
||||||
|
vblog(LOG_INFO, "set scene collection type to \"%s\"",
|
||||||
|
_sceneCollection.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSceneCollection::Save(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroAction::Save(obj);
|
||||||
|
obs_data_set_string(obj, "sceneCollection", _sceneCollection.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSceneCollection::Load(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroAction::Load(obj);
|
||||||
|
_sceneCollection = obs_data_get_string(obj, "sceneCollection");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string MacroActionSceneCollection::GetShortDesc()
|
||||||
|
{
|
||||||
|
return _sceneCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
void populateSceneCollectionSelection(QComboBox *box)
|
||||||
|
{
|
||||||
|
auto sceneCollections = obs_frontend_get_scene_collections();
|
||||||
|
char **temp = sceneCollections;
|
||||||
|
while (*temp) {
|
||||||
|
const char *name = *temp;
|
||||||
|
box->addItem(name);
|
||||||
|
temp++;
|
||||||
|
}
|
||||||
|
bfree(sceneCollections);
|
||||||
|
box->model()->sort(0);
|
||||||
|
addSelectionEntry(
|
||||||
|
box, obs_module_text("AdvSceneSwitcher.selectSceneCollection"),
|
||||||
|
false);
|
||||||
|
box->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
MacroActionSceneCollectionEdit::MacroActionSceneCollectionEdit(
|
||||||
|
QWidget *parent, std::shared_ptr<MacroActionSceneCollection> entryData)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
_sceneCollections = new QComboBox();
|
||||||
|
populateSceneCollectionSelection(_sceneCollections);
|
||||||
|
QWidget::connect(_sceneCollections,
|
||||||
|
SIGNAL(currentTextChanged(const QString &)), this,
|
||||||
|
SLOT(SceneCollectionChanged(const QString &)));
|
||||||
|
|
||||||
|
QHBoxLayout *entryLayout = new QHBoxLayout;
|
||||||
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
|
{"{{sceneCollections}}", _sceneCollections},
|
||||||
|
};
|
||||||
|
placeWidgets(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.sceneCollection.entry"),
|
||||||
|
entryLayout, widgetPlaceholders);
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addLayout(entryLayout);
|
||||||
|
mainLayout->addWidget(new QLabel(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.sceneCollection.warning")));
|
||||||
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
_entryData = entryData;
|
||||||
|
UpdateEntryData();
|
||||||
|
_loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneCollectionEdit::UpdateEntryData()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_sceneCollections->setCurrentText(
|
||||||
|
QString::fromStdString(_entryData->_sceneCollection));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneCollectionEdit::SceneCollectionChanged(const QString &text)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_sceneCollection = text.toStdString();
|
||||||
|
emit HeaderInfoChanged(
|
||||||
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
}
|
||||||
@@ -22,37 +22,77 @@ const static std::map<SceneOrderAction, std::string> actionTypes = {
|
|||||||
"AdvSceneSwitcher.action.sceneOrder.type.movePosition"},
|
"AdvSceneSwitcher.action.sceneOrder.type.movePosition"},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MacroActionSceneOrder::PerformAction()
|
void moveSceneItemsUp(std::vector<obs_scene_item *> &items)
|
||||||
{
|
{
|
||||||
auto s = obs_weak_source_get_source(_scene.GetScene());
|
// In the case of the same source being in two sequential positions
|
||||||
auto scene = obs_scene_from_source(s);
|
// moving the sources up will cause the sources to swap positions due to
|
||||||
auto name = GetWeakSourceName(_source);
|
// the order scene items are being iterated over, which is most likely
|
||||||
auto items = getSceneItemsWithName(scene, name);
|
// not the desired effect.
|
||||||
|
// Instead we reverse the order of the scene items so all scene items
|
||||||
|
// will be moved up.
|
||||||
|
std::reverse(items.begin(), items.end());
|
||||||
|
|
||||||
for (auto &i : items) {
|
for (auto &i : items) {
|
||||||
switch (_action) {
|
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_UP);
|
||||||
case SceneOrderAction::MOVE_UP:
|
|
||||||
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_UP);
|
|
||||||
break;
|
|
||||||
case SceneOrderAction::MOVE_DOWN:
|
|
||||||
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_DOWN);
|
|
||||||
break;
|
|
||||||
case SceneOrderAction::MOVE_TOP:
|
|
||||||
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_TOP);
|
|
||||||
break;
|
|
||||||
case SceneOrderAction::MOVE_BOTTOM:
|
|
||||||
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_BOTTOM);
|
|
||||||
break;
|
|
||||||
case SceneOrderAction::POSITION:
|
|
||||||
obs_sceneitem_set_order_position(i, _position);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
obs_sceneitem_release(i);
|
obs_sceneitem_release(i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
obs_source_release(s);
|
void moveSceneItemsDown(std::vector<obs_scene_item *> &items)
|
||||||
|
{
|
||||||
|
for (auto &i : items) {
|
||||||
|
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_DOWN);
|
||||||
|
obs_sceneitem_release(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveSceneItemsTop(std::vector<obs_scene_item *> &items)
|
||||||
|
{
|
||||||
|
for (auto &i : items) {
|
||||||
|
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_TOP);
|
||||||
|
obs_sceneitem_release(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveSceneItemsBottom(std::vector<obs_scene_item *> &items)
|
||||||
|
{
|
||||||
|
for (auto &i : items) {
|
||||||
|
obs_sceneitem_set_order(i, OBS_ORDER_MOVE_BOTTOM);
|
||||||
|
obs_sceneitem_release(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveSceneItemsPos(std::vector<obs_scene_item *> &items, int pos)
|
||||||
|
{
|
||||||
|
for (auto &i : items) {
|
||||||
|
obs_sceneitem_set_order_position(i, pos);
|
||||||
|
obs_sceneitem_release(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSceneOrder::PerformAction()
|
||||||
|
{
|
||||||
|
auto items = _source.GetSceneItems(_scene);
|
||||||
|
|
||||||
|
switch (_action) {
|
||||||
|
case SceneOrderAction::MOVE_UP:
|
||||||
|
moveSceneItemsUp(items);
|
||||||
|
break;
|
||||||
|
case SceneOrderAction::MOVE_DOWN:
|
||||||
|
moveSceneItemsDown(items);
|
||||||
|
break;
|
||||||
|
case SceneOrderAction::MOVE_TOP:
|
||||||
|
moveSceneItemsTop(items);
|
||||||
|
break;
|
||||||
|
case SceneOrderAction::MOVE_BOTTOM:
|
||||||
|
moveSceneItemsBottom(items);
|
||||||
|
break;
|
||||||
|
case SceneOrderAction::POSITION:
|
||||||
|
moveSceneItemsPos(items, _position);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +102,7 @@ void MacroActionSceneOrder::LogAction()
|
|||||||
if (it != actionTypes.end()) {
|
if (it != actionTypes.end()) {
|
||||||
vblog(LOG_INFO,
|
vblog(LOG_INFO,
|
||||||
"performed order action \"%s\" for source \"%s\" on scene \"%s\"",
|
"performed order action \"%s\" for source \"%s\" on scene \"%s\"",
|
||||||
it->second.c_str(), GetWeakSourceName(_source).c_str(),
|
it->second.c_str(), _source.ToString().c_str(),
|
||||||
_scene.ToString().c_str());
|
_scene.ToString().c_str());
|
||||||
} else {
|
} else {
|
||||||
blog(LOG_WARNING, "ignored unknown scene order action %d",
|
blog(LOG_WARNING, "ignored unknown scene order action %d",
|
||||||
@@ -74,7 +114,7 @@ bool MacroActionSceneOrder::Save(obs_data_t *obj)
|
|||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
_scene.Save(obj);
|
_scene.Save(obj);
|
||||||
obs_data_set_string(obj, "source", GetWeakSourceName(_source).c_str());
|
_source.Save(obj);
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
obs_data_set_int(obj, "position", _position);
|
obs_data_set_int(obj, "position", _position);
|
||||||
return true;
|
return true;
|
||||||
@@ -82,10 +122,16 @@ bool MacroActionSceneOrder::Save(obs_data_t *obj)
|
|||||||
|
|
||||||
bool MacroActionSceneOrder::Load(obs_data_t *obj)
|
bool MacroActionSceneOrder::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
|
// Convert old data format
|
||||||
|
// TODO: Remove in future version
|
||||||
|
if (obs_data_has_user_value(obj, "source")) {
|
||||||
|
auto sourceName = obs_data_get_string(obj, "source");
|
||||||
|
obs_data_set_string(obj, "sceneItem", sourceName);
|
||||||
|
}
|
||||||
|
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_scene.Load(obj);
|
_scene.Load(obj);
|
||||||
const char *sourceName = obs_data_get_string(obj, "source");
|
_source.Load(obj);
|
||||||
_source = GetWeakSourceByName(sourceName);
|
|
||||||
_action =
|
_action =
|
||||||
static_cast<SceneOrderAction>(obs_data_get_int(obj, "action"));
|
static_cast<SceneOrderAction>(obs_data_get_int(obj, "action"));
|
||||||
_position = obs_data_get_int(obj, "position");
|
_position = obs_data_get_int(obj, "position");
|
||||||
@@ -94,10 +140,10 @@ bool MacroActionSceneOrder::Load(obs_data_t *obj)
|
|||||||
|
|
||||||
std::string MacroActionSceneOrder::GetShortDesc()
|
std::string MacroActionSceneOrder::GetShortDesc()
|
||||||
{
|
{
|
||||||
if (_source) {
|
if (_source.ToString().empty()) {
|
||||||
return _scene.ToString() + " - " + GetWeakSourceName(_source);
|
return "";
|
||||||
}
|
}
|
||||||
return "";
|
return _scene.ToString() + " - " + _source.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void populateActionSelection(QComboBox *list)
|
static inline void populateActionSelection(QComboBox *list)
|
||||||
@@ -112,7 +158,7 @@ MacroActionSceneOrderEdit::MacroActionSceneOrderEdit(
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_scenes = new SceneSelectionWidget(window(), false, false, true);
|
_scenes = new SceneSelectionWidget(window(), false, false, true);
|
||||||
_sources = new QComboBox();
|
_sources = new SceneItemSelectionWidget(parent);
|
||||||
_actions = new QComboBox();
|
_actions = new QComboBox();
|
||||||
_position = new QSpinBox();
|
_position = new QSpinBox();
|
||||||
|
|
||||||
@@ -122,8 +168,11 @@ MacroActionSceneOrderEdit::MacroActionSceneOrderEdit(
|
|||||||
SLOT(ActionChanged(int)));
|
SLOT(ActionChanged(int)));
|
||||||
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
this, SLOT(SceneChanged(const SceneSelection &)));
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
QWidget::connect(_sources, SIGNAL(currentTextChanged(const QString &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
this, SLOT(SourceChanged(const QString &)));
|
_sources, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
|
QWidget::connect(_sources,
|
||||||
|
SIGNAL(SceneItemChanged(const SceneItemSelection &)),
|
||||||
|
this, SLOT(SourceChanged(const SceneItemSelection &)));
|
||||||
QWidget::connect(_position, SIGNAL(valueChanged(int)), this,
|
QWidget::connect(_position, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(PositionChanged(int)));
|
SLOT(PositionChanged(int)));
|
||||||
|
|
||||||
@@ -152,9 +201,7 @@ void MacroActionSceneOrderEdit::UpdateEntryData()
|
|||||||
|
|
||||||
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
_actions->setCurrentIndex(static_cast<int>(_entryData->_action));
|
||||||
_scenes->SetScene(_entryData->_scene);
|
_scenes->SetScene(_entryData->_scene);
|
||||||
populateSceneItemSelection(_sources, _entryData->_scene);
|
_sources->SetSceneItem(_entryData->_source);
|
||||||
_sources->setCurrentText(
|
|
||||||
GetWeakSourceName(_entryData->_source).c_str());
|
|
||||||
_position->setValue(_entryData->_position);
|
_position->setValue(_entryData->_position);
|
||||||
_position->setVisible(_entryData->_action ==
|
_position->setVisible(_entryData->_action ==
|
||||||
SceneOrderAction::POSITION);
|
SceneOrderAction::POSITION);
|
||||||
@@ -165,22 +212,19 @@ void MacroActionSceneOrderEdit::SceneChanged(const SceneSelection &s)
|
|||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
}
|
|
||||||
_sources->clear();
|
|
||||||
populateSceneItemSelection(_sources, _entryData->_scene);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneOrderEdit::SourceChanged(const QString &text)
|
void MacroActionSceneOrderEdit::SourceChanged(const SceneItemSelection &item)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_source = GetWeakSourceByQString(text);
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,75 +9,167 @@ bool MacroActionSwitchScene::_registered = MacroActionFactory::Register(
|
|||||||
{MacroActionSwitchScene::Create, MacroActionSwitchSceneEdit::Create,
|
{MacroActionSwitchScene::Create, MacroActionSwitchSceneEdit::Create,
|
||||||
"AdvSceneSwitcher.action.switchScene"});
|
"AdvSceneSwitcher.action.switchScene"});
|
||||||
|
|
||||||
|
void waitForTransitionChange(OBSWeakSource &target)
|
||||||
|
{
|
||||||
|
const int maxNrChecks = 100;
|
||||||
|
int curCheckNr = 0;
|
||||||
|
bool transitionEnded = false;
|
||||||
|
|
||||||
|
auto sceneCheckStartedOn = obs_frontend_get_current_scene();
|
||||||
|
obs_source_release(sceneCheckStartedOn);
|
||||||
|
switcher->abortMacroWait = false;
|
||||||
|
std::unique_lock<std::mutex> lock(switcher->m);
|
||||||
|
while (!transitionEnded && curCheckNr < maxNrChecks &&
|
||||||
|
!switcher->abortMacroWait) {
|
||||||
|
switcher->abortMacroWait = false;
|
||||||
|
switcher->macroTransitionCv.wait_for(
|
||||||
|
lock,
|
||||||
|
std::chrono::milliseconds(
|
||||||
|
(long long)switcher->interval),
|
||||||
|
[] { return switcher->abortMacroWait.load(); });
|
||||||
|
auto curScene = obs_frontend_get_current_scene();
|
||||||
|
obs_source_release(curScene);
|
||||||
|
transitionEnded = curScene != sceneCheckStartedOn ||
|
||||||
|
switcher->currentScene == target;
|
||||||
|
++curCheckNr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MacroActionSwitchScene::PerformAction()
|
bool MacroActionSwitchScene::PerformAction()
|
||||||
{
|
{
|
||||||
OBSWeakSource scene = getScene();
|
auto scene = _scene.GetScene();
|
||||||
switchScene({scene, transition, (int)(_duration.seconds * 1000)});
|
switchScene({scene, _transition.GetTransition(),
|
||||||
|
(int)(_duration.seconds * 1000)});
|
||||||
|
if (_blockUntilTransitionDone) {
|
||||||
|
waitForTransitionChange(scene);
|
||||||
|
return !switcher->abortMacroWait;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSwitchScene::LogAction()
|
void MacroActionSwitchScene::LogAction()
|
||||||
{
|
{
|
||||||
if (switcher->verbose) {
|
auto t = _scene.GetType();
|
||||||
logMatch();
|
auto sceneName = GetWeakSourceName(_scene.GetScene(false));
|
||||||
|
switch (t) {
|
||||||
|
case SceneSelectionType::SCENE:
|
||||||
|
vblog(LOG_INFO, "switch to scene '%s'",
|
||||||
|
_scene.ToString().c_str());
|
||||||
|
break;
|
||||||
|
case SceneSelectionType::GROUP:
|
||||||
|
vblog(LOG_INFO, "switch to scene '%s' (scene group '%s')",
|
||||||
|
sceneName.c_str(), _scene.ToString().c_str());
|
||||||
|
break;
|
||||||
|
case SceneSelectionType::PREVIOUS:
|
||||||
|
vblog(LOG_INFO, "switch to previous scene '%s'",
|
||||||
|
sceneName.c_str());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionSwitchScene::Save(obs_data_t *obj)
|
bool MacroActionSwitchScene::Save(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
SceneSwitcherEntry::save(obj);
|
_scene.Save(obj);
|
||||||
|
_transition.Save(obj);
|
||||||
_duration.Save(obj);
|
_duration.Save(obj);
|
||||||
|
obs_data_set_bool(obj, "blockUntilTransitionDone",
|
||||||
|
_blockUntilTransitionDone);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionSwitchScene::Load(obs_data_t *obj)
|
bool MacroActionSwitchScene::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
|
// Convert old data format
|
||||||
|
// TODO: Remove in future version
|
||||||
|
if (obs_data_has_user_value(obj, "targetType")) {
|
||||||
|
auto sceneName = obs_data_get_string(obj, "target");
|
||||||
|
obs_data_set_string(obj, "scene", sceneName);
|
||||||
|
auto transitionName = obs_data_get_string(obj, "transition");
|
||||||
|
bool usePreviousScene =
|
||||||
|
strcmp(sceneName, previous_scene_name) == 0;
|
||||||
|
bool useCurrentTransition =
|
||||||
|
strcmp(transitionName, current_transition_name) == 0;
|
||||||
|
obs_data_set_int(
|
||||||
|
obj, "sceneType",
|
||||||
|
(usePreviousScene)
|
||||||
|
? static_cast<int>(SceneSelectionType::PREVIOUS)
|
||||||
|
: obs_data_get_int(obj, "targetType"));
|
||||||
|
obs_data_set_int(
|
||||||
|
obj, "transitionType",
|
||||||
|
(useCurrentTransition)
|
||||||
|
? static_cast<int>(
|
||||||
|
TransitionSelectionType::CURRENT)
|
||||||
|
: static_cast<int>(
|
||||||
|
TransitionSelectionType::TRANSITION));
|
||||||
|
}
|
||||||
|
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
SceneSwitcherEntry::load(obj);
|
_scene.Load(obj);
|
||||||
|
_transition.Load(obj);
|
||||||
_duration.Load(obj);
|
_duration.Load(obj);
|
||||||
|
_blockUntilTransitionDone =
|
||||||
|
obs_data_get_bool(obj, "blockUntilTransitionDone");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MacroActionSwitchScene::GetShortDesc()
|
std::string MacroActionSwitchScene::GetShortDesc()
|
||||||
{
|
{
|
||||||
if (targetType == SwitchTargetType::Scene && scene) {
|
return _scene.ToString();
|
||||||
return GetWeakSourceName(scene);
|
|
||||||
}
|
|
||||||
if (targetType == SwitchTargetType::SceneGroup && group) {
|
|
||||||
return group->name;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
MacroActionSwitchSceneEdit::MacroActionSwitchSceneEdit(
|
||||||
QWidget *parent, std::shared_ptr<MacroActionSwitchScene> entryData)
|
QWidget *parent, std::shared_ptr<MacroActionSwitchScene> entryData)
|
||||||
: SwitchWidget(parent, entryData.get(), true, true)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
_scenes = new SceneSelectionWidget(window(), true, true);
|
||||||
|
_transitions = new TransitionSelectionWidget(this);
|
||||||
_duration = new DurationSelection(parent, false);
|
_duration = new DurationSelection(parent, false);
|
||||||
|
_blockUntilTransitionDone = new QCheckBox(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.scene.blockUntilTransitionDone"));
|
||||||
|
|
||||||
|
_duration->SpinBox()->setSpecialValueText("-");
|
||||||
|
|
||||||
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
|
QWidget::connect(_transitions,
|
||||||
|
SIGNAL(TransitionChanged(const TransitionSelection &)),
|
||||||
|
this,
|
||||||
|
SLOT(TransitionChanged(const TransitionSelection &)));
|
||||||
QWidget::connect(_duration, SIGNAL(DurationChanged(double)), this,
|
QWidget::connect(_duration, SIGNAL(DurationChanged(double)), this,
|
||||||
SLOT(DurationChanged(double)));
|
SLOT(DurationChanged(double)));
|
||||||
QWidget::connect(scenes, SIGNAL(currentTextChanged(const QString &)),
|
QWidget::connect(_blockUntilTransitionDone, SIGNAL(stateChanged(int)),
|
||||||
this, SLOT(ChangeHeaderInfo(const QString &)));
|
this, SLOT(BlockUntilTransitionDoneChanged(int)));
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
QHBoxLayout *entryLayout = new QHBoxLayout;
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{scenes}}", scenes},
|
{"{{scenes}}", _scenes},
|
||||||
{"{{transitions}}", transitions},
|
{"{{transitions}}", _transitions},
|
||||||
{"{{duration}}", _duration},
|
{"{{duration}}", _duration},
|
||||||
|
{"{{blockUntilTransitionDone}}", _blockUntilTransitionDone},
|
||||||
};
|
};
|
||||||
placeWidgets(obs_module_text("AdvSceneSwitcher.action.scene.entry"),
|
placeWidgets(obs_module_text("AdvSceneSwitcher.action.scene.entry"),
|
||||||
mainLayout, widgetPlaceholders);
|
entryLayout, widgetPlaceholders);
|
||||||
|
|
||||||
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addLayout(entryLayout);
|
||||||
|
mainLayout->addWidget(_blockUntilTransitionDone);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
_entryData = entryData;
|
_entryData = entryData;
|
||||||
|
_scenes->SetScene(_entryData->_scene);
|
||||||
|
_transitions->SetTransition(_entryData->_transition);
|
||||||
_duration->SetDuration(_entryData->_duration);
|
_duration->SetDuration(_entryData->_duration);
|
||||||
SwitchWidget::loading = false;
|
_blockUntilTransitionDone->setChecked(
|
||||||
|
_entryData->_blockUntilTransitionDone);
|
||||||
|
_loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSwitchSceneEdit::DurationChanged(double seconds)
|
void MacroActionSwitchSceneEdit::DurationChanged(double seconds)
|
||||||
{
|
{
|
||||||
if (SwitchWidget::loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,8 +177,34 @@ void MacroActionSwitchSceneEdit::DurationChanged(double seconds)
|
|||||||
_entryData->_duration.seconds = seconds;
|
_entryData->_duration.seconds = seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSwitchSceneEdit::ChangeHeaderInfo(const QString &)
|
void MacroActionSwitchSceneEdit::BlockUntilTransitionDoneChanged(int state)
|
||||||
{
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_blockUntilTransitionDone = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSwitchSceneEdit::SceneChanged(const SceneSelection &s)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_scene = s;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionSwitchSceneEdit::TransitionChanged(const TransitionSelection &t)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_transition = t;
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,13 +12,8 @@ bool MacroActionSceneTransform::_registered = MacroActionFactory::Register(
|
|||||||
|
|
||||||
bool MacroActionSceneTransform::PerformAction()
|
bool MacroActionSceneTransform::PerformAction()
|
||||||
{
|
{
|
||||||
auto s = obs_weak_source_get_source(_scene.GetScene(false));
|
auto items = _source.GetSceneItems(_scene);
|
||||||
auto scene = obs_scene_from_source(s);
|
|
||||||
auto name = GetWeakSourceName(_source);
|
|
||||||
auto items = getSceneItemsWithName(scene, name);
|
|
||||||
|
|
||||||
for (auto &item : items) {
|
for (auto &item : items) {
|
||||||
// Apply settings
|
|
||||||
obs_sceneitem_defer_update_begin(item);
|
obs_sceneitem_defer_update_begin(item);
|
||||||
obs_sceneitem_set_info(item, &_info);
|
obs_sceneitem_set_info(item, &_info);
|
||||||
obs_sceneitem_set_crop(item, &_crop);
|
obs_sceneitem_set_crop(item, &_crop);
|
||||||
@@ -26,8 +21,6 @@ bool MacroActionSceneTransform::PerformAction()
|
|||||||
|
|
||||||
obs_sceneitem_release(item);
|
obs_sceneitem_release(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_source_release(s);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,34 +28,40 @@ void MacroActionSceneTransform::LogAction()
|
|||||||
{
|
{
|
||||||
vblog(LOG_INFO,
|
vblog(LOG_INFO,
|
||||||
"performed transform action for source \"%s\" on scene \"%s\"",
|
"performed transform action for source \"%s\" on scene \"%s\"",
|
||||||
GetWeakSourceName(_source).c_str(), _scene.ToString().c_str());
|
_source.ToString().c_str(), _scene.ToString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionSceneTransform::Save(obs_data_t *obj)
|
bool MacroActionSceneTransform::Save(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
_scene.Save(obj);
|
_scene.Save(obj);
|
||||||
obs_data_set_string(obj, "source", GetWeakSourceName(_source).c_str());
|
_source.Save(obj);
|
||||||
saveTransformState(obj, _info, _crop);
|
saveTransformState(obj, _info, _crop);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroActionSceneTransform::Load(obs_data_t *obj)
|
bool MacroActionSceneTransform::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
|
// Convert old data format
|
||||||
|
// TODO: Remove in future version
|
||||||
|
if (obs_data_has_user_value(obj, "source")) {
|
||||||
|
auto sourceName = obs_data_get_string(obj, "source");
|
||||||
|
obs_data_set_string(obj, "sceneItem", sourceName);
|
||||||
|
}
|
||||||
|
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_scene.Load(obj);
|
_scene.Load(obj);
|
||||||
const char *sourceName = obs_data_get_string(obj, "source");
|
_source.Load(obj);
|
||||||
_source = GetWeakSourceByName(sourceName);
|
|
||||||
loadTransformState(obj, _info, _crop);
|
loadTransformState(obj, _info, _crop);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MacroActionSceneTransform::GetShortDesc()
|
std::string MacroActionSceneTransform::GetShortDesc()
|
||||||
{
|
{
|
||||||
if (_source) {
|
if (_source.ToString().empty()) {
|
||||||
return _scene.ToString() + " - " + GetWeakSourceName(_source);
|
return "";
|
||||||
}
|
}
|
||||||
return "";
|
return _scene.ToString() + " - " + _source.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MacroActionSceneTransform::GetSettings()
|
std::string MacroActionSceneTransform::GetSettings()
|
||||||
@@ -81,9 +80,13 @@ void MacroActionSceneTransform::SetSettings(std::string &settings)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadTransformState(data, _info, _crop);
|
loadTransformState(data, _info, _crop);
|
||||||
|
auto items = _source.GetSceneItems(_scene);
|
||||||
|
if (items.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (obs_data_has_user_value(data, "size")) {
|
if (obs_data_has_user_value(data, "size")) {
|
||||||
auto obj = obs_data_get_obj(data, "size");
|
auto obj = obs_data_get_obj(data, "size");
|
||||||
auto source = obs_weak_source_get_source(_source);
|
auto source = obs_sceneitem_get_source(items[0]);
|
||||||
if (double h = obs_data_get_double(obj, "height")) {
|
if (double h = obs_data_get_double(obj, "height")) {
|
||||||
_info.scale.y =
|
_info.scale.y =
|
||||||
h / double(obs_source_get_height(source));
|
h / double(obs_source_get_height(source));
|
||||||
@@ -93,9 +96,10 @@ void MacroActionSceneTransform::SetSettings(std::string &settings)
|
|||||||
w / double(obs_source_get_width(source));
|
w / double(obs_source_get_width(source));
|
||||||
}
|
}
|
||||||
obs_data_release(obj);
|
obs_data_release(obj);
|
||||||
obs_source_release(source);
|
|
||||||
}
|
}
|
||||||
|
for (auto item : items) {
|
||||||
|
obs_sceneitem_release(item);
|
||||||
|
}
|
||||||
obs_data_release(data);
|
obs_data_release(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,15 +108,18 @@ MacroActionSceneTransformEdit::MacroActionSceneTransformEdit(
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_scenes = new SceneSelectionWidget(window(), false, false, true);
|
_scenes = new SceneSelectionWidget(window(), false, false, true);
|
||||||
_sources = new QComboBox();
|
_sources = new SceneItemSelectionWidget(parent);
|
||||||
_getSettings = new QPushButton(obs_module_text(
|
_getSettings = new QPushButton(obs_module_text(
|
||||||
"AdvSceneSwitcher.action.sceneTransform.getTransform"));
|
"AdvSceneSwitcher.action.sceneTransform.getTransform"));
|
||||||
_settings = new QPlainTextEdit();
|
_settings = new QPlainTextEdit();
|
||||||
|
|
||||||
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
this, SLOT(SceneChanged(const SceneSelection &)));
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
QWidget::connect(_sources, SIGNAL(currentTextChanged(const QString &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
this, SLOT(SourceChanged(const QString &)));
|
_sources, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
|
QWidget::connect(_sources,
|
||||||
|
SIGNAL(SceneItemChanged(const SceneItemSelection &)),
|
||||||
|
this, SLOT(SourceChanged(const SceneItemSelection &)));
|
||||||
QWidget::connect(_getSettings, SIGNAL(clicked()), this,
|
QWidget::connect(_getSettings, SIGNAL(clicked()), this,
|
||||||
SLOT(GetSettingsClicked()));
|
SLOT(GetSettingsClicked()));
|
||||||
QWidget::connect(_settings, SIGNAL(textChanged()), this,
|
QWidget::connect(_settings, SIGNAL(textChanged()), this,
|
||||||
@@ -152,13 +159,8 @@ void MacroActionSceneTransformEdit::UpdateEntryData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
_scenes->SetScene(_entryData->_scene);
|
_scenes->SetScene(_entryData->_scene);
|
||||||
populateSceneItemSelection(_sources, _entryData->_scene);
|
_sources->SetSceneItem(_entryData->_source);
|
||||||
_sources->setCurrentText(
|
_settings->setPlainText(formatJsonString(_entryData->GetSettings()));
|
||||||
GetWeakSourceName(_entryData->_source).c_str());
|
|
||||||
if (_entryData->_source) {
|
|
||||||
_settings->setPlainText(
|
|
||||||
formatJsonString(_entryData->GetSettings()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneTransformEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionSceneTransformEdit::SceneChanged(const SceneSelection &s)
|
||||||
@@ -166,44 +168,39 @@ void MacroActionSceneTransformEdit::SceneChanged(const SceneSelection &s)
|
|||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
}
|
|
||||||
_sources->clear();
|
|
||||||
populateSceneItemSelection(_sources, _entryData->_scene);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneTransformEdit::SourceChanged(const QString &text)
|
void MacroActionSceneTransformEdit::SourceChanged(const SceneItemSelection &item)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_source = GetWeakSourceByQString(text);
|
_entryData->_source = item;
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneTransformEdit::GetSettingsClicked()
|
void MacroActionSceneTransformEdit::GetSettingsClicked()
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData || !_entryData->_scene.GetScene(false) ||
|
if (_loading || !_entryData || !_entryData->_scene.GetScene(false)) {
|
||||||
!_entryData->_source) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto s = obs_weak_source_get_source(_entryData->_scene.GetScene(false));
|
auto items = _entryData->_source.GetSceneItems(_entryData->_scene);
|
||||||
auto scene = obs_scene_from_source(s);
|
if (items.empty()) {
|
||||||
auto name = GetWeakSourceName(_entryData->_source);
|
|
||||||
auto item = obs_scene_find_source_recursive(scene, name.c_str());
|
|
||||||
obs_source_release(s);
|
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_settings->setPlainText(formatJsonString(getSceneItemTransform(item)));
|
auto settings = getSceneItemTransform(items[0]);
|
||||||
|
_settings->setPlainText(formatJsonString(settings));
|
||||||
|
for (auto item : items) {
|
||||||
|
obs_sceneitem_release(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneTransformEdit::SettingsChanged()
|
void MacroActionSceneTransformEdit::SettingsChanged()
|
||||||
|
|||||||
@@ -29,23 +29,6 @@ struct VisibilityData {
|
|||||||
bool visible;
|
bool visible;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool visibilitySourceEnum(obs_scene_t *, obs_sceneitem_t *item,
|
|
||||||
void *ptr)
|
|
||||||
{
|
|
||||||
VisibilityData *vInfo = reinterpret_cast<VisibilityData *>(ptr);
|
|
||||||
auto sourceName = obs_source_get_name(obs_sceneitem_get_source(item));
|
|
||||||
if (vInfo->name == sourceName) {
|
|
||||||
obs_sceneitem_set_visible(item, vInfo->visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obs_sceneitem_is_group(item)) {
|
|
||||||
obs_scene_t *scene = obs_sceneitem_group_get_scene(item);
|
|
||||||
obs_scene_enum_items(scene, visibilitySourceEnum, ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool visibilitySourceTypeEnum(obs_scene_t *, obs_sceneitem_t *item,
|
static bool visibilitySourceTypeEnum(obs_scene_t *, obs_sceneitem_t *item,
|
||||||
void *ptr)
|
void *ptr)
|
||||||
{
|
{
|
||||||
@@ -67,25 +50,29 @@ static bool visibilitySourceTypeEnum(obs_scene_t *, obs_sceneitem_t *item,
|
|||||||
|
|
||||||
bool MacroActionSceneVisibility::PerformAction()
|
bool MacroActionSceneVisibility::PerformAction()
|
||||||
{
|
{
|
||||||
auto s = obs_weak_source_get_source(_scene.GetScene());
|
|
||||||
auto scene = obs_scene_from_source(s);
|
|
||||||
auto sourceName = GetWeakSourceName(_source);
|
|
||||||
VisibilityData vInfo = {"", _action == SceneVisibilityAction::SHOW};
|
|
||||||
|
|
||||||
switch (_sourceType) {
|
switch (_sourceType) {
|
||||||
case SceneItemSourceType::SOURCE:
|
case SceneItemSourceType::SOURCE: {
|
||||||
vInfo.name = sourceName;
|
auto items = _source.GetSceneItems(_scene);
|
||||||
obs_scene_enum_items(scene, visibilitySourceEnum, &vInfo);
|
for (auto item : items) {
|
||||||
|
obs_sceneitem_set_visible(
|
||||||
|
item, _action == SceneVisibilityAction::SHOW);
|
||||||
|
obs_sceneitem_release(item);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SceneItemSourceType::SOURCE_GROUP:
|
}
|
||||||
vInfo.name = _sourceGroup;
|
case SceneItemSourceType::SOURCE_GROUP: {
|
||||||
|
auto s = obs_weak_source_get_source(_scene.GetScene());
|
||||||
|
auto scene = obs_scene_from_source(s);
|
||||||
|
VisibilityData vInfo = {_sourceGroup,
|
||||||
|
_action == SceneVisibilityAction::SHOW};
|
||||||
obs_scene_enum_items(scene, visibilitySourceTypeEnum, &vInfo);
|
obs_scene_enum_items(scene, visibilitySourceTypeEnum, &vInfo);
|
||||||
|
obs_source_release(s);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_source_release(s);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,8 +83,7 @@ void MacroActionSceneVisibility::LogAction()
|
|||||||
if (_sourceType == SceneItemSourceType::SOURCE) {
|
if (_sourceType == SceneItemSourceType::SOURCE) {
|
||||||
vblog(LOG_INFO,
|
vblog(LOG_INFO,
|
||||||
"performed visibility action \"%s\" for source \"%s\" on scene \"%s\"",
|
"performed visibility action \"%s\" for source \"%s\" on scene \"%s\"",
|
||||||
it->second.c_str(),
|
it->second.c_str(), _source.ToString().c_str(),
|
||||||
GetWeakSourceName(_source).c_str(),
|
|
||||||
_scene.ToString().c_str());
|
_scene.ToString().c_str());
|
||||||
} else {
|
} else {
|
||||||
vblog(LOG_INFO,
|
vblog(LOG_INFO,
|
||||||
@@ -116,10 +102,9 @@ bool MacroActionSceneVisibility::Save(obs_data_t *obj)
|
|||||||
MacroAction::Save(obj);
|
MacroAction::Save(obj);
|
||||||
_scene.Save(obj);
|
_scene.Save(obj);
|
||||||
if (_sourceType == SceneItemSourceType::SOURCE) {
|
if (_sourceType == SceneItemSourceType::SOURCE) {
|
||||||
obs_data_set_string(obj, "source",
|
_source.Save(obj);
|
||||||
GetWeakSourceName(_source).c_str());
|
|
||||||
} else {
|
} else {
|
||||||
obs_data_set_string(obj, "source", _sourceGroup.c_str());
|
obs_data_set_string(obj, "sourceGroup", _sourceGroup.c_str());
|
||||||
}
|
}
|
||||||
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
obs_data_set_int(obj, "action", static_cast<int>(_action));
|
||||||
obs_data_set_int(obj, "sourceType", static_cast<int>(_sourceType));
|
obs_data_set_int(obj, "sourceType", static_cast<int>(_sourceType));
|
||||||
@@ -128,13 +113,20 @@ bool MacroActionSceneVisibility::Save(obs_data_t *obj)
|
|||||||
|
|
||||||
bool MacroActionSceneVisibility::Load(obs_data_t *obj)
|
bool MacroActionSceneVisibility::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
|
// Convert old data format
|
||||||
|
// TODO: Remove in future version
|
||||||
|
if (obs_data_has_user_value(obj, "source")) {
|
||||||
|
auto sourceName = obs_data_get_string(obj, "source");
|
||||||
|
obs_data_set_string(obj, "sceneItem", sourceName);
|
||||||
|
obs_data_set_string(obj, "sourceGroup", sourceName);
|
||||||
|
}
|
||||||
|
|
||||||
MacroAction::Load(obj);
|
MacroAction::Load(obj);
|
||||||
_scene.Load(obj);
|
_scene.Load(obj);
|
||||||
|
_source.Load(obj);
|
||||||
_sourceType = static_cast<SceneItemSourceType>(
|
_sourceType = static_cast<SceneItemSourceType>(
|
||||||
obs_data_get_int(obj, "sourceType"));
|
obs_data_get_int(obj, "sourceType"));
|
||||||
const char *sourceName = obs_data_get_string(obj, "source");
|
_sourceGroup = obs_data_get_string(obj, "sourceGroup");
|
||||||
_source = GetWeakSourceByName(sourceName);
|
|
||||||
_sourceGroup = sourceName;
|
|
||||||
_action = static_cast<SceneVisibilityAction>(
|
_action = static_cast<SceneVisibilityAction>(
|
||||||
obs_data_get_int(obj, "action"));
|
obs_data_get_int(obj, "action"));
|
||||||
return true;
|
return true;
|
||||||
@@ -142,8 +134,9 @@ bool MacroActionSceneVisibility::Load(obs_data_t *obj)
|
|||||||
|
|
||||||
std::string MacroActionSceneVisibility::GetShortDesc()
|
std::string MacroActionSceneVisibility::GetShortDesc()
|
||||||
{
|
{
|
||||||
if (_sourceType == SceneItemSourceType::SOURCE && _source) {
|
if (_sourceType == SceneItemSourceType::SOURCE &&
|
||||||
return _scene.ToString() + " - " + GetWeakSourceName(_source);
|
!_source.ToString().empty()) {
|
||||||
|
return _scene.ToString() + " - " + _source.ToString();
|
||||||
}
|
}
|
||||||
if (_sourceType == SceneItemSourceType::SOURCE_GROUP &&
|
if (_sourceType == SceneItemSourceType::SOURCE_GROUP &&
|
||||||
!_sourceGroup.empty()) {
|
!_sourceGroup.empty()) {
|
||||||
@@ -175,11 +168,12 @@ MacroActionSceneVisibilityEdit::MacroActionSceneVisibilityEdit(
|
|||||||
{
|
{
|
||||||
_scenes = new SceneSelectionWidget(window(), false, true, true);
|
_scenes = new SceneSelectionWidget(window(), false, true, true);
|
||||||
_sourceTypes = new QComboBox();
|
_sourceTypes = new QComboBox();
|
||||||
_sources = new QComboBox();
|
_sources = new SceneItemSelectionWidget(parent);
|
||||||
_sources->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
_sourceGroups = new QComboBox();
|
||||||
_actions = new QComboBox();
|
_actions = new QComboBox();
|
||||||
|
|
||||||
populateSourceItemTypeSelection(_sourceTypes);
|
populateSourceItemTypeSelection(_sourceTypes);
|
||||||
|
populateSourceGroupSelection(_sourceGroups);
|
||||||
populateActionSelection(_actions);
|
populateActionSelection(_actions);
|
||||||
|
|
||||||
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_actions, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@@ -188,14 +182,19 @@ MacroActionSceneVisibilityEdit::MacroActionSceneVisibilityEdit(
|
|||||||
this, SLOT(SceneChanged(const SceneSelection &)));
|
this, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
QWidget::connect(_sourceTypes, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_sourceTypes, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SourceTypeChanged(int)));
|
SLOT(SourceTypeChanged(int)));
|
||||||
QWidget::connect(_sources, SIGNAL(currentTextChanged(const QString &)),
|
QWidget::connect(_scenes, SIGNAL(SceneChanged(const SceneSelection &)),
|
||||||
this, SLOT(SourceChanged(const QString &)));
|
_sources, SLOT(SceneChanged(const SceneSelection &)));
|
||||||
|
QWidget::connect(_sources,
|
||||||
|
SIGNAL(SceneItemChanged(const SceneItemSelection &)),
|
||||||
|
this, SLOT(SourceChanged(const SceneItemSelection &)));
|
||||||
|
QWidget::connect(_sourceGroups,
|
||||||
|
SIGNAL(currentTextChanged(const QString &)), this,
|
||||||
|
SLOT(SourceGroupChanged(const QString &)));
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
QHBoxLayout *mainLayout = new QHBoxLayout;
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{scenes}}", _scenes},
|
{"{{scenes}}", _scenes}, {"{{sourceTypes}}", _sourceTypes},
|
||||||
{"{{sourceTypes}}", _sourceTypes},
|
{"{{sources}}", _sources}, {"{{sourceGroups}}", _sourceGroups},
|
||||||
{"{{sources}}", _sources},
|
|
||||||
{"{{actions}}", _actions},
|
{"{{actions}}", _actions},
|
||||||
};
|
};
|
||||||
placeWidgets(obs_module_text(
|
placeWidgets(obs_module_text(
|
||||||
@@ -218,14 +217,10 @@ void MacroActionSceneVisibilityEdit::UpdateEntryData()
|
|||||||
_sourceTypes->setCurrentIndex(
|
_sourceTypes->setCurrentIndex(
|
||||||
static_cast<int>(_entryData->_sourceType));
|
static_cast<int>(_entryData->_sourceType));
|
||||||
_scenes->SetScene(_entryData->_scene);
|
_scenes->SetScene(_entryData->_scene);
|
||||||
if (_entryData->_sourceType == SceneItemSourceType::SOURCE) {
|
_sources->SetSceneItem((_entryData->_source));
|
||||||
populateSceneItemSelection(_sources, _entryData->_scene);
|
_sourceGroups->setCurrentText(
|
||||||
_sources->setCurrentText(
|
QString::fromStdString(_entryData->_sourceGroup));
|
||||||
GetWeakSourceName(_entryData->_source).c_str());
|
SetWidgetVisibility();
|
||||||
} else {
|
|
||||||
populateSourceTypeSelection(_sources);
|
|
||||||
_sources->setCurrentText(_entryData->_sourceGroup.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
|
void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
|
||||||
@@ -233,13 +228,9 @@ void MacroActionSceneVisibilityEdit::SceneChanged(const SceneSelection &s)
|
|||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_scene = s;
|
_entryData->_scene = s;
|
||||||
}
|
|
||||||
_sources->clear();
|
|
||||||
populateSceneItemSelection(_sources, _entryData->_scene);
|
|
||||||
_sources->adjustSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SourceTypeChanged(int value)
|
void MacroActionSceneVisibilityEdit::SourceTypeChanged(int value)
|
||||||
@@ -247,35 +238,36 @@ void MacroActionSceneVisibilityEdit::SourceTypeChanged(int value)
|
|||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
|
||||||
_entryData->_sourceType =
|
|
||||||
static_cast<SceneItemSourceType>(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
_sources->clear();
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
if (_entryData->_sourceType == SceneItemSourceType::SOURCE) {
|
_entryData->_sourceType = static_cast<SceneItemSourceType>(value);
|
||||||
populateSceneItemSelection(_sources, _entryData->_scene);
|
SetWidgetVisibility();
|
||||||
} else {
|
|
||||||
populateSourceTypeSelection(_sources);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroActionSceneVisibilityEdit::SourceChanged(const QString &text)
|
void MacroActionSceneVisibilityEdit::SourceChanged(
|
||||||
|
const SceneItemSelection &item)
|
||||||
{
|
{
|
||||||
if (_loading || !_entryData) {
|
if (_loading || !_entryData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
if (_entryData->_sourceType == SceneItemSourceType::SOURCE) {
|
_entryData->_source = item;
|
||||||
_entryData->_source = GetWeakSourceByQString(text);
|
emit HeaderInfoChanged(
|
||||||
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneVisibilityEdit::SourceGroupChanged(const QString &text)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
if (text == obs_module_text("AdvSceneSwitcher.selectItem")) {
|
||||||
|
_entryData->_sourceGroup = "";
|
||||||
} else {
|
} else {
|
||||||
if (text == obs_module_text("AdvSceneSwitcher.selectItem")) {
|
_entryData->_sourceGroup = text.toStdString();
|
||||||
_entryData->_sourceGroup = "";
|
|
||||||
} else {
|
|
||||||
_entryData->_sourceGroup = text.toStdString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
@@ -290,3 +282,15 @@ void MacroActionSceneVisibilityEdit::ActionChanged(int value)
|
|||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_action = static_cast<SceneVisibilityAction>(value);
|
_entryData->_action = static_cast<SceneVisibilityAction>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MacroActionSceneVisibilityEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_sources->setVisible(_entryData->_sourceType ==
|
||||||
|
SceneItemSourceType::SOURCE);
|
||||||
|
_sourceGroups->setVisible(_entryData->_sourceType ==
|
||||||
|
SceneItemSourceType::SOURCE_GROUP);
|
||||||
|
adjustSize();
|
||||||
|
}
|
||||||
|
|||||||
382
src/macro-action-sequence.cpp
Normal file
382
src/macro-action-sequence.cpp
Normal file
@@ -0,0 +1,382 @@
|
|||||||
|
#include "headers/macro-action-sequence.hpp"
|
||||||
|
#include "headers/advanced-scene-switcher.hpp"
|
||||||
|
#include "headers/utility.hpp"
|
||||||
|
|
||||||
|
const std::string MacroActionSequence::id = "sequence";
|
||||||
|
|
||||||
|
bool MacroActionSequence::_registered = MacroActionFactory::Register(
|
||||||
|
MacroActionSequence::id,
|
||||||
|
{MacroActionSequence::Create, MacroActionSequenceEdit::Create,
|
||||||
|
"AdvSceneSwitcher.action.sequence"});
|
||||||
|
|
||||||
|
int getNextUnpausedMacroIdx(std::vector<MacroRef> ¯os, int startIdx)
|
||||||
|
{
|
||||||
|
for (; macros.size() > startIdx; ++startIdx) {
|
||||||
|
if (!macros[startIdx]->Paused()) {
|
||||||
|
return startIdx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
MacroRef MacroActionSequence::GetNextMacro(bool advance)
|
||||||
|
{
|
||||||
|
int idx = _lastIdx;
|
||||||
|
MacroRef res;
|
||||||
|
|
||||||
|
int nextUnpausedIdx = getNextUnpausedMacroIdx(_macros, idx + 1);
|
||||||
|
if (nextUnpausedIdx != -1) {
|
||||||
|
res = _macros[nextUnpausedIdx];
|
||||||
|
idx = nextUnpausedIdx;
|
||||||
|
} else {
|
||||||
|
if (_restart) {
|
||||||
|
idx = getNextUnpausedMacroIdx(_macros, 0);
|
||||||
|
if (idx != -1) {
|
||||||
|
res = _macros[idx];
|
||||||
|
} else {
|
||||||
|
// End of sequence reached, as all available
|
||||||
|
// macros are either paused or the macro list
|
||||||
|
// is empty
|
||||||
|
idx = _macros.size();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// End of sequence reached
|
||||||
|
idx = _macros.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (advance) {
|
||||||
|
_lastIdx = idx;
|
||||||
|
_lastSequenceMacro = res;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSequence::PerformAction()
|
||||||
|
{
|
||||||
|
if (_macros.size() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto macro = GetNextMacro();
|
||||||
|
if (!macro.get()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return macro->PerformAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequence::LogAction()
|
||||||
|
{
|
||||||
|
vblog(LOG_INFO, "running macro sequence");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSequence::Save(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroAction::Save(obj);
|
||||||
|
obs_data_array_t *args = obs_data_array_create();
|
||||||
|
for (auto &m : _macros) {
|
||||||
|
obs_data_t *array_obj = obs_data_create();
|
||||||
|
m.Save(array_obj);
|
||||||
|
obs_data_array_push_back(args, array_obj);
|
||||||
|
obs_data_release(array_obj);
|
||||||
|
}
|
||||||
|
obs_data_set_array(obj, "macros", args);
|
||||||
|
obs_data_array_release(args);
|
||||||
|
obs_data_set_bool(obj, "restart", _restart);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroActionSequence::Load(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
MacroAction::Load(obj);
|
||||||
|
obs_data_array_t *args = obs_data_get_array(obj, "macros");
|
||||||
|
size_t count = obs_data_array_count(args);
|
||||||
|
for (size_t i = 0; i < count; i++) {
|
||||||
|
obs_data_t *array_obj = obs_data_array_item(args, i);
|
||||||
|
MacroRef ref;
|
||||||
|
ref.Load(array_obj);
|
||||||
|
_macros.push_back(ref);
|
||||||
|
obs_data_release(array_obj);
|
||||||
|
}
|
||||||
|
obs_data_array_release(args);
|
||||||
|
_restart = obs_data_get_bool(obj, "restart");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
MacroActionSequenceEdit::MacroActionSequenceEdit(
|
||||||
|
QWidget *parent, std::shared_ptr<MacroActionSequence> entryData)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
_macroList = new QListWidget();
|
||||||
|
_add = new QPushButton();
|
||||||
|
_add->setMaximumSize(QSize(22, 22));
|
||||||
|
_add->setProperty("themeID",
|
||||||
|
QVariant(QString::fromUtf8("addIconSmall")));
|
||||||
|
_add->setFlat(true);
|
||||||
|
_remove = new QPushButton();
|
||||||
|
_remove->setMaximumSize(QSize(22, 22));
|
||||||
|
_remove->setProperty("themeID",
|
||||||
|
QVariant(QString::fromUtf8("removeIconSmall")));
|
||||||
|
_remove->setFlat(true);
|
||||||
|
_up = new QPushButton();
|
||||||
|
_up->setMaximumSize(QSize(22, 22));
|
||||||
|
_up->setProperty("themeID",
|
||||||
|
QVariant(QString::fromUtf8("upArrowIconSmall")));
|
||||||
|
_up->setFlat(true);
|
||||||
|
_down = new QPushButton();
|
||||||
|
_down->setMaximumSize(QSize(22, 22));
|
||||||
|
_down->setProperty("themeID",
|
||||||
|
QVariant(QString::fromUtf8("downArrowIconSmall")));
|
||||||
|
_down->setFlat(true);
|
||||||
|
_continueFrom = new QPushButton(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.action.sequence.continueFrom"));
|
||||||
|
_restart = new QCheckBox(
|
||||||
|
obs_module_text("AdvSceneSwitcher.action.sequence.restart"));
|
||||||
|
_statusLine = new QLabel();
|
||||||
|
|
||||||
|
QWidget::connect(_add, SIGNAL(clicked()), this, SLOT(Add()));
|
||||||
|
QWidget::connect(_remove, SIGNAL(clicked()), this, SLOT(Remove()));
|
||||||
|
QWidget::connect(_up, SIGNAL(clicked()), this, SLOT(Up()));
|
||||||
|
QWidget::connect(_down, SIGNAL(clicked()), this, SLOT(Down()));
|
||||||
|
QWidget::connect(_continueFrom, SIGNAL(clicked()), this,
|
||||||
|
SLOT(ContinueFromClicked()));
|
||||||
|
QWidget::connect(_macroList, SIGNAL(currentRowChanged(int)), this,
|
||||||
|
SLOT(MacroSelectionChanged(int)));
|
||||||
|
QWidget::connect(window(),
|
||||||
|
SIGNAL(MacroRenamed(const QString &, const QString &)),
|
||||||
|
this,
|
||||||
|
SLOT(MacroRename(const QString &, const QString &)));
|
||||||
|
QWidget::connect(_restart, SIGNAL(stateChanged(int)), this,
|
||||||
|
SLOT(RestartChanged(int)));
|
||||||
|
|
||||||
|
auto *entryLayout = new QHBoxLayout;
|
||||||
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {};
|
||||||
|
placeWidgets(obs_module_text("AdvSceneSwitcher.action.sequence.entry"),
|
||||||
|
entryLayout, widgetPlaceholders);
|
||||||
|
|
||||||
|
auto *argButtonLayout = new QHBoxLayout;
|
||||||
|
argButtonLayout->addWidget(_add);
|
||||||
|
argButtonLayout->addWidget(_remove);
|
||||||
|
QFrame *line = new QFrame();
|
||||||
|
line->setFrameShape(QFrame::VLine);
|
||||||
|
line->setFrameShadow(QFrame::Sunken);
|
||||||
|
argButtonLayout->addWidget(line);
|
||||||
|
argButtonLayout->addWidget(_up);
|
||||||
|
argButtonLayout->addWidget(_down);
|
||||||
|
QFrame *line2 = new QFrame();
|
||||||
|
line2->setFrameShape(QFrame::VLine);
|
||||||
|
line2->setFrameShadow(QFrame::Sunken);
|
||||||
|
argButtonLayout->addWidget(line2);
|
||||||
|
argButtonLayout->addWidget(_continueFrom);
|
||||||
|
argButtonLayout->addStretch();
|
||||||
|
|
||||||
|
auto *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addLayout(entryLayout);
|
||||||
|
mainLayout->addWidget(_macroList);
|
||||||
|
mainLayout->addLayout(argButtonLayout);
|
||||||
|
mainLayout->addLayout(argButtonLayout);
|
||||||
|
mainLayout->addWidget(_restart);
|
||||||
|
mainLayout->addWidget(_statusLine);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
UpdateStatusLine();
|
||||||
|
connect(&_statusTimer, SIGNAL(timeout()), this,
|
||||||
|
SLOT(UpdateStatusLine()));
|
||||||
|
_statusTimer.start(1000);
|
||||||
|
|
||||||
|
_entryData = entryData;
|
||||||
|
UpdateEntryData();
|
||||||
|
_loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::UpdateEntryData()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto &m : _entryData->_macros) {
|
||||||
|
if (!m.get()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto name = QString::fromStdString(m->Name());
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(name, _macroList);
|
||||||
|
item->setData(Qt::UserRole, name);
|
||||||
|
}
|
||||||
|
SetMacroListSize();
|
||||||
|
_restart->setChecked(_entryData->_restart);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::MacroRemove(const QString &name)
|
||||||
|
{
|
||||||
|
if (_entryData) {
|
||||||
|
auto it = _entryData->_macros.begin();
|
||||||
|
while (it != _entryData->_macros.end()) {
|
||||||
|
if (it->get()->Name() == name.toStdString()) {
|
||||||
|
it = _entryData->_macros.erase(it);
|
||||||
|
} else {
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::MacroRename(const QString &oldName,
|
||||||
|
const QString &newName)
|
||||||
|
{
|
||||||
|
auto count = _macroList->count();
|
||||||
|
for (int idx = 0; idx < count; ++idx) {
|
||||||
|
QListWidgetItem *item = _macroList->item(idx);
|
||||||
|
QString itemString = item->data(Qt::UserRole).toString();
|
||||||
|
if (oldName == itemString) {
|
||||||
|
item->setData(Qt::UserRole, newName);
|
||||||
|
item->setText(newName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::Add()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string macroName;
|
||||||
|
bool accepted = MacroSelectionDialog::AskForMacro(this, macroName);
|
||||||
|
|
||||||
|
if (!accepted || macroName.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MacroRef macro(macroName);
|
||||||
|
|
||||||
|
if (!macro.get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant v = QVariant::fromValue(QString::fromStdString(macroName));
|
||||||
|
new QListWidgetItem(QString::fromStdString(macroName), _macroList);
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_macros.push_back(macro);
|
||||||
|
SetMacroListSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::Remove()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
auto item = _macroList->currentItem();
|
||||||
|
int idx = _macroList->currentRow();
|
||||||
|
if (!item || idx == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_entryData->_macros.erase(std::next(_entryData->_macros.begin(), idx));
|
||||||
|
|
||||||
|
delete item;
|
||||||
|
SetMacroListSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::Up()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int idx = _macroList->currentRow();
|
||||||
|
if (idx != -1 && idx != 0) {
|
||||||
|
_macroList->insertItem(idx - 1, _macroList->takeItem(idx));
|
||||||
|
_macroList->setCurrentRow(idx - 1);
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
std::swap(_entryData->_macros[idx],
|
||||||
|
_entryData->_macros[idx - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::Down()
|
||||||
|
{
|
||||||
|
int idx = _macroList->currentRow();
|
||||||
|
if (idx != -1 && idx != _macroList->count() - 1) {
|
||||||
|
_macroList->insertItem(idx + 1, _macroList->takeItem(idx));
|
||||||
|
_macroList->setCurrentRow(idx + 1);
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
std::swap(_entryData->_macros[idx],
|
||||||
|
_entryData->_macros[idx + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::ContinueFromClicked()
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int idx = _macroList->currentRow();
|
||||||
|
if (idx == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_lastIdx = idx - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::RestartChanged(int state)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_restart = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::UpdateStatusLine()
|
||||||
|
{
|
||||||
|
QString lastMacroName =
|
||||||
|
obs_module_text("AdvSceneSwitcher.action.sequence.status.none");
|
||||||
|
QString nextMacroName =
|
||||||
|
obs_module_text("AdvSceneSwitcher.action.sequence.status.none");
|
||||||
|
if (_entryData) {
|
||||||
|
if (_entryData->_lastSequenceMacro.get()) {
|
||||||
|
lastMacroName = QString::fromStdString(
|
||||||
|
_entryData->_lastSequenceMacro->Name());
|
||||||
|
}
|
||||||
|
auto next = _entryData->GetNextMacro(false);
|
||||||
|
if (next.get()) {
|
||||||
|
nextMacroName = QString::fromStdString(next->Name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString format{
|
||||||
|
obs_module_text("AdvSceneSwitcher.action.sequence.status")};
|
||||||
|
_statusLine->setText(format.arg(lastMacroName, nextMacroName));
|
||||||
|
}
|
||||||
|
|
||||||
|
int MacroActionSequenceEdit::FindEntry(const std::string ¯o)
|
||||||
|
{
|
||||||
|
int count = _macroList->count();
|
||||||
|
int idx = -1;
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
QListWidgetItem *item = _macroList->item(i);
|
||||||
|
QString itemString = item->data(Qt::UserRole).toString();
|
||||||
|
if (QString::fromStdString(macro) == itemString) {
|
||||||
|
idx = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroActionSequenceEdit::SetMacroListSize()
|
||||||
|
{
|
||||||
|
setHeightToContentHeight(_macroList);
|
||||||
|
adjustSize();
|
||||||
|
}
|
||||||
@@ -10,9 +10,24 @@ bool MacroConditionAudio::_registered = MacroConditionFactory::Register(
|
|||||||
{MacroConditionAudio::Create, MacroConditionAudioEdit::Create,
|
{MacroConditionAudio::Create, MacroConditionAudioEdit::Create,
|
||||||
"AdvSceneSwitcher.condition.audio"});
|
"AdvSceneSwitcher.condition.audio"});
|
||||||
|
|
||||||
static std::map<AudioCondition, std::string> audioConditionTypes = {
|
static std::map<AudioOutputCondition, std::string> audioOutputConditionTypes = {
|
||||||
{AudioCondition::ABOVE, "AdvSceneSwitcher.condition.audio.state.above"},
|
{AudioOutputCondition::ABOVE,
|
||||||
{AudioCondition::BELOW, "AdvSceneSwitcher.condition.audio.state.below"},
|
"AdvSceneSwitcher.condition.audio.state.above"},
|
||||||
|
{AudioOutputCondition::BELOW,
|
||||||
|
"AdvSceneSwitcher.condition.audio.state.below"},
|
||||||
|
};
|
||||||
|
|
||||||
|
static std::map<AudioVolumeCondition, std::string> audioVolumeConditionTypes = {
|
||||||
|
{AudioVolumeCondition::ABOVE,
|
||||||
|
"AdvSceneSwitcher.condition.audio.state.above"},
|
||||||
|
{AudioVolumeCondition::EXACT,
|
||||||
|
"AdvSceneSwitcher.condition.audio.state.exact"},
|
||||||
|
{AudioVolumeCondition::BELOW,
|
||||||
|
"AdvSceneSwitcher.condition.audio.state.below"},
|
||||||
|
{AudioVolumeCondition::MUTE,
|
||||||
|
"AdvSceneSwitcher.condition.audio.state.mute"},
|
||||||
|
{AudioVolumeCondition::UNMUTE,
|
||||||
|
"AdvSceneSwitcher.condition.audio.state.unmute"},
|
||||||
};
|
};
|
||||||
|
|
||||||
MacroConditionAudio::~MacroConditionAudio()
|
MacroConditionAudio::~MacroConditionAudio()
|
||||||
@@ -21,21 +36,72 @@ MacroConditionAudio::~MacroConditionAudio()
|
|||||||
obs_volmeter_destroy(_volmeter);
|
obs_volmeter_destroy(_volmeter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroConditionAudio::CheckCondition()
|
bool MacroConditionAudio::CheckOutputCondition()
|
||||||
{
|
{
|
||||||
// peak will have a value from -60 db to 0 db
|
bool ret = false;
|
||||||
bool volumeThresholdreached = false;
|
auto s = obs_weak_source_get_source(_audioSource);
|
||||||
|
|
||||||
if (_condition == AudioCondition::ABOVE) {
|
switch (_outputCondition) {
|
||||||
volumeThresholdreached = ((double)_peak + 60) * 1.7 > _volume;
|
case AudioOutputCondition::ABOVE:
|
||||||
} else {
|
// peak will have a value from -60 db to 0 db
|
||||||
volumeThresholdreached = ((double)_peak + 60) * 1.7 < _volume;
|
ret = ((double)_peak + 60) * 1.7 > _volume;
|
||||||
|
break;
|
||||||
|
case AudioOutputCondition::BELOW:
|
||||||
|
// peak will have a value from -60 db to 0 db
|
||||||
|
ret = ((double)_peak + 60) * 1.7 < _volume;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset for next check
|
// Reset for next check
|
||||||
_peak = -std::numeric_limits<float>::infinity();
|
_peak = -std::numeric_limits<float>::infinity();
|
||||||
|
obs_source_release(s);
|
||||||
|
|
||||||
return volumeThresholdreached;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroConditionAudio::CheckVolumeCondition()
|
||||||
|
{
|
||||||
|
|
||||||
|
bool ret = false;
|
||||||
|
auto s = obs_weak_source_get_source(_audioSource);
|
||||||
|
|
||||||
|
switch (_volumeCondition) {
|
||||||
|
case AudioVolumeCondition::ABOVE:
|
||||||
|
ret = obs_source_get_volume(s) > _volume / 100.f;
|
||||||
|
break;
|
||||||
|
case AudioVolumeCondition::EXACT:
|
||||||
|
ret = obs_source_get_volume(s) == _volume / 100.f;
|
||||||
|
break;
|
||||||
|
case AudioVolumeCondition::BELOW:
|
||||||
|
ret = obs_source_get_volume(s) < _volume / 100.f;
|
||||||
|
break;
|
||||||
|
case AudioVolumeCondition::MUTE:
|
||||||
|
ret = obs_source_muted(s);
|
||||||
|
break;
|
||||||
|
case AudioVolumeCondition::UNMUTE:
|
||||||
|
ret = !obs_source_muted(s);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
obs_source_release(s);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MacroConditionAudio::CheckCondition()
|
||||||
|
{
|
||||||
|
switch (_checkType) {
|
||||||
|
case AudioConditionCheckType::OUTPUT_VOLUME:
|
||||||
|
return CheckOutputCondition();
|
||||||
|
case AudioConditionCheckType::CONFIGURED_VOLUME:
|
||||||
|
return CheckVolumeCondition();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MacroConditionAudio::Save(obs_data_t *obj)
|
bool MacroConditionAudio::Save(obs_data_t *obj)
|
||||||
@@ -44,7 +110,11 @@ bool MacroConditionAudio::Save(obs_data_t *obj)
|
|||||||
obs_data_set_string(obj, "audioSource",
|
obs_data_set_string(obj, "audioSource",
|
||||||
GetWeakSourceName(_audioSource).c_str());
|
GetWeakSourceName(_audioSource).c_str());
|
||||||
obs_data_set_int(obj, "volume", _volume);
|
obs_data_set_int(obj, "volume", _volume);
|
||||||
obs_data_set_int(obj, "condition", static_cast<int>(_condition));
|
obs_data_set_int(obj, "checkType", static_cast<int>(_checkType));
|
||||||
|
obs_data_set_int(obj, "outputCondition",
|
||||||
|
static_cast<int>(_outputCondition));
|
||||||
|
obs_data_set_int(obj, "volumeCondition",
|
||||||
|
static_cast<int>(_volumeCondition));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,14 +135,66 @@ obs_volmeter_t *AddVolmeterToSource(MacroConditionAudio *entry,
|
|||||||
return volmeter;
|
return volmeter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove in future version
|
||||||
|
static void convertOldSettingsFormat(obs_data_t *obj)
|
||||||
|
{
|
||||||
|
auto oldCond = static_cast<AudioOutputCondition>(
|
||||||
|
obs_data_get_int(obj, "condition"));
|
||||||
|
switch (oldCond) {
|
||||||
|
case AudioOutputCondition::ABOVE:
|
||||||
|
obs_data_set_int(
|
||||||
|
obj, "checkType",
|
||||||
|
static_cast<int>(
|
||||||
|
AudioConditionCheckType::OUTPUT_VOLUME));
|
||||||
|
obs_data_set_int(obj, "outputCondition",
|
||||||
|
static_cast<int>(AudioOutputCondition::ABOVE));
|
||||||
|
break;
|
||||||
|
case AudioOutputCondition::BELOW:
|
||||||
|
obs_data_set_int(
|
||||||
|
obj, "checkType",
|
||||||
|
static_cast<int>(
|
||||||
|
AudioConditionCheckType::OUTPUT_VOLUME));
|
||||||
|
obs_data_set_int(obj, "outputCondition",
|
||||||
|
static_cast<int>(AudioOutputCondition::BELOW));
|
||||||
|
break;
|
||||||
|
case AudioOutputCondition::MUTE:
|
||||||
|
obs_data_set_int(
|
||||||
|
obj, "checkType",
|
||||||
|
static_cast<int>(
|
||||||
|
AudioConditionCheckType::CONFIGURED_VOLUME));
|
||||||
|
obs_data_set_int(obj, "volumeCondition",
|
||||||
|
static_cast<int>(AudioVolumeCondition::MUTE));
|
||||||
|
break;
|
||||||
|
case AudioOutputCondition::UNMUTE:
|
||||||
|
obs_data_set_int(
|
||||||
|
obj, "checkType",
|
||||||
|
static_cast<int>(
|
||||||
|
AudioConditionCheckType::CONFIGURED_VOLUME));
|
||||||
|
obs_data_set_int(
|
||||||
|
obj, "volumeCondition",
|
||||||
|
static_cast<int>(AudioVolumeCondition::UNMUTE));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MacroConditionAudio::Load(obs_data_t *obj)
|
bool MacroConditionAudio::Load(obs_data_t *obj)
|
||||||
{
|
{
|
||||||
|
if (!obs_data_has_user_value(obj, "checkType")) {
|
||||||
|
convertOldSettingsFormat(obj);
|
||||||
|
}
|
||||||
|
|
||||||
MacroCondition::Load(obj);
|
MacroCondition::Load(obj);
|
||||||
const char *audioSourceName = obs_data_get_string(obj, "audioSource");
|
const char *audioSourceName = obs_data_get_string(obj, "audioSource");
|
||||||
_audioSource = GetWeakSourceByName(audioSourceName);
|
_audioSource = GetWeakSourceByName(audioSourceName);
|
||||||
_volume = obs_data_get_int(obj, "volume");
|
_volume = obs_data_get_int(obj, "volume");
|
||||||
_condition =
|
_checkType = static_cast<AudioConditionCheckType>(
|
||||||
static_cast<AudioCondition>(obs_data_get_int(obj, "condition"));
|
obs_data_get_int(obj, "checkType"));
|
||||||
|
_outputCondition = static_cast<AudioOutputCondition>(
|
||||||
|
obs_data_get_int(obj, "outputCondition"));
|
||||||
|
_volumeCondition = static_cast<AudioVolumeCondition>(
|
||||||
|
obs_data_get_int(obj, "volumeCondition"));
|
||||||
_volmeter = AddVolmeterToSource(this, _audioSource);
|
_volmeter = AddVolmeterToSource(this, _audioSource);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -85,13 +207,10 @@ std::string MacroConditionAudio::GetShortDesc()
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionAudio::SetVolumeLevel(
|
void MacroConditionAudio::SetVolumeLevel(void *data, const float *,
|
||||||
void *data, const float magnitude[MAX_AUDIO_CHANNELS],
|
const float peak[MAX_AUDIO_CHANNELS],
|
||||||
const float peak[MAX_AUDIO_CHANNELS],
|
const float *)
|
||||||
const float inputPeak[MAX_AUDIO_CHANNELS])
|
|
||||||
{
|
{
|
||||||
UNUSED_PARAMETER(magnitude);
|
|
||||||
UNUSED_PARAMETER(inputPeak);
|
|
||||||
MacroConditionAudio *c = static_cast<MacroConditionAudio *>(data);
|
MacroConditionAudio *c = static_cast<MacroConditionAudio *>(data);
|
||||||
|
|
||||||
for (int i = 0; i < MAX_AUDIO_CHANNELS; i++) {
|
for (int i = 0; i < MAX_AUDIO_CHANNELS; i++) {
|
||||||
@@ -109,9 +228,26 @@ void MacroConditionAudio::ResetVolmeter()
|
|||||||
_volmeter = AddVolmeterToSource(this, _audioSource);
|
_volmeter = AddVolmeterToSource(this, _audioSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void populateConditionSelection(QComboBox *list)
|
static inline void populateCheckTypes(QComboBox *list)
|
||||||
{
|
{
|
||||||
for (auto entry : audioConditionTypes) {
|
list->addItem(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.audio.type.output"));
|
||||||
|
list->addItem(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.audio.type.volume"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void populateOutputConditionSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
list->clear();
|
||||||
|
for (auto entry : audioOutputConditionTypes) {
|
||||||
|
list->addItem(obs_module_text(entry.second.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void populateVolumeConditionSelection(QComboBox *list)
|
||||||
|
{
|
||||||
|
list->clear();
|
||||||
|
for (auto entry : audioVolumeConditionTypes) {
|
||||||
list->addItem(obs_module_text(entry.second.c_str()));
|
list->addItem(obs_module_text(entry.second.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,6 +256,7 @@ MacroConditionAudioEdit::MacroConditionAudioEdit(
|
|||||||
QWidget *parent, std::shared_ptr<MacroConditionAudio> entryData)
|
QWidget *parent, std::shared_ptr<MacroConditionAudio> entryData)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
_checkTypes = new QComboBox();
|
||||||
_audioSources = new QComboBox();
|
_audioSources = new QComboBox();
|
||||||
_condition = new QComboBox();
|
_condition = new QComboBox();
|
||||||
_volume = new QSpinBox();
|
_volume = new QSpinBox();
|
||||||
@@ -128,6 +265,8 @@ MacroConditionAudioEdit::MacroConditionAudioEdit(
|
|||||||
_volume->setMaximum(100);
|
_volume->setMaximum(100);
|
||||||
_volume->setMinimum(0);
|
_volume->setMinimum(0);
|
||||||
|
|
||||||
|
QWidget::connect(_checkTypes, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(CheckTypeChanged(int)));
|
||||||
QWidget::connect(_volume, SIGNAL(valueChanged(int)), this,
|
QWidget::connect(_volume, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(VolumeThresholdChanged(int)));
|
SLOT(VolumeThresholdChanged(int)));
|
||||||
QWidget::connect(_condition, SIGNAL(currentIndexChanged(int)), this,
|
QWidget::connect(_condition, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@@ -136,11 +275,12 @@ MacroConditionAudioEdit::MacroConditionAudioEdit(
|
|||||||
SIGNAL(currentTextChanged(const QString &)), this,
|
SIGNAL(currentTextChanged(const QString &)), this,
|
||||||
SLOT(SourceChanged(const QString &)));
|
SLOT(SourceChanged(const QString &)));
|
||||||
|
|
||||||
|
populateCheckTypes(_checkTypes);
|
||||||
populateAudioSelection(_audioSources);
|
populateAudioSelection(_audioSources);
|
||||||
populateConditionSelection(_condition);
|
|
||||||
|
|
||||||
QHBoxLayout *switchLayout = new QHBoxLayout;
|
QHBoxLayout *switchLayout = new QHBoxLayout;
|
||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
|
{"{{checkType}}", _checkTypes},
|
||||||
{"{{audioSources}}", _audioSources},
|
{"{{audioSources}}", _audioSources},
|
||||||
{"{{volume}}", _volume},
|
{"{{volume}}", _volume},
|
||||||
{"{{condition}}", _condition},
|
{"{{condition}}", _condition},
|
||||||
@@ -189,6 +329,7 @@ void MacroConditionAudioEdit::SourceChanged(const QString &text)
|
|||||||
_entryData->_audioSource = GetWeakSourceByQString(text);
|
_entryData->_audioSource = GetWeakSourceByQString(text);
|
||||||
_entryData->ResetVolmeter();
|
_entryData->ResetVolmeter();
|
||||||
UpdateVolmeterSource();
|
UpdateVolmeterSource();
|
||||||
|
SetWidgetVisibility();
|
||||||
emit HeaderInfoChanged(
|
emit HeaderInfoChanged(
|
||||||
QString::fromStdString(_entryData->GetShortDesc()));
|
QString::fromStdString(_entryData->GetShortDesc()));
|
||||||
}
|
}
|
||||||
@@ -210,7 +351,32 @@ void MacroConditionAudioEdit::ConditionChanged(int cond)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
_entryData->_condition = static_cast<AudioCondition>(cond);
|
if (_entryData->_checkType == AudioConditionCheckType::OUTPUT_VOLUME) {
|
||||||
|
_entryData->_outputCondition =
|
||||||
|
static_cast<AudioOutputCondition>(cond);
|
||||||
|
} else {
|
||||||
|
_entryData->_volumeCondition =
|
||||||
|
static_cast<AudioVolumeCondition>(cond);
|
||||||
|
}
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionAudioEdit::CheckTypeChanged(int cond)
|
||||||
|
{
|
||||||
|
if (_loading || !_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
|
_entryData->_checkType = static_cast<AudioConditionCheckType>(cond);
|
||||||
|
|
||||||
|
const QSignalBlocker b(_condition);
|
||||||
|
if (_entryData->_checkType == AudioConditionCheckType::OUTPUT_VOLUME) {
|
||||||
|
populateOutputConditionSelection(_condition);
|
||||||
|
} else {
|
||||||
|
populateVolumeConditionSelection(_condition);
|
||||||
|
}
|
||||||
|
SetWidgetVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroConditionAudioEdit::UpdateEntryData()
|
void MacroConditionAudioEdit::UpdateEntryData()
|
||||||
@@ -222,6 +388,35 @@ void MacroConditionAudioEdit::UpdateEntryData()
|
|||||||
_audioSources->setCurrentText(
|
_audioSources->setCurrentText(
|
||||||
GetWeakSourceName(_entryData->_audioSource).c_str());
|
GetWeakSourceName(_entryData->_audioSource).c_str());
|
||||||
_volume->setValue(_entryData->_volume);
|
_volume->setValue(_entryData->_volume);
|
||||||
_condition->setCurrentIndex(static_cast<int>(_entryData->_condition));
|
_checkTypes->setCurrentIndex(static_cast<int>(_entryData->_checkType));
|
||||||
|
if (_entryData->_checkType == AudioConditionCheckType::OUTPUT_VOLUME) {
|
||||||
|
populateOutputConditionSelection(_condition);
|
||||||
|
_condition->setCurrentIndex(
|
||||||
|
static_cast<int>(_entryData->_outputCondition));
|
||||||
|
} else {
|
||||||
|
populateVolumeConditionSelection(_condition);
|
||||||
|
_condition->setCurrentIndex(
|
||||||
|
static_cast<int>(_entryData->_volumeCondition));
|
||||||
|
}
|
||||||
UpdateVolmeterSource();
|
UpdateVolmeterSource();
|
||||||
|
SetWidgetVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacroConditionAudioEdit::SetWidgetVisibility()
|
||||||
|
{
|
||||||
|
if (!_entryData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_volume->setVisible(
|
||||||
|
_entryData->_checkType ==
|
||||||
|
AudioConditionCheckType::OUTPUT_VOLUME ||
|
||||||
|
(_entryData->_checkType ==
|
||||||
|
AudioConditionCheckType::CONFIGURED_VOLUME &&
|
||||||
|
(_entryData->_volumeCondition == AudioVolumeCondition::ABOVE ||
|
||||||
|
_entryData->_volumeCondition == AudioVolumeCondition::EXACT ||
|
||||||
|
_entryData->_volumeCondition == AudioVolumeCondition::BELOW)));
|
||||||
|
_volMeter->setVisible(_entryData->_checkType ==
|
||||||
|
AudioConditionCheckType::OUTPUT_VOLUME);
|
||||||
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ bool MacroConditionFactory::Register(const std::string &id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<MacroCondition>
|
std::shared_ptr<MacroCondition>
|
||||||
MacroConditionFactory::Create(const std::string &id)
|
MacroConditionFactory::Create(const std::string &id, Macro *m)
|
||||||
{
|
{
|
||||||
if (auto it = _methods.find(id); it != _methods.end()) {
|
if (auto it = _methods.find(id); it != _methods.end()) {
|
||||||
return it->second._createFunc();
|
return it->second._createFunc(m);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -87,6 +87,7 @@ static inline void populateConditionSelection(QComboBox *list)
|
|||||||
for (auto entry : MacroConditionFactory::GetConditionTypes()) {
|
for (auto entry : MacroConditionFactory::GetConditionTypes()) {
|
||||||
list->addItem(obs_module_text(entry.second._name.c_str()));
|
list->addItem(obs_module_text(entry.second._name.c_str()));
|
||||||
}
|
}
|
||||||
|
list->model()->sort(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MacroConditionEdit::MacroConditionEdit(
|
MacroConditionEdit::MacroConditionEdit(
|
||||||
@@ -189,6 +190,7 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto idx = _entryData->get()->GetIndex();
|
auto idx = _entryData->get()->GetIndex();
|
||||||
|
auto macro = _entryData->get()->GetMacro();
|
||||||
std::string id = MacroConditionFactory::GetIdByName(text);
|
std::string id = MacroConditionFactory::GetIdByName(text);
|
||||||
|
|
||||||
auto temp = DurationConstraint();
|
auto temp = DurationConstraint();
|
||||||
@@ -198,7 +200,7 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
|||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
auto logic = (*_entryData)->GetLogicType();
|
auto logic = (*_entryData)->GetLogicType();
|
||||||
_entryData->reset();
|
_entryData->reset();
|
||||||
*_entryData = MacroConditionFactory::Create(id);
|
*_entryData = MacroConditionFactory::Create(id, macro);
|
||||||
(*_entryData)->SetIndex(idx);
|
(*_entryData)->SetIndex(idx);
|
||||||
(*_entryData)->SetLogicType(logic);
|
(*_entryData)->SetLogicType(logic);
|
||||||
auto widget =
|
auto widget =
|
||||||
@@ -260,14 +262,14 @@ void AdvSceneSwitcher::AddMacroCondition(int idx)
|
|||||||
if (idx - 1 >= 0) {
|
if (idx - 1 >= 0) {
|
||||||
id = macro->Conditions().at(idx - 1)->GetId();
|
id = macro->Conditions().at(idx - 1)->GetId();
|
||||||
} else {
|
} else {
|
||||||
MacroConditionScene temp;
|
MacroConditionScene temp(macro);
|
||||||
id = temp.GetId();
|
id = temp.GetId();
|
||||||
}
|
}
|
||||||
std::lock_guard<std::mutex> lock(switcher->m);
|
std::lock_guard<std::mutex> lock(switcher->m);
|
||||||
bool root = idx == 0;
|
bool root = idx == 0;
|
||||||
auto cond =
|
auto cond = macro->Conditions().emplace(
|
||||||
macro->Conditions().emplace(macro->Conditions().begin() + idx,
|
macro->Conditions().begin() + idx,
|
||||||
MacroConditionFactory::Create(id));
|
MacroConditionFactory::Create(id, macro));
|
||||||
if (idx - 1 >= 0) {
|
if (idx - 1 >= 0) {
|
||||||
auto data = obs_data_create();
|
auto data = obs_data_create();
|
||||||
macro->Conditions().at(idx - 1)->Save(data);
|
macro->Conditions().at(idx - 1)->Save(data);
|
||||||
|
|||||||
@@ -10,21 +10,23 @@ bool MacroConditionHotkey::_registered = MacroConditionFactory::Register(
|
|||||||
{MacroConditionHotkey::Create, MacroConditionHotkeyEdit::Create,
|
{MacroConditionHotkey::Create, MacroConditionHotkeyEdit::Create,
|
||||||
"AdvSceneSwitcher.condition.hotkey", false});
|
"AdvSceneSwitcher.condition.hotkey", false});
|
||||||
|
|
||||||
static void hotkeyCB(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey,
|
static void hotkeyCB(void *data, obs_hotkey_id, obs_hotkey_t *, bool pressed)
|
||||||
bool pressed)
|
|
||||||
{
|
{
|
||||||
UNUSED_PARAMETER(id);
|
|
||||||
UNUSED_PARAMETER(data);
|
|
||||||
UNUSED_PARAMETER(hotkey);
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
auto c = static_cast<MacroConditionHotkey *>(data);
|
auto c = static_cast<MacroConditionHotkey *>(data);
|
||||||
c->SetPressed();
|
auto macro = c->GetMacro();
|
||||||
|
if (!macro) {
|
||||||
|
c->SetPressed();
|
||||||
|
}
|
||||||
|
if (macro && !macro->Paused()) {
|
||||||
|
c->SetPressed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t count = 1;
|
static uint32_t count = 1;
|
||||||
|
|
||||||
MacroConditionHotkey::MacroConditionHotkey()
|
MacroConditionHotkey::MacroConditionHotkey(Macro *m) : MacroCondition(m)
|
||||||
{
|
{
|
||||||
if (_hotkeyID != OBS_INVALID_HOTKEY_ID) {
|
if (_hotkeyID != OBS_INVALID_HOTKEY_ID) {
|
||||||
obs_hotkey_unregister(_hotkeyID);
|
obs_hotkey_unregister(_hotkeyID);
|
||||||
@@ -80,8 +82,11 @@ MacroConditionHotkeyEdit::MacroConditionHotkeyEdit(
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
_name = new QLineEdit();
|
_name = new QLineEdit();
|
||||||
|
QLabel *line1 = new QLabel(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.hotkey.entry.line1"));
|
||||||
QLabel *hint = new QLabel(
|
QLabel *hint = new QLabel(
|
||||||
obs_module_text("AdvSceneSwitcher.condition.hotkey.tip"));
|
obs_module_text("AdvSceneSwitcher.condition.hotkey.tip"));
|
||||||
|
|
||||||
QWidget::connect(_name, SIGNAL(editingFinished()), this,
|
QWidget::connect(_name, SIGNAL(editingFinished()), this,
|
||||||
SLOT(NameChanged()));
|
SLOT(NameChanged()));
|
||||||
|
|
||||||
@@ -89,10 +94,12 @@ MacroConditionHotkeyEdit::MacroConditionHotkeyEdit(
|
|||||||
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
std::unordered_map<std::string, QWidget *> widgetPlaceholders = {
|
||||||
{"{{name}}", _name},
|
{"{{name}}", _name},
|
||||||
};
|
};
|
||||||
placeWidgets(obs_module_text("AdvSceneSwitcher.condition.hotkey.entry"),
|
placeWidgets(obs_module_text(
|
||||||
|
"AdvSceneSwitcher.condition.hotkey.entry.line2"),
|
||||||
switchLayout, widgetPlaceholders);
|
switchLayout, widgetPlaceholders);
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
|
mainLayout->addWidget(line1);
|
||||||
mainLayout->addLayout(switchLayout);
|
mainLayout->addLayout(switchLayout);
|
||||||
mainLayout->addWidget(hint);
|
mainLayout->addWidget(hint);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user