-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #467 from maya3d/duvalb/HYDRA-425/introduce_basic_…
…hydra_scene_browser_plugin Duvalb/hydra 425/introduce basic hydra scene browser plugin
- Loading branch information
Showing
4 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# ----------------------------------------------------------------------------- | ||
# setup | ||
# ----------------------------------------------------------------------------- | ||
set(TARGET_NAME mayaHydraSceneBrowser) | ||
add_library(${TARGET_NAME} SHARED) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# sources | ||
# ----------------------------------------------------------------------------- | ||
target_sources(${TARGET_NAME} | ||
PRIVATE | ||
mayaHydraSceneBrowser.cpp | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# compiler configuration | ||
# ----------------------------------------------------------------------------- | ||
mayaUsd_compile_config(${TARGET_NAME}) | ||
|
||
target_compile_definitions(${TARGET_NAME} | ||
PRIVATE | ||
$<$<BOOL:${IS_MACOSX}>:OSMac_> | ||
$<$<BOOL:${IS_LINUX}>:LINUX> | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# include directories | ||
# ----------------------------------------------------------------------------- | ||
target_include_directories(${TARGET_NAME} | ||
PUBLIC | ||
${MAYA_INCLUDE_DIRS} | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# link libraries | ||
# ----------------------------------------------------------------------------- | ||
target_link_libraries(${TARGET_NAME} | ||
PUBLIC | ||
${MAYA_LIBRARIES} | ||
mayaHydraLib | ||
adskHydraSceneBrowser | ||
) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# properties | ||
# ----------------------------------------------------------------------------- | ||
maya_set_plugin_properties(${TARGET_NAME}) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# run-time search paths | ||
# ----------------------------------------------------------------------------- | ||
if(IS_MACOSX OR IS_LINUX) | ||
mayaUsd_init_rpath(rpath "lib/maya") | ||
mayaUsd_add_rpath(rpath "${CMAKE_INSTALL_PREFIX}/lib/adskHydraSceneBrowser") | ||
mayaUsd_install_rpath(rpath ${TARGET_NAME}) | ||
endif() | ||
|
||
# ----------------------------------------------------------------------------- | ||
# install | ||
# ----------------------------------------------------------------------------- | ||
install(TARGETS ${TARGET_NAME} | ||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/maya) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "mayaHydraSceneBrowser.h" | ||
|
||
#include <mayaHydraLib/hydraUtils.h> | ||
#include <mayaHydraLib/interfaceImp.h> | ||
|
||
#include <sceneIndexDebuggerWidget.h> | ||
|
||
#include <maya/MFnPlugin.h> | ||
#include <maya/MArgList.h> | ||
#include <maya/MGlobal.h> | ||
|
||
PXR_NAMESPACE_USING_DIRECTIVE | ||
|
||
using namespace MAYAHYDRA_NS; | ||
|
||
HduiSceneIndexDebuggerWidget* widget = nullptr; | ||
MStatus mayaHydraSceneBrowserCmd::doIt( const MArgList& args ) | ||
{ | ||
const SceneIndicesVector& sceneIndices = GetMayaHydraLibInterface().GetTerminalSceneIndices(); | ||
if (sceneIndices.empty()) { | ||
return MS::kFailure; | ||
} | ||
else { | ||
if (!widget) { | ||
widget = new HduiSceneIndexDebuggerWidget(); | ||
} | ||
widget->SetSceneIndex("", sceneIndices.front(), true); | ||
widget->show(); | ||
} | ||
|
||
return MS::kSuccess; | ||
} | ||
|
||
MStatus initializePlugin( MObject obj ) | ||
{ | ||
MFnPlugin plugin( obj, "Autodesk", "1.0", "Any" ); | ||
plugin.registerCommand( "mayaHydraSceneBrowser", mayaHydraSceneBrowserCmd::creator ); | ||
return MS::kSuccess; | ||
} | ||
|
||
MStatus uninitializePlugin( MObject obj ) | ||
{ | ||
MFnPlugin plugin( obj ); | ||
plugin.deregisterCommand( "mayaHydraSceneBrowser" ); | ||
return MS::kSuccess; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef MH_SCENEBROWSER_CMD | ||
#define MH_SCENEBROWSER_CMD | ||
|
||
#include <maya/MPxCommand.h> | ||
|
||
class mayaHydraSceneBrowserCmd : public MPxCommand | ||
{ | ||
public: | ||
static void* creator() { return new mayaHydraSceneBrowserCmd(); } | ||
|
||
static const MString name; | ||
|
||
MStatus doIt(const MArgList& args) override; | ||
}; | ||
|
||
#endif // MH_SCENEBROWSER_CMD |