19 {-1,
"DOWN", 0,
"Down",
""},
20 {1,
"UP", 0,
"Up",
""},
21 {0,
nullptr, 0,
nullptr,
nullptr},
36static void rna_GreasePencilDrawing_add_curves(
ID *grease_pencil_id,
45 if (!rna_CurvesGeometry_add_curves(curves, reports, sizes, sizes_num)) {
56 if (grease_pencil_id->
us > 0) {
62static void rna_GreasePencilDrawing_remove_curves(
ID *grease_pencil_id,
65 const int *indices_ptr,
66 const int indices_num)
71 if (!rna_CurvesGeometry_remove_curves(curves, reports, indices_ptr, indices_num)) {
78 if (grease_pencil_id->
us > 0) {
84static void rna_GreasePencilDrawing_resize_curves(
ID *grease_pencil_id,
89 const int *indices_ptr,
90 const int indices_num)
95 if (!rna_CurvesGeometry_resize_curves(
96 curves, reports, sizes_ptr, sizes_num, indices_ptr, indices_num))
104 if (grease_pencil_id->
us > 0) {
112 drawing_ptr->wrap().tag_positions_changed();
124 if (layer.frames().contains(frame_number)) {
133 return layer.frame_at(frame_number);
136static void rna_Frames_frame_remove(
ID *
id,
145 if (!layer.frames().contains(frame_number)) {
150 if (grease_pencil.remove_frames(layer, {frame_number})) {
159 int from_frame_number,
161 bool instance_drawing)
167 if (!layer.frames().contains(from_frame_number)) {
171 if (layer.frames().contains(to_frame_number)) {
176 grease_pencil.insert_duplicate_frame(
177 layer, from_frame_number, to_frame_number, instance_drawing);
180 return layer.frame_at(to_frame_number);
186 int from_frame_number,
193 if (!layer.frames().contains(from_frame_number)) {
197 if (layer.frames().contains(to_frame_number)) {
202 grease_pencil.insert_duplicate_frame(layer, from_frame_number, to_frame_number,
true);
203 grease_pencil.remove_frames(layer, {from_frame_number});
206 return layer.frame_at(to_frame_number);
213 return static_cast<Layer *
>(layer)->frame_at(frame_number);
221 return static_cast<Layer *
>(layer)->frame_at(scene->r.cfra);
226 const bool set_active,
231 if (layer_group_ptr && layer_group_ptr->
data) {
236 layer = &grease_pencil->add_layer(*layer_group, name);
239 layer = &grease_pencil->add_layer(name);
242 grease_pencil->set_active_layer(layer);
254 grease_pencil->remove_layer(layer);
261static void rna_GreasePencil_layer_move(
GreasePencil *grease_pencil,
265 if (direction == 0) {
273 grease_pencil->move_node_down(layer_node, 1);
276 grease_pencil->move_node_up(layer_node, 1);
288 grease_pencil->move_node_top(layer_node);
298 grease_pencil->move_node_bottom(layer_node);
304static void rna_GreasePencil_layer_move_to_layer_group(
GreasePencil *grease_pencil,
309 TreeNode &layer_node =
static_cast<Layer *
>(layer_ptr->
data)->as_node();
311 if (layer_group_ptr && layer_group_ptr->
data) {
315 layer_group = &grease_pencil->root_group();
317 if (layer_group ==
nullptr) {
320 grease_pencil->move_node_into(layer_node, *layer_group);
332 if (parent_group_ptr && parent_group_ptr->
data) {
336 parent_group = &grease_pencil->root_group();
338 LayerGroup *new_layer_group = &grease_pencil->add_layer_group(*parent_group, name);
343 &grease_pencil->
id, &RNA_GreasePencilLayerGroup, new_layer_group);
347static void rna_GreasePencil_layer_group_remove(
GreasePencil *grease_pencil,
353 grease_pencil->remove_group(layer_group, keep_children);
360static void rna_GreasePencil_layer_group_move(
GreasePencil *grease_pencil,
364 if (direction == 0) {
372 grease_pencil->move_node_down(layer_group_node, 1);
375 grease_pencil->move_node_up(layer_group_node, 1);
383static void rna_GreasePencil_layer_group_move_top(
GreasePencil *grease_pencil,
388 grease_pencil->move_node_top(layer_group_node);
394static void rna_GreasePencil_layer_group_move_bottom(
GreasePencil *grease_pencil,
399 grease_pencil->move_node_bottom(layer_group_node);
405static void rna_GreasePencil_layer_group_move_to_layer_group(
GreasePencil *grease_pencil,
412 if (parent_group_ptr && parent_group_ptr->
data) {
416 parent_group = &grease_pencil->root_group();
418 grease_pencil->move_node_into(layer_group_node, *parent_group);
431 func =
RNA_def_function(srna,
"add_strokes",
"rna_GreasePencilDrawing_add_curves");
441 "The number of points in each stroke",
446 func =
RNA_def_function(srna,
"remove_strokes",
"rna_GreasePencilDrawing_remove_curves");
448 "Remove all strokes. If indices are provided, remove only the "
449 "strokes with the given indices.");
458 "The indices of the strokes to remove",
463 func =
RNA_def_function(srna,
"resize_strokes",
"rna_GreasePencilDrawing_resize_curves");
466 "Resize all existing strokes. If indices are provided, resize only the strokes with the "
467 "given indices. If the new size for a stroke is smaller, the stroke is trimmed. If "
468 "the new size for a stroke is larger, the new end values are default initialized.");
477 "The number of points in each stroke",
488 "The indices of the stroke to resize",
494 srna,
"tag_positions_changed",
"rna_GreasePencilDrawing_tag_positions_changed");
496 func,
"Indicate that the positions of points in the drawing have changed");
513 "The frame on which the drawing appears",
517 parm =
RNA_def_pointer(func,
"frame",
"GreasePencilFrame",
"",
"The newly created frame");
529 "The frame number of the frame to remove",
542 "Source Frame Number",
543 "The frame number of the source frame",
552 "Frame Number of Copy",
553 "The frame number to copy the frame to",
561 "Let the copied frame use the same drawing as the source");
562 parm =
RNA_def_pointer(func,
"copy",
"GreasePencilFrame",
"",
"The newly copied frame");
573 "Source Frame Number",
574 "The frame number of the source frame",
583 "Target Frame Number",
584 "The frame number to move the frame to",
588 parm =
RNA_def_pointer(func,
"moved",
"GreasePencilFrame",
"",
"The moved frame");
597 func =
RNA_def_function(srna,
"get_frame_at",
"rna_GreasePencilLayer_get_frame_at");
602 parm =
RNA_def_pointer(func,
"frame",
"GreasePencilFrame",
"Frame",
"");
605 func =
RNA_def_function(srna,
"current_frame",
"rna_GreasePencilLayer_current_frame");
607 func,
"The Grease Pencil frame at the current scene time on this layer");
623 func,
"set_active",
true,
"Set Active",
"Set the newly created layer as the active layer");
627 "GreasePencilLayerGroup",
629 "The layer group the new layer will be created in (use None for the main stack)");
631 parm =
RNA_def_pointer(func,
"layer",
"GreasePencilLayer",
"",
"The newly created layer");
636 parm =
RNA_def_pointer(func,
"layer",
"GreasePencilLayer",
"",
"The layer to remove");
642 "Move a Grease Pencil layer in the layer group or main stack");
643 parm =
RNA_def_pointer(func,
"layer",
"GreasePencilLayer",
"",
"The layer to move");
650 func =
RNA_def_function(srna,
"move_top",
"rna_GreasePencil_layer_move_top");
652 func,
"Move a Grease Pencil layer to the top of the layer group or main stack");
653 parm =
RNA_def_pointer(func,
"layer",
"GreasePencilLayer",
"",
"The layer to move");
657 func =
RNA_def_function(srna,
"move_bottom",
"rna_GreasePencil_layer_move_bottom");
659 func,
"Move a Grease Pencil layer to the bottom of the layer group or main stack");
660 parm =
RNA_def_pointer(func,
"layer",
"GreasePencilLayer",
"",
"The layer to move");
665 srna,
"move_to_layer_group",
"rna_GreasePencil_layer_move_to_layer_group");
667 parm =
RNA_def_pointer(func,
"layer",
"GreasePencilLayer",
"",
"The layer to move");
673 "GreasePencilLayerGroup",
675 "The layer group the layer will be moved into (use None for the main stack)");
688 func,
"name",
"GreasePencilLayerGroup",
MAX_NAME,
"Name",
"Name of the layer group");
692 "GreasePencilLayerGroup",
694 "The parent layer group the new group will be created in (use None "
695 "for the main stack)");
698 func,
"layer_group",
"GreasePencilLayerGroup",
"",
"The newly created layer group");
702 func =
RNA_def_function(srna,
"remove",
"rna_GreasePencil_layer_group_remove");
705 func,
"layer_group",
"GreasePencilLayerGroup",
"",
"The layer group to remove");
712 "Keep the children nodes of the group and only delete the group itself");
716 "Move a layer group in the parent layer group or main stack");
718 func,
"layer_group",
"GreasePencilLayerGroup",
"",
"The layer group to move");
725 func =
RNA_def_function(srna,
"move_top",
"rna_GreasePencil_layer_group_move_top");
727 func,
"Move a layer group to the top of the parent layer group or main stack");
729 func,
"layer_group",
"GreasePencilLayerGroup",
"",
"The layer group to move");
733 func =
RNA_def_function(srna,
"move_bottom",
"rna_GreasePencil_layer_group_move_bottom");
735 func,
"Move a layer group to the bottom of the parent layer group or main stack");
737 func,
"layer_group",
"GreasePencilLayerGroup",
"",
"The layer group to move");
742 srna,
"move_to_layer_group",
"rna_GreasePencil_layer_group_move_to_layer_group");
745 func,
"layer_group",
"GreasePencilLayerGroup",
"",
"The layer group to move");
750 "GreasePencilLayerGroup",
752 "The parent layer group the layer group will be moved into (use "
753 "None for the main stack)");
Scene * CTX_data_scene(const bContext *C)
Low-level operations for curves.
Low-level operations for grease pencil.
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void DEG_id_tag_update(ID *id, unsigned int flags)
#define RNA_POINTER_INVALIDATE(ptr)
void update_curve_types()
MutableSpan< int8_t > curve_types_for_write()
bke::CurvesGeometry & strokes_for_write()
void tag_topology_changed()
float wrap(float value, float max, float min)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_function_flag(FunctionRNA *func, int flag)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_api_grease_pencil_drawing(StructRNA *srna)
void RNA_api_grease_pencil_frames(StructRNA *srna)
const EnumPropertyItem rna_enum_tree_node_move_type_items[]
void RNA_api_grease_pencil_layer(StructRNA *srna)
void RNA_api_grease_pencil_layers(StructRNA *srna)
void RNA_api_grease_pencil_layer_groups(StructRNA *srna)
void WM_main_add_notifier(uint type, void *reference)