fixed regression with internal shaders and multiple effects paths
This commit is contained in:
+24
-1
@@ -155,12 +155,17 @@ void load_internal_effects() {
|
|||||||
effects.append(em);
|
effects.append(em);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_shader_effects() {
|
QList<QString> get_effects_paths() {
|
||||||
QList<QString> effects_paths;
|
QList<QString> effects_paths;
|
||||||
effects_paths.append(get_app_dir() + "/effects");
|
effects_paths.append(get_app_dir() + "/effects");
|
||||||
effects_paths.append(get_app_dir() + "/../share/olive-editor/effects");
|
effects_paths.append(get_app_dir() + "/../share/olive-editor/effects");
|
||||||
QString env_path(qgetenv("OLIVE_EFFECTS_PATH"));
|
QString env_path(qgetenv("OLIVE_EFFECTS_PATH"));
|
||||||
if (!env_path.isEmpty()) effects_paths.append(env_path);
|
if (!env_path.isEmpty()) effects_paths.append(env_path);
|
||||||
|
return effects_paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
void load_shader_effects() {
|
||||||
|
QList<QString> effects_paths = get_effects_paths();
|
||||||
|
|
||||||
for (int h=0;h<effects_paths.size();h++) {
|
for (int h=0;h<effects_paths.size();h++) {
|
||||||
const QString& effects_path = effects_paths.at(h);
|
const QString& effects_path = effects_paths.at(h);
|
||||||
@@ -744,6 +749,23 @@ void Effect::save(QXmlStreamWriter& stream) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Effect::validate_meta_path() {
|
||||||
|
if (!meta->path.isEmpty() || (vertPath.isEmpty() && fragPath.isEmpty())) return;
|
||||||
|
QList<QString> effects_paths = get_effects_paths();
|
||||||
|
const QString& test_fn = vertPath.isEmpty() ? fragPath : vertPath;
|
||||||
|
for (int i=0;i<effects_paths.size();i++) {
|
||||||
|
if (QFileInfo::exists(effects_paths.at(i) + "/" + test_fn)) {
|
||||||
|
for (int j=0;j<effects.size();j++) {
|
||||||
|
if (&effects.at(j) == meta) {
|
||||||
|
effects[j].path = effects_paths.at(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Effect::open() {
|
void Effect::open() {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
dout << "[WARNING] Tried to open an effect that was already open";
|
dout << "[WARNING] Tried to open an effect that was already open";
|
||||||
@@ -754,6 +776,7 @@ void Effect::open() {
|
|||||||
dout << "[WARNING] No current context to create a shader program for - will retry next repaint";
|
dout << "[WARNING] No current context to create a shader program for - will retry next repaint";
|
||||||
} else {
|
} else {
|
||||||
glslProgram = new QOpenGLShaderProgram();
|
glslProgram = new QOpenGLShaderProgram();
|
||||||
|
validate_meta_path();
|
||||||
if (!vertPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + vertPath);
|
if (!vertPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + vertPath);
|
||||||
if (!fragPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + fragPath);
|
if (!fragPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + fragPath);
|
||||||
glslProgram->link();
|
glslProgram->link();
|
||||||
|
|||||||
+42
-41
@@ -26,13 +26,13 @@ class CheckboxEx;
|
|||||||
class KeyframeDelete;
|
class KeyframeDelete;
|
||||||
|
|
||||||
struct EffectMeta {
|
struct EffectMeta {
|
||||||
QString name;
|
QString name;
|
||||||
QString category;
|
QString category;
|
||||||
QString filename;
|
QString filename;
|
||||||
QString path;
|
QString path;
|
||||||
int internal;
|
int internal;
|
||||||
int type;
|
int type;
|
||||||
int subtype;
|
int subtype;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern QVector<EffectMeta> effects;
|
extern QVector<EffectMeta> effects;
|
||||||
@@ -74,33 +74,33 @@ extern QMutex effects_loaded;
|
|||||||
#define KEYFRAME_TYPE_HOLD 2
|
#define KEYFRAME_TYPE_HOLD 2
|
||||||
|
|
||||||
struct GLTextureCoords {
|
struct GLTextureCoords {
|
||||||
int grid_size;
|
int grid_size;
|
||||||
|
|
||||||
int vertexTopLeftX;
|
int vertexTopLeftX;
|
||||||
int vertexTopLeftY;
|
int vertexTopLeftY;
|
||||||
int vertexTopLeftZ;
|
int vertexTopLeftZ;
|
||||||
int vertexTopRightX;
|
int vertexTopRightX;
|
||||||
int vertexTopRightY;
|
int vertexTopRightY;
|
||||||
int vertexTopRightZ;
|
int vertexTopRightZ;
|
||||||
int vertexBottomLeftX;
|
int vertexBottomLeftX;
|
||||||
int vertexBottomLeftY;
|
int vertexBottomLeftY;
|
||||||
int vertexBottomLeftZ;
|
int vertexBottomLeftZ;
|
||||||
int vertexBottomRightX;
|
int vertexBottomRightX;
|
||||||
int vertexBottomRightY;
|
int vertexBottomRightY;
|
||||||
int vertexBottomRightZ;
|
int vertexBottomRightZ;
|
||||||
|
|
||||||
float textureTopLeftX;
|
float textureTopLeftX;
|
||||||
float textureTopLeftY;
|
float textureTopLeftY;
|
||||||
float textureTopLeftQ;
|
float textureTopLeftQ;
|
||||||
float textureTopRightX;
|
float textureTopRightX;
|
||||||
float textureTopRightY;
|
float textureTopRightY;
|
||||||
float textureTopRightQ;
|
float textureTopRightQ;
|
||||||
float textureBottomRightX;
|
float textureBottomRightX;
|
||||||
float textureBottomRightY;
|
float textureBottomRightY;
|
||||||
float textureBottomRightQ;
|
float textureBottomRightQ;
|
||||||
float textureBottomLeftX;
|
float textureBottomLeftX;
|
||||||
float textureBottomLeftY;
|
float textureBottomLeftY;
|
||||||
float textureBottomLeftQ;
|
float textureBottomLeftQ;
|
||||||
};
|
};
|
||||||
|
|
||||||
qint16 mix_audio_sample(qint16 a, qint16 b);
|
qint16 mix_audio_sample(qint16 a, qint16 b);
|
||||||
@@ -114,21 +114,21 @@ class Effect : public QObject {
|
|||||||
public:
|
public:
|
||||||
Effect(Clip* c, const EffectMeta* em);
|
Effect(Clip* c, const EffectMeta* em);
|
||||||
~Effect();
|
~Effect();
|
||||||
Clip* parent_clip;
|
Clip* parent_clip;
|
||||||
const EffectMeta* meta;
|
const EffectMeta* meta;
|
||||||
int id;
|
int id;
|
||||||
QString name;
|
QString name;
|
||||||
CollapsibleWidget* container;
|
CollapsibleWidget* container;
|
||||||
|
|
||||||
EffectRow* add_row(const QString &name, bool savable = true);
|
EffectRow* add_row(const QString &name, bool savable = true);
|
||||||
EffectRow* row(int i);
|
EffectRow* row(int i);
|
||||||
int row_count();
|
int row_count();
|
||||||
|
|
||||||
EffectGizmo* add_gizmo(int type);
|
EffectGizmo* add_gizmo(int type);
|
||||||
EffectGizmo* gizmo(int i);
|
EffectGizmo* gizmo(int i);
|
||||||
int gizmo_count();
|
int gizmo_count();
|
||||||
|
|
||||||
bool is_enabled();
|
bool is_enabled();
|
||||||
void set_enabled(bool b);
|
void set_enabled(bool b);
|
||||||
|
|
||||||
virtual void refresh();
|
virtual void refresh();
|
||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
void copy_field_keyframes(Effect *e);
|
void copy_field_keyframes(Effect *e);
|
||||||
|
|
||||||
void load(QXmlStreamReader& stream);
|
void load(QXmlStreamReader& stream);
|
||||||
void save(QXmlStreamWriter& stream);
|
void save(QXmlStreamWriter& stream);
|
||||||
|
|
||||||
// glsl handling
|
// glsl handling
|
||||||
void open();
|
void open();
|
||||||
@@ -147,24 +147,24 @@ public:
|
|||||||
|
|
||||||
bool enable_shader;
|
bool enable_shader;
|
||||||
bool enable_coords;
|
bool enable_coords;
|
||||||
bool enable_superimpose;
|
bool enable_superimpose;
|
||||||
bool enable_image;
|
bool enable_image;
|
||||||
|
|
||||||
int getIterations();
|
int getIterations();
|
||||||
void setIterations(int i);
|
void setIterations(int i);
|
||||||
|
|
||||||
const char* ffmpeg_filter;
|
const char* ffmpeg_filter;
|
||||||
|
|
||||||
virtual void process_image(double timecode, uint8_t* data, int size);
|
virtual void process_image(double timecode, uint8_t* data, int size);
|
||||||
virtual void process_shader(double timecode, GLTextureCoords&);
|
virtual void process_shader(double timecode, GLTextureCoords&);
|
||||||
virtual void process_coords(double timecode, GLTextureCoords& coords, int data);
|
virtual void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||||
virtual GLuint process_superimpose(double timecode);
|
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 process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
|
|
||||||
virtual void gizmo_draw(double timecode, GLTextureCoords& coords);
|
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_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode, bool done);
|
||||||
void gizmo_world_to_screen();
|
void gizmo_world_to_screen();
|
||||||
bool are_gizmos_enabled();
|
bool are_gizmos_enabled();
|
||||||
public slots:
|
public slots:
|
||||||
void field_changed();
|
void field_changed();
|
||||||
private slots:
|
private slots:
|
||||||
@@ -182,17 +182,17 @@ protected:
|
|||||||
QImage img;
|
QImage img;
|
||||||
QOpenGLTexture* texture;
|
QOpenGLTexture* texture;
|
||||||
|
|
||||||
// enable effect to update constantly
|
// enable effect to update constantly
|
||||||
bool enable_always_update;
|
bool enable_always_update;
|
||||||
private:
|
private:
|
||||||
// superimpose effect
|
// superimpose effect
|
||||||
QString script;
|
QString script;
|
||||||
|
|
||||||
bool isOpen;
|
bool isOpen;
|
||||||
QVector<EffectRow*> rows;
|
QVector<EffectRow*> rows;
|
||||||
QVector<EffectGizmo*> gizmos;
|
QVector<EffectGizmo*> gizmos;
|
||||||
QGridLayout* ui_layout;
|
QGridLayout* ui_layout;
|
||||||
QWidget* ui;
|
QWidget* ui;
|
||||||
bool bound;
|
bool bound;
|
||||||
|
|
||||||
// superimpose functions
|
// superimpose functions
|
||||||
@@ -201,6 +201,7 @@ private:
|
|||||||
QVector<QVariant> cachedValues;
|
QVector<QVariant> cachedValues;
|
||||||
void delete_texture();
|
void delete_texture();
|
||||||
int get_index_in_clip();
|
int get_index_in_clip();
|
||||||
|
void validate_meta_path();
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectInit : public QThread {
|
class EffectInit : public QThread {
|
||||||
|
|||||||
Reference in New Issue
Block a user