47 #include "../gizmo_geometry.h"
48 #include "../gizmo_library_intern.h"
54 #define ARROW_SELECT_THRESHOLD_PX (5)
79 const float arrow_length)
82 bool unbind_shader =
true;
106 const float unitx = aspect[0];
107 const float unity = aspect[1];
108 const float vec[4][3] = {
119 #ifdef USE_GIZMO_CUSTOM_ARROWS
122 const float vec[2][3] = {
124 {0.0f, 0.0f, arrow_length},
144 const float size = 0.05f;
153 unbind_shader =
false;
159 const float len = 0.25f;
160 const float width = 0.06f;
187 float matrix_final[4][4];
234 const float head_center_z = (0.974306f + 1.268098f) / 2;
235 const float head_geo_x = 0.051304f;
236 const float stem_geo_x = 0.012320f;
242 float matrix_final[4][4];
246 const float arrow_start[2] = {matrix_final[3][0], matrix_final[3][1]};
249 float co[3] = {0, 0, arrow_length};
257 float select_threshold_base = gz->
line_width *
U.pixelsize;
259 const float mval_fl[2] = {
UNPACK2(mval)};
271 if (lambda >= 0.0f && lambda <= 1.0f) {
303 float ray_origin[3], ray_direction[3];
317 for (
int j = 0; j < 2; j++) {
326 float arrow_no_proj[3];
360 data, inter, ofs_new, constrained, inverted, use_precision);
369 data->offset = ofs_new;
466 "Make sure this function is called before WM_gizmo_target_property_def_rna"));
478 "Make sure this function is called before WM_gizmo_target_property_def_rna"));
486 gzt->
idname =
"GIZMO_GT_arrow_3d";
521 rna_enum_draw_style_items,
527 rna_enum_draw_options_items,
534 gzt->
srna,
"length", 1.0f, -FLT_MAX, FLT_MAX,
"Arrow Line Length",
"", -FLT_MAX, FLT_MAX);
536 gzt->
srna,
"aspect", 2,
NULL, 0, FLT_MAX,
"Aspect",
"Cone/box style only", 0.0f, FLT_MAX);
struct ARegion * CTX_wm_region(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
MINLINE float square_f(float a)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
bool isect_ray_plane_v3(const float ray_origin[3], const float ray_direction[3], const float plane[4], float *r_lambda, bool clip)
float closest_to_line_v2(float r_close[2], const float p[2], const float l1[2], const float l2[2])
void mul_m4_v3(const float M[4][4], float r[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
float mat4_to_scale(const float M[4][4])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
@ ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED
@ ED_GIZMO_ARROW_XFORM_FLAG_INVERTED
@ ED_GIZMO_ARROW_DRAW_FLAG_STEM
@ ED_GIZMO_ARROW_STYLE_CROSS
@ ED_GIZMO_ARROW_STYLE_BOX
@ ED_GIZMO_ARROW_STYLE_NORMAL
@ ED_GIZMO_ARROW_STYLE_CONE
void ED_region_tag_redraw_editor_overlays(struct ARegion *region)
void ED_view3d_win_to_ray(const struct ARegion *region, const float mval[2], float r_ray_start[3], float r_ray_normal[3])
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
void GPU_matrix_pop(void)
#define GPU_matrix_mul(x)
void GPU_matrix_scale_3f(float x, float y, float z)
void GPU_matrix_push(void)
void GPU_matrix_translate_3f(float x, float y, float z)
bool GPU_select_load_id(unsigned int id)
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
void GPU_viewport_size_get_f(float coords[4])
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
eWM_GizmoFlagTweak
Gizmo tweak flag. Bit-flag passed to gizmo while tweaking.
@ WM_GIZMO_STATE_HIGHLIGHT
struct ArrowGizmoInteraction ArrowGizmoInteraction
static void gizmo_arrow_matrix_basis_get(const wmGizmo *gz, float r_matrix[4][4])
static void gizmo_arrow_setup(wmGizmo *gz)
static int gizmo_arrow_test_select(bContext *UNUSED(C), wmGizmo *gz, const int mval[2])
static int gizmo_arrow_invoke(bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event)
void ED_gizmotypes_arrow_3d(void)
#define ARROW_SELECT_THRESHOLD_PX
void ED_gizmo_arrow3d_set_range_fac(wmGizmo *gz, const float range_fac)
struct ArrowGizmo3D ArrowGizmo3D
static int gizmo_arrow_modal(bContext *C, wmGizmo *gz, const wmEvent *event, eWM_GizmoFlagTweak tweak_flag)
static void GIZMO_GT_arrow_3d(wmGizmoType *gzt)
static void arrow_draw_intern(ArrowGizmo3D *arrow, const bool select, const bool highlight)
static void gizmo_arrow_exit(bContext *C, wmGizmo *gz, const bool cancel)
void ED_gizmo_arrow3d_set_ui_range(wmGizmo *gz, const float min, const float max)
static void gizmo_arrow_property_update(wmGizmo *gz, wmGizmoProperty *gz_prop)
static void gizmo_arrow_draw_select(const bContext *UNUSED(C), wmGizmo *gz, int select_id)
static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const float color[4], const float arrow_length)
static void gizmo_arrow_draw(const bContext *UNUSED(C), wmGizmo *gz)
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
GizmoGeomInfo wm_gizmo_geom_data_arrow
GizmoGeomInfo wm_gizmo_geom_data_cube
void wm_gizmo_vec_draw(const float color[4], const float(*verts)[3], uint vert_count, uint pos, uint primitive_type)
void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(select), const float color[4])
float gizmo_value_from_offset(GizmoCommonData *data, GizmoInteraction *inter, float offset, bool constrained, bool inverted, bool use_precision)
float gizmo_offset_from_value(GizmoCommonData *data, float value, bool constrained, bool inverted)
void gizmo_property_value_reset(bContext *C, const struct wmGizmo *gz, GizmoInteraction *inter, wmGizmoProperty *gz_prop)
void gizmo_color_get(const struct wmGizmo *gz, bool highlight, float r_color[4])
void gizmo_property_data_update(struct wmGizmo *gz, GizmoCommonData *data, wmGizmoProperty *gz_prop, bool constrained, bool inverted)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void *(* MEM_callocN)(size_t len, const char *str)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
float RNA_float_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
float init_matrix_basis[4][4]
float init_matrix_final[4][4]
wmGizmoFnMatrixBasisGet matrix_basis_get
wmGizmoFnTestSelect test_select
wmGizmoFnDrawSelect draw_select
wmGizmoFnPropertyUpdate property_update
void WM_event_add_mousemove(wmWindow *win)
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
void WM_gizmo_target_property_float_set(bContext *C, const wmGizmo *gz, wmGizmoProperty *gz_prop, const float value)
wmGizmoProperty * WM_gizmo_target_property_find(wmGizmo *gz, const char *idname)
bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *gz_prop)
void WM_gizmotype_target_property_def(wmGizmoType *gzt, const char *idname, int data_type, int array_length)
float WM_gizmo_target_property_float_get(const wmGizmo *gz, wmGizmoProperty *gz_prop)
void WM_gizmo_target_property_anim_autokey(bContext *C, const wmGizmo *UNUSED(gz), wmGizmoProperty *gz_prop)
void WM_gizmotype_append(void(*gtfunc)(struct wmGizmoType *))