Skip to content

Commit

Permalink
Merge pull request AnimalLogic#8 from autodesk-forks/dalgos/Integrate…
Browse files Browse the repository at this point in the history
…UFEInAL_USDmaya

MAYA-xxxx Integrating UFE into AL_USDMaya plugin
  • Loading branch information
dalgos-adsk authored and GitHub Enterprise committed May 15, 2018
2 parents 174c571 + c9c3cc3 commit 8bf73f3
Show file tree
Hide file tree
Showing 7 changed files with 417 additions and 177 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ add_definitions(${_PXR_CXX_DEFINITIONS})

find_package(Maya REQUIRED)

if(CMAKE_WANT_UFE_BUILD)
set(UFE_MAJOR_VERSION 0)
set(UFE_MINOR_VERSION 1)
message(STATUS "UFE Build Enabled")
message(STATUS "Using UFE version : ${UFE_MAJOR_VERSION}.${UFE_MINOR_VERSION}")
find_package(UFE REQUIRED)
include_directories(${UFE_INCLUDE_DIR})
endif()


include_directories(${MAYA_INCLUDE_DIRS})

include_directories(${PXR_INCLUDE_DIRS})
Expand Down
95 changes: 95 additions & 0 deletions cmake/modules/FindUFE.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# - UFE finder module
# This module searches for a valid UFE installation.
# It searches for UFE's libraries and include header files
#
# Variables that will be defined:
# UFE_FOUND Defined if a UFE installation has been detected
# UFE_LIBRARY Path to UFE library
# UFE_INCLUDE_DIR Path to the UFE's include directories
#

if(APPLE)
find_path(UFE_LIBRARY_DIR
libufe_${UFE_MAJOR_VERSION}_${UFE_MINOR_VERSION}.dylib
HINTS
"${MAYA_DEVKIT_LOCATION}"
"${MAYA_LOCATION}"
"$ENV{MAYA_LOCATION}"
"${MAYA_BASE_DIR}"
PATH_SUFFIXES
devkit/ufe/lib
lib/
DOC
"UFE's libraries path"
)
elseif(UNIX)
find_path(UFE_LIBRARY_DIR
libufe_${UFE_MAJOR_VERSION}_${UFE_MINOR_VERSION}.so
HINTS
"${MAYA_DEVKIT_LOCATION}"
"${MAYA_LOCATION}"
"$ENV{MAYA_LOCATION}"
"${MAYA_BASE_DIR}"
PATH_SUFFIXES
devkit/ufe/lib
lib/
DOC
"UFE's libraries path"
)
elseif(WIN32)
find_path(UFE_LIBRARY_DIR
ufe_${UFE_MAJOR_VERSION}_${UFE_MINOR_VERSION}.lib
HINTS
"${MAYA_DEVKIT_LOCATION}"
"${MAYA_LOCATION}"
"$ENV{MAYA_LOCATION}"
"${MAYA_BASE_DIR}"
PATH_SUFFIXES
devkit/ufe/lib
lib/
DOC
"UFE's libraries path"
)
endif()

find_path(UFE_INCLUDE_DIR
ufe/versionInfo.h
HINTS
"${MAYA_DEVKIT_LOCATION}"
"${MAYA_LOCATION}"
"$ENV{MAYA_LOCATION}"
"${MAYA_BASE_DIR}"
PATH_SUFFIXES
devkit/ufe/include
DOC
"UFE's headers path"
)

message(STATUS "UFE Library directory: ${UFE_LIBRARY_DIR}")


foreach(UFE_LIB
ufe_${UFE_MAJOR_VERSION}_${UFE_MINOR_VERSION})

find_library(UFE_LIBRARY
NAMES
${UFE_LIB}
PATHS
${UFE_LIBRARY_DIR}
NO_DEFAULT_PATH
)

if (UFE_LIBRARY)
list(APPEND UFE_LIBRARIES ${UFE_LIBRARY})
endif()
endforeach(UFE_LIB)

# handle the QUIETLY and REQUIRED arguments and set UFE_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(UFE
REQUIRED_VARS
UFE_INCLUDE_DIR
UFE_LIBRARIES
)
7 changes: 7 additions & 0 deletions lib/AL_USDMaya/AL/usdmaya/TypeIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,12 @@ const MTypeId AL_USDMAYA_DRIVENTRANSFORMS (0x00112A25);
const MTypeId AL_USDMAYA_DRIVENTRANSFORMS_DATA (0x00112A26);
const MTypeId AL_USDMAYA_LAYERMANAGER (0x00112A27);

#if defined(WANT_UFE_BUILD)
const int MAYA_UFE_RUNTIME_ID(1);
const char MAYA_UFE_SEPARATOR('|');
const int USD_UFE_RUNTIME_ID(2);
const char USD_UFE_SEPARATOR('/');
#endif

} // namespace usdmaya
} // namespace AL
19 changes: 19 additions & 0 deletions lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ typedef boost::filesystem::path path;
#include <algorithm>
#include <iterator>

#if defined(WANT_UFE_BUILD)
#include "ufe/path.h"
#endif

namespace AL {
namespace usdmaya {
namespace nodes {
Expand Down Expand Up @@ -2149,6 +2153,21 @@ void ProxyShape::registerEvents()
registerEvent("EditTargetChanged", AL::event::kUSDMayaEventType);
}

#if defined(WANT_UFE_BUILD)
//----------------------------------------------------------------------------------------------------------------------
Ufe::Path ProxyShape::ufePath() const
{
//Build a path segment to proxyShape
MDagPath thisPath;
MDagPath::getAPathTo(thisMObject(), thisPath);

// MDagPath does not include |world to its full path naem
MString fullpath = "|world" + thisPath.fullPathName();

return Ufe::Path(Ufe::PathSegment(fullpath.asChar(), MAYA_UFE_RUNTIME_ID, MAYA_UFE_SEPARATOR));
}
#endif

//----------------------------------------------------------------------------------------------------------------------
} // nodes
} // usdmaya
Expand Down
13 changes: 13 additions & 0 deletions lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
#include <functional>
#include "AL/usd/utils/ForwardDeclares.h"

#if defined(WANT_UFE_BUILD)
namespace Ufe {
class Path;
}
#endif

PXR_NAMESPACE_USING_DIRECTIVE

PXR_NAMESPACE_OPEN_SCOPE
Expand Down Expand Up @@ -833,6 +839,13 @@ class ProxyShape
AL_USDMAYA_PUBLIC
SdfPathVector getPrimPathsFromCommaJoinedString(const MString &paths) const;

#if defined(WANT_UFE_BUILD)
/// \brief Get the UFE path of the maya proxy shape
/// \return An UFE path containing the path to the proxy shape
AL_USDMAYA_PUBLIC
Ufe::Path ufePath() const;
#endif

private:

static void onSelectionChanged(void* ptr);
Expand Down
Loading

0 comments on commit 8bf73f3

Please sign in to comment.