newlayer = insertlayer(NIL,...) how does it work?

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1180
Joined: Sun Feb 14, 2010 7:11 pm

newlayer = insertlayer(NIL,...) how does it work?

Post by Bugala »

I couldnt find it from manual by quick look, but if i correctly remember, since Hollywood4.5 or soemthing we hadnt had need to worry about next free layers number anymore.

I think it was something like this:

newlayer = InsertLayer(NIL, #BRUSH, brushnumber, x, y)
setlayername(newlayer, "name")

Point was that when you put layers number as NIL, then it would simply assign next free layer number to the layer and return its value.

However, at least when i do it this way, it doesnt work.

So anyone knows how it worked?

Also, is there possibility to set the name of Layer instantly someway, in way of:

InsertLayer(NIL, #BRUSH, brushnumber, x, y, { name="name" })

Its possible to do with TextOut() - command this way, but as far as i remember, it havent worked in this InsertLayer() - command.
PEB
Posts: 569
Joined: Sun Feb 21, 2010 1:28 am

Re: newlayer = insertlayer(NIL,...) how does it work?

Post by PEB »

As long as you have layers enabled, you can just use display brush, and assign a name (and other layer attributes) from DisplayBrush().

For example:
DisplayBrush(1, 50, 50, {Name="LayerName"})

This will display your brush as a new layer and assign the layer name "LayerName" to it.
Bugala
Posts: 1180
Joined: Sun Feb 14, 2010 7:11 pm

Re: newlayer = insertlayer(NIL,...) how does it work?

Post by Bugala »

Aw blasted! - So thats how it works.

No wonder i couldnt find it from manual.

Thanks a Dozen from that. This isnt the first time ive been looking for that answer, but right now it seems it might be even necessary to get it done that way, since im having bit of difficulty keeping track on next free layer.

Thanks a lot. Might be a real life saver!
Bugala
Posts: 1180
Joined: Sun Feb 14, 2010 7:11 pm

Re: newlayer = insertlayer(NIL,...) how does it work?

Post by Bugala »

hmm, one more questio concerning this DisplayBrush()

if i do:

loadbrush(1, firstfilename)
displaybrush(1, x, y, {name="name1"}
laodbrush(1, secondname)
displaybrush(1, x, y, {name="name2"}


Do i now have one or two layers?


If i have only 1 layer, then is there way to for example use NIL instead of 1 to have two layers?

The thing I am most wanting is to get rid of need to keep an eye on the "next free layer".

I rather just put layer on screen, name it right away and after that keep using it with that name without needing to hassle with layernumbers at all.
PEB
Posts: 569
Joined: Sun Feb 21, 2010 1:28 am

Re: newlayer = insertlayer(NIL,...) how does it work?

Post by PEB »

You have two layers with that example.

Assuming you have layers enabled, even if you only load one brush, if you display it 5 times, then you are making 5 separate layers with it.
Post Reply