ColorSwatchData
¶
New in version R18.011.
This type handles the Swatch Data stored globally, in a
BaseDocument
or a preset. It holds 2 kinds of groups:
c4d.modules.colorchooser.
ColorSwatchData
¶
ColorSwatchData.LoadGlobalGroup()
ColorSwatchData.SaveGlobalGroup()
ColorSwatchData.LoadDefaultGlobalGroup()
ColorSwatchData.SaveDefaultGlobalGroup()
ColorSwatchData.GetGlobalGroup()
ColorSwatchData.SetGlobalGroup()
ColorSwatchData.Load()
ColorSwatchData.Save()
ColorSwatchData.LoadPresetByName()
ColorSwatchData.LoadPresetByURL()
ColorSwatchData.SavePresetByName()
ColorSwatchData.SavePresetByURL()
ColorSwatchData.Merge()
ColorSwatchData.CopyFrom()
ColorSwatchData.GetGroupCount()
ColorSwatchData.GetGroupAtIndex()
ColorSwatchData.SetGroupAtIndex()
ColorSwatchData.AddGroup()
ColorSwatchData.InsertGroup()
ColorSwatchData.RemoveGroup()
ColorSwatchData.RemoveSelectedItems()
ColorSwatchData.Reset()
ColorSwatchData.
__init__
(
[
doc=None
,
global=False
]
)
¶
Creates a new swatch data.
Parameters: |
|
---|---|
Return type: | |
Returns: |
A new swatch data. |
ColorSwatchData.
LoadGlobalGroup
(
)
¶
See also
SaveGlobalGroup()
,
LoadDefaultGlobalGroup()
,
SaveDefaultGlobalGroup()
,
GetGlobalGroup()
Return type: | bool |
---|---|
Returns: | True if successful, otherwise False . |
ColorSwatchData.
SaveGlobalGroup
(
)
¶
See also
LoadGlobalGroup()
,
LoadDefaultGlobalGroup()
,
SaveDefaultGlobalGroup()
,
GetGlobalGroup()
Return type: | bool |
---|---|
Returns: | True if successful, otherwise False . |
ColorSwatchData.
LoadDefaultGlobalGroup
(
[
ignoreFile=False
]
)
¶
See also
SaveDefaultGlobalGroup()
,
LoadGlobalGroup()
,
SaveGlobalGroup()
,
GetGlobalGroup()
Parameters: | ignoreFile ( bool ) – If True , the file “defaultswatches” will be ignored and the hardcoded colors will be loaded instead. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
ColorSwatchData.
SaveDefaultGlobalGroup
(
)
¶
See also
LoadDefaultGlobalGroup()
,
LoadGlobalGroup()
,
SaveGlobalGroup()
,
GetGlobalGroup()
Return type: | bool |
---|---|
Returns: | True if successful, otherwise False . |
ColorSwatchData.
GetGlobalGroup
(
)
¶
Retrieves the global colors group.
See also
LoadGlobalGroup()
,
SaveGlobalGroup()
,
LoadDefaultGlobalGroup()
,
SaveDefaultGlobalGroup()
Return type: | c4d.modules.colorchooser.ColorSwatchGroup |
---|---|
Returns: | The global group. Guaranteed to be valid. |
ColorSwatchData.
SetGlobalGroup
(
group
)
¶
Replaces the global group.
Parameters: | group ( c4d.modules.colorchooser.ColorSwatchGroup ) – The group to copy from. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
ColorSwatchData.
Load
(
doc
[
,
merge=False
]
)
¶
Loads the document-based color groups from the given document.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
ColorSwatchData.
Save
(
doc
)
¶
Saves the document-based color groups into the given document.
Parameters: | doc ( c4d.documents.BaseDocument ) – The document to store the color groups into. |
---|---|
Return type: | bool |
Returns: | True if successful, otherwise False . |
ColorSwatchData.
LoadPresetByName
(
name
[
,
merge=False
]
)
¶
Loads the document-based swatch groups of the first preset with the given name found in the user’s Color Swatch Preset directory, including subdirectories.
See also
GetColorSwatchPresetDirectory()
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
ColorSwatchData.
LoadPresetByURL
(
url
,
merge
)
¶
Loads the document-based swatch groups of the given preset.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if successful, otherwise False . |
ColorSwatchData.
SavePresetByName
(
name
[
,
author=”“
,
info=”“
,
forceOverwrite=False
]
)
¶
Saves the document-based groups as a Color Swatch preset.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the preset was saved successfully, otherwise False . |
ColorSwatchData.
SavePresetByURL
(
url
[
,
author=”“
,
info=”“
,
forceOverwrite=False
]
)
¶
Saves the document-based groups as a Color Swatch preset.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the preset was saved successfully, otherwise False . |
ColorSwatchData.
Merge
(
data
)
¶
Merges groups from data .
Parameters: | data ( c4d.modules.colorchooser.ColorSwatchData ) – The data to merge groups from. |
---|---|
Return type: | bool |
Returns: | True if the groups were successfully merged, otherwise False . |
ColorSwatchData.
CopyFrom
(
)
¶
Copies color swatch data.
Parameters: | data ( c4d.modules.colorchooser.ColorSwatchData ) – The data to copy groups from. |
---|---|
Return type: | bool |
Returns: | True if the color swatch data was successfully copied, otherwise False . |
ColorSwatchData.
GetGroupCount
(
)
¶
Retrieves the number of document-based groups stored. Global group is ignored.
Return type: | int |
---|---|
Returns: | The number of color groups. |
ColorSwatchData.
GetGroupAtIndex
(
index
)
¶
Retrieves the document-based group at the given index .
Parameters: |
index
(
int
) – The index of the color group. Must be 0 <=
index
<
GetGroupCount()
.
|
---|---|
Return type: | c4d.modules.colorchooser.ColorSwatchGroup |
Returns: | The swatch group or None . |
ColorSwatchData.
SetGroupAtIndex
(
index
,
group
)
¶
Replaces the group at the given index .
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the group was successfully set, otherwise False . |
ColorSwatchData.
AddGroup
(
[
name=”“
,
selected=False
,
insertAt=-1
,
colors=None
]
)
¶
Adds a new document-based group.
Parameters: |
|
---|---|
Return type: | |
Returns: |
The new swatch group or None . |
ColorSwatchData.
InsertGroup
(
group
[
,
insertAt=-1
]
)
¶
Inserts an existing document-based group.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the group was successfully inserted, otherwise False . |
ColorSwatchData.
RemoveGroup
(
index
)
¶
Removes the document-based group at the given index .
Parameters: |
index
(
int
) – The index of the color group to remove. Must be 0 <=
index
<
GetGroupCount()
.
|
---|---|
Return type: | bool |
Returns: | True if the group was successfully removed, otherwise False . |
ColorSwatchData.
RemoveSelectedItems
(
)
¶
Removes all selected groups and colors, including selected global colors.
ColorSwatchData.
Reset
(
)
¶
Removes all groups and colors, including globals.