diff --git a/build.bat b/build.bat index 777d621..363e552 100644 --- a/build.bat +++ b/build.bat @@ -2,7 +2,7 @@ REM Clear current session log cls REM Source environment (Uncomment lines starting with "set" if you current env does not have these defined.) REM set HFS=C:\Program Files\Side Effects Software\ -REM Define Resolver > Has to be one of 'fileResolver'/'pythonResolver'/'hybridResolver' +REM Define Resolver > Has to be one of 'fileResolver'/'pythonResolver'/'cachedResolver'/'httpResolver' REM set RESOLVER_NAME=fileResolver REM Clear existing build data and invoke cmake rmdir /S /Q build diff --git a/build.sh b/build.sh index 185cae3..c41712b 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ clear # Source environment (Uncomment lines starting with "export" if you current env does not have these defined.) # export HFS=/opt/ -# Define Resolver > Has to be one of 'fileResolver'/'pythonResolver'/'cachedResolver' +# Define Resolver > Has to be one of 'fileResolver'/'pythonResolver'/'cachedResolver'/'httpResolver' # export RESOLVER_NAME=fileResolver # Clear existing build data and invoke cmake rm -R build diff --git a/docs/src/overview.md b/docs/src/overview.md index 8d32244..19f22f2 100644 --- a/docs/src/overview.md +++ b/docs/src/overview.md @@ -11,15 +11,19 @@ This guide currently covers compiling against Houdini on Linux and Windows. Alte ``` ```admonish tip -We also offer a quick install method for Houdini that does the download of the compiled resolvers and environment variable setup for you. This is ideal if you want to get your hands dirty right away and you don't have any C++ knowledge or extensive USD developer knowledge. If you are a small studio, you can jump right in and play around with our "PythonResolver"/"CachedResolver" resolvers and prototype around to make it fit your production needs. See our [Automatic Installation](./installation/automatic_install.md) section for more information. +We also offer a quick install method for Houdini that does the download of the compiled resolvers and environment variable setup for you. This is ideal if you want to get your hands dirty right away and you don't have any C++ knowledge or extensive USD developer knowledge. If you are a small studio, you can jump right in and play around with our resolvers and prototype them further to make it fit your production needs. See our [Automatic Installation](./installation/automatic_install.md) section for more information. ``` ## Feature Overview Asset resolvers that can be compiled via this repository: -- **File Resolver** - A file system based resolver similar to the default resolver with support for custom mapping pairs as well as at runtime modification and refreshing. -- **Python Resolver** - Python based implementation of the file resolver. The goal of this resolver is to enable easier RnD by running all resolver and resolver context related methods in Python. It can be used to quickly inspect resolve calls and to setup prototypes of resolvers that can then later be re-written in C++ as it is easier to code database interactions in Python for initial research. -- **Http Resolver** - A proof of concept http resolver. This is kindly provided and maintained by @charlesfleche in the [arHttp: Offloads USD asset resolution to an HTTP server -](https://github.com/charlesfleche/arHttp) repository. For documentation, feature suggestions and bug reports, please file a ticket there. This repo handles the auto-compilation against DCCs and exposing to the automatic installation update manager UI. +- **Production Resolvers** + - **File Resolver** - A file system based resolver similar to the default resolver with support for custom mapping pairs as well as at runtime modification and refreshing. + - **Cached Resolver** - Still work in progress, more info coming soon. +- **RnD Resolvers** + - **Python Resolver** - Python based implementation of the file resolver. The goal of this resolver is to enable easier RnD by running all resolver and resolver context related methods in Python. It can be used to quickly inspect resolve calls and to setup prototypes of resolvers that can then later be re-written in C++ as it is easier to code database interactions in Python for initial research. +- **Proof Of Concept Resolvers** + - **Http Resolver** - A proof of concept http resolver. This is kindly provided and maintained by @charlesfleche in the [arHttp: Offloads USD asset resolution to an HTTP server + ](https://github.com/charlesfleche/arHttp) repository. For documentation, feature suggestions and bug reports, please file a ticket there. This repo handles the auto-compilation against DCCs and exposing to the automatic installation update manager UI. For more information check out the [building guide](./installation/building.md) as well as the [individual resolvers](./resolvers/overview.md) to see their full functionality. diff --git a/src/HttpResolver/wrap/CMakeLists.txt b/src/HttpResolver/wrap/CMakeLists.txt index a2c00fb..4e96caa 100644 --- a/src/HttpResolver/wrap/CMakeLists.txt +++ b/src/HttpResolver/wrap/CMakeLists.txt @@ -44,4 +44,12 @@ configure_file(plugInfo.json.in plugInfo.json) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugInfo.json DESTINATION resources) install(TARGETS ${AR_HTTPRESOLVER_TARGET_LIB} RUNTIME DESTINATION lib) # Demo -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../arHttp/src/arHttpSampleServer DESTINATION demo/packages) \ No newline at end of file +set(_server_permissions OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE) +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../arHttp/src/arHttpSampleServer DESTINATION demo/packages) +if (WIN32) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/server_install.bat PERMISSIONS ${_server_permissions} DESTINATION demo) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/server_launch.bat PERMISSIONS ${_server_permissions} DESTINATION demo) +else() + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/server_install.sh PERMISSIONS ${_server_permissions} DESTINATION demo) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/server_launch.sh PERMISSIONS ${_server_permissions} DESTINATION demo) +endif() diff --git a/src/HttpResolver/wrap/server_install.bat b/src/HttpResolver/wrap/server_install.bat new file mode 100755 index 0000000..4d0ee12 --- /dev/null +++ b/src/HttpResolver/wrap/server_install.bat @@ -0,0 +1,5 @@ +REM Create and source virtual env +python -m venv venv +call venv\Scripts\activate.bat +REM Install dependencies (We can't use the pyproject.toml as it depends on .git) +python -m pip install fastapi[all] \ No newline at end of file diff --git a/src/HttpResolver/wrap/server_install.sh b/src/HttpResolver/wrap/server_install.sh new file mode 100755 index 0000000..27bcc2c --- /dev/null +++ b/src/HttpResolver/wrap/server_install.sh @@ -0,0 +1,5 @@ +# Create and source virtual env +python -m venv venv +source venv/bin/activate +# Install dependencies (We can't use the pyproject.toml as it depends on .git) +python -m pip install fastapi[all] \ No newline at end of file diff --git a/src/HttpResolver/wrap/server_launch.bat b/src/HttpResolver/wrap/server_launch.bat new file mode 100755 index 0000000..76867ac --- /dev/null +++ b/src/HttpResolver/wrap/server_launch.bat @@ -0,0 +1,2 @@ +REM Start server +venv\Scripts\uvicorn arHttpSampleServer:app --app-dir packages --reload-dir packages --reload \ No newline at end of file diff --git a/src/HttpResolver/wrap/server_launch.sh b/src/HttpResolver/wrap/server_launch.sh new file mode 100755 index 0000000..1dd127b --- /dev/null +++ b/src/HttpResolver/wrap/server_launch.sh @@ -0,0 +1,2 @@ +# Start server +venv/bin/uvicorn arHttpSampleServer:app --app-dir packages --reload-dir packages --reload \ No newline at end of file diff --git a/tools/update_manager.py b/tools/update_manager.py index 0955307..91af5ba 100644 --- a/tools/update_manager.py +++ b/tools/update_manager.py @@ -5,7 +5,6 @@ import re import shutil import ssl -import subprocess import tempfile import urllib import zipfile @@ -32,48 +31,6 @@ QT_ROLE_RELEASE = QtCore.Qt.UserRole + 1001 -def install_side_effect_httpResolver(platform_name, software_name, resolver_dir_path): - """The install side effect for the httpResolver. - # ToDo Instead of using 'HFS' for the Houdini install directory, add a software version input arg. - This does the following: - - Create a venv in the ./demo folder - - Install fastapi - - Return run command for server - Args: - platform_name(str): The active platform - software_name(str): The software name - directory_path(str): The resolver directory path - Returns: - str: A command to run before app execution - """ - # Validate - if platform_name == "macos": - raise Exception( - "Platform {} is currently not supported!".format(platform_name) - ) - - demo_dir_path = os.path.join(resolver_dir_path, "demo") - if not os.path.exists(demo_dir_path): - os.makedirs(demo_dir_path) - python_exe = os.path.join(os.environ["HFS"], "python", "bin", "python") - - # Create venv - subprocess.check_call([python_exe, "-m", "venv", "venv"], cwd=demo_dir_path, env={}) - venv_python_exe = os.path.join(demo_dir_path, "venv", "bin", "python") - # Install deps (We can't use the pyproject.toml as it depends on .git) - subprocess.check_call([venv_python_exe, "-m", "pip", "install", "fastapi[all]"], cwd=demo_dir_path, env={}) - # Command - if platform_name == "linux": - venv_uvicorn_exe = os.path.join(demo_dir_path, "venv", "bin", "uvicorn") - command = "{} arHttpSampleServer:app --reload &".format(venv_uvicorn_exe) - elif platform_name == "win64": - command = 'start "ArHttp Webserver" {} arHttpSampleServer:app --reload'.format(venv_uvicorn_exe) - return command - - -INSTALL_SIDE_EFFECTS = {"fileResolver": install_side_effect_httpResolver} - - class UpdateManagerUI(QtWidgets.QDialog): def __init__(self, parent): super(UpdateManagerUI, self).__init__(parent) @@ -181,16 +138,16 @@ def initialize(self): self.resolver_label.setVisible(True) self.resolver_combobox.setVisible(True) self.uninstall_button.setVisible(False) - # Query data - self.update_manager.initialize() - # Update UI - for release in self.update_manager.releases: - release_name = release["name"] - item = QtGui.QStandardItem(release_name) - item.setData(release, QT_ROLE_RELEASE) - self.release_combobox.model().appendRow(item) - if not self.update_manager.releases: - self.install_button.setEnabled(False) + # Query data + self.update_manager.initialize() + # Update UI + for release in self.update_manager.releases: + release_name = release["name"] + item = QtGui.QStandardItem(release_name) + item.setData(release, QT_ROLE_RELEASE) + self.release_combobox.model().appendRow(item) + if not self.update_manager.releases: + self.install_button.setEnabled(False) def directory_lineedit_editingFinished(self): """Validate the directory path""" @@ -378,8 +335,8 @@ def get_release_data(self, platform_name, software_name, software_version): filtered_data = [] for release in data: # Skip pre releases - if release["prerelease"]: - continue + #if release["prerelease"]: + # continue for asset in release["assets"]: if asset["content_type"] != "application/zip": continue @@ -509,7 +466,7 @@ def install_release( # Cleanup other resolvers for dir_name in os.listdir(directory_path): if dir_name != resolver_name: - os.rmdir(os.path.join(directory_path, dir_name)) + shutil.rmtree(os.path.join(directory_path, dir_name)) # Build launcher env = { "PXR_PLUGINPATH_NAME": os.path.join(resolver_dir_path, "resources"), @@ -518,9 +475,6 @@ def install_release( if platform_name == "linux": env["LD_LIBRARY_PATH"] = os.path.join(resolver_dir_path, "lib") launch_file_path = os.path.join(directory_path, "launch.sh") - side_effect_command = INSTALL_SIDE_EFFECTS.get( - resolver_name, lambda *args: None - )(platform_name, software_name, resolver_dir_path) with open(launch_file_path, "w") as launch_file: lines = [] lines.append("#!/bin/bash") @@ -539,17 +493,14 @@ def install_release( env_name=env_name, env_value=env_value, sep=os.pathsep ) ) - # Side effect command - if side_effect_command: - lines.append(side_effect_command) # App + lines.append("# Launch Houdini") lines.append( "pushd {} && source houdini_setup && popd".format( os.environ["HFS"] ) ) # Command - lines.append("# Launch Houdini") lines.append('houdini -foreground "$@"') launch_file.writelines(line + "\n" for line in lines) # Make executable @@ -557,9 +508,6 @@ def install_release( elif platform_name == "win64": env["PATH"] = os.path.join(resolver_dir_path, "lib") launch_file_path = os.path.join(directory_path, "launch.bat") - side_effect_command = INSTALL_SIDE_EFFECTS.get( - resolver_name, lambda *args: None - )(platform_name, resolver_dir_path) with open(launch_file_path, "w") as launch_file: lines = [] # Environment @@ -577,9 +525,6 @@ def install_release( env_name=env_name, env_value=env_value, sep=os.pathsep ) ) - # Side effect command - if side_effect_command: - lines.append(side_effect_command) # App & command lines.append("REM Launch Houdini") lines.append(os.path.join(os.environ["HFS"], "bin", "houdini")) @@ -647,6 +592,4 @@ def run_houdini(): raise Exception("This function can only be run in an active Houdini session.") dialog = UpdateManagerUI(hou.ui.mainQtWindow()) - dialog.exec_() - -run_houdini() \ No newline at end of file + dialog.exec_() \ No newline at end of file