created clip block node
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(clip)
|
||||
add_subdirectory(gap)
|
||||
add_subdirectory(timeline)
|
||||
|
||||
|
||||
@@ -26,18 +26,14 @@ Block::Block()
|
||||
previous_input_->add_data_input(NodeParam::kBlock);
|
||||
AddParameter(previous_input_);
|
||||
|
||||
previous_output_ = new NodeOutput();
|
||||
previous_output_->set_data_type(NodeParam::kBlock);
|
||||
AddParameter(previous_output_);
|
||||
block_output_ = new NodeOutput();
|
||||
block_output_->set_data_type(NodeParam::kBlock);
|
||||
AddParameter(block_output_);
|
||||
|
||||
next_input_ = new NodeInput();
|
||||
next_input_->add_data_input(NodeParam::kBlock);
|
||||
AddParameter(next_input_);
|
||||
|
||||
next_output_ = new NodeOutput();
|
||||
next_output_->set_data_type(NodeParam::kBlock);
|
||||
AddParameter(next_output_);
|
||||
|
||||
texture_output_ = new NodeOutput();
|
||||
texture_output_->set_data_type(NodeParam::kTexture);
|
||||
AddParameter(texture_output_);
|
||||
@@ -73,8 +69,7 @@ void Block::Process(const rational &time)
|
||||
Q_UNUSED(time)
|
||||
|
||||
// Simply set both output values as a pointer to this object
|
||||
previous_output_->set_value(PtrToValue(this));
|
||||
next_output_->set_value(PtrToValue(this));
|
||||
block_output_->set_value(PtrToValue(this));
|
||||
}
|
||||
|
||||
void Block::Refresh()
|
||||
|
||||
@@ -72,8 +72,7 @@ protected:
|
||||
private:
|
||||
NodeInput* previous_input_;
|
||||
NodeInput* next_input_;
|
||||
NodeOutput* previous_output_;
|
||||
NodeOutput* next_output_;
|
||||
NodeOutput* block_output_;
|
||||
|
||||
NodeOutput* texture_output_;
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# 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/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
node/block/clip/clip.h
|
||||
node/block/clip/clip.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,45 @@
|
||||
/***
|
||||
|
||||
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 "clip.h"
|
||||
|
||||
ClipBlock::ClipBlock()
|
||||
{
|
||||
texture_input_ = new NodeInput();
|
||||
texture_input_->add_data_input(NodeInput::kTexture);
|
||||
AddParameter(texture_input_);
|
||||
}
|
||||
|
||||
NodeInput *ClipBlock::texture_input()
|
||||
{
|
||||
return texture_input_;
|
||||
}
|
||||
|
||||
void ClipBlock::Process(const rational &time)
|
||||
{
|
||||
// Run default node processing
|
||||
Block::Process(time);
|
||||
|
||||
// We convert the time given (timeline time) to media time
|
||||
rational media_time = time - in() + media_in_;
|
||||
|
||||
// Retrieve texture
|
||||
texture_output()->set_value(texture_input_->get_value(media_time));
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/***
|
||||
|
||||
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 CLIPBLOCK_H
|
||||
#define CLIPBLOCK_H
|
||||
|
||||
#include "node/block/block.h"
|
||||
|
||||
/**
|
||||
* @brief Node that represents a block of Media
|
||||
*/
|
||||
class ClipBlock : public Block
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ClipBlock();
|
||||
|
||||
NodeInput* texture_input();
|
||||
|
||||
public slots:
|
||||
virtual void Process(const rational &time) override;
|
||||
|
||||
private:
|
||||
NodeInput* texture_input_;
|
||||
|
||||
rational media_in_;
|
||||
};
|
||||
|
||||
#endif // TIMELINEBLOCK_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 "gap.h"
|
||||
|
||||
GapBlock::GapBlock()
|
||||
|
||||
@@ -18,16 +18,17 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEBLOCK_H
|
||||
#define TIMELINEBLOCK_H
|
||||
#ifndef GAPBLOCK_H
|
||||
#define GAPBLOCK_H
|
||||
|
||||
#include "node/block/block.h"
|
||||
|
||||
/**
|
||||
* @brief Node that represents the end of the Timeline as well as a time traversal Node
|
||||
* @brief Node that represents nothing in its respective track for a certain period of time
|
||||
*/
|
||||
class GapBlock : public Block
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GapBlock();
|
||||
|
||||
|
||||
@@ -1,7 +1,28 @@
|
||||
/***
|
||||
|
||||
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 "timeline.h"
|
||||
|
||||
TimelineBlock::TimelineBlock() :
|
||||
current_block_(nullptr)
|
||||
current_block_(nullptr),
|
||||
attached_timeline_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -17,7 +38,7 @@ void TimelineBlock::Process(const rational &time)
|
||||
|
||||
// This node represents the end of the timeline, so if the time is beyond its start, there's no image to display
|
||||
if (time >= in()) {
|
||||
texture_output_->set_value(0);
|
||||
texture_output()->set_value(0);
|
||||
current_block_ = nullptr;
|
||||
return;
|
||||
}
|
||||
@@ -38,5 +59,5 @@ void TimelineBlock::Process(const rational &time)
|
||||
}
|
||||
|
||||
// At this point, we must have found the correct block so we use its texture output to produce the image
|
||||
texture_output_->set_value(current_block_->texture_output()->get_value(time));
|
||||
texture_output()->set_value(current_block_->texture_output()->get_value(time));
|
||||
}
|
||||
|
||||
@@ -22,22 +22,28 @@
|
||||
#define TIMELINEBLOCK_H
|
||||
|
||||
#include "node/block/block.h"
|
||||
#include "panel/timeline/timeline.h"
|
||||
|
||||
/**
|
||||
* @brief Node that represents the end of the Timeline as well as a time traversal Node
|
||||
*/
|
||||
class TimelineBlock : public Block
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimelineBlock();
|
||||
|
||||
virtual rational length() override;
|
||||
|
||||
void AttachTimeline(TimelinePanel* timeline);
|
||||
|
||||
public slots:
|
||||
virtual void Process(const rational &time) override;
|
||||
|
||||
private:
|
||||
Block* current_block_;
|
||||
|
||||
TimelinePanel* attached_timeline_;
|
||||
};
|
||||
|
||||
#endif // TIMELINEBLOCK_H
|
||||
|
||||
Reference in New Issue
Block a user