Skip to content

Commit 68b861f

Browse files
EMSUSD-1692 - Add LookdevXUsd Extension
1 parent 1082fa2 commit 68b861f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+6106
-7
lines changed

CMakeLists.txt

+29-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ project(maya-usd)
2222
#------------------------------------------------------------------------------
2323
option(BUILD_MAYAUSD_LIBRARY "Build Core USD libraries." ON)
2424
option(BUILD_MAYAUSDAPI_LIBRARY "Build the mayaUsdAPI subset library that provides a stable versioned interface to mayaUsd for external plugins." ON)
25+
option(BUILD_LOOKDEVXUSD_LIBRARY "Build LookdevXUsd library using LookdevXUfe." ON)
2526
option(BUILD_ADSK_PLUGIN "Build Autodesk USD plugin." ON)
2627
option(BUILD_PXR_PLUGIN "Build the Pixar USD plugin and libraries." ON)
2728
option(BUILD_AL_PLUGIN "Build the Animal Logic USD plugin and libraries." ON)
@@ -128,6 +129,11 @@ if (BUILD_MAYAUSDAPI_LIBRARY)
128129
set(MAYAUSDAPI_VERSION "${MAYAUSDAPI_MAJOR_VERSION}.${MAYAUSDAPI_MINOR_VERSION}.${MAYAUSDAPI_PATCH_LEVEL}")
129130
endif()
130131

132+
if (BUILD_MAYAUSDAPI_LIBRARY)
133+
if (NOT BUILD_MAYAUSD_LIBRARY)
134+
message(FATAL_ERROR "Building mayaUsdAPI library requires MayaUsd core libraries to be built, please enable BUILD_MAYAUSD_LIBRARY.")
135+
endif()
136+
endif()
131137

132138
if (DEFINED PYTHON_INCLUDE_DIR AND DEFINED PYTHON_LIBRARIES AND DEFINED Python_EXECUTABLE)
133139
SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
@@ -226,6 +232,28 @@ if(BUILD_MAYAUSD_LIBRARY)
226232
endif()
227233
endif()
228234

235+
# Need LookdevXUfe/MayaUsdAPI when building LookdevXUsd.
236+
if(BUILD_LOOKDEVXUSD_LIBRARY)
237+
if(NOT BUILD_MAYAUSDAPI_LIBRARY)
238+
message(FATAL_ERROR "Building LookdevXUsd requires MayaUsdAPI.")
239+
endif()
240+
241+
if(MAYA_APP_VERSION VERSION_GREATER 2025)
242+
find_package(LookdevXUfe) # Optional component - if not found, disable LookdevXUsd.
243+
else()
244+
set(BUILD_LOOKDEVXUSD_LIBRARY OFF)
245+
message(WARNING "Disabling LookdevXUsd: it is not supported by Maya ${MAYA_APP_VERSION}.")
246+
endif()
247+
if (LookdevXUfe_FOUND)
248+
message(STATUS "Build LookdevXUsd with LookdevXUfe version: ${LookdevXUfe_VERSION}")
249+
message(STATUS " LookdevXUfe include dir: ${LookdevXUfe_INCLUDE_DIR}")
250+
message(STATUS " LookdevXUfe library : ${LookdevXUfe_LIBRARY}")
251+
else()
252+
set(BUILD_LOOKDEVXUSD_LIBRARY OFF)
253+
message(WARNING "Disabling LookdevXUsd as LookdevXUfe was not found (in Maya devkit).")
254+
endif()
255+
endif()
256+
229257
if(BUILD_MAYAUSD_LIBRARY AND (USD_VERSION VERSION_GREATER_EQUAL "0.24.11"))
230258
# In USD v24.11 Pixar USD has completely removed Boost.
231259
# However MayaUsd is still using a few of the Boost components, so
@@ -299,12 +327,6 @@ if (BUILD_PXR_PLUGIN OR BUILD_AL_PLUGIN OR BUILD_ADSK_PLUGIN)
299327
endif()
300328
endif()
301329

