Skip to content

Commit

Permalink
Init http resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaScheller committed Oct 28, 2023
1 parent 5f2d61e commit 5420b14
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 12 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.vscode
*.code-workspace
artifacts
build
dist
temp
docs/book
.vscode
*.code-workspace
temp
venv
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ set(AR_CACHEDRESOLVER_TARGET_PYTHON _${AR_CACHEDRESOLVER_TARGET_LIB})
set(AR_CACHEDRESOLVER_INSTALL_PREFIX ${AR_PROJECT_NAME}/${AR_CACHEDRESOLVER_USD_PLUGIN_NAME})
set(AR_CACHEDRESOLVER_ENV_CONTEXT_BYPASS "AR_CONTEXT_BYPASS")
set(AR_CACHEDRESOLVER_ENV_CONTEXT_DIRTY "AR_CONTEXT_DIRTY")
# Http Resolver
option(AR_HTTPRESOLVER_BUILD "Build the HttpResolver" OFF)
if("$ENV{RESOLVER_NAME}" STREQUAL "httpResolver")
set(AR_HTTPRESOLVER_BUILD ON)
endif()
set(AR_HTTPRESOLVER_USD_PLUGIN_NAME httpResolver)
set(AR_HTTPRESOLVER_USD_CXX_CLASS_NAME ArHttp)
set(AR_HTTPRESOLVER_TARGET_LIB httpResolver)
set(AR_HTTPRESOLVER_INSTALL_PREFIX ${AR_PROJECT_NAME}/${AR_HTTPRESOLVER_USD_PLUGIN_NAME})


# Arch
if (WIN32)
Expand Down Expand Up @@ -127,6 +137,7 @@ link_directories(${AR_PXR_LIB_DIR})
link_directories(${AR_PYTHON_LIB_DIR})

### Targets ###
## Maintained in this repo
# FileResolver
if(${AR_FILERESOLVER_BUILD})
add_subdirectory("src/FileResolver")
Expand All @@ -135,10 +146,15 @@ endif()
if(${AR_PYTHONRESOLVER_BUILD})
add_subdirectory("src/PythonResolver")
endif()
# HybridResolver
# CachedResolver
if(${AR_CACHEDRESOLVER_BUILD})
add_subdirectory("src/CachedResolver")
endif()
## Maintained in submodule repos
# HttpResolver
if(${AR_HTTPRESOLVER_BUILD})
add_subdirectory("src/HttpResolver/wrap")
endif()

