Skip to content

Commit fe8b57b

Browse files
authored
Merge branch 'main' into LordOfDragons-vivefacialtracker
2 parents c15d687 + a68f443 commit fe8b57b

File tree

231 files changed

+142
-25205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+142
-25205
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Babble-Unity-Demo"]
2+
path = Babble-Unity-Demo
3+
url = https://github.com/dfgHiatus/Babble-Unity-Demo

Babble-Unity-Demo

Submodule Babble-Unity-Demo added at aaca058

BabbleApp/babbleapp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
winmm = windll.winmm
4545
except OSError:
4646
print(f'\033[91m[{lang._instance.get_string("log.error")}] {lang._instance.get_string("error.winmm")}.\033[0m')
47+
4748
os.system("color") # init ANSI color
4849

4950
# Random environment variable to speed up webcam opening on the MSMF backend.

BabbleApp/camera.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# packet (packet-size bytes)
2929
ETVR_HEADER = b"\xff\xa0\xff\xa1"
3030
ETVR_HEADER_LEN = 6
31-
PORTS = ("COM", "/dev/tty")
31+
PORTS = ("COM", "/dev/ttyACM")
3232

3333

3434
class CameraState(Enum):
@@ -323,18 +323,20 @@ def start_serial_connection(self, port):
323323
try:
324324
rate = 115200 if sys.platform == "darwin" else 3000000 # Higher baud rate not working on macOS
325325
conn = serial.Serial(baudrate=rate, port=port, xonxoff=False, dsrdtr=False, rtscts=False)
326-
# Set explicit buffer size for serial.
327-
conn.set_buffer_size(rx_size=BUFFER_SIZE, tx_size=BUFFER_SIZE)
326+
# Set explicit buffer size for serial. This function is Windows only!
327+
if is_nt:
328+
conn.set_buffer_size(rx_size=BUFFER_SIZE, tx_size=BUFFER_SIZE)
328329

329330
print(
330331
f'{Fore.CYAN}[{lang._instance.get_string("log.info")}] {lang._instance.get_string("info.ETVRConnected")} {port}{Fore.RESET}'
331332
)
332333
self.serial_connection = conn
333334
self.camera_status = CameraState.CONNECTED
334-
except Exception:
335+
except Exception as e:
335336
print(
336337
f'{Fore.CYAN}[{lang._instance.get_string("log.info")}] {lang._instance.get_string("info.ETVRFailiure")} {port}{Fore.RESET}'
337338
)
339+
print(e)
338340
self.camera_status = CameraState.DISCONNECTED
339341

340342
def clamp_max_res(self, image: MatLike) -> MatLike:

