Free Electron
MayaContext.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __maya_MayaContext_h__
8 #define __maya_MayaContext_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief shared FE context for Maya plugins
17 
18  Note that this MayaContext is the Maya form of the FE OperatorContext
19  singleton and is not related to the Maya MPxContext tool object.
20 
21  @ingroup maya
22 *//***************************************************************************/
24 {
25  public:
26  MayaContext(void)
27  {
28  m_libEnvVar="FE_MAYA_LIBS";
29 #ifdef FE_MAYA_LIBS
30  m_libDefault=FE_STRING(FE_MAYA_LIBS);
31 #else
32  m_libDefault="fexMayaDL";
33 #endif
34  }
35 
36 virtual ~MayaContext(void) {}
37 
38 virtual void libraryLoaded(String a_libraryName);
39 };
40 
41 inline void MayaContext::libraryLoaded(String a_libraryName)
42 {
43  const String checkCommand="exists "+a_libraryName+"";
44 
45  MCommandResult melCommandResult;
46  MGlobal::executeCommand(checkCommand.c_str(),melCommandResult);
47 
48  int melFound=0;
49  melCommandResult.getResult(melFound);
50 
51  if(melFound)
52  {
53  const String initCommand=a_libraryName+"()";
54 
55  MString melResult;
56  MGlobal::executeCommand(initCommand.c_str(),melResult);
57  }
58 }
59 
60 } /* namespace ext */
61 } /* namespace fe */
62 
63 #endif /* __maya_MayaContext_h__ */
shared FE context for Maya plugins
Definition: MayaContext.h:23
const FESTRING_I8 * c_str(void) const
Return the contents of the 8-bit buffer cast as signed bytes.
Definition: String.h:352
kernel
Definition: namespace.dox:3
Automatically reference-counted string container.
Definition: String.h:128
shared FE context for Operator plugins
Definition: OperatorContext.h:23