Skip to content

Commit

Permalink
Refactored to seperate code into 'layers' of source code
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Barry authored and fabal committed Feb 9, 2018
1 parent 8ec421e commit f6918a0
Show file tree
Hide file tree
Showing 139 changed files with 2,095 additions and 1,342 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Expand Up @@ -36,6 +36,7 @@ include(CXXDefaults)
add_definitions(${_PXR_CXX_DEFINITIONS})

find_package(Maya REQUIRED)

include_directories(${MAYA_INCLUDE_DIRS})

if(${MAYA_API_VERSION} STRGREATER 2017)
Expand Down Expand Up @@ -75,8 +76,20 @@ set(AL_USDMAYA_LOCATION_NAME
"Name of the environment variable used to store AL_USDMaya installation location"
)

# Build all the utils
set(UTILS_INCLUDE_LOCATION ${CMAKE_CURRENT_LIST_DIR}/utils)
set(USDUTILS_INCLUDE_LOCATION ${CMAKE_CURRENT_LIST_DIR}/usdutils)
set(MAYAUTILS_INCLUDE_LOCATION ${CMAKE_CURRENT_LIST_DIR}/mayautils)
set(USDMAYAUTILS_INCLUDE_LOCATION ${CMAKE_CURRENT_LIST_DIR}/usdmayautils)

add_subdirectory(utils)
add_subdirectory(usdutils)
add_subdirectory(mayautils)
add_subdirectory(usdmayautils)

add_subdirectory(lib)
add_subdirectory(plugin)

if(BUILD_USDMAYA_SCHEMAS)
message(STATUS "Building AL_USDMayaSchemas")
set(SCHEMAS_PYTHON_MODULE AL.usd.maya.schemas)
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile_centos6
@@ -1,4 +1,4 @@
FROM usd-docker/usd:latest-centos6-mayalatest
FROM knockout:5000/usd-docker/usd:latest-centos6-maya2017

LABEL alusdmaya.version="0.20.2" maintainer="Animal Logic"

Expand Down
48 changes: 24 additions & 24 deletions lib/AL_USDMaya/AL/docpages/docs_events.h
Expand Up @@ -67,7 +67,7 @@ defined within AL/usdmaya/Global.cpp. The main purpose of this binding is to con
logging and scripting capability of the DCC app.
\code
#include "AL/maya/EventHandler.h"
#include "AL/event/EventHandler.h"
// indices into the eventTypeStrings array
constexpr uint32_t kUserSpecifiedEventType = 0;
Expand Down Expand Up @@ -120,7 +120,7 @@ static MayaEventSystemBinding g_eventSystem;
void initEventSystem()
{
// when you need to initialise the event system, simple pass a pointer to the backend DCC system.
AL::maya::EventScheduler::initScheduler(&g_eventSystem);
AL::event::EventScheduler::initScheduler(&g_eventSystem);
}
\endcode
Expand All @@ -130,10 +130,10 @@ The following code sample provides a simple example of how the C++ api works in
\code
#include "AL/maya/EventHandler.h"
#include "AL/event/EventHandler.h"
// a global identifier for the event we have created
AL::maya::EventId g_mySimpleEvent = 0;
AL::event::EventId g_mySimpleEvent = 0;
class SimpleEventExample
: public MPxCommand
Expand All @@ -144,13 +144,13 @@ class SimpleEventExample
MStatus doIt(const MArgList& args)
{
// ask the scheduler to trigger any callbacks registered against our event
AL::maya::EventScheduler::getScheduler().triggerEvent(g_mySimpleEvent);
AL::event::EventScheduler::getScheduler().triggerEvent(g_mySimpleEvent);
return MS::kSuccess;
}
};
AL::maya::CallbackId g_myCallbackId = 0;
AL::maya::event::CallbackId g_myCallbackId = 0;
void myCallbackFunction(void* userData)
{
Expand All @@ -161,10 +161,10 @@ void myCallbackFunction(void* userData)
MStatus initializePlugin(MObject obj)
{
// init the scheduler - this step is only required if you are not using the usdmaya plugin
AL::maya::EventScheduler::initScheduler(&g_eventSystem);
AL::event::EventScheduler::initScheduler(&g_eventSystem);
// to access the global scheduler
auto& scheduler = AL::maya::EventScheduler::getScheduler();
auto& scheduler = AL::event::EventScheduler::getScheduler();
// lets register a simple event named "OnSomethingHappened" that is of the type kUserSpecifiedEventType
g_mySimpleEvent = scheduler.registerEvent("OnSomethingHappened", kUserSpecifiedEventType);
Expand Down Expand Up @@ -198,10 +198,10 @@ MStatus initializePlugin(MObject obj)
MStatus uninitializePlugin(MObject obj)
{
// unregister the callback
AL::maya::EventScheduler::getScheduler().unregisterCallback(g_myCallbackId);
AL::event::EventScheduler::getScheduler().unregisterCallback(g_myCallbackId);
// unregister the event
AL::maya::EventScheduler::getScheduler().unregisterEvent(g_mySimpleEvent);
AL::event::EventScheduler::getScheduler().unregisterEvent(g_mySimpleEvent);
MFnPlugin fn(obj);
fn.unregisterCommand("simpleEventExample");
Expand Down Expand Up @@ -338,7 +338,7 @@ A simple example of setting a node up with the events system would look like so:
\code
#include "AL/maya/EventHandler.h"
#include "AL/event/EventHandler.h"
// To make use of the node events, ensure you derive a node from the MayaNodeEvents class.
class MyMayaNode
Expand Down Expand Up @@ -510,11 +510,11 @@ task is something that needs to be done manually), and child events can only be
\code
#include "AL/maya/EventHandler.h"
#include "AL/event/EventHandler.h"
// a global identifier for the event we have created
AL::maya::EventId g_mySimpleEvent1 = 0;
AL::maya::EventId g_mySimpleEvent2 = 0;
AL::event::EventId g_mySimpleEvent1 = 0;
AL::event::EventId g_mySimpleEvent2 = 0;
class ParentEventExample
: public MPxCommand
Expand All @@ -525,20 +525,20 @@ class ParentEventExample
MStatus doIt(const MArgList& args)
{
// ask the scheduler to trigger any callbacks registered against our event
AL::maya::EventScheduler::getScheduler().triggerEvent(g_mySimpleEvent1);
AL::event::EventScheduler::getScheduler().triggerEvent(g_mySimpleEvent1);
return MS::kSuccess;
}
};
AL::maya::CallbackId g_myCallbackId1 = 0;
AL::maya::CallbackId g_myCallbackId2 = 0;
AL::maya::event::CallbackId g_myCallbackId1 = 0;
AL::maya::event::CallbackId g_myCallbackId2 = 0;
void myCallbackFunction1(void* userData)
{
MGlobal::displayInfo("I am a callback that will trigger an event!\n");
AL::maya::EventScheduler::getScheduler().triggerEvent(g_mySimpleEvent2);
AL::event::EventScheduler::getScheduler().triggerEvent(g_mySimpleEvent2);
}
void myCallbackFunction2(void* userData)
Expand All @@ -550,10 +550,10 @@ void myCallbackFunction2(void* userData)
MStatus initializePlugin(MObject obj)
{
// init the scheduler - this step is only required if you are not using the usdmaya plugin
AL::maya::EventScheduler::initScheduler(&g_eventSystem);
AL::event::EventScheduler::initScheduler(&g_eventSystem);
// to access the global scheduler
auto& scheduler = AL::maya::EventScheduler::getScheduler();
auto& scheduler = AL::event::EventScheduler::getScheduler();
// lets register a simple event
g_mySimpleEvent1 = scheduler.registerEvent("OnParentThingHappened", kUserSpecifiedEventType);
Expand Down Expand Up @@ -609,12 +609,12 @@ MStatus initializePlugin(MObject obj)
MStatus uninitializePlugin(MObject obj)
{
// unregister the callback
AL::maya::EventScheduler::getScheduler().unregisterCallback(g_myCallbackId2);
AL::maya::EventScheduler::getScheduler().unregisterCallback(g_myCallbackId1);
AL::event::EventScheduler::getScheduler().unregisterCallback(g_myCallbackId2);
AL::event::EventScheduler::getScheduler().unregisterCallback(g_myCallbackId1);
// unregister the event
AL::maya::EventScheduler::getScheduler().unregisterEvent(g_mySimpleEvent2);
AL::maya::EventScheduler::getScheduler().unregisterEvent(g_mySimpleEvent1);
AL::event::EventScheduler::getScheduler().unregisterEvent(g_mySimpleEvent2);
AL::event::EventScheduler::getScheduler().unregisterEvent(g_mySimpleEvent1);
MFnPlugin fn(obj);
fn.unregisterCommand("parentEventExample");
Expand Down

0 comments on commit f6918a0

Please sign in to comment.