Pybox Nuke

there’s something in the doc about adding such a field, but how does it work to ‘link’ this to the nuke blur (linked group) value?

@fredwarren Would you have a simple working script (handler) that would expose 1 nuke parameter in Flame?
Like a simple blur maybe? Please pretty please? :slight_smile:

Hi Stefan,

I don’t know if this is of any help, but you can find the pybox script for nuke at:

/opt/Autodesk/presets/2023.2/pybox/presets/nuke_px.py

Thanks

Grant

Hi Grant,
Thank you. Yeah this one works well, I’m able to use it successfully.
What I’m trying to do is to expose parameters from nuke to the flame pybox.
@tpo explained it a little bit and there are bits of info in the doc, but not enough for me to succeed.
I’ve spent hours trying already but no luck yet. I’m a bit slow :frowning:
A simple working handler with at least 1 exposed parameter could help many to get this going.

Looking back at Thiago’s video (Thank you @tpo) (part3/3) using Eddy (Demo Flame2020 - Part3of3 - Eddy Simulations in Flame Idea - YouTube)
So … did I completely misunderstand what the handler should look like? It seems that it’s the exact same script than the one provided by adsk (the one you mentioned @La_Flame) - with the 2 modified variables (paths).
So all the rest (in order to expose parameters in flame) should happen in the nuke script?
I thought I followed the direction for how it worked in nuke (linking values, naming things with ‘adsk_…’ but I’m obviously doing something wrong there.

So I guess my new question is: Would someone have (and share please) a small nuke script with just a blur node (for example) and it’s value exposed in pybox?

here is my non working nuke script btw (modified from @tpo’s shared script) :

#! /opt/Nuke13.2v4/libnuke-13.2.4.so -nx
version 13.2 v4
define_window_layout_xml {<?xml version="1.0" encoding="UTF-8"?>
<layout version="1.0">
    <window x="0" y="27" w="2560" h="1376" maximized="1" screen="0">
        <splitter orientation="1">
            <split size="40"/>
            <dock id="" hideTitles="1" activePageId="Toolbar.1">
                <page id="Toolbar.1"/>
            </dock>
            <split size="1897" stretch="1"/>
            <splitter orientation="2">
                <split size="783"/>
                <dock id="" activePageId="Viewer.1">
                    <page id="Viewer.1"/>
                </dock>
                <split size="550"/>
                <dock id="" activePageId="DAG.1" focus="true">
                    <page id="DAG.1"/>
                    <page id="Curve Editor.1"/>
                    <page id="DopeSheet.1"/>
                </dock>
            </splitter>
            <split size="615"/>
            <dock id="" activePageId="Properties.1">
                <page id="Properties.1"/>
                <page id="uk.co.thefoundry.backgroundrenderview.1"/>
            </dock>
        </splitter>
    </window>
</layout>
}
Root {
 inputs 0
 name /disks/nas0/CGI/R_n_D/work.stefan/flame_python/pybox/pybox_nuke/nuke_scripts/driven_blur.nk
 format "2048 1556 0 0 2048 1556 1 2K_Super_35(full-ap)"
 proxy_type scale
 proxy_format "1024 778 0 0 1024 778 1 1K_Super_35(full-ap)"
 colorManagement OCIO
 OCIO_config custom
 customOCIOConfigPath /disks/nas0/CGI/R_n_D/colorManagement/Color_transforms/OpenColorIO/ocio_v2/studio-config-v1.0.0_aces-v1.3_ocio-v2.0.ocio
 defaultViewerLUT "OCIO LUTs"
 workingSpaceLUT scene_linear
 monitorLut "sRGB - Display/ACES 1.0 - SDR Video"
 monitorOutLUT "ACES 1.0 - SDR Video (sRGB - Display)"
 int8Lut matte_paint
 int16Lut texture_paint
 logLut compositing_log
 floatLut scene_linear
}
BackdropNode {
 inputs 0
 name from_flame
 tile_color 0x213244ff
 gl_color 0x71a4b5ff
 label "From Flame"
 note_font_size 24
 note_font_color 0x777777ff
 xpos -673
 ypos -428
 border_width 0
 bdwidth 260
 bdheight 222
}
BackdropNode {
 inputs 0
 name to_flame
 tile_color 0x213649ff
 gl_color 0x435c6bff
 label "To Flame"
 note_font "DejaVu LGC Sans"
 note_font_size 24
 note_font_color 0x666666ff
 xpos -78
 ypos -430
 bdwidth 281
 bdheight 257
}
Read {
 inputs 0
 format "1536 790 0 0 1536 790 1 HD_1536"
 origset true
 name adsk_1_Front
 xpos -593
 ypos -339
}
Dot {
 name Dot2
 xpos -390
 ypos -312
}
Blur {
 size {{adsk_UI.adsk_blur x1 0}}
 name Blur1
 xpos -343
 ypos -322
}
Dot {
 name Dot1
 xpos -198
 ypos -312
}
set Nacd1050 [stack 0]
Shuffle {
 alpha white
 name Shuffle1_rgb_only
 xpos -18
 ypos -337
}
Write {
 in_colorspace linear
 out_colorspace linear
 name adsk_1_Result
 xpos 92
 ypos -337
 addUserKnob {20 caravr l CaraVR}
 addUserKnob {4 viewPresets l "View Presets" M {main stereo cams "stereo cams" all}}
 addUserKnob {22 set l Set -STARTLINE T "w = nuke.thisNode()\nscriptViews = nuke.views()\nviewPreset = w\['viewPresets'].getValue()\nselectedViews = None\nif viewPreset == 0:\n  selectedViews = \['main']\nif viewPreset == 1:\n  stereoViews = \['left', 'right']\n  if set(stereoViews).issubset(set(scriptViews)):\n    selectedViews = stereoViews\n  else:\n    selectedViews = None\nelif viewPreset == 2:\n  selectedViews = \[v for v in scriptViews if 'cam' in v and not ('_left' in v or '_right' in v)]\nelif viewPreset == 3:\n  selectedViews = \[v for v in scriptViews if 'cam' in v and ('_left' in v or '_right' in v)]\nelif viewPreset == 4:\n  selectedViews = scriptViews\nif selectedViews:\n  w\['views'].fromScript(' '.join(selectedViews))\n"}
}
push $Nacd1050
Shuffle {
 red alpha
 green alpha
 blue alpha
 name Shuffle2_alpha
 xpos -25
 ypos -242
}
Write {
 in_colorspace linear
 out_colorspace linear
 name adsk_2_OutMatte
 xpos 85
 ypos -242
 addUserKnob {20 caravr l CaraVR}
 addUserKnob {4 viewPresets l "View Presets" M {main stereo cams "stereo cams" all}}
 addUserKnob {22 set l Set -STARTLINE T "w = nuke.thisNode()\nscriptViews = nuke.views()\nviewPreset = w\['viewPresets'].getValue()\nselectedViews = None\nif viewPreset == 0:\n  selectedViews = \['main']\nif viewPreset == 1:\n  stereoViews = \['left', 'right']\n  if set(stereoViews).issubset(set(scriptViews)):\n    selectedViews = stereoViews\n  else:\n    selectedViews = None\nelif viewPreset == 2:\n  selectedViews = \[v for v in scriptViews if 'cam' in v and not ('_left' in v or '_right' in v)]\nelif viewPreset == 3:\n  selectedViews = \[v for v in scriptViews if 'cam' in v and ('_left' in v or '_right' in v)]\nelif viewPreset == 4:\n  selectedViews = scriptViews\nif selectedViews:\n  w\['views'].fromScript(' '.join(selectedViews))\n"}
}
Viewer {
 inputs 0
 frame 1
 frame_range 1-100
 viewerProcess "ACES 1.0 - SDR Video (sRGB - Display)"
 name Viewer1
 xpos 234
 ypos -289
}
Group {
 inputs 0
 name adsk_UI
 xpos -342
 ypos -422
 addUserKnob {20 User}
 addUserKnob {7 adsk_blur R 0 100}
 adsk_blur 50.5
}
 Input {
  inputs 0
  name Input1
  xpos 0
 }
 Output {
  name Output1
  xpos 0
  ypos 300
 }
end_group

And the error I’m getting in Flame (and also the UI doesn’t have the exposed parameter):

Traceback (most recent call last):
  File "/opt/Autodesk/shared/presets/pybox/tmp48", line 147, in <module>
    _main(sys.argv[1:])
  File "/opt/Autodesk/shared/presets/pybox/tmp48", line 140, in _main
    p.dispatch()
  File "/Volumes/F2000-01/discreet/shared/presets/pybox/pybox_v1.py", line 530, in dispatch
    getattr(self, self.state_id)()
  File "/opt/Autodesk/shared/presets/pybox/tmp48", line 110, in execute
    self.initialize()
  File "/opt/Autodesk/shared/presets/pybox/tmp48", line 69, in initialize
    self.setup_ui()
  File "/opt/Autodesk/shared/presets/pybox/tmp48", line 85, in setup_ui
    self.add_render_elements(value)
  File "/Volumes/F2000-01/discreet/shared/presets/pybox/pybox_v1.py", line 1114, in add_render_elements
    raise ValueError("Element has no name")
ValueError: Element has no name

EDIT:
A weird thing is that if i delete the ‘controller’ (adsk_UI) and resave the nk script it works, then undo and save again … bam, the pybox doesn’t complain and from there if i change the value in nuke (in the adsk_UI node) and resave, it updates in flame. Still no exposed parameter in Flame though, no added field in the pybox UI

hey @Stefan attached here nuke script with Blur expose to Flame, Edited your nk


Archive.zip (2.9 KB)

2 Likes

Thanks a lot @tpo Thiago, much appreciated!

I see that you don’t use a no-op or group node with expression link in the blur node, interesting.

Is this with the adsk example handler? (with the 2 paths modified of course)

There’s gotta be something wrong on my system, it’s still failing with the ‘Element has no value’ ValueError, not displaying a result and not showing the size fields, like before it’s not even showing the editor button.

Have you encountered something like this in the past? right permissions maybe?
This is with flame 2023.2 and nuke 13.2v4 btw.

Hey @Stefan it might be your system, not sure.

Anyways i recorded this video showing step by step, hope this helps you or anyone that is interesting in

6 Likes

Fantastic! Thanks a lot @tpo Thiago, very kind and helpful!!!

1 Like

Hey Guys.

Is it possible to launch Nuke X instead or regular Nuke? I can get Nuke to work with pybox, but not Nuke X. I’ve tried to add “–nukex” where it made sense, but no luck so far.

You can try setting an alias in your shell to be

alias nuke=“nuke —nukex”

Or something like that

1 Like

Thank you for the suggestion!
While it didn’t help my launch NukeX in Pybox, it will save me a lot of time.