00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _IMAYA_HELPER_H_
00017 #define _IMAYA_HELPER_H_
00018
00019
00020 #include <maya/MPoint.h>
00021 #include <maya/MDagPath.h>
00022 #include <maya/MGlobal.h>
00023 #include <maya/MItSelectionList.h>
00024
00025
00026
00028 namespace Util {
00029
00030
00033
00035 inline void
00036 getPointLightPosition( MPoint &Translation ) {
00037
00038
00039 MStatus status( MS::kFailure );
00040
00041
00042 MSelectionList selectionList;
00043 MString allLights("*");
00044
00045
00046 MStatus stat;
00047 MSelectionMask select_mask_prev( MGlobal::objectSelectionMask( &stat));
00048 CONDITION( MS::kSuccess == stat);
00049
00050
00051 MSelectionMask select_mask( MSelectionMask::kSelectLights );
00052 MGlobal::setObjectSelectionMask( select_mask);
00053 MGlobal::getSelectionListByName( allLights, selectionList );
00054
00055
00056
00057 MDagPath pLTransformDagPath;
00058
00059
00060
00061 MItSelectionList iterator( selectionList );
00062 iterator.setFilter( MFn::kPointLight );
00063
00064 for( iterator.reset(); !iterator.isDone(); iterator.next() ) {
00065
00066 iterator.getDagPath( pLTransformDagPath );
00067
00068
00069
00070 pLTransformDagPath.pop();
00071
00072 MFnTransform theTransform( pLTransformDagPath );
00073 Translation = MPoint( MVector(theTransform.getTranslation( MSpace::kTransform , &status )) );
00074
00075
00076
00077 break;
00078 }
00079
00080
00081 MGlobal::setObjectSelectionMask( select_mask_prev);
00082
00083 }
00084
00085 }
00086
00087
00088
00089
00090
00091
00092
00093 #endif // #ifndef _PROTO_H_
00094