24void EffectBase::InitEffectInfo()
46 *out << std::fixed << std::setprecision(2) << std::boolalpha;
47 *out <<
"----------------------------" << std::endl;
48 *out <<
"----- Effect Information -----" << std::endl;
49 *out <<
"----------------------------" << std::endl;
50 *out <<
"--> Name: " <<
info.
name << std::endl;
54 *out <<
"----------------------------" << std::endl;
63 else if (color_value > 255)
88 root[
"order"] =
Order();
104 catch (
const std::exception& e)
107 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
119 std::list<EffectBase*> effects = parentTimeline->
ClipEffects();
124 for (
auto const& effect : effects){
126 if ((effect->info.parent_effect_id == this->Id()) && (effect->Id() != this->
Id()))
127 effect->SetJsonValue(root);
135 my_root[
"id"] = this->
Id();
145 if (!my_root[
"order"].isNull())
146 Order(my_root[
"order"].asInt());
148 if (!my_root[
"parent_effect_id"].isNull()){
193 if (parentEffectPtr){
199 EffectJSON[
"id"] = this->
Id();
Header file for EffectBase class.
Header file for all Exception classes.
Header file for Timeline class.
This abstract class is the base class, used by all clips in libopenshot.
float Start() const
Get start position (in seconds) of clip (trim start of video)
virtual float End() const
Get end position (in seconds) of clip (trim end of video)
std::string Id() const
Get the Id of this clip object.
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
int Layer() const
Get layer of clip on timeline (lower number is covered by higher numbers)
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
float Position() const
Get position on timeline (in seconds)
virtual openshot::TimelineBase * ParentTimeline()
Get the associated Timeline pointer (if any)
This abstract class is the base class, used by all effects in libopenshot.
virtual void SetJson(const std::string value)
Load JSON string into this object.
EffectBase * parentEffect
Parent effect (which properties will set this effect properties)
Json::Value JsonInfo() const
Generate JSON object of meta data / info.
std::string ParentClipId() const
Return the ID of this effect's parent clip.
void SetParentEffect(std::string parentEffect_id)
Set the parent effect from which this properties will be set to.
virtual Json::Value JsonValue() const
Generate Json::Value for this object.
openshot::ClipBase * ParentClip()
Parent clip object of this effect (which can be unparented and NULL)
int constrain(int color_value)
Constrain a color value from 0 to 255.
virtual std::string Json() const
Generate JSON string of this object.
virtual void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
int Order() const
Get the order that this effect should be executed.
openshot::ClipBase * clip
Pointer to the parent clip instance (if any)
EffectInfoStruct info
Information about the current effect.
void DisplayInfo(std::ostream *out=&std::cout)
Display effect information in the standard output stream (stdout)
Exception for invalid JSON.
This class represents a timeline.
openshot::EffectBase * GetClipEffect(const std::string &id)
Look up a clip effect by ID.
std::list< openshot::EffectBase * > ClipEffects() const
Return the list of effects on all clips.
This namespace is the default namespace for all code in the openshot library.
const Json::Value stringToJson(const std::string value)
bool has_video
Determines if this effect manipulates the image of a frame.
std::string parent_effect_id
Id of the parent effect (if there is one)
bool has_audio
Determines if this effect manipulates the audio of a frame.
std::string class_name
The class name of the effect.
std::string name
The name of the effect.
std::string description
The description of this effect and what it does.
bool has_tracked_object
Determines if this effect track objects through the clip.