Estevanus / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

Subtree for io blocking (mNodes) looks incorrect. Logic is blocking too much! #37

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
For the following "test13" function: the gkMathNode::update method is 
called just one time (only for the first tick). If I am not wrong it should 
be called for every tick since "pMathNode" does not have direct dependency 
with "pKeyNode". Instead of that "pMathNode" is blocked after the first 
tick because has an input socket linked to "pMouseNode" and this last one 
is indirectly blocked because "pKeyNode".

I could solve this issue in two ways: 
1) Creating another mouse node for the math node. 
 I do not like this solution because in a graph, nodes (same instance) can 
be reused. (And this looks to me as a hard-restriction...)
2) Changing gkLogicTree::findSubNodeForward method to not include input 
sockets relations...

Am I missing something?

void test13(gkSceneObject* pScene)
{
    gkCameraObject* pCamera = pScene->getMainCamera();

    gkLogicTree* pTree = gkLogicManager::getSingleton().create();

    gkLogicNode* pMouseNode = pTree->createNode(NT_MOUSE);

    gkLogicNode* pMathNode = pTree->createNode(NT_MATH);

    pMathNode->getInputSocket(0)->link(pMouseNode->getOutputSocket(1));
    pMathNode->getInputSocket(1)->link(pMouseNode->getOutputSocket(2));

    gkKeyNode* pKeyNode= static_cast<gkKeyNode*>(pTree-
>createNode(NT_KEY));
    pKeyNode->getInputSocket(0)->setValue(true);
    pKeyNode->setKey(KC_AKEY);

    gkLogicNode* pMotionNode = pTree->createNode(NT_MOTION);

    pMotionNode->getInputSocket(0)->link(pKeyNode->getOutputSocket(1));
    pMotionNode->getInputSocket(1)->link(pMouseNode-
>getOutputSocket(1));
    pMotionNode->getInputSocket(2)->link(pMouseNode-
>getOutputSocket(2));

    pTree->solveOrder();

    pCamera->attachLogic(pTree);
}

Original issue reported on code.google.com by silveira.nestor@gmail.com on 15 Feb 2010 at 8:51

GoogleCodeExporter commented 8 years ago
I believe The problem is with the keyboard output socket, the first index is a
constant update while the second index is a cached key pulse. It's difficult 
without
a proper GUI in blender. I attached an image showing the working usage on my 
end.

Original comment by snailr...@gmail.com on 15 Feb 2010 at 3:26

Attachments:

GoogleCodeExporter commented 8 years ago
removed, blocking all together. this test is now in Runtime/Main.cpp

Original comment by snailr...@gmail.com on 16 Feb 2010 at 4:18