From 7d78e568bcef0356fa2d4873b2ba6d19b65c4689 Mon Sep 17 00:00:00 2001 From: Comment Date: Sun, 3 Nov 2013 16:00:34 +0000 Subject: making video bank loader --- rotord/src/graph.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 9 deletions(-) (limited to 'rotord/src/graph.cpp') diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp index 3f1d02b..e323b87 100644 --- a/rotord/src/graph.cpp +++ b/rotord/src/graph.cpp @@ -322,19 +322,35 @@ bool Graph::parseJson(string &data,string &media_path){ map settings; vector attrs; settings["type"]=jnodes[i]["type"].asString(); - if (settings["type"]=="video_cycler"){ - //breakpoint - cerr<<"making video cycler"<attributes.find(attribute)!=node->attributes.end()){ + Attribute *attr=node->attributes.find(attribute)->second; + if (attr->type=="enum"){ + string val=jnodes[i]["attributes"][m]["value"].asString(); + attr->init(val); + } + else if (attr->type=="array"){ + std::vector vals; + + for (int i5 = 0; i5 < jnodes[i]["attributes"][m]["value"].size(); i5++ ) + { + vals.push_back(jnodes[i]["attributes"][m]["value"][i5].asString()); + } + attr->init(vals); + + } + else { + string val=jnodes[i]["attributes"][m]["value"].asString(); + attr->value=val; + } + } + //settings[attribute]=val; //cerr << "Rotor: setting attribute '"<set_parameter(xml.getAttribute("parameter","name","",i5),xml.getAttribute("parameter","value","",i5)); //} //if (n5>0) cerr << "Rotor: found " << n5 << " extra parameters for node '" << nodeID << "'" << endl; + //support attributes in tags + n4=xml.getNumTags("attribute"); + for (int i4=0;i4attributes.find(attribute)!=nodes[nodeID]->attributes.end()) { + string val=xml.getAttribute("attribute","value","",i4); + if (val!="") nodes[nodeID]->attributes.find(attribute)->second->value=val; + string type=xml.getAttribute("attribute","type","",i4); + if (nodes[nodeID]->attributes.find(attribute)->second->type=="array"){ + if(xml.pushTag("attribute",i4)) { + int n5=xml.getNumTags("value"); + std::vector vals; + for (int i5=0;i5attributes.find(attribute)->second->init(vals); + xml.popTag(); + } + } + } + else cerr << "Rotor: cannot find attribute '" << attribute << "' of "<