├── Sources ├── LocatorLib │ ├── Root.rc │ ├── LocatorLib-5.vcxproj.user │ ├── LocatorLib.vcxproj.user │ ├── pyramid.txt │ ├── shape.txt │ ├── Resource.h │ ├── Release.props │ ├── StdAfx.cpp │ ├── Debug.props │ ├── Linux2013.5 │ │ ├── buildrules │ │ ├── linux_plugin.map │ │ ├── Makefile │ │ └── buildconfig │ ├── Linux2013 │ │ ├── buildrules │ │ ├── linux_plugin.map │ │ ├── Makefile │ │ └── buildconfig │ ├── Linux2014 │ │ ├── buildrules │ │ ├── linux_plugin.map │ │ ├── Makefile │ │ └── buildconfig │ ├── Mac2013.5 │ │ ├── buildrules │ │ ├── Makefile │ │ └── buildconfig │ ├── Mac2013 │ │ ├── buildrules │ │ ├── Makefile │ │ └── buildconfig │ ├── Mac2014 │ │ ├── buildrules │ │ ├── Makefile │ │ └── buildconfig │ ├── LocatorLibCmd.h │ ├── Shape.h │ ├── plugin.props │ ├── Autodesk.maya-2013.props │ ├── Autodesk.maya-2014.props │ ├── Autodesk.maya-2013-5.props │ ├── StdAfx.h │ ├── LocatorLibBase.cpp │ ├── LocatorLibCmd.cpp │ ├── LocatorLibBase.h │ ├── LocatorLib.cpp │ ├── ovalLocator.h │ ├── cubeLocator.h │ ├── squareLocator.h │ ├── sphereLocator.h │ ├── customLocator.h │ ├── LocatorLib-5.vcxproj.filters │ ├── LocatorLib2014.vcxproj.filters │ ├── LocatorLib.vcxproj.filters │ ├── Shape.cpp │ ├── LocatorLib2014.vcxproj │ ├── LocatorLib.vcxproj │ ├── LocatorLib-5.vcxproj │ ├── customLocator.cpp │ ├── squareLocator.cpp │ ├── sphereLocator.cpp │ ├── ovalLocator.cpp │ └── cubeLocator.cpp ├── LocatorLib.sln └── BuildMe.txt ├── Samples ├── pyramid.txt └── shape.txt ├── LocatorLib.mod ├── scripts ├── AEcubeLocatorTemplate.mel ├── AEovalLocatorTemplate.mel ├── AEsphereLocatorTemplate.mel ├── AEsquareLocatorTemplate.mel └── AEcustomLocatorTemplate.mel ├── LICENSE ├── .gitignore └── README.md /Sources/LocatorLib/Root.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ADN-DevTech/Maya-Locator/HEAD/Sources/LocatorLib/Root.rc -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib-5.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Samples/pyramid.txt: -------------------------------------------------------------------------------- 1 | 5 2 | -0.5 0.0 -0.5 3 | -0.5 0.0 0.5 4 | 0.5 0.0 0.5 5 | 0.5 0.0 -0.5 6 | 0.0 1.0 0.0 7 | 6 8 | 0 2 1 9 | 0 3 2 10 | 0 4 1 11 | 1 4 2 12 | 2 4 3 13 | 3 4 0 14 | -------------------------------------------------------------------------------- /Sources/LocatorLib/pyramid.txt: -------------------------------------------------------------------------------- 1 | 5 2 | -0.5 0.0 -0.5 3 | -0.5 0.0 0.5 4 | 0.5 0.0 0.5 5 | 0.5 0.0 -0.5 6 | 0.0 1.0 0.0 7 | 6 8 | 0 2 1 9 | 0 3 2 10 | 0 4 1 11 | 1 4 2 12 | 2 4 3 13 | 3 4 0 14 | -------------------------------------------------------------------------------- /LocatorLib.mod: -------------------------------------------------------------------------------- 1 | + PLATFORM:win32 MAYAVERSION: LocatorLib 1.0 /LocatorLib 2 | + PLATFORM:win64 MAYAVERSION: LocatorLib 1.0 /LocatorLib 3 | + PLATFORM:mac MAYAVERSION: LocatorLib 1.0 /LocatorLib 4 | + PLATFORM:linux MAYAVERSION: LocatorLib 1.0 /LocatorLib 5 | -------------------------------------------------------------------------------- /Samples/shape.txt: -------------------------------------------------------------------------------- 1 | 21 2 | 0.00 0.0 -0.70 3 | 0.04 0.0 -0.69 4 | 0.09 0.0 -0.65 5 | 0.13 0.0 -0.61 6 | 0.16 0.0 -0.54 7 | 0.17 0.0 -0.46 8 | 0.17 0.0 -0.35 9 | 0.16 0.0 -0.25 10 | 0.15 0.0 -0.14 11 | 0.13 0.0 0.00 12 | 0.00 0.0 0.00 13 | -0.13 0.0 0.00 14 | -0.15 0.0 -0.14 15 | -0.16 0.0 -0.25 16 | -0.17 0.0 -0.35 17 | -0.17 0.0 -0.46 18 | -0.16 0.0 -0.54 19 | -0.13 0.0 -0.61 20 | -0.09 0.0 -0.65 21 | -0.04 0.0 -0.69 22 | -0.00 0.0 -0.70 23 | 0 -------------------------------------------------------------------------------- /Sources/LocatorLib/shape.txt: -------------------------------------------------------------------------------- 1 | 21 2 | 0.00 0.0 -0.70 3 | 0.04 0.0 -0.69 4 | 0.09 0.0 -0.65 5 | 0.13 0.0 -0.61 6 | 0.16 0.0 -0.54 7 | 0.17 0.0 -0.46 8 | 0.17 0.0 -0.35 9 | 0.16 0.0 -0.25 10 | 0.15 0.0 -0.14 11 | 0.13 0.0 0.00 12 | 0.00 0.0 0.00 13 | -0.13 0.0 0.00 14 | -0.15 0.0 -0.14 15 | -0.16 0.0 -0.25 16 | -0.17 0.0 -0.35 17 | -0.17 0.0 -0.46 18 | -0.16 0.0 -0.54 19 | -0.13 0.0 -0.61 20 | -0.09 0.0 -0.65 21 | -0.04 0.0 -0.69 22 | -0.00 0.0 -0.70 23 | 0 -------------------------------------------------------------------------------- /Sources/LocatorLib/Resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by LocatorLib.rc 4 | // 5 | #define IDS_PROJNAME 100 6 | #define IDR_LOCATORLIB 101 7 | 8 | // Next default values for new objects 9 | // 10 | #ifdef APSTUDIO_INVOKED 11 | #ifndef APSTUDIO_READONLY_SYMBOLS 12 | #define _APS_NEXT_RESOURCE_VALUE 102 13 | #define _APS_NEXT_COMMAND_VALUE 32768 14 | #define _APS_NEXT_CONTROL_VALUE 100 15 | #define _APS_NEXT_SYMED_VALUE 102 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Release.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <_ProjectFileVersion>13.0.0.1 7 | <_PropertySheetDisplayName>Maya 2013 Release 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | MultiThreadedDLL 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Sources/LocatorLib/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | //----------------------------------------------------------------------------- 10 | //------ StdAfx.cpp : source file that includes just the standard includes 11 | //------ StdAfx.pch will be the pre-compiled header 12 | //------ StdAfx.obj will contain the pre-compiled type information 13 | //----------------------------------------------------------------------------- 14 | #include "StdAfx.h" 15 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Debug.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <_ProjectFileVersion>13.0.0.1 7 | <_PropertySheetDisplayName>Maya 2013 Debug 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | MultiThreadedDLL 19 | 20 | 21 | true 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2013.5/buildrules: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | INCL_BUILDRULES := 1 10 | 11 | include $(TOP)/buildconfig 12 | 13 | # Generic Rules 14 | .PHONY : all plugins depend clean Clean 15 | .DEFAULT : all 16 | 17 | all : plugins 18 | 19 | # Generic Rules 20 | $(DSTDIR)/%.o : $(SRCDIR)/%.c 21 | $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ 22 | 23 | $(DSTDIR)/%.o : $(SRCDIR)/%.cpp 24 | $(C++) -c $(INCLUDES) $(C++FLAGS) $< -o $@ 25 | 26 | $(DSTDIR)/%.i : $(SRCDIR)/%.cpp 27 | $(C++) -E $(INCLUDES) $(C++FLAGS) $(SRCDIR)/$*.cpp > $(DSTDIR)/$*.i 28 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2013/buildrules: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | INCL_BUILDRULES := 1 10 | 11 | include $(TOP)/buildconfig 12 | 13 | # Generic Rules 14 | .PHONY : all plugins depend clean Clean 15 | .DEFAULT : all 16 | 17 | all : plugins 18 | 19 | # Generic Rules 20 | $(DSTDIR)/%.o : $(SRCDIR)/%.c 21 | $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ 22 | 23 | $(DSTDIR)/%.o : $(SRCDIR)/%.cpp 24 | $(C++) -c $(INCLUDES) $(C++FLAGS) $< -o $@ 25 | 26 | $(DSTDIR)/%.i : $(SRCDIR)/%.cpp 27 | $(C++) -E $(INCLUDES) $(C++FLAGS) $(SRCDIR)/$*.cpp > $(DSTDIR)/$*.i 28 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2014/buildrules: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | INCL_BUILDRULES := 1 10 | 11 | include $(TOP)/buildconfig 12 | 13 | # Generic Rules 14 | .PHONY : all plugins depend clean Clean 15 | .DEFAULT : all 16 | 17 | all : plugins 18 | 19 | # Generic Rules 20 | $(DSTDIR)/%.o : $(SRCDIR)/%.c 21 | $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ 22 | 23 | $(DSTDIR)/%.o : $(SRCDIR)/%.cpp 24 | $(C++) -c $(INCLUDES) $(C++FLAGS) $< -o $@ 25 | 26 | $(DSTDIR)/%.i : $(SRCDIR)/%.cpp 27 | $(C++) -E $(INCLUDES) $(C++FLAGS) $(SRCDIR)/$*.cpp > $(DSTDIR)/$*.i 28 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2013.5/buildrules: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | INCL_BUILDRULES := 1 10 | 11 | include $(TOP)/buildconfig 12 | 13 | # Generic Rules 14 | .PHONY : all plugins depend clean Clean 15 | .DEFAULT : all 16 | 17 | all : plugins 18 | 19 | # Generic Rules 20 | $(DSTDIR)/%.o : $(SRCDIR)/%.c 21 | $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ 22 | 23 | $(DSTDIR)/%.o : $(SRCDIR)/%.cpp 24 | $(C++) -c $(INCLUDES) $(C++FLAGS) $< -o $@ 25 | 26 | $(DSTDIR)/%.i : $(SRCDIR)/%.cpp 27 | $(C++) -E $(INCLUDES) $(C++FLAGS) $(SRCDIR)/$*.cpp > $(DSTDIR)/$*.i 28 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2013/buildrules: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | INCL_BUILDRULES := 1 10 | 11 | include $(TOP)/buildconfig 12 | 13 | # Generic Rules 14 | .PHONY : all plugins depend clean Clean 15 | .DEFAULT : all 16 | 17 | all : plugins 18 | 19 | # Generic Rules 20 | $(DSTDIR)/%.o : $(SRCDIR)/%.c 21 | $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ 22 | 23 | $(DSTDIR)/%.o : $(SRCDIR)/%.cpp 24 | $(C++) -c $(INCLUDES) $(C++FLAGS) $< -o $@ 25 | 26 | $(DSTDIR)/%.i : $(SRCDIR)/%.cpp 27 | $(C++) -E $(INCLUDES) $(C++FLAGS) $(SRCDIR)/$*.cpp > $(DSTDIR)/$*.i 28 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2014/buildrules: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | INCL_BUILDRULES := 1 10 | 11 | include $(TOP)/buildconfig 12 | 13 | # Generic Rules 14 | .PHONY : all plugins depend clean Clean 15 | .DEFAULT : all 16 | 17 | all : plugins 18 | 19 | # Generic Rules 20 | $(DSTDIR)/%.o : $(SRCDIR)/%.c 21 | $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ 22 | 23 | $(DSTDIR)/%.o : $(SRCDIR)/%.cpp 24 | $(C++) -c $(INCLUDES) $(C++FLAGS) $< -o $@ 25 | 26 | $(DSTDIR)/%.i : $(SRCDIR)/%.cpp 27 | $(C++) -E $(INCLUDES) $(C++FLAGS) $(SRCDIR)/$*.cpp > $(DSTDIR)/$*.i 28 | -------------------------------------------------------------------------------- /scripts/AEcubeLocatorTemplate.mel: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | global proc AEcubeLocatorTemplate (string $nodeName) { 14 | editorTemplate -beginScrollLayout ; 15 | 16 | editorTemplate -beginLayout "Cube Locator Attributes" -collapse 0; 17 | editorTemplate -label "Size" -addControl "size"; 18 | editorTemplate -endLayout; 19 | 20 | // Include/call base class/node attributes 21 | editorTemplate -beginLayout (uiRes("m_AElocatorTemplate.kLocatorAttributes")) -collapse 0; 22 | AElocatorCommon $nodeName; 23 | editorTemplate -endLayout; 24 | 25 | AElocatorInclude $nodeName; 26 | 27 | editorTemplate -addExtraControls; 28 | editorTemplate -endScrollLayout ; 29 | } 30 | -------------------------------------------------------------------------------- /scripts/AEovalLocatorTemplate.mel: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | global proc AEovalLocatorTemplate (string $nodeName) { 14 | editorTemplate -beginScrollLayout ; 15 | 16 | editorTemplate -beginLayout "Oval Locator Attributes" -collapse 0; 17 | editorTemplate -label "Size" -addControl "size"; 18 | editorTemplate -endLayout; 19 | 20 | // Include/call base class/node attributes 21 | editorTemplate -beginLayout (uiRes("m_AElocatorTemplate.kLocatorAttributes")) -collapse 0; 22 | AElocatorCommon $nodeName; 23 | editorTemplate -endLayout; 24 | 25 | AElocatorInclude $nodeName; 26 | 27 | editorTemplate -addExtraControls; 28 | editorTemplate -endScrollLayout ; 29 | } 30 | -------------------------------------------------------------------------------- /scripts/AEsphereLocatorTemplate.mel: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | global proc AEsphereLocatorTemplate (string $nodeName) { 14 | editorTemplate -beginScrollLayout ; 15 | 16 | editorTemplate -beginLayout "Sphere Locator Attributes" -collapse 0; 17 | editorTemplate -label "Size" -addControl "size"; 18 | editorTemplate -endLayout; 19 | 20 | // Include/call base class/node attributes 21 | editorTemplate -beginLayout (uiRes("m_AElocatorTemplate.kLocatorAttributes")) -collapse 0; 22 | AElocatorCommon $nodeName; 23 | editorTemplate -endLayout; 24 | 25 | AElocatorInclude $nodeName; 26 | 27 | editorTemplate -addExtraControls; 28 | editorTemplate -endScrollLayout ; 29 | } 30 | -------------------------------------------------------------------------------- /scripts/AEsquareLocatorTemplate.mel: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | global proc AEsquareLocatorTemplate (string $nodeName) { 14 | editorTemplate -beginScrollLayout ; 15 | 16 | editorTemplate -beginLayout "Square Locator Attributes" -collapse 0; 17 | editorTemplate -label "Size" -addControl "size"; 18 | editorTemplate -endLayout; 19 | 20 | // Include/call base class/node attributes 21 | editorTemplate -beginLayout (uiRes("m_AElocatorTemplate.kLocatorAttributes")) -collapse 0; 22 | AElocatorCommon $nodeName; 23 | editorTemplate -endLayout; 24 | 25 | AElocatorInclude $nodeName; 26 | 27 | editorTemplate -addExtraControls; 28 | editorTemplate -endScrollLayout ; 29 | } 30 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLibCmd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (September 1, 2012) 12 | 13 | #pragma once 14 | 15 | //----------------------------------------------------------------------------- 16 | class LocatorLibCmd : public MPxCommand 17 | { 18 | public: 19 | LocatorLibCmd () : MPxCommand () {} 20 | virtual ~LocatorLibCmd () {} 21 | 22 | virtual MStatus doIt (const MArgList &args) ; 23 | 24 | static void *creator() { return new LocatorLibCmd () ; } 25 | static MSyntax newSyntax () ; 26 | 27 | static MStatus registerMe (MFnPlugin &plugin) { 28 | return (plugin.registerCommand (_T("LocatorLibCmd"), LocatorLibCmd::creator, LocatorLibCmd::newSyntax)) ; 29 | } 30 | static MStatus unregisterMe (MFnPlugin &plugin) { 31 | return (plugin.deregisterCommand (_T("LocatorLibCmd"))) ; 32 | } 33 | 34 | } ; 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Autodesk, Inc. All rights reserved 2 | 3 | Maya Locator sample 4 | by Cyrille Fauvel / Naiqi Weng - Autodesk Developer Network (ADN) 5 | October 2012 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | this software and associated documentation files (the "Software"), to deal in 9 | the Software without restriction, including without limitation the rights to 10 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | the Software, and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Shape.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille Fauvel 11 | // 1.0 Original release (September 1, 2012) 12 | 13 | #pragma once 14 | 15 | //----------------------------------------------------------------------------- 16 | class Shape { 17 | public: 18 | MPointArray vertices ; 19 | MIntArray triangles ; 20 | 21 | public: 22 | Shape () {} 23 | virtual ~Shape () {} 24 | 25 | virtual bool loadFromFile (std::string filename) ; 26 | virtual void renderWireFrame (float multiplier =1.0f) ; 27 | virtual void renderShaded (float multiplier =1.0f) ; 28 | virtual MBoundingBox boundingbox (float multiplier =1.0f) ; 29 | 30 | } ; 31 | 32 | //----------------------------------------------------------------------------- 33 | class ShapeMgr { 34 | public: 35 | std::map shapeList ; 36 | 37 | public: 38 | ShapeMgr () ; 39 | virtual ~ShapeMgr () {} 40 | 41 | Shape &shapeData (std::string filename) ; 42 | 43 | } ; 44 | 45 | extern ShapeMgr shapeMgr ; 46 | -------------------------------------------------------------------------------- /Sources/LocatorLib/plugin.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <_ProjectFileVersion>13.0.0.1 7 | <_PropertySheetDisplayName>Maya 2013 Plug-in 8 | .mll 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Auto 20 | 21 | $(MayaDir)\bin\maya.exe 22 | $(ProjectDir) 23 | 24 | 25 | 26 | 27 | 28 | 29 | DynamicLibrary 30 | 31 | 32 | 33 | 34 | NT_PLUGIN;REQUIRE_IOSTREAM;%(PreprocessorDefinitions) 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2013.5/linux_plugin.map: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (c) 2011 Autodesk, Inc. 3 | * All rights reserved. 4 | * 5 | * These coded instructions, statements, and computer programs contain 6 | * unpublished proprietary information written by Autodesk, Inc., and are 7 | * protected by Federal copyright law. They may not be disclosed to third 8 | * parties or copied or duplicated in any form, in whole or in part, without 9 | * the prior written consent of Autodesk, Inc. 10 | ****************************************************************************/ 11 | 12 | /* 13 | * When compiling plug-ins for Maya, we make sure to export only the 14 | * symbols for the initializePlugin(MObject) and 15 | * uninitializePlugin(MObject) functions. In particular, this 16 | * prevents the plug-ins from exporting symbols coming from static 17 | * libaries against which the plug-ins is linked. 18 | * 19 | * Here's why: 20 | * 21 | * Plug-ins are written by separate developers. Each of them might 22 | * want to use various libraries to implement their plug-ins. At 23 | * times, it occurs that plug-ins written by different developers are 24 | * using different and "incompatible" versions of the same library. To 25 | * support this, we recommend that plug-ins be linked against static 26 | * versions of these libraries. And, by hidding the symbols of these 27 | * libraries, we prevent the two incompatible versions of the library 28 | * from interferring with each others. 29 | */ 30 | 31 | { 32 | global: 33 | _Z16initializePlugin7MObject ; 34 | _Z18uninitializePlugin7MObject ; 35 | local: 36 | *; 37 | }; 38 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2013/linux_plugin.map: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (c) 2011 Autodesk, Inc. 3 | * All rights reserved. 4 | * 5 | * These coded instructions, statements, and computer programs contain 6 | * unpublished proprietary information written by Autodesk, Inc., and are 7 | * protected by Federal copyright law. They may not be disclosed to third 8 | * parties or copied or duplicated in any form, in whole or in part, without 9 | * the prior written consent of Autodesk, Inc. 10 | ****************************************************************************/ 11 | 12 | /* 13 | * When compiling plug-ins for Maya, we make sure to export only the 14 | * symbols for the initializePlugin(MObject) and 15 | * uninitializePlugin(MObject) functions. In particular, this 16 | * prevents the plug-ins from exporting symbols coming from static 17 | * libaries against which the plug-ins is linked. 18 | * 19 | * Here's why: 20 | * 21 | * Plug-ins are written by separate developers. Each of them might 22 | * want to use various libraries to implement their plug-ins. At 23 | * times, it occurs that plug-ins written by different developers are 24 | * using different and "incompatible" versions of the same library. To 25 | * support this, we recommend that plug-ins be linked against static 26 | * versions of these libraries. And, by hidding the symbols of these 27 | * libraries, we prevent the two incompatible versions of the library 28 | * from interferring with each others. 29 | */ 30 | 31 | { 32 | global: 33 | _Z16initializePlugin7MObject ; 34 | _Z18uninitializePlugin7MObject ; 35 | local: 36 | *; 37 | }; 38 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2014/linux_plugin.map: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (c) 2011 Autodesk, Inc. 3 | * All rights reserved. 4 | * 5 | * These coded instructions, statements, and computer programs contain 6 | * unpublished proprietary information written by Autodesk, Inc., and are 7 | * protected by Federal copyright law. They may not be disclosed to third 8 | * parties or copied or duplicated in any form, in whole or in part, without 9 | * the prior written consent of Autodesk, Inc. 10 | ****************************************************************************/ 11 | 12 | /* 13 | * When compiling plug-ins for Maya, we make sure to export only the 14 | * symbols for the initializePlugin(MObject) and 15 | * uninitializePlugin(MObject) functions. In particular, this 16 | * prevents the plug-ins from exporting symbols coming from static 17 | * libaries against which the plug-ins is linked. 18 | * 19 | * Here's why: 20 | * 21 | * Plug-ins are written by separate developers. Each of them might 22 | * want to use various libraries to implement their plug-ins. At 23 | * times, it occurs that plug-ins written by different developers are 24 | * using different and "incompatible" versions of the same library. To 25 | * support this, we recommend that plug-ins be linked against static 26 | * versions of these libraries. And, by hidding the symbols of these 27 | * libraries, we prevent the two incompatible versions of the library 28 | * from interferring with each others. 29 | */ 30 | 31 | { 32 | global: 33 | _Z16initializePlugin7MObject ; 34 | _Z18uninitializePlugin7MObject ; 35 | local: 36 | *; 37 | }; 38 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Autodesk.maya-2013.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <_ProjectFileVersion>13.0.0.1 7 | <_PropertySheetDisplayName>Maya 2013 8 | 9 | 10 | 11 | C:\Program Files\Autodesk\Maya2013 12 | C:\Program Files (x86)\Autodesk\Maya2013 13 | $(MayaDir)\devkit 14 | 15 | $(MayaDir)\include 16 | $(MayaDir)\mentalray\include 17 | 18 | $(MayaDir)\lib 19 | $(MayaDir)\mentalray\lib 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | $(MayaIncs);$(MayaMRIncs);$(IncludePath) 30 | $(MayaIncs);$(ReferencePath) 31 | $(MayaLibs);$(MayaMRLibs);$(LibraryPath) 32 | 33 | 34 | 35 | 36 | 37 | 38 | $(OutDir)$(TargetName).pdb 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Autodesk.maya-2014.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <_ProjectFileVersion>14.0.0.1 7 | <_PropertySheetDisplayName>Maya 2014 8 | 9 | 10 | 11 | C:\Program Files\Autodesk\Maya2014 12 | C:\Program Files (x86)\Autodesk\Maya2014 13 | $(MayaDir)\devkit 14 | 15 | $(MayaDir)\include 16 | $(MayaDir)\mentalray\include 17 | 18 | $(MayaDir)\lib 19 | $(MayaDir)\mentalray\lib 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | $(MayaIncs);$(MayaMRIncs);$(IncludePath) 30 | $(MayaIncs);$(ReferencePath) 31 | $(MayaLibs);$(MayaMRLibs);$(LibraryPath) 32 | 33 | 34 | 35 | 36 | 37 | 38 | $(OutDir)$(TargetName).pdb 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Autodesk.maya-2013-5.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <_ProjectFileVersion>13.5.0.1 7 | <_PropertySheetDisplayName>Maya 2013-5 8 | 9 | 10 | 11 | C:\Program Files\Autodesk\Maya2013.5 12 | C:\Program Files (x86)\Autodesk\Maya2013.5 13 | $(MayaDir)\devkit 14 | 15 | $(MayaDir)\include 16 | $(MayaDir)\mentalray\include 17 | 18 | $(MayaDir)\lib 19 | $(MayaDir)\mentalray\lib 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | $(MayaIncs);$(MayaMRIncs);$(IncludePath) 30 | $(MayaIncs);$(ReferencePath) 31 | $(MayaLibs);$(MayaMRLibs);$(LibraryPath) 32 | 33 | 34 | 35 | 36 | 37 | 38 | $(OutDir)$(TargetName).pdb 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Sources/LocatorLib/StdAfx.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | //----------------------------------------------------------------------------- 10 | //- StdAfx.h : include file for standard system include files, 11 | //- or project specific include files that are used frequently, 12 | //- but are changed infrequently 13 | //----------------------------------------------------------------------------- 14 | #pragma once 15 | 16 | #ifdef NT_PLUGIN 17 | #pragma comment (lib, "opengl32.lib") 18 | #pragma comment (lib, "glu32.lib") 19 | #endif 20 | 21 | ////----------------------------------------------------------------------------- 22 | //----- This file is preprocessor symbol driven. 23 | //----- Define: 24 | //----- _PYTHON_MODULE_ to include and import Python headers and libs in your project. 25 | //#define _PYTHON_MODULE_ 26 | //----- _MAYA_QT_ to include and import Maya QT headers and libs in your project. 27 | //#define _MAYA_QT_ 28 | 29 | #include "mayaHeaders.h" 30 | #ifdef NT_PLUGIN 31 | #include 32 | #else 33 | #define _T(a) a 34 | #endif 35 | #include 36 | #include 37 | 38 | // Viewport 2.0 includes 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #ifndef M_PI 47 | #define M_PI 3.14159265358979323846 48 | #endif 49 | 50 | #ifndef M_PI_2 51 | #define M_PI_2 1.57079632679489661923 52 | #endif 53 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLibBase.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille Fauvel 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #include "LocatorLibBase.h" 15 | 16 | //----------------------------------------------------------------------------- 17 | void locatorLibBase::draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status) { 18 | view.beginGL () ; 19 | if ( (style == M3dView::kFlatShaded) 20 | || (style == M3dView::kGouraudShaded) 21 | ) { 22 | // Push the color settings 23 | glPushAttrib (GL_CURRENT_BIT) ; 24 | if ( status == M3dView::kActive ) 25 | view.setDrawColor (13, M3dView::kActiveColors) ; 26 | else 27 | view.setDrawColor (13, M3dView::kDormantColors) ; 28 | myShadedDraw () ; 29 | glPopAttrib () ; 30 | } 31 | myWireFrameDraw () ; // Draw the outline of the locator 32 | view.endGL () ; 33 | } 34 | 35 | MStatus locatorLibBase::initializeSize (MObject &attr) { 36 | MStatus stat ; 37 | MFnNumericAttribute attrFn ; 38 | attr =attrFn.create ("size", "sz", MFnNumericData::kFloat, 1.0f, &stat) ; 39 | attrFn.setMin (0.01f) ; 40 | attrFn.setMax (100.0f) ; 41 | addAttribute (attr) ; 42 | return (MS::kSuccess) ; 43 | } 44 | 45 | //----------------------------------------------------------------------------- 46 | float locatorLibDrawOverrideBase::getMultiplier (const MDagPath &objPath, MObject &attr) const { 47 | // Retrieve value of the size attribute from the node 48 | MStatus status ; 49 | MObject locatorNode =objPath.node (&status) ; 50 | if ( status ) { 51 | MPlug plug (locatorNode, attr) ; 52 | if ( !plug.isNull () ) { 53 | double sizeVal ; 54 | if ( plug.getValue (sizeVal) ) 55 | return (sizeVal) ; 56 | } 57 | } 58 | return (1.00) ; 59 | } 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | *.bak 16 | 17 | # Build results 18 | [Dd]ebug/ 19 | [Rr]elease/ 20 | x64/ 21 | *_i.c 22 | *_p.c 23 | *.ilk 24 | *.meta 25 | *.obj 26 | *.pch 27 | *.pdb 28 | *.pgc 29 | *.pgd 30 | *.rsp 31 | *.sbr 32 | *.tlb 33 | *.tli 34 | *.tlh 35 | *.tmp 36 | *.log 37 | *.vspscc 38 | *.vssscc 39 | .builds 40 | 41 | # Visual C++ cache files 42 | ipch/ 43 | *.aps 44 | *.ncb 45 | *.opensdf 46 | *.sdf 47 | 48 | # Visual Studio profiler 49 | *.psess 50 | *.vsp 51 | *.vspx 52 | 53 | # Guidance Automation Toolkit 54 | *.gpState 55 | 56 | # NCrunch 57 | *.ncrunch* 58 | .*crunch*.local.xml 59 | 60 | # Installshield output folder 61 | [Ee]xpress 62 | 63 | # DocProject is a documentation generator add-in 64 | DocProject/buildhelp/ 65 | DocProject/Help/*.HxT 66 | DocProject/Help/*.HxC 67 | DocProject/Help/*.hhc 68 | DocProject/Help/*.hhk 69 | DocProject/Help/*.hhp 70 | DocProject/Help/Html2 71 | DocProject/Help/html 72 | 73 | # Click-Once directory 74 | publish 75 | 76 | # Compiled Object files 77 | *.slo 78 | *.lo 79 | *.o 80 | 81 | # Compiled Dynamic libraries 82 | *.so 83 | *.dylib 84 | 85 | # Compiled Static libraries 86 | *.lai 87 | *.la 88 | *.a 89 | 90 | # NuGet Packages Directory 91 | packages 92 | 93 | # Windows Azure Build Output 94 | csx 95 | *.build.csdef 96 | 97 | # Windows Store app package directory 98 | AppPackages/ 99 | 100 | # Others 101 | [Bb]in 102 | [Oo]bj 103 | sql 104 | TestResults 105 | [Tt]est[Rr]esult* 106 | *.Cache 107 | ClientBin 108 | [Ss]tyle[Cc]op.* 109 | ~$* 110 | *.dbmdl 111 | Generated_Code #added for RIA/Silverlight projects 112 | 113 | # Backup & report files from converting an old project file to a newer 114 | # Visual Studio version. Backup files are not needed, because we have git ;-) 115 | _UpgradeReport_Files/ 116 | Backup*/ 117 | UpgradeLog*.XML 118 | 119 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLibCmd.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #define MNoVersionString 15 | #define MNoPluginEntry 16 | #include 17 | #include "LocatorLibCmd.h" 18 | 19 | //----------------------------------------------------------------------------- 20 | #define kOvalFlag "-o" 21 | #define kOvalFlagLong "-oval" 22 | #define kSquareFlag "-s" 23 | #define kSquareFlagLong "-square" 24 | #define kCubeFlag "-cu" 25 | #define kCubeFlagLong "-cube" 26 | #define kSphereFlag "-sp" 27 | #define kSphereFlagLong "-sphere" 28 | #define kCustomFlag "-c" 29 | #define kCustomFlagLong "-custom" 30 | 31 | //----------------------------------------------------------------------------- 32 | MStatus LocatorLibCmd::doIt (const MArgList &args) { 33 | MArgDatabase argData (syntax (), args) ; 34 | MString arg ; 35 | if ( argData.isFlagSet (kOvalFlag) ) { 36 | std::cerr << "the oval flag is set" << std::endl ; 37 | MGlobal::executeCommand ("createNode ovalLocator;") ; 38 | } else if ( argData.isFlagSet (kSquareFlag) ) { 39 | std::cerr << "the square flag is set" << std::endl ; 40 | MGlobal::executeCommand ("createNode squareLocator;") ; 41 | } else if ( argData.isFlagSet (kCubeFlag) ) { 42 | std::cerr << "the cube flag is set" << std::endl ; 43 | MGlobal::executeCommand ("createNode cubeLocator;") ; 44 | } else if ( argData.isFlagSet (kSphereFlag) ) { 45 | std::cerr << "the sphere flag is set" << std::endl ; 46 | MGlobal::executeCommand ("createNode sphereLocator;") ; 47 | } else if ( argData.isFlagSet (kCustomFlag) ) { 48 | std::cerr << "the custom flag is set" << std::endl ; 49 | MGlobal::executeCommand ("createNode customLocator;") ; 50 | } else { 51 | std::cerr << "NO flag is set" << std::endl ; 52 | } 53 | return (MS::kSuccess); 54 | } 55 | 56 | MSyntax LocatorLibCmd::newSyntax () { 57 | MSyntax syntax ; 58 | syntax.addFlag (kOvalFlag, kOvalFlagLong) ; 59 | syntax.addFlag (kSquareFlag, kSquareFlagLong) ; 60 | syntax.addFlag (kCubeFlag, kCubeFlagLong) ; 61 | syntax.addFlag (kSphereFlag, kSphereFlagLong) ; 62 | syntax.addFlag (kCustomFlag, kCustomFlagLong) ; 63 | return (syntax) ; 64 | } -------------------------------------------------------------------------------- /Sources/LocatorLib.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LocatorLib2013", "LocatorLib\LocatorLib.vcxproj", "{C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LocatorLib2013-5", "LocatorLib\LocatorLib-5.vcxproj", "{6B205358-6FF9-4690-8388-55CA41A783BF}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LocatorLib2014", "LocatorLib\LocatorLib2014.vcxproj", "{3B922D50-1904-4845-A912-56090FCE761F}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Debug|x64 = Debug|x64 14 | Release|Win32 = Release|Win32 15 | Release|x64 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}.Debug|Win32.Build.0 = Debug|Win32 20 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}.Debug|x64.ActiveCfg = Debug|x64 21 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}.Debug|x64.Build.0 = Debug|x64 22 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}.Release|Win32.ActiveCfg = Release|Win32 23 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}.Release|Win32.Build.0 = Release|Win32 24 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}.Release|x64.ActiveCfg = Release|x64 25 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E}.Release|x64.Build.0 = Release|x64 26 | {6B205358-6FF9-4690-8388-55CA41A783BF}.Debug|Win32.ActiveCfg = Debug|Win32 27 | {6B205358-6FF9-4690-8388-55CA41A783BF}.Debug|Win32.Build.0 = Debug|Win32 28 | {6B205358-6FF9-4690-8388-55CA41A783BF}.Debug|x64.ActiveCfg = Debug|x64 29 | {6B205358-6FF9-4690-8388-55CA41A783BF}.Debug|x64.Build.0 = Debug|x64 30 | {6B205358-6FF9-4690-8388-55CA41A783BF}.Release|Win32.ActiveCfg = Release|Win32 31 | {6B205358-6FF9-4690-8388-55CA41A783BF}.Release|Win32.Build.0 = Release|Win32 32 | {6B205358-6FF9-4690-8388-55CA41A783BF}.Release|x64.ActiveCfg = Release|x64 33 | {6B205358-6FF9-4690-8388-55CA41A783BF}.Release|x64.Build.0 = Release|x64 34 | 35 | {3B922D50-1904-4845-A912-56090FCE761F}.Debug|x64.ActiveCfg = Debug|x64 36 | {3B922D50-1904-4845-A912-56090FCE761F}.Debug|x64.Build.0 = Debug|x64 37 | {3B922D50-1904-4845-A912-56090FCE761F}.Release|x64.ActiveCfg = Release|x64 38 | {3B922D50-1904-4845-A912-56090FCE761F}.Release|x64.Build.0 = Release|x64 39 | EndGlobalSection 40 | GlobalSection(SolutionProperties) = preSolution 41 | HideSolutionNode = FALSE 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLibBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille Fauvel 11 | // 1.0 Original release (September 1, 2012) 12 | 13 | #pragma once 14 | 15 | //----------------------------------------------------------------------------- 16 | class locatorLibBase : public MPxLocatorNode { 17 | 18 | protected: 19 | locatorLibBase () : MPxLocatorNode () {} 20 | public: 21 | virtual ~locatorLibBase () {} 22 | 23 | virtual MStatus compute (const MPlug &plug, MDataBlock &data) { return (MS::kUnknownParameter) ; } 24 | virtual void draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status) ; 25 | virtual void myWireFrameDraw () =0 ; 26 | virtual void myShadedDraw () {} 27 | virtual bool isBounded () const { return (true) ; } 28 | //virtual MBoundingBox boundingBox () const ; 29 | 30 | //static void *creator () ; 31 | //static MStatus initialize () ; 32 | static MStatus initializeSize (MObject &attr) ; 33 | static MStatus initializeColor (MObject &attr) ; 34 | 35 | } ; 36 | 37 | //----------------------------------------------------------------------------- 38 | // Viewport 2.0 override implementation 39 | class locatorLibData : public MUserData { 40 | public: 41 | float multiplier ; 42 | 43 | public: 44 | locatorLibData () : MUserData (false) {} // don't delete after draw 45 | virtual ~locatorLibData () {} 46 | 47 | } ; 48 | 49 | //----------------------------------------------------------------------------- 50 | class locatorLibDrawOverrideBase : public MHWRender::MPxDrawOverride { 51 | 52 | protected: 53 | locatorLibDrawOverrideBase (const MObject &obj, GeometryDrawOverrideCb callback) 54 | : MHWRender::MPxDrawOverride (obj, callback) {} 55 | 56 | public: 57 | virtual ~locatorLibDrawOverrideBase () {} 58 | 59 | virtual MHWRender::DrawAPI supportedDrawAPIs () const { return (MHWRender::kOpenGL) ; } 60 | //virtual MBoundingBox boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const ; 61 | //virtual MUserData* prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) ; 62 | 63 | //static void draw (const MHWRender::MDrawContext &context, const MUserData *data) ; 64 | //static MHWRender::MPxDrawOverride *Creator (const MObject &obj) ; 65 | 66 | protected: 67 | virtual float getMultiplier (const MDagPath &objPath, MObject &attr) const ; 68 | 69 | } ; 70 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #include "Resource.h" 15 | 16 | #include 17 | 18 | #include "LocatorLibCmd.h" 19 | #include "cubeLocator.h" 20 | #include "ovalLocator.h" 21 | #include "sphereLocator.h" 22 | #include "squareLocator.h" 23 | #include "customLocator.h" 24 | 25 | //----------------------------------------------------------------------------- 26 | MStatus initializePlugin (MObject obj) { 27 | #ifdef NT_PLUGIN 28 | #pragma EXPORT 29 | #endif 30 | // Description: 31 | // this method is called when the plug-in is loaded into Maya. It 32 | // registers all of the services that this plug-in provides with 33 | // Maya. 34 | // Arguments: 35 | // obj - a handle to the plug-in object (use MFnPlugin to access it) 36 | MFnPlugin plugin (obj, _T("Autodesk"), _T("Version"), _T("Any")) ; 37 | 38 | //- Examples: 39 | //NodeRegisterOk(plugin.registerNode (_T("myNode"), myNode::id, myNode::creator, myNode::initialize)) ; 40 | //NodeRegisterOk(myNode::registerMe (plugin)) ; 41 | 42 | //-{{MAYA_REGISTER 43 | //-MAYA_REGISTER}} 44 | LocatorLibCmd::registerMe (plugin) ; 45 | cubeLocator::registerMe (plugin) ; 46 | ovalLocator::registerMe (plugin) ; 47 | sphereLocator::registerMe (plugin) ; 48 | squareLocator::registerMe (plugin) ; 49 | customLocator::registerMe (plugin) ; 50 | 51 | return (MS::kSuccess) ; 52 | } 53 | 54 | MStatus uninitializePlugin (MObject obj) { 55 | #ifdef NT_PLUGIN 56 | #pragma EXPORT 57 | #endif 58 | // Description: 59 | // this method is called when the plug-in is unloaded from Maya. It 60 | // deregisters all of the services that it was providing. 61 | // Arguments: 62 | // obj - a handle to the plug-in object (use MFnPlugin to access it) 63 | MFnPlugin plugin (obj) ; 64 | 65 | //- Examples: 66 | //NodeUnregisterOk(plugin.deregisterNode (myNode::id)) ; 67 | //NodeUnregisterOk(myNode::unregisterMe (plugin)) ; 68 | 69 | //-{{MAYA_UNREGISTER 70 | //-MAYA_UNREGISTER}} 71 | LocatorLibCmd::unregisterMe (plugin) ; 72 | cubeLocator::unregisterMe (plugin) ; 73 | ovalLocator::unregisterMe (plugin) ; 74 | sphereLocator::unregisterMe (plugin) ; 75 | squareLocator::unregisterMe (plugin) ; 76 | customLocator::unregisterMe (plugin) ; 77 | 78 | return (MS::kSuccess) ; 79 | } 80 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2013.5/Makefile: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | ifndef INCL_BUILDRULES 10 | 11 | # Include platform specific build settings 12 | TOP := . 13 | SRCDIR := $(TOP)/.. 14 | DSTDIR := $(TOP) 15 | include $(TOP)/buildrules 16 | 17 | # Always build the local plug-in when make is invoked from the 18 | # directory. 19 | all : plugins 20 | 21 | endif 22 | 23 | # Include the optional per-plugin Makefile.inc 24 | # 25 | # The file can contain macro definitions such as: 26 | # {pluginName}_EXTRA_CFLAGS 27 | # {pluginName}_EXTRA_C++FLAGS 28 | # {pluginName}_EXTRA_INCLUDES 29 | # {pluginName}_EXTRA_LIBS 30 | -include Makefile.inc 31 | 32 | # Variable definitions 33 | LocatorLib_SOURCES := $(SRCDIR)/LocatorLib.cpp $(SRCDIR)/LocatorLibBase.cpp $(SRCDIR)/sphereLocator.cpp $(SRCDIR)/cubeLocator.cpp $(SRCDIR)/squareLocator.cpp $(SRCDIR)/ovalLocator.cpp $(SRCDIR)/Shape.cpp $(SRCDIR)/customLocator.cpp $(SRCDIR)/LocatorLibCmd.cpp 34 | LocatorLib_OBJECTS := $(DSTDIR)/LocatorLib.o $(DSTDIR)/LocatorLibBase.o $(DSTDIR)/sphereLocator.o $(DSTDIR)/cubeLocator.o $(DSTDIR)/squareLocator.o $(DSTDIR)/ovalLocator.o $(DSTDIR)/Shape.o $(DSTDIR)/customLocator.o $(DSTDIR)/LocatorLibCmd.o 35 | LocatorLib_PLUGIN := $(DSTDIR)/LocatorLib.$(EXT) 36 | LocatorLib_MAKEFILE := $(DSTDIR)/Makefile 37 | 38 | # Set target specific flags. 39 | $(LocatorLib_OBJECTS): CFLAGS := $(CFLAGS) $(LocatorLib_EXTRA_CFLAGS) 40 | $(LocatorLib_OBJECTS): C++FLAGS := $(C++FLAGS) $(LocatorLib_EXTRA_C++FLAGS) 41 | $(LocatorLib_OBJECTS): INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 42 | 43 | depend_LocatorLib: INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 44 | 45 | $(LocatorLib_PLUGIN): LFLAGS := $(LFLAGS) $(LocatorLib_EXTRA_LFLAGS) 46 | $(LocatorLib_PLUGIN): LIBS := $(LIBS) -lOpenMaya -lFoundation -lOpenMayaRender -lOpenMayaUI -framework AGL -framework OpenGL -framework GLUT $(LocatorLib_EXTRA_LIBS) 47 | 48 | # Rules definitions 49 | .PHONY: depend_LocatorLib clean_LocatorLib Clean_LocatorLib 50 | 51 | $(LocatorLib_PLUGIN): $(LocatorLib_OBJECTS) 52 | -rm -f $@ 53 | $(LD) -o $@ $(LFLAGS) $^ $(LIBS) 54 | 55 | depend_LocatorLib : 56 | makedepend $(INCLUDES) $(MDFLAGS) -f$(DSTDIR)/Makefile $(LocatorLib_SOURCES) 57 | 58 | clean_LocatorLib: 59 | -rm -f $(LocatorLib_OBJECTS) 60 | 61 | Clean_LocatorLib: 62 | -rm -f $(LocatorLib_MAKEFILE).bak $(LocatorLib_OBJECTS) $(LocatorLib_PLUGIN) 63 | 64 | plugins: $(LocatorLib_PLUGIN) 65 | depend: depend_LocatorLib 66 | clean: clean_LocatorLib 67 | Clean: Clean_LocatorLib 68 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2014/Makefile: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | ifndef INCL_BUILDRULES 10 | 11 | # Include platform specific build settings 12 | TOP := . 13 | SRCDIR := $(TOP)/.. 14 | DSTDIR := $(TOP) 15 | include $(TOP)/buildrules 16 | 17 | # Always build the local plug-in when make is invoked from the 18 | # directory. 19 | all : plugins 20 | 21 | endif 22 | 23 | # Include the optional per-plugin Makefile.inc 24 | # 25 | # The file can contain macro definitions such as: 26 | # {pluginName}_EXTRA_CFLAGS 27 | # {pluginName}_EXTRA_C++FLAGS 28 | # {pluginName}_EXTRA_INCLUDES 29 | # {pluginName}_EXTRA_LIBS 30 | -include Makefile.inc 31 | 32 | # Variable definitions 33 | LocatorLib_SOURCES := $(SRCDIR)/LocatorLib.cpp $(SRCDIR)/LocatorLibBase.cpp $(SRCDIR)/sphereLocator.cpp $(SRCDIR)/cubeLocator.cpp $(SRCDIR)/squareLocator.cpp $(SRCDIR)/ovalLocator.cpp $(SRCDIR)/Shape.cpp $(SRCDIR)/customLocator.cpp $(SRCDIR)/LocatorLibCmd.cpp 34 | LocatorLib_OBJECTS := $(DSTDIR)/LocatorLib.o $(DSTDIR)/LocatorLibBase.o $(DSTDIR)/sphereLocator.o $(DSTDIR)/cubeLocator.o $(DSTDIR)/squareLocator.o $(DSTDIR)/ovalLocator.o $(DSTDIR)/Shape.o $(DSTDIR)/customLocator.o $(DSTDIR)/LocatorLibCmd.o 35 | LocatorLib_PLUGIN := $(DSTDIR)/LocatorLib.$(EXT) 36 | LocatorLib_MAKEFILE := $(DSTDIR)/Makefile 37 | 38 | # Set target specific flags. 39 | $(LocatorLib_OBJECTS): CFLAGS := $(CFLAGS) $(LocatorLib_EXTRA_CFLAGS) 40 | $(LocatorLib_OBJECTS): C++FLAGS := $(C++FLAGS) $(LocatorLib_EXTRA_C++FLAGS) 41 | $(LocatorLib_OBJECTS): INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 42 | 43 | depend_LocatorLib: INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 44 | 45 | $(LocatorLib_PLUGIN): LFLAGS := $(LFLAGS) $(LocatorLib_EXTRA_LFLAGS) 46 | $(LocatorLib_PLUGIN): LIBS := $(LIBS) -lOpenMaya -lFoundation -lOpenMayaRender -lOpenMayaUI -framework AGL -framework OpenGL -framework GLUT $(LocatorLib_EXTRA_LIBS) 47 | 48 | # Rules definitions 49 | .PHONY: depend_LocatorLib clean_LocatorLib Clean_LocatorLib 50 | 51 | $(LocatorLib_PLUGIN): $(LocatorLib_OBJECTS) 52 | -rm -f $@ 53 | $(LD) -o $@ $(LFLAGS) $^ $(LIBS) 54 | 55 | depend_LocatorLib : 56 | makedepend $(INCLUDES) $(MDFLAGS) -f$(DSTDIR)/Makefile $(LocatorLib_SOURCES) 57 | 58 | clean_LocatorLib: 59 | -rm -f $(LocatorLib_OBJECTS) 60 | 61 | Clean_LocatorLib: 62 | -rm -f $(LocatorLib_MAKEFILE).bak $(LocatorLib_OBJECTS) $(LocatorLib_PLUGIN) 63 | 64 | plugins: $(LocatorLib_PLUGIN) 65 | depend: depend_LocatorLib 66 | clean: clean_LocatorLib 67 | Clean: Clean_LocatorLib 68 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2013.5/Makefile: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | ifndef INCL_BUILDRULES 10 | 11 | # Include platform specific build settings 12 | TOP := . 13 | SRCDIR := $(TOP)/.. 14 | DSTDIR := $(TOP) 15 | include $(TOP)/buildrules 16 | 17 | # Always build the local plug-in when make is invoked from the 18 | # directory. 19 | all : plugins 20 | 21 | endif 22 | 23 | # Variable definitions 24 | LocatorLib_SOURCES := $(SRCDIR)/LocatorLib.cpp $(SRCDIR)/LocatorLibBase.cpp $(SRCDIR)/cubeLocator.cpp $(SRCDIR)/sphereLocator.cpp $(DSTDIR)/squareLocator.cpp $(SRCDIR)/ovalLocator.cpp $(SRCDIR)/Shape.cpp $(SRCDIR)/customLocator.cpp $(SRCDIR)/LocatorLibCmd.cpp 25 | LocatorLib_OBJECTS := $(DSTDIR)/LocatorLib.o $(DSTDIR)/LocatorLibBase.o $(DSTDIR)/cubeLocator.o $(DSTDIR)/sphereLocator.o $(DSTDIR)/squareLocator.o $(DSTDIR)/ovalLocator.o $(DSTDIR)/Shape.o $(DSTDIR)/customLocator.o $(DSTDIR)/LocatorLibCmd.o 26 | LocatorLib_PLUGIN := $(DSTDIR)/LocatorLib.$(EXT) 27 | LocatorLib_MAKEFILE := $(DSTDIR)/Makefile 28 | 29 | # Include the optional per-plugin Makefile.inc 30 | # 31 | # The file can contain macro definitions such as: 32 | # {pluginName}_EXTRA_CFLAGS 33 | # {pluginName}_EXTRA_C++FLAGS 34 | # {pluginName}_EXTRA_INCLUDES 35 | # {pluginName}_EXTRA_LIBS 36 | -include $(SRCDIR)/Makefile.inc 37 | 38 | # Set target specific flags. 39 | $(LocatorLib_OBJECTS): CFLAGS := $(CFLAGS) $(LocatorLib_EXTRA_CFLAGS) 40 | $(LocatorLib_OBJECTS): C++FLAGS := $(C++FLAGS) $(LocatorLib_EXTRA_C++FLAGS) 41 | $(LocatorLib_OBJECTS): INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 42 | 43 | depend_LocatorLib: INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 44 | 45 | $(LocatorLib_PLUGIN): LFLAGS := $(LFLAGS) $(LocatorLib_EXTRA_LFLAGS) 46 | $(LocatorLib_PLUGIN): LIBS := $(LIBS) -lOpenMaya -lFoundation $(LocatorLib_EXTRA_LIBS) 47 | 48 | # Rules definitions 49 | .PHONY: depend_LocatorLib clean_LocatorLib Clean_LocatorLib 50 | 51 | $(LocatorLib_PLUGIN): $(LocatorLib_OBJECTS) 52 | -rm -f $@ 53 | $(LD) -o $@ $(LFLAGS) $^ $(LIBS) 54 | 55 | depend_LocatorLib : 56 | makedepend $(INCLUDES) $(MDFLAGS) -f$(DSTDIR)/Makefile $(LocatorLib_SOURCES) 57 | 58 | clean_LocatorLib: 59 | -rm -f $(LocatorLib_OBJECTS) 60 | 61 | Clean_LocatorLib: 62 | -rm -f $(LocatorLib_MAKEFILE).bak $(LocatorLib_OBJECTS) $(LocatorLib_PLUGIN) 63 | 64 | 65 | plugins: $(LocatorLib_PLUGIN) 66 | depend: depend_LocatorLib 67 | clean: clean_LocatorLib 68 | Clean: Clean_LocatorLib 69 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2014/Makefile: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | ifndef INCL_BUILDRULES 10 | 11 | # Include platform specific build settings 12 | TOP := . 13 | SRCDIR := $(TOP)/.. 14 | DSTDIR := $(TOP) 15 | include $(TOP)/buildrules 16 | 17 | # Always build the local plug-in when make is invoked from the 18 | # directory. 19 | all : plugins 20 | 21 | endif 22 | 23 | # Variable definitions 24 | LocatorLib_SOURCES := $(SRCDIR)/LocatorLib.cpp $(SRCDIR)/LocatorLibBase.cpp $(SRCDIR)/cubeLocator.cpp $(SRCDIR)/sphereLocator.cpp $(DSTDIR)/squareLocator.cpp $(SRCDIR)/ovalLocator.cpp $(SRCDIR)/Shape.cpp $(SRCDIR)/customLocator.cpp $(SRCDIR)/LocatorLibCmd.cpp 25 | LocatorLib_OBJECTS := $(DSTDIR)/LocatorLib.o $(DSTDIR)/LocatorLibBase.o $(DSTDIR)/cubeLocator.o $(DSTDIR)/sphereLocator.o $(DSTDIR)/squareLocator.o $(DSTDIR)/ovalLocator.o $(DSTDIR)/Shape.o $(DSTDIR)/customLocator.o $(DSTDIR)/LocatorLibCmd.o 26 | LocatorLib_PLUGIN := $(DSTDIR)/LocatorLib.$(EXT) 27 | LocatorLib_MAKEFILE := $(DSTDIR)/Makefile 28 | 29 | # Include the optional per-plugin Makefile.inc 30 | # 31 | # The file can contain macro definitions such as: 32 | # {pluginName}_EXTRA_CFLAGS 33 | # {pluginName}_EXTRA_C++FLAGS 34 | # {pluginName}_EXTRA_INCLUDES 35 | # {pluginName}_EXTRA_LIBS 36 | -include $(SRCDIR)/Makefile.inc 37 | 38 | # Set target specific flags. 39 | $(LocatorLib_OBJECTS): CFLAGS := $(CFLAGS) $(LocatorLib_EXTRA_CFLAGS) 40 | $(LocatorLib_OBJECTS): C++FLAGS := $(C++FLAGS) $(LocatorLib_EXTRA_C++FLAGS) 41 | $(LocatorLib_OBJECTS): INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 42 | 43 | depend_LocatorLib: INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 44 | 45 | $(LocatorLib_PLUGIN): LFLAGS := $(LFLAGS) $(LocatorLib_EXTRA_LFLAGS) 46 | $(LocatorLib_PLUGIN): LIBS := $(LIBS) -lOpenMaya -lFoundation $(LocatorLib_EXTRA_LIBS) 47 | 48 | # Rules definitions 49 | .PHONY: depend_LocatorLib clean_LocatorLib Clean_LocatorLib 50 | 51 | $(LocatorLib_PLUGIN): $(LocatorLib_OBJECTS) 52 | -rm -f $@ 53 | $(LD) -o $@ $(LFLAGS) $^ $(LIBS) 54 | 55 | depend_LocatorLib : 56 | makedepend $(INCLUDES) $(MDFLAGS) -f$(DSTDIR)/Makefile $(LocatorLib_SOURCES) 57 | 58 | clean_LocatorLib: 59 | -rm -f $(LocatorLib_OBJECTS) 60 | 61 | Clean_LocatorLib: 62 | -rm -f $(LocatorLib_MAKEFILE).bak $(LocatorLib_OBJECTS) $(LocatorLib_PLUGIN) 63 | 64 | 65 | plugins: $(LocatorLib_PLUGIN) 66 | depend: depend_LocatorLib 67 | clean: clean_LocatorLib 68 | Clean: Clean_LocatorLib 69 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2013/Makefile: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | ifndef INCL_BUILDRULES 10 | 11 | # Include platform specific build settings 12 | TOP := . 13 | SRCDIR := $(TOP)/.. 14 | DSTDIR := $(TOP) 15 | 16 | include $(TOP)/buildrules 17 | 18 | # Always build the local plug-in when make is invoked from the 19 | # directory. 20 | all : plugins 21 | 22 | endif 23 | 24 | # Variable definitions 25 | LocatorLib_SOURCES := $(SRCDIR)/LocatorLib.cpp $(SRCDIR)/LocatorLibBase.cpp $(SRCDIR)/cubeLocator.cpp $(SRCDIR)/sphereLocator.cpp $(DSTDIR)/squareLocator.cpp $(SRCDIR)/ovalLocator.cpp $(SRCDIR)/Shape.cpp $(SRCDIR)/customLocator.cpp $(SRCDIR)/LocatorLibCmd.cpp 26 | LocatorLib_OBJECTS := $(DSTDIR)/LocatorLib.o $(DSTDIR)/LocatorLibBase.o $(DSTDIR)/cubeLocator.o $(DSTDIR)/sphereLocator.o $(DSTDIR)/squareLocator.o $(DSTDIR)/ovalLocator.o $(DSTDIR)/Shape.o $(DSTDIR)/customLocator.o $(DSTDIR)/LocatorLibCmd.o 27 | LocatorLib_PLUGIN := $(DSTDIR)/LocatorLib.$(EXT) 28 | LocatorLib_MAKEFILE := $(DSTDIR)/Makefile 29 | 30 | # Include the optional per-plugin Makefile.inc 31 | # 32 | # The file can contain macro definitions such as: 33 | # {pluginName}_EXTRA_CFLAGS 34 | # {pluginName}_EXTRA_C++FLAGS 35 | # {pluginName}_EXTRA_INCLUDES 36 | # {pluginName}_EXTRA_LIBS 37 | -include $(SRCDIR)/Makefile.inc 38 | 39 | # Set target specific flags. 40 | $(LocatorLib_OBJECTS): CFLAGS := $(CFLAGS) $(LocatorLib_EXTRA_CFLAGS) 41 | $(LocatorLib_OBJECTS): C++FLAGS := $(C++FLAGS) $(LocatorLib_EXTRA_C++FLAGS) 42 | $(LocatorLib_OBJECTS): INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 43 | 44 | depend_LocatorLib: INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 45 | 46 | $(LocatorLib_PLUGIN): LFLAGS := $(LFLAGS) $(LocatorLib_EXTRA_LFLAGS) 47 | $(LocatorLib_PLUGIN): LIBS := $(LIBS) -lOpenMaya -lFoundation $(LocatorLib_EXTRA_LIBS) 48 | 49 | # Rules definitions 50 | .PHONY: depend_LocatorLib clean_LocatorLib Clean_LocatorLib 51 | 52 | $(LocatorLib_PLUGIN): $(LocatorLib_OBJECTS) 53 | -rm -f $@ 54 | $(LD) -o $@ $(LFLAGS) $^ $(LIBS) 55 | 56 | depend_LocatorLib : 57 | makedepend $(INCLUDES) $(MDFLAGS) -f$(DSTDIR)/Makefile $(LocatorLib_SOURCES) 58 | 59 | clean_LocatorLib: 60 | -rm -f $(LocatorLib_OBJECTS) 61 | 62 | Clean_LocatorLib: 63 | -rm -f $(LocatorLib_MAKEFILE).bak $(LocatorLib_OBJECTS) $(LocatorLib_PLUGIN) 64 | 65 | 66 | plugins: $(LocatorLib_PLUGIN) 67 | depend: depend_LocatorLib 68 | clean: clean_LocatorLib 69 | Clean: Clean_LocatorLib 70 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2013/Makefile: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | ifndef INCL_BUILDRULES 10 | 11 | # 12 | # Include platform specific build settings 13 | # 14 | TOP := . 15 | SRCDIR := $(TOP)/.. 16 | DSTDIR := $(TOP) 17 | include $(TOP)/buildrules 18 | 19 | # Always build the local plug-in when make is invoked from the 20 | # directory. 21 | all : plugins 22 | 23 | endif 24 | 25 | # Include the optional per-plugin Makefile.inc 26 | # 27 | # The file can contain macro definitions such as: 28 | # {pluginName}_EXTRA_CFLAGS 29 | # {pluginName}_EXTRA_C++FLAGS 30 | # {pluginName}_EXTRA_INCLUDES 31 | # {pluginName}_EXTRA_LIBS 32 | -include Makefile.inc 33 | 34 | # Variable definitions 35 | LocatorLib_SOURCES := $(SRCDIR)/LocatorLib.cpp $(SRCDIR)/LocatorLibBase.cpp $(SRCDIR)/sphereLocator.cpp $(SRCDIR)/cubeLocator.cpp $(SRCDIR)/squareLocator.cpp $(SRCDIR)/ovalLocator.cpp $(SRCDIR)/Shape.cpp $(SRCDIR)/customLocator.cpp $(SRCDIR)/LocatorLibCmd.cpp 36 | LocatorLib_OBJECTS := $(DSTDIR)/LocatorLib.o $(DSTDIR)/LocatorLibBase.o $(DSTDIR)/sphereLocator.o $(DSTDIR)/cubeLocator.o $(DSTDIR)/squareLocator.o $(DSTDIR)/ovalLocator.o $(DSTDIR)/Shape.o $(DSTDIR)/customLocator.o $(DSTDIR)/LocatorLibCmd.o 37 | LocatorLib_PLUGIN := $(DSTDIR)/LocatorLib.$(EXT) 38 | LocatorLib_MAKEFILE := $(DSTDIR)/Makefile 39 | 40 | # Set target specific flags. 41 | $(LocatorLib_OBJECTS): CFLAGS := $(CFLAGS) $(LocatorLib_EXTRA_CFLAGS) 42 | $(LocatorLib_OBJECTS): C++FLAGS := $(C++FLAGS) $(LocatorLib_EXTRA_C++FLAGS) 43 | $(LocatorLib_OBJECTS): INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 44 | 45 | depend_LocatorLib: INCLUDES := $(INCLUDES) $(LocatorLib_EXTRA_INCLUDES) 46 | 47 | $(LocatorLib_PLUGIN): LFLAGS := $(LFLAGS) $(LocatorLib_EXTRA_LFLAGS) 48 | $(LocatorLib_PLUGIN): LIBS := $(LIBS) -lOpenMaya -lFoundation -lOpenMayaRender -lOpenMayaUI -framework AGL -framework OpenGL -framework GLUT $(LocatorLib_EXTRA_LIBS) 49 | 50 | # Rules definitions 51 | .PHONY: depend_LocatorLib clean_LocatorLib Clean_LocatorLib 52 | 53 | $(LocatorLib_PLUGIN): $(LocatorLib_OBJECTS) 54 | -rm -f $@ 55 | $(LD) -o $@ $(LFLAGS) $^ $(LIBS) 56 | 57 | depend_LocatorLib : 58 | makedepend $(INCLUDES) $(MDFLAGS) -f$(DSTDIR)/Makefile $(LocatorLib_SOURCES) 59 | 60 | clean_LocatorLib: 61 | -rm -f $(LocatorLib_OBJECTS) 62 | 63 | Clean_LocatorLib: 64 | -rm -f $(LocatorLib_MAKEFILE).bak $(LocatorLib_OBJECTS) $(LocatorLib_PLUGIN) 65 | 66 | plugins: $(LocatorLib_PLUGIN) 67 | depend: depend_LocatorLib 68 | clean: clean_LocatorLib 69 | Clean: Clean_LocatorLib 70 | -------------------------------------------------------------------------------- /scripts/AEcustomLocatorTemplate.mel: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | global proc AEshapeNameNew (string $fileNameAttr) { 14 | setUITemplate -pst attributeEditorTemplate; 15 | columnLayout -adj true; 16 | rowLayout -nc 3 fileNameLayout; 17 | 18 | text -label "Shape filename" fileNameText; 19 | textField fileNameField; 20 | symbolButton -image "navButtonBrowse.png" browser; 21 | 22 | setParent ..; 23 | setParent ..; 24 | setParent ..; 25 | 26 | AEshapeNameReplace ($fileNameAttr); 27 | } 28 | 29 | global proc AEshapeNameReplace (string $fileNameAttr) { 30 | string $fileName = `getAttr $fileNameAttr`; 31 | string $nodeName = `plugNode $fileNameAttr`; 32 | 33 | // file name attribute 34 | // 35 | connectControl -fileName fileNameField $fileNameAttr; 36 | button -e -c ("AEshapeNameFileBrowser " + $fileNameAttr) browser; 37 | } 38 | 39 | global proc AEshapeNameFileBrowser (string $fileNameAttr) { 40 | // prepare filter and starting dir for file dialog 41 | string $filter = "Text files (*.txt);;" 42 | + "All files (*.*)"; 43 | 44 | // choose a file to import 45 | string $result[] = `fileDialog2 46 | -returnFilter 1 47 | -fileFilter $filter 48 | -dialogStyle 2 49 | -caption "Assign Shape File" 50 | -fileMode 1 51 | `; 52 | if (size($result) == 0 || size($result[0]) == 0) { 53 | // cancelled 54 | return; 55 | } 56 | 57 | // set the file name attribute of the cache node 58 | setAttr $fileNameAttr -type "string" $result[0]; 59 | } 60 | 61 | global proc AEcustomLocatorTemplate (string $nodeName) { 62 | editorTemplate -beginScrollLayout ; 63 | 64 | editorTemplate -beginLayout "Custom Locator Attributes" -collapse 0; 65 | editorTemplate -label "Size" -addControl "size"; 66 | editorTemplate -callCustom AEshapeNameNew AEshapeNameReplace "shapeName"; 67 | editorTemplate -endLayout; 68 | 69 | // Include/call base class/node attributes 70 | editorTemplate -beginLayout (uiRes("m_AElocatorTemplate.kLocatorAttributes")) -collapse 0; 71 | AElocatorCommon $nodeName; 72 | editorTemplate -endLayout; 73 | 74 | AElocatorInclude $nodeName; 75 | 76 | editorTemplate -addExtraControls; 77 | editorTemplate -endScrollLayout ; 78 | } 79 | 80 | -------------------------------------------------------------------------------- /Sources/LocatorLib/ovalLocator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (September 1, 2012) 12 | 13 | #pragma once 14 | 15 | #include "LocatorLibBase.h" 16 | 17 | //----------------------------------------------------------------------------- 18 | class ovalLocator : public locatorLibBase { 19 | public: 20 | static MTypeId id ; 21 | static MString drawDbClassification ; 22 | static MString drawRegistrantId ; 23 | static MObject size ; // The size of the oval 24 | 25 | public: 26 | ovalLocator () : locatorLibBase () {} 27 | virtual ~ovalLocator () {} 28 | 29 | //virtual void draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status) ; 30 | virtual void myWireFrameDraw () ; 31 | virtual void myShadedDraw () ; 32 | virtual MBoundingBox boundingBox () const ; 33 | 34 | static void *creator () { return (new ovalLocator ()) ; } 35 | static MStatus initialize () ; 36 | static MStatus registerMe (MFnPlugin &plugin) ; 37 | static MStatus unregisterMe (MFnPlugin &plugin) ; 38 | 39 | public: 40 | static MPointArray &vertices () ; 41 | static MBoundingBox boundingbox (float multiplier =1.0f) ; 42 | 43 | } ; 44 | 45 | //--------------------------------------------------------------------------- 46 | // Viewport 2.0 override implementation 47 | class ovalLocatorData : public locatorLibData { 48 | public: 49 | ovalLocatorData () : locatorLibData () {} 50 | virtual ~ovalLocatorData () {} 51 | 52 | } ; 53 | 54 | //--------------------------------------------------------------------------- 55 | class ovalLocatorDrawOverride : public locatorLibDrawOverrideBase { 56 | 57 | private: 58 | ovalLocatorDrawOverride (const MObject &obj) : locatorLibDrawOverrideBase (obj, ovalLocatorDrawOverride::draw) {} 59 | 60 | public: 61 | virtual ~ovalLocatorDrawOverride () {} 62 | 63 | virtual MBoundingBox boundingBox (const MDagPath &objPath,const MDagPath &cameraPath) const ; 64 | #ifdef preMaya2014 65 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) ; 66 | #else 67 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) ; 68 | #endif 69 | 70 | static void draw (const MHWRender::MDrawContext &context, const MUserData* data) ; 71 | static MHWRender::MPxDrawOverride *Creator (const MObject &obj) { return (new ovalLocatorDrawOverride (obj)) ; } 72 | 73 | private: 74 | virtual float getMultiplier (const MDagPath &objPath) const ; 75 | 76 | } ; 77 | -------------------------------------------------------------------------------- /Sources/LocatorLib/cubeLocator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (September 1, 2012) 12 | 13 | #pragma once 14 | #include "LocatorLibBase.h" 15 | 16 | //----------------------------------------------------------------------------- 17 | class cubeLocator : public locatorLibBase { 18 | public: 19 | static MTypeId id ; 20 | static MString drawDbClassification ; 21 | static MString drawRegistrantId ; 22 | static MObject size ; // The size of the cube 23 | 24 | public: 25 | cubeLocator () : locatorLibBase () {} 26 | virtual ~cubeLocator () {} 27 | 28 | //virtual void draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status) ; 29 | virtual void myWireFrameDraw () ; 30 | virtual void myShadedDraw () ; 31 | virtual MBoundingBox boundingBox () const ; 32 | 33 | static void *creator () { return (new cubeLocator ()) ; } 34 | static MStatus initialize () ; 35 | static MStatus registerMe (MFnPlugin &plugin) ; 36 | static MStatus unregisterMe (MFnPlugin &plugin) ; 37 | 38 | public: 39 | static MPointArray &vertices () ; 40 | static MBoundingBox boundingbox (float multiplier =1.0f) ; 41 | 42 | } ; 43 | 44 | //----------------------------------------------------------------------------- 45 | // Viewport 2.0 override implementation 46 | class cubeLocatorData : public locatorLibData { 47 | 48 | public: 49 | cubeLocatorData () : locatorLibData () {} // don't delete after draw 50 | virtual ~cubeLocatorData () {} 51 | 52 | } ; 53 | 54 | //----------------------------------------------------------------------------- 55 | class cubeLocatorDrawOverride : public locatorLibDrawOverrideBase { 56 | 57 | private: 58 | cubeLocatorDrawOverride (const MObject &obj) : locatorLibDrawOverrideBase (obj, cubeLocatorDrawOverride::draw) {} 59 | 60 | public: 61 | virtual ~cubeLocatorDrawOverride () {} 62 | 63 | virtual MBoundingBox boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const ; 64 | #ifdef preMaya2014 65 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) ; 66 | #else 67 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) ; 68 | #endif 69 | 70 | static void draw (const MHWRender::MDrawContext &context, const MUserData *data) ; 71 | static MHWRender::MPxDrawOverride *Creator (const MObject &obj) { return (new cubeLocatorDrawOverride (obj)) ; } 72 | 73 | private: 74 | virtual float getMultiplier (const MDagPath &objPath) const ; 75 | 76 | } ; 77 | -------------------------------------------------------------------------------- /Sources/LocatorLib/squareLocator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (September 1, 2012) 12 | 13 | #pragma once 14 | 15 | #include "LocatorLibBase.h" 16 | 17 | //----------------------------------------------------------------------------- 18 | class squareLocator : public locatorLibBase { 19 | public: 20 | static MTypeId id ; 21 | static MString drawDbClassification ; 22 | static MString drawRegistrantId ; 23 | static MObject size ; // The size of the square 24 | 25 | public: 26 | squareLocator () : locatorLibBase () {} 27 | virtual ~squareLocator () {} 28 | 29 | //virtual void draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status) ; 30 | virtual void myWireFrameDraw () ; 31 | virtual void myShadedDraw () ; 32 | virtual MBoundingBox boundingBox () const ; 33 | 34 | static void *creator () { return (new squareLocator ()) ; } 35 | static MStatus initialize () ; 36 | static MStatus registerMe (MFnPlugin &plugin) ; 37 | static MStatus unregisterMe (MFnPlugin &plugin) ; 38 | 39 | public: 40 | static MPointArray &vertices () ; 41 | static MBoundingBox boundingbox (float multiplier =1.0f) ; 42 | 43 | } ; 44 | 45 | //--------------------------------------------------------------------------- 46 | // Viewport 2.0 override implementation 47 | class squareLocatorData : public locatorLibData { 48 | public: 49 | squareLocatorData () : locatorLibData () {} // don't delete after draw 50 | virtual ~squareLocatorData () {} 51 | 52 | } ; 53 | 54 | //--------------------------------------------------------------------------- 55 | class squareLocatorDrawOverride : public locatorLibDrawOverrideBase { 56 | private: 57 | squareLocatorDrawOverride (const MObject &obj) : locatorLibDrawOverrideBase (obj, squareLocatorDrawOverride::draw) {} 58 | 59 | public: 60 | virtual ~squareLocatorDrawOverride () {} 61 | 62 | virtual MBoundingBox boundingBox (const MDagPath &objPath,const MDagPath &cameraPath) const ; 63 | #ifdef preMaya2014 64 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) ; 65 | #else 66 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) ; 67 | #endif 68 | 69 | static void draw (const MHWRender::MDrawContext &context, const MUserData *data) ; 70 | static MHWRender::MPxDrawOverride *Creator (const MObject &obj) { return (new squareLocatorDrawOverride (obj)) ; } 71 | 72 | private: 73 | virtual float getMultiplier (const MDagPath &objPath) const ; 74 | 75 | } ; 76 | -------------------------------------------------------------------------------- /Sources/LocatorLib/sphereLocator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (September 1, 2012) 12 | 13 | #pragma once 14 | 15 | #include "LocatorLibBase.h" 16 | 17 | //----------------------------------------------------------------------------- 18 | class sphereLocator : public locatorLibBase { 19 | 20 | public: 21 | static MTypeId id ; 22 | static MString drawDbClassification ; 23 | static MString drawRegistrantId ; 24 | static MObject size ; // The size of the sphere 25 | 26 | public: 27 | sphereLocator () : locatorLibBase () {} 28 | virtual ~sphereLocator () {} 29 | 30 | //virtual void draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status) ; 31 | virtual void myWireFrameDraw () ; 32 | virtual void myShadedDraw () ; 33 | virtual MBoundingBox boundingBox () const ; 34 | 35 | static void *creator () { return (new sphereLocator ()) ; } 36 | static MStatus initialize () ; 37 | static MStatus registerMe (MFnPlugin &plugin) ; 38 | static MStatus unregisterMe (MFnPlugin &plugin) ; 39 | 40 | public: 41 | static MPointArray &vertices () ; 42 | static MBoundingBox boundingbox (float multiplier =1.0f) ; 43 | 44 | } ; 45 | 46 | //----------------------------------------------------------------------------- 47 | // Viewport 2.0 override implementation 48 | class sphereLocatorData : public locatorLibData { 49 | public: 50 | sphereLocatorData () : locatorLibData () {} // don't delete after draw 51 | virtual ~sphereLocatorData () {} 52 | 53 | } ; 54 | 55 | //----------------------------------------------------------------------------- 56 | class sphereLocatorDrawOverride : public locatorLibDrawOverrideBase { 57 | private: 58 | sphereLocatorDrawOverride (const MObject &obj) : locatorLibDrawOverrideBase (obj, sphereLocatorDrawOverride::draw) {} 59 | 60 | public: 61 | virtual ~sphereLocatorDrawOverride () {} 62 | 63 | virtual MBoundingBox boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const ; 64 | #ifdef preMaya2014 65 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) ; 66 | #else 67 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) ; 68 | #endif 69 | 70 | static void draw (const MHWRender::MDrawContext &context, const MUserData *data) ; 71 | static MHWRender::MPxDrawOverride *Creator (const MObject &obj) { return (new sphereLocatorDrawOverride (obj)) ; } 72 | 73 | private: 74 | virtual float getMultiplier (const MDagPath &objPath) const ; 75 | 76 | } ; 77 | -------------------------------------------------------------------------------- /Sources/BuildMe.txt: -------------------------------------------------------------------------------- 1 | 2 | MayaAppWizard has created this LocatorLib application for you. 3 | You can get regular updates for the Wizards at http://www.autodesk.com/developmaya 4 | and report issues at: oarxwiz-feedback@autodesk.com 5 | 6 | The wizards assumes that you have a machine setup for building Maya plug-ins as documented 7 | in the Maya API Guide -> Setting up your build environment - available here http://www.autodesk.com/me-sdk-docs 8 | 9 | MacOS 10 | ===== 11 | Inside the project directory, you'll find a Mac2013[-5] folder with make files. Using a terminal 12 | window go into that directory and run 'make' - that will create the project bundle for Maya on the Mac. 13 | 14 | Linux 15 | ===== 16 | Inside the project directory, you'll find a Linux2013[-5] folder with make files. Using a terminal 17 | window go into that directory and run 'make' - that will create the project bundle for Maya on the Mac. 18 | 19 | Windows 20 | ======= 21 | This project uses the Maya devkit .props file from the Maya devkit to set the C++ compiler, MIDL, 22 | and Linker options appropriately. The project .props file is located in your project directory and reference 23 | the Maya devkit and Maya executable paths. 24 | To create a new configuration and/or change the paths references copy or modify the Autodesk.maya-2013[-5].props 25 | File, like this: 26 | #7 [maya path on your x64 windows platform] 27 | #8 [maya path on your win32 windows platform] 28 | 29 | Note the Wizards installer also provided an Maya 2012 .props file for your convenience as example in 30 | case you want to have multiple configuration (Checkout the Wizards install directory). 31 | To undestand and use .props file, please visit the Microsoft WEB site at http://msdn.microsoft.com/en-us/library/a4xbdz1e.aspx 32 | and http://blogs.msdn.com/b/visualstudio/archive/2010/05/14/a-guide-to-vcxproj-and-props-file-structure.aspx 33 | In Visual Studio 2010, the .props editor is in -> View -> Other Windows -> Property Manager 34 | 35 | ----------------------------------------------------------------------------- 36 | 37 | StdAfx.h, StdAfx.cpp 38 | On Windows, these files are used to build a precompiled header (PCH) file 39 | named LocatorLib.pch and a precompiled types file named StdAfx.obj using StdAfx.cpp. 40 | StdAfx.cpp is not used for Mac and Linux builds. 41 | 42 | StdAfx.h includes mayaHeaders.h which includes all the Maya headers, 43 | On Windows, it uses #pragma to import the required .lib file and exports mandatory symbols. 44 | 45 | ----------------------------------------------------------------------------- 46 | 47 | // 48 | // Copyright 2012 Autodesk, Inc. All rights reserved. 49 | // 50 | // Use of this software is subject to the terms of the Autodesk license 51 | // agreement provided at the time of installation or download, or which 52 | // otherwise accompanies this software in either electronic or hard copy form. 53 | // -------------------------------------------------------------------------------- /Sources/LocatorLib/customLocator.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille Fauvel 11 | // 1.0 Original release (September 1, 2012) 12 | 13 | #pragma once 14 | #include "Shape.h" 15 | #include "LocatorLibBase.h" 16 | 17 | //----------------------------------------------------------------------------- 18 | class customLocator : public locatorLibBase { 19 | public: 20 | static MTypeId id ; 21 | static MString drawDbClassification ; 22 | static MString drawRegistrantId ; 23 | static MObject size ; // The size of the locator 24 | static MObject shapeFilename ; // The shape of the locator 25 | 26 | public: 27 | customLocator () : locatorLibBase () {} 28 | virtual ~customLocator () {} 29 | 30 | //virtual void draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus status) ; 31 | virtual void myWireFrameDraw () ; 32 | virtual void myShadedDraw () ; 33 | virtual MBoundingBox boundingBox () const ; 34 | 35 | static void *creator () { return (new customLocator ()) ; } 36 | static MStatus initialize () ; 37 | static MStatus registerMe (MFnPlugin &plugin) ; 38 | static MStatus unregisterMe (MFnPlugin &plugin) ; 39 | 40 | public: 41 | static MPointArray vertices (MString &name) ; 42 | 43 | } ; 44 | 45 | //----------------------------------------------------------------------------- 46 | // Viewport 2.0 override implementation 47 | class customLocatorData : public locatorLibData { 48 | public: 49 | MString shapeName ; 50 | 51 | public: 52 | customLocatorData () : locatorLibData () {} // don't delete after draw 53 | virtual ~customLocatorData () {} 54 | 55 | } ; 56 | 57 | //----------------------------------------------------------------------------- 58 | class customLocatorDrawOverride : public locatorLibDrawOverrideBase { 59 | 60 | private: 61 | customLocatorDrawOverride (const MObject &obj) : locatorLibDrawOverrideBase (obj, customLocatorDrawOverride::draw) {} 62 | 63 | public: 64 | virtual ~customLocatorDrawOverride () {} 65 | 66 | virtual MBoundingBox boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const ; 67 | #ifdef preMaya2014 68 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) ; 69 | #else 70 | virtual MUserData *prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) ; 71 | #endif 72 | 73 | static void draw (const MHWRender::MDrawContext &context, const MUserData *data) ; 74 | static MHWRender::MPxDrawOverride *Creator (const MObject &obj) { return (new customLocatorDrawOverride (obj)) ; } 75 | 76 | private: 77 | virtual float getMultiplier (const MDagPath &objPath) const ; 78 | virtual MString getShapeName (const MDagPath &objPath) const ; 79 | } ; 80 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib-5.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Source Files 6 | 7 | 8 | Source Files 9 | 10 | 11 | Source Files 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | Source Files 21 | 22 | 23 | Source Files 24 | 25 | 26 | Source Files 27 | 28 | 29 | Source Files 30 | 31 | 32 | Source Files 33 | 34 | 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files 56 | 57 | 58 | Header Files 59 | 60 | 61 | Header Files 62 | 63 | 64 | Header Files 65 | 66 | 67 | Resource Files 68 | 69 | 70 | 71 | 72 | 73 | Samples 74 | 75 | 76 | Samples 77 | 78 | 79 | MEL Scripts 80 | 81 | 82 | MEL Scripts 83 | 84 | 85 | MEL Scripts 86 | 87 | 88 | MEL Scripts 89 | 90 | 91 | MEL Scripts 92 | 93 | 94 | 95 | 96 | 97 | 98 | {70836e6b-f4c5-4aaf-bfae-2615347c9151} 99 | h;hpp;hxx;hm;inl;inc;xsd 100 | 101 | 102 | {e6745db0-bad0-4796-bcb3-da2959cefe47} 103 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 104 | 105 | 106 | {de88a94b-08a1-4254-9d42-8ffe2e74b72c} 107 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 108 | 109 | 110 | {42887074-643e-478a-95b9-910e6c46a14f} 111 | 112 | 113 | {a7540af5-5f91-466a-abd0-376e6000f336} 114 | 115 | 116 | 117 | 118 | Resource Files 119 | 120 | 121 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib2014.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Source Files 6 | 7 | 8 | Source Files 9 | 10 | 11 | Source Files 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | Source Files 21 | 22 | 23 | Source Files 24 | 25 | 26 | Source Files 27 | 28 | 29 | Source Files 30 | 31 | 32 | Source Files 33 | 34 | 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | Header Files 53 | 54 | 55 | Header Files 56 | 57 | 58 | Header Files 59 | 60 | 61 | Header Files 62 | 63 | 64 | Header Files 65 | 66 | 67 | Resource Files 68 | 69 | 70 | 71 | 72 | 73 | Samples 74 | 75 | 76 | Samples 77 | 78 | 79 | MEL Scripts 80 | 81 | 82 | MEL Scripts 83 | 84 | 85 | MEL Scripts 86 | 87 | 88 | MEL Scripts 89 | 90 | 91 | MEL Scripts 92 | 93 | 94 | 95 | 96 | 97 | 98 | {25E479F5-FB8D-4A33-8962-D79F9490F228} 99 | h;hpp;hxx;hm;inl;inc;xsd 100 | 101 | 102 | {E0DB2589-2C03-4911-A0F3-139E90434EFD} 103 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 104 | 105 | 106 | {122F520C-49D9-4E1D-BC4C-C219182017F3} 107 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 108 | 109 | 110 | {64F51C3B-144C-4972-8073-FBBDB043E8A2} 111 | 112 | 113 | {384D046C-8974-4C2E-9DAF-A2E588E81551} 114 | 115 | 116 | 117 | 118 | Resource Files 119 | 120 | 121 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {cb9a0395-b73e-4a99-a11d-e7105132242b} 18 | mel; 19 | 20 | 21 | {df5d35f9-5b23-4304-82e6-d44d4b7d41ad} 22 | 23 | 24 | 25 | 26 | Header Files 27 | 28 | 29 | Header Files 30 | 31 | 32 | Header Files 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | Header Files 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | 60 | 61 | Source Files 62 | 63 | 64 | Source Files 65 | 66 | 67 | Source Files 68 | 69 | 70 | Source Files 71 | 72 | 73 | Source Files 74 | 75 | 76 | Source Files 77 | 78 | 79 | Source Files 80 | 81 | 82 | Source Files 83 | 84 | 85 | Source Files 86 | 87 | 88 | Source Files 89 | 90 | 91 | 92 | 93 | Resource Files 94 | 95 | 96 | 97 | 98 | 99 | Samples 100 | 101 | 102 | Samples 103 | 104 | 105 | MEL Scripts 106 | 107 | 108 | MEL Scripts 109 | 110 | 111 | MEL Scripts 112 | 113 | 114 | MEL Scripts 115 | 116 | 117 | MEL Scripts 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Shape.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille Fauvel 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #include "Shape.h" 15 | 16 | //----------------------------------------------------------------------------- 17 | ShapeMgr shapeMgr ; 18 | 19 | //----------------------------------------------------------------------------- 20 | bool Shape::loadFromFile (std::string filename) { 21 | FILE *fp =fopen (filename.c_str (), "r") ; 22 | if ( fp == NULL ) 23 | return (false) ; 24 | int num_vertices =0 ; 25 | fscanf (fp, "%d\n", &num_vertices) ; 26 | vertices.clear () ; 27 | for ( int i =0 ; i < num_vertices ; i++ ) { 28 | float x, y, z ; 29 | fscanf (fp, "%f %f %f\n", &x, &y, &z) ; 30 | vertices.append (x, y, z) ; 31 | } 32 | int num_triangles =0 ; 33 | fscanf (fp, "%d\n", &num_triangles) ; 34 | triangles.clear () ; 35 | for ( int i =0 ; i < num_triangles ; i++ ) { 36 | int a, b, c ; 37 | fscanf (fp, "%d %d %d\n", &a, &b, &c) ; 38 | triangles.append (a) ; 39 | triangles.append (b) ; 40 | triangles.append (c) ; 41 | } 42 | fclose (fp) ; 43 | return (true) ; 44 | } 45 | 46 | void Shape::renderWireFrame (float multiplier /*=1.0f*/) { 47 | if ( triangles.length () == 0 ) { 48 | glBegin (GL_LINES) ; 49 | for ( int i =0 ; i < vertices.length () - 1 ; i++ ) { 50 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 51 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 52 | } 53 | glEnd () ; 54 | } else { 55 | for ( int i =0 ; i < triangles.length () - 2 ; i +=3 ) { 56 | glBegin (GL_LINE_LOOP) ; 57 | glVertex3f (vertices [triangles [i]].x * multiplier, vertices [triangles [i]].y * multiplier, vertices [triangles [i]].z * multiplier) ; 58 | glVertex3f (vertices [triangles [i + 1]].x * multiplier, vertices [triangles [i + 1]].y * multiplier, vertices [triangles [i + 1]].z * multiplier) ; 59 | glVertex3f (vertices [triangles [i + 2]].x * multiplier, vertices [triangles [i + 2]].y * multiplier, vertices [triangles [i + 2]].z * multiplier) ; 60 | glEnd () ; 61 | } 62 | } 63 | } 64 | 65 | void Shape::renderShaded (float multiplier /*=1.0f*/) { 66 | if ( triangles.length () == 0 ) { 67 | glBegin (GL_POLYGON) ; 68 | for ( int i =0 ; i < vertices.length () ; i++ ) 69 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 70 | glEnd () ; 71 | } else { 72 | glBegin (GL_TRIANGLES) ; 73 | for ( int i =0 ; i < triangles.length () - 2 ; i +=3 ) { 74 | glVertex3f (vertices [triangles [i]].x * multiplier, vertices [triangles [i]].y * multiplier, vertices [triangles [i]].z * multiplier) ; 75 | glVertex3f (vertices [triangles [i + 1]].x * multiplier, vertices [triangles [i + 1]].y * multiplier, vertices [triangles [i + 1]].z * multiplier) ; 76 | glVertex3f (vertices [triangles [i + 2]].x * multiplier, vertices [triangles [i + 2]].y * multiplier, vertices [triangles [i + 2]].z * multiplier) ; 77 | } 78 | glEnd () ; 79 | } 80 | } 81 | 82 | MBoundingBox Shape::boundingbox (float multiplier /*=1.0f*/) { 83 | static MBoundingBox boundingbox ; 84 | if ( boundingbox.min () == boundingbox.max () ) { 85 | for ( unsigned int i =0 ; i < vertices.length () ; i++ ) 86 | boundingbox.expand (vertices [i]) ; 87 | } 88 | MBoundingBox bbox (boundingbox) ; 89 | if ( multiplier != 1.0 ) { 90 | double factors [3] ={ multiplier, multiplier, multiplier } ; 91 | MTransformationMatrix mat ; 92 | mat.setScale (factors, MSpace::kWorld) ; 93 | bbox.transformUsing (mat.asScaleMatrix ()) ; 94 | } 95 | return (bbox) ; 96 | } 97 | 98 | //----------------------------------------------------------------------------- 99 | ShapeMgr::ShapeMgr () { 100 | Shape &shape =shapeList ["default"] ; 101 | shape.vertices.append (-0.5f, 0.0f, 0.5f) ; 102 | shape.vertices.append (0.5f, 0.0f, 0.5f) ; 103 | shape.vertices.append (0.5f, 0.0f, -0.5f) ; 104 | shape.vertices.append (-0.5f, 0.0f, -0.5f) ; 105 | shape.vertices.append (-0.5f, 0.0f, 0.5f) ; 106 | } 107 | 108 | Shape &ShapeMgr::shapeData (std::string filename) { 109 | if ( filename.length () == 0 ) 110 | filename ="default" ; 111 | if ( shapeList.find (filename) == shapeList.end () ) { 112 | Shape &shape =shapeList [filename] ; 113 | shape.loadFromFile (filename) ; 114 | return (shape) ; 115 | } 116 | return ((*(shapeList.find (filename))).second) ; 117 | } 118 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib2014.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | plugin 15 | 16 | 17 | {3B922D50-1904-4845-A912-56090FCE761F} 18 | 19 | 20 | 21 | DynamicLibrary 22 | MultiByte 23 | false 24 | false 25 | false 26 | 27 | 28 | false 29 | true 30 | 31 | 32 | true 33 | false 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | true 47 | _WIN64;%(PreprocessorDefinitions) 48 | Use 49 | Use 50 | Use 51 | 52 | 53 | 54 | 55 | 56 | 57 | Use 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | Create 85 | Create 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Maya Locator Library - Plug-in of the Month, October 2012 2 | ======================================= 3 | 4 | Description 5 | ----------- 6 | 7 | This plug-in allows users to create different shapes of locators other than Maya’s internal built-in locator. It provides a custom command, which has 5 built-in flags, 8 | allowing users to create 4 different basic types of locator, specifically an oval-shape locator, a square-shape locator, a cube-shape locator and a sphere-shape locator. 9 | 10 | It also provide a 'custom' locator which allow the use to define its own locator shape. There is 2 functional modes for the 'custom'. 11 | 12 | - Shape mode 13 | 14 | The user can define a simple shape (2d or 3d) as a continuous closed polyline. See the shape.txt in the Samples folder for details. 15 | This mode accepts files with a serie of 3d coordinates X, Y, Z 16 | 17 | - Solid mode 18 | 19 | The user can define a simple solid as a serie of triangles. See the pyramid.txt in the Samples folder for details. This mode accepts files 20 | with a serie of 3d coordinates X, Y, Z for vertices, and then a serie of triangle vertex index defined above. 21 | 22 | 23 | Execute “help LocatorLibCmd” for more details. 24 | 25 | 26 | 'Shape mode' file format description 27 | ------------------------------------ 28 | 29 | This is the simple 'Shape mode' file structure. 30 | 31 | # Number of vertex (integer) 32 | # #0 Vertex X, Y, Z coordinates (float) 33 | # #1 Vertex X, Y, Z coordinates (float) 34 | ... 35 | # #NNN Vertex X, Y, Z coordinates (float) 36 | 0 # to terminate 37 | 38 | We usually recommend working with a unit size shape, but this is not limited to any size. 39 | 40 | 41 | 'Solid mode' file format description 42 | ------------------------------------ 43 | 44 | This is the simple 'Solid mode' file structure. 45 | # Number of vertex (integer) 46 | # #0 Vertex X, Y, Z coordinates (float) 47 | # #1 Vertex X, Y, Z coordinates (float) 48 | ... 49 | # #NNN Vertex X, Y, Z coordinates (float) 50 | # Number of triangles (integer) 51 | # 1st Triangle Vertex indexes (integer) 52 | # 2nd Triangle Vertex indexes (integer) 53 | ... 54 | # TTT Triangle Vertex indexes (integer) 55 | 56 | We usually recommend working with a unit size shape, but this is not limited to any size. 57 | The Vertex index starts at index 0. The triangle' vertex index runs from 0 to NNN-1 58 | 59 | 60 | System Requirements 61 | ------------------- 62 | This plug-in has been tested with Autodesk Maya 2013 and 2013 Extension. 63 | 64 | This plug-in is a C++ based plug-in, so it does require compilation in case you want to modify it or move to a newer Maya version. It works on Window 32bit/64bit, Mac OS, and Linux. 65 | 66 | 67 | Installation 68 | ------------ 69 | The following steps are for using the plug-in with Autodesk Maya 2013 or 2013 Extension. If you are using Maya 2013 Extension, please 70 | consider the release number as "2013.5" in the paths listed below. 71 | 72 | 1. Create a directory structure like this: 73 | 74 | -- myDirectory --+-- plug-ins 75 | +-- scripts 76 | 77 | 2. Copy the scripts folder into your created directory. 78 | 79 | 3. Copy the plug-in binary into the plug-ins folder (.mll for windows, .bundle for OSX, .so for Linux) 80 | 81 | 4. Create a module file. For this go into: 82 | 83 | Windows 7 84 | C:\users\\Documents\maya\[.5][-x64]\modules 85 | 86 | MacOS 87 | /Users//Library/Preferences/Autodesk/maya/[.5]-x64/modules 88 | 89 | Linux 90 | /home//maya/modules 91 | or /home//maya/2013[.5]-x64/modules 92 | 93 | 4. Edit the new LocatorLib.mod file in a text editor and modify the path and , to reflect the location where you copied the files. 94 | 95 | 5. Once installed, the "LocatorLib" plug-in will be available in your Maya plug-in manager. Open the plug-in manager, load 96 | the plug-in, and select the 'Auto load' option. The plug-in manager can be found in: 97 | ->Window->Settings/Preferences/Plug-in manager 98 | 99 | 100 | Usage 101 | ----- 102 | Inside Maya, call the command 'LocatorLibCmd' with one of the following options: 103 | -o or -oval to create an oval locator 104 | -s or -square to create a square locator 105 | -cu or -cube to create a cube locator 106 | -sp or -sphere to create to create a sphere locator 107 | -c or -custom to create a custom locator 108 | 109 | You can also create an instance of the node locator by using the MEL command 'createNode'. I.e.: 110 | createNode ovalLocator; 111 | createNode squareLocator; 112 | createNode cubeLocator; 113 | createNode sphereLocator; 114 | createNode customLocator; 115 | 116 | 117 | Uninstallation 118 | -------------- 119 | Simply removing the "LocatorLib.mod" files from your system folder, and delete the plug-in module folder will uninstall the plug-in. 120 | 121 | Author 122 | ------ 123 | This plug-in was written by Naiq Weng and Cyrille Fauvel from the Autodesk Developer Network team. 124 | 125 | 126 | Further Reading 127 | --------------- 128 | For more information on developing with Maya, please visit the [Maya Developer Center at http://www.autodesk.com/developmaya](http://www.autodesk.com/developmaya) 129 | 130 | Feedback 131 | -------- 132 | Email us at labs.plug-ins@autodesk.com with feedback or requests for enhancements. 133 | 134 | 135 | License 136 | -------- 137 | This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT). Please see the [LICENSE](LICENSE) file for full details. 138 | 139 | 140 | Release History 141 | --------------- 142 | 143 | 1.0 Original release (October 1, 2012) 144 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | Debug 14 | Win32 15 | 16 | 17 | Release 18 | Win32 19 | 20 | 21 | 22 | plugin 23 | 24 | 25 | {C2B1C75F-B1B3-44BF-9D13-10A771F7FA8E} 26 | 27 | 28 | 29 | DynamicLibrary 30 | MultiByte 31 | false 32 | false 33 | false 34 | 35 | 36 | false 37 | true 38 | 39 | 40 | true 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | true 55 | preMaya2014;_Win64;%(PreprocessorDefinitions) 56 | Use 57 | Use 58 | Use 59 | preMaya2014;%(PreprocessorDefinitions) 60 | 61 | 62 | 63 | 64 | 65 | 66 | Use 67 | preMaya2014;%(PreprocessorDefinitions) 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | Create 95 | Create 96 | Create 97 | Create 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /Sources/LocatorLib/LocatorLib-5.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | Debug 14 | Win32 15 | 16 | 17 | Release 18 | Win32 19 | 20 | 21 | 22 | plugin 23 | 24 | 25 | {6B205358-6FF9-4690-8388-55CA41A783BF} 26 | 27 | 28 | 29 | DynamicLibrary 30 | MultiByte 31 | false 32 | false 33 | false 34 | 35 | 36 | false 37 | true 38 | 39 | 40 | true 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | true 55 | preMaya2014;_WIN64;%(PreprocessorDefinitions) 56 | Use 57 | Use 58 | Use 59 | preMaya2014;%(PreprocessorDefinitions) 60 | 61 | 62 | 63 | 64 | 65 | 66 | Use 67 | preMaya2014;%(PreprocessorDefinitions) 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | Create 95 | Create 96 | Create 97 | Create 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2013/buildconfig: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | mayaVersion := 2013 10 | 11 | # If you have Maya installed in a non-standard location, uncomment the 12 | # following line and set the path to the 'Maya.app/Contents' directory of 13 | # your Maya installation: 14 | # MAYA_LOCATION = /my/path/to/Maya.app/Contents 15 | export MAYA_LOCATION 16 | 17 | # Make sure these are in your path. 18 | CC = gcc-4.2 19 | C++ = g++-4.2 20 | LD = g++-4.2 21 | 22 | # By default, we will try to build a universal binary to match the same 23 | # architectures as the installed Maya binary. If you only want one specific 24 | # architecture (e.g i386 or x86_64) then set it below. 25 | PREFERRED_ARCHITECTURE = 26 | 27 | 28 | #------------------------------------------------------------- 29 | # 30 | # Try to find Maya 31 | # 32 | #------------------------------------------------------------- 33 | ifeq ($(MAYA_LOCATION),) 34 | MAYA_LOCATION = /Applications/Autodesk/maya$(mayaVersion)/Maya.app/Contents 35 | DEVKIT = $(MAYA_LOCATION)/../../devkit 36 | DEVKIT_INCLUDE = $(DEVKIT)/include 37 | 38 | ifeq ($(wildcard $(DEVKIT_INCLUDE)/maya/MTypes.h),) 39 | $(error Cannot find Maya ${mayaVersion}. Please uncomment the \ 40 | MAYA_LOCATION setting near the top of 'buildconfig' and set \ 41 | it to point to the Maya.app/Contents directory of your \ 42 | Maya ${mayaVersion} installation) 43 | endif 44 | else 45 | ifneq ($(wildcard $(MAYA_LOCATION)/../../devkit/include/maya/MTypes.h),) 46 | DEVKIT = $(MAYA_LOCATION)/../../devkit 47 | DEVKIT_INCLUDE = $(DEVKIT)/include 48 | else ifneq ($(wildcard $(MAYA_LOCATION)/../../include/maya/MTypes.h),) 49 | # This is second location is necessary for developer's 50 | # build. On MacOS, the developer's runtime build has a 51 | # slightly different hierarchy than the one constructed by the 52 | # Maya Mac installer. 53 | DEVKIT = $(MAYA_LOCATION)/../../devkit 54 | DEVKIT_INCLUDE = $(MAYA_LOCATION)/../../include 55 | else 56 | $(error The MAYA_LOCATION environment variable does not point to the \ 57 | directory where Maya is installed) 58 | endif 59 | 60 | # Make sure that MAYA_LOCATION is pointing at the correct version of 61 | # Maya. 62 | apiVersion := $(shell grep 'define.*MAYA_API_VERSION' $(DEVKIT_INCLUDE)/maya/MTypes.h | sed 's/^[^0-9]*\([0-9]...\).*$$/\1/') 63 | 64 | ifneq ($(apiVersion),$(mayaVersion)) 65 | $(error The MAYA_LOCATION environment variable is pointing to \ 66 | version $(apiVersion) of Maya. Either change it to point to \ 67 | the directory where Maya $(mayaVersion) is installed or else \ 68 | uncomment the MAYA_LOCATION setting near the top of 'buildconfig' \ 69 | and change that to point to the location of Maya $(mayaVersion)) 70 | endif 71 | endif 72 | 73 | DEVKIT_ALEMBIC_INCDIR = $(DEVKIT)/Alembic/include 74 | DEVKIT_ALEMBIC_LIBDIR = $(DEVKIT)/Alembic/lib 75 | 76 | # Determine the architectures to build. 77 | ARCH_FLAGS = 78 | MAYABIN = ${MAYA_LOCATION}/bin/maya 79 | MAYA_ARCHES = $(shell lipo -info $(MAYABIN) | sed 's/^.*://') 80 | 81 | ifneq ($(PREFERRED_ARCHITECTURE),) 82 | ifneq ($(filter $(PREFERRED_ARCHITECTURE),$(MAYA_ARCHES)),) 83 | ARCH_FLAGS = -arch $(PREFERRED_ARCHITECTURE) 84 | else 85 | $(error $(MAYABIN) does not support the '$(PREFERRED_ARCHITECTURE)' architecture.) 86 | endif 87 | else 88 | ARCH_FLAGS = $(patsubst %,-arch %,$(MAYA_ARCHES)) 89 | endif 90 | 91 | # Settings 92 | CFLAGS = -DCC_GNU_ -DOSMac_ -DOSMacOSX_ -DREQUIRE_IOSTREAM\ 93 | -DOSMac_MachO_ -O3 $(ARCH_FLAGS) -D_LANGUAGE_C_PLUS_PLUS \ 94 | -include "$(DEVKIT_INCLUDE)/maya/OpenMayaMac.h" 95 | C++FLAGS = $(CFLAGS) $(WARNFLAGS) $(ERROR_FLAGS) -fno-gnu-keywords -fpascal-strings 96 | INCLUDES = -I$(SRCDIR) -I"$(DEVKIT_INCLUDE)" 97 | DYNLIB_LOCATION = $(MAYA_LOCATION)/MacOS 98 | 99 | LFLAGS = -fno-gnu-keywords -fpascal-strings \ 100 | -isysroot /Developer/SDKs/MacOSX10.6.sdk \ 101 | $(ARCH_FLAGS) -headerpad_max_install_names \ 102 | -framework System -framework SystemConfiguration \ 103 | -framework CoreServices -framework Carbon \ 104 | -framework Cocoa -framework ApplicationServices \ 105 | -framework IOKit \ 106 | -bundle 107 | 108 | # When compiling plug-ins for Maya, we make sure to export only the 109 | # symbols for the initializePlugin(MObject) and 110 | # uninitializePlugin(MObject) functions. In particular, this 111 | # prevents the plug-ins from exporting symbols coming from static 112 | # libaries against which the plug-ins is linked. 113 | # 114 | # Here's why: 115 | # 116 | # Plug-ins are written by separate developers. Each of them might 117 | # want to use various libraries to implement their plug-ins. At 118 | # times, it occurs that plug-ins written by different developers are 119 | # using different and "incompatible" versions of the same library. To 120 | # support this, we recommend that plug-ins be linked against static 121 | # versions of these libraries. And, by hidding the symbols of these 122 | # libraries, we prevent the two incompatible versions of the library 123 | # from interferring with each others. 124 | LFLAGS += -Wl,-exported_symbol,__Z16initializePlugin7MObject \ 125 | -Wl,-exported_symbol,__Z18uninitializePlugin7MObject 126 | 127 | 128 | LREMAP = -Wl,-executable_path,"$(DYNLIB_LOCATION)" 129 | LFLAGS += -L"$(DYNLIB_LOCATION)" $(LREMAP) 130 | LIBS = 131 | 132 | EXT = bundle 133 | 134 | # Makedepend flags 135 | # 136 | # Ignore dependencies on system header files. 137 | MDFLAGS = -Y 138 | 139 | # Find out if the Qt development tools are installed. 140 | QMAKE = $(shell which qmake 2> /dev/null) 141 | 142 | ifneq ($(QMAKE),) 143 | # We want to generate a Makefile, not an xcode project. 144 | QMAKE += -spec macx-g++ 145 | endif 146 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2014/buildconfig: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | mayaVersion := 2014 10 | 11 | # If you have Maya installed in a non-standard location, uncomment the 12 | # following line and set the path to the 'Maya.app/Contents' directory of 13 | # your Maya installation: 14 | # MAYA_LOCATION = /my/path/to/Maya.app/Contents 15 | export MAYA_LOCATION 16 | 17 | # Make sure these are in your path. 18 | CC = gcc-4.2 19 | C++ = g++-4.2 20 | LD = g++-4.2 21 | 22 | # By default, we will try to build a universal binary to match the same 23 | # architectures as the installed Maya binary. If you only want one specific 24 | # architecture (e.g i386 or x86_64) then set it below. 25 | PREFERRED_ARCHITECTURE = 26 | 27 | 28 | #------------------------------------------------------------- 29 | # 30 | # Try to find Maya 31 | # 32 | #------------------------------------------------------------- 33 | ifeq ($(MAYA_LOCATION),) 34 | MAYA_LOCATION = /Applications/Autodesk/maya$(mayaVersion)/Maya.app/Contents 35 | DEVKIT = $(MAYA_LOCATION)/../../devkit 36 | DEVKIT_INCLUDE = $(DEVKIT)/include 37 | 38 | ifeq ($(wildcard $(DEVKIT_INCLUDE)/maya/MTypes.h),) 39 | $(error Cannot find Maya ${mayaVersion}. Please uncomment the \ 40 | MAYA_LOCATION setting near the top of 'buildconfig' and set \ 41 | it to point to the Maya.app/Contents directory of your \ 42 | Maya ${mayaVersion} installation) 43 | endif 44 | else 45 | ifneq ($(wildcard $(MAYA_LOCATION)/../../devkit/include/maya/MTypes.h),) 46 | DEVKIT = $(MAYA_LOCATION)/../../devkit 47 | DEVKIT_INCLUDE = $(DEVKIT)/include 48 | else ifneq ($(wildcard $(MAYA_LOCATION)/../../include/maya/MTypes.h),) 49 | # This is second location is necessary for developer's 50 | # build. On MacOS, the developer's runtime build has a 51 | # slightly different hierarchy than the one constructed by the 52 | # Maya Mac installer. 53 | DEVKIT = $(MAYA_LOCATION)/../../devkit 54 | DEVKIT_INCLUDE = $(MAYA_LOCATION)/../../include 55 | else 56 | $(error The MAYA_LOCATION environment variable does not point to the \ 57 | directory where Maya is installed) 58 | endif 59 | 60 | # Make sure that MAYA_LOCATION is pointing at the correct version of 61 | # Maya. 62 | # 63 | # Matching subversions (e.g. 2014) is not possible without a lookup 64 | # table, so if this is a sub-version then just make sure that we've 65 | # got the right base version. Not perfect, but better than nothing. 66 | baseMayaVersion := $(shell echo $(mayaVersion) | sed 's/\..*//') 67 | 68 | apiVersion := $(shell grep 'define.*MAYA_API_VERSION' $(DEVKIT_INCLUDE)/maya/MTypes.h | sed 's/^[^0-9]*\([0-9]...\).*$$/\1/') 69 | 70 | ifneq ($(apiVersion),$(baseMayaVersion)) 71 | $(error The MAYA_LOCATION environment variable is pointing to \ 72 | version $(apiVersion) of Maya. Either change it to point to \ 73 | the directory where Maya $(mayaVersion) is installed or else \ 74 | uncomment the MAYA_LOCATION setting near the top of 'buildconfig' \ 75 | and change that to point to the location of Maya $(mayaVersion)) 76 | endif 77 | endif 78 | 79 | DEVKIT_ALEMBIC_INCDIR = $(DEVKIT)/Alembic/include 80 | DEVKIT_ALEMBIC_LIBDIR = $(DEVKIT)/Alembic/lib 81 | 82 | # Determine the architectures to build. 83 | ARCH_FLAGS = 84 | MAYABIN = ${MAYA_LOCATION}/bin/maya 85 | MAYA_ARCHES = $(shell lipo -info $(MAYABIN) | sed 's/^.*://') 86 | 87 | ifneq ($(PREFERRED_ARCHITECTURE),) 88 | ifneq ($(filter $(PREFERRED_ARCHITECTURE),$(MAYA_ARCHES)),) 89 | ARCH_FLAGS = -arch $(PREFERRED_ARCHITECTURE) 90 | else 91 | $(error $(MAYABIN) does not support the '$(PREFERRED_ARCHITECTURE)' architecture.) 92 | endif 93 | else 94 | ARCH_FLAGS = $(patsubst %,-arch %,$(MAYA_ARCHES)) 95 | endif 96 | 97 | # Settings 98 | CFLAGS = -DCC_GNU_ -DOSMac_ -DOSMacOSX_ -DREQUIRE_IOSTREAM\ 99 | -DOSMac_MachO_ -O3 $(ARCH_FLAGS) -D_LANGUAGE_C_PLUS_PLUS \ 100 | -include "$(DEVKIT_INCLUDE)/maya/OpenMayaMac.h" 101 | C++FLAGS = $(CFLAGS) $(WARNFLAGS) $(ERROR_FLAGS) -fno-gnu-keywords -fpascal-strings 102 | INCLUDES = -I$(SRCDIR) -I"$(DEVKIT_INCLUDE)" 103 | DYNLIB_LOCATION = $(MAYA_LOCATION)/MacOS 104 | 105 | LFLAGS = -fno-gnu-keywords -fpascal-strings \ 106 | -isysroot /Developer/SDKs/MacOSX10.6.sdk \ 107 | $(ARCH_FLAGS) -headerpad_max_install_names \ 108 | -framework System -framework SystemConfiguration \ 109 | -framework CoreServices -framework Carbon \ 110 | -framework Cocoa -framework ApplicationServices \ 111 | -framework IOKit \ 112 | -bundle 113 | 114 | # When compiling plug-ins for Maya, we make sure to export only the 115 | # symbols for the initializePlugin(MObject) and 116 | # uninitializePlugin(MObject) functions. In particular, this 117 | # prevents the plug-ins from exporting symbols coming from static 118 | # libaries against which the plug-ins is linked. 119 | # 120 | # Here's why: 121 | # 122 | # Plug-ins are written by separate developers. Each of them might 123 | # want to use various libraries to implement their plug-ins. At 124 | # times, it occurs that plug-ins written by different developers are 125 | # using different and "incompatible" versions of the same library. To 126 | # support this, we recommend that plug-ins be linked against static 127 | # versions of these libraries. And, by hidding the symbols of these 128 | # libraries, we prevent the two incompatible versions of the library 129 | # from interferring with each others. 130 | LFLAGS += -Wl,-exported_symbol,__Z16initializePlugin7MObject \ 131 | -Wl,-exported_symbol,__Z18uninitializePlugin7MObject 132 | 133 | 134 | LREMAP = -Wl,-executable_path,"$(DYNLIB_LOCATION)" 135 | LFLAGS += -L"$(DYNLIB_LOCATION)" $(LREMAP) 136 | LIBS = 137 | 138 | EXT = bundle 139 | 140 | # Makedepend flags 141 | # 142 | # Ignore dependencies on system header files. 143 | MDFLAGS = -Y 144 | 145 | # Find out if the Qt development tools are installed. 146 | QMAKE = $(shell which qmake 2> /dev/null) 147 | 148 | ifneq ($(QMAKE),) 149 | # We want to generate a Makefile, not an xcode project. 150 | QMAKE += -spec macx-g++ 151 | endif 152 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Mac2013.5/buildconfig: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | 9 | mayaVersion := 2013.5 10 | 11 | # If you have Maya installed in a non-standard location, uncomment the 12 | # following line and set the path to the 'Maya.app/Contents' directory of 13 | # your Maya installation: 14 | # MAYA_LOCATION = /my/path/to/Maya.app/Contents 15 | export MAYA_LOCATION 16 | 17 | # Make sure these are in your path. 18 | CC = gcc-4.2 19 | C++ = g++-4.2 20 | LD = g++-4.2 21 | 22 | # By default, we will try to build a universal binary to match the same 23 | # architectures as the installed Maya binary. If you only want one specific 24 | # architecture (e.g i386 or x86_64) then set it below. 25 | PREFERRED_ARCHITECTURE = 26 | 27 | 28 | #------------------------------------------------------------- 29 | # 30 | # Try to find Maya 31 | # 32 | #------------------------------------------------------------- 33 | ifeq ($(MAYA_LOCATION),) 34 | MAYA_LOCATION = /Applications/Autodesk/maya$(mayaVersion)/Maya.app/Contents 35 | DEVKIT = $(MAYA_LOCATION)/../../devkit 36 | DEVKIT_INCLUDE = $(DEVKIT)/include 37 | 38 | ifeq ($(wildcard $(DEVKIT_INCLUDE)/maya/MTypes.h),) 39 | $(error Cannot find Maya ${mayaVersion}. Please uncomment the \ 40 | MAYA_LOCATION setting near the top of 'buildconfig' and set \ 41 | it to point to the Maya.app/Contents directory of your \ 42 | Maya ${mayaVersion} installation) 43 | endif 44 | else 45 | ifneq ($(wildcard $(MAYA_LOCATION)/../../devkit/include/maya/MTypes.h),) 46 | DEVKIT = $(MAYA_LOCATION)/../../devkit 47 | DEVKIT_INCLUDE = $(DEVKIT)/include 48 | else ifneq ($(wildcard $(MAYA_LOCATION)/../../include/maya/MTypes.h),) 49 | # This is second location is necessary for developer's 50 | # build. On MacOS, the developer's runtime build has a 51 | # slightly different hierarchy than the one constructed by the 52 | # Maya Mac installer. 53 | DEVKIT = $(MAYA_LOCATION)/../../devkit 54 | DEVKIT_INCLUDE = $(MAYA_LOCATION)/../../include 55 | else 56 | $(error The MAYA_LOCATION environment variable does not point to the \ 57 | directory where Maya is installed) 58 | endif 59 | 60 | # Make sure that MAYA_LOCATION is pointing at the correct version of 61 | # Maya. 62 | # 63 | # Matching subversions (e.g. 2013.5) is not possible without a lookup 64 | # table, so if this is a sub-version then just make sure that we've 65 | # got the right base version. Not perfect, but better than nothing. 66 | baseMayaVersion := $(shell echo $(mayaVersion) | sed 's/\..*//') 67 | 68 | apiVersion := $(shell grep 'define.*MAYA_API_VERSION' $(DEVKIT_INCLUDE)/maya/MTypes.h | sed 's/^[^0-9]*\([0-9]...\).*$$/\1/') 69 | 70 | ifneq ($(apiVersion),$(baseMayaVersion)) 71 | $(error The MAYA_LOCATION environment variable is pointing to \ 72 | version $(apiVersion) of Maya. Either change it to point to \ 73 | the directory where Maya $(mayaVersion) is installed or else \ 74 | uncomment the MAYA_LOCATION setting near the top of 'buildconfig' \ 75 | and change that to point to the location of Maya $(mayaVersion)) 76 | endif 77 | endif 78 | 79 | DEVKIT_ALEMBIC_INCDIR = $(DEVKIT)/Alembic/include 80 | DEVKIT_ALEMBIC_LIBDIR = $(DEVKIT)/Alembic/lib 81 | 82 | # Determine the architectures to build. 83 | ARCH_FLAGS = 84 | MAYABIN = ${MAYA_LOCATION}/bin/maya 85 | MAYA_ARCHES = $(shell lipo -info $(MAYABIN) | sed 's/^.*://') 86 | 87 | ifneq ($(PREFERRED_ARCHITECTURE),) 88 | ifneq ($(filter $(PREFERRED_ARCHITECTURE),$(MAYA_ARCHES)),) 89 | ARCH_FLAGS = -arch $(PREFERRED_ARCHITECTURE) 90 | else 91 | $(error $(MAYABIN) does not support the '$(PREFERRED_ARCHITECTURE)' architecture.) 92 | endif 93 | else 94 | ARCH_FLAGS = $(patsubst %,-arch %,$(MAYA_ARCHES)) 95 | endif 96 | 97 | # Settings 98 | CFLAGS = -DCC_GNU_ -DOSMac_ -DOSMacOSX_ -DREQUIRE_IOSTREAM\ 99 | -DOSMac_MachO_ -O3 $(ARCH_FLAGS) -D_LANGUAGE_C_PLUS_PLUS \ 100 | -include "$(DEVKIT_INCLUDE)/maya/OpenMayaMac.h" 101 | C++FLAGS = $(CFLAGS) $(WARNFLAGS) $(ERROR_FLAGS) -fno-gnu-keywords -fpascal-strings 102 | INCLUDES = -I$(SRCDIR) -I"$(DEVKIT_INCLUDE)" 103 | DYNLIB_LOCATION = $(MAYA_LOCATION)/MacOS 104 | 105 | LFLAGS = -fno-gnu-keywords -fpascal-strings \ 106 | -isysroot /Developer/SDKs/MacOSX10.6.sdk \ 107 | $(ARCH_FLAGS) -headerpad_max_install_names \ 108 | -framework System -framework SystemConfiguration \ 109 | -framework CoreServices -framework Carbon \ 110 | -framework Cocoa -framework ApplicationServices \ 111 | -framework IOKit \ 112 | -bundle 113 | 114 | # When compiling plug-ins for Maya, we make sure to export only the 115 | # symbols for the initializePlugin(MObject) and 116 | # uninitializePlugin(MObject) functions. In particular, this 117 | # prevents the plug-ins from exporting symbols coming from static 118 | # libaries against which the plug-ins is linked. 119 | # 120 | # Here's why: 121 | # 122 | # Plug-ins are written by separate developers. Each of them might 123 | # want to use various libraries to implement their plug-ins. At 124 | # times, it occurs that plug-ins written by different developers are 125 | # using different and "incompatible" versions of the same library. To 126 | # support this, we recommend that plug-ins be linked against static 127 | # versions of these libraries. And, by hidding the symbols of these 128 | # libraries, we prevent the two incompatible versions of the library 129 | # from interferring with each others. 130 | LFLAGS += -Wl,-exported_symbol,__Z16initializePlugin7MObject \ 131 | -Wl,-exported_symbol,__Z18uninitializePlugin7MObject 132 | 133 | 134 | LREMAP = -Wl,-executable_path,"$(DYNLIB_LOCATION)" 135 | LFLAGS += -L"$(DYNLIB_LOCATION)" $(LREMAP) 136 | LIBS = 137 | 138 | EXT = bundle 139 | 140 | # Makedepend flags 141 | # 142 | # Ignore dependencies on system header files. 143 | MDFLAGS = -Y 144 | 145 | # Find out if the Qt development tools are installed. 146 | QMAKE = $(shell which qmake 2> /dev/null) 147 | 148 | ifneq ($(QMAKE),) 149 | # We want to generate a Makefile, not an xcode project. 150 | QMAKE += -spec macx-g++ 151 | endif 152 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2013/buildconfig: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | mayaVersion := 2013 9 | gccVersion := 4.1.2 10 | 11 | # If you have Maya installed in a non-standard location, uncomment the 12 | # following line and set the path to the directory of your Maya 13 | # installation: 14 | # MAYA_LOCATION = /usr/autodesk/maya2012-x64 15 | export MAYA_LOCATION 16 | 17 | 18 | #------------------------------------------------------------- 19 | # 20 | # Try to find Maya 21 | # 22 | #------------------------------------------------------------- 23 | ifeq ($(MAYA_LOCATION),) 24 | MAYA_LOCATION = /usr/autodesk/maya$(mayaVersion)-x64 25 | 26 | ifeq ($(wildcard $(MAYA_LOCATION)/include/maya/MTypes.h),) 27 | $(error Cannot find Maya ${mayaVersion}. Please uncomment the \ 28 | MAYA_LOCATION setting near the top of 'buildconfig' and set \ 29 | it to point to the directory where Maya ${mayaVersion} \ 30 | is installed) 31 | endif 32 | else ifeq ($(wildcard $(MAYA_LOCATION)/include/maya/MTypes.h),) 33 | $(error The MAYA_LOCATION environment variable does not point to the \ 34 | directory where Maya is installed) 35 | else 36 | # Make sure that MAYA_LOCATION is pointing at the correct version of 37 | # Maya. 38 | apiVersion := $(shell grep 'define.*MAYA_API_VERSION' $(MAYA_LOCATION)/include/maya/MTypes.h | sed 's/^[^0-9]*\([0-9]...\).*$$/\1/') 39 | 40 | ifneq ($(apiVersion),$(mayaVersion)) 41 | $(error The MAYA_LOCATION environment variable is pointing to \ 42 | version $(apiVersion) of Maya. Either change it to point to \ 43 | the directory where Maya $(mayaVersion) is installed or else \ 44 | uncomment the MAYA_LOCATION setting near the top of 'buildconfig' \ 45 | and change that to point to the location of Maya $(mayaVersion)) 46 | endif 47 | endif 48 | 49 | 50 | #------------------------------------------------------------- 51 | # 52 | # Try to find the correct version of gcc 53 | # 54 | #------------------------------------------------------------- 55 | 56 | # If 'CC' is undefined or is the wrong version of gcc then we need to 57 | # try to find the correct version. 58 | ifneq ($(and $(CC),$(shell $(CC) -dumpversion 2>/dev/null)),$(gccVersion)) 59 | compressedVersion := $(subst .,,$(gccVersion)) 60 | 61 | # Possible names for the compiler. 62 | gccNames := gcc \ 63 | gcc${gccVersion} \ 64 | gcc-${gccVersion} \ 65 | gcc${compressedVersion} \ 66 | gcc-${compressedVersion} 67 | 68 | # Possible directories the compiler might be in. 69 | gccDirs := /opt/gcc${gccVersion}/bin \ 70 | /opt/gcc-${gccVersion}/bin \ 71 | /opt/gcc${compressedVersion}/bin \ 72 | /opt/gcc-${compressedVersion}/bin \ 73 | /opt/gcc/${gccVersion}/bin \ 74 | /opt/gcc/${compressedVersion}/bin 75 | 76 | # Get all combinations of paths and names. 77 | gccPaths := $(foreach dir,$(gccDirs),$(foreach name,$(gccNames),$(dir)/$(name))) 78 | 79 | # Insert the names without any directory, in case they are in the user's 80 | # path. 81 | gccPaths := $(gccNames) $(gccPaths) 82 | 83 | # Try to get the version from each one until we find one which exists 84 | # and gives us the right version. 85 | CC := $(shell for p in $(gccPaths); do if [ "`$$p -dumpversion 2>/dev/null`" == "$(gccVersion)" ]; then echo $$p; exit 0; fi; done) 86 | 87 | ifeq ($(CC),) 88 | $(error Could not find version $(gccVersion) of the gcc compiler. \ 89 | Uncomment the CC and C++ settings near the top of Makefile and \ 90 | edit them to point to the correct locations for gcc and g++) 91 | endif 92 | endif 93 | 94 | # If 'C++' is undefined or is the wrong version of g++ then we need to 95 | # try to find the correct version. 96 | ifneq ($(and $(C++),$(shell $(C++) -dumpversion 2>/dev/null)),$(gccVersion)) 97 | # We assume that g++ is in the same dir as gcc and similarly named. 98 | dirPath := $(dir $(CC)) 99 | name := $(notdir $(CC)) 100 | 101 | ifeq ($(dirPath),./) 102 | dirPath := 103 | endif 104 | 105 | C++ := $(dirPath)$(subst gcc,g++,$(name)) 106 | endif 107 | 108 | 109 | #------------------------------------------------------------- 110 | # 111 | # Miscellaneous other settings. 112 | # 113 | #------------------------------------------------------------- 114 | 115 | CFLAGS = -DBits64_ -m64 -DUNIX -D_BOOL -DLINUX -DFUNCPROTO -D_GNU_SOURCE \ 116 | -DLINUX_64 -fPIC \ 117 | -fno-strict-aliasing -DREQUIRE_IOSTREAM -Wno-deprecated -O3 -Wall \ 118 | -Wno-multichar -Wno-comment -Wno-sign-compare -funsigned-char \ 119 | -Wno-reorder -fno-gnu-keywords -ftemplate-depth-25 -pthread 120 | 121 | C++FLAGS = $(CFLAGS) $(WARNFLAGS) -Wno-deprecated -fno-gnu-keywords 122 | 123 | DEVKIT = $(MAYA_LOCATION)/devkit 124 | DEVKIT_INCLUDE = $(MAYA_LOCATION)/include 125 | DEVKIT_ALEMBIC_INCDIR = $(DEVKIT)/Alembic/include 126 | DEVKIT_ALEMBIC_LIBDIR = $(DEVKIT)/Alembic/lib 127 | 128 | INCLUDES = -I$(SRCDIR) -I$(DEVKIT_INCLUDE) -I/usr/X11R6/include 129 | 130 | # -Bsymbolic binds references to global symbols within the library. 131 | # This avoids symbol clashes in other shared libraries but forces 132 | # the linking of all required libraries. 133 | LFLAGS = $(C++FLAGS) -Wl,-Bsymbolic -shared 134 | 135 | # When compiling plug-ins for Maya, we make sure to export only the 136 | # symbols for the initializePlugin(MObject) and 137 | # uninitializePlugin(MObject) functions. In particular, this 138 | # prevents the plug-ins from exporting symbols coming from static 139 | # libaries against which the plug-ins is linked. 140 | # 141 | # Here's why: 142 | # 143 | # Plug-ins are written by separate developers. Each of them might 144 | # want to use various libraries to implement their plug-ins. At 145 | # times, it occurs that plug-ins written by different developers are 146 | # using different and "incompatible" versions of the same library. To 147 | # support this, we recommend that plug-ins be linked against static 148 | # versions of these libraries. And, by hidding the symbols of these 149 | # libraries, we prevent the two incompatible versions of the library 150 | # from interferring with each others. 151 | LFLAGS += -Wl,--version-script=$(TOP)/linux_plugin.map 152 | 153 | LD = $(C++) 154 | LIBS = -L$(MAYA_LOCATION)/lib 155 | EXT = so 156 | 157 | # Makedepend flags 158 | # 159 | # Ignore dependencies on system header files. 160 | MDFLAGS = -Y 161 | 162 | # Find out if the Qt development tools are installed. 163 | QMAKE = $(shell which qmake 2> /dev/null) 164 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2014/buildconfig: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | mayaVersion := 2014 9 | gccVersion := 4.1.2 10 | 11 | # If you have Maya installed in a non-standard location, uncomment the 12 | # following line and set the path to the directory of your Maya 13 | # installation: 14 | # MAYA_LOCATION = /usr/autodesk/maya2014-x64 15 | export MAYA_LOCATION 16 | 17 | 18 | #------------------------------------------------------------- 19 | # 20 | # Try to find Maya 21 | # 22 | #------------------------------------------------------------- 23 | ifeq ($(MAYA_LOCATION),) 24 | MAYA_LOCATION = /usr/autodesk/maya$(mayaVersion)-x64 25 | 26 | ifeq ($(wildcard $(MAYA_LOCATION)/include/maya/MTypes.h),) 27 | $(error Cannot find Maya ${mayaVersion}. Please uncomment the \ 28 | MAYA_LOCATION setting near the top of 'buildconfig' and set \ 29 | it to point to the directory where Maya ${mayaVersion} \ 30 | is installed) 31 | endif 32 | else ifeq ($(wildcard $(MAYA_LOCATION)/include/maya/MTypes.h),) 33 | $(error The MAYA_LOCATION environment variable does not point to the \ 34 | directory where Maya is installed) 35 | else 36 | # Make sure that MAYA_LOCATION is pointing at the correct version of 37 | # Maya. 38 | # 39 | # Matching subversions (e.g. 2014) is not possible without a lookup 40 | # table, so if this is a sub-version then just make sure that we've 41 | # got the right base version. Not perfect, but better than nothing. 42 | baseMayaVersion := $(shell echo $(mayaVersion) | sed 's/\..*//') 43 | 44 | apiVersion := $(shell grep 'define.*MAYA_API_VERSION' $(MAYA_LOCATION)/include/maya/MTypes.h | sed 's/^[^0-9]*\([0-9]...\).*$$/\1/') 45 | 46 | ifneq ($(apiVersion),$(baseMayaVersion)) 47 | $(error The MAYA_LOCATION environment variable is pointing to \ 48 | version $(apiVersion) of Maya. Either change it to point to \ 49 | the directory where Maya $(mayaVersion) is installed or else \ 50 | uncomment the MAYA_LOCATION setting near the top of 'buildconfig' \ 51 | and change that to point to the location of Maya $(mayaVersion)) 52 | endif 53 | endif 54 | 55 | 56 | #------------------------------------------------------------- 57 | # 58 | # Try to find the correct version of gcc 59 | # 60 | #------------------------------------------------------------- 61 | 62 | # If 'CC' is undefined or is the wrong version of gcc then we need to 63 | # try to find the correct version. 64 | ifneq ($(and $(CC),$(shell $(CC) -dumpversion 2>/dev/null)),$(gccVersion)) 65 | compressedVersion := $(subst .,,$(gccVersion)) 66 | 67 | # Possible names for the compiler. 68 | gccNames := gcc \ 69 | gcc${gccVersion} \ 70 | gcc-${gccVersion} \ 71 | gcc${compressedVersion} \ 72 | gcc-${compressedVersion} 73 | 74 | # Possible directories the compiler might be in. 75 | gccDirs := /opt/gcc${gccVersion}/bin \ 76 | /opt/gcc-${gccVersion}/bin \ 77 | /opt/gcc${compressedVersion}/bin \ 78 | /opt/gcc-${compressedVersion}/bin \ 79 | /opt/gcc/${gccVersion}/bin \ 80 | /opt/gcc/${compressedVersion}/bin 81 | 82 | # Get all combinations of paths and names. 83 | gccPaths := $(foreach dir,$(gccDirs),$(foreach name,$(gccNames),$(dir)/$(name))) 84 | 85 | # Insert the names without any directory, in case they are in the user's 86 | # path. 87 | gccPaths := $(gccNames) $(gccPaths) 88 | 89 | # Try to get the version from each one until we find one which exists 90 | # and gives us the right version. 91 | CC := $(shell for p in $(gccPaths); do if [ "`$$p -dumpversion 2>/dev/null`" == "$(gccVersion)" ]; then echo $$p; exit 0; fi; done) 92 | 93 | ifeq ($(CC),) 94 | $(error Could not find version $(gccVersion) of the gcc compiler. \ 95 | Uncomment the CC and C++ settings near the top of Makefile and \ 96 | edit them to point to the correct locations for gcc and g++) 97 | endif 98 | endif 99 | 100 | # If 'C++' is undefined or is the wrong version of g++ then we need to 101 | # try to find the correct version. 102 | ifneq ($(and $(C++),$(shell $(C++) -dumpversion 2>/dev/null)),$(gccVersion)) 103 | # We assume that g++ is in the same dir as gcc and similarly named. 104 | dirPath := $(dir $(CC)) 105 | name := $(notdir $(CC)) 106 | 107 | ifeq ($(dirPath),./) 108 | dirPath := 109 | endif 110 | 111 | C++ := $(dirPath)$(subst gcc,g++,$(name)) 112 | endif 113 | 114 | 115 | #------------------------------------------------------------- 116 | # 117 | # Miscellaneous other settings. 118 | # 119 | #------------------------------------------------------------- 120 | 121 | CFLAGS = -DBits64_ -m64 -DUNIX -D_BOOL -DLINUX -DFUNCPROTO -D_GNU_SOURCE \ 122 | -DLINUX_64 -fPIC \ 123 | -fno-strict-aliasing -DREQUIRE_IOSTREAM -O3 -Wall \ 124 | -Wno-multichar -Wno-comment -Wno-sign-compare -funsigned-char \ 125 | -pthread 126 | 127 | C++FLAGS = $(CFLAGS) $(WARNFLAGS) -Wno-deprecated -Wno-reorder \ 128 | -ftemplate-depth-25 -fno-gnu-keywords 129 | 130 | DEVKIT = $(MAYA_LOCATION)/devkit 131 | DEVKIT_INCLUDE = $(MAYA_LOCATION)/include 132 | DEVKIT_ALEMBIC_INCDIR = $(DEVKIT)/Alembic/include 133 | DEVKIT_ALEMBIC_LIBDIR = $(DEVKIT)/Alembic/lib 134 | 135 | INCLUDES = -I$(SRCDIR) -I$(DEVKIT_INCLUDE) -I/usr/X11R6/include 136 | 137 | # -Bsymbolic binds references to global symbols within the library. 138 | # This avoids symbol clashes in other shared libraries but forces 139 | # the linking of all required libraries. 140 | LFLAGS = $(C++FLAGS) -Wl,-Bsymbolic -shared 141 | 142 | # When compiling plug-ins for Maya, we make sure to export only the 143 | # symbols for the initializePlugin(MObject) and 144 | # uninitializePlugin(MObject) functions. In particular, this 145 | # prevents the plug-ins from exporting symbols coming from static 146 | # libaries against which the plug-ins is linked. 147 | # 148 | # Here's why: 149 | # 150 | # Plug-ins are written by separate developers. Each of them might 151 | # want to use various libraries to implement their plug-ins. At 152 | # times, it occurs that plug-ins written by different developers are 153 | # using different and "incompatible" versions of the same library. To 154 | # support this, we recommend that plug-ins be linked against static 155 | # versions of these libraries. And, by hidding the symbols of these 156 | # libraries, we prevent the two incompatible versions of the library 157 | # from interferring with each others. 158 | LFLAGS += -Wl,--version-script=$(TOP)/linux_plugin.map 159 | 160 | LD = $(C++) 161 | LIBS = -L$(MAYA_LOCATION)/lib 162 | EXT = so 163 | 164 | # Makedepend flags 165 | # 166 | # Ignore dependencies on system header files. 167 | MDFLAGS = -Y 168 | 169 | # Find out if the Qt development tools are installed. 170 | QMAKE = $(shell which qmake 2> /dev/null) 171 | -------------------------------------------------------------------------------- /Sources/LocatorLib/Linux2013.5/buildconfig: -------------------------------------------------------------------------------- 1 | #- 2 | # Copyright 2012 Autodesk, Inc. All rights reserved. 3 | # 4 | # Use of this software is subject to the terms of the Autodesk license 5 | # agreement provided at the time of installation or download, or which 6 | # otherwise accompanies this software in either electronic or hard copy form. 7 | #+ 8 | mayaVersion := 2013.5 9 | gccVersion := 4.1.2 10 | 11 | # If you have Maya installed in a non-standard location, uncomment the 12 | # following line and set the path to the directory of your Maya 13 | # installation: 14 | # MAYA_LOCATION = /usr/autodesk/maya2013.5-x64 15 | export MAYA_LOCATION 16 | 17 | 18 | #------------------------------------------------------------- 19 | # 20 | # Try to find Maya 21 | # 22 | #------------------------------------------------------------- 23 | ifeq ($(MAYA_LOCATION),) 24 | MAYA_LOCATION = /usr/autodesk/maya$(mayaVersion)-x64 25 | 26 | ifeq ($(wildcard $(MAYA_LOCATION)/include/maya/MTypes.h),) 27 | $(error Cannot find Maya ${mayaVersion}. Please uncomment the \ 28 | MAYA_LOCATION setting near the top of 'buildconfig' and set \ 29 | it to point to the directory where Maya ${mayaVersion} \ 30 | is installed) 31 | endif 32 | else ifeq ($(wildcard $(MAYA_LOCATION)/include/maya/MTypes.h),) 33 | $(error The MAYA_LOCATION environment variable does not point to the \ 34 | directory where Maya is installed) 35 | else 36 | # Make sure that MAYA_LOCATION is pointing at the correct version of 37 | # Maya. 38 | # 39 | # Matching subversions (e.g. 2013.5) is not possible without a lookup 40 | # table, so if this is a sub-version then just make sure that we've 41 | # got the right base version. Not perfect, but better than nothing. 42 | baseMayaVersion := $(shell echo $(mayaVersion) | sed 's/\..*//') 43 | 44 | apiVersion := $(shell grep 'define.*MAYA_API_VERSION' $(MAYA_LOCATION)/include/maya/MTypes.h | sed 's/^[^0-9]*\([0-9]...\).*$$/\1/') 45 | 46 | ifneq ($(apiVersion),$(baseMayaVersion)) 47 | $(error The MAYA_LOCATION environment variable is pointing to \ 48 | version $(apiVersion) of Maya. Either change it to point to \ 49 | the directory where Maya $(mayaVersion) is installed or else \ 50 | uncomment the MAYA_LOCATION setting near the top of 'buildconfig' \ 51 | and change that to point to the location of Maya $(mayaVersion)) 52 | endif 53 | endif 54 | 55 | 56 | #------------------------------------------------------------- 57 | # 58 | # Try to find the correct version of gcc 59 | # 60 | #------------------------------------------------------------- 61 | 62 | # If 'CC' is undefined or is the wrong version of gcc then we need to 63 | # try to find the correct version. 64 | ifneq ($(and $(CC),$(shell $(CC) -dumpversion 2>/dev/null)),$(gccVersion)) 65 | compressedVersion := $(subst .,,$(gccVersion)) 66 | 67 | # Possible names for the compiler. 68 | gccNames := gcc \ 69 | gcc${gccVersion} \ 70 | gcc-${gccVersion} \ 71 | gcc${compressedVersion} \ 72 | gcc-${compressedVersion} 73 | 74 | # Possible directories the compiler might be in. 75 | gccDirs := /opt/gcc${gccVersion}/bin \ 76 | /opt/gcc-${gccVersion}/bin \ 77 | /opt/gcc${compressedVersion}/bin \ 78 | /opt/gcc-${compressedVersion}/bin \ 79 | /opt/gcc/${gccVersion}/bin \ 80 | /opt/gcc/${compressedVersion}/bin 81 | 82 | # Get all combinations of paths and names. 83 | gccPaths := $(foreach dir,$(gccDirs),$(foreach name,$(gccNames),$(dir)/$(name))) 84 | 85 | # Insert the names without any directory, in case they are in the user's 86 | # path. 87 | gccPaths := $(gccNames) $(gccPaths) 88 | 89 | # Try to get the version from each one until we find one which exists 90 | # and gives us the right version. 91 | CC := $(shell for p in $(gccPaths); do if [ "`$$p -dumpversion 2>/dev/null`" == "$(gccVersion)" ]; then echo $$p; exit 0; fi; done) 92 | 93 | ifeq ($(CC),) 94 | $(error Could not find version $(gccVersion) of the gcc compiler. \ 95 | Uncomment the CC and C++ settings near the top of Makefile and \ 96 | edit them to point to the correct locations for gcc and g++) 97 | endif 98 | endif 99 | 100 | # If 'C++' is undefined or is the wrong version of g++ then we need to 101 | # try to find the correct version. 102 | ifneq ($(and $(C++),$(shell $(C++) -dumpversion 2>/dev/null)),$(gccVersion)) 103 | # We assume that g++ is in the same dir as gcc and similarly named. 104 | dirPath := $(dir $(CC)) 105 | name := $(notdir $(CC)) 106 | 107 | ifeq ($(dirPath),./) 108 | dirPath := 109 | endif 110 | 111 | C++ := $(dirPath)$(subst gcc,g++,$(name)) 112 | endif 113 | 114 | 115 | #------------------------------------------------------------- 116 | # 117 | # Miscellaneous other settings. 118 | # 119 | #------------------------------------------------------------- 120 | 121 | CFLAGS = -DBits64_ -m64 -DUNIX -D_BOOL -DLINUX -DFUNCPROTO -D_GNU_SOURCE \ 122 | -DLINUX_64 -fPIC \ 123 | -fno-strict-aliasing -DREQUIRE_IOSTREAM -O3 -Wall \ 124 | -Wno-multichar -Wno-comment -Wno-sign-compare -funsigned-char \ 125 | -pthread 126 | 127 | C++FLAGS = $(CFLAGS) $(WARNFLAGS) -Wno-deprecated -Wno-reorder \ 128 | -ftemplate-depth-25 -fno-gnu-keywords 129 | 130 | DEVKIT = $(MAYA_LOCATION)/devkit 131 | DEVKIT_INCLUDE = $(MAYA_LOCATION)/include 132 | DEVKIT_ALEMBIC_INCDIR = $(DEVKIT)/Alembic/include 133 | DEVKIT_ALEMBIC_LIBDIR = $(DEVKIT)/Alembic/lib 134 | 135 | INCLUDES = -I$(SRCDIR) -I$(DEVKIT_INCLUDE) -I/usr/X11R6/include 136 | 137 | # -Bsymbolic binds references to global symbols within the library. 138 | # This avoids symbol clashes in other shared libraries but forces 139 | # the linking of all required libraries. 140 | LFLAGS = $(C++FLAGS) -Wl,-Bsymbolic -shared 141 | 142 | # When compiling plug-ins for Maya, we make sure to export only the 143 | # symbols for the initializePlugin(MObject) and 144 | # uninitializePlugin(MObject) functions. In particular, this 145 | # prevents the plug-ins from exporting symbols coming from static 146 | # libaries against which the plug-ins is linked. 147 | # 148 | # Here's why: 149 | # 150 | # Plug-ins are written by separate developers. Each of them might 151 | # want to use various libraries to implement their plug-ins. At 152 | # times, it occurs that plug-ins written by different developers are 153 | # using different and "incompatible" versions of the same library. To 154 | # support this, we recommend that plug-ins be linked against static 155 | # versions of these libraries. And, by hidding the symbols of these 156 | # libraries, we prevent the two incompatible versions of the library 157 | # from interferring with each others. 158 | LFLAGS += -Wl,--version-script=$(TOP)/linux_plugin.map 159 | 160 | LD = $(C++) 161 | LIBS = -L$(MAYA_LOCATION)/lib 162 | EXT = so 163 | 164 | # Makedepend flags 165 | # 166 | # Ignore dependencies on system header files. 167 | MDFLAGS = -Y 168 | 169 | # Find out if the Qt development tools are installed. 170 | QMAKE = $(shell which qmake 2> /dev/null) 171 | -------------------------------------------------------------------------------- /Sources/LocatorLib/customLocator.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Cyrille Fauvel 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #define MNoVersionString 15 | #define MNoPluginEntry 16 | #include 17 | #include "customLocator.h" 18 | 19 | //----------------------------------------------------------------------------- 20 | MTypeId customLocator::id (0x00118385) ; 21 | MString customLocator::drawDbClassification ("drawdb/geometry/customLocator") ; 22 | MString customLocator::drawRegistrantId ("customLocatorNode") ; 23 | MObject customLocator::size ; 24 | MObject customLocator::shapeFilename ; 25 | 26 | //----------------------------------------------------------------------------- 27 | MPointArray customLocator::vertices (MString &shapeName) { 28 | Shape &shape =shapeMgr.shapeData (shapeName.asChar ()) ; 29 | MPointArray vertices (shape.vertices) ; 30 | return (vertices) ; 31 | } 32 | 33 | void customLocator::myWireFrameDraw () { 34 | MPlug plug (thisMObject (), customLocator::size) ; 35 | float multiplier =plug.asFloat () ; 36 | MPlug plugShape (thisMObject (), customLocator::shapeFilename) ; 37 | MString shapeName =plugShape.asString () ; 38 | //MPointArray vertices =customLocator::vertices (shapeName.asChar ()) ; 39 | 40 | Shape &shape =shapeMgr.shapeData (shapeName.asChar ()) ; 41 | shape.renderWireFrame (multiplier) ; 42 | } 43 | 44 | void customLocator::myShadedDraw () { 45 | MPlug plug (thisMObject (), customLocator::size) ; 46 | float multiplier =plug.asFloat () ; 47 | MPlug plugShape (thisMObject (), customLocator::shapeFilename) ; 48 | MString shapeName =plugShape.asString () ; 49 | //MPointArray vertices =customLocator::vertices (shapeName.asChar ()) ; 50 | 51 | Shape &shape =shapeMgr.shapeData (shapeName.asChar ()) ; 52 | shape.renderShaded (multiplier) ; 53 | } 54 | 55 | MBoundingBox customLocator::boundingBox () const { 56 | MPlug plug (thisMObject (), customLocator::size) ; 57 | float multiplier =plug.asFloat () ; 58 | MPlug plugShape (thisMObject (), customLocator::shapeFilename) ; 59 | MString shapeName =plugShape.asString () ; 60 | 61 | Shape &shape =shapeMgr.shapeData (shapeName.asChar ()) ; 62 | return (shape.boundingbox (multiplier)) ; 63 | } 64 | 65 | MStatus customLocator::initialize () { 66 | locatorLibBase::initializeSize (customLocator::size) ; 67 | 68 | MStatus stat ; 69 | MFnTypedAttribute typedAttr ; 70 | MFnStringData exprSt ; 71 | customLocator::shapeFilename =typedAttr.create ("shapeName", "sn", MFnData::kString, exprSt.create (), &stat) ; 72 | typedAttr.setStorable (true) ; 73 | typedAttr.setKeyable (false) ; 74 | addAttribute (customLocator::shapeFilename) ; 75 | 76 | return (MS::kSuccess) ; 77 | } 78 | 79 | MStatus customLocator::registerMe (MFnPlugin &plugin) { 80 | plugin.registerNode ( 81 | "customLocator", 82 | customLocator::id, 83 | customLocator::creator, 84 | customLocator::initialize, 85 | MPxNode::kLocatorNode, 86 | &customLocator::drawDbClassification 87 | ) ; 88 | MHWRender::MDrawRegistry::registerDrawOverrideCreator ( 89 | customLocator::drawDbClassification, 90 | customLocator::drawRegistrantId, 91 | customLocatorDrawOverride::Creator 92 | ) ; 93 | return (MS::kSuccess) ; 94 | } 95 | 96 | MStatus customLocator::unregisterMe (MFnPlugin &plugin) { 97 | MHWRender::MDrawRegistry::deregisterDrawOverrideCreator ( 98 | customLocator::drawDbClassification, 99 | customLocator::drawRegistrantId 100 | ) ; 101 | return (plugin.deregisterNode (customLocator::id)) ; 102 | } 103 | 104 | //--------------------------------------------------------------------------- 105 | // Viewport 2.0 override implementation 106 | float customLocatorDrawOverride::getMultiplier (const MDagPath &objPath) const { 107 | // Retrieve value of the size attribute from the node 108 | return (locatorLibDrawOverrideBase::getMultiplier (objPath, customLocator::size)) ; 109 | } 110 | 111 | MString customLocatorDrawOverride::getShapeName (const MDagPath &objPath) const { 112 | // Retrieve value of the shapeFilename attribute from the node 113 | MStatus status ; 114 | MObject locatorNode =objPath.node (&status) ; 115 | if ( status ) { 116 | MPlug plug (locatorNode, customLocator::shapeFilename) ; 117 | if ( !plug.isNull () ) { 118 | MString nameVal ; 119 | if ( plug.getValue (nameVal) ) 120 | return (nameVal) ; 121 | } 122 | } 123 | return ("") ; 124 | } 125 | 126 | MBoundingBox customLocatorDrawOverride::boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const { 127 | float multiplier =getMultiplier (objPath) ; 128 | MString shapeName =getShapeName (objPath) ; 129 | Shape &shape =shapeMgr.shapeData (shapeName.asChar ()) ; 130 | return (shape.boundingbox (multiplier)) ; 131 | } 132 | 133 | #ifdef preMaya2014 134 | MUserData *customLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) { 135 | #else 136 | MUserData *customLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) { 137 | #endif 138 | // Retrieve data cache (create if does not exist) 139 | customLocatorData *data =dynamic_cast(oldData) ; 140 | if ( !data ) 141 | data =new customLocatorData () ; 142 | // compute data and cache it 143 | data->multiplier =getMultiplier (objPath) ; 144 | data->shapeName =getShapeName (objPath) ; 145 | return (data) ; 146 | } 147 | 148 | void customLocatorDrawOverride::draw (const MHWRender::MDrawContext &context, const MUserData *data) { 149 | // get cached data 150 | float color [3] ={ 0.0f, 1.0f, 0.0f } ; 151 | float multiplier =1.0f ; 152 | MString shapeName ; 153 | const customLocatorData *customData =dynamic_cast(data) ; 154 | if ( customData ) { 155 | multiplier =customData->multiplier ; 156 | shapeName =customData->shapeName ; 157 | } 158 | Shape &shape =shapeMgr.shapeData (shapeName.asChar ()) ; 159 | // get state data 160 | MStatus status ; 161 | const MMatrix transform =context.getMatrix (MHWRender::MDrawContext::kWorldViewMtx, &status) ; 162 | if ( status != MStatus::kSuccess ) 163 | return ; 164 | const MMatrix projection =context.getMatrix (MHWRender::MDrawContext::kProjectionMtx, &status) ; 165 | if ( status != MStatus::kSuccess ) 166 | return ; 167 | const int displayStyle =context.getDisplayStyle () ; 168 | // get renderer 169 | MHWRender::MRenderer *theRenderer =MHWRender::MRenderer::theRenderer () ; 170 | if ( !theRenderer ) 171 | return ; 172 | 173 | // GL Draw 174 | if ( theRenderer->drawAPIIsOpenGL () ) { 175 | // set colour 176 | glColor3fv (color) ; 177 | // set world matrix 178 | glMatrixMode (GL_MODELVIEW) ; 179 | glPushMatrix () ; 180 | glLoadMatrixd (transform.matrix [0]) ; 181 | // set projection matrix 182 | glMatrixMode (GL_PROJECTION) ; 183 | glPushMatrix () ; 184 | glLoadMatrixd (projection.matrix [0]) ; 185 | if ( displayStyle & MHWRender::MDrawContext::kGouraudShaded ) { 186 | // See myShadedDraw 187 | glPushAttrib (GL_CURRENT_BIT) ; 188 | shape.renderShaded (multiplier) ; 189 | glPopAttrib () ; 190 | } 191 | if ( displayStyle & MHWRender::MDrawContext::kWireFrame ) { 192 | // See myWireFrameDraw 193 | shape.renderWireFrame (multiplier) ; 194 | } 195 | glPopMatrix () ; 196 | glMatrixMode (GL_MODELVIEW) ; 197 | glPopMatrix () ; 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /Sources/LocatorLib/squareLocator.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #define MNoVersionString 15 | #define MNoPluginEntry 16 | #include 17 | #include "squareLocator.h" 18 | 19 | //----------------------------------------------------------------------------- 20 | MTypeId squareLocator::id (0x00118381) ; 21 | MString squareLocator::drawDbClassification ("drawdb/geometry/squareLocator") ; 22 | MString squareLocator::drawRegistrantId ("squareLocatorNode") ; 23 | MObject squareLocator::size ; 24 | 25 | //----------------------------------------------------------------------------- 26 | MPointArray &squareLocator::vertices () { 27 | static MPointArray vertices ; 28 | if ( vertices.length () != 0 ) 29 | return (vertices) ; 30 | // Square data 31 | static float square [] [3] ={ 32 | { -0.5f, 0.0f, 0.5f }, { 0.5f, 0.0f, 0.5f }, { 0.5f, 0.0f, -0.5f }, 33 | { -0.5f, 0.0f, -0.5f }, { -0.5f, 0.0f, 0.5f } 34 | } ; 35 | int len =sizeof (square) / sizeof (square [0]) ; 36 | for ( int i =0 ; i < len ; i++ ) 37 | vertices.append (square [i] [0], square [i] [1], square [i] [2]) ; 38 | return (vertices) ; 39 | } 40 | 41 | void squareLocator::myWireFrameDraw () { 42 | MPlug plug (thisMObject (), squareLocator::size) ; 43 | float multiplier =plug.asFloat () ; 44 | MPointArray vertices =squareLocator::vertices () ; 45 | 46 | glBegin (GL_LINES) ; 47 | for ( int i =0 ; i < vertices.length () - 1 ; i++ ) { 48 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 49 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 50 | } 51 | glEnd () ; 52 | } 53 | 54 | void squareLocator::myShadedDraw () { 55 | MPlug plug (thisMObject (), squareLocator::size) ; 56 | float multiplier =plug.asFloat () ; 57 | MPointArray vertices =squareLocator::vertices () ; 58 | 59 | glBegin (GL_POLYGON) ; 60 | for ( int i =0 ; i < vertices.length () ; i++ ) 61 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 62 | glEnd () ; 63 | } 64 | 65 | MBoundingBox squareLocator::boundingbox (float multiplier /*=1.0f*/) { 66 | static MBoundingBox boundingbox ; 67 | if ( boundingbox.min () == boundingbox.max () ) { 68 | MPointArray vert =squareLocator::vertices () ; 69 | for ( unsigned int i =0 ; i < vert.length () ; i++ ) 70 | boundingbox.expand (vert [i]) ; 71 | } 72 | MBoundingBox bbox (boundingbox) ; 73 | if ( multiplier != 1.0f ) { 74 | double factors [3] ={ multiplier, multiplier, multiplier } ; 75 | MTransformationMatrix mat ; 76 | mat.setScale (factors, MSpace::kWorld) ; 77 | bbox.transformUsing (mat.asScaleMatrix ()) ; 78 | } 79 | return (bbox) ; 80 | } 81 | 82 | MBoundingBox squareLocator::boundingBox () const { 83 | MPlug plug (thisMObject (), squareLocator::size) ; 84 | float multiplier =plug.asFloat () ; 85 | return (squareLocator::boundingbox (multiplier)) ; 86 | } 87 | 88 | MStatus squareLocator::initialize () { 89 | locatorLibBase::initializeSize (squareLocator::size) ; 90 | return (MS::kSuccess) ; 91 | } 92 | 93 | MStatus squareLocator::registerMe (MFnPlugin &plugin) { 94 | plugin.registerNode ( 95 | "squareLocator", 96 | squareLocator::id, 97 | squareLocator::creator, 98 | squareLocator::initialize, 99 | MPxNode::kLocatorNode, 100 | &squareLocator::drawDbClassification 101 | ) ; 102 | MHWRender::MDrawRegistry::registerDrawOverrideCreator ( 103 | squareLocator::drawDbClassification, 104 | squareLocator::drawRegistrantId, 105 | squareLocatorDrawOverride::Creator 106 | ) ; 107 | return (MS::kSuccess) ; 108 | } 109 | 110 | MStatus squareLocator::unregisterMe (MFnPlugin &plugin) { 111 | MHWRender::MDrawRegistry::deregisterDrawOverrideCreator ( 112 | squareLocator::drawDbClassification, 113 | squareLocator::drawRegistrantId 114 | ) ; 115 | return (plugin.deregisterNode (squareLocator::id)) ; 116 | } 117 | 118 | //--------------------------------------------------------------------------- 119 | // Viewport 2.0 override implementation 120 | float squareLocatorDrawOverride::getMultiplier (const MDagPath &objPath) const { 121 | // Retrieve value of the size attribute from the node 122 | return (locatorLibDrawOverrideBase::getMultiplier (objPath, squareLocator::size)) ; 123 | } 124 | 125 | MBoundingBox squareLocatorDrawOverride::boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const { 126 | float multiplier =getMultiplier (objPath) ; 127 | return (squareLocator::boundingbox (multiplier)) ; 128 | } 129 | 130 | #ifdef preMaya2014 131 | MUserData *squareLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) { 132 | #else 133 | MUserData *squareLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) { 134 | #endif 135 | // Retrieve data cache (create if does not exist) 136 | squareLocatorData *data =dynamic_cast(oldData) ; 137 | if ( !data ) 138 | data =new squareLocatorData () ; 139 | // compute data and cache it 140 | data->multiplier =getMultiplier (objPath) ; 141 | return (data) ; 142 | } 143 | 144 | void squareLocatorDrawOverride::draw (const MHWRender::MDrawContext &context, const MUserData *data) { 145 | MPointArray vertices =squareLocator::vertices () ; 146 | // get cached data 147 | float color [3] ={ 0.0f, 1.0f, 0.0f } ; 148 | float multiplier =1.0f ; 149 | const squareLocatorData *squareData =dynamic_cast(data) ; 150 | if ( squareData ) 151 | multiplier =squareData->multiplier ; 152 | // get state data 153 | MStatus status ; 154 | const MMatrix transform =context.getMatrix (MHWRender::MDrawContext::kWorldViewMtx, &status) ; 155 | if ( status != MStatus::kSuccess ) 156 | return ; 157 | const MMatrix projection =context.getMatrix (MHWRender::MDrawContext::kProjectionMtx, &status) ; 158 | if ( status != MStatus::kSuccess ) 159 | return ; 160 | const int displayStyle =context.getDisplayStyle () ; 161 | // get renderer 162 | MHWRender::MRenderer *theRenderer =MHWRender::MRenderer::theRenderer () ; 163 | if ( !theRenderer ) 164 | return ; 165 | 166 | // GL Draw 167 | if ( theRenderer->drawAPIIsOpenGL () ) { 168 | // set colour 169 | glColor3fv (color) ; 170 | // set world matrix 171 | glMatrixMode (GL_MODELVIEW) ; 172 | glPushMatrix () ; 173 | glLoadMatrixd (transform.matrix [0]) ; 174 | // set projection matrix 175 | glMatrixMode (GL_PROJECTION) ; 176 | glPushMatrix () ; 177 | glLoadMatrixd (projection.matrix [0]) ; 178 | if ( displayStyle & MHWRender::MDrawContext::kGouraudShaded ) { 179 | // See myShadedDraw 180 | glPushAttrib (GL_CURRENT_BIT) ; 181 | glBegin (GL_POLYGON) ; 182 | for ( int i =0 ; i < vertices.length () ; ++i ) 183 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 184 | glEnd () ; 185 | glPopAttrib () ; 186 | } 187 | if ( displayStyle & MHWRender::MDrawContext::kWireFrame ) { 188 | // See myWireFrameDraw 189 | glBegin (GL_LINES) ; 190 | for ( int i =0 ; i < vertices.length () - 1 ; ++i ) { 191 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 192 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 193 | } 194 | glEnd () ; 195 | } 196 | glPopMatrix () ; 197 | glMatrixMode (GL_MODELVIEW) ; 198 | glPopMatrix () ; 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /Sources/LocatorLib/sphereLocator.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #define MNoVersionString 15 | #define MNoPluginEntry 16 | #include 17 | #include "sphereLocator.h" 18 | 19 | //----------------------------------------------------------------------------- 20 | MTypeId sphereLocator::id (0x00118384) ; 21 | MString sphereLocator::drawDbClassification ("drawdb/geometry/sphereLocator") ; 22 | MString sphereLocator::drawRegistrantId ("sphereLocatorNode") ; 23 | MObject sphereLocator::size ; 24 | 25 | //----------------------------------------------------------------------------- 26 | MPointArray &sphereLocator::vertices () { 27 | static MPointArray vertices ; 28 | if ( vertices.length () != 0 ) 29 | return (vertices) ; 30 | // Construct the sphere 31 | double u =-M_PI_2 ; 32 | double v =-M_PI ; 33 | double u_delta =M_PI / 32.00 ; 34 | double v_delta =2 * M_PI / 32.00 ; 35 | vertices.append (MPoint (0.0, -0.5, 0.0)) ; 36 | for ( int i =0 ; i<31 ; i++ ) { 37 | u +=u_delta ; 38 | v =-M_PI ; 39 | for ( int j =0 ; j < 32 ; j++ ) { 40 | double x =0.5 * cos (u) * cos (v) ; 41 | double y =0.5 * sin (u) ; 42 | double z =0.5 * cos (u) * sin (v) ; 43 | MPoint pnt (x, y, z) ; 44 | vertices.append (pnt) ; 45 | v +=v_delta ; 46 | } 47 | } 48 | vertices.append (MPoint (0.0, 0.5, 0.0)) ; 49 | return (vertices) ; 50 | } 51 | 52 | void sphereLocator::myWireFrameDraw () { 53 | MPlug plug (thisMObject (), sphereLocator::size) ; 54 | float multiplier =plug.asFloat () ; 55 | MPointArray vertices =sphereLocator::vertices () ; 56 | 57 | glBegin (GL_LINE_STRIP) ; 58 | for ( int i =0 ; i < vertices.length () ; i++ ) 59 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 60 | glEnd () ; 61 | } 62 | 63 | void sphereLocator::myShadedDraw () { 64 | MPlug plug (thisMObject (), sphereLocator::size) ; 65 | float multiplier =plug.asFloat () ; 66 | MPointArray vertices =this->vertices () ; 67 | 68 | glBegin (GL_TRIANGLE_FAN) ; 69 | for ( int i =0 ; i < vertices.length () ; i++ ) 70 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 71 | glEnd () ; 72 | } 73 | 74 | MBoundingBox sphereLocator::boundingbox (float multiplier /*=1.0f*/) { 75 | static MBoundingBox boundingbox ; 76 | if ( boundingbox.min () == boundingbox.max () ) { 77 | MPointArray vert =sphereLocator::vertices () ; 78 | for ( unsigned int i =0 ; i < vert.length () ; i++ ) 79 | boundingbox.expand (vert [i]) ; 80 | } 81 | MBoundingBox bbox (boundingbox) ; 82 | if ( multiplier != 1.0f ) { 83 | double factors [3] ={ multiplier, multiplier, multiplier } ; 84 | MTransformationMatrix mat ; 85 | mat.setScale (factors, MSpace::kWorld) ; 86 | bbox.transformUsing (mat.asScaleMatrix ()) ; 87 | } 88 | return (bbox) ; 89 | } 90 | 91 | MBoundingBox sphereLocator::boundingBox () const { 92 | MPlug plug (thisMObject (), sphereLocator::size) ; 93 | float multiplier =plug.asFloat () ; 94 | return (sphereLocator::boundingbox (multiplier)) ; 95 | } 96 | 97 | MStatus sphereLocator::initialize () { 98 | locatorLibBase::initializeSize (sphereLocator::size) ; 99 | return (MS::kSuccess) ; 100 | } 101 | 102 | MStatus sphereLocator::registerMe (MFnPlugin &plugin) { 103 | plugin.registerNode ( 104 | "sphereLocator", 105 | sphereLocator::id, 106 | sphereLocator::creator, 107 | sphereLocator::initialize, 108 | MPxNode::kLocatorNode, 109 | &sphereLocator::drawDbClassification 110 | ) ; 111 | MHWRender::MDrawRegistry::registerDrawOverrideCreator ( 112 | sphereLocator::drawDbClassification, 113 | sphereLocator::drawRegistrantId, 114 | sphereLocatorDrawOverride::Creator 115 | ) ; 116 | return (MS::kSuccess) ; 117 | } 118 | 119 | MStatus sphereLocator::unregisterMe (MFnPlugin &plugin) { 120 | MHWRender::MDrawRegistry::deregisterDrawOverrideCreator ( 121 | sphereLocator::drawDbClassification, 122 | sphereLocator::drawRegistrantId 123 | ) ; 124 | return (plugin.deregisterNode (sphereLocator::id)) ; 125 | } 126 | 127 | //--------------------------------------------------------------------------- 128 | // Viewport 2.0 override implementation 129 | float sphereLocatorDrawOverride::getMultiplier (const MDagPath &objPath) const { 130 | // Retrieve value of the size attribute from the node 131 | return (locatorLibDrawOverrideBase::getMultiplier (objPath, sphereLocator::size)) ; 132 | } 133 | 134 | MBoundingBox sphereLocatorDrawOverride::boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const { 135 | float multiplier =getMultiplier (objPath) ; 136 | return (sphereLocator::boundingbox (multiplier)) ; 137 | } 138 | 139 | #ifdef preMaya2014 140 | MUserData *sphereLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) { 141 | #else 142 | MUserData *sphereLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) { 143 | #endif 144 | // Retrieve data cache (create if does not exist) 145 | sphereLocatorData *data =dynamic_cast(oldData) ; 146 | if ( !data ) 147 | data =new sphereLocatorData () ; 148 | // compute data and cache it 149 | data->multiplier =getMultiplier (objPath) ; 150 | return (data) ; 151 | } 152 | 153 | void sphereLocatorDrawOverride::draw (const MHWRender::MDrawContext &context, const MUserData *data) { 154 | // Construct the sphere shape 155 | MPointArray vertices =sphereLocator::vertices () ; 156 | // get cached data 157 | float color [3] ={ 0.0f, 1.0f, 0.0f } ; 158 | float multiplier =1.0f ; 159 | const sphereLocatorData *sphereData =dynamic_cast(data) ; 160 | if ( sphereData ) 161 | multiplier =sphereData->multiplier ; 162 | // get state data 163 | MStatus status ; 164 | const MMatrix transform =context.getMatrix (MHWRender::MDrawContext::kWorldViewMtx, &status) ; 165 | if ( status != MStatus::kSuccess ) 166 | return ; 167 | const MMatrix projection =context.getMatrix (MHWRender::MDrawContext::kProjectionMtx, &status) ; 168 | if ( status != MStatus::kSuccess ) 169 | return ; 170 | const int displayStyle =context.getDisplayStyle () ; 171 | // get renderer 172 | MHWRender::MRenderer *theRenderer =MHWRender::MRenderer::theRenderer () ; 173 | if ( !theRenderer ) 174 | return ; 175 | 176 | // GL Draw 177 | if ( theRenderer->drawAPIIsOpenGL () ) { 178 | // set colour 179 | glColor3fv (color) ; 180 | // set world matrix 181 | glMatrixMode (GL_MODELVIEW) ; 182 | glPushMatrix () ; 183 | glLoadMatrixd (transform.matrix [0]) ; 184 | // set projection matrix 185 | glMatrixMode (GL_PROJECTION) ; 186 | glPushMatrix () ; 187 | glLoadMatrixd (projection.matrix [0]) ; 188 | if ( displayStyle & MHWRender::MDrawContext::kGouraudShaded ) { 189 | // See myShadedDraw 190 | glPushAttrib (GL_CURRENT_BIT) ; 191 | glBegin (GL_TRIANGLE_FAN) ; 192 | for ( int i =0 ; i < vertices.length () ; ++i ) 193 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 194 | glEnd () ; 195 | glPopAttrib () ; 196 | } 197 | if ( displayStyle & MHWRender::MDrawContext::kWireFrame ) { 198 | // See myWireFrameDraw 199 | glBegin (GL_LINE_STRIP) ; 200 | for ( int i =0 ; i < vertices.length () ; ++i ) 201 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 202 | glEnd () ; 203 | } 204 | glPopMatrix () ; 205 | glMatrixMode (GL_MODELVIEW) ; 206 | glPopMatrix () ; 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /Sources/LocatorLib/ovalLocator.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #define MNoVersionString 15 | #define MNoPluginEntry 16 | #include 17 | #include "ovalLocator.h" 18 | 19 | //----------------------------------------------------------------------------- 20 | // Testing id for now 21 | MTypeId ovalLocator::id (0x00118382) ; 22 | MString ovalLocator::drawDbClassification ("drawdb/geometry/ovalLocator") ; 23 | MString ovalLocator::drawRegistrantId ("overLocatorNode") ; 24 | MObject ovalLocator::size ; 25 | 26 | //----------------------------------------------------------------------------- 27 | MPointArray &ovalLocator::vertices () { 28 | static MPointArray vertices ; 29 | if ( vertices.length () != 0 ) 30 | return (vertices) ; 31 | // Oval data 32 | static float oval [] [3] ={ 33 | { -2.00f, 0.0f, 0.0f }, { -1.90f, 0.0f, 0.309f }, { -1.618f, 0.0f, 0.588f }, { -1.176f, 0.0f, 0.809f }, 34 | { -0.618f, 0.0f, 0.951f }, { 0.0f, 0.0f, 1.00f }, { 0.618f, 0.0f, 0.951f}, { 1.176f, 0.0f, 0.809f}, 35 | { 1.618f, 0.0f, 0.588f}, { 1.90f, 0.0f, 0.309f}, { 2.00f, 0.0f, 0.0f}, { 1.90f, 0.0f, -0.309f}, 36 | { 1.618f, 0.0f, -0.588f}, { 1.176f, 0.0f, -0.809f}, { 0.618f, 0.0f, -0.951f}, { 0.0f, 0.0f, -1.00f }, 37 | { -0.618f, 0.0f, -0.951f}, { -1.176f, 0.0f, -0.809f}, { -1.618f, 0.0f, -0.588f}, { -1.90f, 0.0f, -0.309f}, 38 | { -2.00f, 0.0f, 0.0f } 39 | } ; 40 | int len =sizeof (oval) / sizeof (oval [0]) ; 41 | for ( int i =0 ; i < len ; i++ ) 42 | vertices.append (oval [i] [0], oval [i] [1], oval [i] [2]) ; 43 | return (vertices) ; 44 | } 45 | 46 | void ovalLocator::myWireFrameDraw () { 47 | MPlug plug (thisMObject (), ovalLocator::size) ; 48 | float multiplier =plug.asFloat () ; 49 | MPointArray vertices =ovalLocator::vertices () ; 50 | 51 | glBegin (GL_LINES) ; 52 | for ( int i =0 ; i < vertices.length () - 1 ; i++ ) { 53 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 54 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 55 | } 56 | glEnd () ; 57 | } 58 | 59 | void ovalLocator::myShadedDraw () { 60 | MPlug plug (thisMObject (), ovalLocator::size) ; 61 | float multiplier =plug.asFloat () ; 62 | MPointArray vertices =ovalLocator::vertices () ; 63 | 64 | glBegin (GL_TRIANGLE_FAN) ; 65 | glVertex3f (0, 0, 0) ; 66 | for ( int i =0 ; i < vertices.length () ; i++ ) 67 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 68 | glEnd () ; 69 | } 70 | 71 | MBoundingBox ovalLocator::boundingbox (float multiplier /*=1.0f*/) { 72 | static MBoundingBox boundingbox ; 73 | if ( boundingbox.min () == boundingbox.max () ) { 74 | MPointArray vert =ovalLocator::vertices () ; 75 | for ( unsigned int i =0 ; i < vert.length () ; i++ ) 76 | boundingbox.expand (vert [i]) ; 77 | } 78 | MBoundingBox bbox (boundingbox) ; 79 | if ( multiplier != 1.0f ) { 80 | double factors [3] ={ multiplier, multiplier, multiplier } ; 81 | MTransformationMatrix mat ; 82 | mat.setScale (factors, MSpace::kWorld) ; 83 | bbox.transformUsing (mat.asScaleMatrix ()) ; 84 | } 85 | return (bbox) ; 86 | } 87 | 88 | MBoundingBox ovalLocator::boundingBox () const { 89 | MPlug plug (thisMObject (), ovalLocator::size) ; 90 | float multiplier =plug.asFloat () ; 91 | return (ovalLocator::boundingbox (multiplier)) ; 92 | } 93 | 94 | MStatus ovalLocator::initialize () { 95 | locatorLibBase::initializeSize (ovalLocator::size) ; 96 | return (MS::kSuccess) ; 97 | } 98 | 99 | MStatus ovalLocator::registerMe (MFnPlugin &plugin) { 100 | plugin.registerNode ( 101 | "ovalLocator", 102 | ovalLocator::id, 103 | ovalLocator::creator, 104 | ovalLocator::initialize, 105 | MPxNode::kLocatorNode, 106 | &ovalLocator::drawDbClassification 107 | ) ; 108 | MHWRender::MDrawRegistry::registerDrawOverrideCreator ( 109 | ovalLocator::drawDbClassification, 110 | ovalLocator::drawRegistrantId, 111 | ovalLocatorDrawOverride::Creator 112 | ) ; 113 | return (MS::kSuccess) ; 114 | } 115 | 116 | MStatus ovalLocator::unregisterMe (MFnPlugin &plugin) { 117 | MHWRender::MDrawRegistry::deregisterDrawOverrideCreator ( 118 | ovalLocator::drawDbClassification, 119 | ovalLocator::drawRegistrantId 120 | ) ; 121 | return (plugin.deregisterNode (ovalLocator::id)) ; 122 | } 123 | 124 | //--------------------------------------------------------------------------- 125 | // Viewport 2.0 override implementation 126 | float ovalLocatorDrawOverride::getMultiplier (const MDagPath &objPath) const { 127 | // Retrieve value of the size attribute from the node 128 | return (locatorLibDrawOverrideBase::getMultiplier (objPath, ovalLocator::size)) ; 129 | } 130 | 131 | MBoundingBox ovalLocatorDrawOverride::boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const { 132 | float multiplier =getMultiplier (objPath) ; 133 | return (ovalLocator::boundingbox (multiplier)) ; 134 | } 135 | 136 | #ifdef preMaya2014 137 | MUserData *ovalLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) { 138 | #else 139 | MUserData *ovalLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) { 140 | #endif 141 | // Retrieve data cache (create if does not exist) 142 | ovalLocatorData *data =dynamic_cast(oldData) ; 143 | if ( !data ) 144 | data =new ovalLocatorData () ; 145 | // compute data and cache it 146 | data->multiplier =getMultiplier (objPath) ; 147 | return (data) ; 148 | } 149 | 150 | void ovalLocatorDrawOverride::draw (const MHWRender::MDrawContext &context, const MUserData *data) { 151 | MPointArray vertices =ovalLocator::vertices () ; 152 | // get cached data 153 | float color [3] ={ 0.0f, 1.0f, 0.0f } ; 154 | float multiplier =1.0f ; 155 | const ovalLocatorData *ovalData =dynamic_cast(data) ; 156 | if ( ovalData ) 157 | multiplier =ovalData->multiplier ; 158 | // get state data 159 | MStatus status ; 160 | const MMatrix transform =context.getMatrix (MHWRender::MDrawContext::kWorldViewMtx, &status) ; 161 | if ( status !=MStatus::kSuccess ) 162 | return ; 163 | const MMatrix projection =context.getMatrix (MHWRender::MDrawContext::kProjectionMtx, &status) ; 164 | if ( status !=MStatus::kSuccess ) 165 | return ; 166 | const int displayStyle =context.getDisplayStyle () ; 167 | // get renderer 168 | MHWRender::MRenderer *theRenderer =MHWRender::MRenderer::theRenderer () ; 169 | if ( !theRenderer ) 170 | return ; 171 | 172 | // GL Draw 173 | if ( theRenderer->drawAPIIsOpenGL () ) { 174 | // set colour 175 | glColor3fv (color) ; 176 | // set world matrix 177 | glMatrixMode (GL_MODELVIEW) ; 178 | glPushMatrix () ; 179 | glLoadMatrixd (transform.matrix [0]) ; 180 | // set projection matrix 181 | glMatrixMode (GL_PROJECTION) ; 182 | glPushMatrix () ; 183 | glLoadMatrixd (projection.matrix [0]) ; 184 | if ( displayStyle & MHWRender::MDrawContext::kGouraudShaded ) { 185 | // See myShadedDraw 186 | glPushAttrib (GL_CURRENT_BIT) ; 187 | glBegin (GL_TRIANGLE_FAN) ; 188 | glVertex3f (0, 0, 0) ; 189 | for ( int i =0 ; i < vertices.length () ; ++i ) 190 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 191 | glEnd () ; 192 | glPopAttrib () ; 193 | } 194 | if ( displayStyle & MHWRender::MDrawContext::kWireFrame ) { 195 | // See myWireFrameDraw 196 | glBegin (GL_LINES) ; 197 | for ( int i =0 ; i < vertices.length () - 1 ; ++i ) { 198 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 199 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 200 | } 201 | glEnd () ; 202 | } 203 | glPopMatrix () ; 204 | glMatrixMode (GL_MODELVIEW) ; 205 | glPopMatrix () ; 206 | } 207 | } 208 | -------------------------------------------------------------------------------- /Sources/LocatorLib/cubeLocator.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012 Autodesk, Inc. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms of the Autodesk license 5 | // agreement provided at the time of installation or download, or which 6 | // otherwise accompanies this software in either electronic or hard copy form. 7 | // 8 | 9 | // Release History 10 | // Written by Naiqi Weng 11 | // 1.0 Original release (October 1, 2012) 12 | 13 | #include "StdAfx.h" 14 | #define MNoVersionString 15 | #define MNoPluginEntry 16 | #include 17 | #include "cubeLocator.h" 18 | 19 | //----------------------------------------------------------------------------- 20 | MTypeId cubeLocator::id (0x00118383) ; 21 | MString cubeLocator::drawDbClassification ("drawdb/geometry/cubeLocator") ; 22 | MString cubeLocator::drawRegistrantId ("cubeLocatorNode") ; 23 | MObject cubeLocator::size ; 24 | 25 | //----------------------------------------------------------------------------- 26 | MPointArray &cubeLocator::vertices () { 27 | static MPointArray vertices ; 28 | if ( vertices.length () != 0 ) 29 | return (vertices) ; 30 | // Cube data 31 | static float cube [] [3] ={ 32 | { -0.5f, -0.5f, -0.5f }, { 0.5f, -0.5f, -0.5f }, { 0.5f, 0.5f, -0.5f }, { -0.5f, 0.5f, -0.5f }, 33 | { -0.5f, 0.5f, -0.5f }, { -0.5f, 0.5f, 0.5f }, { -0.5f, -0.5f, 0.5f }, { -0.5f, -0.5f, -0.5f }, 34 | { -0.5f, 0.5f, 0.5f }, { -0.5f, -0.5f, 0.5f }, { 0.5f, -0.5f, 0.5f }, { 0.5f, 0.5f, 0.5f }, 35 | { 0.5f, 0.5f, 0.5f }, { 0.5f, -0.5f, 0.5f }, { 0.5f, -0.5f, -0.5f }, { 0.5f, 0.5f, -0.5f }, 36 | { 0.5f, -0.5f, 0.5f }, { 0.5f, -0.5f, -0.5f }, { -0.5f, -0.5f, -0.5f }, { -0.5f, -0.5f, 0.5f }, 37 | { -0.5f, 0.5f, -0.5f }, { -0.5f, 0.5f, 0.5f }, { 0.5f, 0.5f, 0.5f }, { 0.5f, 0.5f, -0.5f } 38 | } ; 39 | int len =sizeof (cube) / sizeof (cube [0]) ; 40 | for ( int i =0 ; i < len ; i++ ) 41 | vertices.append (cube [i] [0], cube [i] [1], cube [i] [2]) ; 42 | return (vertices) ; 43 | } 44 | 45 | void cubeLocator::myWireFrameDraw () { 46 | MPlug plug (thisMObject (), cubeLocator::size) ; 47 | float multiplier =plug.asFloat () ; 48 | MPointArray vertices =cubeLocator::vertices () ; 49 | 50 | for ( int i =0 ; i < vertices.length () - 3 ; i +=4 ) { 51 | glBegin (GL_LINE_LOOP) ; 52 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 53 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 54 | glVertex3f (vertices [i + 2].x * multiplier, vertices [i + 2].y * multiplier, vertices [i + 2].z * multiplier) ; 55 | glVertex3f (vertices [i + 3].x * multiplier, vertices [i + 3].y * multiplier, vertices [i + 3].z * multiplier) ; 56 | glEnd () ; 57 | } 58 | } 59 | 60 | void cubeLocator::myShadedDraw () { 61 | MPlug plug (thisMObject (), cubeLocator::size) ; 62 | float multiplier =plug.asFloat () ; 63 | MPointArray vertices =cubeLocator::vertices () ; 64 | 65 | glBegin (GL_QUADS) ; 66 | for ( int i =0 ; i < vertices.length () - 3 ; i +=4 ) { 67 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 68 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 69 | glVertex3f (vertices [i + 2].x * multiplier, vertices [i + 2].y * multiplier, vertices [i + 2].z * multiplier) ; 70 | glVertex3f (vertices [i + 3].x * multiplier, vertices [i + 3].y * multiplier, vertices [i + 3].z * multiplier) ; 71 | } 72 | glEnd () ; 73 | } 74 | 75 | MBoundingBox cubeLocator::boundingbox (float multiplier /*=1.0f*/) { 76 | static MBoundingBox boundingbox ; 77 | if ( boundingbox.min () == boundingbox.max () ) { 78 | MPointArray vert =cubeLocator::vertices () ; 79 | for ( unsigned int i =0 ; i < vert.length () ; i++ ) 80 | boundingbox.expand (vert [i]) ; 81 | } 82 | MBoundingBox bbox (boundingbox) ; 83 | if ( multiplier != 1.0f ) { 84 | double factors [3] ={ multiplier, multiplier, multiplier } ; 85 | MTransformationMatrix mat ; 86 | mat.setScale (factors, MSpace::kWorld) ; 87 | bbox.transformUsing (mat.asScaleMatrix ()) ; 88 | } 89 | return (bbox) ; 90 | } 91 | 92 | MBoundingBox cubeLocator::boundingBox () const { 93 | MPlug plug (thisMObject (), cubeLocator::size) ; 94 | float multiplier =plug.asFloat () ; 95 | return (cubeLocator::boundingbox (multiplier)) ; 96 | } 97 | 98 | MStatus cubeLocator::initialize () { 99 | locatorLibBase::initializeSize (cubeLocator::size) ; 100 | return (MS::kSuccess) ; 101 | } 102 | 103 | MStatus cubeLocator::registerMe (MFnPlugin &plugin) { 104 | plugin.registerNode ( 105 | "cubeLocator", 106 | cubeLocator::id, 107 | cubeLocator::creator, 108 | cubeLocator::initialize, 109 | MPxNode::kLocatorNode, 110 | &cubeLocator::drawDbClassification 111 | ) ; 112 | MHWRender::MDrawRegistry::registerDrawOverrideCreator ( 113 | cubeLocator::drawDbClassification, 114 | cubeLocator::drawRegistrantId, 115 | cubeLocatorDrawOverride::Creator 116 | ) ; 117 | return (MS::kSuccess) ; 118 | } 119 | 120 | MStatus cubeLocator::unregisterMe (MFnPlugin &plugin) { 121 | MHWRender::MDrawRegistry::deregisterDrawOverrideCreator ( 122 | cubeLocator::drawDbClassification, 123 | cubeLocator::drawRegistrantId 124 | ) ; 125 | return (plugin.deregisterNode (cubeLocator::id)) ; 126 | } 127 | 128 | //--------------------------------------------------------------------------- 129 | // Viewport 2.0 override implementation 130 | float cubeLocatorDrawOverride::getMultiplier (const MDagPath &objPath) const { 131 | // Retrieve value of the size attribute from the node 132 | return (locatorLibDrawOverrideBase::getMultiplier (objPath, cubeLocator::size)) ; 133 | } 134 | 135 | MBoundingBox cubeLocatorDrawOverride::boundingBox (const MDagPath &objPath, const MDagPath &cameraPath) const { 136 | float multiplier =getMultiplier (objPath) ; 137 | return (cubeLocator::boundingbox (multiplier)) ; 138 | } 139 | 140 | #ifdef preMaya2014 141 | MUserData *cubeLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, MUserData *oldData) { 142 | #else 143 | MUserData *cubeLocatorDrawOverride::prepareForDraw (const MDagPath &objPath, const MDagPath &cameraPath, const MHWRender::MFrameContext &frameContext, MUserData *oldData) { 144 | #endif 145 | // Retrieve data cache (create if does not exist) 146 | cubeLocatorData *data =dynamic_cast(oldData) ; 147 | if ( !data ) 148 | data =new cubeLocatorData () ; 149 | // compute data and cache it 150 | data->multiplier =getMultiplier (objPath) ; 151 | return (data) ; 152 | } 153 | 154 | void cubeLocatorDrawOverride::draw (const MHWRender::MDrawContext &context, const MUserData *data) { 155 | MPointArray vertices =cubeLocator::vertices () ; 156 | // get cached data 157 | float color [3] ={ 0.0f, 1.0f, 0.0f } ; 158 | float multiplier =1.0f ; 159 | const cubeLocatorData *cubeData =dynamic_cast(data) ; 160 | if ( cubeData ) 161 | multiplier =cubeData->multiplier ; 162 | // get state data 163 | MStatus status ; 164 | const MMatrix transform =context.getMatrix (MHWRender::MDrawContext::kWorldViewMtx, &status) ; 165 | if ( status != MStatus::kSuccess ) 166 | return ; 167 | const MMatrix projection =context.getMatrix (MHWRender::MDrawContext::kProjectionMtx, &status) ; 168 | if ( status != MStatus::kSuccess ) 169 | return ; 170 | const int displayStyle =context.getDisplayStyle () ; 171 | // get renderer 172 | MHWRender::MRenderer *theRenderer =MHWRender::MRenderer::theRenderer () ; 173 | if ( !theRenderer ) 174 | return ; 175 | 176 | // GL Draw 177 | if ( theRenderer->drawAPIIsOpenGL () ) { 178 | // set colour 179 | glColor3fv (color) ; 180 | // set world matrix 181 | glMatrixMode (GL_MODELVIEW) ; 182 | glPushMatrix () ; 183 | glLoadMatrixd (transform.matrix [0]) ; 184 | // set projection matrix 185 | glMatrixMode (GL_PROJECTION) ; 186 | glPushMatrix () ; 187 | glLoadMatrixd (projection.matrix [0]) ; 188 | if ( displayStyle & MHWRender::MDrawContext::kGouraudShaded ) { 189 | // See myShadedDraw 190 | glPushAttrib (GL_CURRENT_BIT) ; 191 | glBegin (GL_QUADS) ; 192 | for ( int i =0 ; i < vertices.length () - 3 ; i +=4 ) { 193 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 194 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 195 | glVertex3f (vertices [i + 2].x * multiplier, vertices [i + 2].y * multiplier, vertices [i + 2].z * multiplier) ; 196 | glVertex3f (vertices [i + 3].x * multiplier, vertices [i + 3].y * multiplier, vertices [i + 3].z * multiplier) ; 197 | } 198 | glEnd () ; 199 | glPopAttrib () ; 200 | } 201 | if ( displayStyle & MHWRender::MDrawContext::kWireFrame ) { 202 | // See myWireFrameDraw 203 | for ( int i =0 ; i < vertices.length () - 3 ; i +=4 ) { 204 | glBegin (GL_LINE_LOOP) ; 205 | glVertex3f (vertices [i].x * multiplier, vertices [i].y * multiplier, vertices [i].z * multiplier) ; 206 | glVertex3f (vertices [i + 1].x * multiplier, vertices [i + 1].y * multiplier, vertices [i + 1].z * multiplier) ; 207 | glVertex3f (vertices [i + 2].x * multiplier, vertices [i + 2].y * multiplier, vertices [i + 2].z * multiplier) ; 208 | glVertex3f (vertices [i + 3].x * multiplier, vertices [i + 3].y * multiplier, vertices [i + 3].z * multiplier) ; 209 | glEnd () ; 210 | } 211 | } 212 | glPopMatrix () ; 213 | glMatrixMode (GL_MODELVIEW) ; 214 | glPopMatrix () ; 215 | } 216 | } 217 | --------------------------------------------------------------------------------