Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_image/image_ops.c
| Show First 20 Lines • Show All 1,478 Lines • ▼ Show 20 Lines | static bool image_open_draw_check_prop(PointerRNA *UNUSED(ptr), | ||||
| return !(STR_ELEM(prop_id, "filepath", "directory", "filename")); | return !(STR_ELEM(prop_id, "filepath", "directory", "filename")); | ||||
| } | } | ||||
| static void image_open_draw(bContext *UNUSED(C), wmOperator *op) | static void image_open_draw(bContext *UNUSED(C), wmOperator *op) | ||||
| { | { | ||||
| uiLayout *layout = op->layout; | uiLayout *layout = op->layout; | ||||
| ImageOpenData *iod = op->customdata; | ImageOpenData *iod = op->customdata; | ||||
| ImageFormatData *imf = &iod->im_format; | ImageFormatData *imf = &iod->im_format; | ||||
| PointerRNA imf_ptr, ptr; | PointerRNA imf_ptr; | ||||
| /* main draw call */ | /* main draw call */ | ||||
| RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); | |||||
| uiDefAutoButsRNA( | uiDefAutoButsRNA( | ||||
| layout, &ptr, image_open_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); | layout, op->ptr, image_open_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); | ||||
| /* image template */ | /* image template */ | ||||
| RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr); | RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr); | ||||
| /* multiview template */ | /* multiview template */ | ||||
| if (RNA_boolean_get(op->ptr, "show_multiview")) { | if (RNA_boolean_get(op->ptr, "show_multiview")) { | ||||
| uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr); | uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 498 Lines • ▼ Show 20 Lines | return !(STREQ(prop_id, "filepath") || STREQ(prop_id, "directory") || | ||||
| /* when saving a copy, relative path has no effect */ | /* when saving a copy, relative path has no effect */ | ||||
| ((STREQ(prop_id, "relative_path")) && RNA_boolean_get(ptr, "copy"))); | ((STREQ(prop_id, "relative_path")) && RNA_boolean_get(ptr, "copy"))); | ||||
| } | } | ||||
| static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) | static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) | ||||
| { | { | ||||
| uiLayout *layout = op->layout; | uiLayout *layout = op->layout; | ||||
| ImageSaveData *isd = op->customdata; | ImageSaveData *isd = op->customdata; | ||||
| PointerRNA imf_ptr, ptr; | PointerRNA imf_ptr; | ||||
| const bool is_multiview = RNA_boolean_get(op->ptr, "show_multiview"); | const bool is_multiview = RNA_boolean_get(op->ptr, "show_multiview"); | ||||
| /* image template */ | /* image template */ | ||||
| RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &isd->im_format, &imf_ptr); | RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &isd->im_format, &imf_ptr); | ||||
| uiTemplateImageSettings(layout, &imf_ptr, false); | uiTemplateImageSettings(layout, &imf_ptr, false); | ||||
| /* main draw call */ | /* main draw call */ | ||||
| RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); | |||||
| uiDefAutoButsRNA( | uiDefAutoButsRNA( | ||||
| layout, &ptr, image_save_as_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); | layout, op->ptr, image_save_as_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false); | ||||
| /* multiview template */ | /* multiview template */ | ||||
| if (is_multiview) { | if (is_multiview) { | ||||
| uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr); | uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr); | ||||
| } | } | ||||
| } | } | ||||
| static bool image_save_as_poll(bContext *C) | static bool image_save_as_poll(bContext *C) | ||||
| ▲ Show 20 Lines • Show All 585 Lines • ▼ Show 20 Lines | static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| RNA_string_set(op->ptr, "name", DATA_(IMA_DEF_NAME)); | RNA_string_set(op->ptr, "name", DATA_(IMA_DEF_NAME)); | ||||
| return WM_operator_props_dialog_popup(C, op, 300); | return WM_operator_props_dialog_popup(C, op, 300); | ||||
| } | } | ||||
| static void image_new_draw(bContext *UNUSED(C), wmOperator *op) | static void image_new_draw(bContext *UNUSED(C), wmOperator *op) | ||||
| { | { | ||||
| uiLayout *col; | uiLayout *col; | ||||
| uiLayout *layout = op->layout; | uiLayout *layout = op->layout; | ||||
| PointerRNA ptr; | |||||
| #if 0 | #if 0 | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; | const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; | ||||
| #endif | #endif | ||||
| RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); | |||||
| /* copy of WM_operator_props_dialog_popup() layout */ | /* copy of WM_operator_props_dialog_popup() layout */ | ||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| uiLayoutSetPropDecorate(layout, false); | uiLayoutSetPropDecorate(layout, false); | ||||
| col = uiLayoutColumn(layout, false); | col = uiLayoutColumn(layout, false); | ||||
| uiItemR(col, &ptr, "name", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "name", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "width", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "width", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "height", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "height", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "color", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "color", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "alpha", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "alpha", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "generated_type", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "generated_type", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "float", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "float", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "tiled", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "tiled", 0, NULL, ICON_NONE); | ||||
| #if 0 | #if 0 | ||||
| if (is_multiview) { | if (is_multiview) { | ||||
| uiItemL(col[0], "", ICON_NONE); | uiItemL(col[0], "", ICON_NONE); | ||||
| uiItemR(col[1], &ptr, "use_stereo_3d", 0, NULL, ICON_NONE); | uiItemR(col[1], op->ptr, "use_stereo_3d", 0, NULL, ICON_NONE); | ||||
| } | } | ||||
| #endif | #endif | ||||
| } | } | ||||
| static void image_new_cancel(bContext *UNUSED(C), wmOperator *op) | static void image_new_cancel(bContext *UNUSED(C), wmOperator *op) | ||||
| { | { | ||||
| image_new_free(op); | image_new_free(op); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,333 Lines • ▼ Show 20 Lines | static int tile_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | ||||
| return WM_operator_props_dialog_popup(C, op, 300); | return WM_operator_props_dialog_popup(C, op, 300); | ||||
| } | } | ||||
| static void tile_add_draw(bContext *UNUSED(C), wmOperator *op) | static void tile_add_draw(bContext *UNUSED(C), wmOperator *op) | ||||
| { | { | ||||
| uiLayout *col; | uiLayout *col; | ||||
| uiLayout *layout = op->layout; | uiLayout *layout = op->layout; | ||||
| PointerRNA ptr; | |||||
| RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); | |||||
| uiLayoutSetPropSep(layout, true); | uiLayoutSetPropSep(layout, true); | ||||
| uiLayoutSetPropDecorate(layout, false); | uiLayoutSetPropDecorate(layout, false); | ||||
| col = uiLayoutColumn(layout, false); | col = uiLayoutColumn(layout, false); | ||||
| uiItemR(col, &ptr, "number", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "number", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "count", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "count", 0, NULL, ICON_NONE); | ||||
| uiItemR(col, &ptr, "label", 0, NULL, ICON_NONE); | uiItemR(col, op->ptr, "label", 0, NULL, ICON_NONE); | ||||
| uiItemR(layout, &ptr, "fill", 0, NULL, ICON_NONE); | uiItemR(layout, op->ptr, "fill", 0, NULL, ICON_NONE); | ||||
| if (RNA_boolean_get(&ptr, "fill")) { | if (RNA_boolean_get(op->ptr, "fill")) { | ||||
| draw_fill_tile(&ptr, layout); | draw_fill_tile(op->ptr, layout); | ||||
| } | } | ||||
| } | } | ||||
| void IMAGE_OT_tile_add(wmOperatorType *ot) | void IMAGE_OT_tile_add(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Add Tile"; | ot->name = "Add Tile"; | ||||
| ot->description = "Adds a tile to the image"; | ot->description = "Adds a tile to the image"; | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| tile_fill_init(op->ptr, CTX_data_edit_image(C), NULL); | tile_fill_init(op->ptr, CTX_data_edit_image(C), NULL); | ||||
| return WM_operator_props_dialog_popup(C, op, 300); | return WM_operator_props_dialog_popup(C, op, 300); | ||||
| } | } | ||||
| static void tile_fill_draw(bContext *UNUSED(C), wmOperator *op) | static void tile_fill_draw(bContext *UNUSED(C), wmOperator *op) | ||||
| { | { | ||||
| PointerRNA ptr; | draw_fill_tile(op->ptr, op->layout); | ||||
| RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr); | |||||
| draw_fill_tile(&ptr, op->layout); | |||||
| } | } | ||||
| void IMAGE_OT_tile_fill(wmOperatorType *ot) | void IMAGE_OT_tile_fill(wmOperatorType *ot) | ||||
| { | { | ||||
| /* identifiers */ | /* identifiers */ | ||||
| ot->name = "Fill Tile"; | ot->name = "Fill Tile"; | ||||
| ot->description = "Fill the current tile with a generated image"; | ot->description = "Fill the current tile with a generated image"; | ||||
| ot->idname = "IMAGE_OT_tile_fill"; | ot->idname = "IMAGE_OT_tile_fill"; | ||||
| Show All 12 Lines | |||||