Salome HOME
Merge branch 'master' of newgeom:newgeom.git into BR_PYTHON_PLUGIN
[modules/shaper.git] / src / Model / Model_Session.cpp
index 37b020eeeec6be69126e17a0eefcf386887059f8..a42eb204696b7283251aae226a13b145bf6cc8e0 100644 (file)
@@ -21,6 +21,9 @@
 #include <TDF_RelocationTable.hxx>
 #include <TDF_ClosureTool.hxx>
 
+// TEST
+#include <Python.h>
+
 using namespace std;
 
 static Model_Session* myImpl = new Model_Session();
@@ -91,8 +94,9 @@ void Model_Session::redo()
 
 FeaturePtr Model_Session::createFeature(string theFeatureID)
 {
-  if (this != myImpl)
+  if (this != myImpl) {
     return myImpl->createFeature(theFeatureID);
+  }
 
   LoadPluginsInfo();
   if (myPlugins.find(theFeatureID) != myPlugins.end()) {
@@ -106,7 +110,14 @@ FeaturePtr Model_Session::createFeature(string theFeatureID)
     myCurrentPluginName = aPlugin.first;
     if (myPluginObjs.find(myCurrentPluginName) == myPluginObjs.end()) {
       // load plugin library if not yet done
-      Config_ModuleReader::loadLibrary(myCurrentPluginName);
+      //TODO: Get info from Config about python libraries
+      if (myCurrentPluginName.compare(string("PythonFeaturesPlugin")) == 0) {
+        Py_Initialize();
+        PyObject* module = PyImport_ImportModule(myCurrentPluginName.c_str());
+        assert(module != NULL);
+      } else {
+        Config_ModuleReader::loadLibrary(myCurrentPluginName);
+      }
     }
     if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
       FeaturePtr aCreated = myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);