pub struct Geometry {
pub node: HoudiniNode,
/* private fields */
}Expand description
Represents a SOP node with methods for manipulating geometry.
Fields§
§node: HoudiniNodeImplementations§
Source§impl Geometry
impl Geometry
Sourcepub fn part_info(&self, part_id: i32) -> Result<PartInfo>
pub fn part_info(&self, part_id: i32) -> Result<PartInfo>
Get geometry partition info by index.
pub fn volume_info(&self, part_id: i32) -> Result<VolumeInfo>
pub fn set_volume_info(&self, part_id: i32, info: &VolumeInfo) -> Result<()>
pub fn volume_bounds(&self, part_id: i32) -> Result<VolumeBounds>
pub fn get_volume_visual_info(&self, part_id: i32) -> Result<VolumeVisualInfo>
Sourcepub fn geo_info(&self) -> Result<GeoInfo>
pub fn geo_info(&self) -> Result<GeoInfo>
Get information about Node’s geometry. Note: The node must be cooked before calling this method.
pub fn set_part_info(&self, info: &PartInfo) -> Result<()>
pub fn box_info(&self, part_id: i32) -> Result<BoxInfo>
pub fn sphere_info(&self, part_id: i32) -> Result<SphereInfo>
pub fn camera_info(&self, part_id: i32) -> Result<CameraInfo>
pub fn camera_transform(&self, part_id: i32) -> Result<Transform>
pub fn set_curve_info(&self, part_id: i32, info: &CurveInfo) -> Result<()>
pub fn set_input_curve_info( &self, part_id: i32, info: &InputCurveInfo, ) -> Result<()>
pub fn get_input_curve_info(&self, part_id: i32) -> Result<InputCurveInfo>
pub fn set_input_curve_positions( &self, part_id: i32, positions: &[f32], ) -> Result<()>
pub fn set_input_curve_transform( &self, part_id: i32, positions: &[f32], rotation: &[f32], scale: &[f32], ) -> Result<()>
pub fn set_curve_counts(&self, part_id: i32, count: &[i32]) -> Result<()>
pub fn set_curve_knots(&self, part_id: i32, knots: &[f32]) -> Result<()>
pub fn set_vertex_list( &self, part_id: i32, list: impl AsRef<[i32]>, ) -> Result<()>
pub fn set_face_counts( &self, part_id: i32, list: impl AsRef<[i32]>, ) -> Result<()>
pub fn update(&mut self) -> Result<()>
pub fn curve_info(&self, part_id: i32) -> Result<CurveInfo>
Sourcepub fn curve_counts(
&self,
part_id: i32,
start: i32,
length: i32,
) -> Result<Vec<i32>>
pub fn curve_counts( &self, part_id: i32, start: i32, length: i32, ) -> Result<Vec<i32>>
Retrieve the number of vertices for each curve in the part.
Sourcepub fn curve_orders(
&self,
part_id: i32,
start: i32,
length: i32,
) -> Result<Vec<i32>>
pub fn curve_orders( &self, part_id: i32, start: i32, length: i32, ) -> Result<Vec<i32>>
Retrieve the orders for each curve in the part if the curve has varying order.
Sourcepub fn curve_knots(
&self,
part_id: i32,
start: i32,
length: i32,
) -> Result<Vec<f32>>
pub fn curve_knots( &self, part_id: i32, start: i32, length: i32, ) -> Result<Vec<f32>>
Retrieve the knots of the curves in this part.
Sourcepub fn vertex_list(&self, part: &PartInfo) -> Result<Vec<i32>>
pub fn vertex_list(&self, part: &PartInfo) -> Result<Vec<i32>>
Get array containing the vertex-point associations where the ith element in the array is the point index the ith vertex associates with.
pub fn partitions(&self) -> Result<Vec<PartInfo>>
pub fn get_face_counts(&self, part: &PartInfo) -> Result<Vec<i32>>
Sourcepub fn get_materials(&self, part: &PartInfo) -> Result<Option<Materials>>
pub fn get_materials(&self, part: &PartInfo) -> Result<Option<Materials>>
Return material nodes applied to geometry.
Sourcepub fn get_group_names(&self, group_type: GroupType) -> Result<StringArray>
pub fn get_group_names(&self, group_type: GroupType) -> Result<StringArray>
Get geometry group names by type.
pub fn get_edge_count_of_edge_group( &self, group: &str, part_id: i32, ) -> Result<i32>
Sourcepub fn get_element_count_by_owner(
&self,
part: &PartInfo,
owner: AttributeOwner,
) -> Result<i32>
pub fn get_element_count_by_owner( &self, part: &PartInfo, owner: AttributeOwner, ) -> Result<i32>
Get num geometry elements by type (points, prims, vertices).
Sourcepub fn get_attribute_count_by_owner(
&self,
part: &PartInfo,
owner: AttributeOwner,
) -> Result<i32>
pub fn get_attribute_count_by_owner( &self, part: &PartInfo, owner: AttributeOwner, ) -> Result<i32>
Get number of attributes by type.
pub fn get_attribute_names( &self, owner: AttributeOwner, part: &PartInfo, ) -> Result<StringArray>
Sourcepub fn get_attribute_info(
&self,
part_id: i32,
owner: AttributeOwner,
name: impl TryInto<AttributeName, Error = impl Into<HapiError>>,
) -> Result<AttributeInfo>
pub fn get_attribute_info( &self, part_id: i32, owner: AttributeOwner, name: impl TryInto<AttributeName, Error = impl Into<HapiError>>, ) -> Result<AttributeInfo>
Retrieve information about a geometry attribute.
Sourcepub fn get_attribute<T>(
&self,
part_id: i32,
owner: AttributeOwner,
name: T,
) -> Result<Option<AnyAttribute>>
pub fn get_attribute<T>( &self, part_id: i32, owner: AttributeOwner, name: T, ) -> Result<Option<AnyAttribute>>
Gets an attribute by part, owner, and name without assuming its storage.
Returns Ok(None) when the attribute does not exist. Otherwise the
returned AnyAttribute variant contains a typed handle bound to the
requested part. Invalid or unsupported HAPI storage is reported as an
error.
Sourcepub fn find_attribute<T>(
&self,
part_id: i32,
name: T,
) -> Result<Option<AnyAttribute>>
pub fn find_attribute<T>( &self, part_id: i32, name: T, ) -> Result<Option<AnyAttribute>>
Finds an attribute by name without assuming its owner.
Returns an error instead of choosing arbitrarily when the name exists on more than one concrete owner.
Sourcepub fn get_numeric_attribute<T: NumericPrimitive, S: AttributeShape>(
&self,
part_id: i32,
owner: AttributeOwner,
name: impl TryInto<AttributeName, Error = impl Into<HapiError>>,
) -> Result<Option<Attribute<T, S>>>
pub fn get_numeric_attribute<T: NumericPrimitive, S: AttributeShape>( &self, part_id: i32, owner: AttributeOwner, name: impl TryInto<AttributeName, Error = impl Into<HapiError>>, ) -> Result<Option<Attribute<T, S>>>
Gets a numeric attribute when its primitive type and shape match T and S.
Returns Ok(None) when the attribute does not exist and an error when
it exists with different storage. The returned handle is bound to
part_id; whole-attribute and fixed-range operations use cached metadata.
Sourcepub fn get_string_attribute<S: AttributeShape>(
&self,
part_id: i32,
owner: AttributeOwner,
name: impl TryInto<AttributeName, Error = impl Into<HapiError>>,
) -> Result<Option<StringAttribute<S>>>
pub fn get_string_attribute<S: AttributeShape>( &self, part_id: i32, owner: AttributeOwner, name: impl TryInto<AttributeName, Error = impl Into<HapiError>>, ) -> Result<Option<StringAttribute<S>>>
Gets a string attribute with the requested fixed or jagged shape.
Returns Ok(None) when the attribute does not exist and an error when
its storage does not match S.
Sourcepub fn get_dictionary_attribute<S: AttributeShape>(
&self,
part_id: i32,
owner: AttributeOwner,
name: impl TryInto<AttributeName, Error = impl Into<HapiError>>,
) -> Result<Option<DictionaryAttribute<S>>>
pub fn get_dictionary_attribute<S: AttributeShape>( &self, part_id: i32, owner: AttributeOwner, name: impl TryInto<AttributeName, Error = impl Into<HapiError>>, ) -> Result<Option<DictionaryAttribute<S>>>
Gets a dictionary attribute with the requested fixed or jagged shape.
Returns Ok(None) when the attribute does not exist and an error when
its storage does not match S.
Sourcepub fn add_numeric_attribute<T: NumericPrimitive, S: AttributeShape>(
&self,
name: &str,
part_id: i32,
info: AttributeInfo,
) -> Result<Attribute<T, S>>
pub fn add_numeric_attribute<T: NumericPrimitive, S: AttributeShape>( &self, name: &str, part_id: i32, info: AttributeInfo, ) -> Result<Attribute<T, S>>
Adds a numeric attribute whose storage is derived from T and S.
The storage field supplied in info is ignored and replaced. The
tuple size must be positive. The returned handle is bound to part_id.
Sourcepub fn add_string_attribute(
&self,
name: &str,
part_id: i32,
info: AttributeInfo,
) -> Result<StringAttribute<Fixed>>
pub fn add_string_attribute( &self, name: &str, part_id: i32, info: AttributeInfo, ) -> Result<StringAttribute<Fixed>>
Adds a fixed-tuple string attribute.
info must specify StorageType::String and a positive tuple size.
Sourcepub fn add_string_array_attribute(
&self,
name: &str,
part_id: i32,
info: AttributeInfo,
) -> Result<StringAttribute<Jagged>>
pub fn add_string_array_attribute( &self, name: &str, part_id: i32, info: AttributeInfo, ) -> Result<StringAttribute<Jagged>>
Adds a jagged string array attribute.
info must specify StorageType::StringArray and a positive tuple size.
Sourcepub fn add_dictionary_attribute(
&self,
name: &str,
part_id: i32,
info: AttributeInfo,
) -> Result<DictionaryAttribute<Fixed>>
pub fn add_dictionary_attribute( &self, name: &str, part_id: i32, info: AttributeInfo, ) -> Result<DictionaryAttribute<Fixed>>
Adds a fixed-tuple JSON dictionary attribute.
info must specify StorageType::Dictionary and a positive tuple size.
Sourcepub fn add_dictionary_array_attribute(
&self,
name: &str,
part_id: i32,
info: AttributeInfo,
) -> Result<DictionaryAttribute<Jagged>>
pub fn add_dictionary_array_attribute( &self, name: &str, part_id: i32, info: AttributeInfo, ) -> Result<DictionaryAttribute<Jagged>>
Adds a jagged JSON dictionary array attribute.
info must specify StorageType::DictionaryArray and a positive tuple size.
Sourcepub fn add_group(
&self,
part_id: i32,
group_type: GroupType,
group_name: &str,
membership: Option<&[i32]>,
) -> Result<()>
pub fn add_group( &self, part_id: i32, group_type: GroupType, group_name: &str, membership: Option<&[i32]>, ) -> Result<()>
Create a new geometry group.
Sourcepub fn delete_group(
&self,
part_id: i32,
group_type: GroupType,
group_name: &str,
) -> Result<()>
pub fn delete_group( &self, part_id: i32, group_type: GroupType, group_name: &str, ) -> Result<()>
Delete a geometry group.
Sourcepub fn set_group_membership(
&self,
part_id: i32,
group_type: GroupType,
group_name: &str,
array: &[i32],
) -> Result<()>
pub fn set_group_membership( &self, part_id: i32, group_type: GroupType, group_name: &str, array: &[i32], ) -> Result<()>
Set element membership for a group.
Sourcepub fn get_group_membership(
&self,
part: &PartInfo,
group_type: GroupType,
group_name: &str,
) -> Result<Vec<i32>>
pub fn get_group_membership( &self, part: &PartInfo, group_type: GroupType, group_name: &str, ) -> Result<Vec<i32>>
Get element membership for a group.
Sourcepub fn group_count_by_type(&self, group_type: GroupType) -> Result<i32>
pub fn group_count_by_type(&self, group_type: GroupType) -> Result<i32>
Number of geometry groups by type.
pub fn get_instanced_part_ids(&self, part: &PartInfo) -> Result<Vec<i32>>
Sourcepub fn get_group_membership_on_packed_instance_part(
&self,
part: &PartInfo,
group_type: GroupType,
group_name: &CStr,
) -> Result<(bool, Vec<i32>)>
pub fn get_group_membership_on_packed_instance_part( &self, part: &PartInfo, group_type: GroupType, group_name: &CStr, ) -> Result<(bool, Vec<i32>)>
Get group membership for a packed instance part. This functions allows you to get the group membership for a specific packed primitive part.
pub fn get_group_count_on_packed_instance( &self, part: &PartInfo, ) -> Result<(i32, i32)>
pub fn get_instance_part_groups_names( &self, group: GroupType, part_id: i32, ) -> Result<StringArray>
pub fn get_instance_part_transforms( &self, part: &PartInfo, order: RSTOrder, ) -> Result<Vec<Transform>>
Sourcepub fn save_to_file(&self, filepath: &str) -> Result<()>
pub fn save_to_file(&self, filepath: &str) -> Result<()>
Save geometry to a file.
Sourcepub fn load_from_file(&self, filepath: &str) -> Result<()>
pub fn load_from_file(&self, filepath: &str) -> Result<()>
Load geometry from a file.
Sourcepub fn commit(&self) -> Result<()>
pub fn commit(&self) -> Result<()>
Commits accumulated geometry edits to the node.
Topology and attribute setters never commit implicitly. Batch related edits and call this once before cooking or consuming an input node. Reacquire or refresh attribute handles after a later cook that may change their cached metadata or part layout.
Sourcepub fn save_to_memory(&self, format: GeoFormat) -> Result<Vec<i8>>
pub fn save_to_memory(&self, format: GeoFormat) -> Result<Vec<i8>>
Serialize node’s geometry to bytes.
Sourcepub fn load_from_memory(&self, data: &[i8], format: GeoFormat) -> Result<()>
pub fn load_from_memory(&self, data: &[i8], format: GeoFormat) -> Result<()>
Load geometry from a given buffer into this node.
pub fn read_volume_tile<T: VolumeStorage>( &self, part: i32, fill: T, tile: &VolumeTileInfo, values: &mut [T], ) -> Result<()>
pub fn write_volume_tile<T: VolumeStorage>( &self, part: i32, tile: &VolumeTileInfo, values: &[T], ) -> Result<()>
pub fn read_volume_voxel<T: VolumeStorage>( &self, part: i32, x_index: i32, y_index: i32, z_index: i32, values: &mut [T], ) -> Result<()>
pub fn write_volume_voxel<T: VolumeStorage>( &self, part: i32, x_index: i32, y_index: i32, z_index: i32, values: &[T], ) -> Result<()>
Sourcepub fn foreach_volume_tile(
&self,
part: i32,
info: &VolumeInfo,
callback: impl Fn(Tile<'_>),
) -> Result<()>
pub fn foreach_volume_tile( &self, part: i32, info: &VolumeInfo, callback: impl Fn(Tile<'_>), ) -> Result<()>
Iterate over volume tiles and apply a function to each tile.