-
Notifications
You must be signed in to change notification settings - Fork 4
/
viewOverrideSimpleMain.cpp
57 lines (51 loc) · 1.39 KB
/
viewOverrideSimpleMain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//-
// Copyright 2015 Autodesk, Inc. All rights reserved.
//
// Use of this software is subject to the terms of the Autodesk license agreement
// provided at the time of installation or download, or which otherwise
// accompanies this software in either electronic or hard copy form.
//+
#include <stdio.h>
#include <maya/MString.h>
#include <maya/MFnPlugin.h>
#include <maya/MViewport2Renderer.h>
#include "viewOverrideSimple.h"
//
// On plug-in initialization we register a new override
//
MStatus initializePlugin(MObject obj)
{
MStatus status;
MFnPlugin plugin(obj, PLUGIN_COMPANY, "1.0", "Any");
MHWRender::MRenderer* renderer = MHWRender::MRenderer::theRenderer();
if (renderer)
{
// We register with a given name
ViewOverrideSimple *overridePtr = new ViewOverrideSimple("viewOverrideSimple");
if (overridePtr)
{
renderer->registerOverride(overridePtr);
}
}
return status;
}
//
// On plug-in de-initialization we deregister a new override
//
MStatus uninitializePlugin(MObject obj)
{
MStatus status;
MFnPlugin plugin(obj);
MHWRender::MRenderer* renderer = MHWRender::MRenderer::theRenderer();
if (renderer)
{
// Find override with the given name and deregister
const MHWRender::MRenderOverride* overridePtr = renderer->findRenderOverride("viewOverrideSimple");
if (overridePtr)
{
renderer->deregisterOverride( overridePtr );
delete overridePtr;
}
}
return status;
}