summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-11-07 20:33:53 +0000
committerComment <tim@gray.(none)>2013-11-07 20:33:53 +0000
commit6d5ef1f8ed4c97814718dead6e6949704217a66d (patch)
treea012886a98f887081a97b8b91ca60df586a89832
parent17b3ae2a27de4fe5d0f565efc83a38bd8ca81b26 (diff)
loader wrangling
-rw-r--r--rotord/src/graph.cpp3
-rw-r--r--rotord/src/rotor.h6
2 files changed, 6 insertions, 3 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp
index 9544446..6409ff6 100644
--- a/rotord/src/graph.cpp
+++ b/rotord/src/graph.cpp
@@ -333,7 +333,7 @@ bool Graph::parseJson(string &data,string &media_path){
}
if (attr->type=="string") {
val=jnodes[i]["attributes"][m]["value"].asString();
- attr->value=val;
+ attr->init(val);
}
if (attr->type=="array"){
std::vector<std::string> vals;
@@ -344,6 +344,7 @@ bool Graph::parseJson(string &data,string &media_path){
}
attr->init(vals);
}
+ node->init_attribute(jnodes[i]["attributes"][m]["name"].asString()); //hook for attribute initialisers
//cerr << "Rotor: setting attribute '"<<attribute<<"' of "<<nodeID<<" type "<<attr->type<<" to "<<val<<endl;
cerr << "Rotor: setting attribute '"<<attribute<<"' of "<<nodeID<<" type "<<attr->type<<" to "<<val<<endl;
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index ee58484..eb3fbc8 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -260,7 +260,8 @@ namespace Rotor {
create_attribute(_attr,_desc,_title,_value,_vals,_type);
alias=&(attributes[_attr]->intVal);
};
- virtual void init_attribute(const string &attr){};
+ virtual void init_attribute(const string &attr){
+ };
string description;
string type;
string ID;
@@ -566,6 +567,7 @@ namespace Rotor {
};
Video_loader(map<string,string> &settings): Video_loader() {
base_settings(settings);
+ for (auto a:attributes) cerr<<"Video loader: "<<a.first<<" set to "<<a.second->value<<endl;
if (attributes["filename"]->value!="") {
isLoaded=load(find_setting(settings,"media_path","")+attributes["filename"]->value);
}
@@ -574,7 +576,7 @@ namespace Rotor {
~Video_loader(){};
void init_attribute(const string &attr){
if (attr=="filename") {
- load(attributes["media_path"]->value+attributes[attr]->value);
+ isLoaded=load(attributes["media_path"]->value+attributes[attr]->value);
}
};
Video_loader* clone(map<string,string> &_settings) { return new Video_loader(_settings);};