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