Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2012-06-21 09:41:06 +0400
committerMitchell Stokes <mogurijin@gmail.com>2012-06-21 09:41:06 +0400
commitd8e2c475a0dbfb9de31c363f76899435d80cff8f (patch)
treebf96da27100e88225895bb58e489934494b10191 /source/gameengine/Converter/KX_BlenderSceneConverter.cpp
parent501922782fec2cd626e3bea13d67f9e225ab025e (diff)
Fix for [#31396] "bge.logic.LibLoad fails to import text blocks" reported by Leonard Ritter.
Blender's import function check's the Text datablocks in main for additional modules for importing. However, libloaded scenes were 1) not loading Text datablocks and 2) not letting bpy know about them. Text datablocks are now loaded if a Scene is loaded and bpy can now looking through extra Mains to find additional modules.
Diffstat (limited to 'source/gameengine/Converter/KX_BlenderSceneConverter.cpp')
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 78e5d7b32c2..3961e6554a7 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -42,6 +42,7 @@
#include "KX_PhysicsEngineEnums.h"
#include "PHY_IPhysicsEnvironment.h"
#include "KX_KetsjiEngine.h"
+#include "KX_PythonInit.h" // So we can handle adding new text datablocks for Python to import
#include "KX_IPhysicsController.h"
#include "BL_Material.h"
#include "BL_ActionActuator.h"
@@ -173,9 +174,9 @@ KX_BlenderSceneConverter::~KX_BlenderSceneConverter()
#endif
/* free any data that was dynamically loaded */
- for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) {
- Main *main= *it;
- free_main(main);
+ while (m_DynamicMaggie.size() != 0)
+ {
+ FreeBlendFile(m_DynamicMaggie[0]);
}
m_DynamicMaggie.clear();
@@ -987,6 +988,11 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
load_datablocks(main_newlib, bpy_openlib, path, idcode);
+ if (idcode==ID_SCE) {
+ /* assume we want text blocks too */
+ load_datablocks(main_newlib, bpy_openlib, path, ID_TXT);
+ }
+
/* now do another round of linking for Scenes so all actions are properly loaded */
if (idcode==ID_SCE && options & LIB_LOAD_LOAD_ACTIONS) {
load_datablocks(main_newlib, bpy_openlib, path, ID_AC);
@@ -1038,6 +1044,10 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
delete other;
}
+ /* Handle any text datablocks */
+
+ addImportMain(main_newlib);
+
/* Now handle all the actions */
if (options & LIB_LOAD_LOAD_ACTIONS) {
ID *action;
@@ -1330,6 +1340,9 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
}
}
+ /* make sure this maggie is removed from the import list if it's there (this operation is safe if it isn't in the list) */
+ removeImportMain(maggie);
+
free_main(maggie);
return true;