View Full Version : Focus
Fielding 08-10-2002, 06:57 PM I need a very simple script but it is very hard to do it for me. I want a script to do: when the mouse is in a specific position, it will do something like exiting MAX for example. For instance when the mouse is in 400-600, 300-700 this position (width and height of the screen coordinates like 1024x768). I wrote 400-600 because it must be considered in ranges: you cant easily place your mouse over a specific point in your screen :p or can you? :surprised
But I want also how to activate a viewport. For example can you tell the script to activate the viewport which is below the mouse(when it comes to the coordinates i told before)?
Please I need this. At least give me a small help.
|
|
Anton Andriesh
08-12-2002, 07:22 AM
:rolleyes: Senseless... how will you work with it, if max will exit every time when you point on animate button?
derelict
08-12-2002, 07:26 AM
Hi Fielding,
Why don't you ask Max to make coffee for you.
Fielding
08-12-2002, 07:08 PM
Anton, as you didnt read carefully, its an example of a function. OK? Then I gave the original function. OK? Did you understood now?
derelict, How about I made MAX to kiss ass of stalkers?
Theta
08-12-2002, 08:52 PM
It would be nice if you could just put your mouse over a different viewport, and it will automatically switch to that viewport. Dunno how you would do it though :|
Fielding
08-12-2002, 11:01 PM
Hey Theta this is what I think and if someone can do this, it will be very good. because it is very simple. And also the two others in this thread couldnt understand what I am talking about. derelict do you want to use my MAX. I added a new script.
Anton Andriesh
08-13-2002, 06:24 AM
I think I understand you now perfectly, the trick with viewports can be really useful. But something here reminds me about Babilonian Tower, don't you think?... ;) There was no need to tell about coordinates, exiting max etc. as activating viewports on mouseover is the only useful tool here, isn't it?...
Chico
08-13-2002, 11:54 AM
feilding, you should check out the discreet forums as they have alot more talent there in the sense of programmers and hard core scripters.
not saying that this place doesnt, I just notice that most people here focus more on the art of creating, rather than the art of scripting.
support.discreet.com
alteratively you could try www.scriptspot.com as they have a tonne of scripts for max there and a great resource for learning...well so Im told...I couldnt programme my way out of a box:surprised
Fielding
08-13-2002, 05:45 PM
Anton, yes you are right but, to activate viewports on mouse over coordinates can be helpful. For example I will search for the coordinates in the 3ds max window as an image and will tell the program if the mouse is over the range of 100-300, 300-500 (x, y), you will tell the max what to do. I am sure it can be done on another way but it will be harder I think.
Chico, I will try for it. Thanks. But I am sure there must someone out there that has the "cure".
Anton Andriesh
08-14-2002, 06:02 AM
I meant that activating viewports on mouseover is the only useful tool here...
do a search in 3dsmax help on "Strokes Utility", mybe that will help u.
torbjorn
08-14-2002, 02:38 PM
I puzzled this together and when Fielding enters a topic or STARTS a topic she/he asks for some really crazy stuff like : can someone write a script that makes MAX my boyfriend, OR can someone make something so that when an unwanted person starts MY MAX, it will explode? Wait, here's another one : Do you think it's possible to model a staircase in max which i later can print and build my own REAL staircase, cause i wanna walk to the moon...
Am i the only one finding this person just acting stupid on the forum? Asking weird questions, unrelated stuff etc.etc?
GET THE **** OFF CGTALK AND EVERYONE CAN RELAX!
"am i clear or brilliant now" - NO you're NOT brilliant, and stop writing like you're an innocent little russian girl...
Anton Andriesh
08-14-2002, 02:57 PM
someone is getting nervous here... :curious: let's be patient ...
Torbjorn: can I ask the meaning of "innocent little russian girl" ?
Originally posted by Fielding
I need a very simple script but it is very hard to do it for me. I want a script to do: when the mouse is in a specific position, it will do something like exiting MAX for example. For instance when the mouse is in 400-600, 300-700 this position (width and height of the screen coordinates like 1024x768). I wrote 400-600 because it must be considered in ranges: you cant easily place your mouse over a specific point in your screen :p or can you? :surprised
But I want also how to activate a viewport. For example can you tell the script to activate the viewport which is below the mouse(when it comes to the coordinates i told before)?
Please I need this. At least give me a small help.
Hi,
I think I understand what you want, but it is slightly tricky.
The problem is to monitor the mouse's position without calling any events like pressing a button etc. This means that the script would either have to run in the background all the time, or use some system callback that does the monitoring for you.
Unfortunately, there is no callback that will monitor the mouse in a general manner. There is a handler that can be called in a dialog created by using createDialog, but you will be limited to getting the mouse position only inside the dialog (see the TreeMatoGraph script which does this to highlight material/map nodes when the mouse rolls over them).
A possible solution for the first option I mentioned is the Timer UI element. Here is a description from the Help file:
--------------
Timer
A timer item generates tick events at set intervals. Timer is unlike the remainder of the user-interface items as it is not a visible control. Timer lets the user interface react, animate, or change without user interaction, such as having animations playing on the rollout, checking for certain conditions or events before continuing, displaying nag/splash screens, and so on. The syntax is:
timer <name> [ interval:<number> ] [ active:<boolean> ]
-----------------
So you could create a timer checking about 1 per second (1000 ms) where your mouse is. The necessary variables to check are
-----------------
mouse.pos
A read only variable to get the mouse position in the currently active viewport as a <point2> value. The coordinates are in pixel values. If the currently active viewport is a 2D view (Track View, Schematic View, Listener, etc.), the coordinates are in the first non-2D viewport.
mouse.screenpos
A read only variable to get the mouse position on the screen as a <point2> value. The coordinates are in pixel values relative to the top-left corner of the screen.
-----------------------
I will put a quick test script together and see if it does anything useful. TTYL...
Ok, this WORKS! :)
Here is a simple script which changes the viewport focus when the mouse moves over the viewport in default 4 views mode.
It is set up to work at 1280x1024 res where the middle of the viewports is around 500,500.
In MAX 5, you could also check the max window size, and it would be possible to go through all available viewports and get their size to calculate the correct limits automatically, but this is a further step I might try later.
Here is the basic script:
macroScript MouseViewTracker category:"Bobo_s Tools"
(
rollout timer_rollout "MouseViewTrack"
(
timer mouse_clock interval:100 active:true
button close_it "CLOSE MVTracker"
on close_it pressed do destroyDialog timer_rollout
on mouse_clock tick do
(
local mpos = mouse.screenPos
local mid_x = 500
local mid_y = 500
if viewport.getLayout() == #layout_4 then
(
if mpos.x < mid_x and mpos.y < mid_y then viewport.activeViewport = 1
if mpos.x < mid_x and mpos.y > mid_y then viewport.activeViewport = 3
if mpos.x > mid_x and mpos.y < mid_y then viewport.activeViewport = 2
if mpos.x > mid_x and mpos.y > mid_y then viewport.activeViewport = 4
)
)
)
try(destroyDialog timer_rollout)catch()
createDialog timer_rollout 140 30 0 150
)
-------------
To install, copy in a new script editor, save and evaluate. Go to Customize>Customize UI..., find the "Bobo_s Tools" category and drag the script to a toolbar (or assign a shortcut, put on a QuadMenu or whatever). Press the button and a new small floater will appear. It will have only one button saying "Close...".
Press it to disable the function. When active and when in 4 views default mode at 1280x1024, the viewports will switch automatically as you move your mouse over them. The current update rate is 100 milliseconds, you could set it to 1000 so less time is wasted for checking the position...
Edit the variables mid_x and mid_y to change the center of the 4 viewports divisor...
So in general, what you asked for is doable. I wouldn't shut down max using this method though ;)
Fielding
08-17-2002, 11:04 PM
Bobo thanks for your all helps and thanks for the code, I will distrube it everywhere with your name off course. AND torbjob, if you wanna tell me things like this GO TO HELL
Originally posted by Fielding
Bobo thanks for your all helps and thanks for the code, I will distrube it everywhere with your name off course. AND torbjob, if you wanna tell me things like this GO TO HELL
Fielding, no problem,
please remember it is just a sample and not a production-ready script. I am playing with a more intelligent version which detects the viewport mode, tries to figure out the size of all viewports automatically etc. I am also trying to get it detect changes to viewports automatically using a callback (for example when you drag the divisor of the viewports around or switch to different number of viewports) and reset its code respectively, but am having slight troubles...
If I get anything stable and worth mentioning, I will post it to Boboland and ScritpSpot and will let you know...
Have fun!
Fielding
08-18-2002, 08:15 PM
Bobo, I am very glad to see your post in my thread as you are the one of the ultimate programmer I think. Then I will wait your script and use the version you gave me. I will also check your site for this. It is an honour for me to see a top-star made a thing I imagine for me. Many many thanks.
Fielding
08-21-2002, 02:22 AM
And by the way due to my limited time, I couldnt reply to a stalker that thinks himself rubbish. torbjorn, do you think you have a good mind? If you think of me like this, why are you writing to my thread, I dont want to see your posts. Also maybe you found my topics unnecessary and silly, let me tell you why? Because you know nothing about these and you like CG and you tried to success and failed offcourse, because you dont have talent and had the feeling to ruin other people's work and criticise them unnecessarily. Even with this forum, a programmer like Bobo, that made the respect in that industry replied and helped me to make a script that I and many artist need if they dont have programming knowledge. He also made a brief information about to write the code. And for my other topics I never asked someone to make a staircase. I asked for a fork with Loft. To do this you need a special technique, that cant understand or know. Yes I will keep your advices in mind and made MAX to kick ass of the stalkers, but I have already added the code in the core program, if you need to see how it is look like let me know.
BY THE WAY I AM NOT FROM RUSSIAN!:scream:
Anton Andriesh
08-21-2002, 07:22 AM
Enough spamming, Fielding... there's no need in justifying yourself...
derelict
08-21-2002, 08:24 AM
Sit back take a deep breath....
...let it out slowly.... yes, yes thats it.
Are you feeling better?
Good.
Fielding, we boys sometimes just don't understand heavy tachnical stuff. I think you're standards are leagues above us, miles infact... way way up there. So much so that we can't really see it, but i degress here. So us meer mortals just don't get what you want.
(if you're the girl in your avatar) Can we make love and move on?
(if you're a guy, lets just shakehands, ok?)
ps: Then came a vateran (Bobo - you rock man! where would max be without you?) to save the day!
torbjorn
08-21-2002, 09:39 AM
FIELDING : whatever... *LOL*
And let's see : did I crit. anyone? In fact, I haven't seen any of your work in here *LOL*
Marley
08-21-2002, 06:54 PM
ok ... here is my suggestion ...
switch to XSI =)
insect666
08-22-2002, 12:36 AM
Ask it at the softimage forum... rather than Max.
You have more luck finding it there. ;)
Chico
08-22-2002, 12:40 AM
Well im sure al our issues will be resolved if we switch to Strata 3d pro.:bounce:
CGTalk Moderation
01-13-2006, 01:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.