Some Flags

Written by John Benson on .

Using flags can be frustrating because not all flags are easily accessed or documented. Create a flags.py file and you have a simple way to easily get at them. Thanks to Nathan and Dee for the tip on where to find them. I'm not sure what context you would use all these or if they are all valid from within python, but the flags I've used from here all work.

"""
flags.py
Created by jrab on 12/1/10.
nuke flags for easy access from /include/DDImage/Knob.h

these can be accessed most likely with
knob.setFlag(nuke.<flag>)
If you add this file, it would be
knob.setFlag(flags.<flag>)
or if you reference the hex value directly and want to be mysterious:
knob.setFlag(<hex value>)

These are updated for nuke 6.2 with added comments.
Flags new in 6.2:
READ_ONLY, GRANULARY_UNDO, NO_RECURSIVE_PATHS

Updated 05/29/12
Flags new in 6.3:
KNOB_CHANGED_RECURSIVE, MODIFIES_GEOMETRY, OUTPUT_ONLY,
NO_KNOB_CHANGED_FINISHED, SET_SIZE_POLICY, EXPAND_TO_WIDTH

Updated 08/12/13
Flags new in 7.0v8:
NEVER_DRAW_HANDLES, KNOB_CHANGED_RIGHTCONTEXT, DONT_SAVE_TO_NODEPRESET,
READ_ONLY_IN_SCRIPTS, NO_SCRIPT_EXECUTE, COLORCHIP_PRESERVE_ALPHA

Updated 09/12/17
Filled in missing docs and flags from 10.5
Flags not in 7.0v8 and below - not sure when they were introduced, but these are in 10.5
RESERVED_COLORCHIP_KNOB, ALWAYS_ALIGN_LABEL_TOP, TINY_SLIDER, HIDE_ANIMATION_AND_VIEWS,
NO_COLOR_DROPDOWN, NODEGRAPH_ONLY, MODIFIES_TIME, TOOLBAR_BUTTON_DRAWSTYLE,
NO_TCL_ERROR, EXPAND_TO_CONTENTS, EXACT_MATCH_ONLY, STRIP_CASCADE_PREFIX
SINGLE_SELECTION_ONLY, SHOW_BUTTONS

"""

# General flags (must not intersect any class-specific flags):
DISABLED = 0x0000000000000080 # DISABLED Set by disable(), cleared by enable().
NO_ANIMATION = 0x0000000000000100 # NO_ANIMATION Prevent the value from being animated.
# This removes any anymation or view buttons, and
# it stops tcl expressions from being evaluated in
# string knobs, and may make it ignore attempts to
# set expressions or key frames (nyi).
DO_NOT_WRITE = 0x0000000000000200 # DO_NOT_WRITE Don't ever save this knob to a script
# (including copy & paste!)
INVISIBLE = 0x0000000000000400 # INVISIBLE The knob does not appear in the panels.
# No widgets are created. This is not the same
# as hide(), and show() will not undo it!
RESIZABLE = 0x0000000000000800 # RESIZABLE The knob can stretch in the panel so
# that it fills up all the remaining space in the line.
# Defaults to true for most of the complex knobs,
# but off for buttons, checkmarks, and pulldown lists.
STARTLINE = 0x0000000000001000 # STARTLINE This knob starts a new row in the panel.
# The default is true unless a zero-length (not NULL)
# string is passed as the label. Currently the default
# is false for checkmarks and buttons but this may
# change in future versions.
ENDLINE = 0x0000000000002000 # ENDLINE This knob will end a row, acts exactly
# like STARTLINE was set on the next knob.
# Set true for divider lines.
NO_RERENDER = 0x0000000000004000 # NO_RERENDER This knob does not contribute to the
# hash value for the op. This should be used on knobs
# that have no effect on the op's output.
NO_HANDLES = 0x0000000000008000 # NO_HANDLES Don't draw anything in the viewer,
# this is useful if the Op draws it's own indicators.
KNOB_CHANGED_ALWAYS = 0x0000000000010000 # KNOB_CHANGED_ALWAYS will call node()->knob_changed()
# every time the value of the knob changes. Normally
# it is only called if the user changes the value with
# the panel open. This allows you to track all changes to
# the value. Be careful as knob_changed() will be called
# without storing the new values into your structure.
NO_KNOB_CHANGED = 0x0000000000020000 # NO_KNOB_CHANGED: Don't bother calling Op::knob_changed()
# with this knob. This is turned on automatically
# if the knob_changed() returns false.
HIDDEN = 0x0000000000040000 # HIDDEN Set by hide(), cleared by show().
NO_UNDO = 0x0000000000080000 # NO_UNDO Don't undo/redo any changes to this knob.
# May be replaced with "output knob" in the future.
ALWAYS_SAVE = 0x0000000000100000 # ALWAYS_SAVE save the knob to a script even if not_default()
# returns false. *Deprecated*, instead override not_default()
# and make it return true!
NODE_KNOB = 0x0000000000200000 # NODE_KNOB is used by Nuke internally for controls on
# the DAG appearance such as xpos and ypos.
HANDLES_ANYWAY = 0x0000000000400000 # HANDLES_ANYWAY makes the handles appear in the viewer
# when the panel is open even if a different tab is selected.
INDETERMINATE = 0x0000000000800000 # Presents a blacked out undefined value interface on supporting knobs.
COLOURCHIP_HAS_UNSET = 0x0000000001000000 # whether a color chip can be in the 'unset' state,
# DEFAULTS TO FALSE
SMALL_UI = 0x0000000002000000 # Switches param panel widget to be more viewer Toolbar friendly in
# supported knobs (eg Button).
NO_NUMERIC_FIELDS = 0x0000000004000000 # Disables numeric input box widget on supported knobs.
KNOB_CHANGED_RECURSIVE = 0x0000000008000000 # recursive knobChanged calls are guarded against.
# To override the non-recursion on a particular knob,
# specify this flag
READ_ONLY = 0x0000000010000000 # knob cannot be modified by UI intervention but can
# still be copied from etc
NO_CURVE_EDITOR = 0x0000000020000000 # Disables curve editor.
NO_MULTIVIEW = 0x0000000040000000 # Disables view menu and splitting when in a multiview script.
EARLY_STORE = 0x0000000080000000 # Forces early synchronisation of data allowing usage in pre-op calls
# such as split_input().

