Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_gpencil.c
| Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | |||||
| # include "DEG_depsgraph_build.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_GpencilLayerMatrix_update(Main *bmain, Scene *scene, PointerRNA *ptr) | |||||
| { | |||||
| bGPDlayer *gpl = (bGPDlayer *)ptr->data; | |||||
| loc_eul_size_to_mat4(gpl->layer_mat, gpl->location, gpl->rotation, gpl->scale); | |||||
| invert_m4_m4(gpl->layer_invmat, gpl->layer_mat); | |||||
| rna_GPencil_update(bmain, scene, ptr); | |||||
| } | |||||
| static void rna_GPencil_curve_edit_mode_toggle(Main *bmain, Scene *scene, PointerRNA *ptr) | static void rna_GPencil_curve_edit_mode_toggle(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| { | { | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| bGPdata *gpd = (bGPdata *)ptr->owner_id; | bGPdata *gpd = (bGPdata *)ptr->owner_id; | ||||
| /* Curve edit mode is turned on. */ | /* Curve edit mode is turned on. */ | ||||
| if (GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)) { | if (GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)) { | ||||
| /* If the current select mode is segment and the Bezier mode is on, change | /* If the current select mode is segment and the Bezier mode is on, change | ||||
| ▲ Show 20 Lines • Show All 742 Lines • ▼ Show 20 Lines | static void rna_GPencil_frame_remove(bGPDlayer *layer, ReportList *reports, PointerRNA *frame_ptr) | ||||
| BKE_gpencil_layer_frame_delete(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, true); | ||||
| while (BKE_gpencil_layer_frame_find(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); | ||||
| ▲ Show 20 Lines • Show All 1,055 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_layer(BlenderRNA *brna) | ||||
| /* blend mode */ | /* blend mode */ | ||||
| prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "blend_mode"); | RNA_def_property_enum_sdna(prop, NULL, "blend_mode"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_layer_blend_modes_items); | RNA_def_property_enum_items(prop, rna_enum_layer_blend_modes_items); | ||||
| RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode"); | RNA_def_property_ui_text(prop, "Blend Mode", "Blend 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"); | ||||
| /* Layer transforms. */ | |||||
| prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); | |||||
| RNA_def_property_float_sdna(prop, NULL, "location"); | |||||
| RNA_def_property_ui_text(prop, "Location", "Values for change location"); | |||||
| RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); | |||||
| RNA_def_property_update(prop, 0, "rna_GpencilLayerMatrix_update"); | |||||
| prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); | |||||
| RNA_def_property_float_sdna(prop, NULL, "rotation"); | |||||
| RNA_def_property_ui_text(prop, "Rotation", "Values for changes in rotation"); | |||||
| RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); | |||||
| RNA_def_property_update(prop, 0, "rna_GpencilLayerMatrix_update"); | |||||
| prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); | |||||
| RNA_def_property_float_sdna(prop, NULL, "scale"); | |||||
| RNA_def_property_float_default(prop, 1.0f); | |||||
| RNA_def_property_ui_text(prop, "Scale", "Values for changes in scale"); | |||||
| RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); | |||||
| RNA_def_property_update(prop, 0, "rna_GpencilLayerMatrix_update"); | |||||
| /* Layer matrix. */ | |||||
| prop = RNA_def_property(srna, "matrix_layer", PROP_FLOAT, PROP_MATRIX); | |||||
| RNA_def_property_float_sdna(prop, NULL, "layer_mat"); | |||||
| RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); | |||||
| RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); | |||||
| RNA_def_property_ui_text(prop, "Matrix Layer", "Local Layer transformation matrix"); | |||||
| /* Layer inverse matrix. */ | |||||
| prop = RNA_def_property(srna, "matrix_inverse_layer", PROP_FLOAT, PROP_MATRIX); | |||||
| RNA_def_property_float_sdna(prop, NULL, "layer_invmat"); | |||||
| RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); | |||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | |||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON); | |||||
| RNA_def_property_override_clear_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "Matrix Layer Inverse", "Local Layer transformation inverse matrix"); | |||||
| /* Flags */ | /* Flags */ | ||||
| prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE); | ||||
| RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1); | RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1); | ||||
| RNA_def_property_ui_text(prop, "Hide", "Set layer Visibility"); | RNA_def_property_ui_text(prop, "Hide", "Set layer Visibility"); | ||||
| 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, "annotation_hide", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "annotation_hide", PROP_BOOLEAN, PROP_NONE); | ||||
| ▲ Show 20 Lines • Show All 553 Lines • Show Last 20 Lines | |||||