On 11/06/2017 at 06:14, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) : C++ ;
---------
I get a pretty weird behavior in my code. Toogle work for selecting but don't for deselecting.
I run my code in a drag event from a MouseInput function of a DescriptionToolData class.
// if we are in point snap mode
if (snapResul.snapmode == SNAPMODE_POINT){
// if the target object is selected
if (objSelectedList->Find(snapResul.target) != NOTOK)
{
BaseContainer* kb_state = NewObjClear(BaseContainer);
if (!win->BfGetInputEvent(BFM_INPUT_KEYBOARD, kb_state))
_shift = false;
if (kb_state->GetInt32(BFM_INPUT_QUALIFIER) & QSHIFT)
_shift = true;
else
_shift = false;
PointObject* pobj = ToPoint(snapResul.target);
BaseSelect* bs = pobj->GetPointS();
if (_shift)
{
bs->Toggle(snapResul.component);
}
else
{
bs->DeselectAll();
bs->Select(snapResul.component);
}
DrawViews(DRAWFLAGS_ONLY_ACTIVE_VIEW | DRAWFLAGS_NO_THREAD | DRAWFLAGS_NO_ANIMATION);
}
}
You can see the full code (and the full project here) => https://github.com/gr4ph0s/AxisConstraint/blob/master/source/tool/graph_constraint_snap.cpp
I also tested to replace Togle to Deselect. It don't work while if I remplace with Select it work perfectly.