Fix T62101: GPencil: selection order is wrong
Following the advices of @Germano Cavalcante (mano-wii) , I have exposed as a workaround the free function to be called from draw manager for selection. Now, the free function is not called for selection inside gpencil draw_scene, but it's called from draw_manager.c. The real fix would be create a new Scene_finish callback in draw manager, but as the release of 2.80 is almost here, we fix this with a workaround that must be removed when new callback is in place. Differential Revision: http://developer.blender.org/D5193
This commit is contained in:
@@ -771,8 +771,11 @@ static void gpencil_prepare_fast_drawing(GPENCIL_StorageList *stl,
|
||||
}
|
||||
}
|
||||
|
||||
static void gpencil_free_runtime_data(GPENCIL_StorageList *stl)
|
||||
void DRW_gpencil_free_runtime_data(void *ved)
|
||||
{
|
||||
GPENCIL_Data *vedata = (GPENCIL_Data *)ved;
|
||||
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
|
||||
|
||||
/* free gpu data */
|
||||
DRW_TEXTURE_FREE_SAFE(stl->g_data->gpencil_blank_texture);
|
||||
|
||||
@@ -976,8 +979,6 @@ void GPENCIL_draw_scene(void *ved)
|
||||
/* if the draw is for select, do a basic drawing and return */
|
||||
if (DRW_state_is_select() || DRW_state_is_depth()) {
|
||||
drw_gpencil_select_render(stl, psl);
|
||||
/* free memory */
|
||||
gpencil_free_runtime_data(stl);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1010,7 +1011,7 @@ void GPENCIL_draw_scene(void *ved)
|
||||
}
|
||||
|
||||
/* free memory */
|
||||
gpencil_free_runtime_data(stl);
|
||||
DRW_gpencil_free_runtime_data(ved);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1159,7 +1160,7 @@ void GPENCIL_draw_scene(void *ved)
|
||||
}
|
||||
}
|
||||
/* free memory */
|
||||
gpencil_free_runtime_data(stl);
|
||||
DRW_gpencil_free_runtime_data(ved);
|
||||
|
||||
/* reset */
|
||||
if (DRW_state_is_fbo()) {
|
||||
|
||||
@@ -359,12 +359,12 @@ typedef struct GpencilBatchCacheElem {
|
||||
} GpencilBatchCacheElem;
|
||||
|
||||
typedef struct GpencilBatchGroup {
|
||||
bGPDlayer *gpl; /* reference to original layer */
|
||||
bGPDframe *gpf; /* reference to original frame */
|
||||
bGPDstroke *gps; /* reference to original stroke */
|
||||
short type; /* type of element */
|
||||
bool onion; /* the group is part of onion skin */
|
||||
int vertex_idx; /* index of vertex data */
|
||||
struct bGPDlayer *gpl; /* reference to original layer */
|
||||
struct bGPDframe *gpf; /* reference to original frame */
|
||||
struct bGPDstroke *gps; /* reference to original stroke */
|
||||
short type; /* type of element */
|
||||
bool onion; /* the group is part of onion skin */
|
||||
int vertex_idx; /* index of vertex data */
|
||||
} GpencilBatchGroup;
|
||||
|
||||
typedef enum GpencilBatchGroup_Type {
|
||||
@@ -507,6 +507,10 @@ void GPENCIL_render_to_image(void *vedata,
|
||||
struct RenderLayer *render_layer,
|
||||
const rcti *rect);
|
||||
|
||||
/* TODO: GPXX workaround function to call free memory from draw manager while draw manager support
|
||||
* scene finish callback. */
|
||||
void DRW_gpencil_free_runtime_data(void *ved);
|
||||
|
||||
/* Use of multisample framebuffers. */
|
||||
#define MULTISAMPLE_GP_SYNC_ENABLE(lvl, fbl) \
|
||||
{ \
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
#include "engines/basic/basic_engine.h"
|
||||
#include "engines/workbench/workbench_engine.h"
|
||||
#include "engines/external/external_engine.h"
|
||||
#include "engines/gpencil/gpencil_engine.h"
|
||||
|
||||
#include "GPU_context.h"
|
||||
|
||||
@@ -2379,6 +2380,13 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: GPXX Workaround for grease pencil selection while draw manager support a callback from
|
||||
* scene finish */
|
||||
void *data = GPU_viewport_engine_data_get(DST.viewport, &draw_engine_gpencil_type);
|
||||
if (data != NULL) {
|
||||
DRW_gpencil_free_runtime_data(data);
|
||||
}
|
||||
|
||||
DRW_state_lock(0);
|
||||
|
||||
DRW_draw_callbacks_post_scene();
|
||||
|
||||
Reference in New Issue
Block a user