1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- /* import_soundtrack.cpp - import soundtrack action
- * Copyright (C) 2017-2018 caryoscelus
- *
- * 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 <core/node_info/node_info.h>
- #include <core/node/make.h>
- #include <core/action_stack.h>
- #include <core/actions/change_link.h>
- #include <generic/process_node.h>
- #include "import.h"
- namespace rainynite::studio {
- struct ImportSoundTag {};
- using ImportSoundProcessor = ProcessNode<string, ImportSoundTag>;
- class SetSoundtrack : public ImportSoundProcessor {
- public:
- bool accept(core::NodeTreeIndex node) const override {
- auto tree = get_context()->tree();
- return node_name(*tree->get_node(node)) == "AudioFromFile";
- }
- void feed(string const& s) override {
- auto string_node = core::make_value<string>(std::move(s));
- auto ctx = get_context();
- ctx->action_stack()->emplace<core::actions::SetProperty>(ctx->tree(), get_node_index(), "file_path", string_node);
- }
- };
- REGISTER_PROCESS_NODE(SetSoundtrack, ImportSoundProcessor)
- namespace actions {
- /**
- * Import file paths as Image layers
- */
- class ImportSoundtrack :
- public ImportFiles<ImportSoundProcessor>,
- REGISTERED_ACTION(ImportSoundtrack)
- {
- ACTION_NAME("Import soundtrack")
- };
- } // namespace actions
- } // namespace rainynite::studio
|