Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_context.c
| Context not available. | |||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_brush_types.h" | |||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "DNA_sequence_types.h" | #include "DNA_sequence_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| Context not available. | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BKE_brush.h" | |||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_action.h" | #include "BKE_action.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_paint.h" | |||||
| #include "BKE_main.h" | |||||
| #include "BKE_gpencil.h" | #include "BKE_gpencil.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| Context not available. | |||||
| "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */ | "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */ | ||||
| "gpencil_data", "gpencil_data_owner", /* grease pencil data */ | "gpencil_data", "gpencil_data_owner", /* grease pencil data */ | ||||
| "visible_gpencil_layers", "editable_gpencil_layers", "editable_gpencil_strokes", | "visible_gpencil_layers", "editable_gpencil_layers", "editable_gpencil_strokes", | ||||
| "active_gpencil_layer", "active_gpencil_frame", "active_gpencil_palette", | "active_gpencil_layer", "active_gpencil_frame", "active_gpencil_brush", | ||||
| "active_gpencil_palettecolor", "active_gpencil_brush", | |||||
| "active_operator", "selected_editable_fcurves", | "active_operator", "selected_editable_fcurves", | ||||
| NULL}; | NULL}; | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (CTX_data_equals(member, "active_gpencil_palette")) { | |||||
| /* XXX: see comment for gpencil_data case... */ | |||||
| bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact); | |||||
| if (gpd) { | |||||
| bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd); | |||||
| if (palette) { | |||||
| CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilPalette, palette); | |||||
| return 1; | |||||
| } | |||||
| } | |||||
| } | |||||
| else if (CTX_data_equals(member, "active_gpencil_palettecolor")) { | |||||
| /* XXX: see comment for gpencil_data case... */ | |||||
| bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact); | |||||
| if (gpd) { | |||||
| bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd); | |||||
| if (palette) { | |||||
| bGPDpalettecolor *palcolor = BKE_gpencil_palettecolor_getactive(palette); | |||||
| if (palcolor) { | |||||
| CTX_data_pointer_set(result, &gpd->id, &RNA_GPencilPaletteColor, palcolor); | |||||
| return 1; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| else if (CTX_data_equals(member, "active_gpencil_brush")) { | else if (CTX_data_equals(member, "active_gpencil_brush")) { | ||||
| /* XXX: see comment for gpencil_data case... */ | Brush *brush = BKE_brush_getactive_gpencil(scene->toolsettings); | ||||
| bGPDbrush *brush = BKE_gpencil_brush_getactive(scene->toolsettings); | |||||
| if (brush) { | if (brush) { | ||||
| CTX_data_pointer_set(result, &scene->id, &RNA_GPencilBrush, brush); | CTX_data_pointer_set(result, &scene->id, &RNA_Brush, brush); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| else if (CTX_data_equals(member, "editable_gpencil_strokes")) { | else if (CTX_data_equals(member, "editable_gpencil_strokes")) { | ||||
| /* XXX: see comment for gpencil_data case... */ | /* XXX: see comment for gpencil_data case... */ | ||||
| bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact); | bGPdata *gpd = ED_gpencil_data_get_active_direct((ID *)sc, scene, sa, obact); | ||||
| bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); | |||||
| if (gpd) { | if (gpd) { | ||||
| bGPDlayer *gpl; | bGPDlayer *gpl; | ||||
| for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { | for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { | ||||
| if (gpencil_layer_is_editable(gpl) && (gpl->actframe)) { | if (gpencil_layer_is_editable(gpl) && (gpl->actframe)) { | ||||
| bGPDframe *gpf = gpl->actframe; | bGPDframe *gpf; | ||||
| bGPDstroke *gps; | bGPDstroke *gps; | ||||
| bGPDframe *init_gpf = gpl->actframe; | |||||
| for (gps = gpf->strokes.first; gps; gps = gps->next) { | if (is_multiedit) { | ||||
| if (ED_gpencil_stroke_can_use_direct(sa, gps)) { | init_gpf = gpl->frames.first; | ||||
| /* check if the color is editable */ | } | ||||
| if (ED_gpencil_stroke_color_use(gpl, gps) == false) { | |||||
| continue; | |||||
| } | |||||
| CTX_data_list_add(result, &gpd->id, &RNA_GPencilStroke, gps); | for (gpf = init_gpf; gpf; gpf = gpf->next) { | ||||
| if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { | |||||
| for (gps = gpf->strokes.first; gps; gps = gps->next) { | |||||
| if (ED_gpencil_stroke_can_use_direct(sa, gps)) { | |||||
| /* check if the color is editable */ | |||||
| if (ED_gpencil_stroke_color_use(obact, gpl, gps) == false) { | |||||
| continue; | |||||
| } | |||||
| CTX_data_list_add(result, &gpd->id, &RNA_GPencilStroke, gps); | |||||
| } | |||||
| } | |||||
| } | |||||
| /* if not multiedit out of loop */ | |||||
| if (!is_multiedit) { | |||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||