Help: registerRedrawViewsCallback + mouse tool

so.. viewport isnt updating when i use this 2 commands together..
why?

here is one sample code

fn aaa = 
(
	unregisterRedrawViewsCallback aaa
	test = text size:100 kerning:0 leading:0 isSelected:on text:"test"
	starttool foo
)
 
 
tool foo
(
on mousePoint clickno do #stop
on freeMove do $.pos = worldPoint
)
 
registerRedrawViewsCallback aaa

the script is clearly working. But for some reason i cannot see where i place the text in this example.

note that the code is only to emulate the error i'm getting.. i know doesnt make sence to register the callback only to unregister it..

i've tried using redrawViews(), completeRedraw(), forceCompleteRedraw.. with no luck

Comments

Comment viewing options

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

hey Anubis.. i dont

hey Anubis.. i dont understand what you are saying.. lol
i think im not very clear.... les see if i can clarify this with the same example

if i do simply this (below), the mouse tool will work properly and i will see the text moving until i place it

tool foo
(
on mousePoint clickno do #stop
on freeMove do $.pos = worldPoint
)

test = text size:100 kerning:0 leading:0 isSelected:on text:"test"
starttool foo

but if i do the "starttool foo" inside one registerRedrawViewsCallback function (op example) it will not work.. but i am doing the exact same thing.. except one is triggered by some event etc..

Anubis's picture

where is the event?

except one is triggered by some event etc...

and where is your event which will trigger the callback? this is what i mean ;)

my recent MAXScripts RSS (archive here)

mjbg's picture

something like this: fn aaa

something like this:

fn aaa = 
(
if objects.count == 5 do -- event
   (
   unregisterRedrawViewsCallback aaa
   test = text size:100 kerning:0 leading:0 isSelected:on text:"test"
   starttool foo
   )
)
 
 
tool foo
(
on mousePoint clickno do #stop
on freeMove do $.pos = worldPoint
)
 
registerRedrawViewsCallback aaa

should work like this:
i run the script in one empty scene
then i start creating objects.. when i try to create the 5th object it runs the tool foo..

the script works like it should.. but i cannot see the text placemant like when i can see if i run the tool foo "outside" of the callback..

mjbg's picture

only updating the original

only updating the original example:

fn aaa = 
(
if objects.count == 5 do
   (
   unregisterRedrawViewsCallback aaa
   test = text size:100 kerning:0 leading:0 isSelected:on text:"test"
   starttool foo
   )
)
 
 
tool foo
(
on mousePoint clickno do #stop
on freeMove do $.pos = worldPoint
)
 
registerRedrawViewsCallback aaa

so i want the starttool foo to be executed when the objects.count == 5

Anubis's picture

tested it

Ok, i tested this and now i see.
Something weird going on with the Text object.
Looks like Max bug.

my recent MAXScripts RSS (archive here)

mjbg's picture

it looks like it "freezes"

it looks like it "freezes" the max viewport when a new object is created by some function called by the callback

anyway.. nothing to do with the mouse tool as i thought
i just find it weird that none of the redraw commands work.

thanks for the efort

Anubis's picture

redraw needs scene changes

your tool not do anything that needs redraw,
so the callback not fired

(
global cbfn_aaa
unregisterRedrawViewsCallback cbfn_aaa
 
fn cbfn_aaa = 
(
	test = text size:100 kerning:0 leading:0 isSelected:on text:"test"
	starttool foo
	unregisterRedrawViewsCallback cbfn_aaa
)
 
tool foo
(
	on mousePoint clickno do (
		$.pos = worldPoint
		#stop
	)
	--on freeMove do $.pos = worldPoint
)
 
registerRedrawViewsCallback cbfn_aaa
Dummy() -- do something that needs redraw
)

my recent MAXScripts RSS (archive here)

Comment viewing options

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