+2 votes

I've create a custom webcam Resource that extends the Texture in a module. Most of the code is hacked together using bits from the theora video player and image texture. Everything works as expected but I can't serialize any properties. They show up in the resource editor. But won't get saved. Do I need to add something else?

// header
class AravisStream: public Texture{
    OBJ_TYPE(AravisStream, Texture);

    static void _bind_methods();

float getFrameRate() const;
void setFrameRate(float value);
int getExposure() const;
void setExposure(int value);


void AravisStream::_bind_methods(){
    ObjectTypeDB::bind_method("start", &AravisStream::start);
    ObjectTypeDB::bind_method("stop", &AravisStream::stop);
    ObjectTypeDB::bind_method("update", &AravisStream::update);

    ObjectTypeDB::bind_method("setExposure", &AravisStream::setExposure);
    ObjectTypeDB::bind_method("getExposure", &AravisStream::getExposure);

    ObjectTypeDB::bind_method("setFrameRate", &AravisStream::setFrameRate);
    ObjectTypeDB::bind_method("getFrameRate", &AravisStream::getFrameRate);

    ADD_PROPERTY(PropertyInfo(Variant::INT,"exposure",PROPERTY_HINT_RANGE,"0,33200,1",PROPERTY_USAGE_EDITOR), _SCS("setExposure"), _SCS("getExposure"));
    ADD_PROPERTY(PropertyInfo(Variant::REAL,"frameRate",PROPERTY_HINT_RANGE,"0,40,.1",PROPERTY_USAGE_EDITOR), _SCS("setFrameRate"), _SCS("getFrameRate"));

in Engine by (61 points)

1 Answer

0 votes
Best answer

Oops. I get it now. Maybe I shouldn't add the PROPERTY_USE_EDITOR flag... solved and sorry for the noise.

by (61 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.