C++ API Reference: MColorPickerUtilities Class Reference

Introduced in 2019.0 More...

#include <MColorPickerUtilities.h>

Public Types

enum  Direction { kForward = 0, kInverse }
 Color transform direction. More...
 

Static Public Member Functions

static bool isRegisteredToColorPicking (QWidget *)
 Returns whether the widget registered to the Color Picking mechanism. More...
 
static MStatus doRegisterToColorPicking (QWidget *, MColorPickerCallback *)
 Registers a widget that can be used to pick a color with an eye dropper. More...
 
static MStatus unregisterFromColorPicking (QWidget *)
 Unregisters a widget that was registed with doRegisterToColorPicking. More...
 
static MColor applyViewTransform (const MColor &inputColor, Direction direction)
 Introduced in 2023.0 More...
 
static MColor grabColor (MStatus *returnedStatus=nullptr)
 Introduced in 2023.0 More...
 
static const char * className ()
 Returns the name of this class. More...
 

Detailed Description

Introduced in 2019.0

2019.0:
Introduced in this version.

Utilities for implementing Color Pickers. See also MColorMixingSpaceHelper

Member Enumeration Documentation

enum Direction

Color transform direction.

Enumerator
kForward 

apply the color transform

kInverse 

invert the color transform

Member Function Documentation

bool isRegisteredToColorPicking ( QWidget *  widget)
static

Returns whether the widget registered to the Color Picking mechanism.

Note
The widget could be either the registered one or one of its parent.
Parameters
[in]widgetThe widget to test
Note
The widget could the one picked or one of its parent. It allows to register the third-party main window and click on a specific child of that window (instead of registering all children).
Returns
true if widget is registered
MStatus doRegisterToColorPicking ( QWidget *  widget,
MColorPickerCallback callback 
)
static

Registers a widget that can be used to pick a color with an eye dropper.

Parameters
[in]widgetThe widget to register
[in]callbackThe callback to get a color at a specifc position
Note
Registering a widget only means that itself or one of its children could be selected for the color computation.
The callback instance creation/deletion must be managed by the caller.
Returns
status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed - the callback object has already been registered
  • MS::kInvalidParameter invalid widget or callback object provided
MStatus unregisterFromColorPicking ( QWidget *  widget)
static

Unregisters a widget that was registed with doRegisterToColorPicking.

Parameters
[in]widgetThe widget to unregister
Returns
status code
Status Codes:
  • MS::kSuccess operation successful
  • MS::kFailure operation failed - the callback object has already been unregistered
  • MS::kInvalidParameter invalid callback object provided
MColor applyViewTransform ( const MColor inputColor,
Direction  direction 
)
static

Introduced in 2023.0

Applies a colour transform from the rendering colour space to the (display, view) space using the color management settings from Maya.

2023.0:
Introduced in this version.
Parameters
[in]inputColorThe input color to transform
[in]directionThe direction of the transform,
Returns
Returns the transformed color, or the input color unmodified if color management is turned off
MColor grabColor ( MStatus returnedStatus = nullptr)
static

Introduced in 2023.0

Run the eye dropper tool to pick a color on screen with the mouse.

2023.0:
Introduced in this version.
Parameters
[out]returnedStatusMS::kFailure if a aborted, otherwise MS::kSuccess
Returns
Returns the picked color. If cancelled, the color returned will have all components set to zero and returnedStatus will be set to MS::kFailure
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files:
  • MColorPickerUtilities.h
  • MColorPickerUtilities.cpp