stpete2 commited on
Commit
2033ff2
·
verified ·
1 Parent(s): a05e8be

Upload preprocess_manual.js

Browse files
Files changed (1) hide show
  1. preprocess_manual.js +34 -24
preprocess_manual.js CHANGED
@@ -2147,6 +2147,8 @@ if (confirmBoxBtn) {
2147
  // Complete setupBoneAssignment Function
2148
  // Replace your entire setupBoneAssignment function with this
2149
  // ========================================
 
 
2150
 
2151
  function setupBoneAssignment(ui, scene, camera, renderer, gvrm, character, filteredGs, filteredPlyUrl, vrmPath, useGPU, savePly, fileName, plyData, originalPlyData) {
2152
  return new Promise(async (resolve2) => {
@@ -2393,38 +2395,45 @@ function setupBoneAssignment(ui, scene, camera, renderer, gvrm, character, filte
2393
  selectionRadiusValue.textContent = selectionRadius.toFixed(2);
2394
  });
2395
  }
2396
-
2397
  // ========================================
2398
  // Raycaster Setup
2399
  // ========================================
2400
  const raycaster = new THREE.Raycaster();
2401
  const mouse = new THREE.Vector2();
2402
-
2403
- // Camera lock state
 
 
 
 
 
 
 
 
2404
  let cameraLocked = false;
2405
  const cameraLockBtn = document.getElementById('camera-lock-btn');
2406
 
2407
- // Get camera controls from parent scope (assuming it's accessible)
2408
- // If not accessible, you'll need to pass it as parameter
2409
- const setupCameraLock = (controls) => {
2410
- if (cameraLockBtn && controls) {
2411
- cameraLockBtn.addEventListener('click', () => {
2412
- cameraLocked = !cameraLocked;
2413
- controls.enabled = !cameraLocked;
2414
-
2415
- if (cameraLocked) {
2416
- cameraLockBtn.textContent = '🔒 Camera Locked (Fixed View)';
2417
- cameraLockBtn.style.background = '#E91E63';
2418
- console.log('[setupBoneAssignment] Camera locked');
2419
- } else {
2420
- cameraLockBtn.textContent = '🔓 Camera Unlocked (Can Rotate)';
2421
- cameraLockBtn.style.background = '#9C27B0';
2422
- console.log('[setupBoneAssignment] Camera unlocked');
2423
- }
2424
- });
2425
- }
2426
- };
2427
-
2428
 
2429
  // Call this after OrbitControls is created
2430
  // You'll need to pass the cameraControls.controls object
@@ -3734,5 +3743,6 @@ if (finalizeBtn) {
3734
  console.error('[setupBoneAssignment] Error:', error);
3735
  ui.setStatus('Error: ' + error.message);
3736
  }
 
3737
  }); // setupBoneAssignment の Promise の終了
3738
  } // setupBoneAssignment 関数の終了
 
2147
  // Complete setupBoneAssignment Function
2148
  // Replace your entire setupBoneAssignment function with this
2149
  // ========================================
2150
+ ////////////////////////////////////////////////0111
2151
+
2152
 
2153
  function setupBoneAssignment(ui, scene, camera, renderer, gvrm, character, filteredGs, filteredPlyUrl, vrmPath, useGPU, savePly, fileName, plyData, originalPlyData) {
2154
  return new Promise(async (resolve2) => {
 
2395
  selectionRadiusValue.textContent = selectionRadius.toFixed(2);
2396
  });
2397
  }
2398
+
2399
  // ========================================
2400
  // Raycaster Setup
2401
  // ========================================
2402
  const raycaster = new THREE.Raycaster();
2403
  const mouse = new THREE.Vector2();
2404
+
2405
+ // ========================================
2406
+ // ⭐ Camera Controls Setup (追加)
2407
+ // ========================================
2408
+ const cameraControls = setupCameraControls(camera, renderer);
2409
+ console.log('[setupBoneAssignment] Camera controls initialized');
2410
+
2411
+ // ========================================
2412
+ // Camera Lock Setup (修正版)
2413
+ // ========================================
2414
  let cameraLocked = false;
2415
  const cameraLockBtn = document.getElementById('camera-lock-btn');
2416
 
2417
+ if (cameraLockBtn && cameraControls && cameraControls.controls) {
2418
+ console.log('[setupBoneAssignment] Setting up camera lock button...');
2419
+
2420
+ cameraLockBtn.addEventListener('click', () => {
2421
+ cameraLocked = !cameraLocked;
2422
+ cameraControls.controls.enabled = !cameraLocked;
2423
+
2424
+ if (cameraLocked) {
2425
+ cameraLockBtn.textContent = '🔒 Camera Locked (Fixed View)';
2426
+ cameraLockBtn.style.background = '#E91E63';
2427
+ console.log('[setupBoneAssignment] Camera locked');
2428
+ } else {
2429
+ cameraLockBtn.textContent = '🔓 Camera Unlocked (Can Rotate)';
2430
+ cameraLockBtn.style.background = '#9C27B0';
2431
+ console.log('[setupBoneAssignment] Camera unlocked');
2432
+ }
2433
+ });
2434
+
2435
+ console.log('[setupBoneAssignment] ✓ Camera lock button ready');
2436
+ }
 
2437
 
2438
  // Call this after OrbitControls is created
2439
  // You'll need to pass the cameraControls.controls object
 
3743
  console.error('[setupBoneAssignment] Error:', error);
3744
  ui.setStatus('Error: ' + error.message);
3745
  }
3746
+
3747
  }); // setupBoneAssignment の Promise の終了
3748
  } // setupBoneAssignment 関数の終了