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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-04-18 12:58:21 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-04-18 12:58:21 +0400
commit4df0c46f838f7c316b10a6667705c093f067cadd (patch)
tree9620cb8dbe215e30a3738509bed50408bca2452d /source/blender/freestyle/intern/system
parent093f95afaa4a08d2cf194b88803a35ef16cfec58 (diff)
Make freestyle use local Main for temporary objects
This means main database is no longer pollutes with temporary scene and objects needed for freestyle render. Actually, there're few of separated temporary mains now. Ideally it's better to use single one, but it's not so much trivial to pass it to all classes. Not so big deal actually. Required some changes to blender kernel, to make it possible to add object to a given main, also to check on mesh materials for objects in given main. This is all straightforward changes. As an additional, solved issue with main database being infinitely polluted with text blocks created by create_lineset_handler function. This fixes: - #35003: Freestyle crashes if user expands objects in FRS1_Scene - #35012: ctrl+f12 rendering crashes when using Freestyle
Diffstat (limited to 'source/blender/freestyle/intern/system')
-rw-r--r--source/blender/freestyle/intern/system/PythonInterpreter.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
index c54546b3ddd..7c271252a32 100644
--- a/source/blender/freestyle/intern/system/PythonInterpreter.h
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -83,11 +83,11 @@ public:
int status = BPY_filepath_exec(_context, fn, reports);
#else
int status;
- Text *text = BKE_text_load(G.main, fn, G.main->name);
+ Text *text = BKE_text_load(&_freestyle_bmain, fn, G.main->name);
if (text) {
status = BPY_text_exec(_context, text, reports, false);
- BKE_text_unlink(G.main, text);
- BKE_libblock_free(&G.main->text, text);
+ BKE_text_unlink(&_freestyle_bmain, text);
+ BKE_libblock_free(&_freestyle_bmain.text, text);
}
else {
BKE_reportf(reports, RPT_ERROR, "Cannot open file: %s", fn);
@@ -151,6 +151,7 @@ public:
private:
bContext *_context;
+ Main _freestyle_bmain;
void initPath()
{
@@ -160,7 +161,7 @@ private:
vector<string> pathnames;
StringUtils::getPathName(_path, "", pathnames);
- struct Text *text = BKE_text_add(G.main, "tmp_freestyle_initpath.txt");
+ struct Text *text = BKE_text_add(&_freestyle_bmain, "tmp_freestyle_initpath.txt");
string cmd = "import sys\n";
txt_insert_buf(text, const_cast<char*>(cmd.c_str()));
@@ -177,8 +178,8 @@ private:
BPY_text_exec(_context, text, NULL, false);
// cleaning up
- BKE_text_unlink(G.main, text);
- BKE_libblock_free(&G.main->text, text);
+ BKE_text_unlink(&_freestyle_bmain, text);
+ BKE_libblock_free(&_freestyle_bmain.text, text);
//PyRun_SimpleString("from Freestyle import *");
_initialized = true;