About
In Cinema 4D it is possible to select multiple scene elements at once. The Attribute Manager displays the parameters of all these selected objects. Only the parameters that are part of all selected objects are displayed. If the value of a given parameter is the same for all selected objects, this value is displayed in the Attribute Manager. But if the value of the parameter on the different objects is not the same a tristate is displayed instead, indicating that the values are not the same.
TriState is a utility class to make it easy to handle multiple parameter values and to display them using GeDialog gadgets. The TriState template class can handle ::Bool, ::Int32, ::Float, ::Vector, BaseTime and String values. Typically the TriState class is only relevant to create CustomGuiData / iCustomGui based custom GUI elements.
- Note
- TriState elements are only handled with GeDialog gadgets. Parameter descriptions (Description elements) define the parameters of a C4DAtom based element and do not handle any TriState.
AutoAlloc<AtomArray> objects;
{
TriState<String> triState;
{
const BaseList2D*
const bl =
static_cast<BaseList2D*
>(objects->GetIndex(
i));
if (bl)
{
const String
name = bl->GetName();
}
}
SetString(ID_OBJECTNAME, triState);
}
Py_ssize_t i
Definition: abstract.h:645
Py_ssize_t count
Definition: abstract.h:640
const char const char * name
Definition: abstract.h:195
NONE
Definition: asset_browser.h:1
BaseDocument * GetActiveDocument()
maxon::Int32 Int32
Definition: ge_sys_math.h:51
const char * doc
Definition: pyerrors.h:226
Functionality
A TriState object stores multiple values:
- TriState::Add(TYPE val): Adds the given value to the TriState.
- TriState::Add(BaseContainer *bc, Int32 id): Adds the value stored in the given BaseContainer to the TriState.
The stored values can be accessed and analysed with:
- TriState::SetTri(): Sets the tristate without touching the value.
- TriState::GetTri(): Returns true if the stored values are not identical.
- TriState::GetValue(): Returns the first added value.
- TriState::HasChanged(): Returns true if values have been added.
TriState<Int32> triState;
triState.Add(100);
triState.Add(100);
const Bool isNotTriState = triState.GetTri() ==
false;
if (triState.HasChanged() && isNotTriState)
triState.Add(200);
if (triState.GetTri())
{
}
PyObject * value
Definition: abstract.h:715
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
maxon::Bool Bool
Definition: ge_sys_math.h:46
Further Reading