本文整理汇总了C++中ParamArray::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamArray::get方法的具体用法?C++ ParamArray::get怎么用?C++ ParamArray::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamArray
的用法示例。
在下文中一共展示了ParamArray::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_cube
auto_release_ptr<MeshObject> create_primitive_mesh(const char* name, const ParamArray& params)
{
const char* primitive_type = params.get("primitive");
// Parametric surfaces.
if (strcmp(primitive_type, "grid") == 0)
return create_parametric_surface<ParametricGrid>(name, params);
if (strcmp(primitive_type, "disk") == 0)
return create_parametric_surface<ParametricDisk>(name, params);
if (strcmp(primitive_type, "sphere") == 0)
return create_parametric_surface<ParametricSphere>(name, params);
if (strcmp(primitive_type, "torus") == 0)
return create_parametric_surface<ParametricTorus>(name, params);
// Other, non-parametric primitives.
if (strcmp(primitive_type, "cube") == 0)
return create_cube(name, params);
RENDERER_LOG_ERROR("unknown primitive type: %s", primitive_type);
return auto_release_ptr<MeshObject>();
}
示例2: slot_import_disney
void MaterialCollectionItem::slot_import_disney()
{
#ifdef APPLESEED_WITH_DISNEY_MATERIAL
QString filepath =
get_open_filename(
0,
"Import...",
"Disney Material (*.dmt);;All Files (*.*)",
m_editor_context.m_settings,
SETTINGS_FILE_DIALOG_PROJECTS);
if (!filepath.isEmpty())
{
filepath = QDir::toNativeSeparators(filepath);
const bf::path root_path(Application::get_root_path());
const bf::path schema_file_path = root_path / "schemas" / "settings.xsd";
SettingsFileReader reader(global_logger());
ParamArray parameters;
const bool success =
reader.read(
filepath.toStdString().c_str(),
schema_file_path.string().c_str(),
parameters);
if (!success)
{
show_error_message_box(
"Importing Error",
"Failed to import the Disney Material file " + filepath.toStdString());
return;
}
string name = parameters.get("__name");
const string model = parameters.get("__model");
parameters.strings().remove("__name");
parameters.strings().remove("__model");
if (model != "disney_material")
{
show_error_message_box(
"Importing Error",
"Material model " + model + " is not supported.");
return;
}
// If there is already a material with the same name, rename the imported material.
for (const_each<MaterialContainer> i = m_parent.materials(); i; ++i)
{
if (strcmp(i->get_name(), name.c_str()) == 0)
{
name = make_unique_name(name, m_parent.materials());
break;
}
}
auto_release_ptr<Material> material =
DisneyMaterialFactory().create(name.c_str(), parameters);
Material* material_ptr = material.get();
add_item(material_ptr);
EntityTraits<Material>::insert_entity(material, m_parent);
m_editor_context.m_project_builder.notify_project_modification();
m_editor_context.m_project_explorer.select_entity(material_ptr->get_uid());
}
#endif
}