Skip to content

Commit

Permalink
HYDRA-307: Add the FootPrint node as an Hydra example
Browse files Browse the repository at this point in the history
  • Loading branch information
lanierd-adsk committed Feb 15, 2024
1 parent b501edb commit 563a86f
Show file tree
Hide file tree
Showing 34 changed files with 1,532 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/mayaHydra/flowViewportAPIExamples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_subdirectory(flowViewportAPIMayaLocator)
add_subdirectory(footPrintNode)
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ MStatus FlowViewportAPIMayaLocator::initialize()
MAKE_INPUT(nAttr);
CHECK_MSTATUS ( nAttr.setDefault(5.0, 5.0, 5.0) );

//Create dummy output attribute to trigger a call to the compute function on demand. as it's in the compute fonction that we add our scene indices
//Create dummy input attribute to trigger a call to the compute function on demand. as it's in the compute fonction that we add our scene indices
mDummyInput = nAttr.create("dummyInput", "dI", MFnNumericData::kInt, 1.0, &status);
MAKE_INPUT(nAttr);
CHECK_MSTATUS ( nAttr.setDefault(1) );
Expand Down
102 changes: 102 additions & 0 deletions lib/mayaHydra/flowViewportAPIExamples/footPrintNode/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
set(TARGET_NAME mayaHydraFootPrintNode)

add_library(${TARGET_NAME} SHARED)

# -----------------------------------------------------------------------------
# sources
# -----------------------------------------------------------------------------
target_sources(${TARGET_NAME}
PRIVATE
mhFootPrintNode.cpp
)

set(HEADERS
PRIVATE
)

# -----------------------------------------------------------------------------
# compiler configuration
# -----------------------------------------------------------------------------
target_compile_definitions(${TARGET_NAME}
PRIVATE
# M3dView needs this (technically, MNativeWindowHdl.h)
# private atm because M3dView is only used in .cpp right now
# gcc will NOT set this automatically
$<$<BOOL:${IS_LINUX}>:LINUX>
# Not sure if msvcc sets this automatically, but won't hurt to redefine
$<$<BOOL:${IS_WINDOWS}>:_WIN32>
MFB_ALT_PACKAGE_NAME="${TARGET_NAME}" # This is used by Pixar HdSceneIndexPluginRegistry::Define to create a unique name
)

# -----------------------------------------------------------------------------
# include directories
# -----------------------------------------------------------------------------
if(DEFINED MAYAUSD_VERSION)
target_compile_definitions(${TARGET_NAME}
PRIVATE
MAYAUSD_VERSION=${MAYAUSD_VERSION}
)
endif()

if(DEFINED MAYAHYDRA_VERSION)
target_compile_definitions(${TARGET_NAME}
PRIVATE
MAYAHYDRA_VERSION=${MAYAHYDRA_VERSION}
)
endif()
if(DEFINED MAYAHYDRA_CUT_ID)
target_compile_definitions(${TARGET_NAME}
PRIVATE
MAYAHYDRA_CUT_ID=${MAYAHYDRA_CUT_ID}
)
endif()

mayaHydra_compile_config(${TARGET_NAME})

# -----------------------------------------------------------------------------
# link libraries
# -----------------------------------------------------------------------------
target_link_libraries(${TARGET_NAME}
PRIVATE
mayaHydraLib
)

# -----------------------------------------------------------------------------
# properties
# -----------------------------------------------------------------------------
maya_set_plugin_properties(${TARGET_NAME})

# -----------------------------------------------------------------------------
# run-time search paths
# -----------------------------------------------------------------------------
if(IS_MACOSX OR IS_LINUX)
mayaUsd_init_rpath(rpath "lib/maya")
if(DEFINED MAYAUSD_TO_USD_RELATIVE_PATH)
mayaUsd_add_rpath(rpath "../../${MAYAUSD_TO_USD_RELATIVE_PATH}/lib")
elseif(DEFINED PXR_USD_LOCATION)
mayaUsd_add_rpath(rpath "${PXR_USD_LOCATION}/lib")
endif()
if (IS_LINUX AND DEFINED MAYAUSD_TO_USD_RELATIVE_PATH)
mayaUsd_add_rpath(rpath "../../${MAYAUSD_TO_USD_RELATIVE_PATH}/lib64")
endif()
if(IS_MACOSX AND DEFINED MAYAUSD_TO_USD_RELATIVE_PATH)
mayaUsd_add_rpath(rpath "../../../../Maya.app/Contents/MacOS")
endif()
mayaUsd_add_rpath(rpath "../")
mayaUsd_install_rpath(rpath ${TARGET_NAME})
endif()

# -----------------------------------------------------------------------------
# install
# -----------------------------------------------------------------------------
install(TARGETS ${TARGET_NAME}
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/maya)

if(IS_WINDOWS)
install(FILES $<TARGET_PDB_FILE:${TARGET_NAME}>
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/maya OPTIONAL)
endif()

set(LIBFILENAME ${CMAKE_SHARED_LIBRARY_PREFIX}${TARGET_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(PLUG_INFO_LIBRARY_PATH "../../../${LIBFILENAME}")
set(PLUG_INFO_RESOURCE_PATH "resources")
Loading

0 comments on commit 563a86f

Please sign in to comment.