Home Technical Talk

what if ... viewport navigation was taken care of for you ? maxscript idea

2

Replies

  • pior
    Options
    Online / Send Message
    pior grand marshal polycounter
    Woah, that last version is rock solid!
    A few more suggestions!

    At the moment, it frames on the cursor location at the surface of the last selected model, wether it is currently selected or not. That great! But could we also use the condition 'cursor outside of any model' to zoom extend the whole scene, and 'cursor over an arbitrary model' to frame on the surface of a given object ? That would let me navigate whole scenes ... just with one button.

    About the reset viewport. It works as intended (gives back a more normal zoomfactor and pan factor once they get messed up) but on my setup it : switches back to four views, and reset my viewport visual preferences (display the brackets, and so on). It would be nice if it was just a pan/zoom reset, with no display changes, on the current viewport only. Or maybe all at once, but still keeping the current layout on display (resetting the other viewports in the background, sortof)

    On a side note, it would be nice to have an option letting the user chose the behaviour of the zoom on cursor action. Many times, I was hoping the viewport would rotate around the point I had my cursor over, instead of just zooming on it. Maybe : object is selected > rotates around surface point, and object is unselected > rotates around object (like it is now). Also, when in vertex mode for instance, and no vert is selected, it would being able to zoom in and rotate around the closest component next to the cursor would be fantastic.

    All in one - the frame on component is such a great feature, I just became addicted to it and want it everywhere!

    Thank you!

    Another script idea to complement it : Would there be a way to bind viewport rotate to arrow keys?
    Like, keeping left or right pressed wound rotate around in circles, and keeping up or down pressed would rotate up and down. That way it would completely free up the drawing hand from viewport nav. If you want some reference, Amapi 3D did it that way, very smart.

    On a side not I had some fun binding FrameIt to a gamepad used as a pedal under the desk :P Hands free zoom haha! Feels like a 3D drummer!

    Cya!
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    I like it so far:

    feedback from me, wish/ change list:
    1. right now it first rotates the view and within a 2nd step zooms in - which irritates me because with 2 steps it eats to much time of my work. So could it be combined into 1 animation tween where the view rotates and zooms in/out at the same time?
    2. it seems not to work always, when I used it for the first time on an object it sometimes did nothing (just the object selected, no sub- elements). I guess it has to do something with the modifier panel as it was not active in those cases it failed.

    but yeah I like it so far, binded it to the Spacebar :) (stupid lock selection, never really needed that except for animation stuff)
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi Pior, I'm really happy you like it!
    pior wrote: »
    At the moment, it frames on the cursor location at the surface of the last selected model, wether it is currently selected or not. That great! But could we also use the condition 'cursor outside of any model' to zoom extend the whole scene, and 'cursor over an arbitrary model' to frame on the surface of a given object ? That would let me navigate whole scenes ... just with one button.

    The behaviour of framing latest selected object is a side effect. I didn't mind about it, and that's how it turned out to be. I'm positive about the possibility to frame any object in the scene when the mouse is over without the need of a direct selection. In that case the whole object would be framed, and if the mouse is over nothing the whole scene could be zoomed without any alignment. The only issue I can see is about hidden objects, because the intersectRayScene() function gets them anyway. There is quite a tweakwork for a workaround, but hope isn't lost yet.
    pior wrote: »
    About the reset viewport. It works as intended (gives back a more normal zoomfactor and pan factor once they get messed up) but on my setup it : switches back to four views, and reset my viewport visual preferences (display the brackets, and so on). It would be nice if it was just a pan/zoom reset, with no display changes, on the current viewport only. Or maybe all at once, but still keeping the current layout on display (resetting the other viewports in the background, sortof)

    Well, the Reset Viewports isn't a script but just a shortcut to the standard function, no more than a couple of minutes of work. For sure it can be expanded to reset only camera settings and leave your viewports alone, it wouldn't even call the viewport.resetAllViews() standard method, but would be done by hand.
    pior wrote: »
    On a side note, it would be nice to have an option letting the user chose the behaviour of the zoom on cursor action. Many times, I was hoping the viewport would rotate around the point I had my cursor over, instead of just zooming on it. Maybe : object is selected > rotates around surface point, and object is unselected > rotates around object (like it is now).

    Here I'm losing you (sorry). The current default behaviour is to align the viewport to the surface normal of the point under mouse if there's no sub selection without zooming, or to the average selection normal if there is a sub selection then perform a zoom ext.
    If you are already looking at a sub selection from its normal axis and have zoomed in or out, the only effect you see by running the script is to perform a zoom ext.

    What do you mean with "I was hoping the viewport would rotate around the point I had my cursor over, instead of just zooming on it."? What is hard for me to understand is the hypothetical center of rotation, as there isn't one, being the camera movement a roto-translation.
    pior wrote: »
    Also, when in vertex mode for instance, and no vert is selected, it would being able to zoom in and rotate around the closest component next to the cursor would be fantastic

    This is possible, with some limitations: 1. the object must be selected - 2. the stack must be on Editable Poly or Edit Poly Modifier. I already got a set of function for IC.Shape 2.0 to deal with proximal elements.
    pior wrote: »
    Another script idea to complement it : Would there be a way to bind viewport rotate to arrow keys?
    Like, keeping left or right pressed wound rotate around in circles, and keeping up or down pressed would rotate up and down. That way it would completely free up the drawing hand from viewport nav. If you want some reference, Amapi 3D did it that way, very smart.

    I'm sorry, as far as I know there's no way to detect key presses within MaxScript, other than modifiers keys (ctrl, shift, alt, esc). In that case, a timer would be needed to poll the status every n-times at second to perform a small shift. Right now I don't know any other solution, and this one isn't even barely good. I'm afraid you'd need the SDK for something so radical like assigning new standard shortcuts. The SDK brings a whole world of other issues, one for all versioning.
    pior wrote: »
    On a side not I had some fun binding FrameIt to a gamepad used as a pedal under the desk :P Hands free zoom haha! Feels like a 3D drummer!

    That's a slick idea! They're quite expensive, but you may like one of these: Keyboard Control Foot Pedals :D

    I'm going to do some adjustments to the main script, and expand the other one. Stay tuned for next release. Thank you! :)


    Addendum for renderhjs (Hi! :)

    1. I'm with you, it's not the best the double action, but it's needed for accurate results. Right now the zoom factor is calculated taking into account the apparent dimension in screen space of geometry in world space. So it must be seen from the same angle before and after the zoom, otherwise it would be quite unaccurate, but I can give a shot to some tweaks. Right now you can change animation speed by adjusting a couple of values at the beginning of the script. Can even take completely away the animation.

    2. It doesn't matter if the Command Panel is in Modify Mode, but the selected object in the stack must be either the Editable Poly or an Edit Poly Modifier, or at least when you left the Modify Mode, and the mouse has to be over the object of course.

    3. Thank you for the interest and suggestions!
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Very cool. I like the tweakable values.
  • pior
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi guys,
    after a lot of coding sweat, anger and blood (!) here is the new IC.FrameIt version 0.7, with more monkeys!

    With a lot of new behaviours, is now conceived to take care of every kind of situation, not only the currently selected object. As for previous releases, be sure to check the documented SETTINGS section at the beginning of the script to adjust variables to fit your needs.

    Some enhancements:
    - In perspective views a single movement take care of alignment and zoom.
    - Frames all geometry in the scene or only selected objects
    - Frames full objects or zoomed in sections
    - See SETTINGS!

    Requirements: 3ds Max 2008+

    ResetViewports has been removed, because it's useless. A simple standard Zoom Extents can do a better job in restoring good viewport settings.

    I hope you like this new release. Please report any issue. Any suggestion for improvement is very welcome. Thank you.

    p.s.
    Pior, now you have got a solid excuse to buy that foot pedal :D
  • sinistergfx
    Options
    Offline / Send Message
    sinistergfx polycounter lvl 18
    Awesome idea and execution!

    Getting this error in max9:
    IC_FrameIt_error_setFocalDistance.gif
    For now I just commented out all lines with that function call. Breaks the script a little bit, but it's still awesome.
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi Will,
    I'm sorry, the script uses some viewport methods available only in 3ds Max 2008+. I forgot to write it down into requirements. Those methods aren't included in AVGuard dlx either for 3ds Max 9, so it's not possible as it is now, to make it fully work in that version :/
  • Japhir
    Options
    Offline / Send Message
    Japhir polycounter lvl 16
    wow that's really cool! works like a charm, like a much improved version of the frame selection hotkey :). I have it set to the space bar! that's how important this script is going to be ;).
    Great work! thanks!

    edit: hey if you have your move tool set to screen you can edit geometry in a fun way ;).
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    very well done
    binded it so far as well to the Spacebar, lets see how the new one handles
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Thank you guys, I'm glad you like it!

    @ renderhjs: I've gone through a hell of trig and linear algebra to make zooming and orienting in a single movement. Unfortunately it works only in perspective viewports, because orthographic manage zoom in a different way, changing FOV rather than shifting the camera, and there seems to be a bug in 3ds when querying the FOV of user type viewports, so I cannot get consistent results.

    @ Japhir: I'm starting to think no one ever uses that Selection Lock thing, and apparently it is the reason why AD linked it to such a tiny button like spacebar ;D
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    Suggestions (to really make it a general purpose tool)
    1. detect if active view port is orthographic projection use just the default zoom to extends (usually the [Z] key), so I can simply hit my spacebar all the time in whatever view
    2. when you select objects it still animates in 2 steps, if you select sub elements (like verts for example) it does the single tween - is it possible to have a single tween for selected objects as well ?
    3. Idea: double tab macro (in my case spacebar) to isolate (otherwise [alt] + [Q]) and zoom to selection in 1 action. Double tab again to get back

    it still has some fancy results at times with just objects selected (like zooming in way to close) but with components or subelements selected it works fine so far.
  • mLichy
    Options
    Offline / Send Message
    wow... that's freaking awesome man! :D Excellent job.
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    @ renderhjs: thanks for your suggestions.

    1. Done. You can get IC.FrameIt 0.7b to see it working. It is smart, I missed it.

    2. New version has many different behaviours depending on what is selected or not, what is the mouse over and what kind of viewport is active. Perspective mode works always in a single tween, orthographic works always in double tween.
    Strange behaviour could be traceable: when an object is selected and mouse is over, it zooms in on the object, while if an object is not selected and the mouse is over it, it zooms the whole object. At the beginning of the script there's the full list of behaviours. It seems they're all respected, but if you find something wrong, please let me know.

    3. Double tap would be good, but unfortunately, as for direction arrow for Pior, MaxScript alone seems to be unable to detect keypresses different from modifier keys (ctrl, shift, alt, esc). If a double tap is performed the script is executed as is twice, as if the command is in a buffer that is emptied as commands are executed. I can try something with globals, but in that case, there would be a starting lag time (i.e. one second) to wait for the hypothetical second tap to occur, which is quite bad, and in every case it could be bound to modifiers key only which are detectable by MaxScript, even worse.

    @ mLichy: Thank you! I'm glad you like it. The original idea is by Pior, and many developing tips came from contributors to this thread.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    3.) just record a timeStamp and compare it to the previous one. if it is below lets say 200 ms it is a double click. If not within that time window a 2nd keystroke follows it is a single key press, otherwise a double click.

    I might have some experiments with that - maybe I can help you with that
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi, that's what I meant. The Idea is to have a very small script to handle the tapping, and other two scripts to do the different jobs. That's fine. The problem is, as you described it, the 200 milliseconds time span, I said 1 second, but it's the same idea.

    - If one tap is performed, the accessory script has to wait the full 200 ms before starting the single-tap action, because it has to wait for a possible second tap within the allowed time span.

    - If two taps are performed, the accessory script can start the double-tap action immediately after the second tap.

    The issue is with that 200 ms lag for single action. It's not a coding issue, but a bad script behaviour. I don't like it at all, but as you said, something can be arranged for a test.
  • Vitor
    Options
    Offline / Send Message
    Vitor polycounter lvl 18
    Just tested it out. Working great so far. Very nice job Sync!
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi, I've been thinking to it in a different way, let me know how it sounds.

    Let's assume the framing action takes 1 second.

    - If you want to perform a single action, just tap once and wait for the tween end to perform another one.

    - If you want to perform a double action, at first tap the framing tween starts immediately, if you tap a second time while the tween is running, as soon as it ends, an isolate selection action is triggered, toggling the current status, from on to off and viceversa.

    It should be feasible and wouldn't have lagging issues. The only problem is with Isolate Selection because it performs a Zoom Extents Selected as soon as is activated, spoiling the framing action. So I need to code a custom Isolate Selection, not that hard to do, but you won't have the big button to switch it off, and must perform a double action again to go back.

    @ Vitor: Thanks man!
  • Japhir
    Options
    Offline / Send Message
    Japhir polycounter lvl 16
    hmm the last download isn't working, first downloading went really slow, and then it suddenly completed and told me the archive wasn't working or something...
    I re-downloaded it 4 times ;).
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    I'm sorry to hear that dropbox is having issues. I just tried the download and it worked good, practically instantaneous. Please try again after a while. As soon as I consider it finished, I will publish the script on IllusionCatalyst website and there shouldn't be issues anymore. Thanks for your patience.
  • Japhir
    Options
    Offline / Send Message
    Japhir polycounter lvl 16
    Now the download works fine but I get this when trying to open the file.
    errorhs.jpg

    but don't stress it :P, the current one does fine for now :) (making it work like f in ortho views sounds cool though ;)).
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    That's really odd. I downloaded it again from the link and opened without any problem. Is the .zip Size: 6.59 KB (6'752 bytes) ? If not, the file is not completed and you cannot open it. Try to get it here, one of my private domains.
  • Japhir
    Options
    Offline / Send Message
    Japhir polycounter lvl 16
    ah that one did work. somehow the other one was 175 bytes.. although the download finished. thanks!
  • solar
    Options
    Offline / Send Message
    solar polycounter lvl 18
    Just been playing around with 0.7b, this is great SyncViewS! Thanks.
  • Racer445
    Options
    Offline / Send Message
    Racer445 polycounter lvl 12
    Cool script, will certainly try it out while modeling later to see if this can actually save time.

    I've got it bound to my third side mouse button (logitech G500,) and I prefer the animation on, set to all the fastest settings with 0.3 selection zoom, what about you folks?
  • DEElekgolo
    Options
    Offline / Send Message
    DEElekgolo interpolator
    I press z...
    Maybe you guys should too.
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi guys, thank you. I'm glad you like it.

    @ Racer445: I chose those settings as averages, then put variables at the beginning to let everyone customize it as wished. To be honest I'm caught into programming, so I don't have extensively tested it during modeling sessions. It is one of the instruments included in the forthcoming IC.Shape 2.0, along with many others. There you will have a nice options panel with spinners to set everything in real time without the need for a new evaluation each time.

    @ DEElekgolo: I assume you don't like the script. Well, in my opinion it's better to have different options to choose, rather then one only. It doesn't matter if the original was better, at least you know others aren't. :)
  • pior
    Options
    Online / Send Message
    pior grand marshal polycounter
    Hi there!
    So I have been playing with the latest version quite a bit lately, it's working great but! I am running into a few hiccups :

    - I am having trouble getting rid of the animation sequence. I am trying to make the script react instantly at keypress but somehow, even if I put
    local fEase = 1
    and
    local fSpeed = 500
    I am stll getting a small delay. It definitely wasn't there in the older version 3 for instance.

    Also when I start working in scenes with a lot of different objects present on screen (splines, modifiers, primitives ...) the 'frame all' function when leaving the cursor over empty space with nothing selected brings up a script error like so :
    http://img.photobucket.com/albums/v242/pior_ubb/errorz.jpg

    hope this helps!
    Gonna try your other IC tools now! You peaked my interest :P
    [edit]shieeeeet, closed for update hehe
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi Pior, I'm glad you like the overall script.

    The delay issue you're reporting can be explained: it is not an animation issue, but a calculation time one. Older version used a much simpler algorithm to determine the zoom factor, but it was unaccurate and required the "double tween" for position an zoom. When you set the easing step to 1, you see it working instantly, but zoom factor is approximate. Newer version, on the contrary, looks for the projection of every object bounding box point with the camera frustum. When the scene is heavy, there are a lot of calculation to do, that's why you got the small delay, even if the camera shift is actually a single step. I can think to something to speed things up, but it would be a little demanding as I'd need to write a different algorithm, maybe something simpler when animation is not active... Or (thinking out loud) I could get all BBoxes, calculate the whole BBbox and then use that to get the zoom factor simplifying thing a lot, even if it would be bigger than really needed... I need to run some tests.

    I don't know what's causing the second issue. The script works on geometry bounding boxes when nothing is selected, which is a property of every node. I tried the script with a full rigged character and worked fine, with many different object types. Are you able to track what's the kind of object that throw the error? Maybe taking the scene and selectively delete one type of object at a time, and run the FrameIt. Or (I don't think so, anyway) share a faulty scene?

    Right now I'm finalizing IC.Shape 2.0 installation package to be released later in the day. It includes this Framing instrument as is in the stand alone version. I'll consider your report as the first bug to investigate. Thank you.
  • pior
    Options
    Online / Send Message
    pior grand marshal polycounter
    Hi there!
    yeah, I'll run a few tests on that scene. There's a FBX rig imported from a CS biped structure in it aswell, if that's of any help ...

    Sorry to hear about the speed issue ... maybe we are not talking about the same thing tho? It's at least half a second here. I'll send you a vid if it helps clarifying the problem.

    Can't wait to try your script collection!
  • Andreas
    Options
    Offline / Send Message
    Andreas polycounter lvl 11
    Does anyone else get a PHP script when they try to download this? is this normal? What do I do with it?

    Great tools and all, but if I have one critisism is that sometimes it is a little hard to know how to get em going if you have no experience how. The documentation on your site is better now but do remember some of us are completely illiterate at these things ;P
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Woops, it was my mistake, the download on web site is now fixed. I try to be as clear as possible, but sometimes I miss something. In that case, feel free to ask, I'll be glad to help and improve instructions to make everything work. Thanks for pointing out the issue.
  • Andreas
    Options
    Offline / Send Message
    Andreas polycounter lvl 11
    Cheers I think I got it working now.

    But now, dunno if its related to installing it, tools like pinch (i.e. anyones at the top) throw a maxscript exception warning, upon selection and deselection and max won't close naturally after that.
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi, I'm not sure to understand what you mean.

    What does "tools like pinch (i.e. anyones at the top)" refers to? Do you mean IC.Shape 2.0 tools? If that's the case, this instrument is included in IC.Shape 2.0 called Frame Geo, and you should use that one, not the stand alone version. I haven't tested compatibility between these two scripts.
  • Andreas
    Options
    Offline / Send Message
    Andreas polycounter lvl 11
    Uh oh :D

    How do I uninstall the standalone script?

    Have you ever considered developing tools for Blender? While its got a pretty good toolset some really basic stuff is missing (like a proper cut tool, that snaps from vert to vert).
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hi, to uninstall IC.FrameIt you simply need to delete the macroscript file created by 3ds Max. Since every OS configures paths in a slightly different way, let's 3ds Max tell you where those files are.

    1. Start 3ds Max
    2. Open the listener by pressing F11
    3. Type: "getDir #userMacros" (without double quotes) and press the numeric pad Enter, you will get a path
    4. Open a file Explorer and get to the path you got from 3ds Max
    5. Search a file called: "IllusionCatalyst Tools-IC_FrameIt.mcr" and delete it
    6. Restart 3ds Max, the script is completely gone

    I've never tried Blender. I guess it should be fun, but right now I prefer to concentrate my efforts on a single application, btw I really need to start modeling rather than going on coding :/
  • pior
    Options
    Online / Send Message
    pior grand marshal polycounter
    By the way, is there a chance to get .MCR releases of such scripts? I know how to evaluate and add to the interface from there, but when upgrading to a new Max or reinstalling I find that dropping a few .MCR in UI/Macroscripts to be much asier than loading and evaluating maxscripts ...

    Plus I personally tend to edit the 'category' tag of macroscripts to make them work with my own naming conventions, dunno if I am the only one doing this?
    (I add "_" at the beginning of the category tag for every custom script I install, that way they all show up at the top of the customize UI lists)

    Anyways, thanks again for the tools man!
  • SyncViewS
    Options
    Offline / Send Message
    SyncViewS polycounter lvl 13
    Hey Pior, .ms and .mcr are the same: you can drag and drop .ms on viewports as well, they get evaluated and 3ds Max adds the .mcr in userMacros folder. If you open the ms file you'll find the MacroScript definition, with Category string at the beginning, so you can change it to whatever you like. These scripts are not encrypted. That's simple, or I didn't get your point.
  • pior
    Options
    Online / Send Message
    pior grand marshal polycounter
    Hi!
    Great to hear, I will do just that :P I usually like to avoid dropping stuff on the viewport as it tends to put things in hard to reach places (ENU folder...). I disabled user profiles on my Max but I still I like the safety of manually placing a .mcr where I like it :P Thank you for the info!!!
2
Sign In or Register to comment.