PDA

View Full Version : Adding nodes to a NodeTab


eledh_telamion
12-27-2006, 12:07 PM
I need to add to nodeTab. It is initialized with nodeTab.ZeroCount(), but when I start working with this table, as nodeTab.Count() or nodeTab[i] = node (node is passed as INode * node), the plugin crashes MAX and then quits.
I don't why it happens.
As always I'm working in SDK.

ypuech
12-27-2006, 01:55 PM
Hi Alex,

ZeroCount() sets the number of used items to zero. So, if you want to modify the number of elements you have Resize(int num).

But it seems that you can get some bugs using Tab class.

eledh_telamion
01-08-2007, 01:16 PM
I've trying some days but I don't get nothing. MAX continues quiting but I don't know why.

Every time I try to work with the nodeTab, when I'm assigning slave nodes to the tab, which is necessary to add nodes to the slaveController, MAX quits.

I have updoaded my Controller project here: http://www.aurtzaka.com/Out/Chain_SIM_2.rar

marktsang
01-08-2007, 01:32 PM
what exactly are you trying to do?

ypuech
01-08-2007, 01:42 PM
Hi Alex,

Have you take a look at maxsdk samples ? Maybe some plugins use Tab class.
Also search Sparks forum at http://sparks.autodesk.com/webboard/wbpx.dll/~maxsdk (http://sparks.autodesk.com/webboard/wbpx.dll/%7Emaxsdk)

eledh_telamion
01-08-2007, 02:58 PM
I have a nodeTab where a list of nodes will be stored.


Well, in this nodeTab I have to add its node (son-nodes of one father-node, which is masterNode and its sons slaveNodes).

This occur when the first son of our hierarchy (clicking in Hijo1 -first son-) is selected .

Node's name is printed in RollUp.
Son-nodes will be stored in nodeTab (from 1 to n)
Those nodes are the slaveNodes that slaveController must manipulate
Hope it would be helpful.

eledh_telamion
01-09-2007, 10:37 AM
More information:

When we click in Hijo1->




case IDC_BUTTON_HIJO1:mc->iObjParams->SetPickMode(&thePickMode);


//mc->showNodeName( node ,HIJO1_NAME ); // Semearen izena jarri beharko dugu bere lekuan

// Esklabuak hasieratu



for (int k=0;k<9;k++) {MessageBox(0,"Proc: ButtonHijo1 - Seme Esklabuak gehitzen","KP",MB_OK);

//mc->SetSlaveNode(0, mc->padre->GetChildNode(0) );
mc->SetSlaveNode(k, mc->padre->GetChildNode(k) );

}

MessageBox(0,"Proc: ButtonHijo1 - Finished!","Kontrol puntua",MB_OK);

break;






// i. slave-nodoa RingMasterrean ezartzeko deitzen da metodo hau
// Nodo-taulan leku gehiago behar bada, alokatu egiten da.
void RingMaster::SetSlaveNode(int i, INode * node)
{


MessageBox(0,"RM:SetSlaveNode - INIT", "KP",MB_OK);

PrintValue(i);

PrintValue( nodeTab.Count() );


if ( i >= nodeTab.Count() ) {MessageBox(0,"1", "KP",MB_OK);

int nOld = nodeTab.Count();
MessageBox(0,"2", "KP",MB_OK);
nodeTab.SetCount(i+1);
MessageBox(0,"3", "KP",MB_OK);
if (i+1>numNodes)
numNodes = i+1;
MessageBox(0,"4", "KP",MB_OK);
for (int j = nOld; j<i+1; j++) nodeTab[j] = NULL;

}


//MessageBox(0,"10", "KP",MB_OK);
//nodeTab.SetCount(NODO_MAX, true);
//MessageBox(0,"11", "KP",MB_OK);
//nodeTab.Insert(i, i, & node);

nodeTab[i] = node;

MessageBox(0,"RM:SetSlaveNode - COMPLETED", "KP",MB_OK);

}

ypuech
01-09-2007, 10:49 AM
Hi Alex,

Have you tried to use a regular STL list<> instead of Tab<>. Tab class seems dated and bugged. It's possible to use STL with 3ds Max SDK but you may encounter compile problems (solutions in sparks forum, very useful to download sparks archive at http://sparks.discreet.com/downloads/downloadshome.cfm)

eledh_telamion
01-10-2007, 11:01 AM
I'm trying now with STL list<> as you said. Thanks.

But I'm still confused about it. I'm explainning. I try this:

node0 = NULL;

//node0 is => INode *node0;


but crashes MAX too. I think I don't understand how it works or something isn't well in my code.

ypuech
01-10-2007, 11:14 AM
Hi Alex,

Why are you setting node to NULL ?

eledh_telamion
01-10-2007, 11:28 AM
Only to see what happens.

eledh_telamion
01-11-2007, 10:13 AM
Well, finaly found why it crashes.

All the stuff (node0, node1 ... node 13 and nodeTab<>) were in RingMaster class, so, to acces to them must have methods, like get/setNode0(..) .

But for nodeTab, I move it to global part of the program, to continue faster without to write its methods.

eledh_telamion
01-12-2007, 04:08 PM
I wasn't right. I think with methods would be able to get acces but, I wasn't right.
Doesn't matter if I try to acces RingMaster class variables (numNodes, rigidValue, ... ) directly (mc->numNodes = 0 or x = mc->numNodes) or by methods (mc->SetNumNodes(0) or x = mc->GetNumNodes() ).

mc is a pointer to our RingMaster class instance.

Why can't I acces? Why crashes?

If you need code you have here http://www.aurtzaka.com/Out/Chain_SIM_2.rar

CGTalk Moderation
01-12-2007, 04:08 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.