GPencil: Cleanup - Remove storage Grid matrix and replace with local variable
Now the matrix is copied when creating shading group and don't need to be saved in storage.
This commit is contained in:
@@ -591,6 +591,7 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
View3D *v3d = draw_ctx->v3d;
|
||||
const View3DCursor *cursor = &scene->cursor;
|
||||
float grid_matrix[4][4];
|
||||
|
||||
if (ob->type == OB_GPENCIL && ob->data) {
|
||||
bGPdata *gpd = (bGPdata *)ob->data;
|
||||
@@ -658,32 +659,31 @@ void GPENCIL_cache_populate(void *vedata, Object *ob)
|
||||
switch (ts->gp_sculpt.lock_axis) {
|
||||
case GP_LOCKAXIS_VIEW: {
|
||||
/* align always to view */
|
||||
invert_m4_m4(stl->storage->grid_matrix, draw_ctx->rv3d->viewmat);
|
||||
invert_m4_m4(grid_matrix, draw_ctx->rv3d->viewmat);
|
||||
/* copy ob location */
|
||||
copy_v3_v3(stl->storage->grid_matrix[3], ob->obmat[3]);
|
||||
copy_v3_v3(grid_matrix[3], ob->obmat[3]);
|
||||
break;
|
||||
}
|
||||
case GP_LOCKAXIS_CURSOR: {
|
||||
float scale[3] = {1.0f, 1.0f, 1.0f};
|
||||
loc_eul_size_to_mat4(
|
||||
stl->storage->grid_matrix, cursor->location, cursor->rotation_euler, scale);
|
||||
loc_eul_size_to_mat4(grid_matrix, cursor->location, cursor->rotation_euler, scale);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
copy_m4_m4(stl->storage->grid_matrix, ob->obmat);
|
||||
copy_m4_m4(grid_matrix, ob->obmat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move the origin to Object or Cursor */
|
||||
if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) {
|
||||
copy_v3_v3(stl->storage->grid_matrix[3], cursor->location);
|
||||
copy_v3_v3(grid_matrix[3], cursor->location);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(stl->storage->grid_matrix[3], ob->obmat[3]);
|
||||
copy_v3_v3(grid_matrix[3], ob->obmat[3]);
|
||||
}
|
||||
|
||||
DRW_shgroup_call(stl->g_data->shgrps_grid, e_data.batch_grid, stl->storage->grid_matrix);
|
||||
DRW_shgroup_call(stl->g_data->shgrps_grid, e_data.batch_grid, grid_matrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -190,7 +190,6 @@ typedef struct GPENCIL_Storage {
|
||||
DRWView *view;
|
||||
float view_vecs[2][4]; /* vec4[2] */
|
||||
|
||||
float grid_matrix[4][4];
|
||||
int shade_render[2];
|
||||
|
||||
Object *camera; /* camera pointer for render mode */
|
||||
|
Reference in New Issue
Block a user