Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Select Folder dialog

Select Folder dialog

chrisdawlud
Enthusiast Enthusiast
2,154 Views
5 Replies
Message 1 of 6

Select Folder dialog

chrisdawlud
Enthusiast
Enthusiast

Hey guys. I want to create 'select folder' dialog window in maxscript looking just like this one below. It is from the new 3ds max 2019 'Projects' toolbar so I assume the right objects and methods are somewhere available to the user. I already tried  .NET's OpenFileDialog and FolderBrowserDialog but they lack functionality.

I thought I could maybe somehow take a look into 'Projects' toolbar's macroscript source code like I can with some  3rd party toolbars but it seems it's hidden for a reason?

123.jpg

0 Likes
Accepted solutions (1)
2,155 Views
5 Replies
Replies (5)
Message 2 of 6

Swordslayer
Advisor
Advisor
Accepted solution

You can find the functionality under stdscripts but the toolbar is not a regular toolbar (no macro buttons etc). You would want to use SDK methods instead. For example:

 

 

(
	local compilerParams = dotNetObject "System.CodeDom.Compiler.CompilerParameters" #(
		getDir #maxRoot + "Autodesk.Max.dll",
		getDir #maxRoot + "ManagedServices.dll")
	compilerParams.GenerateInMemory = on

	local compilerResults = (dotNetObject "Microsoft.CSharp.CSharpCodeProvider").CompileAssemblyFromSource compilerParams #(
		"using System;
		using Autodesk.Max;
		using SDK = ManagedServices.AppSDK;

		public class Dialogs {
			private static readonly IGlobal Global = Autodesk.Max.GlobalInterface.Instance;

			public static string BrowseForFolder(string title) {
				string folder = string.Empty;
				Global.COREInterface9.DoMaxBrowseForFolder(SDK.GetMaxHWND(), title, ref folder);

				return folder;
			}
		}"
	)
	::Dialogs = compilerResults.CompiledAssembly.CreateInstance "Dialogs"
)

And now you can call:

Dialogs.BrowseForFolder "Here comes the title"

 

 

Message 3 of 6

ads_royje
Alumni
Alumni

Hi @chrisdawlud,

 

would :

getSavePath()

be good for you ?

Message 4 of 6

chrisdawlud
Enthusiast
Enthusiast

Thank you for response. This example  creates the same basic dialog as getSavePath() function and although it does the job I would like to avoid it because tree view is not clear to read.

 

I found one way of doing this, but I have to include nuget package. At this point should I dive into Visual Studio or is it still possible to achieve only in maxscript using SDK methods?

0 Likes
Message 5 of 6

Swordslayer
Advisor
Advisor

@chrisdawlud wrote:

Thank you for response. This example  creates the same basic dialog as getSavePath() function and although it does the job I would like to avoid it because tree view is not clear to read.


What do you mean by the same basic dialog, care to share a screenshot? When testing it, I don't see a difference between the dialog in your screenshot and the dialog invoked by this (it used to be different in older max versions but you were talking about Projects toolbar which is fairly recent).

0 Likes
Message 6 of 6

chrisdawlud
Enthusiast
Enthusiast

Sorry, my bad. It's working perfectly with max 2019. I tested it in 2018 version, hence my confusion. Thanks very much

0 Likes