pyhapi package¶
Submodules¶
pyhapi.hasset module¶
Interface for interacting with houdini digital assets (hda) Author : Maajor Email : info@ma-yidong.com
- HAsset:
- Representing an HDA asset
Example usage:
import pyhapi as ph
#create a houdini engine session session = ph.HSessionManager.get_or_create_default_session()
hda_asset = ph.HAsset(session, “hda/FourShapes.hda”) asset_node = hda_asset.instantiate(node_name=”Processor”).cook()
-
class
pyhapi.hasset.
HAsset
(session, hdapath)¶ Bases:
object
An class representing an HDA asset.
- Attributes:
- instantiated (bool): if this asset has instantiated node hda_path (str): Path of this asset session (HSession): Session where this asset is loaded asset_names ([str]): names of operator in this asset
-
asset_names
¶
-
get_assets_names
()¶ Get all operator names in this asset
-
instantiate
(node_name='Node', operator_id=0)¶ Instantiate an operator in this node
- Args:
- node_name (str, optional): Assign a name for this node. Defaults to “Node”. operator_id (int, optional): Operator id you want to instantiate in this asset. Defaults to 0.
- Returns:
- HNode: Node instantiated
-
reload
()¶
pyhapi.hdata module¶
Houdini Engine’s internal data types Author : Maajor Email : info@ma-yidong.com
-
class
pyhapi.hdata.
AssetInfo
¶ Bases:
_ctypes.Structure
Equivalent of HAPI’s HAPI_AssetInfo
-
filePathSH
¶ Structure/Union member
-
fullOpNameSH
¶ Structure/Union member
-
geoInputCount
¶ Structure/Union member
-
geoOutputCount
¶ Structure/Union member
-
handleCount
¶ Structure/Union member
-
hasEverCooked
¶ Structure/Union member
-
haveMaterialsChanged
¶ Structure/Union member
-
haveObjectsChanged
¶ Structure/Union member
-
helpTextSH
¶ Structure/Union member
-
helpURLSH
¶ Structure/Union member
-
labelSH
¶ Structure/Union member
-
nameSH
¶ Structure/Union member
-
nodeId
¶ Structure/Union member
-
objectCount
¶ Structure/Union member
-
objectNodeId
¶ Structure/Union member
-
transformInputCount
¶ Structure/Union member
-
versionSH
¶ Structure/Union member
-
-
class
pyhapi.hdata.
AttributeInfo
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_AttributeInfo
-
count
¶ Structure/Union member
-
exists
¶ Structure/Union member
-
originalOwner
¶ Structure/Union member
-
owner
¶ Structure/Union member
-
storage
¶ Structure/Union member
-
tupleSize
¶ Structure/Union member
-
typeInfo
¶ Structure/Union member
-
-
class
pyhapi.hdata.
AttributeOwner
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_AttributeOwner
-
DETAIL
= 3¶
-
INVALID
= -1¶
-
MAX
= 4¶
-
POINT
= 1¶
-
PRIM
= 2¶
-
VERTEX
= 0¶
-
-
class
pyhapi.hdata.
AttributeTypeInfo
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_AttributeTypeInfo
-
BOX
= 12¶
-
BOX2
= 11¶
-
COLOR
= 5¶
-
HIDDEN
= 10¶
-
HPOINT
= 2¶
-
INVALID
= -1¶
-
MATRIX
= 8¶
-
MATRIX3
= 7¶
-
MAX
= 14¶
-
NONE
= 0¶
-
NORMAL
= 4¶
-
POINT
= 1¶
-
QUATERNION
= 6¶
-
ST
= 9¶
-
TEXTURE
= 13¶
-
VECTOR
= 3¶
-
-
class
pyhapi.hdata.
ChoiceListType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_ChoiceListType
-
MINI
= 2¶
-
NONE
= 0¶
-
NORMAL
= 1¶
-
REPLACE
= 3¶
-
TOGGLE
= 4¶
-
-
class
pyhapi.hdata.
CookOptions
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_CookOptions
-
checkPartChanges
¶ Structure/Union member
-
clearErrorsAndWarnings
¶ Structure/Union member
-
cookTemplatedGeos
¶ Structure/Union member
-
curveRefineLOD
¶ Structure/Union member
-
extraFlags
¶ Structure/Union member
-
handleBoxPartTypes
¶ Structure/Union member
-
handleSpherePartTypes
¶ Structure/Union member
-
maxVerticesPerPrimitive
¶ Structure/Union member
-
packedPrimInstancingMode
¶ Structure/Union member
-
refineCurveToLinear
¶ Structure/Union member
-
splitAttrSH
¶ Structure/Union member
-
splitGeosByAttribute
¶ Structure/Union member
-
splitGeosByGroup
¶ Structure/Union member
-
splitPointsByVertexAttributes
¶ Structure/Union member
-
-
class
pyhapi.hdata.
CurveInfo
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_CurveInfo
-
curveCount
¶ Structure/Union member
-
curveType
¶ Structure/Union member
-
hasKnots
¶ Structure/Union member
-
isPeriodic
¶ Structure/Union member
-
isRational
¶ Structure/Union member
-
knotCount
¶ Structure/Union member
-
order
¶ Structure/Union member
-
vertexCount
¶ Structure/Union member
-
-
class
pyhapi.hdata.
CurveType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_CurveType
-
BEZIER
= 2¶
-
INVALID
= -1¶
-
LINEAR
= 0¶
-
MAX
= 3¶
-
NURBS
= 1¶
-
-
class
pyhapi.hdata.
ErrorCode
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_ErrorCode
-
ASSET_DEF_NOT_FOUND
= 1¶
-
PYTHON_NODE_ERROR
= 2¶
-
-
class
pyhapi.hdata.
GeoInfo
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_GeoInfo
-
hasGeoChanged
¶ Structure/Union member
-
hasMaterialChanged
¶ Structure/Union member
-
isDisplayGeo
¶ Structure/Union member
-
isEditable
¶ Structure/Union member
-
isTemplated
¶ Structure/Union member
-
nameSH
¶ Structure/Union member
-
nodeId
¶ Structure/Union member
-
partCount
¶ Structure/Union member
-
pointGroupCount
¶ Structure/Union member
-
primitiveGroupCount
¶ Structure/Union member
-
type
¶ Structure/Union member
-
-
class
pyhapi.hdata.
GroupType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_GroupType
-
INVALID
= -1¶
-
MAX
= 2¶
-
POINT
= 0¶
-
PRIM
= 1¶
-
-
class
pyhapi.hdata.
HGeoType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_GeoType
-
CURVE
= 3¶
-
DEFAULT
= 0¶
-
INPUT
= 2¶
-
INTERMEDIATE
= 1¶
-
INVALID
= -1¶
-
MAX
= 4¶
-
-
class
pyhapi.hdata.
InputType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_InputType
-
GEOMETRY
= 1¶
-
INVALID
= -1¶
-
MAX
= 2¶
-
TRANSFORM
= 0¶
-
-
class
pyhapi.hdata.
LicenseType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_License
-
HOUDINI
= 2¶
-
HOUDINI_ENGINE
= 1¶
-
HOUDINI_ENGINE_INDIE
= 4¶
-
HOUDINI_FX
= 3¶
-
HOUDINI_INDIE
= 5¶
-
MAX
= 6¶
-
NONE
= 0¶
-
-
class
pyhapi.hdata.
NodeFlags
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_NodeFlags
-
ANY
= -1¶
-
BYPASS
= 32¶
-
DISPLAY
= 1¶
-
EDITABLE
= 16¶
-
LOCKED
= 8¶
-
NETWORK
= 64¶
-
NONE
= 0¶
-
OBJ_CAMERA
= 256¶
-
OBJ_GEOMETRY
= 128¶
-
OBJ_LIGHT
= 512¶
-
OBJ_SUBNET
= 1024¶
-
RENDER
= 2¶
-
SOP_CURVE
= 2048¶
-
SOP_GUIDE
= 4096¶
-
TEMPLATED
= 4¶
-
TOP_NONSCHEDULER
= 8192¶
-
-
class
pyhapi.hdata.
NodeInfo
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_NodeInfo
-
childNodeCount
¶ Structure/Union member
-
createdPostAssetLoad
¶ Structure/Union member
-
id
¶ Structure/Union member
-
inputCount
¶ Structure/Union member
-
internalNodePathSH
¶ Structure/Union member
-
isTimeDependent
¶ Structure/Union member
-
isValid
¶ Structure/Union member
-
nameSH
¶ Structure/Union member
-
outputCount
¶ Structure/Union member
-
parentId
¶ Structure/Union member
-
parmChoiceCount
¶ Structure/Union member
-
parmCount
¶ Structure/Union member
-
parmFloatValueCount
¶ Structure/Union member
-
parmIntValueCount
¶ Structure/Union member
-
parmStringValueCount
¶ Structure/Union member
-
totalCookCount
¶ Structure/Union member
-
type
¶ Structure/Union member
-
uniqueHoudiniNodeId
¶ Structure/Union member
-
-
class
pyhapi.hdata.
NodeType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_NodeType
-
ANY
= -1¶
-
CHOP
= 4¶
-
COP
= 32¶
-
DOP
= 128¶
-
NONE
= 0¶
-
OBJ
= 1¶
-
ROP
= 8¶
-
SHOP
= 16¶
-
SOP
= 2¶
-
TOP
= 256¶
-
VOP
= 64¶
-
-
class
pyhapi.hdata.
ObjectInfo
¶ Bases:
_ctypes.Structure
Equivalent of HAPI’s HAPI_ObjectInfo
-
geoCount
¶ Structure/Union member
-
hasTransformChanged
¶ Structure/Union member
-
haveGeosChanged
¶ Structure/Union member
-
isInstanced
¶ Structure/Union member
-
isInstancer
¶ Structure/Union member
-
isVisible
¶ Structure/Union member
-
nameSH
¶ Structure/Union member
-
nodeId
¶ Structure/Union member
-
objectInstancePathSH
¶ Structure/Union member
-
objectToInstanceId
¶ Structure/Union member
-
-
class
pyhapi.hdata.
PackedPrimInstancingMode
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_PackedPrimInstancingMode
-
DISABLED
= 0¶
-
FLAT
= 2¶
-
HIERARCHY
= 1¶
-
INVALID
= -1¶
-
MAX
= 3¶
-
-
class
pyhapi.hdata.
ParmChoiceInfo
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_ParmChoiceInfo
-
labelSH
¶ Structure/Union member
-
parentParmId
¶ Structure/Union member
-
valueSH
¶ Structure/Union member
-
-
class
pyhapi.hdata.
ParmInfo
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_ParmInfo
-
UIMax
¶ Structure/Union member
-
UIMin
¶ Structure/Union member
-
childIndex
¶ Structure/Union member
-
choiceCount
¶ Structure/Union member
-
choiceIndex
¶ Structure/Union member
-
choiceListType
¶ Structure/Union member
-
disabled
¶ Structure/Union member
-
disabledConditionSH
¶ Structure/Union member
-
floatValuesIndex
¶ Structure/Union member
-
hasMax
¶ Structure/Union member
-
hasMin
¶ Structure/Union member
-
hasUIMax
¶ Structure/Union member
-
hasUIMin
¶ Structure/Union member
-
helpSH
¶ Structure/Union member
-
id
¶ Structure/Union member
-
inputNodeFlag
¶ Structure/Union member
-
inputNodeType
¶ Structure/Union member
-
instanceCount
¶ Structure/Union member
-
instanceLength
¶ Structure/Union member
-
instanceNum
¶ Structure/Union member
-
instanceStartOffset
¶ Structure/Union member
-
intValuesIndex
¶ Structure/Union member
-
invisible
¶ Structure/Union member
-
isChildOfMultiParm
¶ Structure/Union member
-
is_float
()¶ If this attribute is float type
- Returns:
- bool: If this attribute is float type
-
is_int
()¶ If this attribute is int type
- Returns:
- bool: If this attribute is int type
-
is_node
()¶ If this attribute is node type
- Returns:
- bool: If this attribute is node type
-
is_non_value
()¶ If this attribute is non-value
- Returns:
- bool: If this attribute is non-value
-
is_path
()¶ If this attribute is path type
- Returns:
- bool: If this attribute is path type
-
is_string
()¶ If this attribute is string type
- Returns:
- bool: If this attribute is string type
-
joinNext
¶ Structure/Union member
-
labelNone
¶ Structure/Union member
-
labelSH
¶ Structure/Union member
-
max
¶ Structure/Union member
-
min
¶ Structure/Union member
-
nameSH
¶ Structure/Union member
-
parentId
¶ Structure/Union member
-
permissions
¶ Structure/Union member
-
rampType
¶ Structure/Union member
-
scriptType
¶ Structure/Union member
-
size
¶ Structure/Union member
-
spare
¶ Structure/Union member
-
stringValuesIndex
¶ Structure/Union member
-
tagCount
¶ Structure/Union member
-
templateNameSH
¶ Structure/Union member
-
type
¶ Structure/Union member
-
typeInfoSH
¶ Structure/Union member
-
visibilityConditionSH
¶ Structure/Union member
-
-
class
pyhapi.hdata.
ParmType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_ParmType
-
BUTTON
= 3¶
-
COLOR
= 5¶
-
CONTAINER_END
= 12¶
-
CONTAINER_START
= 11¶
-
FLOAT
= 4¶
-
FLOAT_END
= 5¶
-
FLOAT_START
= 4¶
-
FOLDER
= 13¶
-
FOLDERLIST
= 11¶
-
FOLDERLIST_RADIO
= 12¶
-
INT
= 0¶
-
INT_END
= 3¶
-
INT_START
= 0¶
-
LABEL
= 14¶
-
MAX
= 17¶
-
MULTIPARMLIST
= 1¶
-
NODE
= 10¶
-
NODE_END
= 10¶
-
NODE_START
= 10¶
-
NONVALUE_END
= 15¶
-
NONVALUE_START
= 13¶
-
PATH_END
= 9¶
-
PATH_FILE
= 7¶
-
PATH_FILE_DIR
= 16¶
-
PATH_FILE_GEO
= 8¶
-
PATH_FILE_IMAGE
= 9¶
-
PATH_START
= 7¶
-
SEPARATOR
= 15¶
-
STRING
= 6¶
-
STRING_END
= 10¶
-
STRING_START
= 6¶
-
TOGGLE
= 2¶
-
-
class
pyhapi.hdata.
PartInfo
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_PartInfo
-
attributeCounts
¶ Structure/Union member
-
detail_attrib_count
¶ Get detail attribute count
- Returns:
- int: detail attribute count
-
faceCount
¶ Structure/Union member
-
hasChanged
¶ Structure/Union member
-
id
¶ Structure/Union member
-
instanceCount
¶ Structure/Union member
-
instancedPartCount
¶ Structure/Union member
-
isInstanced
¶ Structure/Union member
-
nameSH
¶ Structure/Union member
-
pointCount
¶ Structure/Union member
-
point_attrib_count
¶ Get point attribute count
- Returns:
- int: point attribute count
-
prim_attrib_count
¶ Get prim attribute count
- Returns:
- int: prim attribute count
-
type
¶ Structure/Union member
-
vertexCount
¶ Structure/Union member
-
vertex_attrib_count
¶ Get vertex attribute count
- Returns:
- int: vertex attribute count
-
-
class
pyhapi.hdata.
PartType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_PartType
-
BOX
= 4¶
-
CURVE
= 1¶
-
INSTANCER
= 3¶
-
INVALID
= -1¶
-
MAX
= 4¶
-
MESH
= 0¶
-
SPHERE
= 3¶
-
VOLUME
= 2¶
-
-
class
pyhapi.hdata.
Permissions
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_Permissions
-
MAX
= 4¶
-
NON_APPLICABLE
= 0¶
-
READ_ONLY
= 2¶
-
READ_WRITE
= 1¶
-
WRITE_ONLY
= 3¶
-
-
class
pyhapi.hdata.
PresetType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_PresetType
-
BINARY
= 0¶
-
IDX
= 1¶
-
INVALID
= -1¶
-
MAX
= 2¶
-
-
class
pyhapi.hdata.
PrmScriptType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_PrmScriptType
-
ANGLE
= 2¶
-
BUTTON
= 9¶
-
BUTTONSTRIP
= 40¶
-
COLOR
= 19¶
-
COLOR4
= 20¶
-
DATA
= 36¶
-
DIR
= 18¶
-
DIRECTORY
= 5¶
-
FILE
= 4¶
-
FLOAT
= 1¶
-
FLOAT_LOG
= 34¶
-
FLOAT_MINMAX
= 37¶
-
GEOMETRY
= 7¶
-
GEOMETRY_DATA
= 27¶
-
GROUP
= 1003¶
-
GROUPCOLLAPSIBLE
= 1001¶
-
GROUPRADIO
= 1000¶
-
GROUPSIMPLE
= 1002¶
-
ICONSTRIP
= 41¶
-
IMAGE
= 6¶
-
INT
= 0¶
-
INTVECTOR2
= 13¶
-
INTVECTOR3
= 14¶
-
INTVECTOR4
= 15¶
-
INT_LOG
= 35¶
-
INT_MINMAX
= 38¶
-
INT_STARTEND
= 39¶
-
KEY_VALUE_DICT
= 28¶
-
LABEL
= 29¶
-
OBJECT
= 23¶
-
OBJECTLIST
= 24¶
-
OPLIST
= 22¶
-
OPPATH
= 21¶
-
ORDINAL
= 31¶
-
RAMP_FLT
= 32¶
-
RAMP_RGB
= 33¶
-
RENDER
= 25¶
-
RGBAMASK
= 30¶
-
SEPARATOR
= 26¶
-
STRING
= 3¶
-
TOGGLE
= 8¶
-
UV
= 16¶
-
UVW
= 17¶
-
VECTOR2
= 10¶
-
VECTOR3
= 11¶
-
VECTOR4
= 12¶
-
-
class
pyhapi.hdata.
RSTOrder
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_RSTOrder
-
HAPI_RST
= 3¶
-
HAPI_RSTORDER_DEFAULT
= 5¶
-
HAPI_RTS
= 2¶
-
HAPI_SRT
= 5¶
-
HAPI_STR
= 4¶
-
HAPI_TRS
= 0¶
-
HAPI_TSR
= 1¶
-
-
class
pyhapi.hdata.
RampType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_RampType
-
COLOR
= 1¶
-
FLOAT
= 0¶
-
INVALID
= -1¶
-
MAX
= 2¶
-
-
class
pyhapi.hdata.
Result
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_Result
-
ALREADY_INITIALIZED
= 2¶
-
ASSET_DEF_ALREADY_LOADED
= 10¶
-
ASSET_INVALID
= 200¶
-
CANT_GENERATE_PRESET
= 8¶
-
CANT_LOADFILE
= 4¶
-
CANT_LOAD_GEO
= 7¶
-
CANT_LOAD_PRESET
= 9¶
-
DISALLOWED_HENGINEINDIE_W_3PARTY_PLUGIN
= 160¶
-
DISALLOWED_LC_ASSET_WITH_C_LICENSE
= 150¶
-
DISALLOWED_NC_ASSET_WITH_C_LICENSE
= 130¶
-
DISALLOWED_NC_ASSET_WITH_LC_LICENSE
= 140¶
-
DISALLOWED_NC_LICENSE_FOUND
= 120¶
-
FAILURE
= 1¶
-
INVALID_ARGUMENT
= 6¶
-
INVALID_SESSION
= 400¶
-
NODE_INVALID
= 210¶
-
NOT_INITIALIZED
= 3¶
-
NO_LICENSE_FOUND
= 110¶
-
PARM_SET_FAILED
= 5¶
-
SUCCESS
= 0¶
-
USER_INTERRUPTED
= 300¶
-
-
class
pyhapi.hdata.
Session
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_Session
-
id
¶ Structure/Union member
-
type
¶ Structure/Union member
-
-
class
pyhapi.hdata.
SessionConnectionState
¶ Bases:
enum.IntEnum
[summary]
-
CONNECTED
= 1¶
-
FAILED_TO_CONNECT
= 2¶
-
NOT_CONNECTED
= 0¶
-
-
class
pyhapi.hdata.
SessionType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_SessionType
-
CUSTOM1
= 2¶
-
CUSTOM2
= 3¶
-
CUSTOM3
= 4¶
-
INPROCESS
= 0¶
-
MAX
= 5¶
-
THRIFT
= 1¶
-
-
class
pyhapi.hdata.
State
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_State
-
COOKING
= 4¶
-
LOADING
= 6¶
-
MAX
= 7¶
-
MAX_READY_STATE
= 2¶
-
READY
= 0¶
-
READY_WITH_COOK_ERRORS
= 2¶
-
READY_WITH_FATAL_ERRORS
= 1¶
-
STARTING_COOK
= 3¶
-
STARTING_LOAD
= 5¶
-
-
class
pyhapi.hdata.
StatusType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_StatusType
-
CALL_RESULT
= 0¶
-
COOK_RESULT
= 1¶
-
COOK_STATE
= 2¶
-
MAX
= 3¶
-
-
class
pyhapi.hdata.
StatusVerbosity
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_StatusVerbosity
-
ALL
= 2¶
-
ERRORS
= 0¶
-
MESSAGES
= 2¶
-
WARNINGS
= 1¶
-
-
class
pyhapi.hdata.
StorageType
¶ Bases:
enum.IntEnum
Equivalent of HAPI’s HAPI_StorageType
-
FLOAT
= 2¶
-
FLOAT64
= 3¶
-
INT
= 0¶
-
INT64
= 1¶
-
INVALID
= -1¶
-
MAX
= 5¶
-
STRING
= 4¶
-
-
class
pyhapi.hdata.
StructureWithEnums
¶ Bases:
_ctypes.Structure
Add missing enum feature to ctypes Structures. ref: https://gist.github.com/christoph2/9c390e5c094796903097
-
class
pyhapi.hdata.
ThriftServerOptions
¶ Bases:
_ctypes.Structure
Equivalent of HAPI’s HAPI_ThriftServerOptions
-
autoClose
¶ Structure/Union member
-
timeoutMs
¶ Structure/Union member
-
-
class
pyhapi.hdata.
Transform
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_Transform
-
position
¶ Structure/Union member
-
rotationQuaternion
¶ Structure/Union member
-
rstorder
¶ Structure/Union member
-
scale
¶ Structure/Union member
-
shear
¶ Structure/Union member
-
-
class
pyhapi.hdata.
VolumeInfo
¶ Bases:
pyhapi.hdata.StructureWithEnums
Equivalent of HAPI’s HAPI_VolumeInfo
-
hasTaper
¶ Structure/Union member
-
minX
¶ Structure/Union member
-
minY
¶ Structure/Union member
-
minZ
¶ Structure/Union member
-
nameSH
¶ Structure/Union member
-
storage
¶ Structure/Union member
-
tileSize
¶ Structure/Union member
-
transform
¶ Structure/Union member
-
tupleSize
¶ Structure/Union member
-
type
¶ Structure/Union member
-
xLength
¶ Structure/Union member
-
xTaper
¶ Structure/Union member
-
yLength
¶ Structure/Union member
-
yTaper
¶ Structure/Union member
-
zLength
¶ Structure/Union member
-
pyhapi.hgeo module¶
Wrapper for houdini engine’s geometry. Author : Maajor Email : info@ma-yidong.com
- HGeo:
- An base class for houdini engine’s geometry, including shared operation for setting and getting attributes. It could derived HGeoMesh for handling mesh, HGeoCurve for handling curve, HGeoVolume for handling volume data.
- HGeoMesh:
- An object containing mesh data
- HGeoCurve:
- An object containing curve data
Example usage:
import pyhapi as ph
#create houdini engine session session = ph.HSessionManager.get_or_create_default_session()
#create an inputnode where you can set geometry geo_inputnode = ph.HInputNode(session, “Cube”)
#create a geomesh cube_geo = ph.HGeoMesh(
- vertices=np.array(
- [[0.0, 0.0, 0.0],
- [0.0, 0.0, 1.0], [0.0, 1.0, 0.0], [0.0, 1.0, 1.0], [1.0, 0.0, 0.0], [1.0, 0.0, 1.0], [1.0, 1.0, 0.0], [1.0, 1.0, 1.0]], dtype=np.float32),
- faces=np.array(
- [[0, 2, 6, 4],
- [2, 3, 7, 6], [2, 0, 1, 3], [1, 5, 7, 3], [5, 4, 6, 7], [0, 4, 5, 1]], dtype=np.int32))
#set this geomesh as geometry of inputnode geo_inputnode.set_geometry(cube_geo)
-
class
pyhapi.hgeo.
HGeo
¶ Bases:
object
An base class for houdini engine’s geometry, including shared operation for setting and getting attributes. It could derived HGeoMesh for handling mesh, HGeoCurve for handling curve, HGeoVolume for handling volume data.
- Attributes:
- part_info (PartInfo): geom info of this part point_count (int): number of points in this geo vertex_count (int): number of vertices in this geo face_count (int): number of faces in this geo detail_count (int): number of details in this geo, should be 1 attribs (dict((int,str),(AttributeInfo,str,np.ndarray)): attribute’s name to attribute’s actual data type_to_add_attrib (dict(int,func)): attribute’s type to the function to set the attribute data into hengine
-
add_attrib
(attrib_type, name, data)¶ Add attribute data to geo, should provide attribute’s type, name and data
- Args:
- attrib_type (AttributeOwner): Type of the attribute name (str): name of the attribute data (ndarray(,)): Attribute data, should be 2D, 1st dims corresponding to each item in that attribute, ptnum/vtnum primnum etc, 2nd dim should be tuple size of this attribute
-
add_detail_attrib
(name, data)¶ Add detail attribute data to geo
- Args:
- name (str): name of the attribute data (ndarray(,)): Attribute data, should be 2D, 1st dims should be 1, 2nd dim should be tuple size of this attribute
-
add_point_attrib
(name, data)¶ Add point attribute data to geo
- Args:
- name (str): name of the attribute data (ndarray(,)): Attribute data, should be 2D, 1st dims equals number of points, 2nd dim should be tuple size of this attribute
-
add_prim_attrib
(name, data)¶ Add prim attribute data to geo
- Args:
- name (str): name of the attribute data (ndarray(,)): Attribute data, should be 2D, 1st dims equals number of faces, 2nd dim should be tuple size of this attribute
-
add_vertex_attrib
(name, data)¶ Add vertex attribute data to geo
- Args:
- name (str): name of the attribute data (ndarray(,)): Attribute data, should be 2D, 1st dims equals number of vertices, 2nd dim should be tuple size of this attribute
-
commit_to_node
(session, node_id)¶ Set this geo into hengine’s node
- Args:
- session (int64): The session of Houdini you are interacting with. node_id (int): The node to add geo.
-
extract_from_sop
(session, part_info, node_id, part_id=0)¶ Extract geometry from sop
- Args:
- session (int64): The session of Houdini you are interacting with. part_info (PartInfo): The info of part node_id (int): The node to add geo. part_id (int): Part id. Default to 0
-
get_attrib_data
(attrib_type, name)¶ Get attribute data of certain type and name
- Args:
- attrib_type (AttributeOwner): Type of querying attribute name (str): Name of querying attribute
- Returns:
- ndarray(,): Data of querying attribute
-
get_attrib_data_storage_type
(attrib_type, name)¶ Get attribute data of certain type and name
- Args:
- attrib_type (AttributeOwner): Type of querying attribute name (str): Name of querying attribute
- Returns:
- ndarray(,): Data of querying attribute
-
get_attrib_names
()¶ Get all attribute name in this geo
- Returns:
- list((str,AttributeOwner)): All attributes containing in this geo
-
get_attrib_tuple_size
(attrib_type, name)¶ Get attribute data of certain type and name
- Args:
- attrib_type (AttributeOwner): Type of querying attribute name (str): Name of querying attribute
- Returns:
- ndarray(,): Data of querying attribute
-
class
pyhapi.hgeo.
HGeoCurve
(vertices=None, curve_knots=None, is_periodic=False, order=4, curve_type=<CurveType.LINEAR: 0>)¶ Bases:
pyhapi.hgeo.HGeo
A class representing hengine’s curve geometry
- Attributes:
- curve_knots (np.ndarray): Curve knots curve_count (np.ndarray): Curve counts curve_info (CurveInfo): CurveInfo
-
commit_to_node
(session, node_id)¶ Set this geo into hengine’s node
- Args:
- session (int64): The session of Houdini you are interacting with. node_id (int): The node to add geo.
-
extract_from_sop
(session, part_info, node_id, part_id=0)¶ Extract curve from sop
- Args:
- session (int64): The session of Houdini you are interacting with. part_info (PartInfo): The info of part node_id (int): The node to add geo. part_id (int): Part id. Default to 0
-
class
pyhapi.hgeo.
HGeoHeightfield
(volume=None, volume_name='height', transform=None)¶ Bases:
pyhapi.hgeo.HGeo
[summary]
- Args:
- HGeo ([type]): [description]
-
commit_to_node
(session, node_id)¶ Set this geo into hengine’s node
- Args:
- session (int64): The session of Houdini you are interacting with. node_id (int): The node to add geo.
-
extract_from_sop
(session, part_info, node_id, part_id=0)¶ Extract mesh from sop
- Args:
- session (int64): The session of Houdini you are interacting with. part_info (PartInfo): The info of part node_id (int): The node to add geo. part_id (int): Part id. Default to 0
-
class
pyhapi.hgeo.
HGeoInstancer
¶ Bases:
pyhapi.hgeo.HGeo
-
class
pyhapi.hgeo.
HGeoMesh
(vertices=None, faces=None)¶ Bases:
pyhapi.hgeo.HGeo
A class representing hengine’s mesh geometry
- Attributes:
- faces (np.ndarray): Faces data, should be in 2D such as (face_count, vertex_each_face).
-
commit_to_node
(session, node_id)¶ Set this geo into hengine’s node
- Args:
- session (int64): The session of Houdini you are interacting with. node_id (int): The node to add geo.
-
extract_from_sop
(session, part_info, node_id, part_id=0)¶ Extract mesh from sop
- Args:
- session (int64): The session of Houdini you are interacting with. part_info (PartInfo): The info of part node_id (int): The node to add geo. part_id (int): Part id. Default to 0
-
class
pyhapi.hgeo.
HGeoVolume
¶ Bases:
pyhapi.hgeo.HGeo
[summary]
- Args:
- HGeo ([type]): [description]
-
commit_to_node
(session, node_id)¶ Set this geo into hengine’s node
- Args:
- session (int64): The session of Houdini you are interacting with. node_id (int): The node to add geo.
-
extract_from_sop
(session, part_info, node_id, part_id=0)¶ Extract mesh from sop
- Args:
- session (int64): The session of Houdini you are interacting with. part_info (PartInfo): The info of part node_id (int): The node to add geo. part_id (int): Part id. Default to 0
pyhapi.hnode module¶
Wrapper for houdini engine’s node Author : Maajor Email : info@ma-yidong.com
- HNodeBase:
- A base class for houdini engine’s node, including shared operation for setting input/output, setting/getting geometry, get node information etc.
- HNode:
- A node user created for operator name or hda assets, could get/set params, press button and cook.
- HInputNode:
- A node dedicated to marshall geom datas
- HExistingNode:
- A node created by hengine itself, such as child node of node instantiated with HNode
Example usage:
import pyhapi as ph
#create houdini engine session session = ph.HSessionManager.get_or_create_default_session()
#create an inputnode where you can set geometry geo_inputnode = ph.HInputNode(session, “Cube”)
#create an geo sop another_box = ph.HNode(session, “geo”, “ProgrammaticBox”, parent_node=asset_node)
#connect input node into geo sop’s input another_box.connect_node_input(geo_inputnode)
#disconnect input node another_box.disconnect_node_input(0).delete()
-
class
pyhapi.hnode.
HExistingNode
(session, node_id)¶ Bases:
pyhapi.hnode.HNodeBase
A node created by hengine itself, such as child node of node instantiated with HNode
-
class
pyhapi.hnode.
HHeightfieldInputNode
(session, node_name, x_size, y_size, voxel_size)¶ Bases:
pyhapi.hnode.HNodeBase
A node dedicated to marshall heightfield datas
-
class
pyhapi.hnode.
HHeightfieldInputVolumeNode
(session, node_name, x_size, y_size, voxel_size)¶ Bases:
pyhapi.hnode.HNodeBase
A node dedicated to marshall heightfield volume datas
-
class
pyhapi.hnode.
HInputNode
(session, node_name)¶ Bases:
pyhapi.hnode.HNodeBase
A node dedicated to marshall geom datas
-
class
pyhapi.hnode.
HNode
(session, operator_name, node_name, parent_node=None)¶ Bases:
pyhapi.hnode.HNodeBase
A node user created for operator name or hda assets, could get/set params, press button and cook.
-
class
pyhapi.hnode.
HNodeBase
(session)¶ Bases:
object
A base class for houdini engine’s node, including shared operation for setting input/output, setting/getting geometry, get node information etc.
- Attributes:
- session (HSession): HEngine session containing this node instantiated (bool): instantiated node_id (int): Current node id name (str): Current node name
-
connect_node_input
(node_to_connect, input_index=0, output_index=0)¶ Connect another node into this node’s input
- Args:
- node_to_connect (HNodeBase): The other node to connect to this node input_index (int, optional): This node’s input index. Defaults to 0. output_index (int, optional): The other node’s output index. Defaults to 0.
- Returns:
- HNodeBase: Current node itself
-
cook
(cook_option: pyhapi.hdata.CookOptions = None, status_report_interval=1.0, status_verbosity=<StatusVerbosity.ALL: 2>)¶ Cook this node in sync/blocking manner
- Returns:
- HNodeBase: Current node itself
-
cook_async
(cook_option: pyhapi.hdata.CookOptions = None, status_report_interval=1.0, status_verbosity=<StatusVerbosity.ALL: 2>)¶ Cook this node in async/non-blocking manner
- Returns:
- HNodeBase: Current node itself
-
delete
()¶ Delete current node
-
disconnect_node_input
(input_index=0)¶ Disconnet this node’s input
- Args:
- input_index (int, optional): This node’s input index. Defaults to 0.
- Returns:
- HNodeBase: Current node itself
-
get_all_params
()¶ Get all param in this node
- Returns:
- [HParm]: all params
-
get_child_nodes
()¶ Get children node information
- Returns:
- [HNodeBase]: All children node of this node
-
get_display_geos
()¶ Get display geo of this node
- Returns:
- list of HGeo: List of geos in this node
-
get_node_input
(input_index=0)¶ Get information of input node
- Args:
- input_index (int, optional): This node’s input index. Defaults to 0.
- Returns:
- HNodeBase: Input node
-
get_node_input_name
(input_index=0)¶
-
get_node_type
()¶ Get node’s type
- Returns:
- NodeType: type of node
-
get_param
(param_name)¶ Get all param in this node
- Returns:
- [str]: Name of all params
-
get_param_names
()¶ Get all param in this node
- Returns:
- [str]: Name of all params
-
get_param_type
(param_name)¶ Get param’s type by name
- Args:
- param_name (str): Param name
- Returns:
- type: type of param
-
get_param_value
(param_name, tupleid=0)¶ Get param value
- Args:
- param_name (str): Parameter name to retrieve
- Returns:
- int/float/str: Value of that param, depends on param type
-
get_visible_params
()¶ Get all visible param in this node
- Returns:
- [HParm]: all visible params
-
is_inited
()¶ If this node is inited
- Returns:
- bool: If this node is inited
Press button in this node in sync/blocking manner
- Args:
- param_name (str): Button name to press status_report_interval (float): Time interval in seconds to report status
Press button in this node in async/non-blocking manner
- Args:
- param_name (str): Button name to press status_report_interval (float): Time interval in seconds to report status
-
refresh_params
()¶
-
rename
(new_name)¶ rename this node
-
set_geometry
(geo)¶ Set an HGeo to this node
- Args:
- geo (HGeo): Geometry to set into this node
-
set_param_value
(param_name, value, tupleid=0)¶ Set parameter value
- Args:
- param_name (str): Parameter name to set value (int/float/str): Value to set to that param, depends on param type
- Returns:
- bool: set successed
pyhapi.hsession module¶
wrapper for houdini engine’s session. Author : Maajor Email : info@ma-yidong.com
- HSession:
- A wrapper fou houdini engine’s session, it contains the session itself and other informations such as nodes, process id etc. Use this object to get nodes, save hips. Creating nodes and lots of hengine operation need HSession object as parameter.
- HSessionManager:
- Use this object to get HSession object
Example usage:
import pyhapi as ph
#create a houdini engine session session = ph.HSessionManager.get_or_create_default_session()
#create a geo objnode box = ph.HNode(session, “geo”, “ProgrammaticBox”)
#save the session to a hip file session.save_hip(“test.hip”)
-
class
pyhapi.hsession.
HSession
¶ Bases:
object
A wrapper fou houdini engine’s session, it contains the session itself and other informations such as nodes, process id etc.
- Attributes:
- hapi_session (HAPI_SessionId:int64): hapi session id connected_state (hdata.SessionConnectionState): state of current session nodes (list(hnode.HNodeBase)): all nodes in this session process_id (int): process id used by this session cook_option (hdata.CookOptions): cook option of this session root_path (str): file path to hsession project’s root path, it could contain /hda folder
-
check_and_close_existing_session
()¶ Close current session
- Returns:
- bool: if the close success
-
cleanup
()¶ Clean up current session
-
create_thrift_pipe_session
(rootpath, pipe_name, auto_close=True, timeout=10000.0)¶ Create the session in thrift-pipe manner
- Args:
- rootpath (string): file path to hsession project’s root path, it could contain /hda folder auto_close (bool, optional): Close the server automatically when all clients disconnect from it. Defaults to True. timeout (float, optional): Timeout in milliseconds for waiting on the server to signal that it’s ready to serve. If the server fails to signal within this time interval, the start server call fails and the server process is terminated. Defaults to 10000.0.
- Returns:
- bool: true if the session created successfully, false not.
-
get_node
(node_id)¶ Get node in this session by HAPI_NodeId
- Args:
- node_id (hdata.HAPI_NodeId ): node’s id store by the session
- Returns:
- hnode.HNodeBase: an object represent that node in session. It will return None if cannot find any node matching the node id
-
is_session_valid
()¶ Check if current session is valid
- Returns:
- bool: if current session is valid
-
load_hip
(filename, cook_on_load=False)¶ Loads a .hip file into the main Houdini scene
- Args:
- filename ([type]): HIP file absolute path to load cook_on_load (bool, optional): Set to true if you wish the nodes to cook as soon as they are created. Defaults to False.
- Returns:
- HSession: session itself
-
reload_asset_library
(asset)¶
-
restart_session
()¶ Restart current session
- Returns:
- HSession: session itself
-
save_hip
(filename='debug.hip', lock_nodes=True)¶ Save current session to a hip file
- Args:
- filename (str, optional): name of saved hip file lock_nodes (bool, optional): Specify whether to lock all SOP nodes before saving the scene file.
-
class
pyhapi.hsession.
HSessionManager
¶ Bases:
object
Use this object to get HSession object
-
static
get_or_create_default_session
(rootpath='/home/docs/checkouts/readthedocs.org/user_builds/pyhapi/checkouts/latest/docs', pipe_name='hapi')¶ Get or create an session
- Args:
- rootpath (str, optional): file path to hsession project’s root path, it could contain /hda folder
- Returns:
- HSession: session created
-
static
get_or_create_session_pool
(session_count=4, rootpath='/home/docs/checkouts/readthedocs.org/user_builds/pyhapi/checkouts/latest/docs', pipe_name='hapi')¶ Get or create an session pool
- Args:
- session_count (int, optional): number of sessions to start rootpath (str, optional): working directory of sessions pipe_name (str, optional): name prefix of pipe name communicate with hsession
- Returns:
- HSessionPool: session pool created
-
static
restart_session
()¶ Restart default session
- Returns:
- HSession: session created
-
static
-
class
pyhapi.hsession.
HSessionPool
(session_count, max_task_time: int = 10000)¶ Bases:
object
-
create_thrift_pipe_session
(rootpath, pipe_name_prefix, auto_close=True, timeout=10000.0)¶ Create the session in thrift-pipe manner
- Args:
- rootpath (string): file path to hsession project’s root path, it could contain /hda folder pipe_name_prefix (string): prefix of IPC pipe name auto_close (bool, optional): Close the server automatically when all clients disconnect from it. Defaults to True. timeout (float, optional): Timeout in milliseconds for waiting on the server to signal that it’s ready to serve. If the server fails to signal within this time interval, the start server call fails and the server process is terminated. Defaults to 10000.0.
- Returns:
- bool: true if the session created successfully, false not.
-
enqueue_task
(task, *args)¶ enqueue a session task into session pool
- Args:
- task (func): a houdini task to run *args : arguments pass to this task
- Returns:
- asyncio.Future: future object of task execution
-
enqueue_task_async
(task, *args)¶ enque a session task asynch
- Args:
- task (func): a houdini task to run *args : arguments pass to this task
-
resize
(session_count)¶ resize the session pool to desired size
- Args:
- session_count (int): target size of this session pool
-
restart_session_pool
()¶ restart the session pool
- Returns:
- HSessionPool: this session pool itself
-
run_all_tasks
()¶ run all enqueued tasks by now
-
run_on_task_producer
(producer)¶ run a task producer and consuming task with session pool
- Args:
- producer (func): producer function to generate and enqueue tasks
-
run_on_task_producer_async
(producer)¶ run a task producer and consuming task with session pool async
- Args:
- producer (func): producer function to generate and enqueue tasks
-
run_task_consumer_on_background
()¶ run task consumer on background thread
-
-
pyhapi.hsession.
HSessionTask
(task)¶ A decorator for houdini’s task
Module contents¶
pyhapi Author : Maajor Email : info@ma-yidong.com