ZBrushCentral

More layer puzzles

Take a look at the following bit of code:

[VarDef, A, ""] [RoutineCall, GetActiveLayer, A][Note, [StrMerge, "A", A]] [Note, [StrMerge, "Restored Current Tool ", currentTool]] [IClick, Layer:Clear] [IPress, Stroke:DragDot] [CanvasClick, x, y] [TransformSet, x, y, z, xs, ys, zs, xRot, yRot, zRot] [IPress, Transform:Edit] [VarDef, B, ""] [RoutineCall, GetActiveLayer, B][Note, [StrMerge, "B", B]]

The first line is a debug statement to ensure that the active layer at that point is layer 1.

The next few lines do things to layer 1 (supposedly).

The final line is to confirm the active layer is still layer 1.

The problems are:

  • The first debug line indicates that the active layer is in fact layer 1; but the second debug indicates it has been changed to layer 3, even though none of the intermediate instructions should have caused a layer change.

  • The Layer:Clear command has no effect on any layer.

  • The CanvasClick command does, however, draw correctly on layer 1.

  • After execution, the active layer is in fact layer 3. If I remove the lines after and including the Layer:Clear command, the active layer is left at layer 1. In other words, I’m pretty sure that my get active layer routine is functioning correctly.

So I don’t know what the heck is going on. Any insights?

Thanks,
Ken

Does it have anything to do with LAYER:Auto Select being turned on?

It’s hard to say going just by the script fragment you’ve posted…

Sven

Svengali,

Thanks for the thought. It shouldn’t, as I’m not holding down the tilde key, but I’ll check it out.

The entire script is getting a bit long, so I tried to post the smallest part of it that seemed to be causing the problem. If I still can’t solve this, I may post the whole thing.

Thanks,
Ken

The problem is caused by your variable names. I’ve no idea why it should be a problem but it’s obviously not a good idea to have variable names that are the same as interface names. Change your variable names ‘layer’ and ‘flags’ to ‘lyr’ and ‘flg’ (or something of your choosing) and all will be well.

Why not? It would be nice to see what we’ve all been writing! :smiley:

:smiley: