Eevee: Stop depsgraph update callback form allocating unneeded memory
[blender.git] / source / blender / draw / intern / draw_manager.c
index 9efbf067591e6d1f913f5caec94c72c063e4049b..806c8cce4d563fd280ac7f41cc1505d12cecf19e 100644 (file)
@@ -2702,6 +2702,16 @@ void DRW_viewport_request_redraw(void)
 /** \name ViewLayers (DRW_scenelayer)
  * \{ */
 
+void *DRW_view_layer_engine_data_get(DrawEngineType *engine_type)
+{
+       for (ViewLayerEngineData *sled = DST.draw_ctx.view_layer->drawdata.first; sled; sled = sled->next) {
+               if (sled->engine_type == engine_type) {
+                       return sled->storage;
+               }
+       }
+       return NULL;
+}
+
 void **DRW_view_layer_engine_data_ensure(DrawEngineType *engine_type, void (*callback)(void *storage))
 {
        ViewLayerEngineData *sled;
@@ -2728,6 +2738,16 @@ void **DRW_view_layer_engine_data_ensure(DrawEngineType *engine_type, void (*cal
 /** \name Objects (DRW_object)
  * \{ */
 
+void *DRW_object_engine_data_get(Object *ob, DrawEngineType *engine_type)
+{
+       for (ObjectEngineData *oed = ob->drawdata.first; oed; oed = oed->next) {
+               if (oed->engine_type == engine_type) {
+                       return oed->storage;
+               }
+       }
+       return NULL;
+}
+
 void **DRW_object_engine_data_ensure(
         Object *ob, DrawEngineType *engine_type, void (*callback)(void *storage))
 {