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:
-rw-r--r--doc/python_api/rst/bge.logic.rst4
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp7
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.h1
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp10
4 files changed, 13 insertions, 9 deletions
diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst
index d071984b14b..0d1d0df88c3 100644
--- a/doc/python_api/rst/bge.logic.rst
+++ b/doc/python_api/rst/bge.logic.rst
@@ -172,7 +172,7 @@ General functions
Restarts the current game by reloading the .blend file (the last saved version, not what is currently running).
-.. function:: LibLoad(blend, type, data, load_actions=False, verbose=False)
+.. function:: LibLoad(blend, type, data, load_actions=False, verbose=False, load_scripts=True)
Converts the all of the datablocks of the given type from the given blend.
@@ -186,6 +186,8 @@ General functions
:type load_actions: bool
:arg verbose: Whether or not to print debugging information (e.g., "SceneName: Scene")
:type verbose: bool
+ :arg load_scripts: Whether or not to load text datablocks as well (can be disabled for some extra security)
+ :type load_scripts: bool
.. function:: LibNew(name, type, data)
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 3961e6554a7..651c1a70f45 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -988,8 +988,7 @@ 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 */
+ if (idcode==ID_SCE && options & LIB_LOAD_LOAD_SCRIPTS) {
load_datablocks(main_newlib, bpy_openlib, path, ID_TXT);
}
@@ -1045,8 +1044,8 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
}
/* Handle any text datablocks */
-
- addImportMain(main_newlib);
+ if (options & LIB_LOAD_LOAD_SCRIPTS)
+ addImportMain(main_newlib);
/* Now handle all the actions */
if (options & LIB_LOAD_LOAD_ACTIONS) {
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h
index 906e3fed111..b51c2f21ca7 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.h
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h
@@ -182,6 +182,7 @@ public:
{
LIB_LOAD_LOAD_ACTIONS = 1,
LIB_LOAD_VERBOSE = 2,
+ LIB_LOAD_LOAD_SCRIPTS = 4,
};
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 823363dfd11..536b32cbd77 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -676,12 +676,12 @@ static PyObject *gLibLoad(PyObject*, PyObject* args, PyObject* kwds)
char *err_str= NULL;
short options=0;
- int load_actions=0, verbose=0;
+ int load_actions=0, verbose=0, load_scripts=1;
- static const char *kwlist[] = {"path", "group", "buffer", "load_actions", "verbose", NULL};
+ static const char *kwlist[] = {"path", "group", "buffer", "load_actions", "verbose", "load_scripts", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss|y*ii:LibLoad", const_cast<char**>(kwlist),
- &path, &group, &py_buffer, &load_actions, &verbose))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss|y*iii:LibLoad", const_cast<char**>(kwlist),
+ &path, &group, &py_buffer, &load_actions, &verbose, &load_scripts))
return NULL;
/* setup options */
@@ -689,6 +689,8 @@ static PyObject *gLibLoad(PyObject*, PyObject* args, PyObject* kwds)
options |= KX_BlenderSceneConverter::LIB_LOAD_LOAD_ACTIONS;
if (verbose != 0)
options |= KX_BlenderSceneConverter::LIB_LOAD_VERBOSE;
+ if (load_scripts != 0)
+ options |= KX_BlenderSceneConverter::LIB_LOAD_LOAD_SCRIPTS;
if (!py_buffer.buf)
{