DD::Image::ShapeKnob Class Referenceabstract

Inherits DD::Image::Knob.

Public Types

enum  {
  DELETE_KEY, MAYBE_SET_KEY, SET_KEY, ADD_KEY,
  NO_ANIMATION, AUTOKEY_ON, AUTOKEY_OFF, EDIT_CURVE,
  COPY_KEY, PASTE_KEY, COPY_ALL, PASTE_ALL,
  SPLIT, UNSPLIT
}
 
- Public Types inherited from DD::Image::Knob
enum  CallbackReason { kDestroying, kIsVisible, kUpdateWidgets, kChanged }
 
enum  HandleType {
  INVALID, POSITION, SELECTABLE, DISTANCE_FROM_POINT,
  DISTANCE_WITH_SNAP, ANYWHERE, ANYWHERE_MOUSEMOVES, ANYWHERE_KEY_PRESSED,
  SELECTED_BY_THIS
}
 
enum  HandleFlags { HOVER, USE_CURRENT_COLOR, LOW_PRIORITY, DO_HANDLE_CALLBACK_ON_SHIFT_SELECT }
 
typedef std::vector< int > SelectedIndexVector
 
typedef U64 FlagMask
 
typedef int(* Callback) (void *closure, CallbackReason)
 
typedef std::vector< int > TKnobIndices
 
typedef bool( HandleBatch) (ViewerContext *ctx, Knob *, const int focusIndex, const TKnobIndices &indices)
 
typedef bool( Handle) (ViewerContext *ctx, Knob *, int index)
 

Public Member Functions

 ShapeKnob (Knob_Closure *cb, const char *name, const char *shapename="shape", const char *label=nullptr)
 
int keys () const
 
float time (int key) const
 
float shape (double time) const
 Evaluate the shape curve at time. If the time is between two keys, this will return a number between those two key numbers. If there are less than 2 keys this always returns 0. More...
 
bool is_animated () const
 
virtual bool keyable () const =0
 
bool autokey () const
 
virtual bool from_script (const char *v)=0
 
virtual void to_script (std::ostream &, const OutputContext *, bool quote) const =0
 
int get_key_list (std::set< int > &) const
 
- Public Member Functions inherited from DD::Image::Knob
void setClaimedName (const std::string &claimedName)
 
const std::string & claimedName ()
 
void setDefaultName (const std::string &defaultName)
 
void setDrawHandleTypes (DrawHandleTypeMask drawHandleTypes)
 
DrawHandleTypeMask drawHandleTypes () const
 
const std::string & defaultName () const
 
 Knob (Knob_Closure *c, const char *name, const char *label=nullptr)
 
virtual const char * Class () const =0
 
virtual int ClassID () const
 
virtual ArrayKnobI * arrayKnob ()
 
virtual ResizableArrayKnobI * resizableArrayKnob ()
 
virtual StringKnobI * stringKnob ()
 
virtual ScriptKnobI * scriptKnob ()
 
virtual Enumeration_KnobIenumerationKnob ()
 
virtual Colorspace_KnobIcolorspaceKnob ()
 
virtual SceneView_KnobIsceneViewKnob ()
 
virtual MultiArray_KnobImultiArrayKnob ()
 
virtual List_KnobI * listKnob ()
 
virtual Table_KnobI * tableKnob ()
 
virtual Geo_KnobI * geoKnob ()
 
virtual Axis_KnobI * axisKnob ()
 
virtual PositionVector_KnobIpositionVectorKnob ()
 
virtual PluginPython_KnobI * pluginPythonKnob ()
 
virtual GeoSelect_KnobI * geoSelectKnob ()
 
virtual ControlPointCollection_KnobI * controlPointCollectionKnob ()
 
virtual MetaKeyFrame_KnobI * metaKeyFrameKnob ()
 
virtual TransformJack_KnobI * transformJackKnob ()
 
virtual Transform2d_KnobI * transform2dKnob ()
 
virtual Ripple_KnobI * rippleKnob ()
 
virtual File_KnobIfileKnob ()
 
virtual LookupCurves_KnobIlookupCurvesKnob ()
 
