Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_gpencil.c
| Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | |||||
| # include "WM_api.h" | # include "WM_api.h" | ||||
| # include "BKE_action.h" | # include "BKE_action.h" | ||||
| # include "BKE_animsys.h" | # include "BKE_animsys.h" | ||||
| # include "BKE_gpencil.h" | # include "BKE_gpencil.h" | ||||
| # include "BKE_icons.h" | # include "BKE_icons.h" | ||||
| # include "DEG_depsgraph.h" | # include "DEG_depsgraph.h" | ||||
| # include "DEG_depsgraph_build.h" | |||||
| static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | ||||
| { | { | ||||
| DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY); | ||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | ||||
| } | } | ||||
| static void rna_GPencil_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) | |||||
| { | |||||
| DEG_id_tag_update(ptr->owner_id, ID_RECALC_TRANSFORM); | |||||
| DEG_relations_tag_update(bmain); | |||||
| WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->owner_id); | |||||
| DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY); | |||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | |||||
| } | |||||
| static void rna_GPencil_uv_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | |||||
| { | |||||
| /* Force to recalc the UVs. */ | |||||
| bGPDstroke *gps = (bGPDstroke *)ptr->data; | |||||
| /* Calc geometry data. */ | |||||
| BKE_gpencil_stroke_geometry_update(gps); | |||||
| DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY); | |||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | |||||
| } | |||||
| static void rna_GPencil_autolock(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_GPencil_autolock(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| bGPdata *gpd = (bGPdata *)ptr->owner_id; | bGPdata *gpd = (bGPdata *)ptr->owner_id; | ||||
| BKE_gpencil_layer_autolock_set(gpd, true); | BKE_gpencil_layer_autolock_set(gpd, true); | ||||
| /* standard update */ | /* standard update */ | ||||
| rna_GPencil_update(bmain, scene, ptr); | rna_GPencil_update(bmain, scene, ptr); | ||||
| } | } | ||||
| static void rna_GPencil_editmode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | static void rna_GPencil_editmode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | ||||
| { | { | ||||
| bGPdata *gpd = (bGPdata *)ptr->owner_id; | bGPdata *gpd = (bGPdata *)ptr->owner_id; | ||||
| DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | ||||
| /* Notify all places where GPencil data lives that the editing state is different */ | /* Notify all places where GPencil data lives that the editing state is different */ | ||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | ||||
| WM_main_add_notifier(NC_SCENE | ND_MODE | NC_MOVIECLIP, NULL); | WM_main_add_notifier(NC_SCENE | ND_MODE | NC_MOVIECLIP, NULL); | ||||
| } | } | ||||
| /* Recalc UVs and Fill for all strokes. */ | |||||
| static void rna_GPencil_strokes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) | |||||
| { | |||||
| bGPdata *gpd = (bGPdata *)ptr->owner_id; | |||||
| if (gpd) { | |||||
| for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { | |||||
| for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) { | |||||
| for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { | |||||
| BKE_gpencil_triangulate_stroke_fill(gpd, gps); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Now do standard updates... */ | |||||
| DEG_id_tag_update(ptr->owner_id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); | |||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | |||||
| } | |||||
| /* Poll Callback to filter GP Datablocks to only show those for Annotations */ | /* Poll Callback to filter GP Datablocks to only show those for Annotations */ | ||||
| bool rna_GPencil_datablocks_annotations_poll(PointerRNA *UNUSED(ptr), const PointerRNA value) | bool rna_GPencil_datablocks_annotations_poll(PointerRNA *UNUSED(ptr), const PointerRNA value) | ||||
| { | { | ||||
| bGPdata *gpd = value.data; | bGPdata *gpd = value.data; | ||||
| return (gpd->flag & GP_DATA_ANNOTATIONS) != 0; | return (gpd->flag & GP_DATA_ANNOTATIONS) != 0; | ||||
| } | } | ||||
| /* Poll Callback to filter GP Datablocks to only show those for GP Objects */ | /* Poll Callback to filter GP Datablocks to only show those for GP Objects */ | ||||
| ▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | static void rna_GPencilLayer_parent_bone_set(PointerRNA *ptr, const char *value) | ||||
| Object *par = gpl->parent; | Object *par = gpl->parent; | ||||
| gpl->partype = PARBONE; | gpl->partype = PARBONE; | ||||
| if (par != NULL) { | if (par != NULL) { | ||||
| set_parent(gpl, par, gpl->partype, value); | set_parent(gpl, par, gpl->partype, value); | ||||
| } | } | ||||
| } | } | ||||
| static char *rna_GPencilLayerMask_path(PointerRNA *ptr) | |||||
| { | |||||
| bGPdata *gpd = (bGPdata *)ptr->owner_id; | |||||
| bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); | |||||
| bGPDlayer_Mask *mask = (bGPDlayer_Mask *)ptr->data; | |||||
| char name_layer[sizeof(gpl->info) * 2]; | |||||
| char name_mask[sizeof(mask->name) * 2]; | |||||
| BLI_strescape(name_layer, gpl->info, sizeof(name_layer)); | |||||
| BLI_strescape(name_mask, mask->name, sizeof(name_mask)); | |||||
| return BLI_sprintfN("layers[\"%s\"].mask_layers[\"%s\"]", name_layer, name_mask); | |||||
| } | |||||
| static int rna_GPencil_active_mask_index_get(PointerRNA *ptr) | |||||
| { | |||||
| bGPDlayer *gpl = (bGPDlayer *)ptr->data; | |||||
| return gpl->act_mask - 1; | |||||
| } | |||||
| static void rna_GPencil_active_mask_index_set(PointerRNA *ptr, int value) | |||||
| { | |||||
| bGPDlayer *gpl = (bGPDlayer *)ptr->data; | |||||
| gpl->act_mask = value + 1; | |||||
| } | |||||
| static void rna_GPencil_active_mask_index_range( | |||||
| PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) | |||||
| { | |||||
| bGPDlayer *gpl = (bGPDlayer *)ptr->data; | |||||
| *min = 0; | |||||
| *max = max_ii(0, BLI_listbase_count(&gpl->mask_layers) - 1); | |||||
| } | |||||
| /* parent types enum */ | /* parent types enum */ | ||||
| static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), | static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), | ||||
| PointerRNA *ptr, | PointerRNA *ptr, | ||||
| PropertyRNA *UNUSED(prop), | PropertyRNA *UNUSED(prop), | ||||
| bool *r_free) | bool *r_free) | ||||
| { | { | ||||
| bGPDlayer *gpl = (bGPDlayer *)ptr->data; | bGPDlayer *gpl = (bGPDlayer *)ptr->data; | ||||
| EnumPropertyItem *item = NULL; | EnumPropertyItem *item = NULL; | ||||
| ▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */ | ||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | ||||
| } | } | ||||
| } | } | ||||
| static int rna_GPencil_active_layer_index_get(PointerRNA *ptr) | static int rna_GPencil_active_layer_index_get(PointerRNA *ptr) | ||||
| { | { | ||||
| bGPdata *gpd = (bGPdata *)ptr->owner_id; | bGPdata *gpd = (bGPdata *)ptr->owner_id; | ||||
| bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd); | bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); | ||||
| return BLI_findindex(&gpd->layers, gpl); | return BLI_findindex(&gpd->layers, gpl); | ||||
| } | } | ||||
| static void rna_GPencil_active_layer_index_set(PointerRNA *ptr, int value) | static void rna_GPencil_active_layer_index_set(PointerRNA *ptr, int value) | ||||
| { | { | ||||
| bGPdata *gpd = (bGPdata *)ptr->owner_id; | bGPdata *gpd = (bGPdata *)ptr->owner_id; | ||||
| bGPDlayer *gpl = BLI_findlink(&gpd->layers, value); | bGPDlayer *gpl = BLI_findlink(&gpd->layers, value); | ||||
| BKE_gpencil_layer_setactive(gpd, gpl); | BKE_gpencil_layer_active_set(gpd, gpl); | ||||
| /* Now do standard updates... */ | /* Now do standard updates... */ | ||||
| DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY); | ||||
| WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL); | WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL); | ||||
| } | } | ||||
| static void rna_GPencil_active_layer_index_range( | static void rna_GPencil_active_layer_index_range( | ||||
| PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) | PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax) | ||||
| Show All 23 Lines | static const EnumPropertyItem *rna_GPencil_active_layer_itemf(bContext *C, | ||||
| } | } | ||||
| /* Existing layers */ | /* Existing layers */ | ||||
| for (gpl = gpd->layers.first, i = 0; gpl; gpl = gpl->next, i++) { | for (gpl = gpd->layers.first, i = 0; gpl; gpl = gpl->next, i++) { | ||||
| item_tmp.identifier = gpl->info; | item_tmp.identifier = gpl->info; | ||||
| item_tmp.name = gpl->info; | item_tmp.name = gpl->info; | ||||
| item_tmp.value = i; | item_tmp.value = i; | ||||
| item_tmp.icon = BKE_icon_gplayer_color_ensure(gpl); | item_tmp.icon = (gpd->flag & GP_DATA_ANNOTATIONS) ? BKE_icon_gplayer_color_ensure(gpl) : | ||||
| ICON_GREASEPENCIL; | |||||
| RNA_enum_item_add(&item, &totitem, &item_tmp); | RNA_enum_item_add(&item, &totitem, &item_tmp); | ||||
| } | } | ||||
| RNA_enum_item_end(&item, &totitem); | RNA_enum_item_end(&item, &totitem); | ||||
| *r_free = true; | *r_free = true; | ||||
| return item; | return item; | ||||
| Show All 10 Lines | static void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value) | ||||
| /* copy the new name into the name slot */ | /* copy the new name into the name slot */ | ||||
| BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info)); | BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info)); | ||||
| BLI_uniquename( | BLI_uniquename( | ||||
| &gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); | &gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); | ||||
| /* now fix animation paths */ | /* now fix animation paths */ | ||||
| BKE_animdata_fix_paths_rename_all(&gpd->id, "layers", oldname, gpl->info); | BKE_animdata_fix_paths_rename_all(&gpd->id, "layers", oldname, gpl->info); | ||||
| /* Fix mask layers. */ | |||||
| LISTBASE_FOREACH (bGPDlayer *, gpl_, &gpd->layers) { | |||||
| LISTBASE_FOREACH (bGPDlayer_Mask *, mask, &gpl_->mask_layers) { | |||||
| if (STREQ(mask->name, oldname)) { | |||||
| BLI_strncpy(mask->name, gpl->info, sizeof(mask->name)); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| static void rna_GPencilLayer_mask_info_set(PointerRNA *ptr, const char *value) | |||||
| { | |||||
| bGPdata *gpd = (bGPdata *)ptr->owner_id; | |||||
| bGPDlayer_Mask *mask = ptr->data; | |||||
| char oldname[128] = ""; | |||||
| BLI_strncpy(oldname, mask->name, sizeof(oldname)); | |||||
| /* Really is changing the layer name. */ | |||||
| bGPDlayer *gpl = BKE_gpencil_layer_named_get(gpd, oldname); | |||||
| if (gpl) { | |||||
| /* copy the new name into the name slot */ | |||||
| BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info)); | |||||
| BLI_uniquename( | |||||
| &gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); | |||||
| /* now fix animation paths */ | |||||
| BKE_animdata_fix_paths_rename_all(&gpd->id, "layers", oldname, gpl->info); | |||||
| /* Fix mask layers. */ | |||||
| LISTBASE_FOREACH (bGPDlayer *, gpl_, &gpd->layers) { | |||||
| LISTBASE_FOREACH (bGPDlayer_Mask *, mask_, &gpl_->mask_layers) { | |||||
| if (STREQ(mask_->name, oldname)) { | |||||
| BLI_strncpy(mask_->name, gpl->info, sizeof(mask_->name)); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd, | static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd, | ||||
| const bGPDspoint *pt, | const bGPDspoint *pt, | ||||
| bGPDlayer **r_gpl, | bGPDlayer **r_gpl, | ||||
| bGPDframe **r_gpf) | bGPDframe **r_gpf) | ||||
| { | { | ||||
| bGPDlayer *gpl; | bGPDlayer *gpl; | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | for (int i = 0; i < count; i++) { | ||||
| pt->strength = strength; | pt->strength = strength; | ||||
| dvert->totweight = 0; | dvert->totweight = 0; | ||||
| dvert->dw = NULL; | dvert->dw = NULL; | ||||
| } | } | ||||
| stroke->totpoints += count; | stroke->totpoints += count; | ||||
| stroke->flag |= GP_STROKE_RECALC_GEOMETRY; | /* Calc geometry data. */ | ||||
| BKE_gpencil_stroke_geometry_update(stroke); | |||||
| gpd->flag |= GP_DATA_PYTHON_UPDATED; | gpd->flag |= GP_DATA_PYTHON_UPDATED; | ||||
| DEG_id_tag_update(&gpd->id, | DEG_id_tag_update(&gpd->id, | ||||
| ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); | ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); | ||||
| WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | static void rna_GPencil_stroke_point_pop(ID *id, | ||||
| } | } | ||||
| /* free temp buffer */ | /* free temp buffer */ | ||||
| MEM_freeN(pt_tmp); | MEM_freeN(pt_tmp); | ||||
| if (pt_dvert != NULL) { | if (pt_dvert != NULL) { | ||||
| MEM_freeN(pt_dvert); | MEM_freeN(pt_dvert); | ||||
| } | } | ||||
| stroke->flag |= GP_STROKE_RECALC_GEOMETRY; | /* Calc geometry data. */ | ||||
| BKE_gpencil_stroke_geometry_update(stroke); | |||||
| gpd->flag |= GP_DATA_PYTHON_UPDATED; | gpd->flag |= GP_DATA_PYTHON_UPDATED; | ||||
| DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | 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); | WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | ||||
| } | } | ||||
| static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame) | static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame) | ||||
| { | { | ||||
| bGPDstroke *stroke = MEM_callocN(sizeof(bGPDstroke), "gp_stroke"); | bGPDstroke *stroke = MEM_callocN(sizeof(bGPDstroke), "gp_stroke"); | ||||
| stroke->gradient_f = 1.0f; | stroke->hardeness = 1.0f; | ||||
| ARRAY_SET_ITEMS(stroke->gradient_s, 1.0f, 1.0f); | ARRAY_SET_ITEMS(stroke->aspect_ratio, 1.0f, 1.0f); | ||||
| stroke->uv_scale = 1.0f; | |||||
| BLI_addtail(&frame->strokes, stroke); | BLI_addtail(&frame->strokes, stroke); | ||||
| return stroke; | return stroke; | ||||
| } | } | ||||
| static void rna_GPencil_stroke_remove(bGPDframe *frame, | static void rna_GPencil_stroke_remove(bGPDframe *frame, | ||||
| ReportList *reports, | ReportList *reports, | ||||
| PointerRNA *stroke_ptr) | PointerRNA *stroke_ptr) | ||||
| Show All 17 Lines | |||||
| { | { | ||||
| bGPdata *gpd = (bGPdata *)id; | bGPdata *gpd = (bGPdata *)id; | ||||
| bGPDstroke *stroke = stroke_ptr->data; | bGPDstroke *stroke = stroke_ptr->data; | ||||
| if (BLI_findindex(&frame->strokes, stroke) == -1) { | if (BLI_findindex(&frame->strokes, stroke) == -1) { | ||||
| BKE_report(reports, RPT_ERROR, "Stroke not found in grease pencil frame"); | BKE_report(reports, RPT_ERROR, "Stroke not found in grease pencil frame"); | ||||
| return; | return; | ||||
| } | } | ||||
| BKE_gpencil_close_stroke(stroke); | BKE_gpencil_stroke_close(stroke); | ||||
| DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | 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); | WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | ||||
| } | } | ||||
| static void rna_GPencil_stroke_select_set(PointerRNA *ptr, const bool value) | static void rna_GPencil_stroke_select_set(PointerRNA *ptr, const bool value) | ||||
| { | { | ||||
| bGPDstroke *gps = ptr->data; | bGPDstroke *gps = ptr->data; | ||||
| Show All 21 Lines | |||||
| static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, | static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, | ||||
| ReportList *reports, | ReportList *reports, | ||||
| int frame_number, | int frame_number, | ||||
| bool active) | bool active) | ||||
| { | { | ||||
| bGPDframe *frame; | bGPDframe *frame; | ||||
| if (BKE_gpencil_layer_find_frame(layer, frame_number)) { | if (BKE_gpencil_layer_frame_find(layer, frame_number)) { | ||||
| BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number %d", frame_number); | BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number %d", frame_number); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| frame = BKE_gpencil_frame_addnew(layer, frame_number); | frame = BKE_gpencil_frame_addnew(layer, frame_number); | ||||
| if (active) { | if (active) { | ||||
| layer->actframe = BKE_gpencil_layer_getframe(layer, frame_number, GP_GETFRAME_USE_PREV); | layer->actframe = BKE_gpencil_layer_frame_get(layer, frame_number, GP_GETFRAME_USE_PREV); | ||||
| } | } | ||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | ||||
| return frame; | return frame; | ||||
| } | } | ||||
| static void rna_GPencil_frame_remove(bGPDlayer *layer, ReportList *reports, PointerRNA *frame_ptr) | static void rna_GPencil_frame_remove(bGPDlayer *layer, ReportList *reports, PointerRNA *frame_ptr) | ||||
| { | { | ||||
| bGPDframe *frame = frame_ptr->data; | bGPDframe *frame = frame_ptr->data; | ||||
| if (BLI_findindex(&layer->frames, frame) == -1) { | if (BLI_findindex(&layer->frames, frame) == -1) { | ||||
| BKE_report(reports, RPT_ERROR, "Frame not found in grease pencil layer"); | BKE_report(reports, RPT_ERROR, "Frame not found in grease pencil layer"); | ||||
| return; | return; | ||||
| } | } | ||||
| BKE_gpencil_layer_delframe(layer, frame); | BKE_gpencil_layer_frame_delete(layer, frame); | ||||
| RNA_POINTER_INVALIDATE(frame_ptr); | RNA_POINTER_INVALIDATE(frame_ptr); | ||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | ||||
| } | } | ||||
| static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src) | static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src) | ||||
| { | { | ||||
| bGPDframe *frame = BKE_gpencil_frame_duplicate(src); | bGPDframe *frame = BKE_gpencil_frame_duplicate(src); | ||||
| while (BKE_gpencil_layer_find_frame(layer, frame->framenum)) { | while (BKE_gpencil_layer_frame_find(layer, frame->framenum)) { | ||||
| frame->framenum++; | frame->framenum++; | ||||
| } | } | ||||
| BLI_addtail(&layer->frames, frame); | BLI_addtail(&layer->frames, frame); | ||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | ||||
| return frame; | return frame; | ||||
| Show All 39 Lines | static void rna_GPencil_layer_move(bGPdata *gpd, | ||||
| if (BLI_listbase_link_move(&gpd->layers, gpl, direction)) { | if (BLI_listbase_link_move(&gpd->layers, gpl, direction)) { | ||||
| DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | ||||
| } | } | ||||
| WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | ||||
| } | } | ||||
| static void rna_GPencil_layer_mask_add(bGPDlayer *gpl, PointerRNA *layer_ptr) | |||||
| { | |||||
| bGPDlayer *gpl_mask = layer_ptr->data; | |||||
| BKE_gpencil_layer_mask_add(gpl, gpl_mask->info); | |||||
| WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | |||||
| } | |||||
| static void rna_GPencil_layer_mask_remove(bGPDlayer *gpl, | |||||
| ReportList *reports, | |||||
| PointerRNA *mask_ptr) | |||||
| { | |||||
| bGPDlayer_Mask *mask = mask_ptr->data; | |||||
| if (BLI_findindex(&gpl->mask_layers, mask) == -1) { | |||||
| BKE_report(reports, RPT_ERROR, "Mask not found in mask list"); | |||||
| return; | |||||
| } | |||||
| BKE_gpencil_layer_mask_remove(gpl, mask); | |||||
| RNA_POINTER_INVALIDATE(mask_ptr); | |||||
| WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | |||||
| } | |||||
| static void rna_GPencil_frame_clear(bGPDframe *frame) | static void rna_GPencil_frame_clear(bGPDframe *frame) | ||||
| { | { | ||||
| BKE_gpencil_free_strokes(frame); | BKE_gpencil_free_strokes(frame); | ||||
| WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | ||||
| } | } | ||||
| static void rna_GPencil_layer_clear(bGPDlayer *layer) | static void rna_GPencil_layer_clear(bGPDlayer *layer) | ||||
| ▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_stroke_point(BlenderRNA *brna) | ||||
| RNA_def_property_ui_text(prop, "UV Rotation", "Internal UV factor for dot mode"); | RNA_def_property_ui_text(prop, "UV Rotation", "Internal UV factor for dot mode"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SPOINT_SELECT); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SPOINT_SELECT); | ||||
| RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_stroke_point_select_set"); | RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_stroke_point_select_set"); | ||||
| RNA_def_property_ui_text(prop, "Select", "Point is selected for viewport editing"); | RNA_def_property_ui_text(prop, "Select", "Point is selected for viewport editing"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* Vertex color. */ | |||||
| prop = RNA_def_property(srna, "vertex_color", PROP_FLOAT, PROP_COLOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "vert_color"); | |||||
| RNA_def_property_array(prop, 4); | |||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "Vertex Color", "Color used to mix with point color to get final color"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | |||||
| } | } | ||||
| static void rna_def_gpencil_stroke_points_api(BlenderRNA *brna, PropertyRNA *cprop) | static void rna_def_gpencil_stroke_points_api(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| PropertyRNA *parm; | PropertyRNA *parm; | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_triangle(BlenderRNA *brna) | ||||
| RNA_def_property_ui_text(prop, "v2", "Second triangle vertex index"); | RNA_def_property_ui_text(prop, "v2", "Second triangle vertex index"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| /* point v3 */ | /* point v3 */ | ||||
| prop = RNA_def_property(srna, "v3", PROP_INT, PROP_NONE); | prop = RNA_def_property(srna, "v3", PROP_INT, PROP_NONE); | ||||
| RNA_def_property_int_sdna(prop, NULL, "verts[2]"); | RNA_def_property_int_sdna(prop, NULL, "verts[2]"); | ||||
| RNA_def_property_ui_text(prop, "v3", "Third triangle vertex index"); | RNA_def_property_ui_text(prop, "v3", "Third triangle vertex index"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| /* texture coord for point v1 */ | |||||
| prop = RNA_def_property(srna, "uv1", PROP_FLOAT, PROP_COORDS); | |||||
| RNA_def_property_float_sdna(prop, NULL, "uv[0]"); | |||||
| RNA_def_property_array(prop, 2); | |||||
| RNA_def_property_ui_text(prop, "uv1", "First triangle vertex texture coordinates"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| /* texture coord for point v2 */ | |||||
| prop = RNA_def_property(srna, "uv2", PROP_FLOAT, PROP_COORDS); | |||||
| RNA_def_property_float_sdna(prop, NULL, "uv[1]"); | |||||
| RNA_def_property_array(prop, 2); | |||||
| RNA_def_property_ui_text(prop, "uv2", "Second triangle vertex texture coordinates"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| /* texture coord for point v3 */ | |||||
| prop = RNA_def_property(srna, "uv3", PROP_FLOAT, PROP_COORDS); | |||||
| RNA_def_property_float_sdna(prop, NULL, "uv[2]"); | |||||
| RNA_def_property_array(prop, 2); | |||||
| RNA_def_property_ui_text(prop, "uv3", "Third triangle vertex texture coordinates"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| } | } | ||||
| static void rna_def_gpencil_mvert_group(BlenderRNA *brna) | static void rna_def_gpencil_mvert_group(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| srna = RNA_def_struct(brna, "GpencilVertexGroupElement", NULL); | srna = RNA_def_struct(brna, "GpencilVertexGroupElement", NULL); | ||||
| ▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_stroke(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "line_width", PROP_INT, PROP_PIXEL); | prop = RNA_def_property(srna, "line_width", PROP_INT, PROP_PIXEL); | ||||
| RNA_def_property_int_sdna(prop, NULL, "thickness"); | RNA_def_property_int_sdna(prop, NULL, "thickness"); | ||||
| RNA_def_property_range(prop, 1, 1000); | RNA_def_property_range(prop, 1, 1000); | ||||
| RNA_def_property_ui_range(prop, 1, 10, 1, 0); | RNA_def_property_ui_range(prop, 1, 10, 1, 0); | ||||
| RNA_def_property_ui_text(prop, "Thickness", "Thickness of stroke (in pixels)"); | RNA_def_property_ui_text(prop, "Thickness", "Thickness of stroke (in pixels)"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* gradient control along y */ | /* gradient control along y */ | ||||
| prop = RNA_def_property(srna, "gradient_factor", PROP_FLOAT, PROP_FACTOR); | prop = RNA_def_property(srna, "hardeness", PROP_FLOAT, PROP_FACTOR); | ||||
| RNA_def_property_float_sdna(prop, NULL, "gradient_f"); | RNA_def_property_float_sdna(prop, NULL, "hardeness"); | ||||
| RNA_def_property_range(prop, 0.001f, 1.0f); | RNA_def_property_range(prop, 0.001f, 1.0f); | ||||
| RNA_def_property_float_default(prop, 1.0f); | RNA_def_property_float_default(prop, 1.0f); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text(prop, "Hardeness", "Amount of gradient along section of stroke"); | ||||
| prop, "Border Opacity Factor", "Amount of gradient along section of stroke"); | |||||
| RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* Stroke bound box */ | |||||
| prop = RNA_def_property(srna, "bound_box_min", PROP_FLOAT, PROP_XYZ); | |||||
| RNA_def_property_float_sdna(prop, NULL, "boundbox_min"); | |||||
| RNA_def_property_array(prop, 3); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_ui_text(prop, "Boundbox Min", ""); | |||||
| prop = RNA_def_property(srna, "bound_box_max", PROP_FLOAT, PROP_XYZ); | |||||
| RNA_def_property_float_sdna(prop, NULL, "boundbox_max"); | |||||
| RNA_def_property_array(prop, 3); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_ui_text(prop, "Boundbox Max", ""); | |||||
| /* gradient shape ratio */ | /* gradient shape ratio */ | ||||
| prop = RNA_def_property(srna, "gradient_shape", PROP_FLOAT, PROP_XYZ); | prop = RNA_def_property(srna, "aspect", PROP_FLOAT, PROP_XYZ); | ||||
| RNA_def_property_float_sdna(prop, NULL, "gradient_s"); | RNA_def_property_float_sdna(prop, NULL, "aspect_ratio"); | ||||
| RNA_def_property_array(prop, 2); | RNA_def_property_array(prop, 2); | ||||
| RNA_def_property_range(prop, 0.01f, 1.0f); | RNA_def_property_range(prop, 0.01f, 1.0f); | ||||
| RNA_def_property_float_default(prop, 1.0f); | RNA_def_property_float_default(prop, 1.0f); | ||||
| RNA_def_property_ui_text(prop, "Aspect Ratio", ""); | RNA_def_property_ui_text(prop, "Aspect", ""); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | |||||
| /* UV translation. */ | |||||
| prop = RNA_def_property(srna, "uv_translation", PROP_FLOAT, PROP_XYZ); | |||||
| RNA_def_property_float_sdna(prop, NULL, "uv_translation"); | |||||
| RNA_def_property_array(prop, 2); | |||||
| RNA_def_property_float_default(prop, 0.0f); | |||||
| RNA_def_property_ui_text(prop, "UV Translation", "Translation of default UV postion"); | |||||
| RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_uv_update"); | |||||
| /* UV rotation. */ | |||||
| prop = RNA_def_property(srna, "uv_rotation", PROP_FLOAT, PROP_ANGLE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "uv_rotation"); | |||||
| RNA_def_property_float_default(prop, 0.0f); | |||||
| RNA_def_property_ui_text(prop, "UV Rotation", "Rotation of the UV"); | |||||
| RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_uv_update"); | |||||
| /* UV scale. */ | |||||
| prop = RNA_def_property(srna, "uv_scale", PROP_FLOAT, PROP_NONE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "uv_scale"); | |||||
| RNA_def_property_float_default(prop, 1.0f); | |||||
| RNA_def_property_range(prop, 0.01f, 100.0f); | |||||
| RNA_def_property_ui_text(prop, "UV Scale", "Scale of the UV"); | |||||
| RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_uv_update"); | |||||
| /* Vertex Color for Fill. */ | |||||
| prop = RNA_def_property(srna, "vertex_color_fill", PROP_FLOAT, PROP_COLOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "vert_color_fill"); | |||||
| RNA_def_property_array(prop, 4); | |||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "Vertex Fill Color", "Color used to mix with fill color to get final color"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| } | } | ||||
| static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop) | static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| ▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_frames_api(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| func = RNA_def_function(srna, "copy", "rna_GPencil_frame_copy"); | func = RNA_def_function(srna, "copy", "rna_GPencil_frame_copy"); | ||||
| RNA_def_function_ui_description(func, "Copy a grease pencil frame"); | RNA_def_function_ui_description(func, "Copy a grease pencil frame"); | ||||
| parm = RNA_def_pointer(func, "source", "GPencilFrame", "Source", "The source frame"); | parm = RNA_def_pointer(func, "source", "GPencilFrame", "Source", "The source frame"); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "copy", "GPencilFrame", "", "The newly copied frame"); | parm = RNA_def_pointer(func, "copy", "GPencilFrame", "", "The newly copied frame"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| } | } | ||||
| static void rna_def_gpencil_layers_mask_api(BlenderRNA *brna, PropertyRNA *cprop) | |||||
| { | |||||
| StructRNA *srna; | |||||
| PropertyRNA *prop; | |||||
| FunctionRNA *func; | |||||
| PropertyRNA *parm; | |||||
| RNA_def_property_srna(cprop, "GreasePencilMaskLayers"); | |||||
| srna = RNA_def_struct(brna, "GreasePencilMaskLayers", NULL); | |||||
| RNA_def_struct_sdna(srna, "bGPDlayer"); | |||||
| RNA_def_struct_ui_text( | |||||
| srna, "Grease Pencil Mask Layers", "Collection of grease pencil masking layers"); | |||||
| prop = RNA_def_property(srna, "active_mask_index", PROP_INT, PROP_UNSIGNED); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_int_funcs(prop, | |||||
| "rna_GPencil_active_mask_index_get", | |||||
| "rna_GPencil_active_mask_index_set", | |||||
| "rna_GPencil_active_mask_index_range"); | |||||
| RNA_def_property_ui_text(prop, "Active Layer Mask Index", "Active index in layer mask array"); | |||||
| func = RNA_def_function(srna, "add", "rna_GPencil_layer_mask_add"); | |||||
| RNA_def_function_ui_description(func, "Add a layer to mask list"); | |||||
| parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "Layer to add as mask"); | |||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | |||||
| RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | |||||
| func = RNA_def_function(srna, "remove", "rna_GPencil_layer_mask_remove"); | |||||
| RNA_def_function_ui_description(func, "Remove a layer from mask list"); | |||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS); | |||||
| parm = RNA_def_pointer(func, "mask", "GPencilLayerMask", "", "Mask to remove"); | |||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | |||||
| RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | |||||
| } | |||||
| static void rna_def_gpencil_layer_mask(BlenderRNA *brna) | |||||
| { | |||||
| StructRNA *srna; | |||||
| PropertyRNA *prop; | |||||
| srna = RNA_def_struct(brna, "GPencilLayerMask", NULL); | |||||
| RNA_def_struct_sdna(srna, "bGPDlayer_Mask"); | |||||
| RNA_def_struct_ui_text(srna, "Grease Pencil Masking Layers", "List of Mask Layers"); | |||||
| RNA_def_struct_path_func(srna, "rna_GPencilLayerMask_path"); | |||||
| /* Name */ | |||||
| prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | |||||
| RNA_def_property_ui_text(prop, "Layer", "Mask layer name"); | |||||
| RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_mask_info_set"); | |||||
| RNA_def_struct_name_property(srna, prop); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_RENAME, NULL); | |||||
| /* Flags */ | |||||
| prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MASK_HIDE); | |||||
| RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1); | |||||
| RNA_def_property_ui_text(prop, "Hide", "Set mask Visibility"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | |||||
| prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MASK_INVERT); | |||||
| RNA_def_property_ui_icon(prop, ICON_CLIPUV_HLT, -1); | |||||
| RNA_def_property_ui_text(prop, "Invert", "Invert mask"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | |||||
| } | |||||
| static void rna_def_gpencil_layer(BlenderRNA *brna) | static void rna_def_gpencil_layer(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | FunctionRNA *func; | ||||
| static const float default_onion_color_b[] = {0.302f, 0.851f, 0.302f}; | static const float default_onion_color_b[] = {0.302f, 0.851f, 0.302f}; | ||||
| static const float default_onion_color_a[] = {0.250f, 0.1f, 1.0f}; | static const float default_onion_color_a[] = {0.250f, 0.1f, 1.0f}; | ||||
| Show All 12 Lines | static void rna_def_gpencil_layer(BlenderRNA *brna) | ||||
| /* Frames */ | /* Frames */ | ||||
| prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE); | prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE); | ||||
| RNA_def_property_collection_sdna(prop, NULL, "frames", NULL); | RNA_def_property_collection_sdna(prop, NULL, "frames", NULL); | ||||
| RNA_def_property_struct_type(prop, "GPencilFrame"); | RNA_def_property_struct_type(prop, "GPencilFrame"); | ||||
| RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames"); | RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames"); | ||||
| rna_def_gpencil_frames_api(brna, prop); | rna_def_gpencil_frames_api(brna, prop); | ||||
| /* Mask Layers */ | |||||
| prop = RNA_def_property(srna, "mask_layers", PROP_COLLECTION, PROP_NONE); | |||||
| RNA_def_property_collection_sdna(prop, NULL, "mask_layers", NULL); | |||||
| RNA_def_property_struct_type(prop, "GPencilLayerMask"); | |||||
| RNA_def_property_ui_text(prop, "Masks", "List of Masking Layers"); | |||||
| rna_def_gpencil_layers_mask_api(brna, prop); | |||||
| /* Active Frame */ | /* Active Frame */ | ||||
| prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "actframe"); | RNA_def_property_pointer_sdna(prop, NULL, "actframe"); | ||||
| RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer"); | RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer"); | ||||
| RNA_def_property_editable_func(prop, "rna_GPencilLayer_active_frame_editable"); | RNA_def_property_editable_func(prop, "rna_GPencilLayer_active_frame_editable"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); | ||||
| /* Layer Opacity */ | /* Layer Opacity */ | ||||
| Show All 25 Lines | static void rna_def_gpencil_layer(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_PIXEL); | prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_PIXEL); | ||||
| RNA_def_property_int_sdna(prop, NULL, "thickness"); | RNA_def_property_int_sdna(prop, NULL, "thickness"); | ||||
| RNA_def_property_range(prop, 1, 10); | RNA_def_property_range(prop, 1, 10); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | ||||
| RNA_def_property_ui_text(prop, "Thickness", "Thickness of annotation strokes"); | RNA_def_property_ui_text(prop, "Thickness", "Thickness of annotation strokes"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* Tint Color */ | /* Tint Color */ | ||||
| prop = RNA_def_property(srna, "tint_color", PROP_FLOAT, PROP_COLOR_GAMMA); | prop = RNA_def_property(srna, "tint_color", PROP_FLOAT, PROP_COLOR); | ||||
| RNA_def_property_float_sdna(prop, NULL, "tintcolor"); | RNA_def_property_float_sdna(prop, NULL, "tintcolor"); | ||||
| RNA_def_property_array(prop, 3); | RNA_def_property_array(prop, 3); | ||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | RNA_def_property_range(prop, 0.0f, 1.0f); | ||||
| RNA_def_property_ui_text(prop, "Tint Color", "Color for tinting stroke colors"); | RNA_def_property_ui_text(prop, "Tint Color", "Color for tinting stroke colors"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* Tint factor */ | /* Tint factor */ | ||||
| prop = RNA_def_property(srna, "tint_factor", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "tint_factor", PROP_FLOAT, PROP_FACTOR); | ||||
| RNA_def_property_float_sdna(prop, NULL, "tintcolor[3]"); | RNA_def_property_float_sdna(prop, NULL, "tintcolor[3]"); | ||||
| RNA_def_property_range(prop, 0.0, 1.0f); | RNA_def_property_range(prop, 0.0, 1.0f); | ||||
| RNA_def_property_ui_text(prop, "Tint Factor", "Factor of tinting color"); | RNA_def_property_ui_text(prop, "Tint Factor", "Factor of tinting color"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* Vertex Paint opacity factor */ | |||||
| prop = RNA_def_property(srna, "vertex_paint_opacity", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "vertex_paint_opacity"); | |||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | |||||
| RNA_def_property_float_default(prop, 1.0f); | |||||
| RNA_def_property_ui_text(prop, "Vertex Paint Opacity", "Vertex Paint mix factor"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | |||||
| /* Line Thickness Change */ | /* Line Thickness Change */ | ||||
| prop = RNA_def_property(srna, "line_change", PROP_INT, PROP_PIXEL); | prop = RNA_def_property(srna, "line_change", PROP_INT, PROP_PIXEL); | ||||
| RNA_def_property_int_sdna(prop, NULL, "line_change"); | RNA_def_property_int_sdna(prop, NULL, "line_change"); | ||||
| RNA_def_property_range(prop, -300, 300); | RNA_def_property_range(prop, -300, 300); | ||||
| RNA_def_property_ui_range(prop, -100, 100, 1.0, 1); | RNA_def_property_ui_range(prop, -100, 100, 1.0, 1); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Thickness Change", "Thickness change to apply to current strokes (in pixels)"); | prop, "Thickness Change", "Thickness change to apply to current strokes (in pixels)"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| ▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_layer(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "lock_material", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "lock_material", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_UNLOCK_COLOR); | RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_UNLOCK_COLOR); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Disallow Locked Materials Editing", "Avoids editing locked materials in the layer"); | prop, "Disallow Locked Materials Editing", "Avoids editing locked materials in the layer"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); | ||||
| prop = RNA_def_property(srna, "mask_layer", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_mask_layer", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_USE_MASK); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_USE_MASK); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | ||||
| RNA_def_property_ui_text(prop, "Mask Layer", "Mask pixels from underlying layers drawing"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | |||||
| prop = RNA_def_property(srna, "use_lights", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_USE_LIGHTS); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Mask Layer", "Remove any pixel outside underlying layers drawing"); | prop, "Use Lights", "Enable the use of lights on stroke and fill materials"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* solo mode: Only display frames with keyframe */ | /* solo mode: Only display frames with keyframe */ | ||||
| prop = RNA_def_property(srna, "use_solo_mode", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_solo_mode", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SOLO_MODE); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SOLO_MODE); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Solo Mode", "In Paint mode display only layers with keyframe in current frame"); | prop, "Solo Mode", "In Paint mode display only layers with keyframe in current frame"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* Layer is used as Ruler. */ | /* Layer is used as Ruler. */ | ||||
| prop = RNA_def_property(srna, "is_ruler", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_ruler", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_IS_RULER); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_IS_RULER); | ||||
| RNA_def_property_ui_text(prop, "Ruler", "This is a special ruler layer"); | RNA_def_property_ui_text(prop, "Ruler", "This is a special ruler layer"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| /* exposed as layers.active */ | |||||
| # if 0 | |||||
| prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE); | |||||
| RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set"); | |||||
| RNA_def_property_ui_text(prop, "Active", "Set active layer for editing"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL); | |||||
| # endif | |||||
| prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT); | ||||
| RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet"); | RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)"); | prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* In Front */ | /* In Front */ | ||||
| prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY); | RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY); | ||||
| RNA_def_property_ui_text(prop, "In Front", "Make the layer draw in front of objects"); | RNA_def_property_ui_text(prop, "In Front", "Make the layer draw in front of objects"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* Parent object */ | /* Parent object */ | ||||
| prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_funcs(prop, NULL, "rna_GPencilLayer_parent_set", NULL, NULL); | RNA_def_property_pointer_funcs(prop, NULL, "rna_GPencilLayer_parent_set", NULL, NULL); | ||||
| RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); | RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); | ||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); | RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); | ||||
| RNA_def_property_ui_text(prop, "Parent", "Parent Object"); | RNA_def_property_ui_text(prop, "Parent", "Parent Object"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_dependency_update"); | ||||
| /* parent type */ | /* parent type */ | ||||
| prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype"); | RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype"); | ||||
| RNA_def_property_enum_items(prop, parent_type_items); | RNA_def_property_enum_items(prop, parent_type_items); | ||||
| RNA_def_property_enum_funcs( | RNA_def_property_enum_funcs( | ||||
| prop, NULL, "rna_GPencilLayer_parent_type_set", "rna_Object_parent_type_itemf"); | prop, NULL, "rna_GPencilLayer_parent_type_set", "rna_Object_parent_type_itemf"); | ||||
| RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation"); | RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation"); | ||||
| ▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_data(BlenderRNA *brna) | ||||
| RNA_def_property_collection_funcs( | RNA_def_property_collection_funcs( | ||||
| prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int"); | prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int"); | ||||
| /* Depth */ | /* Depth */ | ||||
| prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "draw_mode"); | RNA_def_property_enum_sdna(prop, NULL, "draw_mode"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_gpencil_stroke_depth_order_items); | RNA_def_property_enum_items(prop, rna_enum_gpencil_stroke_depth_order_items); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Stroke Depth Order", "Defines how the strokes are ordered in 3D space"); | prop, | ||||
| "Stroke Depth Order", | |||||
| "Defines how the strokes are ordered in 3D space (for objects not displayed 'In Front')"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| /* Flags */ | /* Flags */ | ||||
| prop = RNA_def_property(srna, "use_stroke_edit_mode", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_stroke_edit_mode", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_EDITMODE); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_EDITMODE); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Stroke Edit Mode", "Edit Grease Pencil strokes instead of viewport data"); | prop, "Stroke Edit Mode", "Edit Grease Pencil strokes instead of viewport data"); | ||||
| RNA_def_property_update( | RNA_def_property_update( | ||||
| Show All 16 Lines | static void rna_def_gpencil_data(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "is_stroke_weight_mode", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_stroke_weight_mode", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_WEIGHTMODE); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_WEIGHTMODE); | ||||
| RNA_def_property_ui_text(prop, "Stroke Weight Paint Mode", "Grease Pencil weight paint"); | RNA_def_property_ui_text(prop, "Stroke Weight Paint Mode", "Grease Pencil weight paint"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_update( | RNA_def_property_update( | ||||
| prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update"); | prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update"); | ||||
| prop = RNA_def_property(srna, "is_stroke_vertex_mode", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_VERTEXMODE); | |||||
| RNA_def_property_ui_text(prop, "Stroke Vertex Paint Mode", "Grease Pencil vertex paint"); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_update( | |||||
| prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update"); | |||||
| prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_ONIONSKINS); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_ONIONSKINS); | ||||
| RNA_def_property_boolean_default(prop, true); | RNA_def_property_boolean_default(prop, true); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Onion Skins", "Show ghosts of the keyframes before and after the current frame"); | prop, "Onion Skins", "Show ghosts of the keyframes before and after the current frame"); | ||||
| RNA_def_property_update( | RNA_def_property_update( | ||||
| prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update"); | prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "show_stroke_direction", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_DIRECTION); | |||||
| RNA_def_property_ui_text(prop, | |||||
| "Show Direction", | |||||
| "Show stroke drawing direction with a bigger green dot (start) " | |||||
| "and smaller red dot (end) points"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | |||||
| prop = RNA_def_property(srna, "stroke_thickness_space", PROP_ENUM, PROP_NONE); /* as an enum */ | prop = RNA_def_property(srna, "stroke_thickness_space", PROP_ENUM, PROP_NONE); /* as an enum */ | ||||
| RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); | RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); | ||||
| RNA_def_property_enum_items(prop, stroke_thickness_items); | RNA_def_property_enum_items(prop, stroke_thickness_items); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Stroke Thickness", "Set stroke thickness in screen space or world space"); | prop, "Stroke Thickness", "Set stroke thickness in screen space or world space"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "pixel_factor", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "pixel_factor", PROP_FLOAT, PROP_NONE); | ||||
| Show All 9 Lines | static void rna_def_gpencil_data(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "use_multiedit", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_multiedit", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_MULTIEDIT); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_MULTIEDIT); | ||||
| RNA_def_property_ui_text(prop, | RNA_def_property_ui_text(prop, | ||||
| "MultiFrame", | "MultiFrame", | ||||
| "Edit strokes from multiple grease pencil keyframes at the same time " | "Edit strokes from multiple grease pencil keyframes at the same time " | ||||
| "(keyframes must be selected to be included)"); | "(keyframes must be selected to be included)"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "use_force_fill_recalc", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_FORCE_RECALC); | |||||
| RNA_def_property_ui_text( | |||||
| prop, | |||||
| "Force Fill Update", | |||||
| "Force recalc of fill data after use deformation modifiers (reduce FPS)"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | |||||
| prop = RNA_def_property(srna, "use_adaptive_uv", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_UV_ADAPTIVE); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "Adaptive UV", "Automatic UVs are calculated depending of the stroke size"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_strokes_update"); | |||||
| prop = RNA_def_property(srna, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_AUTOLOCK_LAYERS); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_AUTOLOCK_LAYERS); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, | prop, | ||||
| "Autolock Layers", | "Autolock Layers", | ||||
| "Lock automatically all layers except active one to avoid accidental changes"); | "Lock automatically all layers except active one to avoid accidental changes"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_autolock"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_autolock"); | ||||
| Show All 30 Lines | static void rna_def_gpencil_data(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "use_ghost_custom_colors", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_ghost_custom_colors", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna( | RNA_def_property_boolean_sdna( | ||||
| prop, NULL, "onion_flag", GP_ONION_GHOST_PREVCOL | GP_ONION_GHOST_NEXTCOL); | prop, NULL, "onion_flag", GP_ONION_GHOST_PREVCOL | GP_ONION_GHOST_NEXTCOL); | ||||
| RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | ||||
| RNA_def_property_ui_text(prop, "Use Custom Ghost Colors", "Use custom colors for ghost frames"); | RNA_def_property_ui_text(prop, "Use Custom Ghost Colors", "Use custom colors for ghost frames"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "before_color", PROP_FLOAT, PROP_COLOR_GAMMA); | prop = RNA_def_property(srna, "before_color", PROP_FLOAT, PROP_COLOR); | ||||
| RNA_def_property_float_sdna(prop, NULL, "gcolor_prev"); | RNA_def_property_float_sdna(prop, NULL, "gcolor_prev"); | ||||
| RNA_def_property_array(prop, 3); | RNA_def_property_array(prop, 3); | ||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | RNA_def_property_range(prop, 0.0f, 1.0f); | ||||
| RNA_def_property_float_array_default(prop, onion_dft1); | RNA_def_property_float_array_default(prop, onion_dft1); | ||||
| RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame"); | RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame"); | ||||
| RNA_def_property_update( | RNA_def_property_update( | ||||
| prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update"); | prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "after_color", PROP_FLOAT, PROP_COLOR_GAMMA); | prop = RNA_def_property(srna, "after_color", PROP_FLOAT, PROP_COLOR); | ||||
| RNA_def_property_float_sdna(prop, NULL, "gcolor_next"); | RNA_def_property_float_sdna(prop, NULL, "gcolor_next"); | ||||
| RNA_def_property_array(prop, 3); | RNA_def_property_array(prop, 3); | ||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | RNA_def_property_range(prop, 0.0f, 1.0f); | ||||
| RNA_def_property_float_array_default(prop, onion_dft2); | RNA_def_property_float_array_default(prop, onion_dft2); | ||||
| RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame"); | RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame"); | ||||
| RNA_def_property_update( | RNA_def_property_update( | ||||
| prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update"); | prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update"); | ||||
| Show All 25 Lines | static void rna_def_gpencil_data(BlenderRNA *brna) | ||||
| RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Fade", "Display onion keyframes with a fade in color transparency"); | prop, "Fade", "Display onion keyframes with a fade in color transparency"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "use_onion_loop", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_onion_loop", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_LOOP); | RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_LOOP); | ||||
| RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | ||||
| RNA_def_property_ui_text(prop, | RNA_def_property_ui_text( | ||||
| "Loop", | prop, "Show Start Frame", "Display onion keyframes for looping animations"); | ||||
| "Display first onion keyframes using next frame color to show " | |||||
| "indication of loop start frame"); | |||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "onion_factor", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "onion_factor", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_float_sdna(prop, NULL, "onion_factor"); | RNA_def_property_float_sdna(prop, NULL, "onion_factor"); | ||||
| RNA_def_property_float_default(prop, 0.5f); | RNA_def_property_float_default(prop, 0.5f); | ||||
| RNA_def_property_range(prop, 0.0, 1.0f); | RNA_def_property_range(prop, 0.0, 1.0f); | ||||
| RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); | ||||
| RNA_def_property_ui_text(prop, "Onion Opacity", "Change fade opacity of displayed onion frames"); | RNA_def_property_ui_text(prop, "Onion Opacity", "Change fade opacity of displayed onion frames"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "zdepth_offset", PROP_FLOAT, PROP_NONE); | prop = RNA_def_property(srna, "zdepth_offset", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_float_sdna(prop, NULL, "zdepth_offset"); | RNA_def_property_float_sdna(prop, NULL, "zdepth_offset"); | ||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | RNA_def_property_range(prop, 0.0f, 1.0f); | ||||
| RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3); | RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3); | ||||
| RNA_def_property_float_default(prop, 0.150f); | |||||
| RNA_def_property_ui_text(prop, "Surface Offset", "Offset amount when drawing in surface mode"); | RNA_def_property_ui_text(prop, "Surface Offset", "Offset amount when drawing in surface mode"); | ||||
| RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "is_annotation", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_annotation", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_ANNOTATIONS); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_ANNOTATIONS); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_ui_text(prop, "Annotation", "Current datablock is an annotation"); | RNA_def_property_ui_text(prop, "Annotation", "Current datablock is an annotation"); | ||||
| Show All 13 Lines | |||||
| /* --- */ | /* --- */ | ||||
| void RNA_def_gpencil(BlenderRNA *brna) | void RNA_def_gpencil(BlenderRNA *brna) | ||||
| { | { | ||||
| rna_def_gpencil_data(brna); | rna_def_gpencil_data(brna); | ||||
| rna_def_gpencil_layer(brna); | rna_def_gpencil_layer(brna); | ||||
| rna_def_gpencil_layer_mask(brna); | |||||
| rna_def_gpencil_frame(brna); | rna_def_gpencil_frame(brna); | ||||
| rna_def_gpencil_stroke(brna); | rna_def_gpencil_stroke(brna); | ||||
| rna_def_gpencil_stroke_point(brna); | rna_def_gpencil_stroke_point(brna); | ||||
| rna_def_gpencil_triangle(brna); | rna_def_gpencil_triangle(brna); | ||||
| rna_def_gpencil_mvert_group(brna); | rna_def_gpencil_mvert_group(brna); | ||||
| } | } | ||||
| #endif | #endif | ||||