PDA

View Full Version : wheel mouse zoom


BanzaiGonzo
08-28-2007, 05:16 PM
I have tried to register on their forums with three different e-mail accounts have had no luck, so once again I come here to ask the questions that would most likely be better addressed and viewed on their own forums.

I like XSI, but as an AutoCAD draftsman (that has been “wheel zooming” since it was introduced) I really need (want) the wheel to be able to zoom in XSI, as it does in AutoCAD and almost every other 3D application I have ever used.

I did a copy and paste of this response to someone asking about wheel zooming on their forums…

1) Write a simple plugin that creates two commands: ZoomInActiveCamera and ZoomOutActiveCamera. They should locate the active camera and change its parameters (FOV or COI + Translation) so as to perform the zooming in and out by some fixed value (the zooming speed). If you want to be fancy, also set up a custom pref slider that lets the user change that value on the fly.

2) Map these two commands to two keys using the key mapper. Say you map them to "A" and "Z" for this discussion. Now you can press A to zoom in and Z to zoom out.


I have spent at least four hours trying to find out how to do this and still have no clue as to what needs to be done, or how to go about it. I have searched the on-site plug-ins and add-ons but can find nothing that will allow me to wheel zoom.

In the distant past I wrote a few minor programs with Visual Basic, so I am not totally ignorant about writing code and programming, but have no idea about how to approach this issue, nor do I really want to learn more “programming” just to do what other programs do by default.

If anyone could point me in the right direction, or know if this code exists and can link me to it, I would appreciate it more than you could imagine.

Once again I am sorry to be asking here, but nothing I do gets me registered on their forums. Three different registration attempts and follow up e-mails to them have resulted in zero response.

Believe it or not, this is a make or break issue for me to use XSI, and I really want to use the program, but after 8+ hours a day of wheel zooming at work, I just want XSI to act the same way.

I know this has been brought up before (here and there), but I could find no resolution except along the lines of "get used to it, you will like it better."

I don't want to and I won't :)


Thanks again.

MiGa
08-28-2007, 05:26 PM
As far as i know it is not possible to get and scroll wheel feedback from XSI. So this won't work with the mouse wheel

Gwot
08-28-2007, 06:21 PM
Yeah, currently it is kindof being wasted on only a couple of things like Proportional falloff, and brush sizing for vertex map painting. It could be used for so much more if Soft were to open up the bindings and allow for modifier key use as well. In Silo I use the mouse wheel for stuff like Grow/Shrink selection, Soft Selection Falloff and Strength, Undo/Redo, Undo Selection/Redo Selection, Zooming, and for cycling shading modes per object. There's no reason Soft could't open up the mouse bindings for more use, while still maintaining contextual functionality within specific tools etc.

oddforce
08-28-2007, 07:13 PM
You could use autohotkey (http://www.autohotkey.com) to remap mouse wheel events to other hotkeys

Compote
08-28-2007, 08:54 PM
I agree wheel mouse zoom is a necessary feature. it'd be nice if softimage added this in 6.5

5quid
08-28-2007, 10:17 PM
hotkeyed zooming of the active camera isn't too difficult to achieve. i'll throw something together and post it up here.

hooking the mouse for a propper mouse wheel zoom isn't difficult either it'd just be a royal pain checking for other xsi events who use the mouse wheel. the alternative is to override all xsi mw behaviour by using a hotkey or checkbox to toggle...but then you may as well just hold S and be done with it :)

i do agree with the thread sentiments though. the lack of mouse wheel usage in xsi is pitiful (silo has ruined me :))


// JSZoomTools
// Initial code generated by XSI SDK Wizard
// Executed Wed Aug 29 01:55:54 UTC+0100 2007 by Squid
//=============================================================
// change this variable to whatever Zoom Value you require (in si units)
var ZoomFactor = 0.25;


function XSILoadPlugin( in_reg )
{
in_reg.Author = "Squid";
in_reg.Name = "JSZoomTools";
in_reg.Email = "squid@3d-palace.com";
in_reg.URL = "";
in_reg.Major = 1;
in_reg.Minor = 0;

in_reg.RegisterCommand("JSZoomIn","JSZoomIn");
in_reg.RegisterCommand("JSZoomOut","JSZoomOut");

//RegistrationInsertionPoint - do not remove this line

return true;
}

function XSIUnloadPlugin( in_reg )
{
var strPluginName;
strPluginName = in_reg.Name;
Application.LogMessage(strPluginName + " has been unloaded.",siVerbose);
return true;
}

function JSZoomIn_Init( in_ctxt )
{
var oCmd;
oCmd = in_ctxt.Source;
oCmd.Description = "Enables the user to hotkey the dolly functionality of xsi's cameras";
oCmd.SetFlag(siCannotBeUsedInBatch,true);
oCmd.SetFlag(siNoLogging);
oCmd.ReturnValue = true;
return true;
}

function JSZoomIn_Execute()
{

jsMain(false)

return true;
}

function JSZoomOut_Init( in_ctxt )
{
var oCmd;
oCmd = in_ctxt.Source;
oCmd.Description = "Enables the user to hotkey the dolly functionality of xsi's cameras";
oCmd.SetFlag(siCannotBeUsedInBatch,true);
oCmd.SetFlag(siNoLogging);
oCmd.ReturnValue = true;
return true;
}

function JSZoomOut_Execute( )
{
jsMain(true )
return true;
}

//----------------------------------------------------------