virtual ColorKnobI * colorKnob ()
 
virtual AnimationHolderI * animationKnob ()
 
virtual LinkKnobI * linkKnob ()
 
VersionNumbers * version ()
 
VersionNumbers * version () const
 
Node * node () const
 
void set_node (Node *n)
 
Opop () const
 
const std::string & name () const
 
void name (const char *p)
 
bool is (const char *v) const
 
bool startsWith (const char *v) const
 
const std::string & label () const
 
const std::string & labelToUse () const
 
bool labelNotNull () const
 
void label (const char *)
 
bool canCopyValue () const
 
bool canSaveValueToPreset () const
 
std::string fullyQualifiedName (int idx=-1) const
 
const char * label_c_str () const
 
const char * name_c_str () const
 
const std::string & tooltip () const
 
void tooltip (const std::string &p)
 
void flags (FlagMask f) noexcept
 
void set_flag (FlagMask f) noexcept
 
void clear_flag (FlagMask f) noexcept
 
void invert_flag (FlagMask f) noexcept
 
void set_flag (FlagMask f, bool b) noexcept
 
FlagMask flags () const noexcept
 
bool flag (FlagMask f) const noexcept
 
bool any_of (FlagMask f) const noexcept
 
bool all_of (FlagMask f) const noexcept
 
virtual bool priority_undo () const
 
virtual WidgetPointer make_widget (const WidgetContext &context)
 this is the new version for 7.0 onwards More...
 
virtual WidgetPointer make_secondary_widget (const WidgetContext &context)
 
virtual void updateUI (const OutputContext &)
 
void addCallback (Callback cb, void *closure)
 
void removeCallback (Callback cb, void *closure)
 
bool isCallbackRegistered (Callback cb, void *closure) const
 
bool isEnabled () const
 
void enable ()
 
void disable ()
 
virtual void enable (bool)
 
virtual bool disabledDueToLicensing () const
 
virtual bool isReadOnly () const
 
void setReadOnly (bool value)
 
bool isReadOnlyInScripts () const
 
void setReadOnlyInScripts ()
 
bool isVisible () const
 
bool isHandleVisible () const
 
int openLinkCount () const
 the number of panels open which contain a link knob pointing at this knob
 
virtual void openLink ()
 increase the openLinkCount
 
virtual void closeLink ()
 decrease the openLinkCount
 
void hide ()
 
void show ()
 
void visible (bool)
 
bool isOpen () const
 
void open ()
 
void close ()
 
void open (bool)
 
bool isPushed () const
 
void pushed (bool p)
 
Knobknob (const char *) const
 
Knobknob (int) const
 
bool node_disabled () const
 
bool panel_visible () const
 
bool node_selected () const
 
unsigned node_gl_color () const
 
bool script_command (const char *command, bool py=true, bool eval=true) const
 
bool script_expand (const char *str, int what=1) const
 
virtual void reset_to_default ()
 
virtual bool build_handle (ViewerContext *)
 
void add_draw_handle (ViewerContext *)
 
virtual void draw_handle (ViewerContext *)
 
void begin_handle (HandleContext command, ViewerContext *ctx, Handle *cb, int index, const DD::Image::Vector3 &pos, ViewerContext::Cursor cursor=ViewerContext::kNoCursor)
 
void begin_handle (ViewerContext *ctx, Handle *cb, int index, const DD::Image::Vector3 &pos, ViewerContext::Cursor cursor=ViewerContext::kNoCursor)
 
void begin_handle (HandleContext command, ViewerContext *ctx, Handle *cb, int index, float x=0, float y=0, float z=0, ViewerContext::Cursor cursor=ViewerContext::kNoCursor)
 
void begin_handle (ViewerContext *ctx, Handle *cb, int index, float x=0, float y=0, float z=0, ViewerContext::Cursor cursor=ViewerContext::kNoCursor)
 
void end_handle (ViewerContext *ctx)
 
void make_handle (HandleContext command, ViewerContext *ctx, Handle *cb, const int index, const DD::Image::Vector3 &pos, const ViewerContext::Cursor cursor=ViewerContext::kNoCursor)
 
