info_layer_media_pixelSize_x UPDATE
  • User avatar
    defkacko
    junior Member
    Posts: 6
    Joined: Mon Feb 20, 2012 1:09 am
    Location: prague

    info_layer_media_pixelSize_x UPDATE

    by defkacko » Mon Feb 20, 2012 1:39 am

    hello there,

    I am very new to scripting in modul8 and not to mention python itself - feeling like in flying circus at all :]

    I have problem to solve - neverending scrolling line of names specified from external file. This was not so difficult I've just used two text layers, split properly text into different text fields, give layers motion - so far no problem.

    but serious problem is that info_layer_media_pixelSize_x doesn't return correct pixel size of text layer - sometimes it do, sometimes it does not - so I am not able to synchronize layers motion and position properly.

    to find where my problem was i wrote this script - just to read values one by one from list and align them to the left

    Code: Select all

    #text field itself
    textField = ['basdfadsgdfsgsdfgdfsg','asdfasdfasdfasdfsd','2345435dfsgcvbxcer554t','asdgdfgsdfxcvdfsgdgfsdfgfdg','gsdfgsdfgsdfgsdfg']

    #number of elements and active index
    maxField = len(textField)
    actidxField = 0

    #resolution and text size
    resolution_x = 800.0
    textSize = 25.0

    #setting text layer text size
    modul8.setValue('direct_layer_text_size',textSize,0)

    ###########################################

    def TextChange () :
       global actidxField, textField
       
       text=''
       
       if actidxField >= maxField :
             actidxField = 0
                
       text = '__' + textField[actidxField] + '__'
       actidxField += 1
       
       modul8.setValue('direct_layer_position_x',0.0,0)
       modul8.setValue('direct_layer_text_field',text,0)
       

    def TextLeft () :
       size = modul8.getValue('info_layer_media_pixelSize_x',0)
       posX = -(resolution_x / 2)+(size/2)
       modul8.setValue('direct_layer_position_x',posX,0)

    ###########################################

          
    TextChange()
    TextLeft ()


    and for button with 'CHANGE' message

    Code: Select all

    if msg == 'CHANGE' :
       TextChange()
       TextLeft ()


    it seems to me like info_layer_media_pixelSize_x is returning pixel size of previous text field - but pls do not take this seriously.

    using version 2.6.1

    any help would be great. I am lost.

    thanx a lot
    Last edited by defkacko on Tue Mar 06, 2012 3:50 pm, edited 1 time in total.
  • User avatar
    ghostofelvis100
    activ8 member
    Posts: 99
    Joined: Mon Oct 25, 2010 10:19 pm
    Location: Lampeter, Wales, UK
    Contact:

    Re: info_layer_media_pixelSize_x

    by ghostofelvis100 » Mon Feb 20, 2012 4:44 am

    info keywords do not update their values till about 3-4 frames after the image/media element has been changed. This is a seriously annoying problem that I would like to see addressed by garagecube.

    This means that you are indeed getting the last values! To solve this you need to run a delay script through the periodical to wait for 4 counts or so.

    I could explain more later if you need, but now I'm off to have some cool dreams before my horrible alarm clock wakes me up again!
  • User avatar
    defkacko
    junior Member
    Posts: 6
    Joined: Mon Feb 20, 2012 1:09 am
    Location: prague

    Re: info_layer_media_pixelSize_x

    by defkacko » Mon Feb 20, 2012 1:00 pm

    any help would be great. if you could give me explanation i'd be happy
  • User avatar
    ghostofelvis100
    activ8 member
    Posts: 99
    Joined: Mon Oct 25, 2010 10:19 pm
    Location: Lampeter, Wales, UK
    Contact:

    Re: info_layer_media_pixelSize_x

    by ghostofelvis100 » Mon Feb 20, 2012 3:30 pm

    I do have a routine I wrote which should solve this - I'll post it here when I get back to my machine, and acquire a spare moment.

    Basically, you need to set up 2 variables:

    #1st a Boolean value to trigger the delay:-
    InfoDelay = False

    #2nd an integer to work as a frame count:-
    InfoCount = 0

    Then, on the periodical script something like this:-

    if InfoDelay:
    InfoCount += 1
    if InfoCount >= 4
    InfoCount = 0
    InfoDelay = False
    modul8.getValue('info_blah', 0) #or a call to your function textLeft()?

    then, instead of calling the getValue, you would simply set:-
    InfoDelay = True

    This code is just of the top of my head and is untested, but I hope it will give you an idea to start from. I'll have a look for the proper one later and post it up.

    This routine only really applies if you have updated the media element. I haven't played with the text element a great deal so I don't know how it applies, but the symptom you have (data echo of the previous value) sounds just like this is the cause.

    Good luck, took me quite a while to uncover this bug.

    Andy
    Last edited by ghostofelvis100 on Tue Mar 06, 2012 5:51 pm, edited 1 time in total.
  • User avatar
    defkacko
    junior Member
    Posts: 6
    Joined: Mon Feb 20, 2012 1:09 am
    Location: prague

    Re: info_layer_media_pixelSize_x

    by defkacko » Mon Feb 20, 2012 4:39 pm

    andy,

    thank you for your advice and help.

    I have to work a bit on your idea because I can not use simple interruption on whole script - some part of script have to run without interrupting. I have something in my mind ... later on I will post it here with all my neverending subtitle script
  • User avatar
    defkacko
    junior Member
    Posts: 6
    Joined: Mon Feb 20, 2012 1:09 am
    Location: prague

    Re: info_layer_media_pixelSize_x UPDATE

    by defkacko » Tue Mar 06, 2012 4:02 pm

    hi there,

    i got first beta (zeta would be more proper name:). it is working somehow now, interface is not.

    in added archive you'll find modul and text file list.txt, which should be placed in root directory.

    any comments would be greatly wellcome


    i have one serious problem - when i speed up text line, text is not flowing continuously, there are some glitches. i found same glitches when i use auto move too. it seems to me, that this is frame rate problem - don't you have any experiece with this - or solution? :)

    and another question - is it possible to name controls (sliders f.e.) like list? slider[0] - slider[x] ??


    thanks
    Attachments
    modul8.zip
    (33.36 KiB) Downloaded 473 times
  • User avatar
    defkacko
    junior Member
    Posts: 6
    Joined: Mon Feb 20, 2012 1:09 am
    Location: prague

    Re: info_layer_media_pixelSize_x UPDATE

    by defkacko » Tue Mar 06, 2012 4:06 pm

    and one more question: is it possible to have more lines in button caption?
  • vanakaru
    master
    Posts: 669
    Joined: Mon Sep 25, 2006 9:24 pm

    Re: info_layer_media_pixelSize_x UPDATE

    by vanakaru » Tue Mar 06, 2012 9:52 pm

    [quote="defkacko"
    i have one serious problem - when i speed up text line, text is not flowing continuously, there are some glitches. i found same glitches when i use auto move too. it seems to me, that this is frame rate problem - don't you have any experiece with this - or solution? :)

    [/quote]

    Maybe this explanation by Mark Coniglio / TroikaTronix, Creator of Isadora about text in quicktime gives you some clue:
    When you play a normal movie, QuickTime basically feeds the bits right to the Graphics card and allows them to be rendered. It's all quite efficient.

    But when you have a text track, it 1) creates a RAM based bitmap, 2) uses very old (QuickDraw) technology to render the characters, 3) and then sends the result off to the GPU. If you have a movie _and_ a text track, it's even worse.

    Now, it could be Isadora. But it also could be that more recent version of the operating system (e.g., 10.7) are dealing with this situation less and less well since Apple is not doing any further updates to QuickTime.


    http://forum.troikatronix.com/cgi-bin/f ... gine#13327
  • User avatar
    defkacko
    junior Member
    Posts: 6
    Joined: Mon Feb 20, 2012 1:09 am
    Location: prague

    Re: info_layer_media_pixelSize_x UPDATE

    by defkacko » Tue Mar 06, 2012 11:44 pm

    thanks a lot for your answer :]
  • User avatar
    ghostofelvis100
    activ8 member
    Posts: 99
    Joined: Mon Oct 25, 2010 10:19 pm
    Location: Lampeter, Wales, UK
    Contact:

    Re: info_layer_media_pixelSize_x UPDATE

    by ghostofelvis100 » Thu Mar 08, 2012 12:38 am

    Hiya,

    Firstly, well done indeed. Cunning bit of python there!

    Looks marvellous. Shame it eats up 10 layers for 5 lines of text though... I'd like to see those speed & size knobs linked up.

    Firstly I got confused with the placing of the text file. When you said 'root' directory I assumed it was the user directory, but it was actually the root of the HardDisc itself.

    Secondly, about the frame rate I would ask Vanakaru if you are using any other modules along side this. I found that the text module alone would use about 15% cpu, but running alongside my Gener8 modules (which use about 20% together which is very hungry I know), it went right up to 90% on the cpu (incidentally Modul8 uses about 15% with all modules paused), causing the obvious drops in frame rate when trying to do anything like move the y_position

    With a quick read through the code, it all looks very efficient. But I could well have missed something.

    With the text module running on its own, it behaved itself very nicely.

    Hope this helps, and I'm glad to see the progress
    :D

    Andy T.
  • vanakaru
    master
    Posts: 669
    Joined: Mon Sep 25, 2006 9:24 pm

    Re: info_layer_media_pixelSize_x UPDATE

    by vanakaru » Thu Mar 08, 2012 9:57 am

    ghostofelvis100 wrote: about the frame rate I would ask Vanakaru if you are using any other modules along side this


    Actually I do not test this myself. I was just reading and passing something that I came across recently.

Who is online

Users browsing this forum: No registered users and 9 guests