Does COP nodes not have a python api?

   1349   3   1
User Avatar
Member
108 posts
Joined:
オンライン
As the question in the title says - does cop nodes have a python api or something equivalent? I'm trying to read file data through an mcp server I'm building for houdini and this is one of the problems I've bumped into.

I anyone out there have a good answer for how to programatically access/read read file data via python please let me know.

Thanks,

Dag
User Avatar
Member
746 posts
Joined: 8月 2019
オフライン
https://www.sidefx.com/docs/houdini/hom/hou/CopNode.html [www.sidefx.com]
User Avatar
Member
7 posts
Joined: 10月 2025
オフライン
raincole
https://www.sidefx.com/docs/houdini/hom/hou/CopNode.html [www.sidefx.com]
But is it posible to clue COpNode to UI?
User Avatar
Member
33 posts
Joined: 7月 2018
オンライン
Yes, Copernicus has a Python API. You can read a COP’s cooked image as a hou.ImageLayer:

import hou
import numpy as np

cop = hou.node("/obj/copnet1/file1")
layer = cop.layer()

w, h = layer.bufferResolution()
channels = layer.channelCount()
raw = layer.allBufferElements(
    hou.imageLayerStorageType.Float32, channels
)
pixels = np.frombuffer(raw, np.float32).reshape(h, w, channels)

Use layerAtFrame(frame) for another frame. There’s also a Python Snippet COP for processing layers inside a COP network.
If your MCP server runs outside Houdini, the main issue is that the hou calls still need to execute inside the Houdini process/on its main thread.
MotionCOPs toolkit - pushing COPS into motion design and dynamic effects territory.
https://github.com/Boning1011/motion-cops [github.com]
  • Quick Links