Cleanup: Remove unused grease pencil legacy "orig" pointers

Unused for annotations. See #123468.

Pull Request: https://projects.blender.org/blender/blender/pulls/129979
This commit is contained in:
Hans Goudey
2024-11-07 17:54:15 +01:00
committed by Hans Goudey
parent 80b4297b57
commit ba94dbc9c2
4 changed files with 0 additions and 122 deletions

View File

@@ -291,36 +291,6 @@ void BKE_gpencil_stroke_weights_duplicate(struct bGPDstroke *gps_src, struct bGP
*/
void BKE_gpencil_palette_ensure(struct Main *bmain, struct Scene *scene);
/**
* Update original pointers in evaluated frame.
* \param gpf_orig: Original grease-pencil frame.
* \param gpf_eval: Evaluated grease pencil frame.
*/
void BKE_gpencil_frame_original_pointers_update(const struct bGPDframe *gpf_orig,
const struct bGPDframe *gpf_eval);
/**
* Update original pointers in evaluated layer.
* \param gpl_orig: Original grease-pencil layer.
* \param gpl_eval: Evaluated grease pencil layer.
*/
void BKE_gpencil_layer_original_pointers_update(const struct bGPDlayer *gpl_orig,
const struct bGPDlayer *gpl_eval);
/**
* Update pointers of eval data to original data to keep references.
* \param ob_orig: Original grease pencil object
* \param ob_eval: Evaluated grease pencil object
*/
void BKE_gpencil_update_orig_pointers(const struct Object *ob_orig, const struct Object *ob_eval);
/**
* Update pointers of eval data to original data to keep references.
* \param gpd_orig: Original grease pencil data
* \param gpd_eval: Evaluated grease pencil data
*/
void BKE_gpencil_data_update_orig_pointers(const struct bGPdata *gpd_orig,
const struct bGPdata *gpd_eval);
void BKE_gpencil_blend_read_data(struct BlendDataReader *reader, struct bGPdata *gpd);
#ifdef __cplusplus

View File

@@ -1316,69 +1316,4 @@ void BKE_gpencil_palette_ensure(Main *bmain, Scene *scene)
BKE_paint_palette_set(&ts->gp_vertexpaint->paint, palette);
}
void BKE_gpencil_frame_original_pointers_update(const bGPDframe *gpf_orig,
const bGPDframe *gpf_eval)
{
bGPDstroke *gps_eval = static_cast<bGPDstroke *>(gpf_eval->strokes.first);
LISTBASE_FOREACH (bGPDstroke *, gps_orig, &gpf_orig->strokes) {
/* Assign original stroke pointer. */
if (gps_eval != nullptr) {
gps_eval->runtime.gps_orig = gps_orig;
/* Assign original point pointer. */
for (int i = 0; i < gps_orig->totpoints; i++) {
if (i > gps_eval->totpoints - 1) {
break;
}
bGPDspoint *pt_orig = &gps_orig->points[i];
bGPDspoint *pt_eval = &gps_eval->points[i];
pt_orig->runtime.pt_orig = nullptr;
pt_orig->runtime.idx_orig = i;
pt_eval->runtime.pt_orig = pt_orig;
pt_eval->runtime.idx_orig = i;
}
/* Increase pointer. */
gps_eval = gps_eval->next;
}
}
}
void BKE_gpencil_layer_original_pointers_update(const bGPDlayer *gpl_orig,
const bGPDlayer *gpl_eval)
{
bGPDframe *gpf_eval = static_cast<bGPDframe *>(gpl_eval->frames.first);
LISTBASE_FOREACH (bGPDframe *, gpf_orig, &gpl_orig->frames) {
if (gpf_eval != nullptr) {
/* Update frame reference pointers. */
gpf_eval->runtime.gpf_orig = (bGPDframe *)gpf_orig;
BKE_gpencil_frame_original_pointers_update(gpf_orig, gpf_eval);
gpf_eval = gpf_eval->next;
}
}
}
void BKE_gpencil_data_update_orig_pointers(const bGPdata *gpd_orig, const bGPdata *gpd_eval)
{
/* Assign pointers to the original stroke and points to the evaluated data. This must
* be done before applying any modifier because at this moment the structure is equals,
* so we can assume the layer index is the same in both data-blocks.
* This data will be used by operators. */
bGPDlayer *gpl_eval = static_cast<bGPDlayer *>(gpd_eval->layers.first);
LISTBASE_FOREACH (bGPDlayer *, gpl_orig, &gpd_orig->layers) {
if (gpl_eval != nullptr) {
/* Update layer reference pointers. */
gpl_eval->runtime.gpl_orig = gpl_orig;
BKE_gpencil_layer_original_pointers_update(gpl_orig, gpl_eval);
gpl_eval = gpl_eval->next;
}
}
}
void BKE_gpencil_update_orig_pointers(const Object *ob_orig, const Object *ob_eval)
{
BKE_gpencil_data_update_orig_pointers((bGPdata *)ob_orig->data, (bGPdata *)ob_eval->data);
}
/** \} */

View File

@@ -727,16 +727,6 @@ void update_id_after_copy(const Depsgraph *depsgraph,
scene_setup_view_layers_after_remap(depsgraph, id_node, reinterpret_cast<Scene *>(id_cow));
break;
}
/* FIXME: This is a temporary fix to update the runtime pointers properly, see #96216. Should
* be removed at some point. */
case ID_GD_LEGACY: {
bGPdata *gpd_cow = (bGPdata *)id_cow;
bGPDlayer *gpl = (bGPDlayer *)(gpd_cow->layers.first);
if (gpl != nullptr && gpl->runtime.gpl_orig == nullptr) {
BKE_gpencil_data_update_orig_pointers((bGPdata *)id_orig, gpd_cow);
}
break;
}
default:
break;
}

View File

@@ -52,16 +52,6 @@ typedef struct bGPDcontrolpoint {
int size;
} bGPDcontrolpoint;
typedef struct bGPDspoint_Runtime {
DNA_DEFINE_CXX_METHODS(bGPDspoint_Runtime)
/** Original point (used to dereference evaluated data) */
struct bGPDspoint *pt_orig;
/** Original index array position */
int idx_orig;
char _pad0[4];
} bGPDspoint_Runtime;
/**
* Grease-Pencil Annotations - 'Stroke Point'
* -> Coordinates may either be 2d or 3d depending on settings at the time
@@ -94,8 +84,6 @@ typedef struct bGPDspoint {
/** Runtime data */
char _pad2[4];
bGPDspoint_Runtime runtime;
} bGPDspoint;
/** #bGPDspoint.flag */
@@ -395,9 +383,6 @@ typedef struct bGPDframe_Runtime {
int frameid;
/** Onion offset from active frame. 0 if not onion. INT_MAX to bypass frame. */
int onion_id;
/** Original frame (used to dereference evaluated data) */
struct bGPDframe *gpf_orig;
} bGPDframe_Runtime;
/**
@@ -463,8 +448,6 @@ typedef struct bGPDlayer_Runtime {
/** Id for dynamic icon used to show annotation color preview for layer. */
int icon_id;
char _pad[4];
/** Original layer (used to dereference evaluated data) */
struct bGPDlayer *gpl_orig;
} bGPDlayer_Runtime;
/** Grease-Pencil Annotations - 'Layer'. */