void InputBinder::bind_scene_entity_inputs( const Scene& scene, const SymbolTable& scene_symbols, const char* entity_type, ConnectableEntity& entity) { const string entity_path = entity.get_path(); const ParamArray& entity_params = entity.get_parameters(); for (each<InputArray> i = entity.get_inputs(); i; ++i) { InputArray::iterator& input = *i; string param_value; if (entity_params.strings().exist(input.name())) { // A value is assigned to this input, retrieve it. param_value = entity_params.get<string>(input.name()); } else if (input.type() == InputTypeOptional) { // This input is optional, use its default value. param_value = input.default_value(); if (param_value.empty()) continue; } else { // This input is required but has no value, this is an error. RENDERER_LOG_ERROR( "while defining %s \"%s\": required parameter \"%s\" missing.", entity_type, entity_path.c_str(), input.name()); ++m_error_count; continue; } if (try_bind_scene_entity_to_input( scene, scene_symbols, entity_type, entity_path.c_str(), param_value.c_str(), input)) continue; if (try_bind_scalar_to_input(param_value, input)) continue; RENDERER_LOG_ERROR( "while defining %s \"%s\": cannot bind \"%s\" to parameter \"%s\".", entity_type, entity_path.c_str(), param_value.c_str(), input.name()); ++m_error_count; } }
void InputBinder::bind_assembly_entity_inputs( const Scene& scene, const SymbolTable& scene_symbols, const Assembly& assembly, const SymbolTable& assembly_symbols, const char* entity_type, const char* entity_name, const ParamArray& entity_params, InputArray& entity_inputs) { for (each<InputArray> i = entity_inputs; i; ++i) { InputArray::iterator& input = *i; // Retrieve the value assigned to this input in the parameter array. string param_value; try { param_value = entity_params.get<string>(input.name()); } catch (const ExceptionDictionaryItemNotFound&) { // Couldn't find an assignment to this input. if (!input.is_optional()) { RENDERER_LOG_ERROR( "while defining %s \"%s\": required parameter \"%s\" missing.", entity_type, entity_name, input.name()); ++m_error_count; } continue; } if (!try_bind_scalar_to_input(param_value, input)) { bind_assembly_entity_to_input( scene, scene_symbols, assembly, assembly_symbols, entity_type, entity_name, param_value.c_str(), input); } } }