[Bf-blender-cvs] [51347be24e4] master: Fix T64059: Crash in shader when using other object's texture space

Sergey Sharybin noreply at git.blender.org
Thu May 2 15:55:32 CEST 2019


Commit: 51347be24e474a3ad3d38a75d0060ca91b8a9794
Author: Sergey Sharybin
Date:   Thu May 2 15:54:03 2019 +0200
Branches: master
https://developer.blender.org/rB51347be24e474a3ad3d38a75d0060ca91b8a9794

Fix T64059: Crash in shader when using other object's texture space

Can not use evaluated datablock to localize since that could point to
another evaluated datablock, which can not become part of another
dependency graph.

The original code needed to have unkeyed changes preserved, but now
we do have a flush of animation to an active dependency graph, so this
code is not needed anymore.

===================================================================

M	source/blender/editors/render/render_preview.c

===================================================================

diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index c9a4f1948ce..bf6d658f927 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -331,28 +331,22 @@ static World *preview_get_localized_world(ShaderPreview *sp, World *world)
   return sp->worldcopy;
 }
 
-static ID *duplicate_ids(ID *id, Depsgraph *depsgraph)
+static ID *duplicate_ids(ID *id)
 {
   if (id == NULL) {
     /* Non-ID preview render. */
     return NULL;
   }
 
-  ID *id_eval = id;
-
-  if (depsgraph) {
-    id_eval = DEG_get_evaluated_id(depsgraph, id);
-  }
-
   switch (GS(id->name)) {
     case ID_MA:
-      return (ID *)BKE_material_localize((Material *)id_eval);
+      return (ID *)BKE_material_localize((Material *)id);
     case ID_TE:
-      return (ID *)BKE_texture_localize((Tex *)id_eval);
+      return (ID *)BKE_texture_localize((Tex *)id);
     case ID_LA:
-      return (ID *)BKE_light_localize((Light *)id_eval);
+      return (ID *)BKE_light_localize((Light *)id);
     case ID_WO:
-      return (ID *)BKE_world_localize((World *)id_eval);
+      return (ID *)BKE_world_localize((World *)id);
     case ID_IM:
     case ID_BR:
     case ID_SCR:
@@ -820,11 +814,6 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
   char name[32];
   int sizex;
   Main *pr_main = sp->pr_main;
-  ID *id_eval = id;
-
-  if (sp->depsgraph) {
-    id_eval = DEG_get_evaluated_id(sp->depsgraph, id);
-  }
 
   /* in case of split preview, use border render */
   if (split) {
@@ -848,7 +837,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
   }
 
   /* get the stuff from the builtin preview dbase */
-  sce = preview_prepare_scene(sp->bmain, sp->scene, id_eval, idtype, sp);
+  sce = preview_prepare_scene(sp->bmain, sp->scene, id, idtype, sp);
   if (sce == NULL) {
     return;
   }
@@ -1327,7 +1316,7 @@ void ED_preview_icon_render(
   ip.scene = scene;
   ip.owner = BKE_previewimg_id_ensure(id);
   ip.id = id;
-  ip.id_copy = duplicate_ids(id, NULL);
+  ip.id_copy = duplicate_ids(id);
 
   icon_preview_add_size(&ip, rect, sizex, sizey);
 
@@ -1368,7 +1357,7 @@ void ED_preview_icon_job(
   ip->depsgraph = CTX_data_depsgraph(C);
   ip->owner = owner;
   ip->id = id;
-  ip->id_copy = duplicate_ids(id, ip->depsgraph);
+  ip->id_copy = duplicate_ids(id);
 
   icon_preview_add_size(ip, rect, sizex, sizey);
 
@@ -1434,7 +1423,7 @@ void ED_preview_shader_job(const bContext *C,
   sp->sizey = sizey;
   sp->pr_method = method;
   sp->id = id;
-  sp->id_copy = duplicate_ids(id, sp->depsgraph);
+  sp->id_copy = duplicate_ids(id);
   sp->own_id_copy = true;
   sp->parent = parent;
   sp->slot = slot;



More information about the Bf-blender-cvs mailing list