fixed node type issues

This commit is contained in:
itsmattkc
2019-04-10 09:00:25 +10:00
parent a03879a12b
commit c281e5a6ff
4 changed files with 18 additions and 19 deletions
+8 -8
View File
@@ -852,14 +852,14 @@ void Effect::process_shader(double timecode, GLTextureCoords&, int iteration) {
EffectField* field = row->Field(j);
if (!field->id().isEmpty()) {
switch (field->type()) {
case olive::nodes::kFloat:
case EFFECT_FIELD_DOUBLE:
{
DoubleField* double_field = static_cast<DoubleField*>(field);
shader_program_->setUniformValue(double_field->id().toUtf8().constData(),
GLfloat(double_field->GetDoubleAt(timecode)));
}
break;
case olive::nodes::kColor:
case EFFECT_FIELD_COLOR:
{
ColorField* color_field = static_cast<ColorField*>(field);
shader_program_->setUniformValue(
@@ -870,18 +870,18 @@ void Effect::process_shader(double timecode, GLTextureCoords&, int iteration) {
);
}
break;
case olive::nodes::kBoolean:
case EFFECT_FIELD_BOOL:
shader_program_->setUniformValue(field->id().toUtf8().constData(), field->GetValueAt(timecode).toBool());
break;
case olive::nodes::kCombo:
case EFFECT_FIELD_COMBO:
shader_program_->setUniformValue(field->id().toUtf8().constData(), field->GetValueAt(timecode).toInt());
break;
// can you even send a string to a uniform value?
case olive::nodes::kString:
case olive::nodes::kFont:
case olive::nodes::kFile:
case olive::nodes::kUI:
case EFFECT_FIELD_STRING:
case EFFECT_FIELD_FONT:
case EFFECT_FIELD_FILE:
case EFFECT_FIELD_UI:
break;
}
}
+8 -8
View File
@@ -93,7 +93,7 @@ QVariant EffectField::GetValueAt(double timecode)
const QVariant& before_data = keyframes.at(before_keyframe).data;
switch (type_) {
case olive::nodes::kFloat:
case EFFECT_FIELD_DOUBLE:
{
double value;
if (before_keyframe == after_keyframe) {
@@ -163,7 +163,7 @@ QVariant EffectField::GetValueAt(double timecode)
persistent_data_ = value;
break;
}
case olive::nodes::kColor:
case EFFECT_FIELD_COLOR:
{
QColor value;
if (before_keyframe == after_keyframe) {
@@ -178,11 +178,11 @@ QVariant EffectField::GetValueAt(double timecode)
persistent_data_ = value;
break;
}
case olive::nodes::kString:
case olive::nodes::kBoolean:
case olive::nodes::kCombo:
case olive::nodes::kFont:
case olive::nodes::kFile:
case EFFECT_FIELD_STRING:
case EFFECT_FIELD_BOOL:
case EFFECT_FIELD_COMBO:
case EFFECT_FIELD_FONT:
case EFFECT_FIELD_FILE:
persistent_data_ = before_data;
break;
default:
@@ -360,7 +360,7 @@ void EffectField::GetKeyframeData(double timecode, int &before, int &after, doub
}
}
if ((type_ == olive::nodes::kFloat || type_ == olive::nodes::kColor)
if ((type_ == EFFECT_FIELD_DOUBLE || type_ == EFFECT_FIELD_COLOR)
&& (before_keyframe_index > -1 && after_keyframe_index > -1)) {
// interpolate
before = before_keyframe_index;
-1
View File
@@ -25,7 +25,6 @@ NodeEditor::NodeEditor(QWidget *parent) :
void NodeEditor::Retranslate()
{
}
void NodeEditor::LoadEvent()
+2 -2
View File
@@ -244,7 +244,7 @@ void GraphView::paintEvent(QPaintEvent *) {
for (int i=row->FieldCount()-1;i>=0;i--) {
EffectField* field = row->Field(i);
if (field->type() == olive::nodes::kFloat && field_visibility.at(i)) {
if (field->type() == EffectField::EFFECT_FIELD_DOUBLE && field_visibility.at(i)) {
// sort keyframes by time
QVector<int> sorted_keys = sort_keys_from_field(field);
@@ -386,7 +386,7 @@ void GraphView::mousePressEvent(QMouseEvent *event) {
} else {
for (int i=0;i<row->FieldCount();i++) {
EffectField* field = row->Field(i);
if (field->type() == olive::nodes::kFloat && field_visibility.at(i)) {
if (field->type() == EffectField::EFFECT_FIELD_DOUBLE && field_visibility.at(i)) {
for (int j=0;j<field->keyframes.size();j++) {
const EffectKeyframe& key = field->keyframes.at(j);
int key_x = get_screen_x(key.time);