hou.DopRecord
class
A table of values stored inside a DopData.
See hou.DopData for a description of DOP data, records, and fields.
Methods
field(self)→int,bool,float,str, hou.Vector2, hou.Vector3, hou.Vector4, hou.Quaternion, hou.Matrix3, or hou.Matrix4-
Return the value of a field inside this record, or
Noneif no such field exists.Note that you can add the suffixes “x”, “y”, and “z” to a vector field’s name to access the individual float values.
# The following code assumes you have created a box from the shelf and used # Rigid Bodies > RBD Object on the shelf to make it a rigid body. >>> record = hou.node("/obj/AutoDopNetwork").simulation().findData("box_object1/Forces/Gravity_gravity1").options() >>> record.fieldNames() ('force', 'handlepos') >>> record.field("force") <hou.Vector3 [0, -9.80665, 0]> >>> record.field("forcey") -9.8066501617431641 >>> record.fieldType("force") fieldType.Vector3 >>> record.fieldType("forcey") fieldType.Float
This example function creates a dict out of a record:
def recordAsDict(record): return dict((field_name, record.field(field_name)) for field_name in record.fieldNames())
The following function implements the equivalent of the doptransform hscript expression function:
def dopTransform(dopnet_node, object_name, subdata_name="Geometry"): subdata = dopnet_node.simulation().findObject(object_name).findSubData(subdata_name) return subdata.record("Transform").field("transform")
fieldNames(self)→ tuple ofstr-
Return the names of all the fields inside this record. See hou.DopRecord.field for an example.
fieldType(self, field_name)→ hou.fieldType enum value-
Return a hou.fieldType enumerated value that describes the type of data stored in a field. Returns
hou.fieldType.NoSuchFieldif no field exists with that name.See hou.DopRecord.field for an example.
recordIndex(self)→int-
Return the index of this record. See hou.DopData.record and hou.DopData.records for more information.
recordType(self)→str-
Return the name of this record. See hou.DopData.recordTypes for more information.
setField(self, value)-
Set a field to the specified value. You would call this method from a script solver DOP.
valuemay be anint,float,str, hou.Vector2, hou.Vector3, hou.Vector4, hou.Quaternion, hou.Matrix3, or hou.Matrix4.Unfortunately, this method cannot be used to set a field to a boolean (True or False) value. If you pass a boolean to this method, it will set the field to the integer 1 or 0. To properly set it to a boolean value, use hou.DopRecord.setFieldBool.
Raises hou.PermissionError if called from outside a script solver DOP.
setFieldBool(self, value)-
Set a field to the specified boolean value. You would call this method from a script solver DOP.
To set a field to a different type, use hou.DopRecord.setField.
Raises hou.PermissionError if called from outside a script solver DOP.