apply a value contained in layer name to an object
Hi,
I would like to add a fonctionnality to a little script :
In octane render (for eg )you can assign a layer ID to an object.
I would like to apply this ID if the object is in a layer which name contain a specific string :
layer name : thenameIwant - LID_2 or thenameIwant / LID_2 or thenameIwant LID_2
when running script it will set all objects in the layer the Layer ID 2.
(setUserProp $ "octane_layer_ID" 2)
when no string match it will set all objects in the layer the Layer ID 1.
if somebody help for this I could post the script on scriptspot with credit :-)
Comments
I found how to do this... If
I found how to do this...
If it can help someone :
for i = 0 to layerManager.count-1 where matchPattern (LayerManager.getLayer i).name pattern:"*LAYERID*"
do
(
local objArray = #()
layerName = (LayerManager.getLayer i).name
FST = findString layerName "LAYERID"
SB = substring layerName (FST+7) -1
Var = SB as integer
(LayerManager.getLayer i).nodes &theNodes
join objArray theNodes
for aa in objArray do (setUserProp aa "octane_layer_ID" Var)
max select none
)
I tried to isolate the value
I achieve to extract values...
example layers :
LID01
LID02
LID03...
for i = 1 to layerManager.count-1 do
(
ilayer = layerManager.getLayer i
layerName = ilayer.name
MP= matchPattern layerName pattern:"LID?"
if MP=true do
(
FST = findString layerName "LID"
SB = substring layerName (FST+3) 100
print SB
)
)