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-02-05 16:46:15 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-02-05 16:46:15 +0400
commitfdfa5910b50e9e3af5fdd1a24d1affdfbdafc523 (patch)
tree613d772d46595b3be9d9cd6cee327c84543f878b /source/blender/editors/space_text
parente7cead09944a97854309c5eea56fb4fadb92fb3d (diff)
Fix #34040: Moving Normal Node with enabled Cycles Material Preview crashes
Issue was caused by couple of circumstances: - Normal Map node requires tesselated faces to compute tangent space - All temporary meshes needed for Cycles export were adding to G.main - Undo pushes would temporary set meshes tessfaces to NULL - Moving node will cause undo push and tree re-evaluate fr preview All this leads to threading conflict between preview render and undo system. Solved it in way that all temporary meshes are adding to that exact Main which was passed to Cycles via BlendData. This required couple of mechanic changes like adding extra parameter to *_add() functions and adding some *_ex() functions to make it possible RNA adds objects to Main passed to new() RNA function. This was tricky to pass Main to RNA function and IMO that's not so nice to pass main to function, so ended up with such decision: - Object.to_mesh() will add temp mesh to G.main - Added Main.meshes.new_from_object() which does the same as to_mesh, but adds temporary mesh to specified Main. So now all temporary meshes needed for preview render would be added to preview_main which does not conflict with undo pushes. Viewport render shall not be an issue because object sync happens from main thread in this case. It could be some issues with final render, but that's not so much likely to happen, so shall be fine. Thanks to Brecht for review!
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_ops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 21966ef614c..1f209f90007 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -161,11 +161,12 @@ void text_update_edited(Text *text)
static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceText *st = CTX_wm_space_text(C);
+ Main *bmain = CTX_data_main(C);
Text *text;
PointerRNA ptr, idptr;
PropertyRNA *prop;
- text = BKE_text_add("Text");
+ text = BKE_text_add(bmain, "Text");
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
@@ -226,6 +227,7 @@ static int text_open_cancel(bContext *UNUSED(C), wmOperator *op)
static int text_open_exec(bContext *C, wmOperator *op)
{
SpaceText *st = CTX_wm_space_text(C);
+ Main *bmain = CTX_data_main(C);
Text *text;
PropertyPointerRNA *pprop;
PointerRNA idptr;
@@ -234,7 +236,7 @@ static int text_open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", str);
- text = BKE_text_load(str, G.main->name);
+ text = BKE_text_load(bmain, str, G.main->name);
if (!text) {
if (op->customdata) MEM_freeN(op->customdata);