void make_handle (ViewerContext *ctx, Handle *cb, const int index, const DD::Image::Vector3 &pos, const ViewerContext::Cursor cursor=ViewerContext::kNoCursor)
 
void make_handle (HandleContext command, ViewerContext *ctx, Handle *cb, const int index, const float x, const float y, const float z=0.0f, const ViewerContext::Cursor cursor=ViewerContext::kNoCursor)
 
void make_handle (ViewerContext *ctx, Handle *cb, const int index, const float x, const float y, const float z=0.0f, const ViewerContext::Cursor cursor=ViewerContext::kNoCursor)
 
bool is_selected (ViewerContext *ctx, Handle *cb, int index) const
 
virtual bool is_selected (ViewerContext *ctx, int index) const
 
void get_selected_indices (Handle *cb, SelectedIndexVector &allIndices) const
 
bool clear_selected (ViewerContext *)
 
bool toggle_selected (ViewerContext *ctx, Handle *cb, int index)
 
virtual bool toggle_selected (ViewerContext *ctx, int index)
 
bool is_focused (ViewerContext *, Handle *cb, int index)
 
int selection_size (ViewerContext *)
 
void add_to_undo ()
 
void stop_add_to_undo ()
 
void new_undo (const char *name=nullptr)
 
void force_new_undo (const char *name=nullptr)
 
void extra_undo ()
 
void new_undo (const void *controller)
 
bool doingUndoRedo ()
 
virtual Knobundoer ()
 
void setUndoer (Knob *undoer)
 
void new_nudge_undo ()
 
void undo ()
 
void redo ()
 
virtual void changed ()
 
void updateWidgets ()
 
void asapUpdate ()
 
void asapUpdate (const Box &box, int direction=0)
 
void redraw ()
 
void undoless (bool undoless)
 
const OutputContextuiContext () const
 
const Formatinput_format () const
 
virtual void store (StoreType, void *p, Hash &hash, const OutputContext &context)
 
virtual void append (Hash &hash, const OutputContext *context)
 
virtual int get_key_list (std::set< int > &keylist, int index) const
 
virtual bool splitForViews () const
 
virtual ViewSet storedViews () const
 
virtual bool keyframesDisplayed () const
 
bool set_text (const char *v)
 
bool to_double (const char *, double &result)
 
bool to_int (const char *, int &result)
 
bool to_bool (const char *, bool &result)
 
virtual const char * get_text (const OutputContext *=nullptr) const
 
virtual void to_script_prefix (std::ostream &) const
 
virtual void to_script_userknob (std::ostream &) const
 
virtual bool not_default () const
 
void * pyObject ()
 
void setPyObject (void *s)
 
KnobImpl * pImpl ()
 
- Public Member Functions inherited from DD::Image::ValueStuffI
virtual int value_stuff (int what, ValueStuffArg *user=nullptr) const
 
bool set_value (double v, int channel=-1)
 
bool set_value_at (double v, double time, int channel=-1)
 
bool set_value_at_view (double v, double time, int view, int channel=-1)
 
bool set_key (int channel=-1, int view=-1)
 
bool set_key_at (double time, int channel=-1, int view=-1)
 
bool set_values (const double *array, int n)
 
bool set_values_at (const double *array, int n, double time)
 
bool set_values (const float *array, int n)
 
bool set_values_at (const float *array, int n, double time)
 
bool set_values (const int *array, int n)
 
bool set_values_at (const int *array, int n, double time)
 
bool set_values (const U64 *array, int n)
 
bool set_values_at (const U64 *array, int n, double time)
 
bool remove_key (int channel=-1)
 
bool remove_key_at (double time, int channel=-1, int view=-1)
 
void set_range (double a, double b, bool force=false)
 
void set_animation (const char *a, int channel=-1)
 
bool is_key_at (double time, int channel=-1, int view=-1) const
 
bool is_key (int channel=-1) const
 
double get_value (int channel=0) const
 
double get_value_at (double time, int channel=0) const
 
double get_value_at_view (double time, int view, int channel=0) const
 
