Layer Order: il seguente script seleziona vari elementi e li unisce nei relativi Layer.

Al momento supporta i seguenti tipi:

  • Geometry
  • Warps
  • Luci
  • Camera
  • Helper
  • Spline

global Layer_Order
try(destroyDialog Layer_Order)catch()
rollout Layer_Order "Layer Order Option"

(
fn Reset_all_Layer = 
	(
	/*Select all spaceWARPS and put in warps layer*/
	if layer99 = layermanager.newLayerFromName "Space Warps" == undefined /*se esiste già il layer "warps"*/
	then
	(
		layer99 = (layermanager.getLayerFromName "Space Warps") /*assegna la variabile layer99 al layer "warps"*/
		select (for s in spacewarps collect s) /*seleziona tutti i warps*/
		for s in selection do layer99.addnode s /*aggiungi la selezione al layer*/
	)
	else (
		layermanager.newLayerFromName "Space Warps" /*creo il layer warps*/
		layer99 = (layermanager.getLayerFromName "Space Warps" ) /*assegno variabile al layer99*/
		select (for s in spacewarps collect s)
		for s in selection do layer99.addnode s /*aggiungi la selezione al layer*/
	)
	clearSelection()

	/*Select all Lights and put in Lights layer*/
	if layer98 = layermanager.newLayerFromName "Lights" == undefined /*se esiste già il layer "Lights"*/
	then
	(
		layer98 = (layermanager.getLayerFromName "Lights") /*assegna la variabile layer98 al layer "Lights"*/
		select (for l in Lights collect l) /*seleziona tutti i Lights*/
		for l in selection do layer98.addnode l /*aggiungi la selezione al layer*/
	)
	else (
		layermanager.newLayerFromName "Lights" /*creo il layer Lights*/
		layer98 = (layermanager.getLayerFromName "Lights") /*assegno variabile al layer98*/
		select (for l in Lights collect l)
		for l in selection do layer98.addnode l /*aggiungi la selezione al layer*/
	)
	clearSelection()

	/*Select all Camera and put in Camera layer*/
	if layer97 = layermanager.newLayerFromName "Camera" == undefined /*se esiste già il layer "Camera"*/
	then
	(
		layer97 = (layermanager.getLayerFromName "Camera") /*assegna la variabile layer97 al layer "Camera"*/
		select (for c in Cameras collect c) /*seleziona tutti i Camera*/
		for c in selection do layer97.addnode c /*aggiungi la selezione al layer*/
	)
	else (
		layermanager.newLayerFromName "Camera" /*creo il layer Camera*/
		layer97 = (layermanager.getLayerFromName "Camera") /*assegno variabile al layer97*/
		select (for c in Cameras collect c)
		for c in selection do layer97.addnode c /*aggiungi la selezione al layer*/
	)
	clearSelection()

	/*Select all Helpers and put in Helpers layer*/
	if layer101 = layermanager.newLayerFromName "Helpers" == undefined /*se esiste già il layer "Helpers"*/
	then
	(
		layer101 = (layermanager.getLayerFromName "Helpers") /*assegna la variabile layer101 al layer "Helpers"*/
		select (for h in helpers where h.category == #standard collect h) /*seleziona tutti i Helpers*/
		for h in selection do layer101.addnode h /*aggiungi la selezione al layer*/
	)
	else (
		layermanager.newLayerFromName "Helpers" /*creo il layer Helpers*/
		layer101 = (layermanager.getLayerFromName "Helpers" ) /*assegno variabile al layer101*/
		select (for h in helpers where h.category == #standard collect h)
		for h in selection do layer101.addnode h /*aggiungi la selezione al layer*/
	)
	clearSelection()

	/*Select all Spline and put in Spline layer*/
	if layer96 = layermanager.newLayerFromName "Shape" == undefined /*se esiste già il layer "Shape"*/
	then
	(
		layer96 = (layermanager.getLayerFromName "Shape") /*assegna la variabile layer96 al layer "Shape"*/
		select (for s in shapes where s.category == #splines collect s) /*seleziona tutti i Shape*/
		for s in selection do layer96.addnode s /*aggiungi la selezione al layer*/
	)
	else (
		layermanager.newLayerFromName "Shape" /*creo il layer Shape*/
		layer96 = (layermanager.getLayerFromName "Shape" ) /*assegno variabile al layer96*/
		select (for s in shapes where s.category == #splines collect s)
		for s in selection do layer96.addnode s /*aggiungi la selezione al layer*/
	)
	clearSelection()
)

fn Delete_EmptyLayer = 
(
/*Delete empty layers*/
	for i=((layerManager.count)-1) to 0 by -1 do
	(
		layerobj = LayerManager.getLayer i
		layername = layerobj.name
		layerManager.deleteLayerByName layername
	)

)

fn Reset_select_category L_Name Sel_caT = (
	-- var layer_RND_Number
	Layer_name = L_Name
	Sel_caT2 = Sel_caT
	if layer97 = layermanager.newLayerFromName L_Name == undefined /*se esiste già il layer "L_Name"*/
		then
		(
			layer97 = (layermanager.getLayerFromName L_Name) /*assegna la variabile layer97 al layer "L_Name"*/
			select (for c in Sel_caT2 collect c) /*seleziona tutti i Sel_caT*/
			for c in selection do layer97.addnode c /*aggiungi la selezione al layer*/
		)
		else 
		(
			layermanager.newLayerFromName L_Name /*creo il layer FumeFX*/
			layer97 = (layermanager.getLayerFromName L_Name ) /*assegno variabile al layer89*/
			select (for x in Sel_caT2 collect x)
			for x in selection do layer97.addnode x /*aggiungi la selezione al layer*/
		)
		clearSelection()
)

/* Main interface*/

button Reset_all_Category "Reset all Layer" align:#left
button Delete_EmptyLayer_button "Delete Empty Layer" align:#left
group "Class select"
(
radiobuttons Category_Flag labels:#("Camera", "Geometry", "Shape", "Lights", "Helpers", "Space Warps")
button Reset_select_calss "Reset select class" align:#left
)
on Reset_all_Category pressed do
(
	Reset_all_Layer()
)
on Delete_EmptyLayer_button pressed do
(
	Delete_EmptyLayer()
)
on Reset_select_calss pressed do
(
	if Category_Flag.state == 1 then
	(
		Reset_select_category "Camera" Cameras
	)
	if Category_Flag.state == 2 then
	(
		Reset_select_category "Geometry" Geometry
	)
	if Category_Flag.state == 3 then
	(
		Reset_select_category "Shape" Shapes
	)
	if Category_Flag.state == 4 then
	(
		Reset_select_category "Lights" Lights
	)
	if Category_Flag.state == 5 then
	(
		Reset_select_category "Helpers" Helpers
	)
	if Category_Flag.state == 6 then
	(
		Reset_select_category "Space Warps" SpaceWarps
	)
) /*End button If state*/

Button Help "Help" pos:[65,210]
on Help pressed do messageBox "Layer Order - 2014 \n Take the select elements and put them in the right layer"

label Copyright "--== Silver3d.it ==--" pos:[35,240]

) /*End rollout*/

Il codice è commentato ed è molto semplice. Siete liberi di cambiarlo e modificarlo a piacere 🙂

Se avete suggerimenti per migliorarlo fatemi sapere!