Notifications
Clear all

[Closed] Adding nodes to a NodeTab

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.

12 Replies

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.

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

what exactly are you trying to do?

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

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 .
[ul]
[li]Node’s name is printed in RollUp.[/li][li]Son-nodes will be stored in nodeTab (from 1 to n)[/li][li]Those nodes are the slaveNodes that slaveController must manipulate[/li][/ul]Hope it would be helpful.

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++) {[indent]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;

[/indent]

// 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() ) {[indent]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);

[/indent]}

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 )

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.

Hi Alex,

Why are you setting node to NULL ?

Page 1 / 2