Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_image.c
| Show First 20 Lines • Show All 1,115 Lines • ▼ Show 20 Lines | void PAINT_OT_sample_color(wmOperatorType *ot) | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); | RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); | ||||
| RNA_def_boolean(ot->srna, "merged", 0, "Sample Merged", "Sample the output display color"); | RNA_def_boolean(ot->srna, "merged", 0, "Sample Merged", "Sample the output display color"); | ||||
| RNA_def_boolean(ot->srna, "palette", 0, "Add to Palette", ""); | RNA_def_boolean(ot->srna, "palette", 0, "Add to Palette", ""); | ||||
| } | } | ||||
| /******************** texture paint toggle operator ********************/ | /******************** texture paint toggle operator ********************/ | ||||
| void ED_object_texture_paint_mode_exit_ex(bContext *C, Object *ob) | |||||
| { | |||||
| Main *bmain = CTX_data_main(C); | |||||
| ob->mode &= ~OB_MODE_TEXTURE_PAINT; | |||||
| if (U.glreslimit != 0) { | |||||
| GPU_free_images(bmain); | |||||
| } | |||||
| GPU_paint_set_mipmap(bmain, 1); | |||||
| toggle_paint_cursor(C, 0); | |||||
| Mesh *me = BKE_mesh_from_object(ob); | |||||
| BLI_assert(me != NULL); | |||||
| DEG_id_tag_update(&me->id, ID_RECALC_COPY_ON_WRITE); | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL); | |||||
| } | |||||
| void ED_object_texture_paint_mode_exit(bContext *C) | |||||
| { | |||||
| Object *ob = CTX_data_active_object(C); | |||||
| ED_object_texture_paint_mode_exit_ex(C, ob); | |||||
| } | |||||
| static bool texture_paint_toggle_poll(bContext *C) | static bool texture_paint_toggle_poll(bContext *C) | ||||
| { | { | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| if (ob == NULL || ob->type != OB_MESH) { | if (ob == NULL || ob->type != OB_MESH) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| if (!ob->data || ID_IS_LINKED(ob->data)) { | if (!ob->data || ID_IS_LINKED(ob->data)) { | ||||
| return 0; | return 0; | ||||
| Show All 13 Lines | static int texture_paint_toggle_exec(bContext *C, wmOperator *op) | ||||
| if (!is_mode_set) { | if (!is_mode_set) { | ||||
| if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { | if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| } | } | ||||
| if (ob->mode & mode_flag) { | if (ob->mode & mode_flag) { | ||||
| ob->mode &= ~mode_flag; | ED_object_texture_paint_mode_exit_ex(C, ob); | ||||
| if (U.glreslimit != 0) { | |||||
| GPU_free_images(bmain); | |||||
| } | |||||
| GPU_paint_set_mipmap(bmain, 1); | |||||
| toggle_paint_cursor(C, 0); | |||||
| } | } | ||||
| else { | else { | ||||
| bScreen *screen; | bScreen *screen; | ||||
| Image *ima = NULL; | Image *ima = NULL; | ||||
| ImagePaintSettings *imapaint = &scene->toolsettings->imapaint; | ImagePaintSettings *imapaint = &scene->toolsettings->imapaint; | ||||
| /* This has to stay here to regenerate the texture paint | /* This has to stay here to regenerate the texture paint | ||||
| * cache in case we are loading a file */ | * cache in case we are loading a file */ | ||||
| ▲ Show 20 Lines • Show All 186 Lines • Show Last 20 Lines | |||||