MODIFIES_GEOMETRY = 0x0000000100000000 # MODIFIES_GEOMETRY should be set for any knob
# that modifies geometry, either by affecting the
# internal geometry directly or by changing its transform
OUTPUT_ONLY = 0x0000000200000000 # Similar to READ_ONLY & NO_RERENDER together - data changes don't
# count as a script change.
NO_KNOB_CHANGED_FINISHED = 0x0000000400000000 # Prevents knob_changed_finished being called on value change.
# Set if prev call returned false.
SET_SIZE_POLICY = 0x0000000800000000 # Do not use.
EXPAND_TO_WIDTH = 0x0000001000000000 # Force knob to expand to fill available space
# only for Enum knobs currently
NEVER_DRAW_HANDLES = 0x0000002000000000 # Disables viewer widget handles from drawing.
# Unlike the NO_HANDLES flag,
# the state of this flag will never change internally within Nuke
KNOB_CHANGED_RIGHTCONTEXT= 0x0000004000000000 # Always call knob_changed on a properly cooked Op,
# even if KNOB_CHANGED_ALWAYS is on
DONT_SAVE_TO_NODEPRESET = 0x0000008000000000 # This value of this knob should never be saved to a NodePreset.
# Can be used, for example, for data knobs.
RESERVED_COLORCHIP_KNOB = 0x0000010000000000 # DO NOT USE. This value is used by the colorchip knob.
READ_ONLY_IN_SCRIPTS = 0x0000020000000000 # Prevents knobs from being modified from Python/Tcl
ALWAYS_ALIGN_LABEL_TOP = 0x0000040000000000 # Label is always aligned to the top of the Knob
TINY_SLIDER = 0x0000080000000000 # Modifies SLIDER to be a tiny slider underneath lineedit.
# Should be a numeric knob flag but we've overrun the < 0x80 condition.
HIDE_ANIMATION_AND_VIEWS = 0x0000100000000000 # Prevents Animation Curve_Knob and Views being shown.
# Animation is still possible, unless NO_ANIMATION is set of course.
NO_COLOR_DROPDOWN = 0x0000200000000000 # Prevents Color Panel Dropdown from being available.
# Popup color panel will stil be available.
NODEGRAPH_ONLY = 0x0000400000000000 # Indicate that this knob should only be displayed when using
# the NodeGraph, since the Timeline uses gpuEngine,
# which might not support all the same knobs.
MODIFIES_TIME = 0x0001000000000000 # Should be set on all knobs which modify timing
TOOLBAR_BUTTON_DRAWSTYLE = 0x0002000000000000 # This knob must be drawn in the style of Viewer toolbar knobs
NO_SCRIPT_EXECUTE = 0x0000800000000000 # Prevents 'execute' being called on the knob

