>: CG Forums on 3dtotal - The best forums for CG artists :.
threedy forums home
 


Go Back   3DTotal Forums > Archives > Archives > Scripting & coding

Reply
 
Thread Tools Display Modes
Old 01-03-2016, 04:37 PM   #1
fm3d
Registered User
 
Join Date: Dec 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Change Interaction mode Script

Hello. I'm new to MAX Script, and Im trying to do a script for changing the Interaction mode in 3DSMax without using: "Customize menu -> Preferences -> Interacion Mode -> ..."

My Macroscript for this is:

macroScript InteractionModeSwitch
category:"DragAndDrop"
toolTip:"Interaction Mode Switch"
(
fn getFile = "C:\Users\fmsuarez\AppData\Local\Autodesk\3dsmax\2 0 13 - 64bit\ENU\3dsmax.ini"
fn getIni = getINISetting (getFile()) "InteractionModeSection" "InteractionMode"
fn setIni = setINISetting (getFile()) "InteractionModeSection" "InteractionMode" ( if (getIni()) == "3dsMax" then "Maya" else "3dsMax" )

On IsChecked Return (If (getIni() == "Maya") do return true)
On Execute do setIni()
)

This one changes the Interaction Mode value, but the change has no effect for navigation in the viewports.
Any help is welcome. Thank you.
fm3d is offline   Reply With Quote
Old 02-03-2016, 11:55 AM   #2
insect
...
 
Join Date: Oct 2002
Location: Kaunas, Lithuania
Posts: 793
Thanks: 0
Thanked 23 Times in 23 Posts
It is quite likely that max reads the .ini file only when loading the UI, so whatever you change in it might not have immediate results. And your changes may be overwritten when max decides to save its effective settings to the ini file.

Have you tried changing the value using IInteractionMode.CurrentMode?
See MAXscript help for more: http://www.google.com/url?sa=t&rct=j...kxxEMw&cad=rja

I'm also a little puzzled why call a function that only returns a constant string... Wouldn't a variable have been enough?
insect is offline   Reply With Quote
Old 02-03-2016, 05:28 PM   #3
fm3d
Registered User
 
Join Date: Dec 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Change Interaction mode Script - Resolved

Thank you very much for your help "insect". The .ini file modified with my script works as you say.
I have used the "IInteractionMode.CurrentMode" command and now I've gotten it to work the way I wanted.

The new MacroScript is:

macroScript InteractionModeSwitch
category:"DragAndDrop"
toolTip:"Interaction Mode Switch"
(
fn currentimode = IInteractionMode.CurrentMode
fn setcurrentimode = (if (currentimode()) == #3dsMaxMode then (IInteractionMode.CurrentMode = #MayaMode)
else (IInteractionMode.CurrentMode = #3dsMaxMode))

On IsChecked Return (If (currentimode() == #MayaMode) do return true)
On Execute do setcurrentimode()
)
fm3d is offline   Reply With Quote
Old 02-03-2016, 11:48 PM   #4
fructose
Registered User
 
Join Date: Mar 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
It is helpful to me, I leart it. thanks
fructose is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
all images displayed on this site are copyright the original artists and may not be reproduced, copied or published elsewhere without their express permission