Notifications
Clear all
[Closed] Setting vertex normal
Oct 19, 2013 10:30 am
Hello everyone,
is there a way to set vertex normal without Edit_Normals modifier? I can do it with this modifier, but it takes forever to process bigger group of objects, because it works only when the object is selected and max is in modify mode, take a look:
--creating planes
planes = #()
for i = 0 to 49 do
(
append planes (plane lengthsegs:1 widthsegs:1 width:10 length:10 pos:[i*11,0,0])
)
max modify mode
for p in planes do
(
--without select p it does not work!
select p
addModifier p (EditNormals())
for i = 1 to 4 do
(
p.modifiers[#Edit_Normals].setNormal i [(random -1 1), (random -1 1), (random -1 1)]
p.modifiers[#Edit_Normals].EditNormalsMod.Select #{i}
p.modifiers[#Edit_Normals].EditNormalsMod.MakeExplicit()
)
)
Any tips?
5 Replies
1 Reply
it’s slow but might be faster by just better using of MXS
fn setCommandPanelRedraw act =
(
WM_SETREDRAW = 0x000B
windows.sendmessage (windows.getchildhwnd #max "Command Panel")[1] WM_SETREDRAW act 0
)
delete objects
with redraw off
(
num = 100
planes = for k=1 to num collect (plane lengthsegs:1 widthsegs:1 width:10 length:10 pos:[(mod (k-1) 10)*11, (k-1)/10*11, 0])
seed 0
setCommandPanelRedraw 0
max modify mode
select planes
norm = EditNormals()
modpanel.addmodtoselection norm
for p in planes do
(
nn = #{1..norm.GetNumNormals node:p}
for n in nn do norm.setNormal n (normalize (random [-1,-1,-1] [1,1,1])) node:p
norm.MakeExplicit selection:nn node:p
)
setCommandPanelRedraw 1
select selection
completeredraw()
)
but sure… with SDK the same task takes almost nothing.
Oct 19, 2013 10:30 am
and … if you will do all Edit_Normals operations with disabled ref-messaging it will be much faster.
Oct 19, 2013 10:30 am
denisT, thanks for that, it works like 10 times faster now! What do you mean by “ref-messaging”?
1 Reply