Move properties from renderable to video player class

This commit is contained in:
Ylva Selling
2023-02-16 11:41:25 -05:00
parent 871733be1e
commit f4c216d673
2 changed files with 6 additions and 54 deletions
-5
View File
@@ -48,11 +48,6 @@ public:
private:
void bindTexture() override;
properties::TriggerProperty _play;
properties::TriggerProperty _pause;
properties::TriggerProperty _goToStart;
properties::TriggerProperty _reset;
VideoPlayer _videoPlayer;
};
+6 -49
View File
@@ -36,42 +36,8 @@
#include <optional>
namespace {
constexpr openspace::properties::Property::PropertyInfo TexturePathInfo = {
"File",
"Video path",
"Video path"
};
constexpr openspace::properties::Property::PropertyInfo PlayInfo = {
"Play",
"Play",
"Play video"
};
constexpr openspace::properties::Property::PropertyInfo PauseInfo = {
"Pause",
"Pause",
"Pause video"
};
constexpr openspace::properties::Property::PropertyInfo GoToStartInfo = {
"GoToStart",
"Go To Start",
"Go to start in video"
};
constexpr openspace::properties::Property::PropertyInfo ResetInfo = {
"Reset",
"Reset",
"Reset video"
};
struct [[codegen::Dictionary(ScreenSpaceVideo)]] Parameters {
// Specifies the GUI name of the ScreenspaceImage
std::optional<std::string> name;
// [[codegen::verbatim(TexturePathInfo.description)]]
std::optional<std::string> file;
};
#include "screenspacevideo_codegen.cpp"
} // namespace
@@ -79,17 +45,12 @@ namespace {
namespace openspace {
documentation::Documentation ScreenSpaceVideo::Documentation() {
return codegen::doc<Parameters>("base_screenspace_image_local");
return codegen::doc<Parameters>("screenspace_video");
}
ScreenSpaceVideo::ScreenSpaceVideo(const ghoul::Dictionary& dictionary)
: ScreenSpaceRenderable(dictionary)
, _videoPlayer(dictionary)
, _play(PlayInfo)
, _pause(PauseInfo)
, _goToStart(GoToStartInfo)
, _reset(ResetInfo)
{
const Parameters p = codegen::bake<Parameters>(dictionary);
@@ -105,15 +66,11 @@ ScreenSpaceVideo::ScreenSpaceVideo(const ghoul::Dictionary& dictionary)
identifier = makeUniqueIdentifier(identifier);
setIdentifier(identifier);
// Video interaction. Only valid for real time looping
_play.onChange([this]() { _videoPlayer.play(); });
addProperty(_play);
_pause.onChange([this]() { _videoPlayer.pause(); });
addProperty(_pause);
_goToStart.onChange([this]() { _videoPlayer.goToStart(); });
addProperty(_goToStart);
_reset.onChange([this]() { _videoPlayer.reset(); });
addProperty(_reset);
addProperty(_videoPlayer._play);
addProperty(_videoPlayer._pause);
addProperty(_videoPlayer._goToStart);
addProperty(_videoPlayer._reset);
addProperty(_videoPlayer._playAudio);
}
void ScreenSpaceVideo::update() {