New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak Mode does not always work in version 3.0b5 #3742

Closed
PhilipSharman opened this Issue Aug 30, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@PhilipSharman

PhilipSharman commented Aug 30, 2015

Using "tweak mode" (Sketch > Tweak) does not always work. The presence of some comments before the variable(s) to be tweaked seems to make a difference.

For example, this sketch works:

void setup() {
    size(800, 800);
    background(0);
    fill(255);
}

void draw() {
    // 
    float diam = 100;
    ellipse(width/2, height/2, diam, diam);
}

But this sketch does not (the sketch runs, but the diam variable is not tweakable):

void setup() { 
    size(800, 800);
    background(0);
    fill(255);
}

void draw() {
    // test tweak
    float diam = 100;
    ellipse(width/2, height/2, diam, diam);
}

The only different is the comment.

@galsasson

This comment has been minimized.

Show comment
Hide comment
@galsasson

galsasson Aug 31, 2015

Contributor

Hi,
This is actually an old feature of tweak mode.
If you want to tweak only certain values in the code you can add a comment with 'tweak' at the end of the lines that you want tweakable. Like so:

float diam = 100   // tweak

In this case tweak mode will ignore all other numbers in the sketch.

Any suggestions what to do here? @shiffman, @benfry, @REAS?
Do we want to eliminate this behavior?

Thanks for reporting this @PhilipSharman

Contributor

galsasson commented Aug 31, 2015

Hi,
This is actually an old feature of tweak mode.
If you want to tweak only certain values in the code you can add a comment with 'tweak' at the end of the lines that you want tweakable. Like so:

float diam = 100   // tweak

In this case tweak mode will ignore all other numbers in the sketch.

Any suggestions what to do here? @shiffman, @benfry, @REAS?
Do we want to eliminate this behavior?

Thanks for reporting this @PhilipSharman

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 31, 2015

Member

Huh... wasn't aware of that. I think I'd lean toward using something slightly less generic, i.e.:

  • use /// tweak (with three slashes) or something more specific than just "tweak"
  • also only do it when it's the only thing in the comment (i.e. // tweak here wouldn't do it)
  • only allow it for a comment on the same line?

The case in this report seems way too likely to happen on accident (with confusing results—I figured this was just a bug too).

Does it still work if there are multiple variables on the same line?

Member

benfry commented Aug 31, 2015

Huh... wasn't aware of that. I think I'd lean toward using something slightly less generic, i.e.:

  • use /// tweak (with three slashes) or something more specific than just "tweak"
  • also only do it when it's the only thing in the comment (i.e. // tweak here wouldn't do it)
  • only allow it for a comment on the same line?

The case in this report seems way too likely to happen on accident (with confusing results—I figured this was just a bug too).

Does it still work if there are multiple variables on the same line?

@REAS

This comment has been minimized.

Show comment
Hide comment
@REAS

REAS Aug 31, 2015

Member

I'm with Ben. I think that behavior should either be removed or modified to make it a more specific syntax.

Member

REAS commented Aug 31, 2015

I'm with Ben. I think that behavior should either be removed or modified to make it a more specific syntax.

@galsasson

This comment has been minimized.

Show comment
Hide comment
@galsasson

galsasson Sep 8, 2015

Contributor

Ok thanks,
I'll change it to be '///tweak' as the last characters on the line, let me know if you want more specific.
If you have multiple numbers on the same line, it will apply to all of them (they all be tweakable). This way its up for the coder to set it up:

// all
ellipse(100, 100, 300, 500);   ///tweak
// one
ellipse(100, 100, 
             300, ///tweak
             500);

Actually, what started as a way to "toggle" tweak-mode, became later on, on this branch a feature to setup a limit to the range. I needed it for a project where I created random sketch versions.

ellipse(x, y, 100, 100) // tweak[0-200]

I can bring it to life if theres interest.

Contributor

galsasson commented Sep 8, 2015

Ok thanks,
I'll change it to be '///tweak' as the last characters on the line, let me know if you want more specific.
If you have multiple numbers on the same line, it will apply to all of them (they all be tweakable). This way its up for the coder to set it up:

// all
ellipse(100, 100, 300, 500);   ///tweak
// one
ellipse(100, 100, 
             300, ///tweak
             500);

Actually, what started as a way to "toggle" tweak-mode, became later on, on this branch a feature to setup a limit to the range. I needed it for a project where I created random sketch versions.

ellipse(x, y, 100, 100) // tweak[0-200]

I can bring it to life if theres interest.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 11, 2015

Member

The ranges sound like a useful feature, but not if it's too much work or additional mess.

Member

benfry commented Sep 11, 2015

The ranges sound like a useful feature, but not if it's too much work or additional mess.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Sep 11, 2015

Member

Changed hasTweakComment() to use /// tweak for 3.0 beta 6.

Member

benfry commented Sep 11, 2015

Changed hasTweakComment() to use /// tweak for 3.0 beta 6.

@benfry benfry closed this in 1f75b51 Sep 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment