Exemple #1
0
config::TextItem JsonTools::parseTextItem(ci::JsonTree json)
{
	config::TextItem textItem;
	textItem.setText(json.getChild("text").getValue<std::string>());
	textItem.setFontName(json.getChild("font").getValue<std::string>());
	textItem.setSize(json.getChild("size").getValue<int>());
	textItem.setColor(json.getChild("color").getValue<std::string>());

	return textItem;
}
Exemple #2
0
void BSplineEditor::load( const ci::JsonTree &data )
{
	mControlPoints.clear();
	if( data.hasChild( "POINTS" ) ) {
		auto pts = data.getChild( "POINTS" );
		int total = pts.getNumChildren();
		if( (int)mControlPoints.size() < total ) {
			mControlPoints.resize( total );
		}
		for( int i = 0; i < total; i++ ) {
			auto child = pts.getChild( i );
			mControlPoints[i] = expand( vec2( child.getValueForKey<float>( "X" ), child.getValueForKey<float>( "Y" ) ) );
		}
		updateSplineRef();
		if( mTriggerOnLoad ) {
			trigger();
		}
	}
	View::load( data );
}
Model::Model(ci::JsonTree & data, std::string idKey) : raw(data) {
    uid = data.getChild(idKey).getValue<int>();
}
Model::Model(ci::JsonTree & data) : raw(data) {
    uid = data.getChild("id").getValue<int>();
}