Cleanup: Remove unused Grease Pencil legacy functions

This commit is contained in:
Hans Goudey
2024-12-12 16:16:30 -05:00
parent 7eefbd1178
commit cd7b901355
3 changed files with 0 additions and 179 deletions

View File

@@ -50,32 +50,6 @@ void BKE_gpencil_stroke_geometry_update(struct bGPdata *gpd, struct bGPDstroke *
*/
void BKE_gpencil_stroke_uv_update(struct bGPDstroke *gps);
typedef struct GPencilPointCoordinates {
/* This is used when doing "move only origin" in object_data_transform.cc.
* pressure is needs to be stored here as it is tied to object scale. */
float co[3];
float pressure;
} GPencilPointCoordinates;
/**
* \note Used for "move only origins" in object_data_transform.cc.
*/
int BKE_gpencil_stroke_point_count(const struct bGPdata *gpd);
/**
* \note Used for "move only origins" in object_data_transform.cc.
*/
void BKE_gpencil_point_coords_get(struct bGPdata *gpd, GPencilPointCoordinates *elem_data);
/**
* \note Used for "move only origins" in object_data_transform.cc.
*/
void BKE_gpencil_point_coords_apply(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data);
/**
* \note Used for "move only origins" in object_data_transform.cc.
*/
void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd,
const GPencilPointCoordinates *elem_data,
const float mat[4][4]);
/**
* Split the given stroke into several new strokes, partitioning
* it based on whether the stroke points have a particular flag

View File

@@ -261,131 +261,6 @@ void BKE_gpencil_stroke_geometry_update(bGPdata * /*gpd*/, bGPDstroke *gps)
BKE_gpencil_stroke_uv_update(gps);
}
int BKE_gpencil_stroke_point_count(const bGPdata *gpd)
{
int total_points = 0;
if (gpd == nullptr) {
return 0;
}
LISTBASE_FOREACH (const bGPDlayer *, gpl, &gpd->layers) {
/* FIXME: For now, we just skip parented layers.
* Otherwise, we have to update each frame to find
* the current parent position/effects.
*/
if (gpl->parent) {
continue;
}
LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
total_points += gps->totpoints;
}
}
}
return total_points;
}
void BKE_gpencil_point_coords_get(bGPdata *gpd, GPencilPointCoordinates *elem_data)
{
if (gpd == nullptr) {
return;
}
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
/* FIXME: For now, we just skip parented layers.
* Otherwise, we have to update each frame to find
* the current parent position/effects.
*/
if (gpl->parent) {
continue;
}
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
bGPDspoint *pt;
int i;
for (pt = gps->points, i = 0; i < gps->totpoints; pt++, i++) {
copy_v3_v3(elem_data->co, &pt->x);
elem_data->pressure = pt->pressure;
elem_data++;
}
}
}
}
}
void BKE_gpencil_point_coords_apply(bGPdata *gpd, const GPencilPointCoordinates *elem_data)
{
if (gpd == nullptr) {
return;
}
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
/* FIXME: For now, we just skip parented layers.
* Otherwise, we have to update each frame to find
* the current parent position/effects.
*/
if (gpl->parent) {
continue;
}
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
bGPDspoint *pt;
int i;
for (pt = gps->points, i = 0; i < gps->totpoints; pt++, i++) {
copy_v3_v3(&pt->x, elem_data->co);
pt->pressure = elem_data->pressure;
elem_data++;
}
/* Distortion may mean we need to re-triangulate. */
BKE_gpencil_stroke_geometry_update(gpd, gps);
}
}
}
}
void BKE_gpencil_point_coords_apply_with_mat4(bGPdata *gpd,
const GPencilPointCoordinates *elem_data,
const float mat[4][4])
{
if (gpd == nullptr) {
return;
}
const float scalef = mat4_to_scale(mat);
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
/* FIXME: For now, we just skip parented layers.
* Otherwise, we have to update each frame to find
* the current parent position/effects.
*/
if (gpl->parent) {
continue;
}
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
bGPDspoint *pt;
int i;
for (pt = gps->points, i = 0; i < gps->totpoints; pt++, i++) {
mul_v3_m4v3(&pt->x, mat, elem_data->co);
pt->pressure = elem_data->pressure * scalef;
elem_data++;
}
/* Distortion may mean we need to re-triangulate. */
BKE_gpencil_stroke_geometry_update(gpd, gps);
}
}
}
}
/* Temp data for storing information about an "island" of points
* that should be kept when splitting up a stroke. Used in:
* gpencil_stroke_delete_tagged_points()

View File

@@ -298,11 +298,6 @@ struct XFormObjectData_MetaBall {
ElemData_MetaBall elem_array[0];
};
struct XFormObjectData_GPencil {
XFormObjectData base;
GPencilPointCoordinates elem_array[0];
};
struct XFormObjectData_GreasePencil {
XFormObjectData base;
GreasePencilPointCoordinates elem_array[0];
@@ -469,17 +464,6 @@ XFormObjectData *data_xform_create_ex(ID *id, bool is_edit_mode)
xod_base = &xod->base;
break;
}
case ID_GD_LEGACY: {
bGPdata *gpd = (bGPdata *)id;
const int elem_array_len = BKE_gpencil_stroke_point_count(gpd);
XFormObjectData_GPencil *xod = static_cast<XFormObjectData_GPencil *>(
MEM_mallocN(sizeof(*xod) + (sizeof(*xod->elem_array) * elem_array_len), __func__));
memset(xod, 0x0, sizeof(*xod));
BKE_gpencil_point_coords_get(gpd, xod->elem_array);
xod_base = &xod->base;
break;
}
case ID_GP: {
GreasePencil *grease_pencil = (GreasePencil *)id;
const int elem_array_len = BKE_grease_pencil_stroke_point_count(*grease_pencil);
@@ -649,12 +633,6 @@ void data_xform_by_mat4(XFormObjectData *xod_base, const float mat[4][4])
metaball_coords_and_quats_apply_with_mat4(mb, xod->elem_array, mat);
break;
}
case ID_GD_LEGACY: {
bGPdata *gpd = (bGPdata *)xod_base->id;
XFormObjectData_GPencil *xod = (XFormObjectData_GPencil *)xod_base;
BKE_gpencil_point_coords_apply_with_mat4(gpd, xod->elem_array, mat);
break;
}
case ID_GP: {
GreasePencil *grease_pencil = (GreasePencil *)xod_base->id;
XFormObjectData_GreasePencil *xod = (XFormObjectData_GreasePencil *)xod_base;
@@ -757,12 +735,6 @@ void data_xform_restore(XFormObjectData *xod_base)
metaball_coords_and_quats_apply(mb, xod->elem_array);
break;
}
case ID_GD_LEGACY: {
bGPdata *gpd = (bGPdata *)xod_base->id;
XFormObjectData_GPencil *xod = (XFormObjectData_GPencil *)xod_base;
BKE_gpencil_point_coords_apply(gpd, xod->elem_array);
break;
}
case ID_GP: {
GreasePencil *grease_pencil = (GreasePencil *)xod_base->id;
XFormObjectData_GreasePencil *xod = (XFormObjectData_GreasePencil *)xod_base;