/*
Script UnwrapUVW Editor AutOOpen v1.8
Author: Nikolay Litvinov
There is no need to take care in the modifer UnwrapUVW to disable IgnoreBackFaceCull.
And automatically enable UV Editor
1)Assigns unwrap UVW
2)Disables IgnoreBackFaceCull off
3)Entry in the UV Editor
4)Set subobjectLevel = polygons
5)Enables Freeform Mode transformations
*/
messagebox("Actions are stored in Category: \"Niklit Scripts\"")

macroScript UnwrapUVW_Editor_AutOOpen
	Category:"Niklit Scripts"
	Tooltip:"UnwrapUVW Editor AutOOpen"
(
fn FN_Unwrap_Editor fnO = (
	if classof fnO==Unwrap_UVW then
	(fnO.setIgnoreBackFaceCull off
	 fnO.edit()
	 fnO.unwrap.move ()
	 fnO.unwrap2.setFreeFormMode on)
	)
	
curO = modPanel.getCurrentObject()
if classof curO!=Unwrap_UVW then
(
if getCommandPanelTaskMode() != #modify then (max modify mode)
shapeArr = For obj in selection where superclassof obj==shape collect obj
	if shapeArr.count==0 then modPanel.addModToSelection (Unwrap_UVW ()) ui:on
		else 
			(For obj in selection where superclassof obj == GeometryClass do
			addModifier obj (Unwrap_UVW ())
			messageBox ((shapeArr.count as String)+" SplineShape selected \n Select geometry for UnwrapUVW")
			)
curO = modPanel.getCurrentObject()
FN_Unwrap_Editor curO
) else
FN_Unwrap_Editor curO
)