# Numeric knobs:
MAGNITUDE = 0x0000000000000001 # MAGNITUDE If there are several numbers, this enables a
# button to only show a single number, and all are set equal
# to this number. Default is true for WH_knob() and Color_knob().
SLIDER = 0x0000000000000002 # SLIDER Turns on the slider. Currently this only works if the size
# is 1 or MAGNITUDE is enabled and it is set to single numbers.
# Defaults to on for most non-integer numerical controls.
LOG_SLIDER = 0x0000000000000004 # LOG_SLIDER Tick marks on the slider (if enabled with SLIDER)
# are spaced logarithmically. This is turned on for WH_knob()
# and Color_knob(), and if the range has both ends greater
# than zero. If you turn this on and the range passes
# through zero, the scale is actually the cube root of
# the number, not the logarithim.
STORE_INTEGER = 0x0000000000000008 # STORE_INTEGER Only integer values should be displayed or stored.
FORCE_RANGE = 0x0000000000000010 # FORCE_RANGE Clamps the value to the range when storing.
ANGLE = 0x0000000000000020 # ANGLE Turn on a little widget depicting this number as an angle.
NO_PROXYSCALE = 0x0000000000000040 # NO_PROXYSCALE disables proxy scaling for XY or WH knobs.
# Useful if you just want two numbers called "x" and "y"
# that are not really a position.
# You probably also want to do NO_HANDLES.

# String Knobs
GRANULAR_UNDO = 0x0000000000000001 # Disables concatenation of minor undo events (string knobs)
NO_RECURSIVE_PATHS = 0x0000000000000002 # Badly named. Actually disables relative paths (string knobs).
NO_TCL_ERROR = 0x0000000000000004 # For strings containing TCL expressions,
# don't replace with TCL error messages if an error occurs

# Enumeration
SAVE_MENU = 0x0000000002000000 # SAVE_MENU writes the contents of the menu to the saved script.
# Useful if your plugin modifies the list of items.
EXPAND_TO_CONTENTS = 0x0000000000000001 # Make Enumeration knobs adjust their width to the size of the
# largest munu item.
EXACT_MATCH_ONLY = 0x0000000000000002 # Make Enumeration knobs use exact match when setting a value.
# If an attempt is made to set an invalid value,
# the knob will be put into an Error state.
STRIP_CASCADE_PREFIX = 0x0000000000000004 # Make Cascading Enumeration knobs not serialise out
# cascading prefixes

# SceneView knob
SINGLE_SELECTION_ONLY = 0x0000000000000001 # Knob only allows one item to be selected at a time
SHOW_BUTTONS = 0x0000000000000002 # Show Add Layer/Delete Layer buttons

# BeginGroup
CLOSED = 0x0000000000000001 # Stores the open/closed state of group knobs (group knobs).
TOOLBAR_GROUP = 0x0000000000000002 # Make the group into a viewer toolbar. General used via
# BeginToolbar (group knobs).
TOOLBAR_LEFT = 0x0000000000000000 # Defines which side of viewer toolbar appears on.
# Pick one at toolbar construction time (toolbar).
TOOLBAR_TOP = 0x0000000000000010 # Defines which side of viewer toolbar appears on.
# Pick one at toolbar construction time (toolbar).
TOOLBAR_BOTTOM = 0x0000000000000020 # Defines which side of viewer toolbar appears on.
# Pick one at toolbar construction time (toolbar).
TOOLBAR_RIGHT = 0x0000000000000030 # Defines which side of viewer toolbar appears on.
# Pick one at toolbar construction time (toolbar).
TOOLBAR_POSITION = 0x0000000000000030 # A mask for the position part of the flags

# ChannelSet/Channel:
NO_CHECKMARKS = 0x0000000000000001 # Disable individual channel checkbox widgets
# (channel/channelset knobs).
NO_ALPHA_PULLDOWN = 0x0000000000000002 # Disable 4th channel pulldown widget (channel/channelset knobs).

# Format knob
PROXY_DEFAULT = 0x0000000000000001 # Sets default knob value from script proxy format rather
# than full res (format knob).

COLORCHIP_PRESERVE_ALPHA = 0x0000010000000000 # The ColorChip_knob discards alpha values by default.
# Set this flag to make it keep them, instead.

 

jrab

You have no rights to post comments

We have 2881 guests and 80 members online