Cant understand why object doesn`t move
Hi! Trying develop new script I`m stucked at beginning!
Sorry my endlish.
So, here is test part of the future script:
(
global SSTransformObjects
global recreateCallback
global ctrlObjectLastPos
global ctrlObjectLastRot
global ctrlObjectLastScale
fn SSTransformObjects = (
if selection[1].pos != ctrlObjectLastPos do (
$Box002.pos = $Box002.pos + [0,1,0]
ctrlObjectLastPos = selection[1].pos
print $Box002.pos
)
)
fn recreateCallback = (
unregisterRedrawViewsCallback SSTransformObjects
registerRedrawViewsCallback SSTransformObjects
ctrlObjectLastPos = selection[1].pos
)
recreateCallback()
)
And the result must be: while I move Box001 - Box002 must shift its position by 1 in one direction. This is just for test! But Box002 doesn`t move, print command is worked fine - showing us that function worked...
Can`t understand where is mistake :( Please, help me!
Comments
maybe something like this:
Maybe something like this (file attached),
It's refreshing new box location when you release mouse click.
Hope this helps,
Thanks pixamoon! I will think
Thanks pixamoon! I will think about your realization of update on mouse release, but in ideal I want to make it updates instantly while moving (rotating and scaling) control object...
I tryed to make same with change transform handler but it updates at start of moving (2 times) and then stops to update... Cant understand whats problem of this...
Sorry my english.
redraw problem
there is still box redraw problem. There can easy change it wirecolor but is not easy with position. Max keeps start position somehow.
but take a look on next samples: (take a look in attachment)
They can constantly update Box002 position
first you need to create variable BoxPos = $Box002.pos
Than use it BoxPos = BoxPos + [0,1,0]
But to redraw constanly new position you need dotNet Timer (take a look in attached samples)
1st is still with callbacks
2nd is with "when" construct
But still you need dotNet Timer for both to refresh box every tick.
Hope this helps, still I wish to find a way to refresh position without flickering to start position.
Anybody know how to do it ?
Thanks! It can help! I will
Thanks! It can help! I will explore this way a little bit later. But yes, need to find a way to do this without position flickering.
Cool, I have one more idea to
Cool,
I have one more idea to do it around. Will test it and post it soon.
Funny thing is, when you select Box002 and click autoupdate. It will stat updating it self and moving without any flickering !
The same nice update works for change color Callback. (when distance is less than 10 then changing color red/green).
Will try this new idea to redraw box position and post it soon,
Cheers :)
Hi, so I searched more for
Hi, so I searched more for this other idea with scripted controllers.
I found a nice script by barigazy :
http://www.scriptspot.com/forums/3ds-max/general-scripting/how-to-write-...
I think this will be the best way to control position of one object by other in real time. (no flickering etc like in callbacks or "when" functions)
Hope this helps :)
Cheers,
Ah, and I found what was
Ah, and I found what was wrong with "when" function. Now doesn't flicker too :)
should be:
when transform $Box001 changes do ()
Codes in attached.
1st is just basic code, 2nd with rollout
cheers,
Wow! Thank you Pixamoon!!!
Wow! Thank you Pixamoon!!! Looks cool! :) Sorry for delay, a lot of work this days... Will continue to develop my script a little bit later, and let you know when it will be finished ))
Cool,
Cool cool,
I learned new things too :) And glad it solved the problem,
Cheers,
Pixamoon