moved gizmo discovery to distinct function outside of renderfunctions
This commit is contained in:
@@ -107,7 +107,7 @@ GLuint draw_clip(QOpenGLFramebufferObject* fbo, GLuint texture, bool clear) {
|
||||
}
|
||||
|
||||
void process_effect(Clip* c,
|
||||
EffectPtr e,
|
||||
Effect* e,
|
||||
double timecode,
|
||||
GLTextureCoords& coords,
|
||||
GLuint& composite_texture,
|
||||
@@ -415,34 +415,22 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
// get current sequence time in seconds (used for effects)
|
||||
double timecode = get_timecode(c, playhead);
|
||||
|
||||
// set up variables for gizmos later
|
||||
EffectPtr first_gizmo_effect = nullptr;
|
||||
EffectPtr selected_effect = nullptr;
|
||||
|
||||
// run through all of the clip's effects
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
EffectPtr e = c->effects.at(j);
|
||||
Effect* e = c->effects.at(j).get();
|
||||
process_effect(c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, kTransitionNone);
|
||||
|
||||
// retrieve gizmo data from effect
|
||||
if (e->are_gizmos_enabled()) {
|
||||
if (first_gizmo_effect == nullptr) first_gizmo_effect = e;
|
||||
if (e->container->selected) selected_effect = e;
|
||||
if (e == params.gizmos) {
|
||||
e->gizmo_draw(timecode, coords); // set correct gizmo coords
|
||||
e->gizmo_world_to_screen(); // convert gizmo coords to screen coords
|
||||
}
|
||||
}
|
||||
|
||||
// using gizmo data, set definitive gizmo
|
||||
if (selected_effect != nullptr) {
|
||||
(*params.gizmos) = selected_effect;
|
||||
} else if (s->IsClipSelected(c, true)) {
|
||||
(*params.gizmos) = first_gizmo_effect;
|
||||
}
|
||||
|
||||
// if the clip has an opening transition, process that now
|
||||
if (c->opening_transition != nullptr) {
|
||||
int transition_progress = playhead - c->timeline_in(true);
|
||||
if (transition_progress < c->opening_transition->get_length()) {
|
||||
process_effect(c, c->opening_transition, double(transition_progress)/double(c->opening_transition->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionOpening);
|
||||
process_effect(c, c->opening_transition.get(), double(transition_progress)/double(c->opening_transition->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionOpening);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +438,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
if (c->closing_transition != nullptr) {
|
||||
int transition_progress = playhead - (c->timeline_out(true) - c->closing_transition->get_length());
|
||||
if (transition_progress >= 0 && transition_progress < c->closing_transition->get_length()) {
|
||||
process_effect(c, c->closing_transition, double(transition_progress)/double(c->closing_transition->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionClosing);
|
||||
process_effect(c, c->closing_transition.get(), double(transition_progress)/double(c->closing_transition->get_length()), coords, textureID, fbo_switcher, params.texture_failed, kTransitionClosing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,6 +584,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
}
|
||||
|
||||
// prepare gizmos
|
||||
/*
|
||||
if ((*params.gizmos) != nullptr
|
||||
&& params.nests.isEmpty()
|
||||
&& ((*params.gizmos) == first_gizmo_effect
|
||||
@@ -603,6 +592,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
(*params.gizmos)->gizmo_draw(timecode, coords); // set correct gizmo coords
|
||||
(*params.gizmos)->gizmo_world_to_screen(); // convert gizmo coords to screen coords
|
||||
}
|
||||
*/
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -79,10 +79,9 @@ struct ComposeSequenceParams {
|
||||
/**
|
||||
* @brief Set to the Effect whose gizmos were chosen to be drawn on screen
|
||||
*
|
||||
* A pointer to a pointer that will be set to the Effect whose gizmos are being rendered and should therefore
|
||||
* be interacted with if the user uses them.
|
||||
* The currently active Effect that compose_sequence() will update the gizmos of.
|
||||
*/
|
||||
EffectPtr* gizmos;
|
||||
Effect* gizmos;
|
||||
|
||||
/**
|
||||
* @brief A variable that compose_sequence() will set to **TRUE** if any of the clips couldn't be shown.
|
||||
|
||||
@@ -192,7 +192,6 @@ void RenderThread::paint() {
|
||||
params.seq = seq;
|
||||
params.video = true;
|
||||
params.texture_failed = false;
|
||||
params.gizmos = &gizmos;
|
||||
params.wait_for_mutexes = true;
|
||||
params.playback_speed = 1;
|
||||
params.blend_mode_program = blend_mode_program;
|
||||
@@ -204,6 +203,10 @@ void RenderThread::paint() {
|
||||
params.main_buffer = front_buffer_switcher ? front_buffer1 : front_buffer2;
|
||||
params.main_attachment = front_buffer_switcher ? front_texture1 : front_texture2;
|
||||
|
||||
// get currently selected gizmos
|
||||
gizmos = seq->GetSelectedGizmo();
|
||||
params.gizmos = gizmos;
|
||||
|
||||
QMutex& active_mutex = front_buffer_switcher ? front_mutex1 : front_mutex2;
|
||||
active_mutex.lock();
|
||||
|
||||
@@ -221,8 +224,6 @@ void RenderThread::paint() {
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_DEPTH);
|
||||
|
||||
gizmos = nullptr;
|
||||
|
||||
compose_sequence(params);
|
||||
|
||||
// flush changes
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
QMutex* get_texture_mutex();
|
||||
const GLuint& get_texture();
|
||||
|
||||
EffectPtr gizmos;
|
||||
Effect* gizmos;
|
||||
void paint();
|
||||
void start_render(QOpenGLContext* share,
|
||||
SequencePtr s,
|
||||
|
||||
Reference in New Issue
Block a user