SICALLBACK ToonixMesher_Evaluate( ICENodeContext& in_ctxt ) { TXMesh* mesh = (TXMesh*)(CValue::siPtrType)in_ctxt.GetUserData( ); if(!mesh->_valid || GetMesherDirtyState(in_ctxt)) { // Get the input TXLine CDataArrayCustomType ToonixLine( in_ctxt, ID_IN_ToonixLine ); CDataArrayCustomType::TData* pBufferToonixLine; ULONG nSizeToonixLine; ToonixLine.GetData( 0,(const CDataArrayCustomType::TData**)&pBufferToonixLine, nSizeToonixLine ); TXLine* line = (TXLine*)pBufferToonixLine; if(!line) { mesh->_nbv = mesh->_nbp = 0; } else { mesh->_line = line; CDataArrayLong subdivData(in_ctxt, ID_IN_Subdiv); mesh->_subdiv = subdivData[0]; CDataArrayVector3f viewData(in_ctxt, ID_IN_ViewPosition); mesh->_view = viewData[0]; mesh->Build(); } mesh->_valid = true; } // The current output port being evaluated... LONG out_portID = in_ctxt.GetEvaluatedOutputPortID( ); switch( out_portID ) { case ID_OUT_Vertices: { // Get the output port array ... CDataArray2DVector3f outData( in_ctxt ); CDataArray2DVector3f::Accessor outDataSubArray = outData.Resize(0,mesh->_nbv); for(ULONG n=0;n<mesh->_nbv;n++) { outDataSubArray[n].Set(mesh->_vertices[n].GetX(),mesh->_vertices[n].GetY(),mesh->_vertices[n].GetZ()); } } break; case ID_OUT_Polygons: { // Get the output port array ... CDataArray2DLong outData( in_ctxt ); CDataArray2DLong::Accessor outDataSubArray = outData.Resize(0,mesh->_nbp); for(ULONG n=0;n<mesh->_nbp;n++) { outDataSubArray[n] = mesh->_polygons[n]; } } break; } return CStatus::OK; }
EditNode::EditNode(int *id,RDMatrix *matrix,QWidget *parent) : QDialog(parent) { setModal(true); edit_id=id; edit_matrix=matrix; edit_password_changed=false; setWindowTitle("RDAdmin - "+tr("Edit LiveWire Node")); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Create Fonts // QFont bold_font=QFont("Helvetica",12,QFont::Bold); bold_font.setPixelSize(12); QFont font=QFont("Helvetica",12,QFont::Normal); font.setPixelSize(12); // // Node Hostname // edit_hostname_edit=new QLineEdit(this); edit_hostname_edit->setGeometry(90,10,190,20); QLabel *label= new QLabel(edit_hostname_edit,tr("Hostname: "),this); label->setGeometry(10,10,80,20); label->setFont(bold_font); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Node TCP Port // edit_tcpport_spin=new QSpinBox(this); edit_tcpport_spin->setGeometry(335,10,sizeHint().width()-345,20); edit_tcpport_spin->setRange(0,0xFFFF); label=new QLabel(edit_tcpport_spin,tr("Port: "),this); label->setGeometry(290,10,45,20); label->setFont(bold_font); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Node Description // edit_description_edit=new QLineEdit(this); edit_description_edit->setGeometry(90,32,sizeHint().width()-100,20); label=new QLabel(edit_description_edit,tr("Description: "),this); label->setGeometry(10,32,80,20); label->setFont(bold_font); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Base Output // edit_output_spin=new QSpinBox(this); edit_output_spin->setGeometry(90,54,60,20); edit_output_spin->setRange(0,0x7FFF); edit_output_spin->setSpecialValueText(tr("None")); label= new QLabel(edit_output_spin,tr("First Output: "),this); label->setGeometry(10,54,80,20); label->setFont(bold_font); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Node Password // edit_password_edit=new QLineEdit(this); edit_password_edit->setGeometry(245,54,90,20); edit_password_edit->setEchoMode(QLineEdit::Password); edit_password_edit->setText("********"); connect(edit_password_edit,SIGNAL(textChanged(const QString &)), this,SLOT(passwordChangedData(const QString &))); label= new QLabel(edit_password_edit,tr("Password: "******"&View Node\nInfo")); connect(button,SIGNAL(clicked()),this,SLOT(viewData())); // // Ok Button // button=new QPushButton(this); button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50); button->setDefault(true); button->setFont(bold_font); button->setText(tr("&OK")); connect(button,SIGNAL(clicked()),this,SLOT(okData())); // // Cancel Button // button=new QPushButton(this); button->setGeometry(sizeHint().width()-90,sizeHint().height()-60, 80,50); button->setFont(bold_font); button->setText(tr("&Cancel")); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); // // Load Data // if((*edit_id)<0) { edit_tcpport_spin->setValue(RD_LIVEWIRE_DEFAULT_TCP_PORT); } else { QString sql; RDSqlQuery *q; sql=QString().sprintf("select HOSTNAME,TCP_PORT,DESCRIPTION,PASSWORD,\ BASE_OUTPUT \ from SWITCHER_NODES \ where ID=%d",*edit_id); q=new RDSqlQuery(sql); if(q->first()) { edit_hostname_edit->setText(q->value(0).toString()); edit_tcpport_spin->setValue(q->value(1).toInt()); edit_description_edit->setText(q->value(2).toString()); edit_password=q->value(3).toString(); edit_output_spin->setValue(q->value(4).toInt()); } delete q; } }
SICALLBACK ToonixLighter_BeginEvaluate( ICENodeContext& in_ctxt ) { TXLight* light = NULL; CValue userData = in_ctxt.GetUserData(); if(userData.IsEmpty()) { // Build a new Light Object light = new TXLight(); // Get the input TXGeometry CDataArrayCustomType ToonixData( in_ctxt, ID_IN_ToonixData ); CDataArrayCustomType::TData* pBufferToonixData; ULONG nSizeToonixData; ToonixData.GetData( 0,(const CDataArrayCustomType::TData**)&pBufferToonixData, nSizeToonixData ); TXData* data = (TXData*)pBufferToonixData; light->_geom = data->_geom; in_ctxt.PutUserData((CValue::siPtrType)light); } else { light = (TXLight*)(CValue::siPtrType)in_ctxt.GetUserData( ); } if(GetLighterDirtyState(in_ctxt)) { //Application().LogMessage(L"Toonix Lighter >State Dirty..."); // Get lights positions used for light detection light->_lights.clear(); siICENodeDataType inPortType; siICENodeStructureType inPortStruct; siICENodeContextType inPortContext; in_ctxt.GetPortInfo( ID_IN_LightPosition, inPortType, inPortStruct, inPortContext ); if ( inPortStruct == XSI::siICENodeStructureSingle ) { //Application().LogMessage(L"ONE Light"); CDataArrayVector3f lightPointData( in_ctxt, ID_IN_LightPosition ); light->_lights.push_back(lightPointData[0]); light->_nbl = 1; } else if ( inPortStruct == XSI::siICENodeStructureArray ) { //Application().LogMessage(L"MULTI Lights"); CDataArray2DVector3f lightPointsData( in_ctxt, ID_IN_LightPosition ); CDataArray2DVector3f::Accessor lightPointData = lightPointsData[0]; light->_nbl = lightPointData.GetCount(); for(LONG l=0;l<light->_nbl;l++) { light->_lights.push_back(lightPointData[l]); } } light->_bias.resize(light->_nbl); in_ctxt.GetPortInfo( ID_IN_LightBias, inPortType, inPortStruct, inPortContext ); if ( inPortStruct == XSI::siICENodeStructureSingle ) { CDataArrayFloat lightBiasData( in_ctxt, ID_IN_LightBias ); light->_bias[0] = lightBiasData[0]; } else if ( inPortStruct == XSI::siICENodeStructureArray ) { CDataArray2DFloat lightPointsData( in_ctxt, ID_IN_LightBias ); CDataArray2DFloat::Accessor lightPointData = lightPointsData[0]; ULONG nbl = lightPointData.GetCount(); for(LONG l=0;l<nbl&&l<light->_nbl;l++) { light->_bias[l] = lightPointData[l]; } } light->_distance.resize(light->_nbl); in_ctxt.GetPortInfo( ID_IN_LightDistance, inPortType, inPortStruct, inPortContext ); if ( inPortStruct == XSI::siICENodeStructureSingle ) { CDataArrayFloat lightDistanceData( in_ctxt, ID_IN_LightDistance ); light->_distance[0] = lightDistanceData[0]; } else if ( inPortStruct == XSI::siICENodeStructureArray ) { CDataArray2DFloat lightDistancesData( in_ctxt, ID_IN_LightDistance ); CDataArray2DFloat::Accessor lightDistanceData = lightDistancesData[0]; ULONG nbl = lightDistanceData.GetCount(); for(LONG l=0;l<nbl&&l<light->_nbl;l++) { light->_distance[l] = lightDistanceData[l]; } } CDataArrayBool revertData( in_ctxt, ID_IN_Revert ); light->_reverse = revertData[0]; CDataArrayFloat pushData( in_ctxt, ID_IN_Push ); light->_push = pushData[0]; CDataArrayVector3f viewData( in_ctxt, ID_IN_ViewPosition ); light->_view = viewData[0]; light->Build(); in_ctxt.PutUserData((CValue::siPtrType)light); } return CStatus::OK; }