def main(): """Main """ 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) #create a node whose input is inputnode ph.HNode(session, "Sop/subdivide", "Cube Subdivider").connect_node_input(geo_inputnode) session.save_hip()
def main(): """Main """ session = ph.HSessionManager.get_or_create_default_session() #load hda asset and instantiate hda_asset = ph.HAsset(session, "hda/FourShapes.hda") asset_node = hda_asset.instantiate(node_name="Processor").cook() log_childnodes(asset_node) #create a sop node, set input another_box = ph.HNode(session, "geo", "ProgrammaticBox", parent_node=asset_node) input_node = another_box\ .connect_node_input(asset_node.get_child_nodes()[0])\ .cook()\ .get_node_input(0) print("ProgrammaticBox's input node is {0}".format(input_node.name)) log_childnodes(asset_node) #delete sop node another_box\ .disconnect_node_input(0)\ .delete() log_childnodes(asset_node) session.save_hip("modifiedScene.hip")
def test_connect_nodes(init_session): """Test connect nodes """ geo_inputnode = ph.HInputNode(init_session, "Cube") subdnode = ph.HNode(init_session, "Sop/subdivide", "Cube Subdivider").\ connect_node_input(geo_inputnode) assert subdnode is not None