Blender
V3.3
|
#include <math.h>
#include <stdlib.h>
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_brush_types.h"
#include "DNA_scene_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_math_color.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_image.h"
#include "BKE_material.h"
#include "BKE_mesh_runtime.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_prototypes.h"
#include "GPU_framebuffer.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "GPU_texture.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "RE_texture.h"
#include "ED_image.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "BLI_sys_types.h"
#include "ED_mesh.h"
#include "DRW_select_buffer.h"
#include "WM_api.h"
#include "WM_types.h"
#include "paint_intern.h"
Go to the source code of this file.
|
static |
Definition at line 559 of file paint_utils.c.
References BKE_brush_curve_preset(), BKE_paint_brush(), BKE_paint_get_active_from_context(), BKE_paint_invalidate_cursor_overlay(), C, CTX_data_scene(), CTX_data_view_layer(), Brush::curve, OPERATOR_FINISHED, wmOperator::ptr, RNA_enum_get(), and scene.
Referenced by BRUSH_OT_curve_preset().
Definition at line 573 of file paint_utils.c.
References BKE_paint_brush(), BKE_paint_get_active_from_context(), C, and Brush::curve.
Referenced by BRUSH_OT_curve_preset().
void BRUSH_OT_curve_preset | ( | wmOperatorType * | ot | ) |
Definition at line 580 of file paint_utils.c.
References BLT_I18NCONTEXT_ID_CURVE_LEGACY, brush_curve_preset_exec(), brush_curve_preset_poll(), CURVE_PRESET_LINE, CURVE_PRESET_MAX, CURVE_PRESET_ROOT, CURVE_PRESET_ROUND, CURVE_PRESET_SHARP, CURVE_PRESET_SMOOTH, wmOperatorType::description, wmOperatorType::exec, wmOperatorType::idname, wmOperatorType::name, NULL, ot, wmOperatorType::poll, RNA_def_enum(), RNA_def_property_translation_context(), and wmOperatorType::srna.
Referenced by ED_operatortypes_paint().
|
static |
Definition at line 648 of file paint_utils.c.
References C, CTX_data_active_object(), CTX_wm_region(), ED_region_tag_redraw(), OPERATOR_CANCELLED, OPERATOR_FINISHED, paintface_deselect_all_visible(), wmOperator::ptr, and RNA_enum_get().
Referenced by PAINT_OT_face_select_all().
|
static |
Definition at line 728 of file paint_utils.c.
References C, CTX_data_active_object(), CTX_wm_region(), ED_region_tag_redraw(), OPERATOR_FINISHED, paintface_hide(), wmOperator::ptr, and RNA_boolean_get().
Referenced by PAINT_OT_face_select_hide().
|
static |
Definition at line 776 of file paint_utils.c.
References BKE_paint_select_vert_test(), C, CTX_data_active_object(), CTX_wm_region(), ED_region_tag_redraw(), OPERATOR_FINISHED, paintface_reveal(), paintvert_reveal(), wmOperator::ptr, RNA_boolean_get(), and select().
Referenced by PAINT_OT_face_vert_reveal().
Definition at line 792 of file paint_utils.c.
References BKE_paint_always_hide_test(), BKE_paint_select_elem_test(), C, and CTX_data_active_object().
Referenced by PAINT_OT_face_vert_reveal().
|
static |
Definition at line 355 of file paint_utils.c.
References ViewContext::depsgraph, DRW_select_buffer_sample_point(), ED_view3d_select_id_validate(), ViewContext::region, and ViewContext::v3d.
Referenced by paint_sample_color().
|
static |
Definition at line 277 of file paint_utils.c.
References BKE_mesh_runtime_looptri_ensure(), BKE_object_material_get(), CD_MLOOPUV, CD_ORIGINDEX, MVert::co, copy_v3_v3(), CustomData_get_layer(), CustomData_get_layer_named(), fabsf, GPU_matrix_model_view_get, GPU_matrix_projection_get, GPU_viewport_size_get_i(), ToolSettings::imapaint, imapaint_tri_weights(), Mesh::ldata, MLoopTri_Store::len, Mesh_Runtime::looptris, MPoly::mat_nr, Mesh::mloop, ImagePaintSettings::mode, Mesh::mpoly, mul_m4_m4m4(), Mesh::mvert, Object::obmat, Material::paint_active_slot, PAINT_CANVAS_SOURCE_MATERIAL, Mesh::pdata, MLoopTri::poly, Mesh::runtime, scene, Material::texpaintslot, Scene::toolsettings, MLoopTri::tri, UNPACK3, MLoopUV::uv, TexPaintSlot::uvname, MLoop::v, view, w(), and xy.
Referenced by paint_sample_color().
Definition at line 220 of file paint_utils.c.
References copy_v3_v3(), and mul_m4_v4().
Referenced by imapaint_tri_weights().
|
static |
Definition at line 228 of file paint_utils.c.
References copy_v3_v3(), imapaint_project(), invert_m3_m3(), mul_m3_v3(), mul_v3_fl(), v1, v2, view, and w().
Referenced by imapaint_pick_uv().
float paint_calc_object_space_radius | ( | ViewContext * | vc, |
const float | center[3], | ||
float | pixel_radius | ||
) |
Definition at line 130 of file paint_utils.c.
References center, ED_view3d_calc_zfac(), ED_view3d_win_to_delta(), fabsf, len_v3(), mat4_to_scale(), mul_v3_m4v3(), ViewContext::obact, Object::obmat, ViewContext::region, and ViewContext::rv3d.
Referenced by ED_sculpt_update_modal_transform(), paint_cursor_update_object_space_radius(), paint_cursor_update_unprojected_radius(), paint_space_stroke_spacing(), SCULPT_cursor_geometry_info_update(), sculpt_gesture_trim_calculate_depth(), sculpt_update_cache_variants(), and vwpaint_update_cache_variants().
void paint_calc_redraw_planes | ( | float | planes[4][4], |
const ARegion * | region, | ||
Object * | ob, | ||
const rcti * | screen_rect | ||
) |
Definition at line 112 of file paint_utils.c.
References ED_view3d_clipping_calc(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
bool paint_convert_bb_to_rect | ( | rcti * | rect, |
const float | bb_min[3], | ||
const float | bb_max[3], | ||
const ARegion * | region, | ||
RegionView3D * | rv3d, | ||
Object * | ob | ||
) |
Definition at line 68 of file paint_utils.c.
References BLI_rcti_do_minmax_v(), BLI_rcti_init_minmax(), ED_view3d_ob_project_mat_get(), ED_view3d_project_float_v2_m4(), rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
float paint_get_tex_pixel | ( | const MTex * | mtex, |
float | u, | ||
float | v, | ||
struct ImagePool * | pool, | ||
int | thread | ||
) |
Definition at line 147 of file paint_utils.c.
References blender::compositor::pool, RE_texture_evaluate(), and v.
void paint_get_tex_pixel_col | ( | const MTex * | mtex, |
float | u, | ||
float | v, | ||
float | rgba[4], | ||
struct ImagePool * | pool, | ||
int | thread, | ||
bool | convert_to_linear, | ||
struct ColorSpace * | colorspace | ||
) |
Definition at line 158 of file paint_utils.c.
References clamp_v4(), IMB_colormanagement_colorspace_to_scene_linear_v3(), linearrgb_to_srgb_v3_v3(), blender::compositor::pool, RE_texture_evaluate(), usdtokens::rgba(), and v.
void PAINT_OT_face_select_all | ( | wmOperatorType * | ot | ) |
Definition at line 658 of file paint_utils.c.
References wmOperatorType::description, wmOperatorType::exec, face_select_all_exec(), facemask_paint_poll(), wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, and WM_operator_properties_select_all().
Referenced by ED_operatortypes_paint().
void PAINT_OT_face_select_hide | ( | wmOperatorType * | ot | ) |
Definition at line 737 of file paint_utils.c.
References wmOperatorType::description, wmOperatorType::exec, face_select_hide_exec(), facemask_paint_poll(), wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), and wmOperatorType::srna.
Referenced by ED_operatortypes_paint().
void PAINT_OT_face_select_linked | ( | wmOperatorType * | ot | ) |
Definition at line 613 of file paint_utils.c.
References wmOperatorType::description, wmOperatorType::exec, facemask_paint_poll(), wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, paint_select_linked_exec(), and wmOperatorType::poll.
Referenced by ED_operatortypes_paint().
void PAINT_OT_face_select_linked_pick | ( | wmOperatorType * | ot | ) |
Definition at line 634 of file paint_utils.c.
References wmOperatorType::description, facemask_paint_poll(), wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, paint_select_linked_pick_invoke(), wmOperatorType::poll, RNA_def_boolean(), and wmOperatorType::srna.
Referenced by ED_operatortypes_paint().
void PAINT_OT_face_vert_reveal | ( | wmOperatorType * | ot | ) |
Definition at line 800 of file paint_utils.c.
References wmOperatorType::description, wmOperatorType::exec, face_vert_reveal_exec(), face_vert_reveal_poll(), wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), and wmOperatorType::srna.
Referenced by ED_operatortypes_paint().
void PAINT_OT_vert_select_all | ( | wmOperatorType * | ot | ) |
Definition at line 681 of file paint_utils.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, vert_paint_poll(), vert_select_all_exec(), and WM_operator_properties_select_all().
Referenced by ED_operatortypes_paint().
void PAINT_OT_vert_select_hide | ( | wmOperatorType * | ot | ) |
Definition at line 761 of file paint_utils.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), wmOperatorType::srna, vert_paint_poll(), and vert_select_hide_exec().
Referenced by ED_operatortypes_paint().
void PAINT_OT_vert_select_ungrouped | ( | wmOperatorType * | ot | ) |
Definition at line 711 of file paint_utils.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, RNA_def_boolean(), wmOperatorType::srna, vert_paint_poll(), and vert_select_ungrouped_exec().
Referenced by ED_operatortypes_paint().
void paint_sample_color | ( | struct bContext * | C, |
struct ARegion * | region, | ||
int | x, | ||
int | y, | ||
bool | texpaint_proj, | ||
bool | palette | ||
) |
Used for both 3D view and image window.
Definition at line 374 of file paint_utils.c.
References Palette::active_color, bilinear_interpolation_color_wrap(), BKE_brush_color_set(), BKE_image_acquire_ibuf(), BKE_image_get_tile_from_pos(), BKE_image_release_ibuf(), BKE_imageuser_default(), BKE_object_material_get(), BKE_paint_brush(), BKE_paint_get_active_from_context(), BKE_paint_palette(), BKE_paint_palette_set(), BKE_palette_add(), BKE_palette_color_add(), BKE_texpaint_slot_refresh_cache(), BLI_listbase_count(), C, ImagePaintSettings::canvas, CD_MASK_BAREMESH, CD_MASK_ORIGINDEX, CD_MLOOPUV, CLAMP, color, Palette::colors, copy_v3_v3(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_main(), CTX_data_scene(), CTX_data_view_layer(), CTX_wm_space_image(), CTX_wm_view3d(), CustomData_has_layer(), Object::data, DEG_get_evaluated_object(), depsgraph, ED_space_image_color_sample(), ED_view3d_viewcontext_init(), fmodf, ImageUser::framenr, GPU_DATA_FLOAT, GPU_frontbuffer_read_pixels(), TexPaintSlot::ima, IMA_SRC_TILED, image(), IMAGEPAINT_MODE_MATERIAL, ToolSettings::imapaint, imapaint_pick_face(), imapaint_pick_uv(), interp(), TexPaintSlot::interp, ImagePaintSettings::interp, linearrgb_to_srgb_v3_v3(), MPoly::mat_nr, mesh_get_eval_final(), ImagePaintSettings::mode, nearest_interpolation_color_wrap(), NULL, OBACT, Material::paint_active_slot, CustomData_MeshMasks::pmask, ImBuf::rect, ImBuf::rect_float, rgb_uchar_to_float(), usdtokens::rgba(), scene, SHD_INTERP_CLOSEST, SHD_INTERP_LINEAR, straight_to_premul_v4(), Material::texpaintslot, ImageUser::tile, Scene::toolsettings, Mesh::totpoly, v, view3d_operator_needs_opengl(), ARegion::winrct, ARegion::winx, ARegion::winy, x, ImBuf::x, rcti::xmin, y, ImBuf::y, and rcti::ymin.
Referenced by sample_color_exec(), sample_color_invoke(), and sample_color_modal().
|
static |
Definition at line 606 of file paint_utils.c.
References C, CTX_data_active_object(), CTX_wm_region(), ED_region_tag_redraw(), NULL, OPERATOR_FINISHED, and paintface_select_linked().
Referenced by PAINT_OT_face_select_linked().
|
static |
Definition at line 625 of file paint_utils.c.
References C, CTX_data_active_object(), CTX_wm_region(), ED_region_tag_redraw(), wmEvent::mval, OPERATOR_FINISHED, paintface_select_linked(), wmOperator::ptr, RNA_boolean_get(), select(), and view3d_operator_needs_opengl().
Referenced by PAINT_OT_face_select_linked_pick().
void paint_stroke_operator_properties | ( | wmOperatorType * | ot | ) |
Definition at line 188 of file paint_utils.c.
References BRUSH_STROKE_INVERT, BRUSH_STROKE_NORMAL, BRUSH_STROKE_SMOOTH, ot, PROP_HIDDEN, PROP_SKIP_SAVE, RNA_def_collection_runtime(), RNA_def_enum(), RNA_def_property_flag(), and wmOperatorType::srna.
Referenced by PAINT_OT_image_paint(), PAINT_OT_vertex_paint(), PAINT_OT_weight_paint(), blender::ed::sculpt_paint::SCULPT_CURVES_OT_brush_stroke(), and SCULPT_OT_brush_stroke().
|
static |
Definition at line 672 of file paint_utils.c.
References C, CTX_data_active_object(), CTX_wm_region(), ED_region_tag_redraw(), OPERATOR_FINISHED, paintvert_deselect_all_visible(), paintvert_tag_select_update(), wmOperator::ptr, and RNA_enum_get().
Referenced by PAINT_OT_vert_select_all().
|
static |
Definition at line 752 of file paint_utils.c.
References C, CTX_data_active_object(), CTX_wm_region(), ED_region_tag_redraw(), OPERATOR_FINISHED, paintvert_hide(), wmOperator::ptr, and RNA_boolean_get().
Referenced by PAINT_OT_vert_select_hide().
|
static |
Definition at line 695 of file paint_utils.c.
References BKE_report(), BLI_listbase_is_empty(), C, CTX_data_active_object(), CTX_wm_region(), Object::data, Mesh::dvert, ED_region_tag_redraw(), NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, paintvert_select_ungrouped(), paintvert_tag_select_update(), wmOperator::ptr, wmOperator::reports, RNA_boolean_get(), RPT_ERROR, and Mesh::vertex_group_names.
Referenced by PAINT_OT_vert_select_ungrouped().