Skip to content

Commit

Permalink
If J3DUltra doesn't import, recommend installing VS C++ Redistributable
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Mar 19, 2024
1 parent b808429 commit 626f26e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ Then run GCFT with:
Optionally, if you want J3D model previews to display while running from source, you must also clone and build PyJ3DUltra.
A script that automates this process is provided. Simply run the following command:
`py -3.12 build_pyj3dultra.py`
On Windows, you must first [install vcpkg](https://vcpkg.io/en/getting-started) before running that command.
On Windows, you must first [install vcpkg](https://vcpkg.io/en/getting-started) and [Visual Studio](https://visualstudio.microsoft.com/vs/community/) before running that command.

If the script ran successfully with no errors, then the next time you load a J3D model in GCFT you should see a 3D preview.
11 changes: 10 additions & 1 deletion gcft_ui/j3d_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from PySide6.QtWidgets import *
from PySide6.QtOpenGLWidgets import *

from gcft_paths import ASSETS_PATH
from gcft_paths import ASSETS_PATH, IS_RUNNING_FROM_SOURCE
from gcft_ui.nav_camera import Camera
from gclib.j3d import J3D
from gclib.bti import BTI
Expand Down Expand Up @@ -180,6 +180,15 @@ def get_supported_opengl_version(self) -> tuple[int, int]:

def load_model(self, j3d_model: J3D, reset_camera=False, hidden_material_indexes=None):
if not J3DULTRA_INSTALLED:
error_msg = "Cannot show J3D previews, J3DUltra could not be imported."
if IS_RUNNING_FROM_SOURCE:
error_msg += "\n\n"
error_msg += "Make sure you compiled PyJ3DUltra by running the following command:\n"
error_msg += "py build_pyj3dultra.py"
elif sys.platform == "win32":
error_msg += "\n\n"
error_msg += "Make sure you have the Microsoft Visual C++ 2015 Redistributable installed."
self.error_showing_preview.emit(error_msg)
return

if j3d_model.file_type not in ["bmd3", "bdl4", "bmd2"]:
Expand Down

0 comments on commit 626f26e

Please sign in to comment.