ColorSwatchGroup
¶
New in version R18.011.
c4d.modules.colorchooser.
ColorSwatchGroup
¶
ColorSwatchGroup.Merge()
ColorSwatchGroup.CopyFrom()
ColorSwatchGroup.GetName()
ColorSwatchGroup.SetName()
ColorSwatchGroup.GetColorCount()
ColorSwatchGroup.GetColor()
ColorSwatchGroup.GetColors()
ColorSwatchGroup.SetColor()
ColorSwatchGroup.AddColor()
ColorSwatchGroup.AddColors()
ColorSwatchGroup.Reset()
ColorSwatchGroup.RemoveColor()
ColorSwatchGroup.RemoveSelectedColors()
ColorSwatchGroup.HasDuplicatedColors()
ColorSwatchGroup.RemoveDuplicatedColors()
ColorSwatchGroup.InvertSelection()
ColorSwatchGroup.SelectColor()
ColorSwatchGroup.IsColorSelected()
ColorSwatchGroup.SelectGroup()
ColorSwatchGroup.IsGroupSelected()
ColorSwatchGroup.SortColors()
ColorSwatchGroup.
__init__
(
[
name=”“
,
selected=False
,
colors=None
]
)
¶
Creates a new swatch group.
Parameters: |
|
---|---|
Return type: | |
Returns: |
A new swatch group. |
ColorSwatchGroup.
Merge
(
group
)
¶
Merges colors from group .
Parameters: | group ( c4d.modules.colorchooser.ColorSwatchGroup ) – The group to merge colors from. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
ColorSwatchGroup.
CopyFrom
(
)
¶
Copies a group.
Parameters: | group ( c4d.modules.colorchooser.ColorSwatchGroup ) – The group to copy colors from. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
ColorSwatchGroup.
GetName
(
)
¶
Retrieves the group name.
Return type: | str |
---|---|
Returns: | The group name. |
ColorSwatchGroup.
SetName
(
name
)
¶
Sets the group name.
Parameters: | name ( str ) – The new group name. |
---|
ColorSwatchGroup.
GetColorCount
(
)
¶
Retrieves the number of colors stored in the group.
Return type: | int |
---|---|
Returns: | The number of colors stored in the group. |
ColorSwatchGroup.
GetColor
(
index
)
¶
Retrieves the color at the given index .
Parameters: |
index
(
int
) – The index of the color. Must be 0 <=
index
<
GetColorCount()
.
|
---|---|
Return type: |
tuple(
c4d.Vector
, bool)
|
Returns: | The color value and its selection status. |
ColorSwatchGroup.
GetColors
(
[
selectedOnly=False
]
)
¶
Retrieves the colors stored in the group.
Parameters: | selectedOnly ( bool ) – Set to True to get only the selected colors, set to False to get all colors (default). |
---|---|
Return type: |
list of
c4d.Vector
|
Returns: | The list of colors. |
ColorSwatchGroup.
SetColor
(
index
,
color
,
selected
)
¶
Edits the color at the given index .
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the color could be changed, otherwise False . |
ColorSwatchGroup.
AddColor
(
color
[
,
selected=False
,
insertAt=-1
]
)
¶
Adds a new color to the group.
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The index of the new color or -1 if an error occurred. |
ColorSwatchGroup.
AddColors
(
colors
[
,
selected=False
,
merge=True
,
insertAt=-1
]
)
¶
Adds colors to the group.
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The index of the new colors or -1 if an error occurred. |
ColorSwatchGroup.
Reset
(
)
¶
Removes all colors from the group.
ColorSwatchGroup.
RemoveColor
(
index
[
,
removeCount=1
]
)
¶
Removes the color at the given index .
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
ColorSwatchGroup.
RemoveSelectedColors
(
)
¶
Removes all selected colors from the group.
ColorSwatchGroup.
HasDuplicatedColors
(
)
¶
Checks if the group has duplicated colors.
Return type: | bool |
---|---|
Returns: | True if duplicated colors were found, otherwise False . |
ColorSwatchGroup.
RemoveDuplicatedColors
(
)
¶
Removes duplicated colors in the group.
ColorSwatchGroup.
InvertSelection
(
)
¶
Inverts the selection state of all colors, so the currently selected colors will be unselected and vice-versa.
ColorSwatchGroup.
SelectColor
(
index
,
selected
)
¶
Selects/unselects the color at the given index .
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
ColorSwatchGroup.
IsColorSelected
(
index
)
¶
Checks if the color at the given index is selected.
Parameters: |
index
(
int
) – The index of the color. Must be 0 <=
index
<
GetColorCount()
.
|
---|---|
Return type: | bool |
Returns: | True if the color is selected, False if it is unselected or index is invalid. |
ColorSwatchGroup.
SelectGroup
(
select
)
¶
Selects the group. This will select/unselect the group icon and all colors in the group.
Parameters: | select ( bool ) – The new selection status. |
---|
ColorSwatchGroup.
IsGroupSelected
(
)
¶
Checks if the group is selected.
Return type: | bool |
---|---|
Returns: | True if the group is selected, otherwise False . |
ColorSwatchGroup.
SortColors
(
)
¶
Sorts colors in the group based on their HSV values.