About
A ColorSwatchGroup stores multiple colors as maxon::ColorA. The group itself and the colors can be selected. ColorSwatchGroup elements are stored and handled using ColorSwatchData objects. The class is defined in the lib_colorchooser.h
header file.
if (colorSwatchData == nullptr)
freeData.
Assign(colorSwatchData);
for (
Int i = 0;
i < groupCount; ++
i)
{
if (group)
{
for (
Int c = 0;
c < colorCount; ++
c)
{
if (group->
GetColor(
c, color, &selected) && selected)
{
if (mat == nullptr)
const Vector rgb { color.
r, color.
g, color.
b };
doc->InsertMaterial(mat);
}
}
}
}
Py_ssize_t i
Definition: abstract.h:645
Definition: ge_autoptr.h:155
void Assign(TYPE *p)
Definition: ge_autoptr.h:230
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
Definition: lib_colorchooser.h:406
Int GetGroupCount(SWATCH_CATEGORY category=SWATCH_CATEGORY::DOCUMENT) const
ColorSwatchGroup * GetGroupAtIndex(Int index, SWATCH_CATEGORY category=SWATCH_CATEGORY::DOCUMENT)
static ColorSwatchData * Alloc(BaseDocument *doc=nullptr, Bool global=false)
Definition: lib_colorchooser.h:218
Bool GetColor(Int index, maxon::ColorA &color, Bool *selected=nullptr) const
Int GetColorCount() const
Definition: c4d_basematerial.h:241
static Material * Alloc()
Py_UNICODE c
Definition: unicodeobject.h:1200
maxon::Bool Bool
Definition: ge_sys_math.h:55
maxon::Int Int
Definition: ge_sys_math.h:64
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
@ MATERIAL_COLOR_COLOR
Definition: mmaterial.h:56
const char * doc
Definition: pyerrors.h:226
A color consisting of three components R, G, B and an alpha.
Definition: col4.h:16
Allocation/Deallocation
ColorSwatchGroups can be created using the usual tools. This is typically not needed.
Access
ColorSwatchGroup elements are stored in a ColorSwatchData object. See ColorSwatchData Color Groups
Selection
A ColorSwatchGroup can be selected:
for (
Int i = 0;
i < groupCount; ++
i)
{
if (group == nullptr)
{
}
}
Bool IsGroupSelected() const
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
Name
A ColorSwatchGroup can be identified by a name:
if (group == nullptr)
group->
SetName(
"This is a new group");
ColorSwatchGroup * AddGroup(SWATCH_CATEGORY category=SWATCH_CATEGORY::DOCUMENT, const String &name=String(), Bool selected=false, Int insertAt=-1, const ColorAlphaArray &colors=ColorAlphaArray())
void SetName(String name)
Colors
A ColorSwatchGroup stores multiple colors and their selection state. The colors are obtained with:
for (
Int c = 0;
c < colorCount; ++
c)
{
}
Colors can be edited with:
New colors are added with:
{
}
void SortColors()
Sorts colors in the group based in their HSV values.
Int AddColor(const maxon::ColorA &color, Bool selected=false, Int insertAt=-1)
Definition: c4d_tools.h:812
Float64 Float
Definition: apibase.h:197
const char const char grammar * g
Definition: parsetok.h:52
The selection status of a color can be utilized with these functions:
Further utility functions are:
Further Reading