25 PassSimple motion_path_ps_ = {
"motion_path_ps_"};
39 motion_path_ps_.
init();
74 motion_path_sync(
state,
object, pchan, object->pose->avs, pchan->mpath);
81 motion_path_sync(
state,
object,
nullptr, object->avs, object->mpath);
91 manager.
submit(motion_path_ps_, view);
120 int current_frame =
state.cfra;
126 start = current_frame - avs.
path_bc;
127 end = current_frame + avs.
path_ac;
135 std::swap(start, end);
149 Object *camera_eval =
nullptr;
158 const int4 motion_path_settings(
161 auto &sub = *line_ps_;
162 sub.
push_constant(
"mpathLineSettings", motion_path_settings);
164 sub.push_constant(
"selected", selected);
165 sub.push_constant(
"customColorPre", color_pre);
166 sub.push_constant(
"customColorPost", color_post);
167 sub.push_constant(
"camera_space_matrix",
168 camera_eval ? camera_eval->object_to_world() :
float4x4::identity());
170 gpu::Batch *geom = mpath_batch_points_get(mpath);
178 const int4 motion_path_settings = {pt_size, current_frame, mpath->
start_frame, stride};
180 auto &sub = *vert_ps_;
181 sub.
push_constant(
"mpathPointSettings", motion_path_settings);
182 sub.push_constant(
"showKeyFrames", show_keyframes);
183 sub.push_constant(
"customColorPre", color_pre);
184 sub.push_constant(
"customColorPost", color_post);
185 sub.push_constant(
"camera_space_matrix",
186 camera_eval ? camera_eval->object_to_world() :
float4x4::identity());
188 gpu::Batch *geom = mpath_batch_points_get(mpath);
190 sub.draw(geom, 1, frame_range.
size(), start_index);
194 if (show_frame_number || (show_keyframes_number && show_keyframes)) {
199 col.w = col_kf.
w = 255;
201 Span<bMotionPathVert> mpv(mpath->
points, mpath->
length);
202 for (
int i = 0; i < frame_range.
size(); i += stride) {
205 int frame = frame_range.
start() + i;
208 float3 vert_coordinate(mpv_curr.
co);
214 if ((show_keyframes && show_keyframes_number && is_keyframe) ||
215 (show_frame_number && (i == 0)))
226 (is_keyframe) ? col_kf :
col);
228 else if (show_frame_number) {
269 blender::gpu::Batch *mpath_batch_points_get(
bMotionPath *mpath)
MINLINE int max_ii(int a, int b)
#define SNPRINTF_RLEN(dst, format,...)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
@ MOTIONPATH_BAKE_CAMERA_SPACE
enum eMotionPaths_BakeFlag eMotionPath_BakeFlag
#define BASE_SELECTED(v3d, base)
@ V3D_OVERLAY_HIDE_MOTION_PATHS
#define GPU_batch_create(primitive_type, vertex_buf, index_buf)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
#define GPU_vertbuf_create_with_format(format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
constexpr int64_t last(const int64_t n=0) const
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr int64_t start() const
static constexpr IndexRange from_begin_end_inclusive(const int64_t begin, const int64_t last)
void submit(PassSimple &pass, View &view)
PassBase< DrawCommandBufType > & sub(const char *name)
void bind_ubo(const char *name, GPUUniformBuf *buffer)
void push_constant(const char *name, const float &data)
void shader_set(GPUShader *shader)
static bool is_pose_mode(const Object *armature_ob, const State &state)
void begin_sync(Resources &res, const State &state)
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view)
void object_sync(const ObjectRef &ob_ref, Resources &, const State &state)
ShaderPtr motion_path_vert
ShaderPtr motion_path_line
void DRW_text_cache_add(DRWTextStore *dt, const float co[3], const char *str, const int str_len, short xoffs, short yoffs, short flag, const uchar col[4], const bool shadow, const bool align_center)
@ DRW_TEXT_CACHE_GLOBALSPACE
T clamp(const T &a, const T &min, const T &max)
bool is_equal(const MatBase< T, NumCol, NumRow > &a, const MatBase< T, NumCol, NumRow > &b, const T epsilon=T(0))
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
MatBase< float, 4, 4 > float4x4
ListBaseWrapperTemplate< ListBase, T > ListBaseWrapper
VecBase< float, 3 > float3
GPUVertBufHandle * points_vbo
GPUBatchHandle * batch_points
GPUUniformBuf * globals_buf
const SelectionType selection_type