double get_value_at (const OutputContext &oc, int channel=0) const
 
bool set_expression (const char *v, int channel, int view=-1)
 
int getNumKeys (int channel=-1, int view=-1) const
 
int getKeyIndex (double &time, int channel=-1, int view=-1) const
 
bool split_view (int view)
 
bool unsplit_view (int view)
 
void getKeyFrame (int keyindex, double &x, double &y, double &lslope, double &rslope, double &la, double &ra, unsigned char &interp, unsigned char &extrap, int channel, int view=-1) const
 
void setKeyFrame (int keyindex, double x, double y, double lslope, double rslope, double la, double ra, unsigned char interp, unsigned char extrap, int channel, int view=-1) const
 
void addKeyFrame (double x, double y, double lslope, double rslope, double la, double ra, unsigned char interp, unsigned char extrap, int channel, int view=-1) const
 
void get_expression (std::string &expr, int channel=-1, int view=-1)
 
double getKeyTime (int keyindex, int channel=-1, int view=-1) const
 
double getDerivative (double time, int channel=0, int view=-1) const
 
double getNthDerivative (int n, double time, int channel=0, int view=-1) const
 
double getIntegral (double t1, double t2, int channel=0, int view=-1) const
 
double getInverse (double value, int channel=0, int view=-1) const
 
double getInverseGeneral (double value, int channel=0, int view=-1) const
 
bool set_animated (int channel=-1) const
 
bool is_animated (int channel=-1)
 
bool clear_animated (int channel=-1)
 
bool clear_animated_view (int view, int channel=-1)
 
bool set_animated_view (int view, int channel=-1)
 
bool is_animated_view (int view, int channel=-1)
 
bool toggle ()
 
bool set_input (int input)
 

Public Attributes

Knobi
 points at a ShapeController_Knob
 

Protected Member Functions

bool handle (int event, double frame)
 
virtual bool goto_shape (float shape, const DD::Image::OutputContext &context)=0
 
bool goto_context (const DD::Image::OutputContext &oc)
 
bool goto_frame (float frame)
 
bool keys (int n, float delta=1)
 
bool set_key_at (double time)
 
bool maybe_set_key ()
 
bool no_animation ()
 

Friends

class ::ShapeController_Knob
 

Additional Inherited Members

- Static Public Member Functions inherited from DD::Image::Knob
static void addTooltipOverride (const std::string &knob, const std::string &tooltip)
 
static const char * script_result (bool py=false)
 
static void script_unlock ()
 
static int message (char t, const char *,...)
 
static int vmessage (char t, const char *, va_list)
 
static Indent * indent ()
 
static void error (const char *lpFormat,...)
 
static void warning (const char *lpFormat,...)
 
static void critical (const char *lpFormat,...)
 
static void debug (const char *lpFormat,...)
 
static void error (Knob *lpKnob, const char *lpFormat,...)
 
static void warning (Knob *lpKnob, const char *lpFormat,...)
 
static void critical (Knob *lpKnob, const char *lpFormat,...)
 
static void debug (Knob *lpKnob, const char *lpFormat,...)
 
- Static Public Attributes inherited from DD::Image::Knob
static constexpr const FlagMask DISABLED
 Grey out and lock interface. Prevents copy/paste (see READ_ONLY to allow this).
 
static constexpr const FlagMask NO_ANIMATION
 Disable right click and button animation menu.
 
static constexpr const FlagMask DO_NOT_WRITE
 Disables calling to_script. No writing to script file or copy/paste.
 
static constexpr const FlagMask INVISIBLE
 Disables param and viewer widgets. Cannot be made visible again. See HIDDEN for this.
 
static constexpr const FlagMask RESIZABLE
 Allows more complex knobs to resize param panel to fill available space.
 
static constexpr const FlagMask STARTLINE
 Start a new line in the param panel before knob widget.
 
static constexpr const FlagMask ENDLINE
 Start a new line in the param panel after knob widget.
 
static constexpr const FlagMask NO_RERENDER
 Removes knob from Op hash calculation, preventing rerendering on value change.
 