BabbleApp/camera_widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def render(self, window, event, values):
319319
# if value not in self.camera_list:
320320
# self.config.capture_source = value
321321
# if "COM" not in value:
322-
ports = ("COM", "/dev/tty")
322+
ports = ("COM", "/dev/ttyACM")
323323
if any(x in str(value) for x in ports):
324324
self.config.capture_source = value
325325
else:
@@ -341,7 +341,7 @@ def render(self, window, event, values):
341341
and ".mp4" not in value
342342
and "udp" not in value
343343
and "COM" not in value
344-
and "/dev/tty" not in value
344+
and "/dev/ttyACM" not in value
345345
and value not in self.camera_list
346346
): # If http is not in camera address, add it.
347347
self.config.capture_source = (

README.md

Lines changed: 31 additions & 4 deletions

babbleapp-installer-latest.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
3+
# Check if running on a supported operating system
4+
if [[ "$OSTYPE" != "linux-gnu"* ]] && [[ "$OSTYPE" != "darwin"* ]]; then
5+
echo "Error: This script is only compatible with Linux and macOS operating systems."
6+
exit 1
7+
fi
8+
9+
# Check Python version
10+
if ! command -v python3 &> /dev/null; then
11+
echo "Error: Python is not installed. Please install Python 3.8 or higher."
12+
exit 1
13+
fi
14+
15+
python_version_major=$(python3 -c 'import platform; print(platform.python_version_tuple()[0])')
16+
python_version_minor=$(python3 -c 'import platform; print(platform.python_version_tuple()[1])')
17+
if (( python_version_major < 3 || python_version_minor < 8 )); then
18+
echo "Error: Your Python version is too low! Please install 3.8 or higher."
19+
exit 1
20+
fi
21+
22+
install_dir="$HOME/.local/share/project-babble"
23+
bin_dir="$HOME/.local/bin"
24+
25+
# Create installation directory if it doesn't exist
26+
mkdir -p "$install_dir"
27+
28+
# Function to install requirements
29+
install_requirements() {
30+
cd "$install_dir"
31+
cd BabbleApp
32+
echo "Installing requirements..."
33+
# Create a temporary requirements file without the Windows-only package
34+
grep -v "onnxruntime-directml" requirements.txt > unix_requirements.txt
35+
pip install -r unix_requirements.txt --quiet
36+
rm unix_requirements.txt
37+
}
38+
39+
# Function to get the latest commit hash
40+
get_latest_commit() {
41+
git fetch origin main
42+
git rev-parse origin/main
43+
}
44+
45+
# Function to get the current commit hash
46+
get_current_commit() {
47+
git rev-parse HEAD
48+
}
49+
50+
# Function to update the repository
51+
update_repo() {
52+
echo "Checking for updates..."
53+
git fetch origin main
54+
local_commit=$(get_current_commit)
55+
remote_commit=$(get_latest_commit)
56+
57+
if [ "$local_commit" != "$remote_commit" ]; then
58+
echo "New version available"
59+
echo "Current commit: ${local_commit:0:8}"
60+
echo "Latest commit: ${remote_commit:0:8}"
61+
echo "Updating to the latest version..."
62+
git checkout main
63+
git pull origin main
64+
echo "Updating dependencies..."
65+
source venv/bin/activate
66+
install_requirements
67+
deactivate
68+
echo "Project Babble has been updated successfully to commit ${remote_commit:0:8}!"
69+
else
70+
echo "Project Babble is already at the latest commit: ${local_commit:0:8}"
71+
fi
72+
}
73+
74+
# Ensure we're in the correct directory
75+
cd "$install_dir"
76+
cd BabbleApp
77+
78+
# Create venv if it does not exist
79+
if ! [ -d "venv" ]; then
80+
python3 -m venv venv
81+
fi
82+
83+
# Use the correct activation script based on OS
84+
source venv/bin/activate
85+
update_repo
86+
echo "Verifying dependencies. This might take a second!"
87+
install_requirements
88+
echo "Starting Babble app..."
89+
python3 babbleapp.py

babbleapp.sh renamed to babbleapp-installer-tagged.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

3-
# Check if running on Linux
4-
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
5-
echo "Error: This script is only compatible with Linux operating systems."
3+
# Check if running on a supported operating system
4+
if [[ "$OSTYPE" != "linux-gnu"* ]] && [[ "$OSTYPE" != "darwin"* ]]; then
5+
echo "Error: This script is only compatible with Linux and macOS operating systems."
66
exit 1
77
fi
88

@@ -19,12 +19,15 @@ if (( python_version_major < 3 || python_version_minor < 8 )); then
1919
exit 1
2020
fi
2121

22-
# Set installation directory
2322
install_dir="$HOME/.local/share/project-babble"
23+
bin_dir="$HOME/.local/bin"
24+
25+
# Create installation directory if it doesn't exist
26+
mkdir -p "$install_dir"
2427

2528
# Function to install requirements
2629
install_requirements() {
27-
cd $install_dir
30+
cd "$install_dir"
2831
cd BabbleApp
2932
echo "Installing requirements..."
3033
# Create a temporary requirements file without the Windows-only package
@@ -62,7 +65,7 @@ update_repo() {
6265
}
6366

6467

65-
cd $install_dir
68+
cd "$install_dir"
6669
cd BabbleApp
6770

6871
# Create venv if it does not exists

unitybuild/FaceTrackPOC.exe

-636 KB
Binary file not shown.
-27 KB
Binary file not shown.

0 commit comments

Comments
 (0)