[Closed] A layer question
Everybody Happy New Year!
I meet a question ,hope help
I select a object, I want to isolate layer of selected object .
Use maxscript how to do ?
If I’ve understood correctly what you want is a way to get the layer where a node is in, right?. If so…
fn getNodeLayer node = (
local nLayer = 0
local found = undefined
if node != undefined and selection.count == 1 do (
do (
local layerRef = (LayerManager.getLayer nLayer).layerAsRefTarg
local nodesInLayer = #()
if (layerRef.nodes &nodesInLayer) do (
local index = findItem nodesInLayer node
if index != 0 do found = layerRef
)
nLayer += 1
) while (found == undefined) and nLayer < (LayerManager.count)
)
return found
)
I don’t know if this is the best way to do this but it is the first that I came with.
Happy new year.
Thank HalfVector
vbmenu_register(“postmenu_2943639”, true); you are right ,I need a (fn)
but how to let (fn) work ?
Imagine you have a box named “Box01”. And this box is in the default layer “0”. To get the layer where the box is in, you should call the function I wrote like this:
layer = getNodeLayer $Box01
So now, you can access all the properties of the layer. For example you could do something like this to get the layer name:
layer.name
Take a look at the LayerProperties interface in the MAXScript reference to know more about the layer properties.
I understand
I can close the layer :
layer = getNodeLayer $
layer.on= false
but use (fn) how to isolate ?