本文整理汇总了C++中nodes_t::size方法的典型用法代码示例。如果您正苦于以下问题:C++ nodes_t::size方法的具体用法?C++ nodes_t::size怎么用?C++ nodes_t::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nodes_t
的用法示例。
在下文中一共展示了nodes_t::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: modify_selected_meshes
void modify_selected_meshes(document_state& DocumentState, iplugin_factory* Modifier)
{
return_if_fail(Modifier);
idocument& document = DocumentState.document();
if (Modifier->implements(typeid(imulti_mesh_sink)))
{ // Mesh modifier taking multiple inputs
uint_t count = 0;
ipipeline::dependencies_t dependencies;
const nodes_t selected_nodes = selection::state(DocumentState.document()).selected_nodes();
// Create the node
inode* multi_sink = pipeline::create_node(document, *Modifier);
record_state_change_set changeset(document, string_cast(boost::format(_("Add Modifier %1%")) % Modifier->name()), K3D_CHANGE_SET_CONTEXT);
nodes_t nodes_to_delete;
for(nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node)
{
imesh_sink* const mesh_sink = dynamic_cast<imesh_sink*>(*node);
if(!mesh_sink)
continue;
imatrix_sink* const matrix_sink = dynamic_cast<imatrix_sink*>(*node);
iproperty* source_mesh = document.pipeline().dependency(mesh_sink->mesh_sink_input());
if (!source_mesh)
continue;
if (matrix_sink) // Insert a transform node
{
iproperty* const source_transformation = document.pipeline().dependency(matrix_sink->matrix_sink_input());
if (source_transformation)
{
inode* transform_points = plugin::create<inode>("TransformPoints", document, unique_name(document.nodes(), "TransformPoints"));
return_if_fail(transform_points);
imatrix_sink* transform_points_matrix_sink = dynamic_cast<imatrix_sink*>(transform_points);
return_if_fail(transform_points_matrix_sink);
imesh_sink* transform_points_mesh_sink = dynamic_cast<imesh_sink*>(transform_points);
return_if_fail(transform_points_mesh_sink);
dependencies.insert(std::make_pair(&transform_points_matrix_sink->matrix_sink_input(), source_transformation));
dependencies.insert(std::make_pair(&transform_points_mesh_sink->mesh_sink_input(), source_mesh));
imesh_source* transform_points_mesh_source = dynamic_cast<imesh_source*>(transform_points);
return_if_fail(transform_points_mesh_source);
source_mesh = &transform_points_mesh_source->mesh_source_output();
imesh_selection_sink* selection_sink = dynamic_cast<imesh_selection_sink*>(transform_points);
return_if_fail(selection_sink);
property::set_internal_value(selection_sink->mesh_selection_sink_input(), k3d::geometry::selection::create(1.0));
}
}
++count;
// Create a new user property
std::stringstream name, label;
name << "input_mesh" << count;
label << "Input Mesh " << count;
iproperty* sink = property::get(*multi_sink, name.str());
if (!sink)
sink = property::create<mesh*>(*multi_sink, name.str(), label.str(), "", static_cast<mesh*>(0));
// Store the connection
dependencies.insert(std::make_pair(sink, source_mesh));
// Delete the input node
nodes_to_delete.push_back(*node);
}
document.pipeline().set_dependencies(dependencies);
delete_nodes(document, nodes_to_delete);
// Give nodes a chance to initialize their property values based on their inputs, if any ...
if(ireset_properties* const reset_properties = dynamic_cast<ireset_properties*>(multi_sink))
reset_properties->reset_properties();
panel::mediator(DocumentState.document()).set_focus(*multi_sink);
}
else
{ // Normal mesh modifier
nodes_t new_modifiers;
const nodes_t selected_nodes = selection::state(DocumentState.document()).selected_nodes();
for(nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node)
{
new_modifiers.push_back(modify_mesh(DocumentState, **node, Modifier));
assert_warning(new_modifiers.back());
}
// Show the new modifier properties if only one was processed
if(selected_nodes.size() == 1)
{
panel::mediator(DocumentState.document()).set_focus(*new_modifiers.front());
}
else // otherwise connect all parameter properties to the first node and show that one
{
iproperty_collection* first_property_collection = dynamic_cast<iproperty_collection*>(new_modifiers.front());
if (first_property_collection)
{
// Get the in-and output property names, to exclude them from the connections
imesh_sink* const modifier_sink = dynamic_cast<imesh_sink*>(new_modifiers.front());
return_if_fail(modifier_sink);
imesh_source* const modifier_source = dynamic_cast<imesh_source*>(new_modifiers.front());
return_if_fail(modifier_source);
const std::string sink_name = modifier_sink->mesh_sink_input().property_name();
const std::string source_name = modifier_source->mesh_source_output().property_name();
ipipeline::dependencies_t dependencies;
const iproperty_collection::properties_t& first_properties = first_property_collection->properties();
nodes_t::iterator modifier = new_modifiers.begin();
++modifier;
for (modifier; modifier != new_modifiers.end(); ++modifier)
//.........这里部分代码省略.........