function jsMain(boolZoomOut)
{
var tmp;
var vec = XSIMath.CreateVector3();
//change this!!
if( boolZoomOut)
{
tmp = ZoomFactor;
vec.Set(0,0,tmp);
}
else
{
tmp = -ZoomFactor;
vec.Set(0,0,tmp);
}

// get the camera under the mouse
var ac = GetCamObj()

if(ac)
{
//!! xsi user cams with a perspective prop don't have a local kine. boo, hiss!!
if(ac.proj.Value) // it's a perspective cam
{
// throw the vector into the camera's local space
var trans = ac.Kinematics.Local.Transform
vec.MulByTransformationInPlace(trans);
// add the zoom to the transform copy
trans.SetTranslation(vec)

// you would probably check for distance to ac.interest and
// any sort of flipping here but, well, it's 2am :)

// put the new xform values back on the camera
ac.Kinematics.Local.Transform = trans
}
else // ortho
{
// ortho cams are simple,
// just set the ortho height and we are done :)

// opportunity for some sort of linear func here
var oh = ac.orthoheight;
if(oh.Value + tmp <= 0)
{
// do nothing, limt reached
Logmessage("implement your own lin func", siVerbose)
}
else
{
oh.Value += tmp;
}
}
}
}


function GetCamObj()
{
var vm = Desktop.ActiveLayout.Views.Find("View Manager")
var viewName = vm.GetAttributeValue("viewportundermouse");

// !! this returns the menu label for built in xsi cams !!
var activeCam = vm.GetAttributeValue("ActiveCamera:" + viewName);

//throwing errors to switch..welcome to VB for the bone idle circa 1998 :)
try
{
return (Dictionary.GetObject("Views.View" + viewName + "." + activeCam + "Camera", true))
}
catch(e)
{
// it's either a renderpass or a custom/scene camera
if(activeCam == "Render Pass") // just asking for trouble
return false
else
return (Dictionary.GetObject(activeCam, true));
}

}

copy and paste and save as a .js file. plop it in wg or your user root /plugins directory.
refresh the plugin manager then go map
JSZoomOut
JSZoomIn

to whatever hotkeys you want.

the reason it's not an addon is for the simple reason that it sucks :)

the script won't repeat when a hotkey is held down so it's rather rsi inducing.

compiled version should be a lot better (but i need sleep). i'll post that when done

oddforce
08-29-2007, 12:34 PM
This is a autohotkey script that remaps the wheel events to XSI hotkeys. You'll have to press the navigation hotkey in conjunction with turning the wheel so this will work (so as to avoid confilcts with the snapping/proportional mode adjustment functions)

This assumes navigation key is "s", and 5quid's commands from the previous post are mapped to ALT-p and ALT-o

#MaxHotkeysPerInterval 400

SetKeyDelay ,-1
~s & WheelDown::Send !{p}
~s & WheelUp::Send !{o}


If navigation is on ALT, use

#MaxHotkeysPerInterval 400

SetKeyDelay ,-1
~!WheelDown::Send !{p}
~!WheelUp::Send !{o}

BanzaiGonzo
08-29-2007, 01:11 PM
thank you for all the help, links and code.
i will try them all (as soon as possible) and see which one feels right for me.

BanzaiGonzo
08-29-2007, 10:27 PM
i just tried both methods (hotkeys & the JSZoomTools).
i appreciate the hotkeys link, but i will be using the JSZoomTools, at least for XSI.
it works without having to activate navigation with the "S" key.
i could probably figure out a way to do this with hotkeys, and may look into this in the future, but with all the different programs on my machine, finding a key combo not used in one of them might be difficult.
at work autohotkeys would not shutdown unless i did a CTRL+ALT+Del, so it seemed kind of wonky at first.
eventually it would close by left clicking the "H" icon, and i had no problems with it on my machine at home.
hotkeys is easier to figure out and write code for (8 lines for what i needed) and i am sure i will be using it at work since i use far fewer (2) programs with key combos, so finding an un-used one should be easy.
so many thanks again for the help, links, instructions & guidance.

p.s. still no e-mail password / reply from XSI for forum registration :( , and since your help has allowed me to stick with using XSI, be ready to be barraged with many more insipid and moronic help requests. :)

MarkInTx
08-29-2007, 10:55 PM
i do agree with the thread sentiments though. the lack of mouse wheel usage in xsi is pitiful (silo has ruined me :))


Amen to that! I love the fact that Silo lets you pretty much assign anything to anything!

Thanks for the code. I'll have to try it. The lack of a zoom on the mouse wheel is soooo frustrating!

oddforce
08-29-2007, 11:08 PM
Autohotkey allows per-application settings (should've included that in the script)


#MaxHotkeysPerInterval 400
SetKeyDelay ,-1
#IfWinActive, SOFTIMAGE
~s & WheelDown::Send !{p}
#IfWinActive, SOFTIMAGE
~s & WheelUp::Send !{o}


also if you don't want the navigation key combo, you could work around the collision issue (proportional adjust/snap) using the GetKeyState function


#MaxHotkeysPerInterval 400
SetKeyDelay ,-1
#IfWinActive, SOFTIMAGE
~WheelDown::
If GetKeyState("r", "P") ; don't send alt-p if "r" is pressed
return
Send !{p}
return

#IfWinActive, SOFTIMAGE
~WheelUp::
If GetKeyState("r", "P") ; don't send alt-o if "r" is pressed
return
Send !{o}
return


Autohotkey is really powerful, I use it for a lot of apps

CGTalk Moderation
08-29-2007, 11:08 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.