meshselect uvw auto refresh?

Hi
I have this simple script i wrote which works great for me (below)
If i change the model i need to work my way up the stack manually clicking on the "select" within mesh select modifier just to apply all the uvws.
Is there a script out there that would automatically work its way up the stack with one click? hopefully this is clear, Thanks for your help

(
tMod1 = Mesh_Select()
tMod1.name = "Mesh_Select_id1_Roof"
addModifier $ tMod1
$.modifiers[#Mesh_Select_id1_Roof].materialID = 1
modPanel.addModToSelection (Uvwmap ()) ui:on
$.modifiers[#UVW_Map].axis = 2
$.modifiers[#UVW_Map].length = 9
$.modifiers[#UVW_Map].width = 9

tMod2 = Mesh_Select()
tMod2.name = "Mesh_Select_id2_front"
addModifier $ tMod2
$.modifiers[#Mesh_Select_id2_front].materialID = 2
$.modifiers[#Mesh_Select_id2_front].enabled = false
modPanel.addModToSelection (Uvwmap ()) ui:on
$.modifiers[#UVW_Map].axis = 1
$.modifiers[#UVW_Map].enabled = false

tMod3 = Mesh_Select()
tMod3.name = "Mesh_Select_id3"
addModifier $ tMod3
$.modifiers[#Mesh_Select_id3].materialID = 3
$.modifiers[#Mesh_Select_id3].enabled = false
modPanel.addModToSelection (Uvwmap ()) ui:on
$.modifiers[#UVW_Map].axis = 1
$.modifiers[#UVW_Map].enabled = false

tMod4 = Mesh_Select()
tMod4.name = "Mesh_Select_id4"
addModifier $ tMod4
$.modifiers[#Mesh_Select_id4].materialID = 4
$.modifiers[#Mesh_Select_id4].enabled = false
modPanel.addModToSelection (Uvwmap ()) ui:on
$.modifiers[#UVW_Map].axis = 1
$.modifiers[#UVW_Map].enabled = false

tMod5 = Mesh_Select()
tMod5.name = "Mesh_Select_id5"
addModifier $ tMod5
$.modifiers[#Mesh_Select_id5].materialID = 5
$.modifiers[#Mesh_Select_id5].enabled = false
modPanel.addModToSelection (Uvwmap ()) ui:on
$.modifiers[#UVW_Map].axis = 1
$.modifiers[#UVW_Map].enabled = false

tMod6 = Mesh_Select()
tMod6.name = "Mesh_Select_id6"
addModifier $ tMod6
$.modifiers[#Mesh_Select_id6].materialID = 6
$.modifiers[#Mesh_Select_id6].enabled = false
modPanel.addModToSelection (Uvwmap ()) ui:on
$.modifiers[#UVW_Map].axis = 1
$.modifiers[#UVW_Map].enabled = false
)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pixamoon's picture

`

ah, I see now what you need.
That should be even easier. I will take a look on it after work.

pixamoon's picture

`

first i tried this oen to press select, but it still keeps old selection :(

fn ClickSelect = (
		for child in (windows.getChildrenHWND #max) where child[4] == "#32770" do 
			for classN in (windows.getChildrenHWND child[1]) where (classN[4] == "ModifyTask") do
				for btn in (windows.getChildrenHWND classN[1]) where btn[5] == "Select" do (
					UIAccessor.PressButton btn[1]
				)
	)
ClickSelect

but than I found that maybe is better to use Volume Select modifier instead of Mesh_Select in your cases
Volume Select automatically update selection by ID if you changed anything below in geometry.

so you should use something like this:

sel = deepcopy (selection as array)
 
for o in sel do (
	select o
	for i = 1 to 6 do (
 
		local n = "VolSelect_id" + i as string + "_Roof"
		addModifier o (VolumeSelect level:2 volume:5 matID:i name:n)
 
		if i == 1 then 			
			modPanel.addModToSelection (Uvwmap axis:2 length:9 width:9) ui:on
		else (
			o.modifiers[n as name].enabled = false
			modPanel.addModToSelection (Uvwmap axis:1) ui:on
			o.modifiers[1].enabled = false
		)
	)
)
-- refresh common panel
setCommandPanelTaskMode mode:#create; setCommandPanelTaskMode mode:#modify
pixamoon's picture

`

so... basically you should use VolumeSelect instead of MeshSelect because it will update all automatically :)

pixamoon's picture

`

hey, try this one:

sel = deepcopy (selection as array)
 
for o in sel do (
	select o
	for i = 1 to 6 do (
 
		local n = "Mesh_Select_id" + i as string + "_Roof"
		addModifier o (Mesh_Select name:n)
		subobjectLevel = 3
 
		o.modifiers[n as name].materialID = i
		mIds = for fi = 1 to getNumFaces o where getFaceMatID o fi == i collect fi
		setFaceSelection o o.modifiers[n as name] mIds
 
		if i == 1 then 			
			modPanel.addModToSelection (Uvwmap axis:2 length:9 width:9) ui:on
		else (
			o.modifiers[n as name].enabled = false
			modPanel.addModToSelection (Uvwmap axis:1) ui:on
			o.modifiers[1].enabled = false
		)
	)
)
-- refresh common panel
setCommandPanelTaskMode mode:#create; setCommandPanelTaskMode mode:#modify

but 'm not sure why you want to turn off smodifiers with MatIDs higher than 1.

brit's picture

Hi Thanks for look into but

Hi Thanks for look into but that didn`t really work for my situation, i`ll try and explain my workflow:

I am build mainy low poly buildings to which i have taken mainly the front photos and maybe the side

so my script just applys the meshs select and uvw map which is fine,
and i apply a standard multi material with 6 slot of which the 1 id is alway the roof.
and the 2nd id is the front of the building.

I then go through the stack and fit the uvwmaps to fit the building elevations.
if i decide i need a bit more detail in the model i edit it at the bottom of the stack which alway messes up the uv`s.

So I need a script the simple goes back up through the stack selecting the id and applyign the uvw i have aready done. I don`t need the script to create the mesh select or uvw as its already been done.

Thanks again

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.