Page 1 of 1

info_layer_media_pixelSize_x UPDATE

Posted: Mon Feb 20, 2012 1:39 am
by defkacko
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

Re: info_layer_media_pixelSize_x

Posted: Mon Feb 20, 2012 4:44 am
by ghostofelvis100
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!

Re: info_layer_media_pixelSize_x

Posted: Mon Feb 20, 2012 1:00 pm
by defkacko
any help would be great. if you could give me explanation i'd be happy

Re: info_layer_media_pixelSize_x

Posted: Mon Feb 20, 2012 3:30 pm
by ghostofelvis100
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

Re: info_layer_media_pixelSize_x

Posted: Mon Feb 20, 2012 4:39 pm
by defkacko
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

Re: info_layer_media_pixelSize_x UPDATE

Posted: Tue Mar 06, 2012 4:02 pm
by defkacko
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

Re: info_layer_media_pixelSize_x UPDATE

Posted: Tue Mar 06, 2012 4:06 pm
by defkacko
and one more question: is it possible to have more lines in button caption?

Re: info_layer_media_pixelSize_x UPDATE

Posted: Tue Mar 06, 2012 9:52 pm
by vanakaru
[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

Re: info_layer_media_pixelSize_x UPDATE

Posted: Tue Mar 06, 2012 11:44 pm
by defkacko
thanks a lot for your answer :]

Re: info_layer_media_pixelSize_x UPDATE

Posted: Thu Mar 08, 2012 12:38 am
by ghostofelvis100
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.

Re: info_layer_media_pixelSize_x UPDATE

Posted: Thu Mar 08, 2012 9:57 am
by vanakaru
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.