# Status
message(STATUS "--- Usd Resolver Instructions Start ---")
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ See our [Automatic Installation](https://lucascheller.github.io/VFX-UsdAssetReso
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.
- **Hybrid Resolver** - Still work in progress, more info soon.
- **Cached Resolver** - Still work in progress, more info soon.
- **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 update manager UI.

For more information check out the [building guide](https://lucascheller.github.io/VFX-UsdAssetResolver/installation/building.html) as well as the [individual resolvers](https://lucascheller.github.io/VFX-UsdAssetResolver/resolvers/overview.html) to see their full functionality.

Expand Down
5 changes: 3 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ then
# Define repo root
export REPO_SOURCED=1
export REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && (pwd -W 2> /dev/null || pwd))
# Define Resolver > Has to be one of 'fileResolver'/'pythonResolver'/'cachedResolver'
export RESOLVER_NAME=pythonResolver
# Define Resolver > Has to be one of 'fileResolver'/'pythonResolver'/'cachedResolver'/'httpResolver'
export RESOLVER_NAME=fileResolver
export RESOLVER_NAME_UPPERCASE=$(echo ${RESOLVER_NAME} | tr '[:lower:]' '[:upper:]')
# Source Houdini (This defines what Houdini version to compile against)
pushd /opt/hfs19.5 > /dev/null
Expand All @@ -24,6 +24,7 @@ then
export AR_SEARCH_REGEX_FORMAT="Bo"
# Debug
export TF_DEBUG=${RESOLVER_NAME_UPPERCASE}_RESOLVER
# export TF_DEBUG=AR_RESOLVER_INIT
# Log
echo "The resolver environment for resolver '${RESOLVER_NAME}' has been initialized."
fi
Expand Down
2 changes: 1 addition & 1 deletion src/CachedResolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ configure_file(plugInfo.json.in plugInfo.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugInfo.json DESTINATION resources)
install(TARGETS ${AR_CACHEDRESOLVER_TARGET_LIB} RUNTIME DESTINATION lib)

## Target library > HYBRIDRESOLVER Python ##
## Target library > CachedResolver Python ##
add_library(${AR_CACHEDRESOLVER_TARGET_PYTHON}
SHARED
wrapResolver.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/FileResolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (WIN32)
endif()

### Targets ###
## Target library > FILERESOLVER ##
## Target library > fileResolver ##
add_library(${AR_FILERESOLVER_TARGET_LIB}
SHARED
debugCodes.cpp
Expand Down Expand Up @@ -53,7 +53,7 @@ configure_file(plugInfo.json.in plugInfo.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugInfo.json DESTINATION resources)
install(TARGETS ${AR_FILERESOLVER_TARGET_LIB} RUNTIME DESTINATION lib)

## Target library > FILERESOLVER Python ##
## Target library > fileResolver Python ##
add_library(${AR_FILERESOLVER_TARGET_PYTHON}
SHARED
module.cpp
Expand Down
45 changes: 45 additions & 0 deletions src/HttpResolver/wrap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### CPP Settings ###
SET(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/dist/${AR_HTTPRESOLVER_USD_PLUGIN_NAME}" CACHE PATH "Default install dir " FORCE)

# Preprocessor Defines (Same as #define)
if (WIN32)
add_compile_definitions(AR_HTTPRESOLVER_EXPORTS)
endif()

### Targets ###
## Target library > httpResolver ##
add_library(${AR_HTTPRESOLVER_TARGET_LIB}
SHARED
../arHttp/src/arHttp/resolver.cpp
)
#set_boost_namespace(${AR_HTTPRESOLVER_TARGET_LIB})
# Libs
target_link_libraries(${AR_HTTPRESOLVER_TARGET_LIB}
${AR_PXR_LIB_PREFIX}arch
${AR_PXR_LIB_PREFIX}tf
${AR_PXR_LIB_PREFIX}gf
${AR_PXR_LIB_PREFIX}vt
${AR_PXR_LIB_PREFIX}ar
${AR_PXR_LIB_PREFIX}sdf
${AR_BOOST_PYTHON_LIB}
)
# Headers
target_include_directories(${AR_HTTPRESOLVER_TARGET_LIB}
PUBLIC
${AR_BOOST_INCLUDE_DIR}
${AR_PYTHON_INCLUDE_DIR}
${AR_PXR_INCLUDE_DIR}
)
# Props
# Remove default "lib" prefix
set_target_properties(${AR_HTTPRESOLVER_TARGET_LIB} PROPERTIES PREFIX "")
# Preprocessor Defines (Same as #define)
target_compile_definitions(${AR_HTTPRESOLVER_TARGET_LIB}
PRIVATE
# USD Plugin Internal Namings
MFB_PACKAGE_NAME=${AR_HTTPRESOLVER_USD_PLUGIN_NAME}
)
# Install
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)
19 changes: 19 additions & 0 deletions src/HttpResolver/wrap/plugInfo.json.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"Plugins": [
{
"Info": {
"Types": {
"@AR_HTTPRESOLVER_USD_CXX_CLASS_NAME@": {
"bases": ["ArResolver"],
"implementsContexts" : true
}
}
},
"LibraryPath": "../lib/@AR_HTTPRESOLVER_TARGET_LIB@.@AR_ARCH_LIB_SUFFIX@",
"Name": "@AR_HTTPRESOLVER_USD_PLUGIN_NAME@",
"Root": ".",
"Type": "library"
}
]
}

5 changes: 5 additions & 0 deletions src/HttpResolver/wrap/server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
python -m pip install -e ../arHttp
uvicorn arHttpSampleServer:app --reload
4 changes: 2 additions & 2 deletions src/PythonResolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (WIN32)
endif()

### Targets ###
## Target library > PYTHONRESOLVER ##
## Target library > pythonResolver ##
add_library(${AR_PYTHONRESOLVER_TARGET_LIB}
SHARED
debugCodes.cpp
Expand Down Expand Up @@ -53,7 +53,7 @@ configure_file(plugInfo.json.in plugInfo.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugInfo.json DESTINATION resources)
install(TARGETS ${AR_PYTHONRESOLVER_TARGET_LIB} RUNTIME DESTINATION lib)

## Target library > PYTHONRESOLVER Python ##
## Target library > pythonResolver Python ##
add_library(${AR_PYTHONRESOLVER_TARGET_PYTHON}
SHARED
module.cpp
Expand Down

0 comments on commit 5420b14

Please sign in to comment.