static constexpr const FlagMask NO_HANDLES
 Disables viewer widget handles from drawing.
 
static constexpr const FlagMask KNOB_CHANGED_ALWAYS
 Always calls knob_changed, regardless of whether it has previously returned false.
 
static constexpr const FlagMask NO_KNOB_CHANGED
 Prevents knob_changed being called on value change. Set if prev knob_changed returned false.
 
static constexpr const FlagMask HIDDEN
 Disables param panel and viewer widgets. Can be managed dynamically with show/hide.
 
static constexpr const FlagMask NO_UNDO
 Disables laying down of undo/redo points.
 
static constexpr const FlagMask ALWAYS_SAVE
 Forces data to always be written regardless. Deprecated. Override not_default instead.
 
static constexpr const FlagMask NODE_KNOB
 For internal use only.
 
static constexpr const FlagMask HANDLES_ANYWAY
 Force viewer widgets to be visible regardless of current node tab.
 
static constexpr const FlagMask INDETERMINATE
 Presents a blacked out undefined value interface on supporting knobs.
 
static constexpr const FlagMask COLOURCHIP_HAS_UNSET
 Defines whether a color chip can be in the 'unset' state. Defaults to false.
 
static constexpr const FlagMask SMALL_UI
 Switches param panel widget to be more viewer Toolbar friendly in supported knobs (eg Button).
 
static constexpr const FlagMask NO_NUMERIC_FIELDS
 Disables numeric input box widget on supported knobs.
 
static constexpr const FlagMask KNOB_CHANGED_RECURSIVE
 Recursive knob_changed calls are prevented unless overriden using this flag.
 
static constexpr const FlagMask READ_ONLY
 As with DISABLED, except value can be copied from and expression linked against.
 
static constexpr const FlagMask NO_CURVE_EDITOR
 Disables curve editor.
 
static constexpr const FlagMask NO_MULTIVIEW
 Disables view menu and splitting when in a multiview script.
 
static constexpr const FlagMask EARLY_STORE
 Forces early synchronisation of data allowing usage in pre-op calls such as split_input().
 
static constexpr const FlagMask MODIFIES_GEOMETRY
 Should be set on all knobs which modify geometry or associated transforms.
 
static constexpr const FlagMask OUTPUT_ONLY
 Similar to READ_ONLY & NO_RERENDER together - data changes don't count as a script change.
 
static constexpr const FlagMask NO_KNOB_CHANGED_FINISHED
 Prevents knob_changed_finished being called on value change. Set if prev call returned false.
 
static constexpr const FlagMask SET_SIZE_POLICY
 Do not use.
 
static constexpr const FlagMask EXPAND_TO_WIDTH
 Force knob to expand to fill available space. - only for Enum knobs currently.
 
static constexpr const FlagMask NEVER_DRAW_HANDLES
 Disables viewer widget handles from drawing. Unlike the NO_HANDLES flag, the state of this flag will never change internally within Nuke.
 
static constexpr const FlagMask KNOB_CHANGED_RIGHTCONTEXT
 Always call knob_changed on a properly cooked Op, even if KNOB_CHANGED_ALWAYS is on.
 
static constexpr const FlagMask DONT_SAVE_TO_NODEPRESET
 This value of this knob should never be saved to a NodePreset. Can be used, for example, for data knobs.
 
static constexpr const FlagMask RESERVED_COLORCHIP_KNOB
 DO NOT USE. This value is used by the colorchip knob.
 
static constexpr const FlagMask READ_ONLY_IN_SCRIPTS
 Prevents knobs from being modified from Python/Tcl.
 
static constexpr const FlagMask ALWAYS_ALIGN_LABEL_TOP
 Label is always aligned to the top of the Knob.
 
static constexpr const FlagMask TINY_SLIDER
 Modifies SLIDER to be a tiny slider underneath lineedit. Should be a numeric knob flag but we've overrun the < 0x80 condition.
 
static constexpr const FlagMask HIDE_ANIMATION_AND_VIEWS
 Prevents Animation Curve_Knob and Views being shown. Animation is still possible, unless NO_ANIMATION is set of course.
 
