Notifications
Clear all

[Closed] Had to share this snippet

i want create a simplified attach controller (no key framing) and as you do you use the samples a starting point I am using position constraint (not the original attach) as my plugin basis. What a mess !!! random bit of code that does nothing or never called wonderful comments

// TODO: Most of the other calls to RedrawListbox() should be removed with this addition.

calls to RedrawListbox() litter the code like a rash so that worked out well but what I really wanted to share was this little snippet of coding

bool SvCanDetachRel(IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
{
	if(GetLocked()==false)
		return true;
	else 
		return false;
}

:argh:

3 Replies

it must be fixed to be absolutely clear:

bool SvCanDetachRel(IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
{
	if(GetLocked()==false && GetLocked()!=true)
		return true;
	else if(GetLocked()!=false || GetLocked()==true)
		return false;
        else return !GetLocked();
}

:keenly:

 lo1

Geez, Denis. Stop trying to micro-optimize everything! It’s ok to leave things long and readable at times.

bool SvCanDetachRel(IGraphObjectManager *gom, IGraphNode *gNodeTarget, int id, IGraphNode *gNodeMaker)
{
    bool locked = GetLocked();
    switch (locked)
    {
         case true:
            {
                locked = !true;
                break;
            }
         case false:
            {
                locked = !false;
                break;
            }
          default:
            {
                //Quantum computing has arrived!
                break;
            }
    }
    return locked;
}

found this lovely variable name while looking through epoly stuff

klugeToFixWM_CUSTEDIT_ENTEROnEnterFaceLevel = true;

even though extremely verbose i still don’t understand what it says !