29 #ifndef __PYTHONSCRIPT_H__
30 #define __PYTHONSCRIPT_H__
41 typedef _object PyObject;
57 Inst< MFNode > _references = 0,
58 Inst< SFString > _moduleName = 0 );
63 if ( _name ==
"references" )
64 return references.get();
66 return lookupField( _name );
75 virtual Field *lookupField(
const string &_name )
const;
81 virtual PyObject *getPythonAttribute(
const string &_name );
85 virtual void getTopLevelFields( vector< pair< string, Field * > > &fields );
93 virtual bool initialiseParser();
95 virtual string getInstanceName() {
96 ostringstream namestr;
97 namestr <<
"PythonScript_" <<
this;
101 virtual void loadScript(
const string &script_filename,
const string &script_content=
"" );
105 std::string execute (
const std::string& _command );
107 static void setargv(
int _argc,
char *_argv[] );
108 static void setargv(
int _argc,
wchar_t *_argv[] );
118 static bool initPythonHome(
const std::string& exe_with_full_path );
122 virtual void initialize();
164 static void allowMainThreadPython();
169 static void disallowMainThreadPython();
173 static bool mainThreadPythonAllowed();
178 return static_cast< PyObject *
>(module);
187 static void pythonSetargv();
190 void initializePython();
195 static wchar_t **w_argv;
197 static bool python_h3d_initialized;
Base class for all scripting node interfaces.
Contains the MFNode class.
Contains the SFString field class.
The Field class.
Definition: Field.h:46
virtual Field * getField(const string &_name) const
return a pointer to the field specified by name within this instance
Definition: Node.cpp:217
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194
The base class for script nodes.
Definition: H3DScriptNode.h:41
Interface to the dynamic Python library for executing script code as part of the API.
Definition: PythonScript.h:54
virtual Field * getField(const string &_name) const
return a pointer to the field specified by name within this instance
Definition: PythonScript.h:60
PyObject * getPythonModule()
Returns a borrowed reference to the PyModule object use by the PythonScript node.
Definition: PythonScript.h:177
H3DUniquePtr< SFString > moduleName
Specify a specific moduleName for the pythonscript.
Definition: PythonScript.h:139
H3DUniquePtr< MFNode > references
Through this field one can pass references to Nodes in the scene graph that can then be access throug...
Definition: PythonScript.h:129
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: PythonScript.h:142