1use super::raw::*;
2use crate::{
3 errors::Result,
4 node::{HoudiniNode, NodeHandle},
5 parameter::ParmHandle,
6 pdg::WorkItemId,
7 session::Session,
8 stringhandle::StringHandle,
9};
10use debug_ignore::DebugIgnore;
11use paste::paste;
12use std::ffi::{CStr, CString};
13
14macro_rules! get {
15
16 ($method:ident->$field:ident->bool) => {
17 #[inline]
18 pub fn $method(&self) -> bool {
19 self.0.$field == 1
20 }
21 };
22
23 ($method:ident->$field:ident->[handle: $hdl:ident]) => {
25 #[inline]
26 pub fn $method(&self) -> $hdl {
27 $hdl(self.0.$field)
28 }
29 };
30
31 ($self_:ident, $method:ident->$block:block->$tp:ty) => {
32 #[inline]
33 pub fn $method(&$self_) -> $tp {
34 $block
35 }
36 };
37
38 ($method:ident->$field:ident->Result<String>) => {
39 #[inline]
40 pub fn $method(&self) -> Result<String> {
41 use crate::stringhandle::StringHandle;
42 crate::stringhandle::get_string(StringHandle(self.0.$field), &self.1)
43 }
44 };
45
46 (with_session $method:ident->$field:ident->Result<String>) => {
47 #[inline]
48 pub fn $method(&self, session: &Session) -> Result<String> {
49 use crate::stringhandle::StringHandle;
50 crate::stringhandle::get_string(StringHandle(self.0.$field), session)
51 }
52 };
53
54 ($method:ident->$field:ident->Result<CString>) => {
55 #[inline]
56 pub fn $method(&self) -> Result<CString> {
57 use crate::stringhandle::StringHandle;
58 crate::stringhandle::get_cstring(StringHandle(self.0.$field), &self.1)
59 }
60 };
61
62 ($method:ident->$field:ident->$tp:ty) => {
63 #[inline]
64 pub fn $method(&self) -> $tp {
65 self.0.$field
66 }
67 };
68
69 ($method:ident->$field:ident->[$($tp:tt)*]) => {
70 get!($method->$field->[$($tp)*]);
71 };
72}
73macro_rules! wrap {
92 (_with_ $method:ident->$field:ident->bool) => {
93 paste!{
94 pub fn [<with_ $method>](mut self, val: bool) -> Self {self.0.$field = val as i8; self}
95 }
96 };
97 (_with_ $method:ident->$field:ident->$tp:ty) => {
98 paste!{
99 pub fn [<with_ $method>](mut self, val: $tp) -> Self {self.0.$field = val; self}
100 }
101 };
102 (_set_ $method:ident->$field:ident->bool) => {
103 paste!{
104 pub fn [<set_ $method>](&mut self, val: bool) {self.0.$field = val as i8}
105 }
106 };
107 (_set_ $method:ident->$field:ident->$tp:ty) => {
108 paste!{
109 pub fn [<set_ $method>](&mut self, val: $tp) {self.0.$field = val}
110 }
111 };
112
113 ([get] $object:ident $method:ident->$field:ident->$($tp:tt)*) => {
115 get!($method->$field->$($tp)*);
116 };
117
118 ([get+session] $object:ident $method:ident->$field:ident->$($tp:tt)*) => {
119 get!(with_session $method->$field->$($tp)*);
120 };
121
122 ([set] $object:ident $method:ident->$field:ident->$($tp:tt)*) => {
123 $(wrap!{_set_ $method->$field->$tp})*
124 };
125
126 ([with] $object:ident $method:ident->$field:ident->$($tp:tt)*) => {
127 $(wrap!{_with_ $method->$field->$tp})*
128 };
129
130 ([get|set] $object:ident $method:ident->$field:ident->$($tp:tt)*) => {
131 get!($method->$field->$($tp)*);
132 $(wrap!{_set_ $method->$field->$tp})*
133 };
134 ([get|set|with] $object:ident $method:ident->$field:ident->$($tp:tt)*) => {
135 get!($method->$field->$($tp)*);
136 $(wrap!{_set_ $method->$field->$tp})*
137 $(wrap!{_with_ $method->$field->$tp})*
138 };
139
140 (Default $object:ident [$create_func:path=>$ffi_tp:ty]; $($rest:tt)*) => {
141 impl Default for $object {
142 fn default() -> Self {
143 #[allow(unused_unsafe)]
144 Self(unsafe { $create_func() })
145 }
146 }
147 wrap!{_impl_methods_ $object $ffi_tp $($rest)*}
148 };
149
150 (impl $object:ident=>$ffi_tp:ty; $($rest:tt)*) => {
151 wrap!{_impl_methods_ $object $ffi_tp $($rest)*}
152 };
153
154
155 (_impl_methods_ $object:ident $ffi_tp:ty
156 $([$($access:tt)*] $method:ident->$field:ident->[$($tp:tt)*]);* $(;)?
157 ) => {
158 impl $object {
159 $(wrap!([$($access)*] $object $method->$field->$($tp)*);)*
160
161 #[inline]
162 pub fn ptr(&self) -> *const $ffi_tp {
163 &self.0 as *const _
164 }
165 }
166 };
167}
168
169#[derive(Clone, Debug)]
171pub struct SessionInfo(pub(crate) HAPI_SessionInfo);
172
173wrap! {
174 Default SessionInfo [HAPI_SessionInfo_Create => HAPI_SessionInfo];
175 [get|set|with] connection_count->connectionCount->[i32];
176 [get|set|with] port_type->portType->[TcpPortType];
177 [get] min_port->minPort->[i32];
178 [get] max_port->maxPort->[i32];
179 [get] ports->ports->[[i32;128usize]];
180 [get|set|with] shared_memory_buffer_type->sharedMemoryBufferType->[ThriftSharedMemoryBufferType];
181 [get|set|with] shared_memory_buffer_size->sharedMemoryBufferSize->[i64];
182}
183
184#[derive(Clone)]
186pub struct ThriftServerOptions(pub(crate) HAPI_ThriftServerOptions);
187
188wrap! {
189 Default ThriftServerOptions [HAPI_ThriftServerOptions_Create => HAPI_ThriftServerOptions];
190 [get|set|with] auto_close->autoClose->[bool];
191 [get|set|with] timeout_ms->timeoutMs->[f32];
192 [get|set|with] verbosity->verbosity->[StatusVerbosity];
193 [get|set|with] shared_memory_buffer_type->sharedMemoryBufferType->[ThriftSharedMemoryBufferType];
194 [get|set|with] shared_memory_buffer_size->sharedMemoryBufferSize->[i64];
195}
196
197#[derive(Clone)]
198pub struct CompositorOptions(pub(crate) HAPI_CompositorOptions);
199
200wrap! {
201 Default CompositorOptions [HAPI_CompositorOptions_Create => HAPI_CompositorOptions];
202 [get|set] max_resolution_x->maximumResolutionX->[i32];
203 [get|set] max_resolution_y->maximumResolutionY->[i32];
204}
205
206#[derive(Clone)]
208pub struct ParmChoiceInfo(pub(crate) HAPI_ParmChoiceInfo, pub(crate) Session);
209
210impl std::fmt::Debug for ParmChoiceInfo {
211 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
212 use std::borrow::Cow;
213
214 let get_str = |h: i32| -> Cow<str> {
215 match crate::stringhandle::get_string_bytes(StringHandle(h), &self.1) {
216 Ok(bytes) => unsafe { Cow::Owned(String::from_utf8_unchecked(bytes)) },
218 Err(_) => Cow::Borrowed("!!! Could not retrieve string"),
219 }
220 };
221
222 f.debug_struct("ParmChoiceInfo")
223 .field("label", &get_str(self.0.labelSH))
224 .field("value", &get_str(self.0.valueSH))
225 .finish()
226 }
227}
228
229impl ParmChoiceInfo {
230 get!(value->valueSH->Result<String>);
231 get!(label->labelSH->Result<String>);
232}
233
234#[derive(Debug)]
236pub struct ParmInfo(
237 pub(crate) HAPI_ParmInfo,
238 pub(crate) DebugIgnore<Session>,
239 pub(crate) Option<CString>,
240);
241
242impl ParmInfo {
243 pub(crate) fn new(inner: HAPI_ParmInfo, session: Session, name: Option<CString>) -> Self {
244 Self(inner, DebugIgnore(session), name)
245 }
246}
247
248impl ParmInfo {
249 get!(id->id->[handle: ParmHandle]);
250 get!(parent_id->parentId->[handle: ParmHandle]);
251 get!(child_index->childIndex->i32);
252 get!(parm_type->type_->ParmType);
253 get!(script_type->scriptType->PrmScriptType);
254 get!(permissions->permissions->Permissions);
255 get!(tag_count->tagCount->i32);
256 get!(size->size->i32);
257 get!(choice_count->choiceCount->i32);
258 get!(choice_list_type->choiceListType->ChoiceListType);
259 get!(has_min->hasMin->bool);
260 get!(has_max->hasMax->bool);
261 get!(has_uimin->hasUIMin->bool);
262 get!(has_uimax->hasUIMax->bool);
263 get!(min->min->f32);
264 get!(max->max->f32);
265 get!(uimin->UIMin->f32);
266 get!(uimax->UIMax->f32);
267 get!(invisible->invisible->bool);
268 get!(disabled->disabled->bool);
269 get!(spare->spare->bool);
270 get!(join_next->joinNext->bool);
271 get!(label_none->labelNone->bool);
272 get!(int_values_index->intValuesIndex->i32);
273 get!(float_values_index->floatValuesIndex->i32);
274 get!(string_values_index->stringValuesIndex->i32);
275 get!(choice_index->choiceIndex->i32);
276 get!(input_node_type->inputNodeType->NodeType);
277 get!(input_node_flag->inputNodeFlag->NodeFlags);
278 get!(is_child_of_multi_parm->isChildOfMultiParm->bool);
279 get!(instance_num->instanceNum->i32);
280 get!(instance_length->instanceLength->i32);
281 get!(instance_count->instanceCount->i32);
282 get!(instance_start_offset->instanceStartOffset->i32);
283 get!(ramp_type->rampType->RampType);
284 get!(type_info->typeInfoSH->Result<String>);
285 get!(name->nameSH->Result<String>);
286 get!(name_cstr->nameSH->Result<CString>);
287 get!(label->labelSH->Result<String>);
288 get!(template_name->templateNameSH->Result<String>);
289 get!(help->helpSH->Result<String>);
290 get!(visibility_condition->visibilityConditionSH->Result<String>);
291 get!(disabled_condition->disabledConditionSH->Result<String>);
292}
293
294pub struct NodeInfo(pub(crate) HAPI_NodeInfo, pub(crate) DebugIgnore<Session>);
297
298impl NodeInfo {
299 get!(name->nameSH->Result<String>);
300 get!(internal_path->internalNodePathSH->Result<String>);
301 get!(node_type->type_->NodeType);
302 get!(is_valid->isValid->bool);
303 get!(unique_node_id->uniqueHoudiniNodeId->i32);
304 get!(total_cook_count->totalCookCount->i32);
305 get!(child_node_count->childNodeCount->i32);
306 get!(parm_count->parmCount->i32);
307 get!(input_count->inputCount->i32);
308 get!(output_count->outputCount->i32);
309 get!(is_time_dependent->isTimeDependent->bool);
310 get!(created_post_asset_load->createdPostAssetLoad->bool);
311 get!(parm_int_value_count->parmIntValueCount->i32);
312 get!(parm_float_value_count->parmFloatValueCount->i32);
313 get!(parm_string_value_count->parmStringValueCount->i32);
314 get!(parm_choice_count->parmChoiceCount->i32);
315 get!(node_handle->id->[handle: NodeHandle]);
316 get!(parent_id->parentId->[handle: NodeHandle]);
317
318 pub(crate) fn new(session: &Session, node: NodeHandle) -> Result<Self> {
319 let session = session.clone();
320 let inner = crate::ffi::get_node_info(node, &session)?;
321 Ok(Self(inner, DebugIgnore(session)))
322 }
323}
324
325impl std::fmt::Debug for NodeInfo {
326 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
327 let err = "Error in Debug impl";
328 f.debug_struct("NodeInfo")
329 .field("name", &self.name().as_deref().unwrap_or(err))
330 .field(
331 "internal_path",
332 &self.internal_path().as_deref().unwrap_or(err),
333 )
334 .field("type", &self.node_type())
335 .field("is_valid", &self.is_valid())
336 .field("time_dependent", &self.is_time_dependent())
337 .field("total_cook_count", &self.total_cook_count())
338 .field("parm_count", &self.parm_count())
339 .field("child_count", &self.child_node_count())
340 .field("input_count", &self.input_count())
341 .field("output_count", &self.output_count())
342 .finish()
343 }
344}
345
346#[derive(Debug, Clone)]
348pub struct CookOptions(pub(crate) HAPI_CookOptions);
349
350wrap!(
351 Default CookOptions [HAPI_CookOptions_Create => HAPI_CookOptions];
352 [get|set|with] split_geo_by_group->splitGeosByGroup->[bool];
353 [get|set|with] split_geos_by_attribute->splitGeosByAttribute->[bool];
354 [get|set|with] max_vertices_per_primitive->maxVerticesPerPrimitive->[i32];
355 [get|set|with] refine_curve_to_linear->refineCurveToLinear->[bool];
356 [get|set|with] curve_refine_lod->curveRefineLOD->[f32];
357 [get|set|with] clear_errors_and_warnings->clearErrorsAndWarnings->[bool];
358 [get|set|with] cook_templated_geos->cookTemplatedGeos->[bool];
359 [get|set|with] split_points_by_vertex_attributes->splitPointsByVertexAttributes->[bool];
360 [get|set|with] handle_box_part_types->handleBoxPartTypes->[bool];
361 [get|set|with] handle_sphere_part_types->handleSpherePartTypes->[bool];
362 [get|set|with] check_part_changes->checkPartChanges->[bool];
363 [get|set|with] cache_mesh_topology->cacheMeshTopology->[bool];
364 [get|set|with] prefer_output_nodes->preferOutputNodes->[bool];
365 [get|set|with] packed_prim_instancing_mode->packedPrimInstancingMode->[PackedPrimInstancingMode];
366 [get+session] split_attr->splitAttrSH->[Result<String>];
367);
368
369#[derive(Debug, Clone)]
370pub struct AttributeInfo(pub(crate) HAPI_AttributeInfo);
371
372impl Default for AttributeInfo {
373 fn default() -> Self {
374 let mut inner = unsafe { HAPI_AttributeInfo_Create() };
375 inner.totalArrayElements = 0;
377 Self(inner)
378 }
379}
380wrap! {
381 _impl_methods_ AttributeInfo HAPI_AttributeInfo[get]exists->exists->[bool];
382 [get]original_owner->originalOwner->[AttributeOwner];
383 [get|set|with]total_array_elements->totalArrayElements->[i64];
384 [get|set|with]owner->owner->[AttributeOwner];
385 [get|set|with]storage->storage->[StorageType];
386 [get|set|with]tuple_size->tupleSize->[i32];
387 [get|set|with]type_info->typeInfo->[AttributeTypeInfo];
388 [get|set|with]count->count->[i32];
389}
390
391impl AttributeInfo {
392 pub(crate) fn new(
393 node: &HoudiniNode,
394 part_id: i32,
395 owner: AttributeOwner,
396 name: &CStr,
397 ) -> Result<Self> {
398 Ok(Self(crate::ffi::get_attribute_info(
399 node, part_id, owner, name,
400 )?))
401 }
402}
403
404#[derive(Debug)]
406pub struct AssetInfo(pub(crate) HAPI_AssetInfo, pub DebugIgnore<Session>);
407
408impl AssetInfo {
409 get!(node_id->nodeId->[handle: NodeHandle]);
410 get!(object_node_id->objectNodeId->[handle: NodeHandle]);
411 get!(has_ever_cooked->hasEverCooked->bool);
412 get!(have_objects_changed->haveObjectsChanged->bool);
413 get!(have_materials_changed->haveMaterialsChanged->bool);
414 get!(object_count->objectCount->i32);
415 get!(handle_count->handleCount->i32);
416 get!(transform_input_count->transformInputCount->i32);
417 get!(geo_input_count->geoInputCount->i32);
418 get!(geo_output_count->geoOutputCount->i32);
419 get!(name->nameSH->Result<String>);
420 get!(label->labelSH->Result<String>);
421 get!(file_path->filePathSH->Result<String>);
422 get!(version->versionSH->Result<String>);
423 get!(full_op_name->fullOpNameSH->Result<String>);
424 get!(help_text->helpTextSH->Result<String>);
425 get!(help_url->helpURLSH->Result<String>);
426}
427
428#[derive(Debug)]
430pub struct ObjectInfo<'session>(
431 pub(crate) HAPI_ObjectInfo,
432 pub DebugIgnore<&'session Session>,
433);
434
435impl ObjectInfo<'_> {
436 get!(name->nameSH->Result<String>);
437 get!(object_instance_path->objectInstancePathSH->Result<String>);
438 get!(has_transform_changed->hasTransformChanged->bool);
439 get!(have_geos_changed->haveGeosChanged->bool);
440 get!(is_visible->isVisible->bool);
441 get!(is_instancer->isInstancer->bool);
442 get!(is_instanced->isInstanced->bool);
443 get!(geo_count->geoCount->bool);
444 get!(node_id->nodeId->[handle: NodeHandle]);
445 get!(object_to_instance_id->objectToInstanceId->[handle: NodeHandle]);
446 pub fn to_node(&self) -> Result<HoudiniNode> {
447 self.node_id().to_node(&self.1)
448 }
449}
450
451#[derive(Debug, Clone)]
452pub struct GeoInfo(pub(crate) HAPI_GeoInfo);
454
455impl<'s> GeoInfo {
456 get!(geo_type->type_->GeoType);
457 get!(with_session name->nameSH->Result<String>);
458 get!(node_id->nodeId->[handle: NodeHandle]);
459 get!(is_editable->isEditable->bool);
460 get!(is_templated->isTemplated->bool);
461 get!(is_display_geo->isDisplayGeo->bool);
462 get!(has_geo_changed->hasGeoChanged->bool);
463 get!(has_material_changed->hasMaterialChanged->bool);
464 get!(edge_group_count->edgeGroupCount->i32);
465 get!(point_group_count->pointGroupCount->i32);
466 get!(primitive_group_count->primitiveGroupCount->i32);
467 get!(part_count->partCount->i32);
468
469 pub fn from_node(node: &'s HoudiniNode) -> Result<Self> {
470 GeoInfo::from_handle(node.handle, &node.session)
471 }
472 pub fn from_handle(handle: NodeHandle, session: &'s Session) -> Result<GeoInfo> {
473 crate::ffi::get_geo_info(session, handle).map(GeoInfo)
474 }
475}
476
477#[derive(Debug)]
478pub struct PartInfo(pub(crate) HAPI_PartInfo);
479
480wrap!(
481 Default PartInfo [HAPI_PartInfo_Create => HAPI_PartInfo];
482 [get] part_id->id->[i32];
483 [get] attribute_counts->attributeCounts->[[i32; 4]];
484 [get] has_changed->hasChanged->[bool];
485 [get] is_instanced->isInstanced->[bool];
486 [get+session] name->nameSH->[Result<String>];
487 [get|set|with] part_type->type_->[PartType];
488 [get|set|with] face_count->faceCount->[i32];
489 [get|set|with] point_count->pointCount->[i32];
490 [get|set|with] vertex_count->vertexCount->[i32];
491 [get|set|with] instance_count->instanceCount->[i32];
492 [get|set|with] instanced_part_count->instancedPartCount->[i32];
493);
494
495#[derive(Debug, Clone)]
496pub struct TimelineOptions(pub(crate) HAPI_TimelineOptions);
497
498wrap!(
499 Default TimelineOptions [HAPI_TimelineOptions_Create => HAPI_TimelineOptions];
500 [get|set|with] fps->fps->[f32];
501 [get|set|with] start_time->startTime->[f32];
502 [get|set|with] end_time->endTime->[f32];
503);
504
505#[derive(Debug, Clone)]
506pub struct CurveInfo(pub(crate) HAPI_CurveInfo);
507
508wrap!(
509 Default CurveInfo [HAPI_CurveInfo_Create => HAPI_CurveInfo];
510 [get|set|with] curve_type->curveType->[CurveType];
511 [get|set|with] curve_count->curveCount->[i32];
512 [get|set|with] vertex_count->vertexCount->[i32];
513 [get|set|with] knot_count->knotCount->[i32];
514 [get|set|with] periodic->isPeriodic->[bool];
515 [get|set|with] rational->isRational->[bool];
516 [get|set|with] closed->isClosed->[bool];
517 [get|set|with] has_knots->hasKnots->[bool];
518 [get|set|with] order->order->[i32];
519);
520
521#[derive(Debug, Clone)]
522pub struct Viewport(pub(crate) HAPI_Viewport);
523
524wrap!(
525 Default Viewport [HAPI_Viewport_Create => HAPI_Viewport];
526 [get|set|with] position->position->[[f32; 3]];
527 [get|set|with] rotation->rotationQuaternion->[[f32; 4]];
528 [get|set|with] offset->offset->[f32];
529);
530
531#[derive(Debug, Clone)]
532pub struct Transform(pub(crate) HAPI_Transform);
534
535wrap!(
536 Default Transform [HAPI_Transform_Create => HAPI_Transform];
537 [get|set|with] position->position->[[f32;3]];
538 [get|set|with] rotation->rotationQuaternion->[[f32;4]];
539 [get|set|with] scale->scale->[[f32;3]];
540 [get|set|with] shear->shear->[[f32;3]];
541 [get|set|with] rst_order->rstOrder->[RSTOrder];
542);
543
544impl Transform {
545 pub fn from_matrix(session: &Session, matrix: &[f32; 16], rst_order: RSTOrder) -> Result<Self> {
546 crate::ffi::convert_matrix_to_quat(session, matrix, rst_order).map(Transform)
547 }
548
549 pub fn convert_to_matrix(&self, session: &Session) -> Result<[f32; 16]> {
550 crate::ffi::convert_transform_quat_to_matrix(session, &self.0)
551 }
552}
553
554#[derive(Debug, Clone)]
555pub struct TransformEuler(pub(crate) HAPI_TransformEuler);
557
558wrap!(
559 Default TransformEuler [HAPI_TransformEuler_Create => HAPI_TransformEuler];
560 [get|set|with] position->position->[[f32;3]];
561 [get|set|with] rotation->rotationEuler->[[f32;3]];
562 [get|set|with] scale->scale->[[f32;3]];
563 [get|set|with] shear->shear->[[f32;3]];
564 [get|set|with] roation_order->rotationOrder->[XYZOrder];
565 [get|set|with] rst_order->rstOrder->[RSTOrder];
566);
567
568impl TransformEuler {
569 pub fn convert_transform(
570 &self,
571 session: &Session,
572 rst_order: RSTOrder,
573 rot_order: XYZOrder,
574 ) -> Result<Self> {
575 crate::ffi::convert_transform(session, &self.0, rst_order, rot_order).map(TransformEuler)
576 }
577
578 pub fn from_matrix(
579 session: &Session,
580 matrix: &[f32; 16],
581 rst_order: RSTOrder,
582 rot_order: XYZOrder,
583 ) -> Result<Self> {
584 crate::ffi::convert_matrix_to_euler(session, matrix, rst_order, rot_order)
585 .map(TransformEuler)
586 }
587
588 pub fn convert_to_matrix(&self, session: &Session) -> Result<[f32; 16]> {
589 crate::ffi::convert_transform_euler_to_matrix(session, &self.0)
590 }
591}
592
593#[derive(Debug, Clone)]
594pub struct SessionSyncInfo(pub(crate) HAPI_SessionSyncInfo);
595
596wrap!(
597 Default SessionSyncInfo [HAPI_SessionSyncInfo_Create => HAPI_SessionSyncInfo];
598 [get|set|with] cook_using_houdini_time->cookUsingHoudiniTime->[bool];
599 [get|set|with] sync_viewport->syncViewport->[bool];
600);
601
602#[derive(Debug, Clone)]
603pub struct BoxInfo(pub(crate) HAPI_BoxInfo);
604
605fn _create_box_info() -> HAPI_BoxInfo {
607 HAPI_BoxInfo {
608 center: Default::default(),
609 size: Default::default(),
610 rotation: Default::default(),
611 }
612}
613
614wrap!(
615 Default BoxInfo [_create_box_info => HAPI_BoxInfo];
616 [get|set|with] center->center->[[f32;3]];
617 [get|set|with] rotation->rotation->[[f32;3]];
618 [get|set|with] size->size->[[f32;3]];
619);
620
621#[derive(Debug, Clone)]
622pub struct SphereInfo(pub(crate) HAPI_SphereInfo);
623
624fn _create_sphere_info() -> HAPI_SphereInfo {
626 HAPI_SphereInfo {
627 center: Default::default(),
628 radius: 0.0,
629 }
630}
631
632wrap!(
633 Default SphereInfo [_create_sphere_info => HAPI_SphereInfo];
634 [get|set|with] center->center->[[f32;3]];
635 [get|set|with] radius->radius->[f32];
636);
637
638#[repr(C)]
639#[derive(Debug, Clone)]
640pub struct ImageInfo(pub(crate) HAPI_ImageInfo);
641
642wrap!(
643 Default ImageInfo [HAPI_ImageInfo_Create => HAPI_ImageInfo];
644 [get|set|with] x_res->xRes->[i32];
645 [get|set|with] y_res->yRes->[i32];
646 [get|set|with] gamma->gamma->[f64];
647 [get|set|with] data_format->dataFormat->[ImageDataFormat];
648 [get|set|with] interleaved->interleaved->[bool];
649 [get|set|with] packing->packing->[ImagePacking];
650 [get+session] image_format->imageFileFormatNameSH->[Result<String>];
651);
652
653#[repr(C)]
654#[derive(Debug, Clone)]
655pub struct KeyFrame {
657 pub time: f32,
658 pub value: f32,
659 pub in_tangent: f32,
660 pub out_tangent: f32,
661}
662
663#[derive(Debug, Clone)]
664pub struct ImageFileFormat<'a>(
665 pub(crate) HAPI_ImageFileFormat,
666 pub(crate) DebugIgnore<&'a Session>,
667);
668
669impl ImageFileFormat<'_> {
670 get!(name->nameSH->Result<String>);
671 get!(description->descriptionSH->Result<String>);
672 get!(extension->defaultExtensionSH->Result<String>);
673}
674
675#[derive(Debug, Clone)]
676pub struct VolumeInfo(pub(crate) HAPI_VolumeInfo);
677
678wrap!(
679 impl VolumeInfo => HAPI_VolumeInfo;
680 [get+session] name->nameSH->[Result<String>];
681 [get] volume_type->type_->[VolumeType];
682 [get|set|with] x_length->xLength->[i32];
683 [get|set|with] y_length->yLength->[i32];
684 [get|set|with] z_length->zLength->[i32];
685 [get|set|with] min_x->minX->[i32];
686 [get|set|with] min_y->minY->[i32];
687 [get|set|with] min_z->minZ->[i32];
688 [get|set|with] tuple_size->tupleSize->[i32];
689 [get|set|with] storage->storage->[StorageType];
690 [get|set|with] tile_size->tileSize->[i32];
691 [get|set|with] has_taper->hasTaper->[bool];
692 [get|set|with] x_taper->xTaper->[f32];
693 [get|set|with] y_taper->yTaper->[f32];
694);
695
696impl VolumeInfo {
697 fn transform(&self) -> Transform {
698 Transform(self.0.transform)
699 }
700 fn set_transform(&mut self, transform: Transform) {
701 self.0.transform = transform.0
702 }
703 fn with_transform(mut self, transform: Transform) -> Self {
704 self.0.transform = transform.0;
705 self
706 }
707}
708
709#[derive(Debug, Clone)]
710pub struct VolumeTileInfo(pub(crate) HAPI_VolumeTileInfo);
711
712wrap!(
713 impl VolumeTileInfo => HAPI_VolumeTileInfo;
714 [get|set|with] min_x->minX->[i32];
715 [get|set|with] min_y->minY->[i32];
716 [get|set|with] min_z->minZ->[i32];
717 [get] is_valid->isValid->[bool];
718);
719
720#[derive(Debug, Clone)]
721pub struct VolumeVisualInfo(pub(crate) HAPI_VolumeVisualInfo);
722
723wrap!(
724 impl VolumeVisualInfo => HAPI_VolumeVisualInfo;
725 [get|set|with] visual_type->type_->[VolumeVisualType];
726 [get|set|with] iso->iso->[f32];
727 [get|set|with] density->density->[f32];
728);
729
730#[derive(Debug, Clone)]
731pub struct InputCurveInfo(pub(crate) HAPI_InputCurveInfo);
732
733wrap!(
734 Default InputCurveInfo [HAPI_InputCurveInfo_Create => HAPI_InputCurveInfo];
735 [get|set|with] curve_type->curveType->[CurveType];
736 [get|set|with] order->order->[i32];
737 [get|set|with] closed->closed->[bool];
738 [get|set|with] reverse->reverse->[bool];
739 [get|set|with] input_method->inputMethod->[InputCurveMethod];
740 [get|set|with] breakpoint_parameterization->breakpointParameterization->[InputCurveParameterization];
741);
742
743#[derive(Debug, Copy, Clone)]
744pub struct PDGEventInfo(pub(crate) HAPI_PDG_EventInfo);
745
746impl PDGEventInfo {
747 get!(node_id->nodeId->[handle: NodeHandle]);
748 get!(workitem_id->workItemId->[handle: WorkItemId]);
749 get!(dependency_id->dependencyId->i32);
750 get!(with_session message->msgSH->Result<String>);
751 pub fn current_state(&self) -> PdgWorkItemState {
752 unsafe { std::mem::transmute::<i32, PdgWorkItemState>(self.0.currentState) }
753 }
754 pub fn last_state(&self) -> PdgWorkItemState {
755 unsafe { std::mem::transmute::<i32, PdgWorkItemState>(self.0.lastState) }
756 }
757 pub fn event_type(&self) -> PdgEventType {
758 unsafe { std::mem::transmute::<i32, PdgEventType>(self.0.eventType) }
759 }
760}
761
762#[derive(Debug)]
763pub struct PDGWorkItemOutputFile<'session>(
764 pub(crate) HAPI_PDG_WorkItemOutputFile,
765 pub(crate) DebugIgnore<&'session Session>,
766);
767
768impl PDGWorkItemOutputFile<'_> {
769 get!(path->filePathSH->Result<String>);
770 get!(tag->tagSH->Result<String>);
771 get!(sha->hash->i64);
772}
773
774pub struct PDGWorkItemInfo(pub(crate) HAPI_PDG_WorkItemInfo);
775
776wrap! {
777 impl PDGWorkItemInfo => HAPI_PDG_WorkItemInfo;
778 [get] index->index->[i32];
779 [get] output_file_count->outputFileCount->[i32];
780 [get+session] name->nameSH->[Result<String>];
781}