Notifications
Clear all

[Closed] Need test about when handler issue

hi guys,
need some help testing a little script.
I’m getting unexpected behavior and don’t know if it’s just because of the version.
currently using a old version of max (max 8)

Execute, Push the “context” button and move the box around
Normally the second Point should stay where it is even if it’s his child

When I translate only X axis is realtime, when moving in Y or Z redraw happen only when I move another time
Same behavior with rotating!

thanks if you can test and give me feedback and you’re max version


def = attributes root
(
-------------------------------------------------
parameters data
(
childArr type:#nodeTab tabSizeVariable:true
childTR type:#matrix3Tab tabSizeVariable:true
)
-------------------------------------------------
-------------------------------------------------
fn getWorldTR nod = 
( return (nod.transform*inverse(matrix3 1)) )
-------------------------------------------------
fn getSelf = 
(
r = undefined
holder = (refs.dependents this)
Self = (refs.dependents holder[1])
for s in Self do (if isValidNode s do r = s)
print r
)
-------------------------------------------------
-------------------------------------------------
rollout test "test"
(
checkbutton context "context"
on context changed arg do 
(
if arg then -- special context
(
selfObj = getSelf()
for c in 1 to childArr.count do (childTR[c] = getWorldTR childArr[c])
when transform selfObj changes id:#rootHandler obj do
	( for c in 1 to childArr.count do (childArr[c].transform = childTR[c]) )
)
else -- normal
(
deleteAllChangeHandlers id:#rootHandler
)
)
)
)
-------------------------------------------------
resetMaxFile()
setCommandPanelTaskMode #create
objColor = (color 20 20 20)
defObj = Point size:10 Box:on Cross:off wirecolor:objColor
curChild = Point size:10 Box:on Cross:off wirecolor:objColor pos:[0,0,20]
curChild.parent = defObj
addModifier defObj (EmptyModifier())
curMod = defObj.modifiers[1]
custAttributes.add curMod def
curMod.childArr = #(curChild)
select defObj
setCommandPanelTaskMode #modify

4 Replies
 lo1

It’s a well known issue. You can try using the handleAt:#redrawViews parameter when defining the when construct which will result in correct end result but incorrect realtime behaviour. :hmm:

thx lo! this make me sure the issue is known from other users.
Any idea to bypass the problem?

 lo1

If I’m not mistaken it was fixed in newer versions of max.
A better solution is using a script or expression controller.

ok, i will try to find how to make it possible with expression controller.
cheers