Example #1
0
void 
DlgPass::OnProcessPGChange( wxPropertyGridEvent& e)
{
	Pass *p = getPass();

	wxString name,subname,value;
	std::string mat,lib;
	name = e.GetPropertyName();
	int index;
	index = e.GetPropertyValue().GetInteger();

	if (name == wxT("Camera")) {
		value = m_pgCamList.GetLabel(index);
		p->setCamera(std::string(value.mb_str()));	
	}
	else if (name == wxT("Viewport")) {
		if (index == 0)
			p->setViewport(RENDERMANAGER->getCamera(p->getCameraName())->getViewport());
		else {
			value = m_pgViewportList.GetLabel(index-1);
			p->setViewport(RENDERMANAGER->getViewport(std::string(value.mb_str())));
		}
	}
	else if (name == wxT("Use Render Target")) {
		p->enableRenderTarget(0 != e.GetPropertyValue().GetBool());
	}
	else if (name == wxT("Render Target")) {
		value = e.GetPropertyValue().GetString();
		if (value == wxT("None")) {
			p->setRenderTarget(NULL);
			m_PG->SetPropertyValue(wxT("Viewport"),wxT("From Camera"));
			m_PG->EnableProperty(wxT("Viewport"));
		}
		else {
			m_PG->SetPropertyValue(wxT("Viewport"), wxT("From Render Target"));
			m_PG->DisableProperty(wxT("Viewport"));
			p->setRenderTarget(RESOURCEMANAGER->getRenderTarget(std::string(value.mb_str())));
		}
	}
	//else if (name == wxT("Clear Color")) 
	//	p->setPropb(Pass::COLOR_CLEAR, (0 != e.GetPropertyValue().GetBool()));
	//else if (name == wxT("Clear Depth"))
	//	p->setPropb(Pass::DEPTH_CLEAR, (0 != e.GetPropertyValue().GetBool()));
	
	else if (name.substr(0,6) == wxT("Lights")) {

		subname = name.substr(7,std::string::npos);
		bool b = 0 != e.GetPropertyValue().GetBool();
		if (b)
			p->addLight(std::string(subname.mb_str()));
		else
			p->removeLight(std::string(subname.mb_str()));
	}
	else if (name.substr(0,6) == wxT("Scenes")) {

		subname = name.substr(7,std::string::npos);
		bool b = 0 != e.GetPropertyValue().GetBool();
		if (b)
			p->addScene(std::string(subname.mb_str()));
		else
			p->removeScene(std::string(subname.mb_str()));
	}
	else if (name.substr(0,13) == wxT("Material Maps")) { // Material Maps

		subname = name.substr(14, std::string::npos);
		if (subname == wxT("*"))
			value = m_pgMaterialListPlus.GetLabel(e.GetPropertyValue().GetInteger());
		else
			value = m_pgMaterialList.GetLabel(e.GetPropertyValue().GetInteger());
		mat = std::string(value.AfterLast(':').mb_str());
		lib = std::string(value.BeforeFirst(':').mb_str());

		if (subname == wxT("*")) {
			if (mat == "*") {
				p->remapAll(lib);
				updateMats(p);
			}
			else if (value != wxT("None")) {
				p->remapAll(lib,mat);
				updateMats(p);
			}
		}
		else
			p->remapMaterial(std::string(subname.c_str()),lib,mat);
	}
	else
		PropertyManager::updateProp(m_PG, name.ToStdString(), Pass::Attribs, (AttributeValues *)p);

	//else if (name.substr(0,10) == wxT("Parameters")) {

	//	subname = name.substr(11, std::string::npos);
	//	p->setParam(std::string(subname.mb_str()), (float)(e.GetPropertyValue().GetDouble()));
	//
	//} 
}
Example #2
0
tuiomultiplexer::tuiomultiplexer(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::tuiomultiplexer)
{
    ui->setupUi(this);
    grid=new QGridLayout();
    gridGest=new QGridLayout();
    titulos[0]=new QLabel("N");
    titulos[1]=new QLabel("Host");
    titulos[2]=new QLabel("Port");
    titulos[3]=new QLabel("Active");
    titulos[4]=new QLabel("Gesture ID");
    titulos[5]=new QLabel("Train Gesture");
    gridGest->addWidget(titulos[4],0,0,1,1);
    gridGest->addWidget(titulos[5],0,1,1,1);
    gridGest->setRowStretch(0,0);
    grid->addWidget(titulos[0],0,0,1,1);
    grid->addWidget(titulos[1],0,1,1,1);
    grid->addWidget(titulos[2],0,2,1,1);
    grid->addWidget(titulos[3],0,3,1,1);
    signalMapper = new QSignalMapper(this);
    signalMapperGest=new QSignalMapper(this);
    connect(signalMapper,SIGNAL(mapped(int)),this,SLOT(activated(int)));
    connect(signalMapperGest,SIGNAL(mapped(int)),this,SLOT(startTraining(int)));
    for(int i=0;i<NUM_SER;i++){
        ports[i]=new QSpinBox();
        ports[i]->setMinimum(0);
        ports[i]->setMaximum(65000);
        ports[i]->setValue(3333+i+1);
        hosts[i]=new QLineEdit("localhost");
        labels[i]=new QLabel(QString::number(i+1));
        actives[i]=new QCheckBox();
        grid->addWidget(labels[i],i+1,0,1,1);
        grid->addWidget(hosts[i],i+1,1,1,1);
        grid->addWidget(ports[i],i+1,2,1,1);
        grid->addWidget(actives[i],i+1,3,1,1);
        signalMapper->setMapping(actives[i], i);
        connect(actives[i], SIGNAL(released()), signalMapper, SLOT(map()));
        serverCreated[i]=false;
    }
    grid->setRowStretch(0,0);
    for(int i=0;i<NUM_SER;i++){
        grid->setRowStretch(i+1,1);
    }
    ui->scrollAreaContentTUIO->setLayout(grid);
    //ui->groupBox_2->setLayout(grid);
    ui->scrollAreaWidgetContents->setLayout(gridGest);
        ui->scrollAreaWidgetContents->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
        ui->scrollAreaWidgetContents->resize(ui->scrollGest->size().width() ,ui->scrollGest->size().height());
        ui->scrollGest->setWidgetResizable(true);
        ui->scrollGest->setWidget(ui->scrollAreaWidgetContents);
        ui->scrollAreaWidgetContents->adjustSize();
    this->setAttribute( Qt::WA_DeleteOnClose, true );
    clientCreated=false;
    clientHasBeenUsed=false;
    updateM=false;
    areWeCalibrating=false;
    pp=NULL;
    kindNew=4;
    workingPP=false;
    calSKT=new calibrationskt();
    timer=new QTimer(this);
    timer->start(30);
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(updateMats()));
}