GameOfLife / Unit-Lib

The Unit Library is a system that provides high level abstractions on top of the SuperCollider language.
25 stars 6 forks source link

EnvView changing curve with mouse failing (in linux ?) #31

Closed miguel-negrao closed 10 years ago

miguel-negrao commented 10 years ago

I get the error

ERROR: binary operator '-' failed.
RECEIVER:
   nil
ARGS:
   Float 0.631579   0D79435E 3FE435E5
   nil
CALL STACK:
    DoesNotUnderstandError:reportError   0xffcbf78
        arg this = <instance of BinaryOpFailureError>
    Nil:handleError   0xffc7068
        arg this = nil
        arg error = <instance of BinaryOpFailureError>
    Thread:handleError   0xffc5598
        arg this = <instance of Thread>
        arg error = <instance of BinaryOpFailureError>
    Object:throw   0xff95d48
        arg this = <instance of BinaryOpFailureError>
    Object:performBinaryOpOnSomething   0x12d664d8
        arg this = nil
        arg aSelector = '-'
        arg thing = 0.63157894736842
        arg adverb = nil
    Env:at   0xff92438
        arg this = <instance of EnvM>
        arg time = 0.63157894736842
        var data = [*1]
    < FunctionDef in Method EnvPlotView:makeView >  (no arguments or variables)
    < FunctionDef in Method EnvPlotView:makeView >   0x7fa9a004d448
        arg vw = <instance of ScaledUserView>
        arg x = 0.63157894736842
        arg y = 0.2280701754386
        arg mod = 0
        var bounds = <instance of Rect>
        var pts = [*3]
    < FunctionDef in Method ScaledUserView:init >   0x7fa9a00c9fa8
        arg v = <instance of QUserView>
        arg x = 108
        arg y = 39
        arg m = 0
        arg buttonNumber = 0
        arg clickCount = 1
        var scaledX = 0.63157894736842
        var scaledY = 0.2280701754386
        var isInside = true
    QView:mouseDownEvent   0x7fa9a00d3c68
        arg this = <instance of QUserView>
        arg x = 108
        arg y = 39
        arg modifiers = 0
        arg buttonNumber = 0
        arg clickCount = 1
^^ The preceding error dump is for ERROR: binary operator '-' failed.
RECEIVER: nil
``'
miguel-negrao commented 10 years ago

UEnv was being left with offset as nil, which made Env.at fail. I can now use the EnvView without errors.

woutersnoei commented 10 years ago

Ah, oops, I found that the fix isn't SC3.5 compatible. Apparently offset is new in 3.6. In 3.5 get a 'Message 'offset_' not understood' on EnvM. Not sure how to fix..

woutersnoei commented 10 years ago

Just tried a fix, can you test on your version if this works?

miguel-negrao commented 10 years ago

Ah, sorry didn't realize that, I always forget I'm on 3.7. I tested your commit and it's working fine here !