diff --git a/src/constants.h b/src/constants.h index 0698c14..91ad8ff 100644 --- a/src/constants.h +++ b/src/constants.h @@ -1,7 +1,7 @@ #ifndef CONSTANTS_H #define CONSTANTS_H -static const char* WORKSPACE_CONTROL_NAME = "RSMLControl"; +static const char* WORKSPACE_CONTROL_NAME = "RSLMControl"; static const char* WIDGET_TITLE = "Rokoko Studio Live"; static const int INITIAL_WINDOW_WIDTH = 400; static const int MINIMUM_WINDOW_WIDTH = 100; diff --git a/src/main.cpp b/src/main.cpp index b3ca098..6998ef6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,8 +17,8 @@ #pragma comment(lib,"OpenMayaAnim.lib") #endif -QPointer rsmlScrollArea; -QPointer rsmlWidget; +QPointer rslmScrollArea; +QPointer rslmWidget; QPointer workspaceControl; @@ -36,27 +36,33 @@ class InvokeRSLM : MPxCommand { MStatus result = MStatus::kSuccess; - if(!rsmlWidget.isNull()) { + if(!rslmWidget.isNull()) { // do nothing if already visible - if(rsmlWidget->isVisible()) return MStatus::kFailure; + if(rslmWidget->isVisible()) + { + std::cout << "Failed to open\n"; + return MStatus::kFailure; + } } - if(workspaceControl.isNull()) { MString cmd; char sizeArgs[128]; sprintf(sizeArgs, "-iw %d -mw %d -ih %d -mh %d", INITIAL_WINDOW_WIDTH, MINIMUM_WINDOW_WIDTH, INITIAL_WINDOW_HEIGHT, MINIMUM_WINDOW_HEIGHT); - cmd.format("workspaceControl -l \"^1s\" -fl true ^2s \"RSMLControl\";", WIDGET_TITLE, sizeArgs); + cmd.format("workspaceControl -l \"^1s\" -fl true ^2s \"RSLMControl\";", WIDGET_TITLE, sizeArgs); MGlobal::executeCommand(cmd); + + workspaceControl = MQtUtil::findControl(WORKSPACE_CONTROL_NAME); + rslmScrollArea = new QScrollArea(workspaceControl); + rslmWidget = new RootWidget(workspaceControl); + rslmScrollArea->setWidget(rslmWidget); + rslmScrollArea->setWidgetResizable(true); + MQtUtil::addWidgetToMayaLayout(rslmScrollArea, workspaceControl); + } else { + Utils::showWSControl(); } - workspaceControl = MQtUtil::findControl(WORKSPACE_CONTROL_NAME); - rsmlScrollArea = new QScrollArea(workspaceControl); - rsmlWidget = new RootWidget(workspaceControl); - rsmlScrollArea->setWidget(rsmlWidget); - rsmlScrollArea->setWidgetResizable(true); - MQtUtil::addWidgetToMayaLayout(rsmlScrollArea, workspaceControl); return result; } @@ -92,12 +98,12 @@ MStatus uninitializePlugin(MObject obj) Utils::removeMayaWSControl(); } - if(!rsmlWidget.isNull()) { - rsmlWidget.clear(); + if(!rslmWidget.isNull()) { + rslmWidget.clear(); } - if(!rsmlScrollArea.isNull()) { - rsmlScrollArea.clear(); + if(!rslmScrollArea.isNull()) { + rslmScrollArea.clear(); } Utils::RSLMShutdown(); diff --git a/src/utils.cpp b/src/utils.cpp index 0e56291..6b8de04 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -55,6 +55,13 @@ void Utils::fillFaceWeightsMap(const MFnBlendShapeDeformer &bsFn, QHash &map); + static void showWSControl(); static void removeMayaWSControl(); static void RSLMInit(); static void RSLMShutdown();