On 23/06/2013 at 12:08, xxxxxxxx wrote:
Originally posted by xxxxxxxx
i don't think effectors contain a pointer / reference to a selection, as that would cause
problems for setups where one effector is targeting multiple generator objects.
long story short:
1. create a generator with a selection.
2. assign an effector to the generator and restrict it to the selection.
3. duplicate the generator.
4. rename the selection tag on the duplicate.
the effector will stop working on the duplicate setup after step four. effectors do not do
anything with selections themselves i think, they just do carry arround the name string.
a generator object does relate to that name string when passing the modata to effector
methods.
so you have either to stick with the selection name string provided by the effectors
description or you rely on the modata passed to the effector methods, as it will contain
sort of the selection info.
Well, they contain the name of the MoGraph selection tag which can be grabbed from the MoGraph
generator object in ModifyPoints(). I couldn't find the selection info in the MoData array. But after
taking another deep look into the c4d_baseeffector.h header, I found the
MSG_GET_MODATASELECTION message! :slightly_smiling_face:
// Find the MoGraph selection tag.
BaseTag* moTag = NULL;
String moTagName = bc->GetString(ID_MG_BASEEFFECTOR_SELECTION);
if (moTagName.Content()) moTag = gen->GetFirstTag();
while (moTag) {
if (moTag->IsInstanceOf(Tmgselection) && moTag->GetName() == moTagName) {
break;
}
moTag = moTag->GetNext();
}
// Retrieve the BaseSelect from the MoGraph selection tag.
BaseSelect* moSelection = NULL;
if (moTag && moTag->IsInstanceOf(Tmgselection)) {
GetMGSelectionMessage data = {0};
moTag->Message(MSG_GET_MODATASELECTION, &data);
moSelection = data.sel;
}
Thanks for your answer though, I appreciate your effort.
Best,
-Niklas