merge of long discussed new pipeline
This commit is contained in:
-1132
File diff suppressed because it is too large
Load Diff
@@ -1,262 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef EFFECT_H
|
||||
#define EFFECT_H
|
||||
|
||||
#include <memory>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QColor>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QOpenGLTexture>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
#include <QLabel>
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
#include <QMouseEvent>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <random>
|
||||
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "effectrow.h"
|
||||
#include "effectgizmo.h"
|
||||
|
||||
class Clip;
|
||||
|
||||
class Effect;
|
||||
using EffectPtr = std::shared_ptr<Effect>;
|
||||
|
||||
struct EffectMeta {
|
||||
QString name;
|
||||
QString category;
|
||||
QString filename;
|
||||
QString path;
|
||||
QString tooltip;
|
||||
int internal;
|
||||
int type;
|
||||
int subtype;
|
||||
};
|
||||
extern QVector<EffectMeta> effects;
|
||||
|
||||
double log_volume(double linear);
|
||||
|
||||
enum EffectType {
|
||||
EFFECT_TYPE_INVALID,
|
||||
EFFECT_TYPE_VIDEO,
|
||||
EFFECT_TYPE_AUDIO,
|
||||
EFFECT_TYPE_EFFECT,
|
||||
EFFECT_TYPE_TRANSITION
|
||||
};
|
||||
|
||||
enum EffectKeyframeType {
|
||||
EFFECT_KEYFRAME_LINEAR,
|
||||
EFFECT_KEYFRAME_BEZIER,
|
||||
EFFECT_KEYFRAME_HOLD
|
||||
};
|
||||
|
||||
enum EffectInternal {
|
||||
EFFECT_INTERNAL_TRANSFORM,
|
||||
EFFECT_INTERNAL_TEXT,
|
||||
EFFECT_INTERNAL_SOLID,
|
||||
EFFECT_INTERNAL_NOISE,
|
||||
EFFECT_INTERNAL_VOLUME,
|
||||
EFFECT_INTERNAL_PAN,
|
||||
EFFECT_INTERNAL_TONE,
|
||||
EFFECT_INTERNAL_SHAKE,
|
||||
EFFECT_INTERNAL_TIMECODE,
|
||||
EFFECT_INTERNAL_MASK,
|
||||
EFFECT_INTERNAL_FILLLEFTRIGHT,
|
||||
EFFECT_INTERNAL_VST,
|
||||
EFFECT_INTERNAL_CORNERPIN,
|
||||
EFFECT_INTERNAL_FREI0R,
|
||||
EFFECT_INTERNAL_RICHTEXT,
|
||||
EFFECT_INTERNAL_COUNT
|
||||
};
|
||||
|
||||
struct GLTextureCoords {
|
||||
int grid_size;
|
||||
|
||||
int vertexTopLeftX;
|
||||
int vertexTopLeftY;
|
||||
int vertexTopLeftZ;
|
||||
int vertexTopRightX;
|
||||
int vertexTopRightY;
|
||||
int vertexTopRightZ;
|
||||
int vertexBottomLeftX;
|
||||
int vertexBottomLeftY;
|
||||
int vertexBottomLeftZ;
|
||||
int vertexBottomRightX;
|
||||
int vertexBottomRightY;
|
||||
int vertexBottomRightZ;
|
||||
|
||||
float textureTopLeftX;
|
||||
float textureTopLeftY;
|
||||
float textureTopLeftQ;
|
||||
float textureTopRightX;
|
||||
float textureTopRightY;
|
||||
float textureTopRightQ;
|
||||
float textureBottomRightX;
|
||||
float textureBottomRightY;
|
||||
float textureBottomRightQ;
|
||||
float textureBottomLeftX;
|
||||
float textureBottomLeftY;
|
||||
float textureBottomLeftQ;
|
||||
|
||||
int blendmode;
|
||||
float opacity;
|
||||
};
|
||||
|
||||
const EffectMeta* get_meta_from_name(const QString& input);
|
||||
|
||||
qint16 mix_audio_sample(qint16 a, qint16 b);
|
||||
|
||||
class Effect : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Effect(Clip *c, const EffectMeta* em);
|
||||
~Effect();
|
||||
|
||||
Clip* parent_clip;
|
||||
const EffectMeta* meta;
|
||||
int id;
|
||||
QString name;
|
||||
|
||||
void AddRow(EffectRow* row);
|
||||
|
||||
EffectRow* row(int i);
|
||||
int row_count();
|
||||
|
||||
EffectGizmo* add_gizmo(int type);
|
||||
EffectGizmo* gizmo(int i);
|
||||
int gizmo_count();
|
||||
|
||||
bool IsEnabled();
|
||||
bool IsExpanded();
|
||||
|
||||
virtual void refresh();
|
||||
|
||||
virtual EffectPtr copy(Clip* c);
|
||||
void copy_field_keyframes(EffectPtr e);
|
||||
|
||||
virtual void load(QXmlStreamReader& stream);
|
||||
virtual void custom_load(QXmlStreamReader& stream);
|
||||
virtual void save(QXmlStreamWriter& stream);
|
||||
|
||||
void load_from_string(const QByteArray &s);
|
||||
QByteArray save_to_string();
|
||||
|
||||
// glsl handling
|
||||
bool is_open();
|
||||
void open();
|
||||
void close();
|
||||
bool is_glsl_linked();
|
||||
virtual void startEffect();
|
||||
virtual void endEffect();
|
||||
|
||||
enum VideoEffectFlags {
|
||||
ShaderFlag = 0x1,
|
||||
CoordsFlag = 0x2,
|
||||
SuperimposeFlag = 0x4,
|
||||
ImageFlag = 0x8
|
||||
};
|
||||
int Flags();
|
||||
void SetFlags(int flags);
|
||||
|
||||
int getIterations();
|
||||
void setIterations(int i);
|
||||
|
||||
const char* ffmpeg_filter;
|
||||
|
||||
virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size);
|
||||
virtual void process_shader(double timecode, GLTextureCoords&, int iteration);
|
||||
virtual void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||
virtual GLuint process_superimpose(double timecode);
|
||||
virtual void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
|
||||
virtual void gizmo_draw(double timecode, GLTextureCoords& coords);
|
||||
void gizmo_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode, bool done);
|
||||
void gizmo_world_to_screen();
|
||||
bool are_gizmos_enabled();
|
||||
|
||||
template <typename T>
|
||||
T randomNumber()
|
||||
{
|
||||
static std::random_device device;
|
||||
static std::mt19937 generator(device());
|
||||
static std::uniform_int_distribution<> distribution(std::numeric_limits<T>::min(), std::numeric_limits<T>::max());
|
||||
return distribution(generator);
|
||||
}
|
||||
|
||||
static EffectPtr Create(Clip *c, const EffectMeta *em);
|
||||
static const EffectMeta* GetInternalMeta(int internal_id, int type);
|
||||
public slots:
|
||||
void FieldChanged();
|
||||
void SetEnabled(bool b);
|
||||
void SetExpanded(bool e);
|
||||
signals:
|
||||
void EnabledChanged(bool);
|
||||
private slots:
|
||||
void delete_self();
|
||||
void move_up();
|
||||
void move_down();
|
||||
void save_to_file();
|
||||
void load_from_file();
|
||||
protected:
|
||||
// glsl effect
|
||||
QOpenGLShaderProgram* glslProgram;
|
||||
QString vertPath;
|
||||
QString fragPath;
|
||||
|
||||
// superimpose effect
|
||||
QImage img;
|
||||
QOpenGLTexture* texture;
|
||||
|
||||
// enable effect to update constantly
|
||||
virtual bool AlwaysUpdate();
|
||||
|
||||
private:
|
||||
bool isOpen;
|
||||
QVector<EffectRow*> rows;
|
||||
QVector<EffectGizmo*> gizmos;
|
||||
bool bound;
|
||||
int iterations;
|
||||
|
||||
bool enabled_;
|
||||
bool expanded_;
|
||||
|
||||
int flags_;
|
||||
|
||||
QVector<KeyframeDataChange*> gizmo_dragging_actions_;
|
||||
|
||||
// superimpose functions
|
||||
virtual void redraw(double timecode);
|
||||
bool valueHasChanged(double timecode);
|
||||
QVector<QVariant> cachedValues;
|
||||
void delete_texture();
|
||||
void validate_meta_path();
|
||||
};
|
||||
|
||||
#endif // EFFECT_H
|
||||
+23
-59
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -24,33 +24,23 @@
|
||||
#include <QtMath>
|
||||
|
||||
#include "rendering/renderfunctions.h"
|
||||
|
||||
#include "global/config.h"
|
||||
|
||||
#include "global/timing.h"
|
||||
#include "effects/effectrow.h"
|
||||
#include "effects/effect.h"
|
||||
|
||||
#include "nodes/node.h"
|
||||
#include "undo/undo.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "timeline/sequence.h"
|
||||
|
||||
#include "global/math.h"
|
||||
|
||||
#include "global/debug.h"
|
||||
|
||||
EffectField::EffectField(EffectRow* parent, const QString &i, EffectFieldType t) :
|
||||
EffectField::EffectField(EffectRow* parent, EffectFieldType t) :
|
||||
QObject(parent),
|
||||
type_(t),
|
||||
id_(i),
|
||||
enabled_(true),
|
||||
colspan_(1)
|
||||
enabled_(true)
|
||||
{
|
||||
// EffectField MUST be created with a parent.
|
||||
Q_ASSERT(parent != nullptr);
|
||||
Q_ASSERT(!i.isEmpty() || t == EFFECT_FIELD_UI);
|
||||
|
||||
// Add this field to the parent row specified
|
||||
parent->AddField(this);
|
||||
|
||||
// Set a very base default value
|
||||
SetValueAt(0, 0);
|
||||
@@ -64,17 +54,6 @@ EffectRow *EffectField::GetParentRow()
|
||||
return static_cast<EffectRow*>(parent());
|
||||
}
|
||||
|
||||
int EffectField::GetColumnSpan()
|
||||
{
|
||||
return colspan_;
|
||||
}
|
||||
|
||||
void EffectField::SetColumnSpan(int i)
|
||||
{
|
||||
Q_ASSERT(i >= 1);
|
||||
colspan_ = i;
|
||||
}
|
||||
|
||||
QVariant EffectField::ConvertStringToValue(const QString &s)
|
||||
{
|
||||
return s;
|
||||
@@ -175,7 +154,9 @@ QVariant EffectField::GetValueAt(double timecode)
|
||||
} else {
|
||||
QColor before_data = keyframes.at(before_keyframe).data.value<QColor>();
|
||||
QColor after_data = keyframes.at(after_keyframe).data.value<QColor>();
|
||||
value = QColor(lerp(before_data.red(), after_data.red(), progress), lerp(before_data.green(), after_data.green(), progress), lerp(before_data.blue(), after_data.blue(), progress));
|
||||
value = QColor(lerp(before_data.red(), after_data.red(), progress),
|
||||
lerp(before_data.green(), after_data.green(), progress),
|
||||
lerp(before_data.blue(), after_data.blue(), progress));
|
||||
}
|
||||
persistent_data_ = value;
|
||||
break;
|
||||
@@ -234,18 +215,6 @@ void EffectField::SetValueAt(double time, const QVariant &value)
|
||||
emit Changed();
|
||||
}
|
||||
|
||||
double EffectField::Now()
|
||||
{
|
||||
Clip* c = GetParentRow()->GetParentEffect()->parent_clip;
|
||||
return playhead_to_clip_seconds(c, c->sequence->playhead);
|
||||
}
|
||||
|
||||
long EffectField::NowInFrames()
|
||||
{
|
||||
Clip* c = GetParentRow()->GetParentEffect()->parent_clip;
|
||||
return playhead_to_clip_frame(c, c->sequence->playhead);
|
||||
}
|
||||
|
||||
void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca)
|
||||
{
|
||||
if (enabled) {
|
||||
@@ -253,7 +222,7 @@ void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca)
|
||||
// Create keyframe from perpetual data
|
||||
EffectKeyframe key;
|
||||
|
||||
key.time = NowInFrames();
|
||||
key.time = GetParentRow()->GetParentEffect()->NowInFrames();
|
||||
key.data = persistent_data_;
|
||||
key.type = EFFECT_KEYFRAME_LINEAR;
|
||||
|
||||
@@ -266,7 +235,7 @@ void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca)
|
||||
// Convert keyframes to one "perpetual" keyframe
|
||||
|
||||
// Set first keyframe to whatever the data is now
|
||||
ca->append(new SetQVariant(&persistent_data_, persistent_data_, GetValueAt(Now())));
|
||||
ca->append(new SetQVariant(&persistent_data_, persistent_data_, GetValueAt(GetParentRow()->GetParentEffect()->Now())));
|
||||
|
||||
// Delete all keyframes
|
||||
for (int i=0;i<keyframes.size();i++) {
|
||||
@@ -281,11 +250,6 @@ const EffectField::EffectFieldType &EffectField::type()
|
||||
return type_;
|
||||
}
|
||||
|
||||
const QString &EffectField::id()
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
double EffectField::GetValidKeyframeHandlePosition(int key, bool post) {
|
||||
int comp_key = -1;
|
||||
|
||||
@@ -333,11 +297,11 @@ double EffectField::GetValidKeyframeHandlePosition(int key, bool post) {
|
||||
}
|
||||
|
||||
double EffectField::FrameToSeconds(long frame) {
|
||||
return (double(frame) / GetParentRow()->GetParentEffect()->parent_clip->sequence->frame_rate);
|
||||
return (double(frame) / GetParentRow()->GetParentEffect()->parent_clip->track()->sequence()->frame_rate);
|
||||
}
|
||||
|
||||
long EffectField::SecondsToFrame(double seconds) {
|
||||
return qRound(seconds * GetParentRow()->GetParentEffect()->parent_clip->sequence->frame_rate);
|
||||
return qRound(seconds * GetParentRow()->GetParentEffect()->parent_clip->track()->sequence()->frame_rate);
|
||||
}
|
||||
|
||||
void EffectField::GetKeyframeData(double timecode, int &before, int &after, double &progress) {
|
||||
|
||||
+15
-88
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
#include <QVector>
|
||||
|
||||
#include "effects/keyframe.h"
|
||||
#include "undo/undo.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "nodes/nodedatatypes.h"
|
||||
|
||||
class EffectRow;
|
||||
class ComboAction;
|
||||
@@ -56,6 +56,7 @@ class ComboAction;
|
||||
class EffectField : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief The EffectFieldType enum
|
||||
*
|
||||
@@ -101,18 +102,11 @@ public:
|
||||
* using the QObject parent/child system to automate memory management. EffectFields are never expected
|
||||
* to change parent during their lifetime.
|
||||
*
|
||||
* @param i
|
||||
*
|
||||
* Field ID. Must be non-empty. Must also be unique within this Effect. Used for saving/loading values into project
|
||||
* files so that if ordering of fields are changed, or fields are added/removed from Effects later in development,
|
||||
* saved values in project files will still link with the correct field. Also used as the uniform variable name
|
||||
* in GLSL shaders.
|
||||
*
|
||||
* @param t
|
||||
*
|
||||
* The type of data contained within this field. This is expected to be filled by a derived class.
|
||||
*/
|
||||
EffectField(EffectRow* parent, const QString& i, EffectFieldType t);
|
||||
EffectField(EffectRow* parent, EffectFieldType t);
|
||||
|
||||
/**
|
||||
* @brief Get the EffectRow that this field is a member of.
|
||||
@@ -134,15 +128,6 @@ public:
|
||||
*/
|
||||
const EffectFieldType& type();
|
||||
|
||||
/**
|
||||
* @brief Get the unique identifier of this field set in the constructor
|
||||
*
|
||||
* Mostly used for saving/loading or interacting with GLSL-based shader effects (see EffectField() for more details).
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
const QString& id();
|
||||
|
||||
/**
|
||||
* @brief Get the value of this field at a given timecode
|
||||
*
|
||||
@@ -193,18 +178,6 @@ public:
|
||||
*/
|
||||
void SetValueAt(double time, const QVariant& value);
|
||||
|
||||
/**
|
||||
* @brief Get the current clip/media time
|
||||
*
|
||||
* A convenience function that can be plugged into GetValueAt() to get the value wherever the appropriate Sequence's
|
||||
* playhead it.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* Current clip/media time in seconds.
|
||||
*/
|
||||
double Now();
|
||||
|
||||
/**
|
||||
* @brief Set up keyframing on this field
|
||||
*
|
||||
@@ -228,30 +201,6 @@ public:
|
||||
*/
|
||||
void PrepareDataForKeyframing(bool enabled, ComboAction* ca);
|
||||
|
||||
/**
|
||||
* @brief Get field's column span
|
||||
*
|
||||
* Used whenever constructing the effect's UI. EffectFields are visually laid out in a table, and some widgets can
|
||||
* be set to take up multiple columns for a better visual flow.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The current column span.
|
||||
*/
|
||||
int GetColumnSpan();
|
||||
|
||||
/**
|
||||
* @brief Set field's column span
|
||||
*
|
||||
* Used whenever constructing the effect's UI. EffectFields are visually laid out in a table, and some widgets can
|
||||
* be set to take up multiple columns for a better visual flow.
|
||||
*
|
||||
* @param i
|
||||
*
|
||||
* The column span to set on this field.
|
||||
*/
|
||||
void SetColumnSpan(int i);
|
||||
|
||||
/**
|
||||
* @brief Convert a value from this field to a string
|
||||
*
|
||||
@@ -432,11 +381,6 @@ private:
|
||||
*/
|
||||
EffectFieldType type_;
|
||||
|
||||
/**
|
||||
* @brief Internal unique identifier for this field set in the constructor. Access with id().
|
||||
*/
|
||||
QString id_;
|
||||
|
||||
/**
|
||||
* @brief Used by GetValueAt() to determine whether to use keyframe data or persistent data
|
||||
* @return
|
||||
@@ -492,28 +436,11 @@ private:
|
||||
*/
|
||||
void GetKeyframeData(double timecode, int& before, int& after, double& d);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the current clip as a frame number
|
||||
*
|
||||
* Same as Now() but retrieves the value as a frame number (in the appropriate Sequence's frame rate) instead of
|
||||
* seconds.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The current clip time in frames
|
||||
*/
|
||||
long NowInFrames();
|
||||
|
||||
/**
|
||||
* @brief Internal enabled value
|
||||
*/
|
||||
bool enabled_;
|
||||
|
||||
/**
|
||||
* @brief Internal column span value
|
||||
*/
|
||||
int colspan_;
|
||||
|
||||
};
|
||||
|
||||
#endif // EFFECTFIELD_H
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef EFFECTFIELDS_H
|
||||
#define EFFECTFIELDS_H
|
||||
|
||||
|
||||
+14
-14
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "effects/fields/doublefield.h"
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
EffectGizmo::EffectGizmo(Effect *parent, int type) :
|
||||
EffectGizmo::EffectGizmo(Node *parent, int type) :
|
||||
QObject(parent),
|
||||
x_field1(nullptr),
|
||||
x_field_multi1(1.0),
|
||||
|
||||
+18
-17
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -27,25 +27,26 @@ enum GizmoType {
|
||||
GIZMO_TYPE_TARGET
|
||||
};
|
||||
|
||||
#define GIZMO_DOT_SIZE 2.5
|
||||
#define GIZMO_TARGET_SIZE 5.0
|
||||
#define GIZMO_DOT_SIZE 2.5f
|
||||
#define GIZMO_TARGET_SIZE 5.0f
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QRect>
|
||||
#include <QPoint>
|
||||
#include <QVector>
|
||||
#include <QVector3D>
|
||||
#include <QColor>
|
||||
|
||||
class DoubleField;
|
||||
class Effect;
|
||||
class Node;
|
||||
|
||||
class EffectGizmo : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
EffectGizmo(Effect* parent, int type);
|
||||
EffectGizmo(Node* parent, int type);
|
||||
|
||||
QVector<QPoint> world_pos;
|
||||
QVector<QVector3D> world_pos;
|
||||
QVector<QPoint> screen_pos;
|
||||
|
||||
DoubleField* x_field1;
|
||||
|
||||
+83
-199
@@ -1,149 +1,106 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "effectloaders.h"
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include <QDir>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QDebug>
|
||||
|
||||
#include "nodes/node.h"
|
||||
#include "effects/transition.h"
|
||||
#include "global/path.h"
|
||||
#include "panels/panels.h"
|
||||
#include "panels/effectcontrols.h"
|
||||
#include "global/config.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QLibrary>
|
||||
#include <QDebug>
|
||||
#include "effects/internal/transformeffect.h"
|
||||
#include "effects/internal/texteffect.h"
|
||||
#include "effects/internal/timecodeeffect.h"
|
||||
#include "effects/internal/solideffect.h"
|
||||
#include "effects/internal/audionoiseeffect.h"
|
||||
#include "effects/internal/toneeffect.h"
|
||||
#include "effects/internal/volumeeffect.h"
|
||||
#include "effects/internal/paneffect.h"
|
||||
#include "effects/internal/shakeeffect.h"
|
||||
#include "effects/internal/cornerpineffect.h"
|
||||
#include "effects/internal/vsthost.h"
|
||||
#include "effects/internal/fillleftrighteffect.h"
|
||||
#include "effects/internal/richtexteffect.h"
|
||||
|
||||
#ifndef NOFREI0R
|
||||
#include <frei0r.h>
|
||||
typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info);
|
||||
#endif
|
||||
#include "effects/internal/crossdissolvetransition.h"
|
||||
#include "effects/internal/linearfadetransition.h"
|
||||
#include "effects/internal/logarithmicfadetransition.h"
|
||||
#include "effects/internal/exponentialfadetransition.h"
|
||||
|
||||
#include "nodes/nodes/nodemedia.h"
|
||||
#include "nodes/nodes/nodeimageoutput.h"
|
||||
#include "nodes/nodes/nodeshader.h"
|
||||
|
||||
QMutex olive::effects_loaded;
|
||||
|
||||
void load_internal_effects() {
|
||||
if (!olive::CurrentRuntimeConfig.shaders_are_enabled) {
|
||||
if (!olive::runtime_config.shaders_are_enabled) {
|
||||
qWarning() << "Shaders are disabled, some effects may be nonfunctional";
|
||||
}
|
||||
|
||||
EffectMeta em;
|
||||
olive::node_library.resize(kInvalidNode);
|
||||
olive::node_library.fill(nullptr);
|
||||
|
||||
// load internal effects
|
||||
em.path = ":/internalshaders";
|
||||
|
||||
em.type = EFFECT_TYPE_EFFECT;
|
||||
em.subtype = EFFECT_TYPE_AUDIO;
|
||||
|
||||
em.name = "Volume";
|
||||
em.internal = EFFECT_INTERNAL_VOLUME;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Pan";
|
||||
em.internal = EFFECT_INTERNAL_PAN;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "VST Plugin 2.x";
|
||||
em.internal = EFFECT_INTERNAL_VST;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Tone";
|
||||
em.internal = EFFECT_INTERNAL_TONE;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Noise";
|
||||
em.internal = EFFECT_INTERNAL_NOISE;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Fill Left/Right";
|
||||
em.internal = EFFECT_INTERNAL_FILLLEFTRIGHT;
|
||||
effects.append(em);
|
||||
|
||||
em.subtype = EFFECT_TYPE_VIDEO;
|
||||
|
||||
em.name = "Transform";
|
||||
em.category = "Distort";
|
||||
em.internal = EFFECT_INTERNAL_TRANSFORM;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Corner Pin";
|
||||
em.internal = EFFECT_INTERNAL_CORNERPIN;
|
||||
effects.append(em);
|
||||
|
||||
/*em.name = "Mask";
|
||||
em.internal = EFFECT_INTERNAL_MASK;
|
||||
effects.append(em);*/
|
||||
|
||||
em.name = "Shake";
|
||||
em.internal = EFFECT_INTERNAL_SHAKE;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Text";
|
||||
em.category = "Render";
|
||||
em.internal = EFFECT_INTERNAL_TEXT;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Rich Text";
|
||||
em.category = "Render";
|
||||
em.internal = EFFECT_INTERNAL_RICHTEXT;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Timecode";
|
||||
em.internal = EFFECT_INTERNAL_TIMECODE;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Solid";
|
||||
em.internal = EFFECT_INTERNAL_SOLID;
|
||||
effects.append(em);
|
||||
|
||||
// internal transitions
|
||||
em.type = EFFECT_TYPE_TRANSITION;
|
||||
em.category = "";
|
||||
|
||||
em.name = "Cross Dissolve";
|
||||
em.internal = TRANSITION_INTERNAL_CROSSDISSOLVE;
|
||||
effects.append(em);
|
||||
|
||||
em.subtype = EFFECT_TYPE_AUDIO;
|
||||
|
||||
em.name = "Linear Fade";
|
||||
em.internal = TRANSITION_INTERNAL_LINEARFADE;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Exponential Fade";
|
||||
em.internal = TRANSITION_INTERNAL_EXPONENTIALFADE;
|
||||
effects.append(em);
|
||||
|
||||
em.name = "Logarithmic Fade";
|
||||
em.internal = TRANSITION_INTERNAL_LOGARITHMICFADE;
|
||||
effects.append(em);
|
||||
olive::node_library[kTransformEffect] = std::make_shared<TransformEffect>(nullptr);
|
||||
olive::node_library[kTextInput] = std::make_shared<TextEffect>(nullptr);
|
||||
olive::node_library[kSolidInput] = std::make_shared<SolidEffect>(nullptr);
|
||||
olive::node_library[kNoiseInput] = std::make_shared<AudioNoiseEffect>(nullptr);
|
||||
olive::node_library[kVolumeEffect] = std::make_shared<VolumeEffect>(nullptr);
|
||||
olive::node_library[kPanEffect] = std::make_shared<PanEffect>(nullptr);
|
||||
olive::node_library[kToneInput] = std::make_shared<ToneEffect>(nullptr);
|
||||
olive::node_library[kShakeEffect] = std::make_shared<ShakeEffect>(nullptr);
|
||||
olive::node_library[kTimecodeEffect] = std::make_shared<TimecodeEffect>(nullptr);
|
||||
olive::node_library[kFillLeftRightEffect] = std::make_shared<FillLeftRightEffect>(nullptr);
|
||||
olive::node_library[kVstEffect] = std::make_shared<VSTHost>(nullptr);
|
||||
olive::node_library[kCornerPinEffect] = std::make_shared<CornerPinEffect>(nullptr);
|
||||
olive::node_library[kRichTextInput] = std::make_shared<RichTextEffect>(nullptr);
|
||||
olive::node_library[kMediaInput] = std::make_shared<NodeMedia>(nullptr);
|
||||
olive::node_library[kImageOutput] = std::make_shared<NodeImageOutput>(nullptr);
|
||||
olive::node_library[kCrossDissolveTransition] = std::make_shared<CrossDissolveTransition>(nullptr);
|
||||
olive::node_library[kLinearFadeTransition] = std::make_shared<LinearFadeTransition>(nullptr);
|
||||
olive::node_library[kExponentialFadeTransition] = std::make_shared<ExponentialFadeTransition>(nullptr);
|
||||
olive::node_library[kLogarithmicFadeTransition] = std::make_shared<LogarithmicFadeTransition>(nullptr);
|
||||
}
|
||||
|
||||
void load_shader_effects_worker(const QString& effects_path) {
|
||||
QDir effects_dir(effects_path);
|
||||
if (effects_dir.exists()) {
|
||||
QList<QString> entries = effects_dir.entryList(QStringList("*.xml"), QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
||||
QList<QString> entries = effects_dir.entryList({"*.xml"},
|
||||
QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
||||
for (int i=0;i<entries.size();i++) {
|
||||
QString entry_path = effects_dir.filePath(entries.at(i));
|
||||
if (QFileInfo(entry_path).isDir()) {
|
||||
load_shader_effects_worker(entry_path);
|
||||
} else {
|
||||
QFile file(effects_path + "/" + entries.at(i));
|
||||
QString file_url = QDir(effects_path).filePath(entries.at(i));
|
||||
|
||||
QFile file(file_url);
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qCritical() << "Could not open" << entries.at(i);
|
||||
return;
|
||||
@@ -152,26 +109,25 @@ void load_shader_effects_worker(const QString& effects_path) {
|
||||
QXmlStreamReader reader(&file);
|
||||
while (!reader.atEnd()) {
|
||||
if (reader.name() == "effect") {
|
||||
QString effect_name = "";
|
||||
QString effect_cat = "";
|
||||
QString effect_name;
|
||||
QString effect_cat;
|
||||
QString effect_id;
|
||||
const QXmlStreamAttributes attr = reader.attributes();
|
||||
for (int j=0;j<attr.size();j++) {
|
||||
if (attr.at(j).name() == "name") {
|
||||
effect_name = attr.at(j).value().toString();
|
||||
} else if (attr.at(j).name() == "category") {
|
||||
effect_cat = attr.at(j).value().toString();
|
||||
} else if (attr.at(j).name() == "id") {
|
||||
effect_id = attr.at(j).value().toString();
|
||||
}
|
||||
}
|
||||
if (!effect_name.isEmpty()) {
|
||||
EffectMeta em;
|
||||
em.type = EFFECT_TYPE_EFFECT;
|
||||
em.subtype = EFFECT_TYPE_VIDEO;
|
||||
em.name = effect_name;
|
||||
em.category = effect_cat;
|
||||
em.filename = file.fileName();
|
||||
em.path = effects_path;
|
||||
em.internal = -1;
|
||||
effects.append(em);
|
||||
if (!effect_name.isEmpty() && !effect_id.isEmpty()) {
|
||||
olive::node_library.append(std::make_shared<NodeShader>(nullptr,
|
||||
effect_name,
|
||||
effect_id,
|
||||
effect_cat,
|
||||
file_url));
|
||||
} else {
|
||||
qCritical() << "Invalid effect found in" << entries.at(i);
|
||||
}
|
||||
@@ -201,86 +157,14 @@ void EffectInit::StartLoading() {
|
||||
init_thread->start();
|
||||
}
|
||||
|
||||
#ifndef NOFREI0R
|
||||
void load_frei0r_effects_worker(const QString& dir, EffectMeta& em, QVector<QString>& loaded_names) {
|
||||
QDir search_dir(dir);
|
||||
if (search_dir.exists()) {
|
||||
QList<QString> entry_list = search_dir.entryList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||
for (int j=0;j<entry_list.size();j++) {
|
||||
QString entry_path = search_dir.filePath(entry_list.at(j));
|
||||
if (QFileInfo(entry_path).isDir()) {
|
||||
load_frei0r_effects_worker(entry_path, em, loaded_names);
|
||||
} else {
|
||||
|
||||
QString path_without_extension = search_dir.filePath(QFileInfo(entry_list.at(j)).baseName());
|
||||
|
||||
QLibrary effect;
|
||||
effect.setFileName(path_without_extension);
|
||||
if (effect.load()) {
|
||||
f0rGetPluginInfo get_info_func = reinterpret_cast<f0rGetPluginInfo>(effect.resolve("f0r_get_plugin_info"));
|
||||
if (get_info_func != nullptr) {
|
||||
f0r_plugin_info_t info;
|
||||
get_info_func(&info);
|
||||
|
||||
if (!loaded_names.contains(info.name)
|
||||
&& info.plugin_type == F0R_PLUGIN_TYPE_FILTER
|
||||
&& info.color_model == F0R_COLOR_MODEL_RGBA8888) {
|
||||
em.name = info.name;
|
||||
em.path = dir;
|
||||
em.filename = entry_list.at(j);
|
||||
em.tooltip = QString("%1\n%2\n%3\n%4").arg(em.name, info.author, info.explanation, em.filename);
|
||||
|
||||
loaded_names.append(em.name);
|
||||
|
||||
effects.append(em);
|
||||
}
|
||||
}
|
||||
effect.unload();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void load_frei0r_effects() {
|
||||
QList<QString> effect_dirs = get_effects_paths();
|
||||
|
||||
// add defined paths for frei0r plugins on unix
|
||||
#if defined(Q_OS_MACOS) || defined(Q_OS_LINUX) || defined(__HAIKU__)
|
||||
effect_dirs.prepend("/usr/lib/frei0r-1");
|
||||
effect_dirs.prepend("/usr/local/lib/frei0r-1");
|
||||
effect_dirs.prepend(QDir::homePath() + "/.frei0r-1/lib");
|
||||
#endif
|
||||
|
||||
QString env_path(qgetenv("FREI0R_PATH"));
|
||||
if (!env_path.isEmpty()) effect_dirs.append(env_path);
|
||||
|
||||
QVector<QString> loaded_names;
|
||||
|
||||
// search for paths
|
||||
EffectMeta em;
|
||||
em.category = "Frei0r";
|
||||
em.type = EFFECT_TYPE_EFFECT;
|
||||
em.subtype = EFFECT_TYPE_VIDEO;
|
||||
em.internal = EFFECT_INTERNAL_FREI0R;
|
||||
|
||||
for (int i=0;i<effect_dirs.size();i++) {
|
||||
load_frei0r_effects_worker(effect_dirs.at(i), em, loaded_names);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
EffectInit::EffectInit() {
|
||||
panel_effect_controls->effects_loaded.lock();
|
||||
olive::effects_loaded.lock();
|
||||
}
|
||||
|
||||
void EffectInit::run() {
|
||||
qInfo() << "Initializing effects...";
|
||||
load_internal_effects();
|
||||
load_shader_effects();
|
||||
#ifndef NOFREI0R
|
||||
load_frei0r_effects();
|
||||
#endif
|
||||
panel_effect_controls->effects_loaded.unlock();
|
||||
olive::effects_loaded.unlock();
|
||||
qInfo() << "Finished initializing effects";
|
||||
}
|
||||
|
||||
+17
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
|
||||
namespace olive {
|
||||
extern QMutex effects_loaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The EffectInit class
|
||||
|
||||
+136
-26
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -32,17 +32,23 @@
|
||||
#include "panels/effectcontrols.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "panels/grapheditor.h"
|
||||
#include "effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "ui/keyframenavigator.h"
|
||||
#include "ui/clickablelabel.h"
|
||||
|
||||
EffectRow::EffectRow(Effect *parent, const QString &n, bool savable, bool keyframable) :
|
||||
EffectRow::EffectRow(Node *parent,
|
||||
const QString &id,
|
||||
const QString &name,
|
||||
bool savable,
|
||||
bool keyframable) :
|
||||
QObject(parent),
|
||||
name_(n),
|
||||
id_(id),
|
||||
name_(name),
|
||||
keyframable_(keyframable),
|
||||
keyframing_(false),
|
||||
savable_(savable)
|
||||
savable_(savable),
|
||||
output_type_(olive::nodes::kInvalid)
|
||||
{
|
||||
Q_ASSERT(parent != nullptr);
|
||||
|
||||
@@ -52,15 +58,67 @@ EffectRow::EffectRow(Effect *parent, const QString &n, bool savable, bool keyfra
|
||||
void EffectRow::AddField(EffectField *field)
|
||||
{
|
||||
field->setParent(this);
|
||||
|
||||
connect(field, SIGNAL(Clicked()), this, SIGNAL(Clicked()));
|
||||
connect(field, SIGNAL(Changed()), this, SIGNAL(Changed()));
|
||||
|
||||
fields_.append(field);
|
||||
}
|
||||
|
||||
void EffectRow::AddAcceptedNodeInput(olive::nodes::DataType type)
|
||||
{
|
||||
Q_ASSERT(output_type_ == olive::nodes::kInvalid);
|
||||
|
||||
accepted_inputs_.append(type);
|
||||
}
|
||||
|
||||
void EffectRow::ConnectEdge(EffectRow *output, EffectRow *input)
|
||||
{
|
||||
// Make sure one is an output and one is an input
|
||||
Q_ASSERT(output->IsNodeInput() != input->IsNodeInput());
|
||||
|
||||
// Swap them if necessary
|
||||
if (input->IsNodeOutput()) {
|
||||
EffectRow* temp = output;
|
||||
output = input;
|
||||
input = temp;
|
||||
}
|
||||
|
||||
// Inputs can only have one edge, so we disconnect it here if there is one
|
||||
if (!input->node_edges_.isEmpty()) {
|
||||
DisconnectEdge(input->node_edges_.first());
|
||||
}
|
||||
|
||||
NodeEdgePtr edge = std::make_shared<NodeEdge>(output, input);
|
||||
|
||||
output->node_edges_.append(edge);
|
||||
input->node_edges_.append(edge);
|
||||
|
||||
emit output->EdgesChanged();
|
||||
}
|
||||
|
||||
void EffectRow::DisconnectEdge(NodeEdgePtr edge)
|
||||
{
|
||||
EffectRow* output = edge->output();
|
||||
EffectRow* input = edge->input();
|
||||
|
||||
output->node_edges_.removeAll(edge);
|
||||
input->node_edges_.removeAll(edge);
|
||||
|
||||
emit output->EdgesChanged();
|
||||
}
|
||||
|
||||
QVector<NodeEdgePtr> EffectRow::edges()
|
||||
{
|
||||
return node_edges_;
|
||||
}
|
||||
|
||||
bool EffectRow::IsKeyframing() {
|
||||
return keyframing_;
|
||||
}
|
||||
|
||||
void EffectRow::SetKeyframingInternal(bool b) {
|
||||
if (GetParentEffect()->meta->type != EFFECT_TYPE_TRANSITION) {
|
||||
if (GetParentEffect()->type() != EFFECT_TYPE_TRANSITION) {
|
||||
keyframing_ = b;
|
||||
emit KeyframingSetChanged(keyframing_);
|
||||
}
|
||||
@@ -76,6 +134,58 @@ bool EffectRow::IsKeyframable()
|
||||
return keyframable_;
|
||||
}
|
||||
|
||||
QVariant EffectRow::GetValueAt(double timecode)
|
||||
{
|
||||
Q_ASSERT(FieldCount() == 1);
|
||||
|
||||
return Field(0)->GetValueAt(timecode);
|
||||
}
|
||||
|
||||
void EffectRow::SetValueAt(double timecode, const QVariant &value)
|
||||
{
|
||||
Q_ASSERT(FieldCount() == 1);
|
||||
|
||||
Field(0)->SetValueAt(timecode, value);
|
||||
}
|
||||
|
||||
void EffectRow::SetEnabled(bool enabled)
|
||||
{
|
||||
for (int i=0;i<FieldCount();i++) {
|
||||
Field(i)->SetEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectRow::SetOutputDataType(olive::nodes::DataType type)
|
||||
{
|
||||
Q_ASSERT(accepted_inputs_.isEmpty());
|
||||
|
||||
output_type_ = type;
|
||||
}
|
||||
|
||||
bool EffectRow::CanAcceptDataType(olive::nodes::DataType type)
|
||||
{
|
||||
if (!IsNodeInput()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return accepted_inputs_.contains(type);
|
||||
}
|
||||
|
||||
olive::nodes::DataType EffectRow::OutputDataType()
|
||||
{
|
||||
return output_type_;
|
||||
}
|
||||
|
||||
bool EffectRow::IsNodeInput()
|
||||
{
|
||||
return !accepted_inputs_.isEmpty();
|
||||
}
|
||||
|
||||
bool EffectRow::IsNodeOutput()
|
||||
{
|
||||
return output_type_ != olive::nodes::kInvalid;
|
||||
}
|
||||
|
||||
void EffectRow::SetKeyframingEnabled(bool enabled) {
|
||||
if (enabled == keyframing_) {
|
||||
return;
|
||||
@@ -93,7 +203,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
|
||||
Field(i)->PrepareDataForKeyframing(true, ca);
|
||||
}
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
|
||||
update_ui(false);
|
||||
|
||||
@@ -116,7 +226,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
|
||||
// Disable keyframing setting on this row
|
||||
ca->append(new SetIsKeyframing(this, false));
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
|
||||
update_ui(false);
|
||||
|
||||
@@ -131,7 +241,7 @@ void EffectRow::SetKeyframingEnabled(bool enabled) {
|
||||
void EffectRow::GoToPreviousKeyframe() {
|
||||
long key = LONG_MIN;
|
||||
Clip* c = GetParentEffect()->parent_clip;
|
||||
long sequence_playhead = c->sequence->playhead;
|
||||
long sequence_playhead = c->track()->sequence()->playhead;
|
||||
|
||||
// Used to convert clip frame number to sequence frame number
|
||||
long time_adjustment = c->timeline_in() - c->clip_in();
|
||||
@@ -158,7 +268,7 @@ void EffectRow::GoToPreviousKeyframe() {
|
||||
|
||||
void EffectRow::ToggleKeyframe() {
|
||||
Clip* c = GetParentEffect()->parent_clip;
|
||||
long sequence_playhead = c->sequence->playhead;
|
||||
long sequence_playhead = c->track()->sequence()->playhead;
|
||||
|
||||
// Used to convert clip frame number to sequence frame number
|
||||
long time_adjustment = c->timeline_in() - c->clip_in();
|
||||
@@ -222,7 +332,7 @@ void EffectRow::ToggleKeyframe() {
|
||||
|
||||
}
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
@@ -233,7 +343,7 @@ void EffectRow::GoToNextKeyframe() {
|
||||
EffectField* f = Field(i);
|
||||
for (int j=0;j<f->keyframes.size();j++) {
|
||||
long comp = f->keyframes.at(j).time - c->clip_in() + c->timeline_in();
|
||||
if (comp > olive::ActiveSequence->playhead) {
|
||||
if (comp > c->track()->sequence()->playhead) {
|
||||
key = qMin(comp, key);
|
||||
}
|
||||
}
|
||||
@@ -251,7 +361,7 @@ void EffectRow::SetKeyframeOnAllFields(ComboAction* ca) {
|
||||
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(field);
|
||||
|
||||
field->SetValueAt(field->Now(), field->GetValueAt(field->Now()));
|
||||
field->SetValueAt(GetParentEffect()->Now(), field->GetValueAt(GetParentEffect()->Now()));
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
ca->append(kdc);
|
||||
@@ -260,9 +370,9 @@ void EffectRow::SetKeyframeOnAllFields(ComboAction* ca) {
|
||||
panel_effect_controls->update_keyframes();
|
||||
}
|
||||
|
||||
Effect *EffectRow::GetParentEffect()
|
||||
Node *EffectRow::GetParentEffect()
|
||||
{
|
||||
return static_cast<Effect*>(parent());
|
||||
return static_cast<Node*>(parent());
|
||||
}
|
||||
|
||||
const QString &EffectRow::name() {
|
||||
|
||||
+232
-28
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
class Effect;
|
||||
class Node;
|
||||
class QGridLayout;
|
||||
class EffectField;
|
||||
class QLabel;
|
||||
@@ -35,6 +35,7 @@ class KeyframeNavigator;
|
||||
class ClickableLabel;
|
||||
|
||||
#include "effectfields.h"
|
||||
#include "nodes/nodeedge.h"
|
||||
|
||||
/**
|
||||
* @brief The EffectRow class
|
||||
@@ -51,6 +52,7 @@ class ClickableLabel;
|
||||
class EffectRow : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief EffectRow Constructor
|
||||
*
|
||||
@@ -60,7 +62,14 @@ public:
|
||||
* EffectRow and automatically frees it through the QObject parent/child system. EffectRows are never intended to
|
||||
* change parents throughout their lifetimes.
|
||||
*
|
||||
* @param n
|
||||
* @param id
|
||||
*
|
||||
* Field ID. Must be non-empty. Must also be unique within this Effect. Used for saving/loading values into project
|
||||
* files so that if ordering of fields are changed, or fields are added/removed from Effects later in development,
|
||||
* saved values in project files will still link with the correct field. Also used as the uniform variable name
|
||||
* in GLSL shaders.
|
||||
*
|
||||
* @param name
|
||||
*
|
||||
* Row name. This is not used as an internal identifier, it's just for the user interface, so it can be translated
|
||||
* with no issue.
|
||||
@@ -75,19 +84,11 @@ public:
|
||||
* Whether keyframing can be enabled on this row or not. This is true by default. Some values you may want to prevent
|
||||
* the user from keyframing (e.g. the filename of a VST plugin), which can be done by setting this to false.
|
||||
*/
|
||||
EffectRow(Effect* parent, const QString& n, bool savable = true, bool keyframable = true);
|
||||
|
||||
/**
|
||||
* @brief Add a field to this row
|
||||
*
|
||||
* Ownership of the EffectField is transferred to this row and the row will free its memory. In the Effect's UI, this
|
||||
* will add the field to an additional column.
|
||||
*
|
||||
* @param Field
|
||||
*
|
||||
* The field to add to this row.
|
||||
*/
|
||||
void AddField(EffectField* Field);
|
||||
EffectRow(Node* parent,
|
||||
const QString& id,
|
||||
const QString& name,
|
||||
bool savable = true,
|
||||
bool keyframable = true);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the EffectField at this index. Must be less than FieldCount().
|
||||
@@ -126,7 +127,7 @@ public:
|
||||
*
|
||||
* @return The parent Effect object that this row is attached to.
|
||||
*/
|
||||
Effect* GetParentEffect();
|
||||
Node* GetParentEffect();
|
||||
|
||||
/**
|
||||
* @brief Return the row's name
|
||||
@@ -135,6 +136,15 @@ public:
|
||||
*/
|
||||
const QString& name();
|
||||
|
||||
/**
|
||||
* @brief Get the unique identifier of this field set in the constructor
|
||||
*
|
||||
* Mostly used for saving/loading or interacting with GLSL-based shader effects (see EffectField() for more details).
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
const QString& id();
|
||||
|
||||
/**
|
||||
* @brief Get whether this row is keyframing or not
|
||||
*
|
||||
@@ -163,6 +173,150 @@ public:
|
||||
* @return True if this row can be keyframed. This value is set in the constructor.
|
||||
*/
|
||||
bool IsKeyframable();
|
||||
|
||||
/**
|
||||
* @brief Get value at a given timecode
|
||||
*
|
||||
* Functions as a wrapper for EffectField::GetValueAt().
|
||||
*
|
||||
* The default function is to return the result of the first EffectField on this EffectRow which should be sufficient
|
||||
* for most input types. If this EffectRow has more or less than one EffectField, you must override this function in a
|
||||
* derived class to provide the correct field <-> row coordination or else it will trigger an abort.
|
||||
*
|
||||
* @param timecode
|
||||
*
|
||||
* Timecode to get the value at
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* The value of the first EffectField at the given timecode
|
||||
*/
|
||||
virtual QVariant GetValueAt(double timecode);
|
||||
|
||||
/**
|
||||
* @brief SetValueAt
|
||||
*
|
||||
* Functions as a wrapper for EffectField::SetValueAt().
|
||||
*
|
||||
* The default function is to call the function of the first EffectField on this EffectRow which should be sufficient
|
||||
* for most input types. If this EffectRow has more or less than one EffectField, you must override this function in a
|
||||
* derived class to provide the correct field <-> row coordination or else it will trigger an abort.
|
||||
*
|
||||
* @param timecode
|
||||
*
|
||||
* Timecode to set the value at
|
||||
*
|
||||
* @param value
|
||||
*
|
||||
* Value to set at this timecode
|
||||
*/
|
||||
virtual void SetValueAt(double timecode, const QVariant& value);
|
||||
|
||||
/**
|
||||
* @brief Sets the enabled state on all EffectField objects on this row to enabled
|
||||
*/
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Check if nodes can be connected to this as an input.
|
||||
*
|
||||
* Connecting is enabled by adding an accepted node input using AddNodeInput().
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* TRUE if nodes can be connected as an input.
|
||||
*/
|
||||
bool IsNodeInput();
|
||||
|
||||
/**
|
||||
* @brief Check if nodes can be connected to this as an output
|
||||
*
|
||||
* Connecting is enabled by setting an output data type in SetOutputDataType().
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* TRUE if nodes can be connected as an output
|
||||
*/
|
||||
bool IsNodeOutput();
|
||||
|
||||
/**
|
||||
* @brief Set output data type
|
||||
*
|
||||
* Set the type of data this row outputs to type
|
||||
*/
|
||||
void SetOutputDataType(olive::nodes::DataType type);
|
||||
|
||||
/**
|
||||
* @brief Check if this row can accept the data type specified in type
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* TRUE if this row can accept this data type. If this row is not an input, this function will always return FALSE.
|
||||
*/
|
||||
bool CanAcceptDataType(olive::nodes::DataType type);
|
||||
|
||||
/**
|
||||
* @brief Get this row's output data type
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* If this is not an output, this will always return olive::nodes::kInvalid
|
||||
*/
|
||||
olive::nodes::DataType OutputDataType();
|
||||
|
||||
/**
|
||||
* @brief Adds a node data type that can be accepted by this input
|
||||
*
|
||||
* Allows this input to take a node connection from a data type specified by type. An input can take several data
|
||||
* types.
|
||||
*
|
||||
* @param type
|
||||
*
|
||||
* The data type to add
|
||||
*/
|
||||
void AddAcceptedNodeInput(olive::nodes::DataType type);
|
||||
|
||||
/**
|
||||
* @brief Connect two node sockets together
|
||||
*
|
||||
* For outputs, the maximum amount of edges is unlimited and this will continually add to a list of edges. For inputs,
|
||||
* there can only be one edge and adding a second will destroy the first.
|
||||
*
|
||||
* @param edge
|
||||
*
|
||||
* The edge to add (output) or replace the current edge (input).
|
||||
*/
|
||||
static void ConnectEdge(EffectRow* output, EffectRow* input);
|
||||
|
||||
/**
|
||||
* @brief Disconnect an edge
|
||||
*
|
||||
* Disconnects two nodes and destroys the edge object connecting them together
|
||||
*
|
||||
* @param edge
|
||||
*
|
||||
* Edge to be removed
|
||||
*/
|
||||
static void DisconnectEdge(NodeEdgePtr edge);
|
||||
|
||||
/**
|
||||
* @brief Get a list of references to all edges currently connected to this row
|
||||
*/
|
||||
QVector<NodeEdgePtr> edges();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Add a field to this row
|
||||
*
|
||||
* Ownership of the EffectField is transferred to this row and the row will free its memory. In the Effect's UI, this
|
||||
* will add the field to an additional column.
|
||||
*
|
||||
* @param Field
|
||||
*
|
||||
* The field to add to this row.
|
||||
*/
|
||||
void AddField(EffectField* Field);
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Go to previous keyframe
|
||||
@@ -199,6 +353,7 @@ public slots:
|
||||
*/
|
||||
void FocusRow();
|
||||
signals:
|
||||
|
||||
/**
|
||||
* @brief Keyframing setting changed signal
|
||||
*
|
||||
@@ -209,6 +364,28 @@ signals:
|
||||
* True if keyframing was enabled, false if keyframing was disabled.
|
||||
*/
|
||||
void KeyframingSetChanged(bool);
|
||||
|
||||
/**
|
||||
* @brief Changed signal
|
||||
*
|
||||
* Wrapper for EffectField::Changed().
|
||||
*/
|
||||
void Changed();
|
||||
|
||||
/**
|
||||
* @brief Clicked signal
|
||||
*
|
||||
* Wrapper for EffectField::Clicked().
|
||||
*/
|
||||
void Clicked();
|
||||
|
||||
/**
|
||||
* @brief Edges changed signal
|
||||
*
|
||||
* Signal emitted any time an edge is connected or disconnected from this row
|
||||
*/
|
||||
void EdgesChanged();
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Set keyframing enabled state
|
||||
@@ -222,6 +399,12 @@ private slots:
|
||||
*/
|
||||
void SetKeyframingEnabled(bool);
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Internal unique identifier for this field set in the constructor. Access with id().
|
||||
*/
|
||||
QString id_;
|
||||
|
||||
/**
|
||||
* @brief Internal variable for the row's name
|
||||
*
|
||||
@@ -257,6 +440,27 @@ private:
|
||||
* get freed automatically.
|
||||
*/
|
||||
QVector<EffectField*> fields_;
|
||||
|
||||
/**
|
||||
* @brief Internal array of accepted node data types.
|
||||
*
|
||||
* Is mutally-exclusive with accepted_outputs_, i.e. you cannot have values added to this and also a value set in
|
||||
* accepted_outputs_.
|
||||
*/
|
||||
QVector<olive::nodes::DataType> accepted_inputs_;
|
||||
|
||||
/**
|
||||
* @brief Internal value for what kind of data this row outputs
|
||||
*
|
||||
* Is mutally-exclusive with accepted_inputs_, i.e. you cannot have values added to it and also a value set in
|
||||
* this.
|
||||
*/
|
||||
olive::nodes::DataType output_type_;
|
||||
|
||||
/**
|
||||
* @brief Internal array of node edges. Access with AddEdge() and RemoveEdge().
|
||||
*/
|
||||
QVector<NodeEdgePtr> node_edges_;
|
||||
};
|
||||
|
||||
#endif // EFFECTROW_H
|
||||
|
||||
@@ -1,9 +1,32 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "boolfield.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
BoolField::BoolField(EffectRow *parent, const QString &id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_BOOL)
|
||||
#include "nodes/node.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
BoolField::BoolField(EffectRow *parent) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_BOOL)
|
||||
{}
|
||||
|
||||
bool BoolField::GetBoolAt(double timecode)
|
||||
@@ -69,8 +92,8 @@ void BoolField::UpdateFromWidget(bool b)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), b);
|
||||
SetValueAt(GetParentRow()->GetParentEffect()->Now(), b);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef BOOLFIELD_H
|
||||
#define BOOLFIELD_H
|
||||
|
||||
@@ -15,7 +35,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::EffectField().
|
||||
*/
|
||||
BoolField(EffectRow* parent, const QString& id);
|
||||
BoolField(EffectRow* parent);
|
||||
|
||||
/**
|
||||
* @brief Get the boolean value at a given timecode
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "buttonfield.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
ButtonField::ButtonField(EffectRow *parent, const QString &string) :
|
||||
EffectField(parent, nullptr, EFFECT_FIELD_UI),
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_UI),
|
||||
button_text_(string)
|
||||
{}
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef BUTTONFIELD_H
|
||||
#define BUTTONFIELD_H
|
||||
|
||||
|
||||
@@ -1,11 +1,33 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "colorfield.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#include "ui/colorbutton.h"
|
||||
#include "nodes/node.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
ColorField::ColorField(EffectRow* parent, const QString& id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_COLOR)
|
||||
ColorField::ColorField(EffectRow* parent) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_COLOR)
|
||||
{}
|
||||
|
||||
QColor ColorField::GetColorAt(double timecode)
|
||||
@@ -44,8 +66,8 @@ void ColorField::UpdateFromWidget(const QColor& c)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), c);
|
||||
SetValueAt(GetParentRow()->GetParentEffect()->Now(), c);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef COLORFIELD_H
|
||||
#define COLORFIELD_H
|
||||
|
||||
@@ -15,7 +35,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::EffectField().
|
||||
*/
|
||||
ColorField(EffectRow* parent, const QString& id);
|
||||
ColorField(EffectRow* parent);
|
||||
|
||||
/**
|
||||
* @brief Get the color value at a given timecode
|
||||
|
||||
@@ -1,11 +1,33 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "combofield.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "nodes/node.h"
|
||||
#include "ui/comboboxex.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
ComboField::ComboField(EffectRow* parent, const QString& id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_COMBO)
|
||||
ComboField::ComboField(EffectRow* parent) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_COMBO)
|
||||
{}
|
||||
|
||||
void ComboField::AddItem(const QString &text, const QVariant &data)
|
||||
@@ -64,8 +86,8 @@ void ComboField::UpdateFromWidget(int index)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), items_.at(index).data);
|
||||
SetValueAt(GetParentRow()->GetParentEffect()->Now(), items_.at(index).data);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef COMBOFIELD_H
|
||||
#define COMBOFIELD_H
|
||||
|
||||
@@ -28,7 +48,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::EffectField().
|
||||
*/
|
||||
ComboField(EffectRow* parent, const QString& id);
|
||||
ComboField(EffectRow* parent);
|
||||
|
||||
/**
|
||||
* @brief Add an item to this ComboField
|
||||
|
||||
@@ -1,9 +1,30 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "doublefield.h"
|
||||
|
||||
#include "effects/effectrow.h"
|
||||
#include "nodes/node.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
DoubleField::DoubleField(EffectRow* parent, const QString& id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_DOUBLE),
|
||||
DoubleField::DoubleField(EffectRow* parent) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_DOUBLE),
|
||||
min_(qSNaN()),
|
||||
max_(qSNaN()),
|
||||
default_(0),
|
||||
@@ -118,12 +139,12 @@ void DoubleField::UpdateFromWidget(double d)
|
||||
kdc_ = new KeyframeDataChange(this);
|
||||
}
|
||||
|
||||
SetValueAt(Now(), d);
|
||||
SetValueAt(GetParentRow()->GetParentEffect()->Now(), d);
|
||||
|
||||
if (!ls->IsDragging() && kdc_ != nullptr) {
|
||||
kdc_->SetNewKeyframes();
|
||||
|
||||
olive::UndoStack.push(kdc_);
|
||||
olive::undo_stack.push(kdc_);
|
||||
|
||||
kdc_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,31 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef DOUBLEFIELD_H
|
||||
#define DOUBLEFIELD_H
|
||||
|
||||
#include "../effectfield.h"
|
||||
#include "ui/labelslider.h"
|
||||
|
||||
class KeyframeDataChange;
|
||||
|
||||
/**
|
||||
* @brief The DoubleField class
|
||||
*
|
||||
@@ -17,7 +39,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::EffectField().
|
||||
*/
|
||||
DoubleField(EffectRow* parent, const QString& id);
|
||||
DoubleField(EffectRow* parent);
|
||||
|
||||
/**
|
||||
* @brief Get double value at timecode
|
||||
|
||||
@@ -1,11 +1,33 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "filefield.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "ui/embeddedfilechooser.h"
|
||||
#include "nodes/node.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
FileField::FileField(EffectRow* parent, const QString &id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_FILE)
|
||||
FileField::FileField(EffectRow* parent) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_FILE)
|
||||
{
|
||||
// Set default value to an empty string
|
||||
SetValueAt(0, "");
|
||||
@@ -39,8 +61,8 @@ void FileField::UpdateFromWidget(const QString &s)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), s);
|
||||
SetValueAt(GetParentRow()->GetParentEffect()->Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,30 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef FILEFIELD_H
|
||||
#define FILEFIELD_H
|
||||
|
||||
#include "../effectfield.h"
|
||||
|
||||
/**
|
||||
* @brief The FileField class
|
||||
* @brief The FileInput class
|
||||
*
|
||||
* An EffectField derivative that produces filenames in string and uses an EmbeddedFileChooser
|
||||
* as its visual representation.
|
||||
@@ -16,7 +36,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::EffectField().
|
||||
*/
|
||||
FileField(EffectRow* parent, const QString& id);
|
||||
FileField(EffectRow* parent);
|
||||
|
||||
/**
|
||||
* @brief Get the filename at the given timecode
|
||||
|
||||
@@ -1,14 +1,36 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "fontfield.h"
|
||||
|
||||
#include <QFontDatabase>
|
||||
#include <QDebug>
|
||||
|
||||
#include "ui/comboboxex.h"
|
||||
#include "nodes/node.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
// NOTE/TODO: This shares a lot of similarity with ComboField, and could probably be a derived class of it
|
||||
// NOTE/TODO: This shares a lot of similarity with ComboInput, and could probably be a derived class of it
|
||||
|
||||
FontField::FontField(EffectRow* parent, const QString &id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_FONT)
|
||||
FontField::FontField(EffectRow* parent) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_FONT)
|
||||
{
|
||||
font_list = QFontDatabase().families();
|
||||
|
||||
@@ -66,8 +88,8 @@ void FontField::UpdateFromWidget(const QString& s)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), s);
|
||||
SetValueAt(GetParentRow()->GetParentEffect()->Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef FONTFIELD_H
|
||||
#define FONTFIELD_H
|
||||
|
||||
@@ -17,7 +37,7 @@ public:
|
||||
/**
|
||||
* @brief Reimplementation of EffectField::EffectField().
|
||||
*/
|
||||
FontField(EffectRow* parent, const QString& id);
|
||||
FontField(EffectRow* parent);
|
||||
|
||||
/**
|
||||
* @brief Get the font family name at the given timecode
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "labelfield.h"
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
LabelField::LabelField(EffectRow *parent, const QString &string) :
|
||||
EffectField(parent, nullptr, EFFECT_FIELD_UI),
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_UI),
|
||||
label_text_(string)
|
||||
{}
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef LABELFIELD_H
|
||||
#define LABELFIELD_H
|
||||
|
||||
|
||||
@@ -1,13 +1,35 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "stringfield.h"
|
||||
|
||||
#include <QtMath>
|
||||
#include <QDebug>
|
||||
|
||||
#include "nodes/node.h"
|
||||
#include "ui/texteditex.h"
|
||||
#include "global/config.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
StringField::StringField(EffectRow* parent, const QString& id, bool rich_text) :
|
||||
EffectField(parent, id, EFFECT_FIELD_STRING),
|
||||
StringField::StringField(EffectRow* parent, bool rich_text) :
|
||||
EffectField(parent, EffectField::EFFECT_FIELD_STRING),
|
||||
rich_text_(rich_text)
|
||||
{
|
||||
// Set default value to an empty string
|
||||
@@ -31,7 +53,7 @@ QWidget *StringField::CreateWidget(QWidget *existing)
|
||||
text_edit->setUndoRedoEnabled(true);
|
||||
|
||||
// the "2" is because the height needs one extra pixel of padding on the top and the bottom
|
||||
text_edit->setTextHeight(qCeil(text_edit->fontMetrics().lineSpacing()*olive::CurrentConfig.effect_textbox_lines
|
||||
text_edit->setTextHeight(qCeil(text_edit->fontMetrics().lineSpacing()*olive::config.effect_textbox_lines
|
||||
+ text_edit->document()->documentMargin()
|
||||
+ text_edit->document()->documentMargin() + 2));
|
||||
|
||||
@@ -72,8 +94,8 @@ void StringField::UpdateFromWidget(const QString &s)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), s);
|
||||
SetValueAt(GetParentRow()->GetParentEffect()->Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
olive::undo_stack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef STRINGFIELD_H
|
||||
#define STRINGFIELD_H
|
||||
|
||||
@@ -19,7 +39,7 @@ public:
|
||||
* Provides a setting for whether this StringField - and its attached TextEditEx objects - should operate in rich
|
||||
* text or plain text mode, defaulting to rich text mode.
|
||||
*/
|
||||
StringField(EffectRow* parent, const QString& id, bool rich_text = true);
|
||||
StringField(EffectRow* parent, bool rich_text = true);
|
||||
|
||||
/**
|
||||
* @brief Get the string at the given timecode
|
||||
|
||||
@@ -1,61 +1,94 @@
|
||||
/*
|
||||
* Olive. Olive is a free non-linear video editor for Windows, macOS, and Linux.
|
||||
* Copyright (C) 2018 {{ organization }}
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
*along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "audionoiseeffect.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QtMath>
|
||||
|
||||
AudioNoiseEffect::AudioNoiseEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* amount_row = new EffectRow(this, tr("Amount"));
|
||||
amount_val = new DoubleField(amount_row, "amount");
|
||||
AudioNoiseEffect::AudioNoiseEffect(Clip* c) : Node(c) {
|
||||
amount_val = new DoubleInput(this, "amount", tr("Amount"));
|
||||
amount_val->SetMinimum(0);
|
||||
amount_val->SetDefault(20);
|
||||
amount_val->SetMaximum(100);
|
||||
|
||||
EffectRow* mix_row = new EffectRow(this, tr("Mix"));
|
||||
mix_val = new BoolField(mix_row, "mix");
|
||||
mix_val = new BoolInput(this, "mix", tr("Mix"));
|
||||
mix_val->SetValueAt(0, true);
|
||||
}
|
||||
|
||||
void AudioNoiseEffect::process_audio(double timecode_start, double timecode_end, quint8 *samples, int nb_bytes, int) {
|
||||
double interval = (timecode_end - timecode_start)/nb_bytes;
|
||||
for (int i=0;i<nb_bytes;i+=4) {
|
||||
QString AudioNoiseEffect::name()
|
||||
{
|
||||
return tr("Noise");
|
||||
}
|
||||
|
||||
QString AudioNoiseEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.noise";
|
||||
}
|
||||
|
||||
QString AudioNoiseEffect::description()
|
||||
{
|
||||
return tr("Generate audio noise that can be mixed with this clip.");
|
||||
}
|
||||
|
||||
EffectType AudioNoiseEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType AudioNoiseEffect::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr AudioNoiseEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<AudioNoiseEffect>(c);
|
||||
}
|
||||
|
||||
void AudioNoiseEffect::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
|
||||
Q_UNUSED(type)
|
||||
|
||||
double interval = (timecode_end - timecode_start)/nb_samples;
|
||||
for (int i=0;i<nb_samples;i+=4) {
|
||||
double timecode = timecode_start+(interval*i);
|
||||
|
||||
qint16 left_noise_sample = this->randomNumber<qint16>();
|
||||
qint16 right_noise_sample = this->randomNumber<qint16>();
|
||||
|
||||
// set noise volume
|
||||
double vol = log_volume( amount_val->GetDoubleAt(timecode)*0.01 );
|
||||
left_noise_sample *= vol;
|
||||
right_noise_sample *= vol;
|
||||
float vol = log_volume( amount_val->GetDoubleAt(timecode)*0.01 );
|
||||
|
||||
// mix with source audio
|
||||
if (mix_val->GetBoolAt(timecode)) {
|
||||
qint16 left_sample = static_cast<qint16> (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
qint16 right_sample = static_cast<qint16> (((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
|
||||
left_noise_sample = mix_audio_sample(left_noise_sample, left_sample);
|
||||
right_noise_sample = mix_audio_sample(right_noise_sample, right_sample);
|
||||
for (int j=0;j<channel_count;j++) {
|
||||
// Generate noise sample
|
||||
float noise_sample = this->randomFloat<float>() * vol;
|
||||
|
||||
// mix with source audio
|
||||
if (mix_val->GetBoolAt(timecode)) {
|
||||
samples[j][i] += noise_sample;
|
||||
} else {
|
||||
samples[j][i] = noise_sample;
|
||||
}
|
||||
}
|
||||
|
||||
samples[i+3] = static_cast<quint8> (right_noise_sample >> 8);
|
||||
samples[i+2] = static_cast<quint8> (right_noise_sample);
|
||||
samples[i+1] = static_cast<quint8> (left_noise_sample >> 8);
|
||||
samples[i] = static_cast<quint8> (left_noise_sample);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,49 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef AUDIONOISEEFFECT_H
|
||||
#define AUDIONOISEEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class AudioNoiseEffect : public Effect {
|
||||
class AudioNoiseEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AudioNoiseEffect(Clip* c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
AudioNoiseEffect(Clip* c);
|
||||
|
||||
DoubleField* amount_val;
|
||||
BoolField* mix_val;
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
|
||||
DoubleInput* amount_val;
|
||||
BoolInput* mix_val;
|
||||
};
|
||||
|
||||
#endif // AUDIONOISEEFFECT_H
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
#version 110
|
||||
|
||||
const int BLEND_MODE_ADD = 0;
|
||||
const int BLEND_MODE_AVERAGE = 1;
|
||||
const int BLEND_MODE_COLORBURN = 2;
|
||||
const int BLEND_MODE_COLORDODGE = 3;
|
||||
const int BLEND_MODE_DARKEN = 4;
|
||||
const int BLEND_MODE_DIFFERENCE = 5;
|
||||
const int BLEND_MODE_EXCLUSION = 6;
|
||||
const int BLEND_MODE_GLOW = 7;
|
||||
const int BLEND_MODE_HARDLIGHT = 8;
|
||||
const int BLEND_MODE_HARDMIX = 9;
|
||||
const int BLEND_MODE_LIGHTEN = 10;
|
||||
const int BLEND_MODE_LINEARBURN = 11;
|
||||
const int BLEND_MODE_LINEARDODGE = 12;
|
||||
const int BLEND_MODE_LINEARLIGHT = 13;
|
||||
const int BLEND_MODE_MULTIPLY = 14;
|
||||
const int BLEND_MODE_NEGATION = 15;
|
||||
const int BLEND_MODE_NORMAL = 16;
|
||||
const int BLEND_MODE_OVERLAY = 17;
|
||||
const int BLEND_MODE_PHOENIX = 18;
|
||||
const int BLEND_MODE_PINLIGHT = 19;
|
||||
const int BLEND_MODE_REFLECT = 20;
|
||||
const int BLEND_MODE_SCREEN = 21;
|
||||
const int BLEND_MODE_SOFTLIGHT = 22;
|
||||
const int BLEND_MODE_SUBSTRACT = 23;
|
||||
const int BLEND_MODE_SUBTRACT = 24;
|
||||
const int BLEND_MODE_VIVIDLIGHT = 25;
|
||||
|
||||
uniform sampler2D background;
|
||||
uniform sampler2D foreground;
|
||||
|
||||
uniform int blendmode;
|
||||
uniform float opacity;
|
||||
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
// adapted from https://github.com/jamieowen/glsl-blend
|
||||
// and http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html
|
||||
|
||||
// float blending functions
|
||||
float blend_color_burn(float base, float blend) {
|
||||
return (blend==0.0)?blend:max((1.0-((1.0-base)/blend)),0.0);
|
||||
}
|
||||
|
||||
float blend_color_dodge(float base, float blend) {
|
||||
return (blend==1.0)?blend:min(base/(1.0-blend),1.0);
|
||||
}
|
||||
|
||||
float blend_vivid_light(float base, float blend) {
|
||||
return (blend<0.5)?blend_color_burn(base,(2.0*blend)):blend_color_dodge(base,(2.0*(blend-0.5)));
|
||||
}
|
||||
|
||||
vec3 blend_vivid_light(vec3 base, vec3 blend) {
|
||||
return vec3(blend_vivid_light(base.r,blend.r),blend_vivid_light(base.g,blend.g),blend_vivid_light(base.b,blend.b));
|
||||
}
|
||||
|
||||
float blend_hard_mix(float base, float blend) {
|
||||
return (blend_vivid_light(base,blend)<0.5)?0.0:1.0;
|
||||
}
|
||||
|
||||
float blend_lighten(float base, float blend) {
|
||||
return max(blend,base);
|
||||
}
|
||||
|
||||
float blend_overlay(float base, float blend) {
|
||||
return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));
|
||||
}
|
||||
|
||||
vec3 blend_overlay(vec3 base, vec3 blend) {
|
||||
return vec3(blend_overlay(base.r,blend.r),blend_overlay(base.g,blend.g),blend_overlay(base.b,blend.b));
|
||||
}
|
||||
|
||||
float blend_darken(float base, float blend) {
|
||||
return min(blend, base);
|
||||
}
|
||||
|
||||
float blend_linear_burn(float base, float blend) {
|
||||
return max(base+blend-1.0,0.0);
|
||||
}
|
||||
|
||||
vec3 blend_linear_burn(vec3 base, vec3 blend) {
|
||||
return max(base+blend-vec3(1.0),vec3(0.0));
|
||||
}
|
||||
|
||||
float blend_linear_dodge(float base, float blend) {
|
||||
return min(base+blend,1.0);
|
||||
}
|
||||
|
||||
vec3 blend_linear_dodge(vec3 base, vec3 blend) {
|
||||
return min(base+blend,vec3(1.0));
|
||||
}
|
||||
|
||||
float blend_linear_light(float base, float blend) {
|
||||
return blend<0.5?blend_linear_burn(base,(2.0*blend)):blend_linear_dodge(base,(2.0*(blend-0.5)));
|
||||
}
|
||||
|
||||
float blend_pin_light(float base, float blend) {
|
||||
return (blend<0.5)?blend_darken(base,(2.0*blend)):blend_lighten(base,(2.0*(blend-0.5)));
|
||||
}
|
||||
|
||||
float blend_reflect(float base, float blend) {
|
||||
return (blend==1.0)?blend:min(base*base/(1.0-blend),1.0);
|
||||
}
|
||||
|
||||
vec3 blend_reflect(vec3 base, vec3 blend) {
|
||||
return vec3(blend_reflect(base.r,blend.r),blend_reflect(base.g,blend.g),blend_reflect(base.b,blend.b));
|
||||
}
|
||||
|
||||
float blend_screen(float base, float blend) {
|
||||
return 1.0-((1.0-base)*(1.0-blend));
|
||||
}
|
||||
|
||||
float blend_substract(float base, float blend) {
|
||||
return max(base+blend-1.0,0.0);
|
||||
}
|
||||
|
||||
float blend_soft_light(float base, float blend) {
|
||||
return (blend<0.5)?(2.0*base*blend+base*base*(1.0-2.0*blend)):(sqrt(base)*(2.0*blend-1.0)+2.0*base*(1.0-blend));
|
||||
}
|
||||
|
||||
// RGB blending function, alpha is handled below
|
||||
vec3 blend(vec3 base, vec3 blend) {
|
||||
if (blendmode == BLEND_MODE_AVERAGE) {
|
||||
return (base+blend)/2.0;
|
||||
} else if (blendmode == BLEND_MODE_COLORBURN) {
|
||||
return vec3(blend_color_burn(base.r, blend.r), blend_color_burn(base.g, blend.g), blend_color_burn(base.b, blend.b));
|
||||
} else if (blendmode == BLEND_MODE_COLORDODGE) {
|
||||
return vec3(blend_color_dodge(base.r, blend.r), blend_color_dodge(base.g, blend.g), blend_color_dodge(base.b, blend.b));
|
||||
} else if (blendmode == BLEND_MODE_DARKEN) {
|
||||
return vec3(blend_darken(base.r, blend.r), blend_darken(base.g, blend.g), blend_darken(base.b, blend.b));
|
||||
} else if (blendmode == BLEND_MODE_DIFFERENCE) {
|
||||
return abs(base-blend);
|
||||
} else if (blendmode == BLEND_MODE_EXCLUSION) {
|
||||
return base+blend-2.0*base*blend;
|
||||
} else if (blendmode == BLEND_MODE_GLOW) {
|
||||
return blend_reflect(blend, base);
|
||||
} else if (blendmode == BLEND_MODE_HARDLIGHT) {
|
||||
return blend_overlay(blend,base);
|
||||
} else if (blendmode == BLEND_MODE_HARDMIX) {
|
||||
return vec3(blend_hard_mix(base.r,blend.r),blend_hard_mix(base.g,blend.g),blend_hard_mix(base.b,blend.b));
|
||||
} else if (blendmode == BLEND_MODE_LIGHTEN) {
|
||||
return vec3(blend_lighten(base.r,blend.r),blend_lighten(base.g,blend.g),blend_lighten(base.b,blend.b));
|
||||
} else if (blendmode == BLEND_MODE_LINEARBURN || blendmode == BLEND_MODE_SUBTRACT) {
|
||||
return blend_linear_burn(base, blend);
|
||||
} else if (blendmode == BLEND_MODE_LINEARDODGE || blendmode == BLEND_MODE_ADD) {
|
||||
return blend_linear_dodge(base, blend);
|
||||
} else if (blendmode == BLEND_MODE_LINEARLIGHT) {
|
||||
return vec3(blend_linear_light(base.r,blend.r),blend_linear_light(base.g,blend.g),blend_linear_light(base.b,blend.b));
|
||||
} else if (blendmode == BLEND_MODE_MULTIPLY) {
|
||||
return (base * blend);
|
||||
} else if (blendmode == BLEND_MODE_NEGATION) {
|
||||
return vec3(1.0)-abs(vec3(1.0)-base-blend);
|
||||
} else if (blendmode == BLEND_MODE_OVERLAY) {
|
||||
return blend_overlay(base, blend);
|
||||
} else if (blendmode == BLEND_MODE_PHOENIX) {
|
||||
return min(base,blend)-max(base,blend)+vec3(1.0);
|
||||
} else if (blendmode == BLEND_MODE_PINLIGHT) {
|
||||
return vec3(blend_pin_light(base.r,blend.r),blend_pin_light(base.g,blend.g),blend_pin_light(base.b,blend.b));
|
||||
} else if (blendmode == BLEND_MODE_REFLECT) {
|
||||
return blend_reflect(base, blend);
|
||||
} else if (blendmode == BLEND_MODE_SCREEN) {
|
||||
return vec3(blend_screen(base.r,blend.r),blend_screen(base.g,blend.g),blend_screen(base.b,blend.b));
|
||||
} else if (blendmode == BLEND_MODE_SUBSTRACT) {
|
||||
return max(base+blend-vec3(1.0),vec3(0.0));
|
||||
} else if (blendmode == BLEND_MODE_SOFTLIGHT) {
|
||||
return vec3(blend_soft_light(base.r,blend.r),blend_soft_light(base.g,blend.g),blend_soft_light(base.b,blend.b));
|
||||
} else if (blendmode == BLEND_MODE_VIVIDLIGHT) {
|
||||
return vec3(blend_vivid_light(base.r,blend.r),blend_vivid_light(base.g,blend.g),blend_vivid_light(base.b,blend.b));
|
||||
} else {
|
||||
return blend;
|
||||
}
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec4 bg_color = texture2D(background, vTexCoord);
|
||||
vec4 fg_color = texture2D(foreground, vTexCoord);
|
||||
|
||||
// blend textures together
|
||||
vec3 composite = blend(bg_color.rgb, fg_color.rgb);
|
||||
|
||||
// add foreground and background alpha's together
|
||||
// float alpha_opac = fg_color.a*opacity;
|
||||
|
||||
if (blendmode == BLEND_MODE_OVERLAY
|
||||
|| blendmode == BLEND_MODE_LIGHTEN
|
||||
|| blendmode == BLEND_MODE_SCREEN
|
||||
|| blendmode == BLEND_MODE_COLORDODGE
|
||||
|| blendmode == BLEND_MODE_LINEARDODGE
|
||||
|| blendmode == BLEND_MODE_ADD
|
||||
|| blendmode == BLEND_MODE_SOFTLIGHT
|
||||
|| blendmode == BLEND_MODE_NEGATION
|
||||
|| blendmode == BLEND_MODE_AVERAGE
|
||||
|| blendmode == BLEND_MODE_REFLECT
|
||||
|| blendmode == BLEND_MODE_EXCLUSION
|
||||
|| blendmode == BLEND_MODE_DIFFERENCE) {
|
||||
composite *= fg_color.a;
|
||||
}
|
||||
|
||||
vec4 full_composite = vec4(composite + bg_color.rgb*(1.0-fg_color.a), bg_color.a + fg_color.a);
|
||||
// vec4 full_composite = vec4(mix(bg_color.rgb, composite, alpha_opac), bg_color.a + alpha_opac);
|
||||
|
||||
full_composite = mix(bg_color, full_composite, opacity);
|
||||
|
||||
// output to color
|
||||
gl_FragColor = full_composite;
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -24,74 +24,93 @@
|
||||
#include "timeline/clip.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
CornerPinEffect::CornerPinEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
SetFlags(Effect::CoordsFlag | Effect::ShaderFlag);
|
||||
CornerPinEffect::CornerPinEffect(Clip* c) : Node(c) {
|
||||
SetFlags(Node::CoordsFlag | Node::ShaderFlag);
|
||||
|
||||
EffectRow* top_left = new EffectRow(this, tr("Top Left"));
|
||||
top_left_x = new DoubleField(top_left, "topleftx");
|
||||
top_left_y = new DoubleField(top_left, "toplefty");
|
||||
top_left = new Vec2Input(this, "topleft", tr("Top Left"));
|
||||
|
||||
EffectRow* top_right = new EffectRow(this, tr("Top Right"));
|
||||
top_right_x = new DoubleField(top_right, "toprightx");
|
||||
top_right_y = new DoubleField(top_right, "toprighty");
|
||||
top_right = new Vec2Input(this, "topright", tr("Top Right"));
|
||||
|
||||
EffectRow* bottom_left = new EffectRow(this, tr("Bottom Left"));
|
||||
bottom_left_x = new DoubleField(bottom_left, "bottomleftx");
|
||||
bottom_left_y = new DoubleField(bottom_left, "bottomlefty");
|
||||
bottom_left = new Vec2Input(this, "bottomleft", tr("Bottom Left"));
|
||||
|
||||
EffectRow* bottom_right = new EffectRow(this, tr("Bottom Right"));
|
||||
bottom_right_x = new DoubleField(bottom_right, "bottomrightx");
|
||||
bottom_right_y = new DoubleField(bottom_right, "bottomrighty");
|
||||
bottom_right = new Vec2Input(this, "bottomright", tr("Bottom Right"));
|
||||
|
||||
EffectRow* perspective_row = new EffectRow(this, tr("Perspective"));
|
||||
perspective = new BoolField(perspective_row, "perspective");
|
||||
perspective = new BoolInput(this, "perspective", tr("Perspective"));
|
||||
perspective->SetValueAt(0, true);
|
||||
|
||||
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
top_left_gizmo->x_field1 = top_left_x;
|
||||
top_left_gizmo->y_field1 = top_left_y;
|
||||
top_left_gizmo->x_field1 = static_cast<DoubleField*>(top_left->Field(0));
|
||||
top_left_gizmo->y_field1 = static_cast<DoubleField*>(top_left->Field(1));
|
||||
|
||||
top_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
top_right_gizmo->x_field1 = top_right_x;
|
||||
top_right_gizmo->y_field1 = top_right_y;
|
||||
top_right_gizmo->x_field1 = static_cast<DoubleField*>(top_right->Field(0));
|
||||
top_right_gizmo->y_field1 = static_cast<DoubleField*>(top_right->Field(1));
|
||||
|
||||
bottom_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
bottom_left_gizmo->x_field1 = bottom_left_x;
|
||||
bottom_left_gizmo->y_field1 = bottom_left_y;
|
||||
bottom_left_gizmo->x_field1 = static_cast<DoubleField*>(bottom_left->Field(0));
|
||||
bottom_left_gizmo->y_field1 = static_cast<DoubleField*>(bottom_left->Field(1));
|
||||
|
||||
bottom_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
bottom_right_gizmo->x_field1 = bottom_right_x;
|
||||
bottom_right_gizmo->y_field1 = bottom_right_y;
|
||||
bottom_right_gizmo->x_field1 = static_cast<DoubleField*>(bottom_right->Field(0));
|
||||
bottom_right_gizmo->y_field1 = static_cast<DoubleField*>(bottom_right->Field(1));
|
||||
|
||||
vertPath = "cornerpin.vert";
|
||||
fragPath = "cornerpin.frag";
|
||||
shader_vert_path_ = "cornerpin.vert";
|
||||
shader_frag_path_ = "cornerpin.frag";
|
||||
}
|
||||
|
||||
QString CornerPinEffect::name()
|
||||
{
|
||||
return tr("Corner Pin");
|
||||
}
|
||||
|
||||
QString CornerPinEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.cornerpin";
|
||||
}
|
||||
|
||||
QString CornerPinEffect::category()
|
||||
{
|
||||
return tr("Distort");
|
||||
}
|
||||
|
||||
QString CornerPinEffect::description()
|
||||
{
|
||||
return tr("Distort/warp this clip by pinning each of its four corners.");
|
||||
}
|
||||
|
||||
EffectType CornerPinEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType CornerPinEffect::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
NodePtr CornerPinEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<CornerPinEffect>(c);
|
||||
}
|
||||
|
||||
void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords, int) {
|
||||
coords.vertexTopLeftX += top_left_x->GetDoubleAt(timecode);
|
||||
coords.vertexTopLeftY += top_left_y->GetDoubleAt(timecode);
|
||||
|
||||
coords.vertexTopRightX += top_right_x->GetDoubleAt(timecode);
|
||||
coords.vertexTopRightY += top_right_y->GetDoubleAt(timecode);
|
||||
|
||||
coords.vertexBottomLeftX += bottom_left_x->GetDoubleAt(timecode);
|
||||
coords.vertexBottomLeftY += bottom_left_y->GetDoubleAt(timecode);
|
||||
|
||||
coords.vertexBottomRightX += bottom_right_x->GetDoubleAt(timecode);
|
||||
coords.vertexBottomRightY += bottom_right_y->GetDoubleAt(timecode);
|
||||
coords.vertex_top_left += top_left->GetVector2DAt(timecode);
|
||||
coords.vertex_top_right += top_right->GetVector2DAt(timecode);
|
||||
coords.vertex_bottom_left += bottom_left->GetVector2DAt(timecode);
|
||||
coords.vertex_bottom_right += bottom_right->GetVector2DAt(timecode);
|
||||
}
|
||||
|
||||
void CornerPinEffect::process_shader(double timecode, GLTextureCoords &coords, int) {
|
||||
glslProgram->setUniformValue("p0", GLfloat(coords.vertexBottomLeftX), GLfloat(coords.vertexBottomLeftY));
|
||||
glslProgram->setUniformValue("p1", GLfloat(coords.vertexBottomRightX), GLfloat(coords.vertexBottomRightY));
|
||||
glslProgram->setUniformValue("p2", GLfloat(coords.vertexTopLeftX), GLfloat(coords.vertexTopLeftY));
|
||||
glslProgram->setUniformValue("p3", GLfloat(coords.vertexTopRightX), GLfloat(coords.vertexTopRightY));
|
||||
glslProgram->setUniformValue("perspective", perspective->GetBoolAt(timecode));
|
||||
shader_program_->setUniformValue("p0", coords.vertex_bottom_left.x(), coords.vertex_bottom_left.y());
|
||||
shader_program_->setUniformValue("p1", coords.vertex_bottom_right.x(), coords.vertex_bottom_right.y());
|
||||
shader_program_->setUniformValue("p2", coords.vertex_top_left.x(), coords.vertex_top_left.y());
|
||||
shader_program_->setUniformValue("p3", coords.vertex_top_right.x(), coords.vertex_top_right.y());
|
||||
shader_program_->setUniformValue("perspective", perspective->GetBoolAt(timecode));
|
||||
}
|
||||
|
||||
void CornerPinEffect::gizmo_draw(double, GLTextureCoords &coords) {
|
||||
top_left_gizmo->world_pos[0] = QPoint(coords.vertexTopLeftX, coords.vertexTopLeftY);
|
||||
top_right_gizmo->world_pos[0] = QPoint(coords.vertexTopRightX, coords.vertexTopRightY);
|
||||
bottom_right_gizmo->world_pos[0] = QPoint(coords.vertexBottomRightX, coords.vertexBottomRightY);
|
||||
bottom_left_gizmo->world_pos[0] = QPoint(coords.vertexBottomLeftX, coords.vertexBottomLeftY);
|
||||
top_left_gizmo->world_pos[0] = coords.vertex_top_left;
|
||||
top_right_gizmo->world_pos[0] = coords.vertex_top_right;
|
||||
bottom_right_gizmo->world_pos[0] = coords.vertex_bottom_right;
|
||||
bottom_left_gizmo->world_pos[0] = coords.vertex_bottom_left;
|
||||
}
|
||||
|
||||
@@ -1,45 +1,51 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef CORNERPINEFFECT_H
|
||||
#define CORNERPINEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class CornerPinEffect : public Effect {
|
||||
class CornerPinEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CornerPinEffect(Clip* c, const EffectMeta* em);
|
||||
CornerPinEffect(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString category() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||
void process_shader(double timecode, GLTextureCoords& coords, int iterations);
|
||||
void gizmo_draw(double timecode, GLTextureCoords& coords);
|
||||
private:
|
||||
DoubleField* top_left_x;
|
||||
DoubleField* top_left_y;
|
||||
DoubleField* top_right_x;
|
||||
DoubleField* top_right_y;
|
||||
DoubleField* bottom_left_x;
|
||||
DoubleField* bottom_left_y;
|
||||
DoubleField* bottom_right_x;
|
||||
DoubleField* bottom_right_y;
|
||||
BoolField* perspective;
|
||||
Vec2Input* top_left;
|
||||
Vec2Input* top_right;
|
||||
Vec2Input* bottom_left;
|
||||
Vec2Input* bottom_right;
|
||||
|
||||
BoolInput* perspective;
|
||||
|
||||
EffectGizmo* top_left_gizmo;
|
||||
EffectGizmo* top_right_gizmo;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -22,13 +22,49 @@
|
||||
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
CrossDissolveTransition::CrossDissolveTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {
|
||||
SetFlags(Effect::CoordsFlag);
|
||||
CrossDissolveTransition::CrossDissolveTransition(Clip* c) : Transition(c) {
|
||||
SetFlags(Node::CoordsFlag);
|
||||
}
|
||||
|
||||
QString CrossDissolveTransition::name()
|
||||
{
|
||||
return tr("Cross Dissolve");
|
||||
}
|
||||
|
||||
QString CrossDissolveTransition::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.crossdissolve";
|
||||
}
|
||||
|
||||
QString CrossDissolveTransition::category()
|
||||
{
|
||||
return tr("Dissolves");
|
||||
}
|
||||
|
||||
QString CrossDissolveTransition::description()
|
||||
{
|
||||
return tr("Dissolve clips evenly.");
|
||||
}
|
||||
|
||||
EffectType CrossDissolveTransition::type()
|
||||
{
|
||||
return EFFECT_TYPE_TRANSITION;
|
||||
}
|
||||
|
||||
olive::TrackType CrossDissolveTransition::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
NodePtr CrossDissolveTransition::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<CrossDissolveTransition>(c);
|
||||
}
|
||||
|
||||
void CrossDissolveTransition::process_coords(double progress, GLTextureCoords& coords, int data) {
|
||||
if (!(data == kTransitionClosing && secondary_clip != nullptr)) {
|
||||
if (data == kTransitionClosing) progress = 1.0 - progress;
|
||||
if (data == kTransitionClosing) {
|
||||
coords.opacity *= (1.0 - progress);
|
||||
} else {
|
||||
coords.opacity *= progress;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -25,8 +25,17 @@
|
||||
|
||||
class CrossDissolveTransition : public Transition {
|
||||
public:
|
||||
CrossDissolveTransition(Clip *c, Clip *s, const EffectMeta* em);
|
||||
void process_coords(double timecode, GLTextureCoords &, int data);
|
||||
CrossDissolveTransition(Clip *c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString category() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_coords(double timecode, GLTextureCoords &, int data) override;
|
||||
};
|
||||
|
||||
#endif // CROSSDISSOLVETRANSITION_H
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
class CubeTransition : public Transition {
|
||||
public:
|
||||
CubeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
void process_coords(double timecode, GLTextureCoords &, int data);
|
||||
CubeTransition(Clip* c, Clip* s);
|
||||
void process_coords(double timecode, GLTextureCoords &, int data);
|
||||
};
|
||||
|
||||
#endif // CUBETRANSITION_H
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "dropshadoweffect.h"
|
||||
|
||||
DropShadowEffect::DropShadowEffect() {
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef DROPSHADOWEFFECT_H
|
||||
#define DROPSHADOWEFFECT_H
|
||||
|
||||
@@ -8,4 +28,4 @@ public:
|
||||
DropShadowEffect();
|
||||
};
|
||||
|
||||
#endif // DROPSHADOWEFFECT_H
|
||||
#endif // DROPSHADOWEFFECT_H
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -22,34 +22,62 @@
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
ExponentialFadeTransition::ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
|
||||
void ExponentialFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||
|
||||
for (int i=0;i<nb_bytes;i+=2) {
|
||||
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
|
||||
/*switch (type) {
|
||||
case TRAN_TYPE_OPEN:
|
||||
case TRAN_TYPE_OPENWLINK:
|
||||
samp *= qSqrt(timecode_start + (interval * i));
|
||||
break;
|
||||
case TRAN_TYPE_CLOSE:
|
||||
case TRAN_TYPE_CLOSEWLINK:
|
||||
samp *= qSqrt(1 - (timecode_start + (interval * i)));
|
||||
break;
|
||||
}*/
|
||||
switch (type) {
|
||||
case kTransitionOpening:
|
||||
samp *= qPow(timecode_start + (interval * i), 2);
|
||||
break;
|
||||
case kTransitionClosing:
|
||||
samp *= qPow(1 - (timecode_start + (interval * i)), 2);
|
||||
break;
|
||||
}
|
||||
|
||||
samples[i+1] = (quint8) (samp >> 8);
|
||||
samples[i] = (quint8) samp;
|
||||
}
|
||||
ExponentialFadeTransition::ExponentialFadeTransition(Clip* c) :
|
||||
Transition(c)
|
||||
{
|
||||
}
|
||||
|
||||
QString ExponentialFadeTransition::name()
|
||||
{
|
||||
return tr("Exponential Fade");
|
||||
}
|
||||
|
||||
QString ExponentialFadeTransition::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.exponentialfade";
|
||||
}
|
||||
|
||||
QString ExponentialFadeTransition::description()
|
||||
{
|
||||
return tr("An exponential audio fade that starts slow and ends fast.");
|
||||
}
|
||||
|
||||
EffectType ExponentialFadeTransition::type()
|
||||
{
|
||||
return EFFECT_TYPE_TRANSITION;
|
||||
}
|
||||
|
||||
olive::TrackType ExponentialFadeTransition::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr ExponentialFadeTransition::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<ExponentialFadeTransition>(c);
|
||||
}
|
||||
|
||||
void ExponentialFadeTransition::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_samples;
|
||||
|
||||
for (int i=0;i<nb_samples;i++) {
|
||||
|
||||
double multi = timecode_start + (interval * i);
|
||||
|
||||
for (int j=0;j<channel_count;j++) {
|
||||
switch (type) {
|
||||
case kTransitionOpening:
|
||||
samples[j][i] *= qPow(multi, 2);
|
||||
break;
|
||||
case kTransitionClosing:
|
||||
samples[j][i] *= qPow(1.0 - multi, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -25,8 +25,21 @@
|
||||
|
||||
class ExponentialFadeTransition : public Transition {
|
||||
public:
|
||||
ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
ExponentialFadeTransition(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
};
|
||||
|
||||
#endif // LINEARFADETRANSITION_H
|
||||
|
||||
@@ -1,44 +1,84 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "fillleftrighteffect.h"
|
||||
|
||||
#define FILL_TYPE_LEFT 0
|
||||
#define FILL_TYPE_RIGHT 1
|
||||
enum FillType {
|
||||
FILL_TYPE_LEFT,
|
||||
FILL_TYPE_RIGHT
|
||||
};
|
||||
|
||||
FillLeftRightEffect::FillLeftRightEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* type_row = new EffectRow(this, tr("Type"));
|
||||
fill_type = new ComboField(type_row, "type");
|
||||
FillLeftRightEffect::FillLeftRightEffect(Clip* c) : Node(c) {
|
||||
fill_type = new ComboInput(this, "type", tr("Type"));
|
||||
fill_type->AddItem(tr("Fill Left with Right"), FILL_TYPE_LEFT);
|
||||
fill_type->AddItem(tr("Fill Right with Left"), FILL_TYPE_RIGHT);
|
||||
}
|
||||
|
||||
void FillLeftRightEffect::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int) {
|
||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||
for (int i=0;i<nb_bytes;i+=4) {
|
||||
if (fill_type->GetValueAt(timecode_start+(interval*i)) == FILL_TYPE_LEFT) {
|
||||
samples[i+1] = samples[i+3];
|
||||
samples[i] = samples[i+2];
|
||||
} else {
|
||||
samples[i+3] = samples[i+1];
|
||||
samples[i+2] = samples[i];
|
||||
QString FillLeftRightEffect::name()
|
||||
{
|
||||
return tr("Fill Left/Right");
|
||||
}
|
||||
|
||||
QString FillLeftRightEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.fillleftright";
|
||||
}
|
||||
|
||||
QString FillLeftRightEffect::description()
|
||||
{
|
||||
return tr("Replaces either the left or right channel with the other");
|
||||
}
|
||||
|
||||
EffectType FillLeftRightEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType FillLeftRightEffect::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr FillLeftRightEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<FillLeftRightEffect>(c);
|
||||
}
|
||||
|
||||
void FillLeftRightEffect::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
|
||||
Q_UNUSED(type)
|
||||
|
||||
double interval = (timecode_end-timecode_start)/nb_samples;
|
||||
|
||||
if (channel_count == 2) {
|
||||
for (int i=0;i<nb_samples;i++) {
|
||||
if (fill_type->GetValueAt(timecode_start+(interval*i)) == FILL_TYPE_LEFT) {
|
||||
samples[0][i] = samples[1][i];
|
||||
} else {
|
||||
samples[1][i] = samples[0][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,48 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef FILLLEFTRIGHTEFFECT_H
|
||||
#define FILLLEFTRIGHTEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class FillLeftRightEffect : public Effect {
|
||||
class FillLeftRightEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FillLeftRightEffect(Clip* c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
FillLeftRightEffect(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
private:
|
||||
ComboField* fill_type;
|
||||
ComboInput* fill_type;
|
||||
};
|
||||
|
||||
#endif // FILLLEFTRIGHTEFFECT_H
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/internalshaders">
|
||||
<file>blending.frag</file>
|
||||
<file>common.vert</file>
|
||||
<file>cornerpin.frag</file>
|
||||
<file>cornerpin.vert</file>
|
||||
|
||||
@@ -1,43 +1,79 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "linearfadetransition.h"
|
||||
|
||||
LinearFadeTransition::LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
LinearFadeTransition::LinearFadeTransition(Clip* c) : Transition(c) {}
|
||||
|
||||
void LinearFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||
|
||||
for (int i=0;i<nb_bytes;i+=2) {
|
||||
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
|
||||
switch (type) {
|
||||
case kTransitionOpening:
|
||||
samp *= timecode_start + (interval * i);
|
||||
break;
|
||||
case kTransitionClosing:
|
||||
samp *= 1 - (timecode_start + (interval * i));
|
||||
break;
|
||||
}
|
||||
|
||||
samples[i+1] = (quint8) (samp >> 8);
|
||||
samples[i] = (quint8) samp;
|
||||
}
|
||||
QString LinearFadeTransition::name()
|
||||
{
|
||||
return tr("Linear Fade");
|
||||
}
|
||||
|
||||
QString LinearFadeTransition::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.linearfade";
|
||||
}
|
||||
|
||||
QString LinearFadeTransition::description()
|
||||
{
|
||||
return tr("An linear audio fade that fades evenly at a constant rate.");
|
||||
}
|
||||
|
||||
EffectType LinearFadeTransition::type()
|
||||
{
|
||||
return EFFECT_TYPE_TRANSITION;
|
||||
}
|
||||
|
||||
olive::TrackType LinearFadeTransition::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr LinearFadeTransition::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<LinearFadeTransition>(c);
|
||||
}
|
||||
|
||||
void LinearFadeTransition::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_samples;
|
||||
|
||||
for (int i=0;i<nb_samples;i++) {
|
||||
|
||||
float multi = timecode_start + (interval * i);
|
||||
|
||||
for (int j=0;j<channel_count;j++) {
|
||||
|
||||
switch (type) {
|
||||
case kTransitionOpening:
|
||||
samples[j][i] *= multi;
|
||||
break;
|
||||
case kTransitionClosing:
|
||||
samples[j][i] *= 1.0f - multi;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -25,8 +25,21 @@
|
||||
|
||||
class LinearFadeTransition : public Transition {
|
||||
public:
|
||||
LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
LinearFadeTransition(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
};
|
||||
|
||||
#endif // LINEARFADETRANSITION_H
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -22,24 +22,62 @@
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
LogarithmicFadeTransition::LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||
|
||||
void LogarithmicFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||
|
||||
for (int i=0;i<nb_bytes;i+=2) {
|
||||
qint16 samp = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
|
||||
switch (type) {
|
||||
case kTransitionOpening:
|
||||
samp *= qSqrt(timecode_start + (interval * i));
|
||||
break;
|
||||
case kTransitionClosing:
|
||||
samp *= qSqrt(1 - (timecode_start + (interval * i)));
|
||||
break;
|
||||
}
|
||||
|
||||
samples[i+1] = (quint8) (samp >> 8);
|
||||
samples[i] = (quint8) samp;
|
||||
}
|
||||
LogarithmicFadeTransition::LogarithmicFadeTransition(Clip* c) :
|
||||
Transition(c)
|
||||
{
|
||||
}
|
||||
|
||||
QString LogarithmicFadeTransition::name()
|
||||
{
|
||||
return tr("Logarithmic Fade");
|
||||
}
|
||||
|
||||
QString LogarithmicFadeTransition::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.logarithmicfade";
|
||||
}
|
||||
|
||||
QString LogarithmicFadeTransition::description()
|
||||
{
|
||||
return tr("An logarithmic audio fade that starts fast and ends slow.");
|
||||
}
|
||||
|
||||
EffectType LogarithmicFadeTransition::type()
|
||||
{
|
||||
return EFFECT_TYPE_TRANSITION;
|
||||
}
|
||||
|
||||
olive::TrackType LogarithmicFadeTransition::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr LogarithmicFadeTransition::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<LogarithmicFadeTransition>(c);
|
||||
}
|
||||
|
||||
void LogarithmicFadeTransition::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
double interval = (timecode_end-timecode_start)/nb_samples;
|
||||
|
||||
for (int i=0;i<nb_samples;i++) {
|
||||
|
||||
float multi = timecode_start + (interval * i);
|
||||
|
||||
for (int j=0;j<channel_count;j++) {
|
||||
switch (type) {
|
||||
case kTransitionOpening:
|
||||
samples[j][i] *= qSqrt(multi);
|
||||
break;
|
||||
case kTransitionClosing:
|
||||
samples[j][i] *= qSqrt(1.0f - multi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -25,8 +25,21 @@
|
||||
|
||||
class LogarithmicFadeTransition : public Transition {
|
||||
public:
|
||||
LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
LogarithmicFadeTransition(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip* c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
};
|
||||
|
||||
#endif // LOGARITHMICFADETRANSITION_H
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -28,34 +28,69 @@
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
|
||||
PanEffect::PanEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* pan_row = new EffectRow(this, tr("Pan"));
|
||||
pan_val = new DoubleField(pan_row, "pan");
|
||||
PanEffect::PanEffect(Clip* c) : Node(c) {
|
||||
pan_val = new DoubleInput(this, "pan", tr("Pan"));
|
||||
pan_val->SetMinimum(-100);
|
||||
pan_val->SetDefault(0);
|
||||
pan_val->SetMaximum(100);
|
||||
}
|
||||
|
||||
void PanEffect::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int) {
|
||||
double interval = (timecode_end - timecode_start)/nb_bytes;
|
||||
for (int i=0;i<nb_bytes;i+=4) {
|
||||
QString PanEffect::name()
|
||||
{
|
||||
return tr("Pan");
|
||||
}
|
||||
|
||||
QString PanEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.pan";
|
||||
}
|
||||
|
||||
QString PanEffect::description()
|
||||
{
|
||||
return tr("Modifying the panning on a stereo audio clip.");
|
||||
}
|
||||
|
||||
EffectType PanEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType PanEffect::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr PanEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<PanEffect>(c);
|
||||
}
|
||||
|
||||
void PanEffect::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
|
||||
Q_UNUSED(type)
|
||||
|
||||
// This has no effect on mono sources
|
||||
if (channel_count < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
double interval = (timecode_end - timecode_start)/nb_samples;
|
||||
|
||||
for (int i=0;i<nb_samples;i++) {
|
||||
double pan_field_val = pan_val->GetDoubleAt(timecode_start+(interval*i));
|
||||
double pval = log_volume(qAbs(pan_field_val)*0.01);
|
||||
|
||||
qint16 left_sample = qint16(((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
qint16 right_sample = qint16(((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
|
||||
|
||||
if (pan_field_val < 0) {
|
||||
// affect right channel
|
||||
right_sample *= (1.0-pval);
|
||||
samples[1][i] *= (1.0-pval);
|
||||
} else {
|
||||
// affect left channel
|
||||
left_sample *= (1.0-pval);
|
||||
samples[0][i] *= (1.0-pval);
|
||||
}
|
||||
|
||||
samples[i+3] = quint8(right_sample >> 8);
|
||||
samples[i+2] = quint8(right_sample);
|
||||
samples[i+1] = quint8(left_sample >> 8);
|
||||
samples[i] = quint8(left_sample);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,48 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef PANEFFECT_H
|
||||
#define PANEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class PanEffect : public Effect {
|
||||
class PanEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PanEffect(Clip* c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
PanEffect(Clip* c);
|
||||
|
||||
DoubleField* pan_val;
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
|
||||
DoubleInput* pan_val;
|
||||
};
|
||||
|
||||
#endif // PANEFFECT_H
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "richtexteffect.h"
|
||||
|
||||
#include <QTextDocument>
|
||||
@@ -14,65 +34,43 @@ enum AutoscrollDirection {
|
||||
SCROLL_RIGHT,
|
||||
};
|
||||
|
||||
RichTextEffect::RichTextEffect(Clip *c, const EffectMeta *em) :
|
||||
Effect(c, em)
|
||||
RichTextEffect::RichTextEffect(Clip *c) :
|
||||
Node(c)
|
||||
{
|
||||
SetFlags(Effect::SuperimposeFlag);
|
||||
SetFlags(Node::SuperimposeFlag);
|
||||
|
||||
EffectRow* text_row = new EffectRow(this, tr("Text"));
|
||||
text_val = new StringField(text_row, "text");
|
||||
text_val->SetColumnSpan(2);
|
||||
text_val = new StringInput(this, "text", tr("Text"));
|
||||
|
||||
EffectRow* padding_row = new EffectRow(this, tr("Padding"));
|
||||
padding_field = new DoubleField(padding_row, "padding");
|
||||
padding_field->SetColumnSpan(2);
|
||||
padding_field = new DoubleInput(this, "padding", tr("Padding"));
|
||||
|
||||
EffectRow* position_row = new EffectRow(this, tr("Position"));
|
||||
position_x = new DoubleField(position_row, "posx");
|
||||
position_y = new DoubleField(position_row, "posy");
|
||||
position = new Vec2Input(this, "pos", tr("Position"));
|
||||
|
||||
EffectRow* vertical_align_row = new EffectRow(this, tr("Vertical Align:"));
|
||||
vertical_align = new ComboField(vertical_align_row, "valign");
|
||||
vertical_align = new ComboInput(this, "valign", tr("Vertical Align:"));
|
||||
vertical_align->AddItem(tr("Top"), Qt::AlignTop);
|
||||
vertical_align->AddItem(tr("Center"), Qt::AlignCenter);
|
||||
vertical_align->AddItem(tr("Bottom"), Qt::AlignBottom);
|
||||
vertical_align->SetValueAt(0, Qt::AlignCenter);
|
||||
vertical_align->SetColumnSpan(2);
|
||||
|
||||
EffectRow* autoscroll_row = new EffectRow(this, tr("Auto-Scroll"));
|
||||
autoscroll = new ComboField(autoscroll_row, "autoscroll");
|
||||
autoscroll = new ComboInput(this, "autoscroll", tr("Auto-Scroll"));
|
||||
autoscroll->AddItem(tr("Off"), SCROLL_OFF);
|
||||
autoscroll->AddItem(tr("Up"), SCROLL_UP);
|
||||
autoscroll->AddItem(tr("Down"), SCROLL_DOWN);
|
||||
autoscroll->AddItem(tr("Left"), SCROLL_LEFT);
|
||||
autoscroll->AddItem(tr("Right"), SCROLL_RIGHT);
|
||||
autoscroll->SetColumnSpan(2);
|
||||
|
||||
EffectRow* shadow_row = new EffectRow(this, tr("Shadow"));
|
||||
shadow_bool = new BoolField(shadow_row, "shadow");
|
||||
shadow_bool->SetColumnSpan(2);
|
||||
shadow_bool = new BoolInput(this, "shadow", tr("Shadow"));
|
||||
|
||||
EffectRow* shadow_color_row = new EffectRow(this, tr("Shadow Color"));
|
||||
shadow_color = new ColorField(shadow_color_row, "shadowcolor");
|
||||
shadow_color->SetColumnSpan(2);
|
||||
shadow_color = new ColorInput(this, "shadowcolor", tr("Shadow Color"));
|
||||
|
||||
EffectRow* shadow_angle_row = new EffectRow(this, tr("Shadow Angle"));
|
||||
shadow_angle = new DoubleField(shadow_angle_row, "shadowangle");
|
||||
shadow_angle->SetColumnSpan(2);
|
||||
shadow_angle = new DoubleInput(this, "shadowangle", tr("Shadow Angle"));
|
||||
|
||||
EffectRow* shadow_distance_row = new EffectRow(this, tr("Shadow Distance"));
|
||||
shadow_distance = new DoubleField(shadow_distance_row, "shadowdistance");
|
||||
shadow_distance->SetColumnSpan(2);
|
||||
shadow_distance = new DoubleInput(this, "shadowdistance", tr("Shadow Distance"));
|
||||
shadow_distance->SetMinimum(0);
|
||||
|
||||
EffectRow* shadow_softness_row = new EffectRow(this, tr("Shadow Softness"));
|
||||
shadow_softness = new DoubleField(shadow_softness_row, "shadowsoftness");
|
||||
shadow_softness->SetColumnSpan(2);
|
||||
shadow_softness = new DoubleInput(this, "shadowsoftness", tr("Shadow Softness"));
|
||||
shadow_softness->SetMinimum(0);
|
||||
|
||||
EffectRow* shadow_opacity_row = new EffectRow(this, tr("Shadow Opacity"));
|
||||
shadow_opacity = new DoubleField(shadow_opacity_row, "shadowopacity");
|
||||
shadow_opacity->SetColumnSpan(2);
|
||||
shadow_opacity = new DoubleInput(this, "shadowopacity", tr("Shadow Opacity"));
|
||||
shadow_opacity->SetMinimum(0);
|
||||
shadow_opacity->SetMaximum(100);
|
||||
|
||||
@@ -84,6 +82,41 @@ RichTextEffect::RichTextEffect(Clip *c, const EffectMeta *em) :
|
||||
"</html>");
|
||||
}
|
||||
|
||||
QString RichTextEffect::name()
|
||||
{
|
||||
return tr("Rich Text");
|
||||
}
|
||||
|
||||
QString RichTextEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.richtext";
|
||||
}
|
||||
|
||||
QString RichTextEffect::category()
|
||||
{
|
||||
return tr("Render");
|
||||
}
|
||||
|
||||
QString RichTextEffect::description()
|
||||
{
|
||||
return tr("Render formatted rich text over a clip.");
|
||||
}
|
||||
|
||||
EffectType RichTextEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType RichTextEffect::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
NodePtr RichTextEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<RichTextEffect>(c);
|
||||
}
|
||||
|
||||
void RichTextEffect::redraw(double timecode)
|
||||
{
|
||||
QPainter p(&img);
|
||||
@@ -100,8 +133,8 @@ void RichTextEffect::redraw(double timecode)
|
||||
td.setHtml(text_val->GetStringAt(timecode));
|
||||
td.setTextWidth(width);
|
||||
|
||||
int translate_x = qRound(position_x->GetDoubleAt(timecode) + padding);
|
||||
int translate_y = qRound(position_y->GetDoubleAt(timecode) + padding);
|
||||
QPoint translation = position->GetVector2DAt(timecode).toPoint();
|
||||
translation += {padding, padding};
|
||||
|
||||
int doc_height = qRound(td.size().height());
|
||||
|
||||
@@ -118,9 +151,9 @@ void RichTextEffect::redraw(double timecode)
|
||||
|
||||
// If we're not auto-scrolling the vertical direction, respect the vertical alignment
|
||||
if (vertical_align->GetValueAt(timecode).toInt() == Qt::AlignCenter) {
|
||||
translate_y += height / 2 - doc_height / 2;
|
||||
translation.setY(translation.y() + height / 2 - doc_height / 2);
|
||||
} else if (vertical_align->GetValueAt(timecode).toInt() == Qt::AlignBottom) {
|
||||
translate_y += height - doc_height;
|
||||
translation.setY(translation.y() + height - doc_height);
|
||||
}
|
||||
|
||||
// Check if we are autoscrolling
|
||||
@@ -131,7 +164,7 @@ void RichTextEffect::redraw(double timecode)
|
||||
}
|
||||
|
||||
int doc_width = qRound(td.size().width());
|
||||
translate_x += qRound(-doc_width + (img.width() + doc_width) * scroll_progress);
|
||||
translation.setX(translation.x() + qRound(-doc_width + (img.width() + doc_width) * scroll_progress));
|
||||
}
|
||||
|
||||
} else if (auto_scroll_dir == SCROLL_UP || auto_scroll_dir == SCROLL_DOWN) {
|
||||
@@ -142,13 +175,13 @@ void RichTextEffect::redraw(double timecode)
|
||||
scroll_progress = 1.0 - scroll_progress;
|
||||
}
|
||||
|
||||
translate_y += qRound(-doc_height + (img.height() + doc_height)*scroll_progress);
|
||||
translation.setY(translation.y() + qRound(-doc_height + (img.height() + doc_height)*scroll_progress));
|
||||
|
||||
}
|
||||
|
||||
QRect clip_rect = img.rect();
|
||||
clip_rect.translate(-translate_x, -translate_y);
|
||||
p.translate(translate_x, translate_y);
|
||||
clip_rect.translate(-translation);
|
||||
p.translate(translation);
|
||||
|
||||
img.fill(Qt::transparent);
|
||||
|
||||
@@ -188,5 +221,5 @@ void RichTextEffect::redraw(double timecode)
|
||||
|
||||
bool RichTextEffect::AlwaysUpdate()
|
||||
{
|
||||
return autoscroll->GetValueAt(autoscroll->Now()).toInt() != SCROLL_OFF;
|
||||
return autoscroll->GetValueAt(Now()).toInt() != SCROLL_OFF;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,58 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef RICHTEXTEFFECT_H
|
||||
#define RICHTEXTEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class RichTextEffect : public Effect {
|
||||
class RichTextEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RichTextEffect(Clip* c, const EffectMeta *em);
|
||||
void redraw(double timecode);
|
||||
RichTextEffect(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString category() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void redraw(double timecode) override;
|
||||
|
||||
protected:
|
||||
virtual bool AlwaysUpdate() override;
|
||||
private:
|
||||
StringField* text_val;
|
||||
DoubleField* padding_field;
|
||||
DoubleField* position_x;
|
||||
DoubleField* position_y;
|
||||
ComboField* vertical_align;
|
||||
ComboField* autoscroll;
|
||||
StringInput* text_val;
|
||||
DoubleInput* padding_field;
|
||||
Vec2Input* position;
|
||||
ComboInput* vertical_align;
|
||||
ComboInput* autoscroll;
|
||||
|
||||
BoolField* shadow_bool;
|
||||
DoubleField* shadow_angle;
|
||||
DoubleField* shadow_distance;
|
||||
ColorField* shadow_color;
|
||||
DoubleField* shadow_softness;
|
||||
DoubleField* shadow_opacity;
|
||||
BoolInput* shadow_bool;
|
||||
DoubleInput* shadow_angle;
|
||||
DoubleInput* shadow_distance;
|
||||
ColorInput* shadow_color;
|
||||
DoubleInput* shadow_softness;
|
||||
DoubleInput* shadow_opacity;
|
||||
};
|
||||
|
||||
#endif // RICHTEXTEFFECT_H
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -32,21 +32,18 @@
|
||||
#include "panels/timeline.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
ShakeEffect::ShakeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
SetFlags(Effect::CoordsFlag);
|
||||
ShakeEffect::ShakeEffect(Clip* c) : Node(c) {
|
||||
SetFlags(Node::CoordsFlag);
|
||||
|
||||
EffectRow* intensity_row = new EffectRow(this, tr("Intensity"));
|
||||
intensity_val = new DoubleField(intensity_row, "intensity");
|
||||
intensity_val = new DoubleInput(this, "intensity", tr("Intensity"));
|
||||
intensity_val->SetMinimum(0);
|
||||
intensity_val->SetDefault(25);
|
||||
|
||||
EffectRow* rotation_row = new EffectRow(this, tr("Rotation"));
|
||||
rotation_val = new DoubleField(rotation_row, "rotation");
|
||||
rotation_val = new DoubleInput(this, "rotation", tr("Rotation"));
|
||||
rotation_val->SetMinimum(0);
|
||||
rotation_val->SetDefault(10);
|
||||
|
||||
EffectRow* frequency_row = new EffectRow(this, tr("Frequency"));
|
||||
frequency_val = new DoubleField(frequency_row, "frequency");
|
||||
frequency_val = new DoubleInput(this, "frequency", tr("Frequency"));
|
||||
frequency_val->SetMinimum(0);
|
||||
frequency_val->SetDefault(5);
|
||||
|
||||
@@ -78,15 +75,42 @@ void ShakeEffect::process_coords(double timecode, GLTextureCoords& coords, int)
|
||||
yoff *= multiplier;
|
||||
rotoff *= rotmult;
|
||||
|
||||
coords.vertexTopLeftX += xoff;
|
||||
coords.vertexTopRightX += xoff;
|
||||
coords.vertexBottomLeftX += xoff;
|
||||
coords.vertexBottomRightX += xoff;
|
||||
coords.matrix.translate(xoff, yoff, 0.0);
|
||||
|
||||
coords.vertexTopLeftY += yoff;
|
||||
coords.vertexTopRightY += yoff;
|
||||
coords.vertexBottomLeftY += yoff;
|
||||
coords.vertexBottomRightY += yoff;
|
||||
coords.matrix.rotate(QQuaternion::fromEulerAngles(0.0f, 0.0f, rotoff));
|
||||
}
|
||||
|
||||
glRotatef(rotoff, 0, 0, 1);
|
||||
QString ShakeEffect::name()
|
||||
{
|
||||
return tr("Shake");
|
||||
}
|
||||
|
||||
QString ShakeEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.shake";
|
||||
}
|
||||
|
||||
QString ShakeEffect::category()
|
||||
{
|
||||
return tr("Distort");
|
||||
}
|
||||
|
||||
QString ShakeEffect::description()
|
||||
{
|
||||
return tr("Simulate a camera shake movement.");
|
||||
}
|
||||
|
||||
EffectType ShakeEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType ShakeEffect::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
NodePtr ShakeEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<ShakeEffect>(c);
|
||||
}
|
||||
|
||||
@@ -1,39 +1,47 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SHAKEEFFECT_H
|
||||
#define SHAKEEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
#define RANDOM_VAL_SIZE 30
|
||||
|
||||
class ShakeEffect : public Effect {
|
||||
class ShakeEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShakeEffect(Clip* c, const EffectMeta* em);
|
||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||
ShakeEffect(Clip* c);
|
||||
virtual void process_coords(double timecode, GLTextureCoords& coords, int data) override;
|
||||
|
||||
DoubleField* intensity_val;
|
||||
DoubleField* rotation_val;
|
||||
DoubleField* frequency_val;
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString category() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
DoubleInput* intensity_val;
|
||||
DoubleInput* rotation_val;
|
||||
DoubleInput* frequency_val;
|
||||
private:
|
||||
double random_vals[RANDOM_VAL_SIZE];
|
||||
};
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -34,30 +34,26 @@ const int SMPTE_BARS = 7;
|
||||
const int SMPTE_STRIP_COUNT = 3;
|
||||
const int SMPTE_LOWER_BARS = 4;
|
||||
|
||||
SolidEffect::SolidEffect(Clip* c, const EffectMeta* em) :
|
||||
Effect(c, em)
|
||||
SolidEffect::SolidEffect(Clip* c) :
|
||||
Node(c)
|
||||
{
|
||||
SetFlags(Effect::SuperimposeFlag);
|
||||
SetFlags(Node::SuperimposeFlag);
|
||||
|
||||
// Field for solid type
|
||||
EffectRow* type_row = new EffectRow(this, tr("Type"));
|
||||
solid_type = new ComboField(type_row, "type");
|
||||
solid_type = new ComboInput(this, "type", tr("Type"));
|
||||
solid_type->AddItem(tr("Solid Color"), SOLID_TYPE_COLOR);
|
||||
solid_type->AddItem(tr("SMPTE Bars"), SOLID_TYPE_BARS);
|
||||
solid_type->AddItem(tr("Checkerboard"), SOLID_TYPE_CHECKERBOARD);
|
||||
|
||||
EffectRow* opacity_row = new EffectRow(this, tr("Opacity"));
|
||||
opacity_field = new DoubleField(opacity_row, "opacity");
|
||||
opacity_field = new DoubleInput(this, "opacity", tr("Opacity"));
|
||||
opacity_field->SetMinimum(0);
|
||||
opacity_field->SetDefault(100);
|
||||
opacity_field->SetMaximum(100);
|
||||
|
||||
EffectRow* solid_color_row = new EffectRow(this, tr("Color"));
|
||||
solid_color_field = new ColorField(solid_color_row, "color");
|
||||
solid_color_field = new ColorInput(this, "color", tr("Color"));
|
||||
solid_color_field->SetValueAt(0, QColor(Qt::red));
|
||||
|
||||
EffectRow* checkerboard_size = new EffectRow(this, tr("Checkerboard Size"));
|
||||
checkerboard_size_field = new DoubleField(checkerboard_size, "checker_size");
|
||||
checkerboard_size_field = new DoubleInput(this, "checker_size", tr("Checkerboard Size"));
|
||||
checkerboard_size_field->SetMinimum(1);
|
||||
checkerboard_size_field->SetDefault(10);
|
||||
|
||||
@@ -73,6 +69,41 @@ SolidEffect::SolidEffect(Clip* c, const EffectMeta* em) :
|
||||
fragPath = ":/shaders/solideffect.frag";*/
|
||||
}
|
||||
|
||||
QString SolidEffect::name()
|
||||
{
|
||||
return tr("Solid");
|
||||
}
|
||||
|
||||
QString SolidEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.solid";
|
||||
}
|
||||
|
||||
QString SolidEffect::category()
|
||||
{
|
||||
return tr("Render");
|
||||
}
|
||||
|
||||
QString SolidEffect::description()
|
||||
{
|
||||
return tr("Render a solid color over this clip.");
|
||||
}
|
||||
|
||||
EffectType SolidEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType SolidEffect::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
NodePtr SolidEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<SolidEffect>(c);
|
||||
}
|
||||
|
||||
void SolidEffect::redraw(double timecode) {
|
||||
int w = img.width();
|
||||
int h = img.height();
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SOLIDEFFECT_H
|
||||
#define SOLIDEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
#include <QImage>
|
||||
|
||||
class SolidEffect : public Effect {
|
||||
class SolidEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum SolidType {
|
||||
@@ -34,17 +34,26 @@ public:
|
||||
SOLID_TYPE_CHECKERBOARD
|
||||
};
|
||||
|
||||
SolidEffect(Clip* c, const EffectMeta *em);
|
||||
virtual void redraw(double timecode);
|
||||
SolidEffect(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString category() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void redraw(double timecode) override;
|
||||
|
||||
void SetType(SolidType type);
|
||||
private slots:
|
||||
void ui_update(const QVariant &d);
|
||||
private:
|
||||
ComboField* solid_type;
|
||||
ColorField* solid_color_field;
|
||||
DoubleField* opacity_field;
|
||||
DoubleField* checkerboard_size_field;
|
||||
ComboInput* solid_type;
|
||||
ColorInput* solid_color_field;
|
||||
DoubleInput* opacity_field;
|
||||
DoubleInput* checkerboard_size_field;
|
||||
};
|
||||
|
||||
#endif // SOLIDEFFECT_H
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -39,94 +39,60 @@
|
||||
#include "timeline/sequence.h"
|
||||
#include "ui/comboboxex.h"
|
||||
#include "ui/colorbutton.h"
|
||||
#include "ui/fontcombobox.h"
|
||||
#include "ui/blur.h"
|
||||
#include "global/config.h"
|
||||
|
||||
TextEffect::TextEffect(Clip* c, const EffectMeta* em) :
|
||||
Effect(c, em)
|
||||
TextEffect::TextEffect(Clip* c) :
|
||||
Node(c)
|
||||
{
|
||||
SetFlags(Effect::SuperimposeFlag);
|
||||
SetFlags(Node::SuperimposeFlag);
|
||||
|
||||
EffectRow* text_field = new EffectRow(this, tr("Text"));
|
||||
text_val = new StringField(text_field, "text", false);
|
||||
text_val->SetColumnSpan(2);
|
||||
text_val = new StringInput(this, "text", tr("Text"), false);
|
||||
|
||||
EffectRow* font_row = new EffectRow(this, tr("Font"));
|
||||
set_font_combobox = new FontField(font_row, "font");
|
||||
set_font_combobox->SetColumnSpan(2);
|
||||
set_font_combobox = new FontInput(this, "font", tr("Font"));
|
||||
|
||||
EffectRow* size_row = new EffectRow(this, tr("Size"));
|
||||
size_val = new DoubleField(size_row, "size");
|
||||
size_val = new DoubleInput(this, "size", tr("Size"));
|
||||
size_val->SetMinimum(0);
|
||||
size_val->SetColumnSpan(2);
|
||||
|
||||
EffectRow* color_row = new EffectRow(this, tr("Color"));
|
||||
set_color_button = new ColorField(color_row, "color");
|
||||
set_color_button->SetColumnSpan(2);
|
||||
set_color_button = new ColorInput(this, "color", tr("Color"));
|
||||
|
||||
EffectRow* alignment_row = new EffectRow(this, tr("Alignment"));
|
||||
halign_field = new ComboField(alignment_row, "halign");
|
||||
halign_field = new ComboInput(this, "halign", tr("Horizontal Alignment"));
|
||||
halign_field->AddItem(tr("Left"), Qt::AlignLeft);
|
||||
halign_field->AddItem(tr("Center"), Qt::AlignHCenter);
|
||||
halign_field->AddItem(tr("Right"), Qt::AlignRight);
|
||||
halign_field->AddItem(tr("Justify"), Qt::AlignJustify);
|
||||
|
||||
valign_field = new ComboField(alignment_row, "valign");
|
||||
valign_field = new ComboInput(this, "valign", tr("Vertical Alignment"));
|
||||
valign_field->AddItem(tr("Top"), Qt::AlignTop);
|
||||
valign_field->AddItem(tr("Center"), Qt::AlignVCenter);
|
||||
valign_field->AddItem(tr("Bottom"), Qt::AlignBottom);
|
||||
|
||||
EffectRow* word_wrap_row = new EffectRow(this, tr("Word Wrap"));
|
||||
word_wrap_field = new BoolField(word_wrap_row, "wordwrap");
|
||||
word_wrap_field->SetColumnSpan(2);
|
||||
word_wrap_field = new BoolInput(this, "wordwrap", tr("Word Wrap"));
|
||||
|
||||
EffectRow* padding_row = new EffectRow(this, tr("Padding"));
|
||||
padding_field = new DoubleField(padding_row, "padding");
|
||||
padding_field->SetColumnSpan(2);
|
||||
padding_field = new DoubleInput(this, "padding", tr("Padding"));
|
||||
|
||||
EffectRow* position_row = new EffectRow(this, tr("Position"));
|
||||
position_x = new DoubleField(position_row, "posx");
|
||||
position_y = new DoubleField(position_row, "posy");
|
||||
position = new Vec2Input(this, "pos", tr("Position"));
|
||||
|
||||
EffectRow* outline_row = new EffectRow(this, tr("Outline"));
|
||||
outline_bool = new BoolField(outline_row, "outline");
|
||||
outline_bool->SetColumnSpan(2);
|
||||
outline_bool = new BoolInput(this, "outline", tr("Outline"));
|
||||
|
||||
EffectRow* outline_color_row = new EffectRow(this, tr("Outline Color"));
|
||||
outline_color = new ColorField(outline_color_row, "outlinecolor");
|
||||
outline_color->SetColumnSpan(2);
|
||||
outline_color = new ColorInput(this, "outlinecolor", tr("Outline Color"));
|
||||
|
||||
EffectRow* outline_width_row = new EffectRow(this, tr("Outline Width"));
|
||||
outline_width = new DoubleField(outline_width_row, "outlinewidth");
|
||||
outline_width->SetColumnSpan(2);
|
||||
outline_width = new DoubleInput(this, "outlinewidth", tr("Outline Width"));
|
||||
outline_width->SetMinimum(0);
|
||||
|
||||
EffectRow* shadow_row = new EffectRow(this, tr("Shadow"));
|
||||
shadow_bool = new BoolField(shadow_row, "shadow");
|
||||
shadow_bool->SetColumnSpan(2);
|
||||
shadow_bool = new BoolInput(this, "shadow", tr("Shadow"));
|
||||
|
||||
EffectRow* shadow_color_row = new EffectRow(this, tr("Shadow Color"));
|
||||
shadow_color = new ColorField(shadow_color_row, "shadowcolor");
|
||||
shadow_color->SetColumnSpan(2);
|
||||
shadow_color = new ColorInput(this, "shadowcolor", tr("Shadow Color"));
|
||||
|
||||
EffectRow* shadow_angle_row = new EffectRow(this, tr("Shadow Angle"));
|
||||
shadow_angle = new DoubleField(shadow_angle_row, "shadowangle");
|
||||
shadow_angle->SetColumnSpan(2);
|
||||
shadow_angle = new DoubleInput(this, "shadowangle", tr("Shadow Angle"));
|
||||
|
||||
EffectRow* shadow_distance_row = new EffectRow(this, tr("Shadow Distance"));
|
||||
shadow_distance = new DoubleField(shadow_distance_row, "shadowdistance");
|
||||
shadow_distance->SetColumnSpan(2);
|
||||
shadow_distance = new DoubleInput(this, "shadowdistance", tr("Shadow Distance"));
|
||||
shadow_distance->SetMinimum(0);
|
||||
|
||||
EffectRow* shadow_softness_row = new EffectRow(this, tr("Shadow Softness"));
|
||||
shadow_softness = new DoubleField(shadow_softness_row, "shadowsoftness");
|
||||
shadow_softness->SetColumnSpan(2);
|
||||
shadow_softness = new DoubleInput(this, "shadowsoftness", tr("Shadow Softness"));
|
||||
shadow_softness->SetMinimum(0);
|
||||
|
||||
EffectRow* shadow_opacity_row = new EffectRow(this, tr("Shadow Opacity"));
|
||||
shadow_opacity = new DoubleField(shadow_opacity_row, "shadowopacity");
|
||||
shadow_opacity->SetColumnSpan(2);
|
||||
shadow_opacity = new DoubleInput(this, "shadowopacity", tr("Shadow Opacity"));
|
||||
shadow_opacity->SetMinimum(0);
|
||||
shadow_opacity->SetMaximum(100);
|
||||
|
||||
@@ -151,8 +117,43 @@ TextEffect::TextEffect(Clip* c, const EffectMeta* em) :
|
||||
connect(shadow_bool, SIGNAL(Toggled(bool)), this, SLOT(shadow_enable(bool)));
|
||||
connect(outline_bool, SIGNAL(Toggled(bool)), this, SLOT(outline_enable(bool)));
|
||||
|
||||
vertPath = "common.vert";
|
||||
fragPath = "dropshadow.frag";
|
||||
shader_vert_path_ = "common.vert";
|
||||
shader_frag_path_ = "dropshadow.frag";
|
||||
}
|
||||
|
||||
QString TextEffect::name()
|
||||
{
|
||||
return tr("Text");
|
||||
}
|
||||
|
||||
QString TextEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.text";
|
||||
}
|
||||
|
||||
QString TextEffect::category()
|
||||
{
|
||||
return tr("Render");
|
||||
}
|
||||
|
||||
QString TextEffect::description()
|
||||
{
|
||||
return tr("Generate simple text over this clip");
|
||||
}
|
||||
|
||||
EffectType TextEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType TextEffect::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
NodePtr TextEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<TextEffect>(c);
|
||||
}
|
||||
|
||||
void TextEffect::redraw(double timecode) {
|
||||
@@ -257,7 +258,7 @@ void TextEffect::redraw(double timecode) {
|
||||
path.addText(text_x, text_y, font, lines.at(i));
|
||||
}
|
||||
|
||||
path.translate(position_x->GetDoubleAt(timecode) + padding, position_y->GetDoubleAt(timecode) + padding);
|
||||
path.translate(position->GetVector2DAt(timecode).toPointF() + QPointF(padding, padding));
|
||||
|
||||
// draw software shadow
|
||||
if (shadow_bool->GetBoolAt(timecode)) {
|
||||
|
||||
@@ -1,63 +1,71 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TEXTEFFECT_H
|
||||
#define TEXTEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QImage>
|
||||
|
||||
class TextEffect : public Effect {
|
||||
class TextEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextEffect(Clip* c, const EffectMeta *em);
|
||||
void redraw(double timecode);
|
||||
TextEffect(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString category() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void redraw(double timecode) override;
|
||||
private slots:
|
||||
void outline_enable(bool);
|
||||
void shadow_enable(bool);
|
||||
private:
|
||||
QFont font;
|
||||
|
||||
StringField* text_val;
|
||||
DoubleField* size_val;
|
||||
ColorField* set_color_button;
|
||||
FontField* set_font_combobox;
|
||||
ComboField* halign_field;
|
||||
ComboField* valign_field;
|
||||
BoolField* word_wrap_field;
|
||||
DoubleField* padding_field;
|
||||
DoubleField* position_x;
|
||||
DoubleField* position_y;
|
||||
StringInput* text_val;
|
||||
DoubleInput* size_val;
|
||||
ColorInput* set_color_button;
|
||||
FontInput* set_font_combobox;
|
||||
ComboInput* halign_field;
|
||||
ComboInput* valign_field;
|
||||
BoolInput* word_wrap_field;
|
||||
DoubleInput* padding_field;
|
||||
Vec2Input* position;
|
||||
|
||||
BoolField* outline_bool;
|
||||
DoubleField* outline_width;
|
||||
ColorField* outline_color;
|
||||
BoolInput* outline_bool;
|
||||
DoubleInput* outline_width;
|
||||
ColorInput* outline_color;
|
||||
|
||||
BoolField* shadow_bool;
|
||||
DoubleField* shadow_angle;
|
||||
DoubleField* shadow_distance;
|
||||
ColorField* shadow_color;
|
||||
DoubleField* shadow_softness;
|
||||
DoubleField* shadow_opacity;
|
||||
BoolInput* shadow_bool;
|
||||
DoubleInput* shadow_angle;
|
||||
DoubleInput* shadow_distance;
|
||||
ColorInput* shadow_color;
|
||||
DoubleInput* shadow_softness;
|
||||
DoubleInput* shadow_opacity;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -37,66 +37,90 @@
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "global/timing.h"
|
||||
#include "ui/comboboxex.h"
|
||||
#include "ui/colorbutton.h"
|
||||
#include "ui/fontcombobox.h"
|
||||
#include "global/config.h"
|
||||
|
||||
TimecodeEffect::TimecodeEffect(Clip* c, const EffectMeta* em) :
|
||||
Effect(c, em)
|
||||
TimecodeEffect::TimecodeEffect(Clip* c) :
|
||||
Node(c)
|
||||
{
|
||||
SetFlags(Effect::SuperimposeFlag);
|
||||
SetFlags(Node::SuperimposeFlag);
|
||||
|
||||
EffectRow* tc_row = new EffectRow(this, tr("Timecode"));
|
||||
tc_select = new ComboField(tc_row, "tc_selector");
|
||||
tc_select = new ComboInput(this, "tc_selector", tr("Timecode"));
|
||||
tc_select->AddItem(tr("Sequence"), true);
|
||||
tc_select->AddItem(tr("Media"), false);
|
||||
tc_select->SetValueAt(0, true);
|
||||
|
||||
EffectRow* scale_row = new EffectRow(this, tr("Scale"));
|
||||
scale_val = new DoubleField(scale_row, "scale");
|
||||
scale_val->SetColumnSpan(2);
|
||||
scale_val = new DoubleInput(this, "scale", tr("Scale"));
|
||||
scale_val->SetMinimum(1);
|
||||
scale_val->SetDefault(100);
|
||||
scale_val->SetMaximum(1000);
|
||||
|
||||
EffectRow* color_row = new EffectRow(this, tr("Color"));
|
||||
color_val = new ColorField(color_row, "color");
|
||||
color_val->SetColumnSpan(2);
|
||||
color_val = new ColorInput(this, "color", tr("Color"));
|
||||
color_val->SetValueAt(0, QColor(Qt::white));
|
||||
|
||||
EffectRow* color_bg_row = new EffectRow(this, tr("Background Color"));
|
||||
color_bg_val = new ColorField(color_bg_row, "bgcolor");
|
||||
color_bg_val->SetColumnSpan(2);
|
||||
color_bg_val = new ColorInput(this, "bgcolor", tr("Background Color"));
|
||||
color_bg_val->SetValueAt(0, QColor(Qt::black));
|
||||
|
||||
EffectRow* bg_alpha_row = new EffectRow(this, tr("Background Opacity"));
|
||||
bg_alpha = new DoubleField(bg_alpha_row, "bgalpha");
|
||||
bg_alpha->SetColumnSpan(2);
|
||||
bg_alpha = new DoubleInput(this, "bgalpha", tr("Background Opacity"));
|
||||
bg_alpha->SetMinimum(0);
|
||||
bg_alpha->SetDefault(50);
|
||||
bg_alpha->SetMaximum(100);
|
||||
|
||||
EffectRow* offset_row = new EffectRow(this, tr("Offset"));
|
||||
offset_x_val = new DoubleField(offset_row, "offsetx");
|
||||
offset_y_val = new DoubleField(offset_row, "offsety");
|
||||
offset_val = new Vec2Input(this, "offset", tr("Offset"));
|
||||
offset_val->SetDefault(0);
|
||||
|
||||
EffectRow* prepent_text_row = new EffectRow(this, tr("Prepend"));
|
||||
prepend_text = new StringField(prepent_text_row, "prepend", false);
|
||||
prepend_text->SetColumnSpan(2);
|
||||
prepend_text = new StringInput(this, "prepend", tr("Prepend"), false);
|
||||
}
|
||||
|
||||
QString TimecodeEffect::name()
|
||||
{
|
||||
return tr("Timecode");
|
||||
}
|
||||
|
||||
QString TimecodeEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.timecode";
|
||||
}
|
||||
|
||||
QString TimecodeEffect::category()
|
||||
{
|
||||
return tr("Render");
|
||||
}
|
||||
|
||||
QString TimecodeEffect::description()
|
||||
{
|
||||
return tr("Render the media or sequence timecode on this clip.");
|
||||
}
|
||||
|
||||
EffectType TimecodeEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType TimecodeEffect::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
NodePtr TimecodeEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<TimecodeEffect>(c);
|
||||
}
|
||||
|
||||
|
||||
void TimecodeEffect::redraw(double timecode) {
|
||||
Sequence* sequence = parent_clip->track()->sequence();
|
||||
|
||||
if (tc_select->GetValueAt(timecode).toBool()) {
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(olive::ActiveSequence->playhead,
|
||||
olive::CurrentConfig.timecode_view,
|
||||
olive::ActiveSequence->frame_rate);
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(sequence->playhead,
|
||||
olive::config.timecode_view,
|
||||
sequence->frame_rate);
|
||||
} else {
|
||||
double media_rate = parent_clip->media_frame_rate();
|
||||
display_timecode = prepend_text->GetStringAt(timecode) + frame_to_timecode(qRound(timecode * media_rate),
|
||||
olive::CurrentConfig.timecode_view,
|
||||
olive::config.timecode_view,
|
||||
media_rate);
|
||||
}
|
||||
img.fill(Qt::transparent);
|
||||
@@ -115,18 +139,17 @@ void TimecodeEffect::redraw(double timecode) {
|
||||
|
||||
QPainterPath path;
|
||||
|
||||
int text_x, text_y, rect_y, offset_x, offset_y;
|
||||
int text_x, text_y, rect_y;
|
||||
int text_height = fm.height();
|
||||
int text_width = fm.width(display_timecode);
|
||||
QColor background_color = color_bg_val->GetColorAt(timecode);
|
||||
int alpha_val = qCeil(bg_alpha->GetDoubleAt(timecode)*2.55);
|
||||
background_color.setAlpha(alpha_val);
|
||||
|
||||
offset_x = int(offset_x_val->GetDoubleAt(timecode));
|
||||
offset_y = int(offset_y_val->GetDoubleAt(timecode));
|
||||
QVector2D offset = offset_val->GetVector2DAt(timecode);
|
||||
|
||||
text_x = offset_x + (width/2) - (text_width/2);
|
||||
text_y = offset_y + height - height/10;
|
||||
text_x = offset.x() + (width/2) - (text_width/2);
|
||||
text_y = offset.y() + height - height/10;
|
||||
rect_y = text_y + fm.descent() - text_height;
|
||||
|
||||
path.addText(text_x, text_y, font, display_timecode);
|
||||
|
||||
@@ -1,44 +1,52 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMECODEEFFECT_H
|
||||
#define TIMECODEEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QImage>
|
||||
|
||||
class TimecodeEffect : public Effect {
|
||||
class TimecodeEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimecodeEffect(Clip* c, const EffectMeta *em);
|
||||
void redraw(double timecode);
|
||||
DoubleField* scale_val;
|
||||
ColorField* color_val;
|
||||
ColorField* color_bg_val;
|
||||
DoubleField* bg_alpha;
|
||||
DoubleField* offset_x_val;
|
||||
DoubleField* offset_y_val;
|
||||
StringField* prepend_text;
|
||||
ComboField* tc_select;
|
||||
TimecodeEffect(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString category() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void redraw(double timecode) override;
|
||||
DoubleInput* scale_val;
|
||||
ColorInput* color_val;
|
||||
ColorInput* color_bg_val;
|
||||
DoubleInput* bg_alpha;
|
||||
Vec2Input* offset_val;
|
||||
StringInput* prepend_text;
|
||||
ComboInput* tc_select;
|
||||
|
||||
protected:
|
||||
virtual bool AlwaysUpdate() override;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -27,51 +27,88 @@
|
||||
#include "timeline/clip.h"
|
||||
#include "timeline/sequence.h"
|
||||
|
||||
ToneEffect::ToneEffect(Clip* c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) {
|
||||
EffectRow* type_row = new EffectRow(this, tr("Type"));
|
||||
type_val = new ComboField(type_row, "type");
|
||||
ToneEffect::ToneEffect(Clip* c) : Node(c), sinX(INT_MIN) {
|
||||
type_val = new ComboInput(this, "type", tr("Type"));
|
||||
type_val->AddItem(tr("Sine"), TONE_TYPE_SINE);
|
||||
|
||||
EffectRow* frequency_row = new EffectRow(this, tr("Frequency"));
|
||||
freq_val = new DoubleField(frequency_row, "frequency");
|
||||
freq_val = new DoubleInput(this, "frequency", tr("Frequency"));
|
||||
freq_val->SetMinimum(20);
|
||||
freq_val->SetMaximum(20000);
|
||||
freq_val->SetDefault(1000);
|
||||
|
||||
EffectRow* amount_row = new EffectRow(this, tr("Amount"));
|
||||
amount_val = new DoubleField(amount_row, "amount");
|
||||
amount_val = new DoubleInput(this, "amount", tr("Amount"));
|
||||
amount_val->SetMinimum(0);
|
||||
amount_val->SetMaximum(100);
|
||||
amount_val->SetDefault(25);
|
||||
|
||||
EffectRow* mix_row = new EffectRow(this, tr("Mix"));
|
||||
mix_val = new BoolField(mix_row, "mix");
|
||||
mix_val = new BoolInput(this, "mix", tr("Mix"));
|
||||
mix_val->SetValueAt(0, true);
|
||||
}
|
||||
|
||||
void ToneEffect::process_audio(double timecode_start, double timecode_end, quint8 *samples, int nb_bytes, int) {
|
||||
double interval = (timecode_end - timecode_start)/nb_bytes;
|
||||
for (int i=0;i<nb_bytes;i+=4) {
|
||||
QString ToneEffect::name()
|
||||
{
|
||||
return tr("Tone");
|
||||
}
|
||||
|
||||
QString ToneEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.tone";
|
||||
}
|
||||
|
||||
QString ToneEffect::description()
|
||||
{
|
||||
return tr("Generate a sine wave tone to mix into this clip's audio.");
|
||||
}
|
||||
|
||||
EffectType ToneEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType ToneEffect::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr ToneEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<ToneEffect>(c);
|
||||
}
|
||||
|
||||
void ToneEffect::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
|
||||
Q_UNUSED(type)
|
||||
|
||||
double interval = (timecode_end - timecode_start)/nb_samples;
|
||||
|
||||
for (int i=0;i<nb_samples;i++) {
|
||||
|
||||
double timecode = timecode_start+(interval*i);
|
||||
float tone_sample = qSin((2*M_PI*sinX*freq_val->GetDoubleAt(timecode))
|
||||
/parent_clip->track()->sequence()->audio_frequency)
|
||||
*log_volume(amount_val->GetDoubleAt(timecode)*0.01);
|
||||
|
||||
qint16 left_tone_sample = qint16(qRound(qSin((2*M_PI*sinX*freq_val->GetDoubleAt(timecode))
|
||||
/parent_clip->sequence->audio_frequency)
|
||||
*log_volume(amount_val->GetDoubleAt(timecode)*0.01)*INT16_MAX));
|
||||
qint16 right_tone_sample = left_tone_sample;
|
||||
for (int j=0;j<channel_count;j++) {
|
||||
|
||||
if (mix_val->GetBoolAt(timecode)) {
|
||||
|
||||
// mix with source audio
|
||||
samples[j][i] += tone_sample;
|
||||
|
||||
} else {
|
||||
|
||||
// replace source audio
|
||||
samples[j][i] = tone_sample;
|
||||
|
||||
}
|
||||
|
||||
// mix with source audio
|
||||
if (mix_val->GetBoolAt(timecode)) {
|
||||
qint16 left_sample = qint16(((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
qint16 right_sample = qint16(((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
|
||||
left_tone_sample = mix_audio_sample(left_tone_sample, left_sample);
|
||||
right_tone_sample = mix_audio_sample(right_tone_sample, right_sample);
|
||||
}
|
||||
|
||||
samples[i+3] = quint8(right_tone_sample >> 8);
|
||||
samples[i+2] = quint8(right_tone_sample);
|
||||
samples[i+1] = quint8(left_tone_sample >> 8);
|
||||
samples[i] = quint8(left_tone_sample);
|
||||
|
||||
sinX++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,53 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TONEEFFECT_H
|
||||
#define TONEEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class ToneEffect : public Effect {
|
||||
class ToneEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ToneEffect(Clip* c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
ToneEffect(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
|
||||
ComboField* type_val;
|
||||
DoubleField* freq_val;
|
||||
DoubleField* amount_val;
|
||||
BoolField* mix_val;
|
||||
private:
|
||||
ComboInput* type_val;
|
||||
DoubleInput* freq_val;
|
||||
DoubleInput* amount_val;
|
||||
BoolInput* mix_val;
|
||||
|
||||
int sinX;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -43,122 +43,131 @@
|
||||
#include "panels/viewer.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
|
||||
TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
|
||||
SetFlags(Effect::CoordsFlag);
|
||||
TransformEffect::TransformEffect(Clip* c) : Node(c) {
|
||||
SetFlags(Node::CoordsFlag);
|
||||
|
||||
EffectRow* position_row = new EffectRow(this, tr("Position"));
|
||||
position = new Vec2Input(this, "pos", tr("Position"));
|
||||
|
||||
position_x = new DoubleField(position_row, "posx"); // position X
|
||||
position_y = new DoubleField(position_row, "posy"); // position Y
|
||||
scale = new Vec2Input(this, "scale", tr("Scale"));
|
||||
scale->SetMinimum(0);
|
||||
scale->SetDefault(100);
|
||||
|
||||
EffectRow* scale_row = new EffectRow(this, tr("Scale"));
|
||||
uniform_scale_field = new BoolInput(this, "uniformscale", tr("Uniform Scale"));
|
||||
connect(uniform_scale_field, SIGNAL(Toggled(bool)), scale, SLOT(SetSingleValueMode(bool)));
|
||||
uniform_scale_field->SetValueAt(0, true);
|
||||
|
||||
// scale X (and Y is uniform scale is selected)
|
||||
scale_x = new DoubleField(scale_row, "scalex");
|
||||
scale_x->SetMinimum(0);
|
||||
rotation = new DoubleInput(this, "rotation", tr("Rotation"));
|
||||
|
||||
// scale Y (disabled if uniform scale is selected)
|
||||
scale_y = new DoubleField(scale_row, "scaley");
|
||||
scale_y->SetMinimum(0);
|
||||
|
||||
EffectRow* uniform_scale_row = new EffectRow(this, tr("Uniform Scale"));
|
||||
|
||||
uniform_scale_field = new BoolField(uniform_scale_row, "uniformscale"); // uniform scale option
|
||||
|
||||
EffectRow* rotation_row = new EffectRow(this, tr("Rotation"));
|
||||
|
||||
rotation = new DoubleField(rotation_row, "rotation");
|
||||
|
||||
EffectRow* anchor_point_row = new EffectRow(this, tr("Anchor Point"));
|
||||
|
||||
anchor_x_box = new DoubleField(anchor_point_row, "anchorx"); // anchor point X
|
||||
anchor_y_box = new DoubleField(anchor_point_row, "anchory"); // anchor point Y
|
||||
|
||||
EffectRow* opacity_row = new EffectRow(this, tr("Opacity"));
|
||||
anchor_point = new Vec2Input(this, "anchor", tr("Anchor Point"));
|
||||
anchor_point->SetDefault(0);
|
||||
|
||||
// opacity
|
||||
opacity = new DoubleField(opacity_row, "opacity");
|
||||
opacity = new DoubleInput(this, "opacity", tr("Opacity"));
|
||||
opacity->SetMinimum(0);
|
||||
opacity->SetMaximum(100);
|
||||
opacity->SetDefault(100);
|
||||
|
||||
EffectRow* blend_mode_row = new EffectRow(this, tr("Blend Mode"));
|
||||
|
||||
// blend mode
|
||||
blend_mode_box = new ComboField(blend_mode_row, "blendmode");
|
||||
blend_mode_box->SetColumnSpan(2);
|
||||
blend_mode_box->AddItem(tr("Normal"), "");
|
||||
// TEMP - Create matrix output
|
||||
EffectRow* matrix_output = new EffectRow(this, "matrix", "Matrix", false, false);
|
||||
matrix_output->SetOutputDataType(olive::nodes::kMatrix);
|
||||
|
||||
// set up gizmos
|
||||
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
top_left_gizmo->set_cursor(Qt::SizeFDiagCursor);
|
||||
top_left_gizmo->x_field1 = scale_x;
|
||||
top_left_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
|
||||
|
||||
top_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
top_center_gizmo->set_cursor(Qt::SizeVerCursor);
|
||||
top_center_gizmo->y_field1 = scale_x;
|
||||
top_center_gizmo->y_field1 = static_cast<DoubleField*>(scale->Field(0));
|
||||
|
||||
top_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
top_right_gizmo->set_cursor(Qt::SizeBDiagCursor);
|
||||
top_right_gizmo->x_field1 = scale_x;
|
||||
top_right_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
|
||||
|
||||
bottom_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
bottom_left_gizmo->set_cursor(Qt::SizeBDiagCursor);
|
||||
bottom_left_gizmo->x_field1 = scale_x;
|
||||
bottom_left_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
|
||||
|
||||
bottom_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
bottom_center_gizmo->set_cursor(Qt::SizeVerCursor);
|
||||
bottom_center_gizmo->y_field1 = scale_x;
|
||||
bottom_center_gizmo->y_field1 = static_cast<DoubleField*>(scale->Field(0));
|
||||
|
||||
bottom_right_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
bottom_right_gizmo->set_cursor(Qt::SizeFDiagCursor);
|
||||
bottom_right_gizmo->x_field1 = scale_x;
|
||||
bottom_right_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
|
||||
|
||||
left_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
left_center_gizmo->set_cursor(Qt::SizeHorCursor);
|
||||
left_center_gizmo->x_field1 = scale_x;
|
||||
left_center_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
|
||||
|
||||
right_center_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
right_center_gizmo->set_cursor(Qt::SizeHorCursor);
|
||||
right_center_gizmo->x_field1 = scale_x;
|
||||
right_center_gizmo->x_field1 = static_cast<DoubleField*>(scale->Field(0));
|
||||
|
||||
anchor_gizmo = add_gizmo(GIZMO_TYPE_TARGET);
|
||||
anchor_gizmo->set_cursor(Qt::SizeAllCursor);
|
||||
anchor_gizmo->x_field1 = anchor_x_box;
|
||||
anchor_gizmo->y_field1 = anchor_y_box;
|
||||
anchor_gizmo->x_field2 = position_x;
|
||||
anchor_gizmo->y_field2 = position_y;
|
||||
anchor_gizmo->x_field1 = static_cast<DoubleField*>(anchor_point->Field(0));
|
||||
anchor_gizmo->y_field1 = static_cast<DoubleField*>(anchor_point->Field(1));
|
||||
anchor_gizmo->x_field2 = static_cast<DoubleField*>(position->Field(0));
|
||||
anchor_gizmo->y_field2 = static_cast<DoubleField*>(position->Field(1));
|
||||
|
||||
rotate_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
rotate_gizmo->color = Qt::green;
|
||||
rotate_gizmo->set_cursor(Qt::SizeAllCursor);
|
||||
rotate_gizmo->x_field1 = rotation;
|
||||
rotate_gizmo->x_field1 = static_cast<DoubleField*>(rotation->Field(0));
|
||||
|
||||
rect_gizmo = add_gizmo(GIZMO_TYPE_POLY);
|
||||
rect_gizmo->x_field1 = position_x;
|
||||
rect_gizmo->y_field1 = position_y;
|
||||
rect_gizmo->x_field1 = static_cast<DoubleField*>(position->Field(0));
|
||||
rect_gizmo->y_field1 = static_cast<DoubleField*>(position->Field(1));
|
||||
|
||||
connect(uniform_scale_field, SIGNAL(Toggled(bool)), this, SLOT(toggle_uniform_scale(bool)));
|
||||
|
||||
// set defaults
|
||||
uniform_scale_field->SetValueAt(0, true);
|
||||
blend_mode_box->SetValueAt(0, "");
|
||||
anchor_x_box->SetDefault(0);
|
||||
anchor_y_box->SetDefault(0);
|
||||
opacity->SetDefault(100);
|
||||
scale_x->SetDefault(100);
|
||||
scale_y->SetDefault(100);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
QString TransformEffect::name()
|
||||
{
|
||||
return tr("Transform");
|
||||
}
|
||||
|
||||
QString TransformEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.transform";
|
||||
}
|
||||
|
||||
QString TransformEffect::category()
|
||||
{
|
||||
return tr("Distort");
|
||||
}
|
||||
|
||||
QString TransformEffect::description()
|
||||
{
|
||||
return tr("Transform the position, scale, and rotation of this clip.");
|
||||
}
|
||||
|
||||
EffectType TransformEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType TransformEffect::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
NodePtr TransformEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<TransformEffect>(c);
|
||||
}
|
||||
|
||||
void TransformEffect::refresh() {
|
||||
if (parent_clip != nullptr && parent_clip->sequence != nullptr) {
|
||||
if (parent_clip != nullptr && parent_clip->track()->sequence() != nullptr) {
|
||||
|
||||
position_x->SetDefault(parent_clip->sequence->width/2);
|
||||
position_y->SetDefault(parent_clip->sequence->height/2);
|
||||
position->SetDefault({parent_clip->track()->sequence()->width*0.5,
|
||||
parent_clip->track()->sequence()->height*0.5});
|
||||
|
||||
double x_percent_multipler = 200.0 / parent_clip->sequence->width;
|
||||
double y_percent_multipler = 200.0 / parent_clip->sequence->height;
|
||||
double x_percent_multipler = 200.0 / parent_clip->track()->sequence()->width;
|
||||
double y_percent_multipler = 200.0 / parent_clip->track()->sequence()->height;
|
||||
|
||||
top_left_gizmo->x_field_multi1 = -x_percent_multipler;
|
||||
top_left_gizmo->y_field_multi1 = -y_percent_multipler;
|
||||
@@ -178,7 +187,10 @@ void TransformEffect::refresh() {
|
||||
}
|
||||
|
||||
void TransformEffect::toggle_uniform_scale(bool enabled) {
|
||||
scale_y->SetEnabled(!enabled);
|
||||
scale->SetSingleValueMode(enabled);
|
||||
|
||||
DoubleField* scale_x = static_cast<DoubleField*>(scale->Field(0));
|
||||
DoubleField* scale_y = static_cast<DoubleField*>(scale->Field(1));
|
||||
|
||||
top_center_gizmo->y_field1 = enabled ? scale_x : scale_y;
|
||||
bottom_center_gizmo->y_field1 = enabled ? scale_x : scale_y;
|
||||
@@ -190,51 +202,55 @@ void TransformEffect::toggle_uniform_scale(bool enabled) {
|
||||
|
||||
void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, int) {
|
||||
// position
|
||||
glTranslated(position_x->GetDoubleAt(timecode)-(parent_clip->sequence->width/2),
|
||||
position_y->GetDoubleAt(timecode)-(parent_clip->sequence->height/2),
|
||||
0);
|
||||
coords.matrix.translate(position->GetVector2DAt(timecode)
|
||||
- QVector2D(parent_clip->track()->sequence()->width*0.5f,
|
||||
parent_clip->track()->sequence()->height*0.5f));
|
||||
|
||||
// anchor point
|
||||
int anchor_x_offset = qRound(anchor_x_box->GetDoubleAt(timecode));
|
||||
int anchor_y_offset = qRound(anchor_y_box->GetDoubleAt(timecode));
|
||||
coords.vertexTopLeftX -= anchor_x_offset;
|
||||
coords.vertexTopRightX -= anchor_x_offset;
|
||||
coords.vertexBottomLeftX -= anchor_x_offset;
|
||||
coords.vertexBottomRightX -= anchor_x_offset;
|
||||
coords.vertexTopLeftY -= anchor_y_offset;
|
||||
coords.vertexTopRightY -= anchor_y_offset;
|
||||
coords.vertexBottomLeftY -= anchor_y_offset;
|
||||
coords.vertexBottomRightY -= anchor_y_offset;
|
||||
QVector2D anchor_val = anchor_point->GetVector2DAt(timecode);
|
||||
|
||||
coords.vertex_top_left -= anchor_val;
|
||||
coords.vertex_top_right -= anchor_val;
|
||||
coords.vertex_bottom_left -= anchor_val;
|
||||
coords.vertex_bottom_right -= anchor_val;
|
||||
|
||||
// rotation
|
||||
glRotated(rotation->GetDoubleAt(timecode), 0, 0, 1);
|
||||
coords.matrix.rotate(QQuaternion::fromEulerAngles(0, 0, float(rotation->GetDoubleAt(timecode))));
|
||||
|
||||
// scale
|
||||
double sx = scale_x->GetDoubleAt(timecode)*0.01;
|
||||
double sy = (uniform_scale_field->GetBoolAt(timecode)) ? sx : scale_y->GetDoubleAt(timecode)*0.01;
|
||||
glScaled(sx, sy, 1);
|
||||
|
||||
// blend mode
|
||||
coords.blendmode = blend_mode_box->GetValueAt(timecode).toInt();
|
||||
coords.matrix.scale(scale->GetVector2DAt(timecode)*0.01f);
|
||||
|
||||
// opacity
|
||||
coords.opacity *= float(opacity->GetDoubleAt(timecode)*0.01);
|
||||
}
|
||||
|
||||
QVector3D LerpVector3D(const QVector3D& a, const QVector3D& b, float t) {
|
||||
return QVector3D(
|
||||
float_lerp(a.x(), b.x(), t),
|
||||
float_lerp(a.y(), b.y(), t),
|
||||
float_lerp(a.z(), b.z(), t)
|
||||
);
|
||||
}
|
||||
|
||||
void TransformEffect::gizmo_draw(double, GLTextureCoords& coords) {
|
||||
top_left_gizmo->world_pos[0] = QPoint(coords.vertexTopLeftX, coords.vertexTopLeftY);
|
||||
top_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexTopLeftX, coords.vertexTopRightX, 0.5), lerp(coords.vertexTopLeftY, coords.vertexTopRightY, 0.5));
|
||||
top_right_gizmo->world_pos[0] = QPoint(coords.vertexTopRightX, coords.vertexTopRightY);
|
||||
right_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexTopRightX, coords.vertexBottomRightX, 0.5), lerp(coords.vertexTopRightY, coords.vertexBottomRightY, 0.5));
|
||||
bottom_right_gizmo->world_pos[0] = QPoint(coords.vertexBottomRightX, coords.vertexBottomRightY);
|
||||
bottom_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexBottomRightX, coords.vertexBottomLeftX, 0.5), lerp(coords.vertexBottomRightY, coords.vertexBottomLeftY, 0.5));
|
||||
bottom_left_gizmo->world_pos[0] = QPoint(coords.vertexBottomLeftX, coords.vertexBottomLeftY);
|
||||
left_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexBottomLeftX, coords.vertexTopLeftX, 0.5), lerp(coords.vertexBottomLeftY, coords.vertexTopLeftY, 0.5));
|
||||
top_left_gizmo->world_pos[0] = coords.vertex_top_left;
|
||||
top_right_gizmo->world_pos[0] = coords.vertex_top_right;
|
||||
bottom_right_gizmo->world_pos[0] = coords.vertex_bottom_right;
|
||||
bottom_left_gizmo->world_pos[0] = coords.vertex_bottom_left;
|
||||
|
||||
top_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_top_left, coords.vertex_top_right, 0.5);
|
||||
right_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_top_right, coords.vertex_bottom_right, 0.5);
|
||||
bottom_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_bottom_right, coords.vertex_bottom_left, 0.5);
|
||||
left_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_bottom_left, coords.vertex_top_left, 0.5);
|
||||
|
||||
rotate_gizmo->world_pos[0] = QPoint(lerp(top_center_gizmo->world_pos[0].x(), bottom_center_gizmo->world_pos[0].x(), -0.1), lerp(top_center_gizmo->world_pos[0].y(), bottom_center_gizmo->world_pos[0].y(), -0.1));
|
||||
rotate_gizmo->world_pos[0] = QVector3D(
|
||||
float_lerp(top_center_gizmo->world_pos[0].x(), bottom_center_gizmo->world_pos[0].x(), 0.5f),
|
||||
float_lerp(top_center_gizmo->world_pos[0].y(), bottom_center_gizmo->world_pos[0].y(), -0.1f),
|
||||
0.0f
|
||||
);
|
||||
|
||||
rect_gizmo->world_pos[0] = QPoint(coords.vertexTopLeftX, coords.vertexTopLeftY);
|
||||
rect_gizmo->world_pos[1] = QPoint(coords.vertexTopRightX, coords.vertexTopRightY);
|
||||
rect_gizmo->world_pos[2] = QPoint(coords.vertexBottomRightX, coords.vertexBottomRightY);
|
||||
rect_gizmo->world_pos[3] = QPoint(coords.vertexBottomLeftX, coords.vertexBottomLeftY);
|
||||
rect_gizmo->world_pos[0] = coords.vertex_top_left;
|
||||
rect_gizmo->world_pos[1] = coords.vertex_top_right;
|
||||
rect_gizmo->world_pos[2] = coords.vertex_bottom_right;
|
||||
rect_gizmo->world_pos[3] = coords.vertex_bottom_left;
|
||||
}
|
||||
|
||||
@@ -1,49 +1,56 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TRANSFORMEFFECT_H
|
||||
#define TRANSFORMEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class TransformEffect : public Effect {
|
||||
class TransformEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TransformEffect(Clip* c, const EffectMeta* em);
|
||||
void refresh();
|
||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||
TransformEffect(Clip* c);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString category() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void refresh() override;
|
||||
virtual void process_coords(double timecode, GLTextureCoords& coords, int data) override;
|
||||
|
||||
virtual void gizmo_draw(double timecode, GLTextureCoords& coords) override;
|
||||
|
||||
void gizmo_draw(double timecode, GLTextureCoords& coords);
|
||||
public slots:
|
||||
void toggle_uniform_scale(bool enabled);
|
||||
|
||||
private:
|
||||
DoubleField* position_x;
|
||||
DoubleField* position_y;
|
||||
DoubleField* scale_x;
|
||||
DoubleField* scale_y;
|
||||
BoolField* uniform_scale_field;
|
||||
DoubleField* rotation;
|
||||
DoubleField* anchor_x_box;
|
||||
DoubleField* anchor_y_box;
|
||||
DoubleField* opacity;
|
||||
ComboField* blend_mode_box;
|
||||
Vec2Input* position;
|
||||
Vec2Input* scale;
|
||||
BoolInput* uniform_scale_field;
|
||||
DoubleInput* rotation;
|
||||
Vec2Input* anchor_point;
|
||||
DoubleInput* opacity;
|
||||
|
||||
EffectGizmo* top_left_gizmo;
|
||||
EffectGizmo* top_center_gizmo;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -27,25 +27,55 @@
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
VoidEffect::VoidEffect(Clip* c, const QString& n) : Effect(c, nullptr) {
|
||||
QString display_name;
|
||||
if (n.isEmpty()) {
|
||||
display_name = tr("(unknown)");
|
||||
} else {
|
||||
display_name = n;
|
||||
VoidEffect::VoidEffect(Clip* c, const QString& n, const QString& id) :
|
||||
Node(c),
|
||||
display_name_(n),
|
||||
id_(id)
|
||||
{
|
||||
if (display_name_.isEmpty()) {
|
||||
display_name_ = tr("(unknown)");
|
||||
}
|
||||
EffectRow* row = new EffectRow(this, tr("Missing Effect"), false, false);
|
||||
|
||||
new LabelField(row, display_name);
|
||||
|
||||
name = display_name;
|
||||
|
||||
void_meta.type = EFFECT_TYPE_EFFECT;
|
||||
meta = &void_meta;
|
||||
new LabelWidget(this, tr("Missing Effect"), display_name_);
|
||||
}
|
||||
|
||||
EffectPtr VoidEffect::copy(Clip* c) {
|
||||
EffectPtr copy = std::make_shared<VoidEffect>(c, name);
|
||||
QString VoidEffect::name()
|
||||
{
|
||||
return display_name_;
|
||||
}
|
||||
|
||||
QString VoidEffect::id()
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
QString VoidEffect::description()
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
EffectType VoidEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType VoidEffect::subtype()
|
||||
{
|
||||
return olive::kTypeVideo;
|
||||
}
|
||||
|
||||
bool VoidEffect::IsCreatable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NodePtr VoidEffect::Create(Clip *)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NodePtr VoidEffect::copy(Clip* c) {
|
||||
NodePtr copy = std::make_shared<VoidEffect>(c, display_name_, id_);
|
||||
copy->SetEnabled(IsEnabled());
|
||||
copy_field_keyframes(copy);
|
||||
return copy;
|
||||
@@ -54,7 +84,7 @@ EffectPtr VoidEffect::copy(Clip* c) {
|
||||
void VoidEffect::load(QXmlStreamReader &stream) {
|
||||
QString tag = stream.name().toString();
|
||||
|
||||
QXmlStreamWriter writer(&bytes);
|
||||
QXmlStreamWriter writer(&bytes_);
|
||||
|
||||
// copy XML from reader to writer
|
||||
while (!stream.atEnd() && !(stream.name() == tag && stream.isEndElement())) {
|
||||
@@ -76,18 +106,18 @@ void VoidEffect::load(QXmlStreamReader &stream) {
|
||||
}
|
||||
|
||||
void VoidEffect::save(QXmlStreamWriter &stream) {
|
||||
if (!name.isEmpty()) {
|
||||
stream.writeAttribute("name", name);
|
||||
if (!display_name_.isEmpty()) {
|
||||
stream.writeAttribute("name", display_name_);
|
||||
stream.writeAttribute("enabled", QString::number(IsEnabled()));
|
||||
|
||||
// force xml writer to expand <effect> tag, ignored when loading
|
||||
stream.writeStartElement("void");
|
||||
stream.writeEndElement();
|
||||
|
||||
if (!bytes.isEmpty()) {
|
||||
if (!bytes_.isEmpty()) {
|
||||
// write stored data
|
||||
QIODevice* device = stream.device();
|
||||
device->write(bytes);
|
||||
device->write(bytes_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -27,19 +27,28 @@
|
||||
* isn't lost if the user saves over the project.
|
||||
*/
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class VoidEffect : public Effect {
|
||||
class VoidEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VoidEffect(Clip* c, const QString& n);
|
||||
VoidEffect(Clip* c, const QString& n, const QString &id);
|
||||
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual bool IsCreatable() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
virtual NodePtr copy(Clip* c) override;
|
||||
|
||||
virtual EffectPtr copy(Clip* c) override;
|
||||
virtual void load(QXmlStreamReader &stream) override;
|
||||
virtual void save(QXmlStreamWriter &stream) override;
|
||||
private:
|
||||
QByteArray bytes;
|
||||
EffectMeta void_meta;
|
||||
QByteArray bytes_;
|
||||
QString display_name_;
|
||||
QString id_;
|
||||
};
|
||||
|
||||
#endif // VOIDEFFECT_H
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -28,41 +28,63 @@
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
|
||||
VolumeEffect::VolumeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* volume_row = new EffectRow(this, tr("Volume"));
|
||||
volume_val = new DoubleField(volume_row, "volume");
|
||||
VolumeEffect::VolumeEffect(Clip* c) : Node(c) {
|
||||
volume_val = new DoubleInput(this, "volume", tr("Volume"));
|
||||
|
||||
// set defaults
|
||||
volume_val->SetDefault(1);
|
||||
volume_val->SetDisplayType(LabelSlider::Decibel);
|
||||
}
|
||||
|
||||
void VolumeEffect::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int) {
|
||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||
for (int i=0;i<nb_bytes;i+=4) {
|
||||
QString VolumeEffect::name()
|
||||
{
|
||||
return tr("Volume");
|
||||
}
|
||||
|
||||
QString VolumeEffect::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.volume";
|
||||
}
|
||||
|
||||
QString VolumeEffect::description()
|
||||
{
|
||||
return tr("Adjust the volume of this clip's audio");
|
||||
}
|
||||
|
||||
EffectType VolumeEffect::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType VolumeEffect::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr VolumeEffect::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<VolumeEffect>(c);
|
||||
}
|
||||
|
||||
void VolumeEffect::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
|
||||
Q_UNUSED(type)
|
||||
|
||||
double interval = (timecode_end-timecode_start)/nb_samples;
|
||||
|
||||
for (int i=0;i<nb_samples;i++) {
|
||||
|
||||
double vol_val = volume_val->GetDoubleAt(timecode_start+(interval*i));
|
||||
|
||||
qint32 right_samp = qint16(((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
|
||||
qint32 left_samp = qint16(((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
for (int j=0;j<channel_count;j++) {
|
||||
|
||||
left_samp *= vol_val;
|
||||
right_samp *= vol_val;
|
||||
samples[j][i] *= vol_val;
|
||||
|
||||
if (left_samp > INT16_MAX) {
|
||||
left_samp = INT16_MAX;
|
||||
} else if (left_samp < INT16_MIN) {
|
||||
left_samp = INT16_MIN;
|
||||
}
|
||||
|
||||
if (right_samp > INT16_MAX) {
|
||||
right_samp = INT16_MAX;
|
||||
} else if (right_samp < INT16_MIN) {
|
||||
right_samp = INT16_MIN;
|
||||
}
|
||||
|
||||
samples[i+3] = (quint8) (right_samp >> 8);
|
||||
samples[i+2] = (quint8) right_samp;
|
||||
samples[i+1] = (quint8) (left_samp >> 8);
|
||||
samples[i] = (quint8) left_samp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,49 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef VOLUMEEFFECT_H
|
||||
#define VOLUMEEFFECT_H
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
class VolumeEffect : public Effect {
|
||||
class VolumeEffect : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VolumeEffect(Clip* c, const EffectMeta* em);
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
VolumeEffect(Clip* c);
|
||||
|
||||
DoubleField* volume_val;
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
|
||||
private:
|
||||
DoubleInput* volume_val;
|
||||
};
|
||||
|
||||
#endif // VOLUMEEFFECT_H
|
||||
|
||||
+120
-69
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -46,7 +46,6 @@ class NSWindow;
|
||||
#endif
|
||||
|
||||
#define BLOCK_SIZE 512
|
||||
#define CHANNEL_COUNT 2
|
||||
|
||||
struct VSTRect {
|
||||
int16_t top;
|
||||
@@ -212,15 +211,6 @@ bool VSTHost::canPluginDo(char *canDoString) {
|
||||
return (dispatcher(plugin, effCanDo, 0, 0, static_cast<void*>(canDoString), 0.0f) > 0);
|
||||
}
|
||||
|
||||
void VSTHost::processAudio(long numFrames) {
|
||||
// Always reset the output array before processing.
|
||||
for (int i=0;i<CHANNEL_COUNT;i++) {
|
||||
memset(outputs[i], 0, BLOCK_SIZE*sizeof(float));
|
||||
}
|
||||
|
||||
plugin->processReplacing(plugin, inputs, outputs, numFrames);
|
||||
}
|
||||
|
||||
void VSTHost::CreateDialogIfNull()
|
||||
{
|
||||
if (dialog == nullptr) {
|
||||
@@ -237,74 +227,84 @@ void VSTHost::send_data_cache_to_plugin()
|
||||
dispatcher(plugin, effSetChunk, 0, int32_t(data_cache.size()), static_cast<void*>(data_cache.data()), 0);
|
||||
}
|
||||
|
||||
VSTHost::VSTHost(Clip* c, const EffectMeta *em) :
|
||||
Effect(c, em),
|
||||
VSTHost::VSTHost(Clip* c) :
|
||||
Node(c),
|
||||
plugin(nullptr),
|
||||
dialog(nullptr)
|
||||
dialog(nullptr),
|
||||
input_cache(BLOCK_SIZE),
|
||||
output_cache(BLOCK_SIZE)
|
||||
{
|
||||
plugin = nullptr;
|
||||
|
||||
inputs = new float* [CHANNEL_COUNT];
|
||||
outputs = new float* [CHANNEL_COUNT];
|
||||
for(int channel = 0; channel < CHANNEL_COUNT; channel++) {
|
||||
inputs[channel] = new float[BLOCK_SIZE];
|
||||
outputs[channel] = new float[BLOCK_SIZE];
|
||||
}
|
||||
|
||||
EffectRow* file_row = new EffectRow(this, tr("Plugin"), true, false);
|
||||
file_field = new FileField(file_row, "filename");
|
||||
file_field = new FileInput(this, "filename", tr("Plugin"), true, false);
|
||||
connect(file_field, SIGNAL(Changed()), this, SLOT(change_plugin()), Qt::QueuedConnection);
|
||||
|
||||
EffectRow* interface_row = new EffectRow(this, tr("Interface"), false, false);
|
||||
|
||||
show_interface_btn = new ButtonField(interface_row, tr("Show"));
|
||||
show_interface_btn = new ButtonWidget(this, tr("Interface"), tr("Show"));
|
||||
show_interface_btn->SetCheckable(true);
|
||||
show_interface_btn->SetEnabled(false);
|
||||
connect(show_interface_btn, SIGNAL(Toggled(bool)), this, SLOT(show_interface(bool)));
|
||||
}
|
||||
|
||||
VSTHost::~VSTHost() {
|
||||
for(int channel = 0; channel < CHANNEL_COUNT; channel++) {
|
||||
delete [] inputs[channel];
|
||||
delete [] outputs[channel];
|
||||
}
|
||||
delete [] outputs;
|
||||
delete [] inputs;
|
||||
|
||||
freePlugin();
|
||||
}
|
||||
|
||||
void VSTHost::process_audio(double, double, quint8* samples, int nb_bytes, int) {
|
||||
QString VSTHost::name()
|
||||
{
|
||||
return tr("VST Plugin 2.x");
|
||||
}
|
||||
|
||||
QString VSTHost::id()
|
||||
{
|
||||
return "org.olivevideoeditor.Olive.vst2x";
|
||||
}
|
||||
|
||||
QString VSTHost::description()
|
||||
{
|
||||
return tr("Use a VST 2.x plugin on this clip's audio.");
|
||||
}
|
||||
|
||||
EffectType VSTHost::type()
|
||||
{
|
||||
return EFFECT_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
olive::TrackType VSTHost::subtype()
|
||||
{
|
||||
return olive::kTypeAudio;
|
||||
}
|
||||
|
||||
NodePtr VSTHost::Create(Clip *c)
|
||||
{
|
||||
return std::make_shared<VSTHost>(c);
|
||||
}
|
||||
|
||||
void VSTHost::process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) {
|
||||
if (plugin != nullptr) {
|
||||
int interval = BLOCK_SIZE*4;
|
||||
for (int i=0;i<nb_bytes;i+=interval) {
|
||||
int process_size = qMin(interval, nb_bytes - i);
|
||||
int lim = i + process_size;
|
||||
|
||||
// convert to float
|
||||
for (int j=i;j<lim;j+=4) {
|
||||
qint16 left_sample = qint16(((samples[j+1] & 0xFF) << 8) | (samples[j] & 0xFF));
|
||||
qint16 right_sample = qint16(((samples[j+3] & 0xFF) << 8) | (samples[j+2] & 0xFF));
|
||||
// Make copy of audio
|
||||
input_cache.Create(channel_count);
|
||||
output_cache.Create(channel_count);
|
||||
|
||||
int index = (j-i)>>2;
|
||||
inputs[0][index] = float(left_sample) / float(INT16_MAX);
|
||||
inputs[1][index] = float(right_sample) / float(INT16_MAX);
|
||||
for (int i=0;i<nb_samples;i+=BLOCK_SIZE) {
|
||||
int sample_size = qMin(BLOCK_SIZE, nb_samples - i);
|
||||
|
||||
// Copy samples to input cache
|
||||
for (int j=0;j<channel_count;j++) {
|
||||
memcpy(input_cache.data()[j], &samples[j][i], nb_samples * sizeof(float));
|
||||
}
|
||||
|
||||
// send to VST
|
||||
processAudio(process_size>>2);
|
||||
plugin->processReplacing(plugin, input_cache.data(), output_cache.data(), sample_size);
|
||||
|
||||
// convert back to int16
|
||||
for (int j=i;j<lim;j+=4) {
|
||||
int index = (j-i)>>2;
|
||||
|
||||
qint16 left_sample = qint16(qRound(outputs[0][index] * INT16_MAX));
|
||||
qint16 right_sample = qint16(qRound(outputs[1][index] * INT16_MAX));
|
||||
|
||||
samples[j+3] = quint8(right_sample >> 8);
|
||||
samples[j+2] = quint8(right_sample);
|
||||
samples[j+1] = quint8(left_sample >> 8);
|
||||
samples[j] = quint8(left_sample);
|
||||
// Copy output cache back to samples
|
||||
for (int j=0;j<channel_count;j++) {
|
||||
memcpy(&samples[j][i], output_cache.data()[j], nb_samples * sizeof(float));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,7 +321,7 @@ void VSTHost::custom_load(QXmlStreamReader &stream) {
|
||||
}
|
||||
|
||||
void VSTHost::save(QXmlStreamWriter &stream) {
|
||||
Effect::save(stream);
|
||||
Node::save(stream);
|
||||
if (plugin != nullptr) {
|
||||
char* p = nullptr;
|
||||
int32_t length = int32_t(dispatcher(plugin, effGetChunk, 0, 0, &p, 0));
|
||||
@@ -379,3 +379,54 @@ void VSTHost::change_plugin() {
|
||||
}
|
||||
show_interface_btn->SetEnabled(plugin != nullptr);
|
||||
}
|
||||
|
||||
SampleCache::SampleCache(int block_size) :
|
||||
block_size_(block_size),
|
||||
channel_count_(0),
|
||||
array_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
SampleCache::~SampleCache()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
void SampleCache::Create(int channels)
|
||||
{
|
||||
if (channel_count_ != channels) {
|
||||
|
||||
if (channel_count_ > 0) {
|
||||
destroy();
|
||||
}
|
||||
|
||||
channel_count_ = channels;
|
||||
|
||||
array_ = new float* [channel_count_];
|
||||
for (int i=0;i<channel_count_;i++) {
|
||||
array_[i] = new float[block_size_];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SampleCache::SetZero()
|
||||
{
|
||||
for (int i=0;i<channel_count_;i++) {
|
||||
memset(array_[i], 0, block_size_ * sizeof(float));
|
||||
}
|
||||
}
|
||||
|
||||
float **SampleCache::data()
|
||||
{
|
||||
return array_;
|
||||
}
|
||||
|
||||
void SampleCache::destroy()
|
||||
{
|
||||
for (int i=0;i<channel_count_;i++) {
|
||||
delete [] array_[i];
|
||||
}
|
||||
|
||||
delete [] array_;
|
||||
array_ = nullptr;
|
||||
}
|
||||
|
||||
+52
-24
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -24,28 +24,57 @@
|
||||
#include <QDialog>
|
||||
#include <QLibrary>
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "include/vestige.h"
|
||||
|
||||
// Plugin's dispatcher function
|
||||
typedef intptr_t (*dispatcherFuncPtr)(AEffect *effect, int32_t opCode, int32_t index, int32_t value, void *ptr, float opt);
|
||||
|
||||
class VSTHost : public Effect {
|
||||
class SampleCache {
|
||||
public:
|
||||
SampleCache(int block_size);
|
||||
~SampleCache();
|
||||
|
||||
void Create(int channels);
|
||||
void SetZero();
|
||||
|
||||
float** data();
|
||||
private:
|
||||
int channel_count_;
|
||||
int block_size_;
|
||||
float** array_;
|
||||
void destroy();
|
||||
};
|
||||
|
||||
class VSTHost : public Node {
|
||||
Q_OBJECT
|
||||
public:
|
||||
VSTHost(Clip* c, const EffectMeta* em);
|
||||
~VSTHost();
|
||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
VSTHost(Clip* c);
|
||||
virtual ~VSTHost() override;
|
||||
|
||||
void custom_load(QXmlStreamReader& stream);
|
||||
void save(QXmlStreamWriter& stream);
|
||||
virtual QString name() override;
|
||||
virtual QString id() override;
|
||||
virtual QString description() override;
|
||||
virtual EffectType type() override;
|
||||
virtual olive::TrackType subtype() override;
|
||||
virtual NodePtr Create(Clip *c) override;
|
||||
|
||||
virtual void process_audio(double timecode_start,
|
||||
double timecode_end,
|
||||
float **samples,
|
||||
int nb_samples,
|
||||
int channel_count,
|
||||
int type) override;
|
||||
|
||||
virtual void custom_load(QXmlStreamReader& stream) override;
|
||||
virtual void save(QXmlStreamWriter& stream) override;
|
||||
private slots:
|
||||
void show_interface(bool show);
|
||||
void uncheck_show_button();
|
||||
void change_plugin();
|
||||
private:
|
||||
FileField* file_field;
|
||||
ButtonField* show_interface_btn;
|
||||
FileInput* file_field;
|
||||
ButtonWidget* show_interface_btn;
|
||||
|
||||
void loadPlugin();
|
||||
void freePlugin();
|
||||
@@ -57,12 +86,11 @@ private:
|
||||
void resumePlugin();
|
||||
void suspendPlugin();
|
||||
bool canPluginDo(char *canDoString);
|
||||
void processAudio(long numFrames);
|
||||
void CreateDialogIfNull();
|
||||
float** inputs;
|
||||
float** outputs;
|
||||
QDialog* dialog;
|
||||
QByteArray data_cache;
|
||||
SampleCache input_cache;
|
||||
SampleCache output_cache;
|
||||
|
||||
void send_data_cache_to_plugin();
|
||||
|
||||
|
||||
+13
-13
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -60,7 +60,7 @@ void delete_keyframes(QVector<EffectField *>& selected_key_fields, QVector<int>
|
||||
for (int i=0;i<key_indices.size();i++) {
|
||||
ca->append(new KeyframeDelete(fields.at(i), key_indices.at(i)));
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
selected_keys.clear();
|
||||
selected_key_fields.clear();
|
||||
update_ui(false);
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
#version 110
|
||||
|
||||
uniform sampler2D image;
|
||||
|
||||
uniform float radius;
|
||||
uniform vec2 resolution;
|
||||
uniform bool horiz_blur;
|
||||
uniform bool vert_blur;
|
||||
uniform int iteration;
|
||||
uniform vec2 resolution;
|
||||
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
void main(void) {
|
||||
vec4 process(vec4 col) {
|
||||
float rad = ceil(radius);
|
||||
|
||||
float divider = 1.0 / rad;
|
||||
@@ -19,15 +13,15 @@ void main(void) {
|
||||
|
||||
if (iteration == 0 && horiz_blur && !radius_is_zero) {
|
||||
for (float x=-rad+0.5;x<=rad;x+=2.0) {
|
||||
color += texture2D(image, (vec2(gl_FragCoord.x+x, gl_FragCoord.y))/resolution)*(divider);
|
||||
color += texture2D(texture, vec2(gl_FragCoord.x+x, gl_FragCoord.y)/resolution)*(divider);
|
||||
}
|
||||
gl_FragColor = color;
|
||||
return color;
|
||||
} else if (iteration == 1 && vert_blur && !radius_is_zero) {
|
||||
for (float x=-rad+0.5;x<=rad;x+=2.0) {
|
||||
color += texture2D(image, (vec2(gl_FragCoord.x, gl_FragCoord.y+x))/resolution)*(divider);
|
||||
color += texture2D(texture, vec2(gl_FragCoord.x, gl_FragCoord.y+x)/resolution)*(divider);
|
||||
}
|
||||
gl_FragColor = color;
|
||||
return color;
|
||||
} else {
|
||||
gl_FragColor = texture2D(image, vTexCoord);
|
||||
return col;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<effect name="Box Blur" category="Blur">
|
||||
<row name="Radius">
|
||||
<field type="double" min="0" default="10" id="radius"/>
|
||||
</row>
|
||||
<row name="Horizontal">
|
||||
<field type="bool" default="1" id="horiz_blur"/>
|
||||
</row>
|
||||
<row name="Vertical">
|
||||
<field type="bool" default="1" id="vert_blur"/>
|
||||
</row>
|
||||
<shader vert="common.vert" frag="boxblur.frag" iterations="2"/>
|
||||
<effect name="Box Blur" category="Blur" id="org.olivevideoeditor.Olive.boxblur">
|
||||
<field name="Radius" type="double" min="0" default="10" id="radius"/>
|
||||
<field name="Horizontal" type="bool" default="1" id="horiz_blur"/>
|
||||
<field name="Vertical" type="bool" default="1" id="vert_blur"/>
|
||||
<shader vert="common.vert" frag="boxblur.frag" iterations="2" />
|
||||
</effect>
|
||||
@@ -1,7 +1,3 @@
|
||||
#version 120
|
||||
|
||||
uniform sampler2D tex0;
|
||||
varying vec2 vTexCoord;
|
||||
const float PI = 3.1415926535;
|
||||
|
||||
uniform vec2 resolution;
|
||||
@@ -18,15 +14,15 @@ vec2 distort(vec2 p, vec2 offset) {
|
||||
return 0.5 * (p + 1.0);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec4 process(vec4 col) {
|
||||
vec2 offset = vec2(xoff/resolution.x, yoff/resolution.y);
|
||||
vec2 xy = 2.0 * vTexCoord - 1.0 - offset;
|
||||
vec2 xy = 2.0 * v_texcoord - 1.0 - offset;
|
||||
vec2 uv;
|
||||
float d = length(xy);
|
||||
uv = distort(xy, offset);
|
||||
if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) {
|
||||
gl_FragColor = texture2D(tex0, uv);
|
||||
return texture2D(texture, uv);
|
||||
} else {
|
||||
discard;
|
||||
return vec4(0.0);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,17 @@
|
||||
#version 110
|
||||
|
||||
uniform vec2 resolution;
|
||||
|
||||
uniform sampler2D tex;
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
uniform float red_amount;
|
||||
uniform float green_amount;
|
||||
uniform float blue_amount;
|
||||
|
||||
void main(void) {
|
||||
uniform vec2 resolution;
|
||||
|
||||
vec4 process(vec4 col) {
|
||||
vec2 rOffset = vec2(red_amount*0.01)/resolution;
|
||||
vec2 gOffset = vec2(green_amount*0.01)/resolution;
|
||||
vec2 bOffset = vec2(blue_amount*0.01)/resolution;
|
||||
|
||||
vec4 rValue = texture2D(tex, vTexCoord - rOffset);
|
||||
vec4 gValue = texture2D(tex, vTexCoord - gOffset);
|
||||
vec4 bValue = texture2D(tex, vTexCoord - bOffset);
|
||||
vec4 rValue = texture2D(texture, v_texcoord - rOffset);
|
||||
vec4 gValue = texture2D(texture, v_texcoord - gOffset);
|
||||
vec4 bValue = texture2D(texture, v_texcoord - bOffset);
|
||||
|
||||
gl_FragColor = vec4(rValue.r, gValue.g, bValue.b, texture2D(tex, vTexCoord).a);
|
||||
return vec4(rValue.r, gValue.g, bValue.b, col.a);
|
||||
}
|
||||
+31
-27
@@ -1,43 +1,47 @@
|
||||
#version 110
|
||||
|
||||
uniform float left;
|
||||
uniform float top;
|
||||
uniform float right;
|
||||
uniform float bottom;
|
||||
uniform float feather;
|
||||
uniform bool invert;
|
||||
uniform vec2 resolution;
|
||||
|
||||
uniform mediump float amount_val;
|
||||
uniform sampler2D myTexture;
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
void main(void) {
|
||||
vec4 textureColor = texture2D(myTexture, vec2(vTexCoord.x, vTexCoord.y));
|
||||
float alpha = textureColor.a;
|
||||
vec4 process(vec4 col) {
|
||||
float alpha = 1.0;
|
||||
|
||||
|
||||
if (feather == 0.0) {
|
||||
if (vTexCoord.x < (left*0.01) || vTexCoord.y < (top*0.01) || vTexCoord.x > (1.0-(right*0.01)) || vTexCoord.y > (1.0-(bottom*0.01))) {
|
||||
if (v_texcoord.x < (left*0.01) || v_texcoord.y < (top*0.01) || v_texcoord.x > (1.0-(right*0.01)) || v_texcoord.y > (1.0-(bottom*0.01))) {
|
||||
alpha = 0.0;
|
||||
}
|
||||
} else {
|
||||
float f = pow(2.0, 10.0-(feather*0.1));
|
||||
if (left > 0.0) alpha = alpha * clamp(((vTexCoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left
|
||||
if (top > 0.0) alpha = alpha * clamp(((vTexCoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top
|
||||
if (right > 0.0) alpha = alpha * clamp((((1.0-vTexCoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right
|
||||
if (bottom > 0.0) alpha = alpha * clamp((((1.0-vTexCoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom
|
||||
|
||||
float f = pow(2.0, 10.0-(feather*0.25));
|
||||
|
||||
if (left > 0.0) {
|
||||
alpha *= clamp(((resolution.x*v_texcoord.x+(0.5/f))-(left*0.01*resolution.x))*f, 0.0, 1.0); // left
|
||||
}
|
||||
|
||||
if (top > 0.0) {
|
||||
alpha *= clamp(((resolution.y*v_texcoord.y+(0.5/f))-(top*0.01*resolution.y))*f, 0.0, 1.0); // top
|
||||
}
|
||||
|
||||
if (right > 0.0) {
|
||||
alpha *= clamp(((resolution.x*(1.0-v_texcoord.x)+(0.5/f))-(right*0.01*resolution.x))*f, 0.0, 1.0); // right
|
||||
}
|
||||
|
||||
if (bottom > 0.0) {
|
||||
alpha *= clamp(((resolution.y*(1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01*resolution.y))*f, 0.0, 1.0); // bottom
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (invert)
|
||||
{gl_FragColor = vec4(
|
||||
textureColor.r*(1.0 - alpha),
|
||||
textureColor.g*(1.0 - alpha),
|
||||
textureColor.b*(1.0 - alpha),
|
||||
1.0 - alpha
|
||||
);}
|
||||
else{
|
||||
gl_FragColor = vec4(
|
||||
textureColor.r*(alpha),
|
||||
textureColor.g*(alpha),
|
||||
textureColor.b*(alpha),
|
||||
alpha
|
||||
);}
|
||||
if (invert) {
|
||||
return col * (1.0-alpha);
|
||||
} else {
|
||||
return col * alpha;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
#version 110
|
||||
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
|
||||
uniform sampler2D image;
|
||||
|
||||
uniform float angle; // degrees
|
||||
uniform float length;
|
||||
|
||||
uniform vec2 resolution;
|
||||
|
||||
void main(void) {
|
||||
vec4 process(vec4 col) {
|
||||
if (length > 0.0) {
|
||||
float ceillen = ceil(length);
|
||||
float radians = (angle*M_PI)/180.0;
|
||||
@@ -21,10 +17,10 @@ void main(void) {
|
||||
for (float i=-ceillen+0.5;i<=ceillen;i+=2.0) {
|
||||
float y = sin_angle * i;
|
||||
float x = cos_angle * i;
|
||||
color += texture2D(image, vec2(gl_FragCoord.x+x, gl_FragCoord.y+y)/resolution)*(divider);
|
||||
color += texture2D(texture, vec2(gl_FragCoord.x+x, gl_FragCoord.y+y)/resolution)*(divider);
|
||||
}
|
||||
gl_FragColor = color;
|
||||
return color;
|
||||
} else {
|
||||
gl_FragColor = texture2D(image, gl_FragCoord.xy/resolution);
|
||||
return col;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<effect name="Drop Shadow" category="Stylize">
|
||||
<row name="Color">
|
||||
<field type="color" r="0" g="0" b="0" id="shadowcolor"/>
|
||||
</row>
|
||||
<row name="Softness">
|
||||
<field type="double" min="0" default="20" id="shadowsoftness"/>
|
||||
</row>
|
||||
<row name="Opacity">
|
||||
<field type="double" min="0" default="100" max="100" id="shadowopacity"/>
|
||||
</row>
|
||||
<row name="Distance">
|
||||
<field type="double" min="0" default="20" id="shadowdistance"/>
|
||||
</row>
|
||||
<shader vert="common.vert" frag="dropshadow.frag"/>
|
||||
</effect>
|
||||
@@ -1,23 +1,14 @@
|
||||
#version 110
|
||||
|
||||
uniform bool horiz;
|
||||
uniform bool vert;
|
||||
|
||||
uniform sampler2D myTexture;
|
||||
varying vec2 vTexCoord;
|
||||
vec4 process(vec4 col) {
|
||||
float x = v_texcoord.x;
|
||||
float y = v_texcoord.y;
|
||||
|
||||
void main(void) {
|
||||
float x = vTexCoord.x;
|
||||
float y = vTexCoord.y;
|
||||
if (!horiz && !vert) return col;
|
||||
|
||||
if (horiz) x = 1.0 - x;
|
||||
if (vert) y = 1.0 - y;
|
||||
|
||||
vec4 textureColor = texture2D(myTexture, vec2(x, y));
|
||||
gl_FragColor = vec4(
|
||||
textureColor.r,
|
||||
textureColor.g,
|
||||
textureColor.b,
|
||||
textureColor.a
|
||||
);
|
||||
return texture2D(texture, vec2(x, y));
|
||||
}
|
||||
@@ -1,18 +1,11 @@
|
||||
#version 110
|
||||
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
|
||||
uniform sampler2D image;
|
||||
|
||||
//uniform float radius;
|
||||
uniform float sigma;
|
||||
uniform vec2 resolution;
|
||||
uniform bool horiz_blur;
|
||||
uniform bool vert_blur;
|
||||
uniform int iteration;
|
||||
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
float gaussian(float x, float sigma) {
|
||||
return (1.0/(sigma*sqrt(2.0*M_PI)))*exp(-0.5*pow(x/sigma, 2.0));
|
||||
}
|
||||
@@ -21,7 +14,7 @@ float gaussian2(float x, float y, float sigma) {
|
||||
return (1.0/(pow(sigma, 2.0)*2.0*M_PI))*exp(-0.5*((pow(x, 2.0) + pow(y, 2.0))/pow(sigma, 2.0)));
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec4 process(vec4 col) {
|
||||
float rad = ceil(3.0 * sigma);
|
||||
|
||||
float sum = 0.0;
|
||||
@@ -39,16 +32,16 @@ void main(void) {
|
||||
if (iteration == 0 && horiz_blur && !radius_is_zero) {
|
||||
for (float x=-rad+0.5;x<=rad;x+=2.0) {
|
||||
float weight = (gaussian2(x, 0.0, sigma)/sum);
|
||||
color += texture2D(image, (vec2(gl_FragCoord.x+x, gl_FragCoord.y))/resolution)*(weight);
|
||||
color += texture2D(texture, vec2(gl_FragCoord.x+x, gl_FragCoord.y)/resolution)*(weight);
|
||||
}
|
||||
gl_FragColor = color;
|
||||
return color;
|
||||
} else if (iteration == 1 && vert_blur && !radius_is_zero) {
|
||||
for (float x=-rad+0.5;x<=rad;x+=2.0) {
|
||||
float weight = (gaussian2(0.0, x, sigma)/sum);
|
||||
color += texture2D(image, (vec2(gl_FragCoord.x, gl_FragCoord.y+x))/resolution)*(weight);
|
||||
color += texture2D(texture, vec2(gl_FragCoord.x, gl_FragCoord.y+x)/resolution)*(weight);
|
||||
}
|
||||
gl_FragColor = color;
|
||||
return color;
|
||||
} else {
|
||||
gl_FragColor = texture2D(image, vTexCoord);
|
||||
return col;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#version 110
|
||||
|
||||
uniform float amount;
|
||||
|
||||
uniform sampler2D myTexture;
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
void main(void) {
|
||||
vec4 textureColor = texture2D(myTexture, vTexCoord);
|
||||
float amount_val = amount * 0.01;
|
||||
vec3 col = textureColor.rgb+((vec3(1.0)-textureColor.rgb-textureColor.rgb)*vec3(amount_val));
|
||||
gl_FragColor = vec4(col, textureColor.a);
|
||||
}
|
||||
@@ -4,9 +4,6 @@ feel free to use or modify at will*/
|
||||
|
||||
/*the following three functions convert RGB into YCbCr in the same manner as in JPEG images*/
|
||||
|
||||
uniform sampler2D tex;
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
uniform vec3 key_color;
|
||||
uniform float tola;
|
||||
uniform float tolb;
|
||||
@@ -42,13 +39,11 @@ float colorclose(float Cb_p,float Cr_p,float Cb_key,float Cr_key,float tola,floa
|
||||
if (temp < tolb) {return ((temp-tola)/(tolb-tola));}
|
||||
return (1.0);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
|
||||
vec4 process(vec4 texture_color) {
|
||||
float cb_key = rgb2cb(key_color);
|
||||
float cr_key = rgb2cr(key_color);
|
||||
|
||||
vec4 texture_color = texture2D(tex, vTexCoord);
|
||||
|
||||
float cb = rgb2cb(texture_color.rgb);
|
||||
float cr = rgb2cr(texture_color.rgb);
|
||||
float mask = colorclose(cb, cr, cb_key, cr_key, (tola/100.0), (tolb/100.0));
|
||||
@@ -68,5 +63,5 @@ void main(void) {
|
||||
} else if (mode == 2) { // original
|
||||
}
|
||||
|
||||
gl_FragColor = texture_color;
|
||||
return texture_color;
|
||||
}
|
||||
@@ -2,10 +2,6 @@
|
||||
Based on Edward Cannon's Simple Chroma Key (adaptation by Olive Team)
|
||||
RGB to HSV based on MattKC's toonify source code
|
||||
Feel free to modify and use at will */
|
||||
#version 110
|
||||
|
||||
uniform sampler2D tex;
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
uniform float loc;
|
||||
uniform float hic;
|
||||
@@ -57,8 +53,7 @@ bool isNotIncreasingSequence(float a, float b, float c) {
|
||||
return (c < b || a > b);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec4 texture_color = texture2D(tex,vTexCoord);
|
||||
vec4 process(vec4 texture_color) {
|
||||
vec3 color = texture_color.rgb;
|
||||
float toCheck = 0.0;
|
||||
|
||||
@@ -79,5 +74,5 @@ void main(void) {
|
||||
}
|
||||
texture_color.a = isNotIncreasingSequence(loc, toCheck, hic) ? (invert ? texture_color.a : 0.0) : (invert ? 0.0 : texture_color.a);
|
||||
texture_color.rgb *= texture_color.a;
|
||||
gl_FragColor = texture_color;
|
||||
return texture_color;
|
||||
}
|
||||
@@ -1,15 +1,12 @@
|
||||
#version 120
|
||||
uniform sampler2D tex0;
|
||||
varying vec2 vTexCoord;
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
|
||||
uniform float size;
|
||||
|
||||
void main(void) {
|
||||
vec4 process(vec4 col) {
|
||||
float maxFactor = 2.0 - (size * 0.01);
|
||||
|
||||
vec2 uv;
|
||||
vec2 xy = 2.0 * vTexCoord - 1.0;
|
||||
vec2 xy = 2.0 * v_texcoord - 1.0;
|
||||
float d = length(xy);
|
||||
if (d < (2.0-maxFactor)) {
|
||||
d = length(xy * maxFactor);
|
||||
@@ -20,8 +17,7 @@ void main(void) {
|
||||
uv.x = r * cos(phi) + 0.5;
|
||||
uv.y = r * sin(phi) + 0.5;
|
||||
} else {
|
||||
uv = vTexCoord;
|
||||
uv = v_texcoord;
|
||||
}
|
||||
vec4 c = texture2D(tex0, uv);
|
||||
gl_FragColor = c;
|
||||
return texture2D(texture, uv);
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
#version 110
|
||||
|
||||
uniform float hue;
|
||||
uniform float saturation;
|
||||
uniform float brightness;
|
||||
|
||||
uniform sampler2D myTexture;
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
vec3 rgb2hsv(vec3 c) {
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
@@ -23,9 +18,7 @@ vec3 hsv2rgb(vec3 c) {
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec4 tex_color = texture2D(myTexture, vTexCoord);
|
||||
|
||||
vec4 process(vec4 tex_color) {
|
||||
vec3 hsv = rgb2hsv(tex_color.rgb);
|
||||
hsv.r += (hue/360.0);
|
||||
hsv.g *= (saturation*0.01);
|
||||
@@ -33,10 +26,8 @@ void main(void) {
|
||||
|
||||
vec3 rgb = hsv2rgb(hsv);
|
||||
|
||||
gl_FragColor = vec4(
|
||||
rgb.r,
|
||||
rgb.g,
|
||||
rgb.b,
|
||||
return vec4(
|
||||
rgb.rgb,
|
||||
tex_color.a
|
||||
);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user