setup.sh
1 #!/bin/bash 2 # 3 # DreamTalk Setup Script 4 # Sets up symlinks and dependencies for DreamTalk development 5 # 6 7 set -e 8 9 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 10 DREAMTALK_ROOT="$(dirname "$SCRIPT_DIR")" 11 12 echo "🎬 DreamTalk Setup" 13 echo "==================" 14 echo "DreamTalk root: $DREAMTALK_ROOT" 15 echo "" 16 17 # Detect Cinema 4D version and plugins folder 18 detect_c4d_plugins_folder() { 19 local prefs_dir="$HOME/Library/Preferences/Maxon" 20 21 if [ ! -d "$prefs_dir" ]; then 22 echo "❌ Maxon preferences folder not found at $prefs_dir" 23 echo " Is Cinema 4D installed?" 24 return 1 25 fi 26 27 # Find the most recent C4D version folder 28 local c4d_folder=$(ls -td "$prefs_dir"/Maxon\ Cinema\ 4D\ * 2>/dev/null | head -1) 29 30 if [ -z "$c4d_folder" ]; then 31 echo "❌ No Cinema 4D preferences folder found" 32 return 1 33 fi 34 35 local plugins_folder="$c4d_folder/plugins" 36 37 if [ ! -d "$plugins_folder" ]; then 38 echo "Creating plugins folder: $plugins_folder" 39 mkdir -p "$plugins_folder" 40 fi 41 42 echo "$plugins_folder" 43 } 44 45 # Setup C4D plugin symlink 46 setup_c4d_plugin() { 47 echo "📦 Setting up Cinema 4D plugin..." 48 49 local plugins_folder=$(detect_c4d_plugins_folder) 50 if [ $? -ne 0 ]; then 51 echo "⚠️ Skipping C4D plugin setup" 52 return 1 53 fi 54 55 local source="$DREAMTALK_ROOT/mcp-servers/cinema4d-mcp/c4d_plugin/mcp_server_plugin.pyp" 56 local target="$plugins_folder/mcp_server_plugin.pyp" 57 58 if [ ! -f "$source" ]; then 59 echo "❌ Plugin source not found: $source" 60 return 1 61 fi 62 63 # Remove existing file or symlink 64 if [ -e "$target" ] || [ -L "$target" ]; then 65 echo " Removing existing plugin at $target" 66 rm "$target" 67 fi 68 69 # Create symlink 70 ln -s "$source" "$target" 71 echo "✅ Symlinked plugin:" 72 echo " $target -> $source" 73 } 74 75 # Setup Python environment for MCP server 76 setup_mcp_server() { 77 echo "" 78 echo "📦 Setting up MCP server dependencies..." 79 80 local mcp_dir="$DREAMTALK_ROOT/mcp-servers/cinema4d-mcp" 81 82 if [ ! -d "$mcp_dir" ]; then 83 echo "❌ MCP server directory not found: $mcp_dir" 84 return 1 85 fi 86 87 if command -v uv &> /dev/null; then 88 echo " Using uv to install dependencies..." 89 (cd "$mcp_dir" && uv sync) 90 echo "✅ MCP server dependencies installed" 91 else 92 echo "⚠️ uv not found. Install with: curl -LsSf https://astral.sh/uv/install.sh | sh" 93 echo " Then run this script again." 94 return 1 95 fi 96 } 97 98 # Main 99 echo "" 100 setup_c4d_plugin 101 setup_mcp_server 102 103 echo "" 104 echo "==================" 105 echo "✅ DreamTalk setup complete!" 106 echo "" 107 echo "Next steps:" 108 echo " 1. Restart Cinema 4D to load the plugin" 109 echo " 2. In C4D: Extensions > Socket Server Plugin > Start Server" 110 echo " 3. Start Claude Code in the DreamTalk directory" 111 echo ""