Custom Compositing Filters and Generators in Copernicus?

   866   6   1
User Avatar
Member
25 posts
Joined: May 2023
Online
Hi

Is it not possible to use Python Compositing Filter and Compositing Generator kind of assets in new Copernicus networks?

If I create one of these (File => New Asset => Compositing Filter / Generator), they can be added to old "cop2net" networks but not to new "copnet" Copernicus networks. Am I missing something obvious?

Thanks
User Avatar
Member
8046 posts
Joined: Sept. 2011
Offline
No, there's no Python type for Copernicus networks as OpenCL is the native language for COPs. VEX is also supported with wrangles.
User Avatar
Member
25 posts
Joined: May 2023
Online
Shame, this was an easy way to insert external tools processing steps into a COP network

I wonder if perhaps it is possible to pass image data like this:

( Copernicus ) => ( COP Old ) => ( Copernicus )

So you can still pass it through a custom Python Compositing Filter node in the old COP net...
Edited by voidcoder - Oct. 3, 2024 13:16:08
User Avatar
Member
8046 posts
Joined: Sept. 2011
Offline
I would avoid using Old cops in such a dependency, as it lacks proper cook signaling which can lead to deadlock crashes. It's okay if you write it to disk first though.

Another way to add external tool processing steps is to use a top network to manage disk writes and launching external processes. The expected output path of the intermediary step can be passed to a read node via top attributes to continue the chain in further cop networks. It's not ideal as you won't be able to leverage vram residency at all--but I doubt that was possible when calling external processes in python anyway.
User Avatar
Member
25 posts
Joined: May 2023
Online
Thanks Jsmack. This is not for invoking external processes, I'm actually passing image data through some specialized processing in an external python module. Literally passing an array of pixel color and other plane data for in-place processing at runtime w/o dumping to disk or passing to external programs. I suppose dumping image data to disk in Copernicus net then loading it in a Python script down the line will work but would be super taxing.

I probably can achieve the same ish result outside of old COP network using normal Python script node if I knew how to get hold of the new Copernicus node input/output channels in Python. In the old Compositing Filter script you would do something like e.g:

input = cop_node.inputs()
pixels = input.allPixels()

<do whatever you want with image data>

cop_node.setPixels(pixels)


I wonder if there is an equivalent of .allPixels() etc API for the new Copernicus nodes (or for Copernicus network inputs/outputs). Seems can't find anything related in the docs.
Edited by voidcoder - Oct. 4, 2024 12:51:31
User Avatar
Member
8046 posts
Joined: Sept. 2011
Offline
voidcoder
I probably can achieve the same ish result outside of old COP network using normal Python script node if I knew how to get hold of the new Copernicus node input/output channels in Python. In the old Compositing Filter script you would do something like e.g:

input = cop_node.inputs()
pixels = input.allPixels()

<do whatever you want with image data>

cop_node.setPixels(pixels)


I wonder if there is an equivalent of .allPixels() etc API for the new Copernicus nodes (or for Copernicus network inputs/outputs). Seems can't find anything related in the docs.

Copernicus nodes have no python api yet, so that's not possible either. SOPs do have a python api though, so you could marshal it via sops as a volume primitive. The python sop would let you call external modules. It would be up to you to convert a sop volumes values array to some kind of pil or numpy object though.
User Avatar
Member
25 posts
Joined: May 2023
Online
Thanks. I'll see if I can use volumes for this.
  • Quick Links