Hi @C4DS,
no, I do not think that there is anything to find for you in the settings container. Internally there is only some very low-level stuff written into it and also the information you pass as the layoutflags
, so it should probably be marked as private. The non-public ColorChooserGui
, i.e., what is effectively at work for ::AddColorChooser
and the recipient of theBaseContainer
in question, is also not a monolithic thing, but rather split into many interfaces for all the bits and bobs that go into a color gui gadget of Cinema 4D. The size of the ColorInterfaceSpectrum
, i.e. the "thing" in your screenshot, is stored locally in the interface and initially derived from the world settings container: GetWorldContainerInstance()->GetInt32(WPREF_COLOR_MODE_SPECTRUM_SIZE)
.
The values there can be COLORSYSTEM_SIZE_SMALL
, COLORSYSTEM_SIZE_MEDIUM
and COLORSYSTEM_SIZE_LARGE
. So technically you could write to the world settings container before you open your dialog and after that restore the old value; something like the Python script attached at the end. But as stated in the script itself, this is very much a workaround with probably unintended side effects.
I also do not see a way to remove the "top color rectangle", which makes sense to me, since it is what you expand the GUI out from and into when it is being render in a description resource. So removing it would break the GUI there. Sorry, I don't really have a better answer for you.
Cheers,
Ferdinand
"""How to open a color chooser spectrum GUI with specified size in a dialog.
This is very much a workaround I would say, which most likely has unintended
consequences while the dialog is open. All newly created or refreshed spectrum
interfaces will then be large, and even beyond the life time of the dialog
when they are not being refreshed after the dialog has closed.
As discussed in:
https://plugincafe.maxon.net/topic/13101/
"""
import c4d
class MyDialog (c4d.gui.GeDialog):
"""A dialog that opens with a large color spectrum gadget.
"""
def __init__(self):
"""Constructor.
"""
# Get the world settings and store the old value and set the
# color spectrum size globally to large.
self._worldSettings = c4d.GetWorldContainerInstance()
self._oldSize = self._worldSettings.GetInt32(
c4d.WPREF_COLOR_MODE_SPECTRUM_SIZE)
self._worldSettings.SetInt32(
c4d.WPREF_COLOR_MODE_SPECTRUM_SIZE,
c4d.COLORSYSTEM_SIZE_LARGE)
def __del__(self):
"""Destructor.
"""
# Write the old value back.
self._worldSettings.SetInt32(
c4d.WPREF_COLOR_MODE_SPECTRUM_SIZE,
self._oldSize)
def CreateLayout(self):
"""Adds a color chooser gadget with a spectrum field.
"""
self.AddColorChooser(id=1,
flags=c4d.BFH_SCALEFIT,
layoutflags=c4d.DR_COLORFIELD_ENABLE_SPECTRUM)
return True
if __name__=='__main__':
global dialog
dialog = MyDialog()
dialog.Open(c4d.DLG_TYPE_ASYNC, xpos=-2, ypos=-2)