On 04/10/2015 at 01:44, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) : C++ ;
---------
Hi,
in my Plugin i need to have a select cycle that contains all layers in the scene, just like Cinema's right click in OM -> 'add to layer' select. I can dynamically add each layer to my cycle in GetDDescription, but whats missing is the color of the layer.
I already have the list of layers from the documents layerRoot, but i cant figure out how to add the color icons to my select cycle..
here's the relevant code:
// get list of all layers currently in the document
vector<LayerObject*> layerList;
getLayerList(doc->GetLayerObjectRoot(),layerList);
// get cycle-container from description that we want to add the layers to
BaseContainer* bc = description->GetParameterI(CLONE_LAYER, NULL);
if(bc==NULL) return;
bc->SetParameter(DESC_NAME, GeData("Layer"));
BaseContainer cycleNames, cycleIcons;
// add static select options 'none' and 'new'
cycleNames.SetParameter(0L, GeData("none"));
cycleIcons.SetParameter(0L, GeData(Ocube)); // test-icon-id
cycleNames.SetParameter(1L, GeData("new parent layer"));
cycleIcons.SetParameter(1L, GeData(Osphere)); // test-icon-id
// add dynamic select option for each layer in the scene
for(unsigned int i=0; i<layerList.size(); i++) {
// set select option name
cycleNames.SetParameter(2L + i,GeData(layerList[i]->GetName()));
// set select option color
// ..
}
// put cycle names and icons back into the description
bc->SetParameter(DESC_CYCLE, GeData(cycleNames));
bc->SetParameter(DESC_CYCLEICONS, GeData(cycleIcons));
When you add a normal icon to the cycle,you just put in a GeData with the object id that references the icon you want to show, but how to display a color instead of an icon ?
I tried putting in the bitmap of the corresponding layerIcon and also the color vector of the layer, but the GeData Constructor wont take that..
Anybody know how to pull this off ?