static constexpr const FlagMask NO_COLOR_DROPDOWN
 Prevents Color Panel Dropdown from being available. Popup color panel will stil be available.
 
static constexpr const FlagMask NODEGRAPH_ONLY
 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.
 
static constexpr const FlagMask NO_SCRIPT_EXECUTE
 Prevents 'execute' being called on the knob.
 
static constexpr const FlagMask MODIFIES_TIME
 Should be set on all knobs which modify timing.
 
static constexpr const FlagMask TOOLBAR_BUTTON_DRAWSTYLE
 This knob must be drawn in the style of Viewer toolbar knobs.
 
static constexpr const FlagMask FLAGS_LOCKED
 Used to lock modifications to this knobs flags.
 
static constexpr const FlagMask MAGNITUDE
 Enables switchable numeric box & slider to multiple boxes (array knob derived numeric knobs).
 
static constexpr const FlagMask SLIDER
 Enables slider on single numeric knob, or array knob with MAGNITUDE set (numeric knobs).
 
static constexpr const FlagMask LOG_SLIDER
 Switches linear slider to log slider, or cubic depending on range (numeric knobs with SLIDER).
 
static constexpr const FlagMask STORE_INTEGER
 Stores and presents integer value rather than float (numeric knobs).
 
static constexpr const FlagMask FORCE_RANGE
 Forces stored and presented value to be clamped to range set (numeric knobs).
 
static constexpr const FlagMask ANGLE
 Switches widget for angle UI (single value numeric knobs).
 
static constexpr const FlagMask NO_PROXYSCALE
 Disables proxyscaling on knobs supporting it (XY_Knob & WH_Knob derivatives).
 
static constexpr const FlagMask GRANULAR_UNDO
 Disables concatenation of minor undo events (string knobs)
 
static constexpr const FlagMask NO_RECURSIVE_PATHS
 Badly named. Actually disables relative paths (string knobs).
 
static constexpr const FlagMask NO_TCL_ERROR
 For strings containing TCL expressions, don't replace with TCL error messages if an error occurs.
 
static constexpr const FlagMask SAVE_MENU
 Forces menu entries to be written to script. Used by dynamic menus (enumeration knobs).
 
static constexpr const FlagMask EXPAND_TO_CONTENTS
 Make Enumeration knobs adjust their width to the size of the largest munu item.
 
static constexpr const FlagMask EXACT_MATCH_ONLY
 invalid value, the knob will be put into an Error state. More...
 
static constexpr const FlagMask STRIP_CASCADE_PREFIX
 Make Cascading Enumeration knobs not serialise out cascading prefixes.
 
static constexpr const FlagMask SINGLE_SELECTION_ONLY
 Knob only allows one item to be selected at a time.
 
static constexpr const FlagMask SHOW_BUTTONS
 Show Add Layer/Delete Layer buttons.
 
static constexpr const FlagMask CLOSED
 Stores the open/closed state of group knobs (group knobs).
 
static constexpr const FlagMask TOOLBAR_GROUP
 Make the group into a viewer toolbar. General used via BeginToolbar (group knobs).
 
static constexpr const FlagMask TOOLBAR_LEFT
 Defines which side of viewer toolbar appears on. Pick one at toolbar construction time (toolbar).
 
static constexpr const FlagMask TOOLBAR_TOP
 Defines which side of viewer toolbar appears on. Pick one at toolbar construction time (toolbar).
 
static constexpr const FlagMask TOOLBAR_BOTTOM
 Defines which side of viewer toolbar appears on. Pick one at toolbar construction time (toolbar).
 
static constexpr const FlagMask TOOLBAR_RIGHT
 Defines which side of viewer toolbar appears on. Pick one at toolbar construction time (toolbar).
 
static constexpr const FlagMask TOOLBAR_POSITION
 A mask for the position part of the flags.
 
static constexpr const FlagMask NO_CHECKMARKS
 Disable individual channel checkbox widgets (channel/channelset knobs).
 
static constexpr const FlagMask NO_ALPHA_PULLDOWN
 Disable 4th channel pulldown widget (channel/channelset knobs).
 
