Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLT_translation.h"
#include "DNA_mesh_types.h"
#include "BKE_context.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_screen.h"
#include "DEG_depsgraph.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_space_api.h"
#include "ED_view3d.h"
#include "sculpt_intern.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include <math.h>
#include <stdlib.h>
Go to the source code of this file.
Classes | |
struct | SculptDetailRaycastData |
struct | DyntopoDetailSizeEditCustomData |
Functions | |
Internal Utilities | |
static bool | sculpt_and_constant_or_manual_detail_poll (bContext *C) |
static bool | sculpt_and_dynamic_topology_poll (bContext *C) |
Detail Flood Fill | |
static int | sculpt_detail_flood_fill_exec (bContext *C, wmOperator *UNUSED(op)) |
void | SCULPT_OT_detail_flood_fill (wmOperatorType *ot) |
Dynamic-topology detail size | |
Currently, there are two operators editing the detail size:
| |
static void | set_brush_rc_props (PointerRNA *ptr, const char *prop) |
static void | sculpt_detail_size_set_radial_control (bContext *C) |
static int | sculpt_set_detail_size_exec (bContext *C, wmOperator *UNUSED(op)) |
void | SCULPT_OT_set_detail_size (wmOperatorType *ot) |
Sample Detail Size | |
enum | eSculptSampleDetailModeTypes { SAMPLE_DETAIL_DYNTOPO = 0 , SAMPLE_DETAIL_VOXEL = 1 } |
typedef enum eSculptSampleDetailModeTypes | eSculptSampleDetailModeTypes |
static EnumPropertyItem | prop_sculpt_sample_detail_mode_types [] |
static void | sample_detail_voxel (bContext *C, ViewContext *vc, const int mval[2]) |
static void | sculpt_raycast_detail_cb (PBVHNode *node, void *data_v, float *tmin) |
static void | sample_detail_dyntopo (bContext *C, ViewContext *vc, const int mval[2]) |
static int | sample_detail (bContext *C, const int event_xy[2], int mode) |
static int | sculpt_sample_detail_size_exec (bContext *C, wmOperator *op) |
static int | sculpt_sample_detail_size_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(e)) |
static int | sculpt_sample_detail_size_modal (bContext *C, wmOperator *op, const wmEvent *event) |
void | SCULPT_OT_sample_detail_size (wmOperatorType *ot) |
#define DETAIL_SIZE_DELTA_ACCURATE_SPEED 0.004f |
Definition at line 447 of file sculpt_detail.c.
#define DETAIL_SIZE_DELTA_SPEED 0.08f |
Definition at line 446 of file sculpt_detail.c.
typedef struct DyntopoDetailSizeEditCustomData DyntopoDetailSizeEditCustomData |
typedef enum eSculptSampleDetailModeTypes eSculptSampleDetailModeTypes |
Enumerator | |
---|---|
SAMPLE_DETAIL_DYNTOPO | |
SAMPLE_DETAIL_VOXEL |
Definition at line 150 of file sculpt_detail.c.
|
static |
Definition at line 565 of file sculpt_detail.c.
References C, CTX_data_active_object(), CTX_wm_region(), wmOperator::customdata, SculptSession::draw_faded_cursor, DyntopoDetailSizeEditCustomData::draw_handle, ED_region_draw_cb_exit(), ED_workspace_status_text(), MEM_freeN, NULL, Object::sculpt, and ARegion::type.
Referenced by dyntopo_detail_size_edit_modal(), and SCULPT_OT_dyntopo_detail_size_edit().
|
static |
Definition at line 518 of file sculpt_detail.c.
References dyntopo_detail_size_parallel_lines_draw(), DyntopoDetailSizeEditCustomData::gizmo_mat, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_matrix_mul, GPU_matrix_pop(), GPU_matrix_push(), GPU_PRIM_LINES, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), imm_draw_circle_wire_3d(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniformColor4f(), immUniformColor4fv(), immVertex3fv(), immVertexFormat(), DyntopoDetailSizeEditCustomData::outline_col, DyntopoDetailSizeEditCustomData::preview_tri, and DyntopoDetailSizeEditCustomData::radius.
Referenced by dyntopo_detail_size_edit_invoke().
|
static |
Definition at line 681 of file sculpt_detail.c.
References DyntopoDetailSizeEditCustomData::active_object, Brush::add_col, BKE_paint_brush(), C, Sculpt::constant_detail, copy_m4_m4(), copy_v3_v3(), copy_v4_v4(), CTX_data_active_object(), CTX_data_tool_settings(), CTX_wm_region(), SculptSession::cursor_location, SculptSession::cursor_normal, SculptSession::cursor_radius, SculptSession::cursor_sampled_normal, wmOperator::customdata, DEG2RAD, DyntopoDetailSizeEditCustomData::detail_size, SculptSession::draw_faded_cursor, DyntopoDetailSizeEditCustomData::draw_handle, dyntopo_detail_size_edit_draw(), ED_region_draw_cb_activate(), ED_region_tag_redraw(), ED_workspace_status_text(), Sculpt::flags, DyntopoDetailSizeEditCustomData::gizmo_mat, DyntopoDetailSizeEditCustomData::init_detail_size, DyntopoDetailSizeEditCustomData::init_mval, is_zero_v3(), MEM_callocN, mul_m4_m4_post(), Object::obmat, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, DyntopoDetailSizeEditCustomData::outline_col, Sculpt::paint, DyntopoDetailSizeEditCustomData::preview_tri, quat_to_mat4(), DyntopoDetailSizeEditCustomData::radius, REGION_DRAW_POST_VIEW, rotate_v2_v2fl(), rotation_between_vecs_to_quat(), Object::sculpt, ToolSettings::sculpt, sculpt_detail_size_set_radial_control(), SCULPT_DYNTOPO_DETAIL_CONSTANT, SCULPT_DYNTOPO_DETAIL_MANUAL, SCULPT_vertex_random_access_ensure(), TIP_, translate_m4(), ARegion::type, WM_event_add_modal_handler(), and zero_v3().
Referenced by SCULPT_OT_dyntopo_detail_size_edit().
|
static |
Definition at line 630 of file sculpt_detail.c.
References C, Sculpt::constant_detail, CTX_data_active_object(), CTX_data_tool_settings(), CTX_wm_region(), wmOperator::customdata, DyntopoDetailSizeEditCustomData::detail_size, SculptSession::draw_faded_cursor, DyntopoDetailSizeEditCustomData::draw_handle, dyntopo_detail_size_edit_cancel(), dyntopo_detail_size_sample_from_surface(), dyntopo_detail_size_update_from_mouse_delta(), ED_region_draw_cb_exit(), ED_region_tag_redraw(), ED_workspace_status_text(), ELEM, EVT_ESCKEY, EVT_LEFTCTRLKEY, EVT_PADENTER, EVT_RETKEY, EVT_RIGHTCTRLKEY, KM_PRESS, KM_RELEASE, LEFTMOUSE, MEM_freeN, NULL, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, RIGHTMOUSE, DyntopoDetailSizeEditCustomData::sample_mode, Object::sculpt, ToolSettings::sculpt, ARegion::type, wmEvent::type, and wmEvent::val.
Referenced by SCULPT_OT_dyntopo_detail_size_edit().
|
static |
Definition at line 470 of file sculpt_detail.c.
References DyntopoDetailSizeEditCustomData::active_object, angle(), copy_v3_v3(), DEG2RAD, DyntopoDetailSizeEditCustomData::detail_size, float(), GPU_PRIM_LINES, immBegin(), immEnd(), immVertex3fv(), len_v3v3(), madd_v3_v3v3fl(), mat4_to_scale(), mul_v3_fl(), normalize_v3(), Object::obmat, DyntopoDetailSizeEditCustomData::preview_tri, rotate_v2_v2fl(), and sub_v3_v3v3().
Referenced by dyntopo_detail_size_edit_draw().
|
static |
Definition at line 577 of file sculpt_detail.c.
References DyntopoDetailSizeEditCustomData::active_object, clamp_f(), DyntopoDetailSizeEditCustomData::detail_size, SculptVertexNeighborIter::index, len_v3v3(), mat4_to_scale(), Object::obmat, Object::sculpt, SCULPT_active_vertex_get(), SCULPT_vertex_co_get(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, and SCULPT_VERTEX_NEIGHBORS_ITER_END.
Referenced by dyntopo_detail_size_edit_modal().
|
static |
Definition at line 601 of file sculpt_detail.c.
References DyntopoDetailSizeEditCustomData::accurate_detail_size, DyntopoDetailSizeEditCustomData::accurate_mode, DyntopoDetailSizeEditCustomData::accurate_mval, clamp_f(), copy_v2_v2(), DyntopoDetailSizeEditCustomData::detail_size, DETAIL_SIZE_DELTA_ACCURATE_SPEED, DETAIL_SIZE_DELTA_SPEED, EVT_LEFTSHIFTKEY, DyntopoDetailSizeEditCustomData::init_detail_size, DyntopoDetailSizeEditCustomData::init_mval, KM_PRESS, KM_RELEASE, wmEvent::type, and wmEvent::val.
Referenced by dyntopo_detail_size_edit_modal().
|
static |
Definition at line 231 of file sculpt_detail.c.
References blender::compositor::area(), BKE_area_find_region_xy(), BKE_pbvh_type(), BKE_screen_find_area_xy(), C, CTX_data_ensure_evaluated_depsgraph(), CTX_wm_area(), CTX_wm_area_set(), CTX_wm_region(), CTX_wm_region_set(), CTX_wm_screen(), depsgraph, ED_view3d_viewcontext_init(), NULL, ViewContext::obact, OPERATOR_CANCELLED, OPERATOR_FINISHED, SculptSession::pbvh, PBVH_BMESH, PBVH_FACES, RGN_TYPE_WINDOW, SAMPLE_DETAIL_DYNTOPO, sample_detail_dyntopo(), SAMPLE_DETAIL_VOXEL, sample_detail_voxel(), Object::sculpt, SPACE_VIEW3D, ARegion::winrct, rcti::xmin, and rcti::ymin.
Referenced by sculpt_sample_detail_size_exec(), and sculpt_sample_detail_size_modal().
|
static |
Definition at line 204 of file sculpt_detail.c.
References BKE_paint_brush(), BKE_pbvh_raycast(), C, Sculpt::constant_detail, CTX_data_tool_settings(), SculptDetailRaycastData::depth, SculptDetailRaycastData::edge_length, SculptDetailRaycastData::hit, SculptDetailRaycastData::isect_precalc, isect_ray_tri_watertight_v3_precalc(), mat4_to_scale(), ViewContext::obact, Object::obmat, Sculpt::paint, SculptSession::pbvh, SculptDetailRaycastData::ray_start, Object::sculpt, ToolSettings::sculpt, sculpt_raycast_detail_cb(), SCULPT_raycast_init(), SCULPT_stroke_modifiers_check(), and UNPACK2.
Referenced by sample_detail().
|
static |
Definition at line 161 of file sculpt_detail.c.
References BKE_sculpt_update_object_for_edit(), C, CTX_data_depsgraph_pointer(), Object::data, depsgraph, float(), SculptVertexNeighborIter::index, len_v3v3(), mesh, ViewContext::obact, Mesh::remesh_voxel_size, Object::sculpt, SCULPT_active_vertex_co_get(), SCULPT_active_vertex_get(), SCULPT_cursor_geometry_info_update(), SCULPT_vertex_co_get(), SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN, SCULPT_VERTEX_NEIGHBORS_ITER_END, SCULPT_vertex_random_access_ensure(), and UNPACK2.
Referenced by sample_detail().
Definition at line 57 of file sculpt_detail.c.
References SculptSession::bm, C, CTX_data_active_object(), CTX_data_tool_settings(), Sculpt::flags, Object::sculpt, ToolSettings::sculpt, SCULPT_DYNTOPO_DETAIL_CONSTANT, SCULPT_DYNTOPO_DETAIL_MANUAL, and SCULPT_mode_poll().
Referenced by SCULPT_OT_detail_flood_fill().
Definition at line 66 of file sculpt_detail.c.
References SculptSession::bm, C, CTX_data_active_object(), Object::sculpt, and SCULPT_mode_poll().
Referenced by SCULPT_OT_dyntopo_detail_size_edit(), and SCULPT_OT_set_detail_size().
|
static |
Definition at line 79 of file sculpt_detail.c.
References add_v3_v3v3(), BKE_pbvh_bmesh_detail_size_set(), BKE_pbvh_bmesh_update_topology(), BKE_pbvh_bounding_box(), BKE_pbvh_node_mark_topology_update(), BKE_pbvh_search_gather(), C, center, Sculpt::constant_detail, CTX_data_active_object(), CTX_data_tool_settings(), mat4_to_scale(), max_fff(), MEM_SAFE_FREE, mul_v3_fl(), NC_OBJECT, ND_DRAW, NULL, Object::obmat, OPERATOR_CANCELLED, OPERATOR_FINISHED, SculptSession::pbvh, PBVH_Collapse, PBVH_Subdivide, Object::sculpt, ToolSettings::sculpt, SCULPT_pbvh_clear(), SCULPT_UNDO_COORDS, SCULPT_undo_push_begin(), SCULPT_undo_push_end(), SCULPT_undo_push_node(), size(), sub_v3_v3v3(), and WM_event_add_notifier().
Referenced by SCULPT_OT_detail_flood_fill().
Definition at line 389 of file sculpt_detail.c.
References C, CTX_data_tool_settings(), Sculpt::flags, NULL, ot, RNA_string_set(), ToolSettings::sculpt, SCULPT_DYNTOPO_DETAIL_BRUSH, SCULPT_DYNTOPO_DETAIL_CONSTANT, SCULPT_DYNTOPO_DETAIL_MANUAL, set_brush_rc_props(), WM_OP_INVOKE_DEFAULT, WM_operator_name_call_ptr(), WM_operator_properties_create_ptr(), WM_operator_properties_free(), and WM_operatortype_find().
Referenced by dyntopo_detail_size_edit_invoke(), and sculpt_set_detail_size_exec().
void SCULPT_OT_detail_flood_fill | ( | wmOperatorType * | ot | ) |
Definition at line 130 of file sculpt_detail.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, sculpt_and_constant_or_manual_detail_poll(), and sculpt_detail_flood_fill_exec().
Referenced by ED_operatortypes_sculpt().
void SCULPT_OT_dyntopo_detail_size_edit | ( | wmOperatorType * | ot | ) |
Definition at line 758 of file sculpt_detail.c.
References wmOperatorType::cancel, wmOperatorType::description, dyntopo_detail_size_edit_cancel(), dyntopo_detail_size_edit_invoke(), dyntopo_detail_size_edit_modal(), wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, and sculpt_and_dynamic_topology_poll().
Referenced by ED_operatortypes_sculpt().
void SCULPT_OT_sample_detail_size | ( | wmOperatorType * | ot | ) |
Definition at line 337 of file sculpt_detail.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::modal, wmOperatorType::name, NULL, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, prop_sculpt_sample_detail_mode_types, RNA_def_enum(), RNA_def_int_array(), SAMPLE_DETAIL_DYNTOPO, SCULPT_mode_poll(), sculpt_sample_detail_size_exec(), sculpt_sample_detail_size_invoke(), sculpt_sample_detail_size_modal(), and wmOperatorType::srna.
Referenced by ED_operatortypes_sculpt().
void SCULPT_OT_set_detail_size | ( | wmOperatorType * | ot | ) |
Definition at line 424 of file sculpt_detail.c.
References wmOperatorType::description, wmOperatorType::exec, wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::name, OPTYPE_REGISTER, OPTYPE_UNDO, ot, wmOperatorType::poll, sculpt_and_dynamic_topology_poll(), and sculpt_set_detail_size_exec().
Referenced by ED_operatortypes_sculpt().
Definition at line 192 of file sculpt_detail.c.
References BKE_pbvh_bmesh_node_raycast_detail(), BKE_pbvh_node_get_tmin(), SculptDetailRaycastData::depth, SculptDetailRaycastData::edge_length, SculptDetailRaycastData::hit, SculptDetailRaycastData::isect_precalc, node, and SculptDetailRaycastData::ray_start.
Referenced by sample_detail_dyntopo().
|
static |
Definition at line 293 of file sculpt_detail.c.
References C, wmOperator::ptr, RNA_enum_get(), RNA_int_get_array(), and sample_detail().
Referenced by SCULPT_OT_sample_detail_size().
|
static |
Definition at line 301 of file sculpt_detail.c.
References C, CTX_wm_window(), ED_workspace_status_text(), OPERATOR_RUNNING_MODAL, TIP_, WM_CURSOR_EYEDROPPER, WM_cursor_modal_set(), and WM_event_add_modal_handler().
Referenced by SCULPT_OT_sample_detail_size().
|
static |
Definition at line 309 of file sculpt_detail.c.
References C, CTX_wm_window(), ED_workspace_status_text(), EVT_ESCKEY, KM_PRESS, LEFTMOUSE, NC_SCENE, ND_TOOLSETTINGS, NULL, OPERATOR_CANCELLED, OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, wmOperator::ptr, RIGHTMOUSE, RNA_enum_get(), RNA_int_set_array(), sample_detail(), wmEvent::type, wmEvent::val, WM_cursor_modal_restore(), WM_main_add_notifier(), and wmEvent::xy.
Referenced by SCULPT_OT_sample_detail_size().
|
static |
Definition at line 417 of file sculpt_detail.c.
References C, OPERATOR_FINISHED, and sculpt_detail_size_set_radial_control().
Referenced by SCULPT_OT_set_detail_size().
|
static |
Definition at line 382 of file sculpt_detail.c.
References BLI_sprintfN(), MEM_freeN, ptr, and RNA_string_set().
Referenced by sculpt_detail_size_set_radial_control().
|
static |
Definition at line 155 of file sculpt_detail.c.
Referenced by SCULPT_OT_sample_detail_size().