"SOLVED"Script Solver?

   223   0   0
User Avatar
Member
152 posts
Joined: Aug. 2017
Offline
How can one effectively transfer geometry, along with all associated attributes, from the SOP level to a Script Solver within the DOP context in Houdini?

def solveForObjects(solver_data, new_dop_objects, existing_dop_objects, time, timestep):
    
    # Reference to the SOP node containing the geometry to copy
    sop_node_path = "/obj/geo1/Nul"  # Replace with your SOP node path
    sop_node = hou.node(sop_node_path)
    sop_geo = sop_node.geometry()

    for dop_object in new_dop_objects:
        # Optional: Set custom DOP attributes or physical parameters
        sub_data = dop_object.createSubData('PhysicalParms', 'SIM_PhysicalParms')
        
        # Access the editable geometry of the DOP object
        with dop_object.editableGeometry() as geo:
            # Merge the SOP geometry into the DOP geometry
            geo.merge(sop_geo)

            # Example: Adding custom attributes to the copied geometry
            geo.addAttrib(hou.attribType.Prim, 'max_nhit',2)
Edited by cncverkstad - Oct. 25, 2024 17:06:34

Attachments:
SCRIPTDOP.hipnc (173.3 KB)

Conservation of Momentum
  • Quick Links