Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

ofParameterGroup does not accept ofParameter< ofVec2f > but ofParameter< ofDefaultVec2 >

$
0
0

@pierre_tardif00 wrote:

Hi,

I noticed that when trying to add an ofParameter < ofVec2f > to ofParameterGroup, i got this error:

[warning] ofxBaseGroup; no control for parameter of type 11ofParameterI7ofVec2fE
and the sliders don’t appear.
(the same problem occurred with ofVec3f and ofVec4f ).

Though the ofxGuiGroup should accept the type ofVec2f, in ofxGuiGroup.cpp line 85:

}else if(type == typeid(ofParameter <ofDefaultVec2> ).name()){

I tried replacing ofVec2f with ofDefaultVec2 while adding it to an ofParameterGroup and it works, but I guess it should be possible to use ofVec2f ? Or am I missing something here?

here is my code if you want to test it :slight_smile:

ofApp.h :

#pragma once

#include “ofMain.h”
#include “ofxGui.h”

class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();

    ofParameter<float> size;
    ofParameter< ofDefaultVec2 > number1;
    ofParameter< ofVec2f > number2;
    ofParameter<bool> check;
    ofParameterGroup parameters1;
    ofParameterGroup parameters2;
    ofParameter<ofColor> color;
    ofxPanel gui;

};

ofApp.cpp :

#include “ofApp.h”

//--------------------------------------------------------------
void ofApp::setup(){
gui.setup();

parameters1.setName("parameters");
parameters1.add(size.set("size",10,0,100));

// gui.add(number.set(“number”,ofVec2f(0,0), ofVec2f(-10,-10), ofVec2f(10,10)));
parameters1.add(number1.set(“number1”,ofVec2f(0,0), ofVec2f(-10,-10), ofVec2f(10,10)));
parameters1.add(number2.set(“number2”,ofVec2f(0,0), ofVec2f(-10,-10), ofVec2f(10,10)));
parameters1.add(check.set(“check”,false));
parameters1.add(color.set(“color”,ofColor(127),ofColor(0,0),ofColor(255)));
parameters2.setName(“testParameters”);
parameters2.add(parameters1);
gui.add(parameters2);

}

//--------------------------------------------------------------
void ofApp::update(){

}

//--------------------------------------------------------------
void ofApp::draw(){
gui.draw();

}

Best,

P

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4929

Latest Images

Trending Articles



Latest Images