efficient Viewport drawing methods

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  10 October 2009
efficient Viewport drawing methods

Hello everybody

I got today another one small exercise for that who would like explain to me what I am doing wrong that my script is slow again J This Is just a test for gw. command and should have draw vertex number for selected spline on screen. Yes I know it is exactly same how SHOW VERTEX NUMBERS in line but the point is why my screen draw is not so smooth and fast. Is it because I do something generally wrong or because I canít have better feedback from gw. command when I am updating whole screen? Thanks for your explanation and suggestion how it write better.

global DrawTest
unregisterRedrawViewsCallback DrawTest
fn DrawTest = 
gw.setTransform(Matrix3 1)
local p3TextPos = [0,0,0]
SplineSet = $
if (selection.count == 1) and ((isKindof SplineSet splineshape == true) or (isKindOf SplineSet line == true)) do
for i = 1 to numKnots SplineSet do
	KnotPosition = getKnotPoint SplineSet 1 i 
	p3TextPos =gw.wTransPoint KnotPosition
	--print p3TextPos
	KnotNumber = i as string
	--Print KnotNumber
	gw.wText p3TextPos KnotNumber color:yellow
gw.enlargeUpdateRect #whole
registerRedrawViewsCallback DrawTest

Don't forget take this for unregister
unregisterRedrawViewsCallback DrawTest
  10 October 2009
I am not sure what your situation is ...I have tried your script 。The number on the screen flashed over and over.
And My suggestion is:Maybe play around with a scripted manipulator is a good idear.
  10 October 2009
Yeap that's the point . The numbers in my script are flashed but when you try switch on SHOW VERTEX NUMBERS direct from max they are nice and smooth. So Do you think is nothing wrong with my script it is just how this gw command works and if i want make my print on screen smooth i must use for that scripted manipulator :\ Hmm i read about this but i was hoping it must be way how make it better with gw either. But thanks for your reply.
  10 October 2009
This is just the way GW works. You can't get it smooth.
Paul Neale
  10 October 2009

Well ,Why the numbers flash out?
I think this because max has to rebuild/recreate the text number each time redraw callback function is being called.
So , the idear is if we can store the text number somewhere , things may go smoother.For example ,store a text number spline/mesh somewhere , show it when you need show it.I don't think splines or meshes tend to flash out:P
This idear comes with another 2 problems sometime(maybe always with mxs). Text number spline/mesh need to be kicked out of your selectable possibility,Then a selection change callback is needed.And you may want it face to the screen. Figure out the transform matrix in a script controller and update it with redraw callback.

Last edited by HuaMuLan : 10 October 2009 at 09:38 PM.
  10 October 2009
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:19 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.