linking a script to a modul interface button
  • samichlamich
    junior Member
    Posts: 7
    Joined: Wed Dec 06, 2006 11:26 am
    Location: Amsterdam
    Contact:

    linking a script to a modul interface button

    by samichlamich » Fri Aug 17, 2007 5:37 pm

    Hello,
    After reading Modul8 documentation and few tutorials about Python programmation, I still have a basic question about the way of using scripts with modul8.

    I wrote a very simple script wich is making a progressive fade out on a layer (alpha value getting down slowly automaticaly). It's working correctly, but I have to restart the module every time I want to use it.

    So, what I would like is to design a very simple module interface with only one button wich would start the fade out (and that I should assign to a midi controller then). It doesn't sound so complicated, but I can not find it.
    Does anyone could explain me how to do this ?

    greetings
    Mr Miche de Pain
  • Lupin
    garageCube team
    Posts: 383
    Joined: Fri Aug 18, 2006 12:37 pm
    Location: France
    Contact:

    by Lupin » Mon Aug 20, 2007 12:56 am

    I wrote a very simple script wich is making a progressive fade out on a layer (alpha value getting down slowly automaticaly). It's working correctly, but I have to restart the module every time I want to use it.

    the easiest way to built this module is to modify the crossfader(master) module :

    go to the PeriodicalEvent bloc then change every occurences of:

    Code: Select all

    modul8.getValue ('ctrl_master_crossfader_slider',0)


    to

    Code: Select all

    modul8.setValue ('ctrl_layer_alpha',pos,0)


    the result should be:

    Code: Select all

    if run :
       
       if sec > 0 :
          pos = modul8.getValue ('ctrl_layer_alpha',0)
          inc = (elapsed / sec) * dir
          pos += inc
          
          if pos > 1 : pos = 1; run = 0
          elif pos < 0 : pos = 0 ; run = 0
       
       elif dir == 1 : pos = 1 ; run = 0
       else : pos = 0 ; run = 0
       
       modul8.setValue ('ctrl_layer_alpha',pos,0)


    then go back to the visual editor and change caption for <<A and >>B buttons to 0% and 100% for instance.

    this module is great coz you can set a fading time in seconds
    caution!! the default fade time in the module is set to 0seconds so if you want to set a minimum time for your default fading time, go to the script in the init block then change

    Code: Select all

    sec = 0

    to

    Code: Select all

    sec = 3


    3 seconds here for instance
    when you change you'll notice that the new default fading time value doesn't match displayed values. You gotta add this script at the end of the script in the init block:

    Code: Select all

    module.setValue ('secFader',0,sec)
    module.setValue ('sec',0,sec)


    a last important thing is to go back to the visual part and check the
    layer contextual chekbox (or else your fade process will stop when you focus on another layer)

    i just uploaded the module if you want to see changes and check you did everything right go to the public library and check for the Alpha time fader(alpha) module

    enjoy Python! :)
    Gael Abegg Gauthey (former known as Lupin)
    https://www.linkedin.com/in/abegg-gauthey/
  • samichlamich
    junior Member
    Posts: 7
    Joined: Wed Dec 06, 2006 11:26 am
    Location: Amsterdam
    Contact:

    by samichlamich » Tue Aug 21, 2007 12:23 pm

    merci merci merci...
    au passage, j'ai regardé votre site Vision Sonore, c'est bien bien cool ce que vous faites. ça a l'air assez pro. Chapô. Pour l'instant je travaille à l'étranger mais je reviens sur Grenoble-Lyon fin octobre. J'espère qu'on pourra se croiser entre deux montagnes....
    Sur ces entrefaits, je vais continuer en anglais, des fois que la discution intéresse quelqu'un d'autre.

    The module you have designed is really perfect, i wasn't excpecting so much...and you can set easily the time of fading !! :D Greatttt
    but the thing is that I can not make it run properly on my computer :cry:

    Maybe it is only working with Modul 8 V2.5 (cause i'm still on 2.03) ?
    Anyway i'm going to try to rebuild it in my own way, because it's a great tool (for me at least) that you imagined.

    just a last question, is the fading supposed to fade only one layer, or the Master Alpha ?

    merci encore
    conservation !
    >>>>>>>>>>>>>>>>>>>>>>
    Vidéos
    http://blog.myspace.com/samichlamich
    <<<<<<<<<<<<<<<<<<<<<<
    Grafic Design
    http://samichlamich.free.fr/
  • samichlamich
    junior Member
    Posts: 7
    Joined: Wed Dec 06, 2006 11:26 am
    Location: Amsterdam
    Contact:

    by samichlamich » Tue Aug 21, 2007 2:10 pm

    So, finally I rebuild the module completly on my own computer...and it's working perfect :D :D :D ... and now I understand it a little bit more.

    just one question, how did you modify the crossfader(master) module you are speking about ? I mean, where (how) did you find it ?

    Once more, a big big thanks.
    peace

    Lamiche
    >>>>>>>>>>>>>>>>>>>>>>
    Vidéos
    http://blog.myspace.com/samichlamich
    <<<<<<<<<<<<<<<<<<<<<<
    Grafic Design
    http://samichlamich.free.fr/
  • Lupin
    garageCube team
    Posts: 383
    Joined: Fri Aug 18, 2006 12:37 pm
    Location: France
    Contact:

    by Lupin » Tue Aug 21, 2007 2:26 pm

    samichlamich wrote:The module you have designed is really perfect, i wasn't excpecting so much...and you can set easily the time of fading !! :D Greatttt
    but the thing is that I can not make it run properly on my computer :cry:

    Maybe it is only working with Modul 8 V2.5 (cause i'm still on 2.03) ?
    Anyway i'm going to try to rebuild it in my own way, because it's a great tool (for me at least) that you imagined.


    you are welcome, it's only a small modification from the great crossfader module. probably it doesn"t work on a 2.03 version, i'm running the last version of M8. this module is part of the 2.5 default modules i guess.

    just a last question, is the fading supposed to fade only one layer, or the Master Alpha ?

    this module fades only one layer at once, it doesn"t affect the Master Alpha.
    if you want to create a module to fade the Master alpha property just change every occcurences of

    Code: Select all

    'ctrl_layer_alpha'

    to

    Code: Select all

    'ctrl_master_alpha'


    Passe donc prendre une bière à VisionSonor quand tu seras de retour sur la région ;)
    Gael Abegg Gauthey (former known as Lupin)
    https://www.linkedin.com/in/abegg-gauthey/

Who is online

Users browsing this forum: No registered users and 6 guests