Commit: c3545e7311d02f987c7b44a53fbdc7999c9869bd
Author: Antonioya
Date: Fri Dec 21 08:43:00 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBc3545e7311d02f987c7b44a53fbdc7999c9869bd
GP: Cleanup API removing extra ID parameter
===================================================================
M source/blender/makesrna/intern/rna_gpencil.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_gpencil.c
b/source/blender/makesrna/intern/rna_gpencil.c
index 8c6ad207bc4..fabb2ec7308 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -500,8 +500,10 @@ static void rna_GPencil_stroke_point_select_set(PointerRNA
*ptr, const bool valu
}
}
-static void rna_GPencil_stroke_point_add(bGPDstroke *stroke, bGPdata *gpd, int
count, float pressure, float strength)
+static void rna_GPencil_stroke_point_add(ID *id, bGPDstroke *stroke, int
count, float pressure, float strength)
{
+ bGPdata *gpd = (bGPdata *)id;
+
if (count > 0) {
/* create space at the end of the array for extra points */
stroke->points = MEM_recallocN_id(stroke->points,
@@ -528,17 +530,16 @@ static void rna_GPencil_stroke_point_add(bGPDstroke
*stroke, bGPdata *gpd, int c
stroke->flag |= GP_STROKE_RECALC_CACHES;
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM |
ID_RECALC_GEOMETRY);
-
gpd->flag |= GP_DATA_PYTHON_UPDATED;
- DEG_id_tag_update(&gpd->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM |
ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
}
-static void rna_GPencil_stroke_point_pop(bGPDstroke *stroke, ReportList
*reports, bGPdata *gpd, int index)
+static void rna_GPencil_stroke_point_pop(ID *id, bGPDstroke *stroke,
ReportList *reports, int index)
{
+ bGPdata *gpd = (bGPdata *)id;
bGPDspoint *pt_tmp = stroke->points;
MDeformVert *pt_dvert = stroke->dvert;
@@ -582,10 +583,9 @@ static void rna_GPencil_stroke_point_pop(bGPDstroke
*stroke, ReportList *reports
stroke->flag |= GP_STROKE_RECALC_CACHES;
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
-
gpd->flag |= GP_DATA_PYTHON_UPDATED;
- DEG_id_tag_update(&gpd->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY |
ID_RECALC_COPY_ON_WRITE);
+
WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
@@ -820,8 +820,7 @@ static void rna_def_gpencil_stroke_points_api(BlenderRNA
*brna, PropertyRNA *cpr
func = RNA_def_function(srna, "add", "rna_GPencil_stroke_point_add");
RNA_def_function_ui_description(func, "Add a new grease pencil stroke
point");
- parm = RNA_def_pointer(func, "gpd", "GreasePencil", "", "Grease pencil
datablock");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
parm = RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of
points to add to the stroke", 0, INT_MAX);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_float(func, "pressure", 1.0f, 0.0f, 1.0f, "Pressure", "Pressure
for newly created points", 0.0f, 1.0f);
@@ -829,9 +828,7 @@ static void rna_def_gpencil_stroke_points_api(BlenderRNA
*brna, PropertyRNA *cpr
func = RNA_def_function(srna, "pop", "rna_GPencil_stroke_point_pop");
RNA_def_function_ui_description(func, "Remove a grease pencil stroke
point");
- parm = RNA_def_pointer(func, "gpd", "GreasePencil", "", "Grease pencil
datablock");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
RNA_def_int(func, "index", -1, INT_MIN, INT_MAX, "Index", "point
index", INT_MIN, INT_MAX);
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs