Fix wrong key type for GSet in Grease Pencil same material selection
The type of the key was changed from string to integer in 66da2f537a
, but
the GSet was still being created for string keys.
As long as the integers stay small enough, this even kind of works on
little-endian systems, but of course it should use an integer hash instead.
This commit is contained in:
parent
3c62e539af
commit
6f1ad5f5e7
|
@ -826,7 +826,7 @@ static bool gpencil_select_same_material(bContext *C)
|
|||
bGPdata *gpd = ED_gpencil_data_get_active(C);
|
||||
const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
|
||||
/* First, build set containing all the colors of selected strokes */
|
||||
GSet *selected_colors = BLI_gset_str_new("GP Selected Colors");
|
||||
GSet *selected_colors = BLI_gset_int_new("GP Selected Colors");
|
||||
|
||||
bool changed = false;
|
||||
|
||||
|
@ -835,7 +835,7 @@ static bool gpencil_select_same_material(bContext *C)
|
|||
/* add instead of insert here, otherwise the uniqueness check gets skipped,
|
||||
* and we get many duplicate entries...
|
||||
*/
|
||||
BLI_gset_add(selected_colors, &gps->mat_nr);
|
||||
BLI_gset_add(selected_colors, POINTER_FROM_INT(gps->mat_nr));
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
@ -843,7 +843,8 @@ static bool gpencil_select_same_material(bContext *C)
|
|||
/* Second, select any visible stroke that uses these colors */
|
||||
if (is_curve_edit) {
|
||||
CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
|
||||
if (gps->editcurve != NULL && BLI_gset_haskey(selected_colors, &gps->mat_nr)) {
|
||||
if (gps->editcurve != NULL &&
|
||||
BLI_gset_haskey(selected_colors, POINTER_FROM_INT(gps->mat_nr))) {
|
||||
bGPDcurve *gpc = gps->editcurve;
|
||||
for (int i = 0; i < gpc->tot_curve_points; i++) {
|
||||
bGPDcurve_point *gpc_pt = &gpc->curve_points[i];
|
||||
|
@ -861,7 +862,7 @@ static bool gpencil_select_same_material(bContext *C)
|
|||
}
|
||||
else {
|
||||
CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
|
||||
if (BLI_gset_haskey(selected_colors, &gps->mat_nr)) {
|
||||
if (BLI_gset_haskey(selected_colors, POINTER_FROM_INT(gps->mat_nr))) {
|
||||
/* select this stroke */
|
||||
bGPDspoint *pt;
|
||||
int i;
|
||||
|
|
Loading…
Reference in New Issue