static constexpr const FlagMask FULL_LAYER_ENABLED
 channel/channelset knobs will always consider every channel in a layer to be enabled.
 
static constexpr const FlagMask PROXY_DEFAULT
 Sets default knob value from script proxy format rather than full res (format knob).
 
static constexpr const FlagMask COLORCHIP_PRESERVE_ALPHA
 The ColorChip_knob discards alpha values by default. Set this flag to make it keep them, instead.
 
static constexpr const FlagMask ALLOW_NUKE_COLORSPACES
 Allows the knob to display Nuke's native colorspaces if Color Management is set to Nuke.
 
static int nudgeController
 
static KnobshowPanel
 passed to Op::knob_changed() when panel opened
 
static KnobhidePanel
 passed to Op::knob_changed() when panel closed
 
static KnobinputChange
 passed to Op::knob_changed() when inputs change
 
static bool undo_state
 true in Op::knob_changed() when called due to undo/redo
 
static void(* pMessageCallback )(const Knob *lpKnob, const OpMessage &lrMessage)
 Callback function for internal use.
 
- Protected Types inherited from DD::Image::ValueStuffI
enum  {
  W_SETVALUES_DBL, W_SETVALUE, W_SETRANGE, W_SETVALUESAT_DBL,
  W_SETVALUES_FLT, W_SETVALUES_INT, W_SETVALUES_INT64, W_SETANIMATION,
  W_SETVALUEAT, W_SETKEY, W_SETKEYAT, W_ISKEYAT,
  W_GETVALUE, W_SETEXPRESSION, W_SETVALUESAT_FLT, W_SETVALUESAT_INT,
  W_SETVALUESAT_INT64, W_GETVALUEAT, W_REMOVEKEY, W_REMOVEKEYAT,
  W_ISKEY, W_GETNUMKEYS, W_GETKEYINDEX, W_GETKEYTIME,
  W_GETDERIVATIVE, W_GETINTEGRAL, W_GETVALUEATVIEW, W_SET_ANIMATED,
  W_IS_ANIMATED, W_CLEAR_ANIMATED, W_TOGGLE, W_SET_INPUT,
  W_SETVALUEAT_VIEW, W_SPLIT_VIEW, W_UNSPLIT_VIEW, W_CLEAR_ANIMATED_VIEW,
  W_IS_ANIMATED_VIEW, W_SET_ANIMATED_VIEW, W_GETKEYFRAME, W_SETKEYFRAME,
  W_ADDKEYFRAME, W_GETEXPRESSION, W_GETINVERSE, W_GETINVERSE_GENERAL
}
 

Detailed Description

This subclass of Knob can be used to manipulate a piece of data that changes over time, such as an animated shape. The Bezier operator uses this. There is also a demo Polygon plugin that you can refer to for an example of the use of this knob.

You must write code to store a set of "key" shapes. You should also store a "current" shape that may be different from any of the keys. You also need to write methods to set the current shape to an interpolation between two shapes, and to add and delete keys and to set a key to the current shape.

Member Enumeration Documentation

anonymous enum

Event numbers for pop-up menu

Constructor & Destructor Documentation

ShapeKnob::ShapeKnob ( Knob_Closure *  cb,
const char *  name,
const char *  shapename = "shape",
const char *  label = nullptr 
)

This creates a child knob that holds the shape animation. The second argument is the name of this knob (and thus the name of the curve for the shape in the shape editor). The third argument is a label for the shape knob, if not given the shapename will be used.

References i.

Member Function Documentation

bool ShapeKnob::handle ( int  event,
double  frame 
)
protected

Do one of DELETE_KEY, MAYBE_SET_KEY, SET_KEY, ADD_KEY, NO_ANIMATIONS, AUTOKEY_ON, or AUTOKEY_OFF, depending on the event. This is useful to make a menu() that does these actions.

bool DD::Image::ShapeKnob::goto_shape ( float  shape,
const DD::Image::OutputContext context 
)
protectedpure virtual

Your subclass must implement this. It should set the "current" shape to an interpolation between two keys. Return true if the new current shape is different than the previous current shape.