302-
if (BUILD_MAYAUSDAPI_LIBRARY)
303-
if (NOT BUILD_MAYAUSD_LIBRARY)
304-
message(FATAL_ERROR "Building mayaUsdAPI library requires MayaUsd core libraries to be built, please enable BUILD_MAYAUSD_LIBRARY.")
305-
endif()
306-
endif()
307-
308330
if (BUILD_PXR_PLUGIN)
309331
add_subdirectory(plugin/pxr)
310332
endif()
@@ -371,6 +393,6 @@ endif()
371393
# Special file for handling boost vs pxr::boost
372394
#------------------------------------------------------------------------------
373395
mayaUsd_promoteHeaderList(HEADERS pxr_python.h BASEDIR "NONE")
374-
install(FILES ${CMAKE_BINARY_DIR}/include//pxr_python.h
396+
install(FILES ${CMAKE_BINARY_DIR}/include/pxr_python.h
375397
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
376398
)

cmake/modules/FindLookdevXUfe.cmake

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#
2+
# Simple module to find LookdevXUfe.
3+
#
4+
# This module searches for a valid LookdevXUfe installation in the Maya devkit.
5+
# It searches for LookdevXUfe's libraries and include files.
6+
#
7+
# Variables that will be defined:
8+
# LookdevXUfe_FOUND Defined if a LookdevXUfe installation has been detected
9+
# LookdevXUfe_LIBRARY Path to LookdevXUfe library
10+
# LookdevXUfe_INCLUDE_DIR Path to the LookdevXUfe include directory
11+
# LookdevXUfe_VERSION LookdevXUfe version (major.minor.patch) from LookdevXUfe.h
12+
#
13+
14+
find_path(LookdevXUfe_INCLUDE_DIR
15+
LookdevXUfe/LookdevXUfe.h
16+
HINTS
17+
$ENV{LOOKDEVXUFE_INCLUDE_ROOT}
18+
${LOOKDEVXUFE_INCLUDE_ROOT}
19+
${MAYA_DEVKIT_LOCATION}
20+
$ENV{MAYA_DEVKIT_LOCATION}
21+
${MAYA_LOCATION}
22+
$ENV{MAYA_LOCATION}
23+
${MAYA_BASE_DIR}
24+
PATH_SUFFIXES
25+
devkit/ufe/extensions/lookdevXUfe/include
26+
include/
27+
DOC
28+
"LookdevXUfe header path"
29+
)
30+
31+
# Get the LookdevXUfe_VERSION from LookdevXUfe.h
32+
if(LookdevXUfe_INCLUDE_DIR AND EXISTS "${LookdevXUfe_INCLUDE_DIR}/LookdevXUfe/LookdevXUfe.h")
33+
# Parse the file and get the three lines that have the version info.
34+
file(STRINGS
35+
"${LookdevXUfe_INCLUDE_DIR}/LookdevXUfe/LookdevXUfe.h"
36+
_ldx_vers
37+
REGEX "#define[ ]+(LOOKDEVXUFE_MAJOR_VERSION|LOOKDEVXUFE_MINOR_VERSION|LOOKDEVXUFE_PATCH_LEVEL)[ ]+[0-9]+$")
38+
39+
# Then extract the number from each one.
40+
foreach(_ldxufe_tmp ${_ldx_vers})
41+
if(_ldxufe_tmp MATCHES "#define[ ]+(LOOKDEVXUFE_MAJOR_VERSION|LOOKDEVXUFE_MINOR_VERSION|LOOKDEVXUFE_PATCH_LEVEL)[ ]+([0-9]+)$")
42+
set(${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
43+
endif()
44+
endforeach()
45+
set(LookdevXUfe_VERSION ${LOOKDEVXUFE_MAJOR_VERSION}.${LOOKDEVXUFE_MINOR_VERSION}.${LOOKDEVXUFE_PATCH_LEVEL})
46+
endif()
47+
48+
find_library(LookdevXUfe_LIBRARY
49+
NAMES
50+
lookdevXUfe_${LOOKDEVXUFE_MAJOR_VERSION}_${LOOKDEVXUFE_MINOR_VERSION}
51+
HINTS
52+
$ENV{LOOKDEVXUFE_LIB_ROOT}
53+
${LOOKDEVXUFE_LIB_ROOT}
54+
${MAYA_DEVKIT_LOCATION}
55+
$ENV{MAYA_DEVKIT_LOCATION}
56+
${MAYA_LOCATION}
57+
$ENV{MAYA_LOCATION}
58+
${MAYA_BASE_DIR}
59+
PATHS
60+
${UFE_LIBRARY_DIR}
61+
PATH_SUFFIXES
62+
devkit/ufe/extensions/lookdevXUfe/lib
63+
lib/
64+
DOC
65+
"LookdevXUfe library"
66+
NO_DEFAULT_PATH
67+
)
68+
69+
# Handle the QUIETLY and REQUIRED arguments and set LookdevXUfe_FOUND to TRUE if
70+
# all listed variables are TRUE.
71+
include(FindPackageHandleStandardArgs)
72+
73+
find_package_handle_standard_args(LookdevXUfe
74+
REQUIRED_VARS
75+
LookdevXUfe_INCLUDE_DIR
76+
LookdevXUfe_LIBRARY
77+
VERSION_VAR
78+
LookdevXUfe_VERSION
79+
)

doc/build.md

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ c:\maya-usd> python build.py --maya-location "C:\Program Files\Autodesk\Maya2025
120120
Name | Description | Default
121121
--- | --- | ---
122122
BUILD_MAYAUSD_LIBRARY | builds Core USD libraries. | ON
123+
BUILD_MAYAUSDAPI_LIBRARY | Build the mayaUsdAPI subset library that provides a stable versioned interface to mayaUsd for external plugins. | ON
124+
BUILD_LOOKDEVXUSD_LIBRARY | Build LookdevXUsd library using LookdevXUfe. | ON
123125
BUILD_ADSK_PLUGIN | builds Autodesk USD plugin. | ON
124126
BUILD_PXR_PLUGIN | builds the Pixar USD plugin and libraries. | ON
125127
BUILD_AL_PLUGIN | builds the Animal Logic USD plugin and libraries. | ON

lib/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ endif()
66
if (BUILD_MAYAUSDAPI_LIBRARY)
77
add_subdirectory(mayaUsdAPI)
88
endif()
9+
if (BUILD_LOOKDEVXUSD_LIBRARY)
10+
add_subdirectory(lookdevXUsd)
11+
endif()

lib/lookdevXUsd/CMakeLists.txt

+177
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#
2+
# Copyright 2024 Autodesk
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
project(lookdevXUsd)
18+
19+
add_library(${PROJECT_NAME} SHARED)
20+
21+
# -----------------------------------------------------------------------------
22+
# sources
23+
# -----------------------------------------------------------------------------
24+
target_sources(${PROJECT_NAME}
25+
PRIVATE
26+
LookdevXUsd.cpp
27+
UsdCapabilityHandler.cpp
28+
UsdClipboardHandler.cpp
29+
UsdComponentConnections.cpp
30+
UsdConnectionCommands.cpp
31+
UsdDebugHandler.cpp
32+
UsdDeleteCommand.cpp
33+
UsdExtendedAttributeHandler.cpp
34+
UsdExtendedConnectionHandler.cpp
35+
UsdFileHandler.cpp
36+
UsdHierarchy.cpp
37+
UsdHierarchyHandler.cpp
38+
UsdLookdevHandler.cpp
39+
UsdMaterial.cpp
40+
UsdMaterialCommands.cpp
41+
UsdMaterialHandler.cpp
42+
UsdMaterialValidator.cpp
43+
UsdSceneItemOps.cpp
44+
UsdSceneItemOpsHandler.cpp
45+
UsdSceneItemUI.cpp
46+
UsdSceneItemUIHandler.cpp
47+
UsdSoloingHandler.cpp
48+
UsdUINodeGraphNode.cpp
49+
UsdUINodeGraphNodeHandler.cpp
50+
Utils.cpp
51+
)
52+
53+
set(HEADERS
54+
Export.h
55+
LookdevXUsd.h
56+
UsdCapabilityHandler.h
57+
UsdClipboardHandler.h
58+
UsdComponentConnections.h
59+
UsdConnectionCommands.h
60+
UsdDebugHandler.h
61+
UsdDeleteCommand.h
62+
UsdExtendedAttributeHandler.h
63+
UsdExtendedConnectionHandler.h
64+
UsdFileHandler.h
65+
UsdHierarchy.h
66+
UsdHierarchyHandler.h
67+
UsdLookdevHandler.h
68+
UsdMaterial.h
69+
UsdMaterialCommands.h
70+
UsdMaterialHandler.h
71+
UsdMaterialValidator.h
72+
UsdSceneItemOps.h
73+
UsdSceneItemOpsHandler.h
74+
UsdSceneItemUI.h
75+
UsdSceneItemUIHandler.h
76+
UsdSoloingHandler.h
77+
UsdUINodeGraphNode.h
78+
UsdUINodeGraphNodeHandler.h
79+
Utils.h
80+
)
81+
82+
# -----------------------------------------------------------------------------
83+
# Compiler configuration
84+
# -----------------------------------------------------------------------------
85+
target_compile_definitions(${PROJECT_NAME}
86+
PRIVATE
87+
LOOKDEVX_USD_SHARED
88+
PXR_VERSION=${PXR_VERSION}
89+
MFB_PACKAGE_NAME="${PROJECT_NAME}"
90+
MFB_ALT_PACKAGE_NAME="${PROJECT_NAME}"
91+
MFB_PACKAGE_MODULE="${PROJECT_NAME}"
92+
$<$<BOOL:${IS_MACOSX}>:OSMac_>
93+
$<$<BOOL:${IS_LINUX}>:LINUX>
94+
# this flag is needed when building for Maya
95+
$<$<BOOL:${IS_WINDOWS}>:WIN32>
96+
)
97+
98+
mayaUsd_compile_config(${PROJECT_NAME})
99+
100+
mayaUsd_promoteHeaderList(
101+
HEADERS
102+
${HEADERS}
103+
BASEDIR
104+
${PROJECT_NAME}
105+
)
106+
107+
# -----------------------------------------------------------------------------
108+
# include directories
109+
# -----------------------------------------------------------------------------
110+
target_include_directories(${PROJECT_NAME}
111+
PUBLIC
112+
${PXR_INCLUDE_DIRS}
113+
${UFE_INCLUDE_DIR}
114+
${LookdevXUfe_INCLUDE_DIR}
115+
${CMAKE_BINARY_DIR}/include
116+
)
117+
118+
# -----------------------------------------------------------------------------
119+
# link libraries
120+
# -----------------------------------------------------------------------------
121+
target_link_libraries(${PROJECT_NAME}
122+
PUBLIC
123+
sdf
124+
sdr
125+
mayaUsdAPI
126+
PRIVATE
127+
usd
128+
usdShade
129+
usdUtils
130+
usdUI
131+
${UFE_LIBRARY}
132+
${LookdevXUfe_LIBRARY}
133+
)
134+
135+
# -----------------------------------------------------------------------------
136+
# run-time search paths
137+
# -----------------------------------------------------------------------------
138+
if(IS_MACOSX OR IS_LINUX)
139+
mayaUsd_init_rpath(rpath "lib")
140+
if(DEFINED MAYAUSD_TO_USD_RELATIVE_PATH)
141+
mayaUsd_add_rpath(rpath "../${MAYAUSD_TO_USD_RELATIVE_PATH}/lib")
142+
elseif(DEFINED PXR_USD_LOCATION)
143+
mayaUsd_add_rpath(rpath "${PXR_USD_LOCATION}/lib")
144+
endif()
145+
if (IS_LINUX AND DEFINED MAYAUSD_TO_USD_RELATIVE_PATH)
146+
mayaUsd_add_rpath(rpath "../${MAYAUSD_TO_USD_RELATIVE_PATH}/lib64")
147+
endif()
148+
if(IS_MACOSX AND DEFINED MAYAUSD_TO_USD_RELATIVE_PATH)
149+
mayaUsd_add_rpath(rpath "../../../Maya.app/Contents/MacOS")
150+
endif()
151+
mayaUsd_install_rpath(rpath ${PROJECT_NAME})
152+
endif()
153+
154+
# -----------------------------------------------------------------------------
155+
# install
156+
# -----------------------------------------------------------------------------
157+
158+
# TODO - do we need to install the headers?
159+
#install(FILES ${HEADERS}
160+
# DESTINATION
161+
# ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}
162+
#)
163+
164+
install(TARGETS ${PROJECT_NAME}
165+
LIBRARY
166+
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
167+
ARCHIVE
168+
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
169+
RUNTIME
170+
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
171+
)
172+
173+
if(IS_WINDOWS)
174+
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
175+
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib OPTIONAL
176+
)
177+
endif()

lib/lookdevXUsd/Export.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//*****************************************************************************
2+
// Copyright (c) 2024 Autodesk, Inc.
3+
// All rights reserved.
4+
//
5+
// These coded instructions, statements, and computer programs contain
6+
// unpublished proprietary information written by Autodesk, Inc. and are
7+
// protected by Federal copyright law. They may not be disclosed to third
8+
// parties or copied or duplicated in any form, in whole or in part, without
9+
// the prior written consent of Autodesk, Inc.
10+
//*****************************************************************************
11+
12+
#ifndef LOOKDEVX_USD_EXPORT_H_
13+
#define LOOKDEVX_USD_EXPORT_H_
14+
15+
#if defined(_WIN32)
16+
#if defined(LOOKDEVX_USD_SHARED)
17+
#define LOOKDEVX_USD_EXPORT __declspec(dllexport)
18+
#else
19+
#define LOOKDEVX_USD_EXPORT __declspec(dllimport)
20+
#endif
21+
#elif defined(__GNUC__)
22+
#define LOOKDEVX_USD_EXPORT __attribute__((visibility("default")))
23+
#else
24+
#error "Unsupported platform."
25+
#endif
26+
27+
#endif

0 commit comments

Comments
 (0)