29 PassSimple motion_path_ps_ = {
"motion_path_ps_"};
40 motion_path_ps_.init();
52 sub.
shader_set(res.shaders->motion_path_line.get());
57 sub.
shader_set(res.shaders->motion_path_vert.get());
72 const Object *
object = ob_ref.object;
78 motion_path_sync(
state,
object, pchan, object->
pose->
avs, pchan->mpath);
85 motion_path_sync(
state,
object,
nullptr, object->
avs, object->
mpath);
95 manager.submit(motion_path_ps_,
view);
124 int current_frame =
state.cfra;
130 start = current_frame - avs.
path_bc;
131 end = current_frame + avs.
path_ac;
139 std::swap(start, end);
153 Object *camera_eval =
nullptr;
162 const int4 motion_path_settings(
165 auto &sub = *line_ps_;
166 sub.push_constant(
"mpath_line_settings", motion_path_settings);
168 sub.push_constant(
"selected", selected);
169 sub.push_constant(
"custom_color_pre", color_pre);
170 sub.push_constant(
"custom_color_post", color_post);
171 sub.push_constant(
"camera_space_matrix",
174 gpu::Batch *geom = mpath_batch_points_get(mpath);
182 const int4 motion_path_settings = {pt_size, current_frame, mpath->
start_frame, stride};
184 auto &sub = *vert_ps_;
185 sub.push_constant(
"mpath_point_settings", motion_path_settings);
186 sub.push_constant(
"show_key_frames", show_keyframes);
187 sub.push_constant(
"custom_color_pre", color_pre);
188 sub.push_constant(
"custom_color_post", color_post);
189 sub.push_constant(
"camera_space_matrix",
192 gpu::Batch *geom = mpath_batch_points_get(mpath);
194 sub.draw(geom, 1, frame_range.
size(), start_index);
198 if (show_frame_number || (show_keyframes_number && show_keyframes)) {
203 col.w = col_kf.
w = 255;
205 auto safe_index = [&](
int index) {
return math::clamp(index, 0, mpath->
length - 1); };
207 Span<bMotionPathVert> mpv(mpath->
points, mpath->
length);
208 for (
int i = 0;
i < frame_range.
size();
i += stride) {
211 int frame = frame_range.
start() +
i;
214 float3 vert_coordinate(mpv_curr.
co);
220 if ((show_keyframes && show_keyframes_number && is_keyframe) ||
221 (show_frame_number && (
i == 0)))
232 (is_keyframe) ? col_kf :
col);
234 else if (show_frame_number) {
235 const bMotionPathVert &mpv_prev = mpv[safe_index(start_index +
i - stride)];
236 const bMotionPathVert &mpv_next = mpv[safe_index(start_index +
i + stride)];
260 blender::gpu::VertBuf *mpath_vbo_get(
bMotionPath *mpath)
263 GPUVertFormat
format = {0};
275 blender::gpu::Batch *mpath_batch_points_get(
bMotionPath *mpath)
MINLINE int max_ii(int a, int b)
#define SNPRINTF_RLEN(dst, format,...)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ MOTIONPATH_BAKE_CAMERA_SPACE
struct bMotionPathVert bMotionPathVert
struct bMotionPath bMotionPath
enum eMotionPaths_BakeFlag eMotionPath_BakeFlag
#define BASE_SELECTED(v3d, base)
#define GPU_batch_create(primitive_type, vertex_buf, index_buf)
void GPU_framebuffer_bind(blender::gpu::FrameBuffer *fb)
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &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 shader_set(gpu::Shader *shader)
PassBase< DrawCommandBufType > & sub(const char *name)
void state_set(DRWState state, int clip_plane_count=0)
void bind_ubo(const char *name, gpu::UniformBuf *buffer)
detail::PassBase< command::DrawCommandBuf > Sub
static bool is_pose_mode(const Object *armature_ob, const State &state)
void object_sync(Manager &, const ObjectRef &ob_ref, Resources &, const State &state) final
void begin_sync(Resources &res, const State &state) final
void draw_color_only(Framebuffer &framebuffer, Manager &manager, View &view) final
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
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
detail::Pass< command::DrawCommandBuf > PassSimple
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)
VecBase< int32_t, 4 > int4
blender::VecBase< uint8_t, 4 > uchar4
ListBaseWrapperTemplate< ListBase, T > ListBaseWrapper
VecBase< float, 3 > float3
GPUVertBufHandle * points_vbo
GPUBatchHandle * batch_points
static MatBase identity()