Пример #1
0
void CompositorLoader::ParseRenderTargets(Compositor::Ptr& compositor, const json::Object& renderTargets)
{
	for (auto it = renderTargets.begin(); it != renderTargets.end(); ++it)
	{
		const Value& data = it->second;

		DataFormat dataFormat = JsonTypeHelper::ParseDataFormat(data);
		compositor->AddRenderTarget(it->first, dataFormat);

		if (data.HasKey("scale"))
		{
			compositor->SetRenderTargetScale(it->first, JsonTypeHelper::ParseFloatVector(data["scale"]).XY());
		}

		if (dataFormat.IsDepthFormat())
		{
			if (data.HasKey("clearDepth"))
			{
				compositor->SetClearDepth(it->first, data["clearDepth"].ToFloat(1.0f));
			}
		}
		else
		{
			if (data.HasKey("clearColor"))
			{
				compositor->SetClearColor(it->first, JsonTypeHelper::ParseColor(data["clearColor"]));
			}
		}
	}
}
Пример #2
0
SEXP create(const json::Object& value, Protect* pProtect)
{
   // create the list
   SEXP listSEXP ;
   pProtect->add(listSEXP = Rf_allocVector(VECSXP, value.size()));
   
   // build list of names
   SEXP namesSEXP ;
   pProtect->add(namesSEXP = Rf_allocVector(STRSXP, value.size()));
   
   // add each object field to it
   int index = 0;
   for (json::Object::const_iterator 
            it = value.begin();
            it != value.end();
            ++it)
   {
      // set name
      SET_STRING_ELT(namesSEXP, index, Rf_mkChar(it->first.c_str()));
      
      // set value
      SEXP valueSEXP = create(it->second, pProtect);
      SET_VECTOR_ELT(listSEXP, index,  valueSEXP);
      
      // increment element index
      index++;
   }
   
   // attach names
   Rf_setAttrib(listSEXP, R_NamesSymbol, namesSEXP);
   
   // return the list
   return listSEXP;
}
void PlotManipulatorManager::setPlotManipulatorValues(const json::Object& values)
{
   if (manipulatorIsActive())
   {
      // get the manipulator
      SEXP manipulatorSEXP = plotManager().activePlot().manipulatorSEXP();

      // set the underlying values
      std::for_each(values.begin(),
                    values.end(),
                    boost::bind(setManipulatorJsonValue, manipulatorSEXP, _1));

      // replay the manipulator
      replayManipulator(manipulatorSEXP);

      // set all of the buttons to false
      setManipulatorButtonsToFalse(manipulatorSEXP);
   }
   else
   {
      LOG_WARNING_MESSAGE("called setPlotManipulatorValues but active plot "
                          "has no manipulator");
   }
}