Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
| Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (CollectionChild *, child, &collection->children) { | ||||
| instance.type = INSTANCE_DATA_TYPE_COLLECTION; | instance.type = INSTANCE_DATA_TYPE_COLLECTION; | ||||
| instance.data.collection = child_collection; | instance.data.collection = child_collection; | ||||
| possible_instances.append(instance); | possible_instances.append(instance); | ||||
| } | } | ||||
| if (!possible_instances.is_empty()) { | if (!possible_instances.is_empty()) { | ||||
| const int seed = params.get_input<int>("Seed"); | const int seed = params.get_input<int>("Seed"); | ||||
| Array<uint32_t> ids = get_geometry_element_ids_as_uints(component, ATTR_DOMAIN_POINT); | Array<uint32_t> ids = get_geometry_element_ids_as_uints(component, ATTR_DOMAIN_POINT); | ||||
| for (const int i : r_instances_data.index_range()) { | for (const int i : iter_indices(r_instances_data)) { | ||||
| const int index = BLI_hash_int_2d(ids[i], seed) % possible_instances.size(); | const int index = BLI_hash_int_2d(ids[i], seed) % possible_instances.size(); | ||||
| r_instances_data[i] = possible_instances[index]; | r_instances_data[i] = possible_instances[index]; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static Array<std::optional<InstancedData>> get_instanced_data(const GeoNodeExecParams ¶ms, | static Array<std::optional<InstancedData>> get_instanced_data(const GeoNodeExecParams ¶ms, | ||||
| ▲ Show 20 Lines • Show All 95 Lines • Show Last 20 Lines | |||||