Which keys and how much to interpolate them is determined by shape().

bool ShapeKnob::keys ( int  n,
float  delta = 1 
)
protected

Change the number of keys stored in the shape curve and the value returned by keys(). You must reallocate your own storage of keys to match before calling this (it does not callback add_key() or delete_keys()).

If n is less than keys() then the trailing keys are deleted. If n is greater than keys() then delta is used as a spacing in time between each of them and between the first new one and the last old key. If no time has been set for any keys than delta is used as the time for the first one.

Usually you call this in from_script() to set the number of keys.

Returns true if n is different than keys().

bool DD::Image::ShapeKnob::set_key_at ( double  t)
inlineprotected

Stores the current shape as a new key at given time. NYI...

bool DD::Image::ShapeKnob::maybe_set_key ( )
inlineprotected

void ShapeKnob::maybe_set_key()

When the user changes the current shape using the GUI you should call this. If is_animated() is off this will call set_key(0). If is_animated() is on and autokey() is on this calls set_key() (which will either set the current key or create a new one). If is_animated() is on but autokey() is off this does nothing.

This calls Knob::changed() so that Nuke knows that the display in the viewer must update.

bool DD::Image::ShapeKnob::no_animation ( )
inlineprotected

Make the node be non-animated by deleting all but one keys, setting the remaining key to the current shape, destroying the shape curve so it is not in the curve editor, and turning off autokey() and animated(). This pops up an "are you sure?" question if it looks like this will destroy useful animation.

int DD::Image::ShapeKnob::keys ( ) const
inline

Returns how many keys there are. This will be at least 1.

float ShapeKnob::time ( int  key) const

Return the time that key n is at. This can be used to draw frame numbers next to a "path" of a point in the GUI, or can be used to vary how the interpolation is done, for instance to make the motion smooth in time rather than in key numbers.

float ShapeKnob::shape ( double  time) const

Evaluate the shape curve at time. If the time is between two keys, this will return a number between those two key numbers. If there are less than 2 keys this always returns 0.

Return a number indicating which two keys to interpolate and how much to interpolate between them. This is set before goto_shape() is called.

If there are less than 2 keys this will always return 0.0.

If shape() is an integer (and in range) then the result should be exactly equal to some key. Otherwise do a mix between keys floorf(shape()) and ceilf(shape()), using (shape()-floorf(shape())) as a mixing factor.

The value may be out of the range from 0 to keys()-1. If this is true you should extrapolate the last two or first two keys. If that does not make sense for your data you should pretend it is equal to the first or the last key.

bool ShapeKnob::is_animated ( ) const

If this returns false then keys() is always 1, shape() is always zero, and any changes you make call set_key(0) no matter what the frame is. This is the initial state.

If this returns true than there is a shape curve that the user can edit in the curve editor. keys() is greater or equal to 1.

To turn it on, call set_key() (or call maybe_set_key() while autokey is on, or turn on autokey).

To turn it off call no_animation(). This will pop up a question for the user if Nuke thinks something valuable is going to be destroyed.

bool ShapeKnob::autokey ( ) const
inline

Return true if the autokey checkmark is turned on.

Sets autokey() to the given value, updating the checkmark in the user interface, and calling set_key() if you turn it on.

bool DD::Image::ShapeKnob::from_script ( const char *  v)
pure virtual

You will need to implement this. It should figure out from the text how many keys there are and call keys() with that number, and allocate and store all the data.

The time of each key is done by the internal shape curve knob. In a normal script this will be parsed afterwards. If the shape curve has the wrong number of keys an error will be produced and it will be brute-forced to match.

Reimplemented from DD::Image::Knob.

void DD::Image::ShapeKnob::to_script ( std::ostream &  o,
const OutputContext ,
bool  quote 
) const
pure virtual

You will need to implement this as well, to write all the data in each key in a way that can be parsed by from_script and the number of keys can be determined.

The easiest way is to put {...} around each key so that an outer ScriptList will return the number of keys.

Reimplemented from DD::Image::Knob.



©2020 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk