Jump to content
3DCoat Forums
PolyHertz

3DS Max Applink - Complete Rewrite

Recommended Posts

Update: https://dl.dropboxusercontent.com/u/4210886/3ds%20Max%20Applink%20v1.8c.mzp

 

Changes:
-Fixed issue with "Export To" directories not being properly created (bug affected v1.8+ ).
-Fixed special right-click Export mode (export without auto-importing into 3DC feature)
-Fixed a bug that happened if users tried to import a mesh with a preset enabled without exporting any maps from 3D-Coat.
-Fixed some minor UI issues (radio buttons not showing what was selected by default).
-Fixed bug where auto-import would activate when switching different Temp directories.

  • Like 1

Share this post


Link to post
Share on other sites

Hmm, I get this no matter what I do, Manual install and drag install:

 

I get this when I run the script or click the 3d coat applink button:

--   currentINIsettings: #("UVs", "", "Default (no preset used)", "E:\games\steam games\steamapps\common\3d-coat\3D-CoatDX64C.exe", undefined, undefined, false, undefined, undefined, true, true, true, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, ...)
--   scriptDirTMP: "C:\Users\Bjørn\AppData\Local\Autodesk\3dsMax\2016 - 64bit\ENU\scripts\"
--   runfile: undefined
>> MAXScript Rollout Handler Exception:
-- No ""+"" function for undefined <<

-- Error occurred in anonymous codeblock; filename: C:\Users\Bjørn\AppData\Local\Autodesk\3dsmax\2016 - 64bit\ENU\usermacros\GregsScripts-g_3DCappLink.mcr; position: 41240; line: 801
--  Frame:
--   tmpFilesPath: undefined
-- No ""+"" function for undefined

Error generated on this line:

	------Get newest export.txt file------
	tmpRootEXPfile = (tmpFilesPath + "export.txt")
	tmpMaxEXPfile = (tmpFilesPath + maxver + "/export.txt")
	existA = doesFileExist tmpRootEXPfile
	existB = doesFileExist tmpMaxEXPfile

Get this when I press the Import button.

--   called in expButton.pressed(); filename: C:\Users\Bjørn\AppData\Local\Autodesk\3dsMax\2016 - 64bit\ENU\usermacros\GregsScripts-g_3DCappLink.mcr; position: 78114; line: 1475
--  Frame:
--   expSuccess: undefined
>> MAXScript Rollout Handler Exception:
-- No ""+"" function for undefined <<
undefined

This error happens on this line:

	--Perform actual export
	tdcExpSuccessful = false
	if (noPrompt == true) and ((getCurrentSelection()).count != 0) do (tdcExpSuccessful = exportFile (tdcTmpDir +"input.obj") #noprompt selectedOnly:true using:ObjExp)
	if (noPrompt == false) and ((getCurrentSelection()).count != 0) do (tdcExpSuccessful = exportFile (tdcTmpDir +"input.obj") selectedOnly:true using:ObjExp)

Nothing happens when trying to send this to 3D-coat naturally.

 

Found some forum posts with the same error, but those were related to older 3d coat version mismatch etc. Which is not the case for me. ( I could not find the specific lines mentioned in a search at least. )

 

I get around this by exporting and importing back & forth. Not the first time this happens, even had problems with autodesks integrated "send to" command between 3dsmax, maya and mudbox as well.

 

I'be been trying to find out whats wrong, could it be a steam installed 3d-coat? I had to manually update some of the code because I have my steam library installed on another harddrive. Before that the applet did not even appear, it did after i changed those lines, however, there must be something more I need to check..problem is, there is quite the few lines of code and it's easy to miss something when going through it not know what to look for.

 

Thanks in advance!

 

Share this post


Link to post
Share on other sites

 

Hmm, I get this no matter what I do, Manual install and drag install:

 

I get this when I run the script or click the 3d coat applink button:

--   currentINIsettings: #("UVs", "", "Default (no preset used)", "E:\games\steam games\steamapps\common\3d-coat\3D-CoatDX64C.exe", undefined, undefined, false, undefined, undefined, true, true, true, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, ...)
--   scriptDirTMP: "C:\Users\Bjørn\AppData\Local\Autodesk\3dsMax\2016 - 64bit\ENU\scripts\"
--   runfile: undefined
>> MAXScript Rollout Handler Exception:
-- No ""+"" function for undefined <<

-- Error occurred in anonymous codeblock; filename: C:\Users\Bjørn\AppData\Local\Autodesk\3dsmax\2016 - 64bit\ENU\usermacros\GregsScripts-g_3DCappLink.mcr; position: 41240; line: 801
--  Frame:
--   tmpFilesPath: undefined
-- No ""+"" function for undefined

Error generated on this line:

	------Get newest export.txt file------
	tmpRootEXPfile = (tmpFilesPath + "export.txt")
	tmpMaxEXPfile = (tmpFilesPath + maxver + "/export.txt")
	existA = doesFileExist tmpRootEXPfile
	existB = doesFileExist tmpMaxEXPfile

Get this when I press the Import button.

--   called in expButton.pressed(); filename: C:\Users\Bjørn\AppData\Local\Autodesk\3dsMax\2016 - 64bit\ENU\usermacros\GregsScripts-g_3DCappLink.mcr; position: 78114; line: 1475
--  Frame:
--   expSuccess: undefined
>> MAXScript Rollout Handler Exception:
-- No ""+"" function for undefined <<
undefined

This error happens on this line:

	--Perform actual export
	tdcExpSuccessful = false
	if (noPrompt == true) and ((getCurrentSelection()).count != 0) do (tdcExpSuccessful = exportFile (tdcTmpDir +"input.obj") #noprompt selectedOnly:true using:ObjExp)
	if (noPrompt == false) and ((getCurrentSelection()).count != 0) do (tdcExpSuccessful = exportFile (tdcTmpDir +"input.obj") selectedOnly:true using:ObjExp)

Nothing happens when trying to send this to 3D-coat naturally.

 

Found some forum posts with the same error, but those were related to older 3d coat version mismatch etc. Which is not the case for me. ( I could not find the specific lines mentioned in a search at least. )

 

I get around this by exporting and importing back & forth. Not the first time this happens, even had problems with autodesks integrated "send to" command between 3dsmax, maya and mudbox as well.

 

I'be been trying to find out whats wrong, could it be a steam installed 3d-coat? I had to manually update some of the code because I have my steam library installed on another harddrive. Before that the applet did not even appear, it did after i changed those lines, however, there must be something more I need to check..problem is, there is quite the few lines of code and it's easy to miss something when going through it not know what to look for.

 

Thanks in advance!

 

Looks like you have your 3D Coat install folder in a drive with the letter E: ....which could be the culprit. Applink might be looking for 3D Coat in the C drive. Just a guess.

Share this post


Link to post
Share on other sites

It looks like it's failing to write one of the basic files. Two possibilities:

 

1. Windows permissions are interfering with files being written to your users directory.

2. Max is having problems with the file path itself (maybe due to the "ø" in your user name).

Edited by PolyHertz

Share this post


Link to post
Share on other sites

I can confirm that version 1.8c does not work when 3D coat is installed on a drive other than the C drive.  I installed the applink with no problem on a pc with 3d coat installed on the c drive.  When I tried to do the same on another windows 7 computer we have that has 3D coat installed on the E drive (since the ssd C drive is getting a bit full), the temp directory path field comes up blank in the app link rollout and the error,  "No  "+" function for undefined " is displayed for the line that has "tmp Root Exp file = tmp Files Path + "export.txt".  Based on the forum messages, I have tried the following without any success:

 

Ran 3ds max as administrator both before and after install

Edited the file, Applink_3DC_settings.ini to contain a temp directory set up on the E drive

 

If I right click on the temp directory field of the app link dialog, I get another error to the effect that shell explorer.exe is expecting  a string but is getting "undefined"..

 

However, as soon as I created a new Exchange directory on the C drive at C:\Users\[user Name]\Documents\  the app link works.  This is irrespective ot the path specified in the .ini file , which still points to the E:\ drive location for the Temp directory.  So the installed script apparently expects the Exchange folder to be only on the C:\Drive and doesn't allow/recognize an Exchange folder on another drive irrespective of the path specified in the .ini file.  Anyway this worked for me, and I thought I would pass this along in case someone else finds it to be helpful.

 

Thanks for the useful script.

Share this post


Link to post
Share on other sites

C_Man: Could you tell me where this ini file is that points to the exchange directory? Someone mentioned it before, and I looked for it on my pc, but couldn't find it, and thus couldn't implement it.

Share this post


Link to post
Share on other sites

Sure.  On my computer, the ini file is here:

 

C:\Users\Dave\Documents\Applink_Max3DC\AppLink_3DC_settings.ini

 

Hope it helps.  

Share this post


Link to post
Share on other sites

Update: https://dl.dropboxusercontent.com/u/4210886/3ds%20Max%20Applink%20v1.8d.mzp

 

Changes:

-Added ability to select alternative Exchange (temp files) directories via "Other..." at bottom of drop down list (just like for exe files).

-Added a ton of error checking for those that have 3D-Coat on a drive other then "C:/".

-Corona material presets have had their gloss output inverted.

Edited by PolyHertz
  • Like 1

Share this post


Link to post
Share on other sites

Sorry if I wasn't clear about the ini file -- I was referring only to the one that your script created.  I do not know of any created by 3D Coat.  Very impressive turnaround with the update btw.  Version 1.8d installed without any hiccups.  Thanks for your efforts and impressive responsiveness.

Share this post


Link to post
Share on other sites

Just did a stealth update to 1.8d, if the current version was still giving anyone problems, download and try it again.

Edited by PolyHertz

Share this post


Link to post
Share on other sites

Thanks Polyhertz for the update.  I think I picked up a glitch in that while the temp directory field of the applink rollout now correctly gives the option of changing the directory, when the user selects the directory there is a missing "\" at the end of the path.  This (at least in my case) caused the applink to not open the mesh i I was trying to export into 3D Coat.  The fix I found was to simply edit the AppLink_3DC_settings.ini file (written by your script) and add the missing backslash to the end of the path.  After that the exchange between apps worked perfectly as far as I can tell.  Just wanted to pass this along in case it is helpful.

Share this post


Link to post
Share on other sites

Thanks for updating it. It solved everything for me. 

I had one last problem and that was that even after last update, my mesh did not import to 3d coat, it opened 3D-coat and nothing happened after that. Turns out that it was because I had moved my "Documents" directory to another harddrive..did this to avoid unecessary writes and trashdata to the SSD drive which contains "C:".

Windows does not solve the "move to another location" very efficiently, it actually moves the directory to another drive and link it directly, microsoft should be slapped for this solution, it's not a good way to do it, it should have been moved AND created a symlink from the old location to the new one to fool the system. To many programs rely on the original C:\%userprofile% folder. 
This would also explain why some programs have been acting funky. 

Just so people know. 3D-Coat actually installs into the redirected user profile folders, but the applink does not, there is a mismatch, so the applink will not find the exchange folder located in the directory because it's not located under C:\Users\<user>\3D-CoatV45.

The solution is simple though:

 

1. Install the applink like usual.

2. move the applink folder called "Applink_Max3DC" located under "C:\users\<user>\Documents\" to the profile location that you chose.

3. Open a command line window with elevated right ( run as administrator )

4. Type:

cd c:\users\<USERNAME>\Documents 

You NEED to do this first to get the right location or else you will have a useless symlink lying in your System32 folder.

 

5. use the command below to create a symbolic link.

mklink /d Applink_Max3DC [YourDrive e.g F:\]DocumentsFolder\Applink_Max3DC

You should get a confirmation message if it was created correctly.

 

6. Now you need to make an symlink for the 3D-CoatV45 Folder to.

mklink /d 3D-CoatV45 [YourDrive e.g F:\]DocumentsFolder\Applink_Max3DC

Same here with confirmation message.

 

You should now have 2 folders in your default profile folder that looks like shortcuts, you may want to right click on them and check that they point to the right path etc.

Now test!

I tested my symlinks and they work.

 

Protip: You can also use mklink command on basicly everything and it can trick programs to think your location is somewhere it's not, hence why it's genious to use in many cases.
If you use OneDrive for example ( which does not let you right click and syncronize folders (come on microsoft....) you can create symlinks to get around this. But remember to only use symlinks INTO a cloud based storage program, not the other way, that might turn out problematic. I will not go into more detail here ( yeah shutup Mr.Digression ).

 

Just thought maybe someone else might run into this problem. :)

Share this post


Link to post
Share on other sites

Could someone who has their documents folder on a different drive then C:/ run this and let me know if the window that pops up shows the correct directory path? Also what OS your using (since I don't know if the registry values have the same location across different Windows versions)

 

https://dl.dropboxusercontent.com/u/4210886/showDocPath.ms

Share this post


Link to post
Share on other sites

Hi PolyHertz,

 

I have My documents on my E drive ( the specific path is E:\My Documents ) , and when I ran the script, the following appeared  in the popup window     E:\

 

I have Windows 7.Professional, Service Pack 1.

 

Hope this is helpful. 

 

C_Man

Share this post


Link to post
Share on other sites

I tested it as well, I got the full path when trying the .ms file you linked. It displayed exactly "D:\Documents" here. I have Windows 10. However, the documents path should be the same on all Windows versions since windows visa to present.

They will always be stored under "C:\Users\%username%\Documents" by default.  The Library however might name the "Documents" folder "My Documents".

WIndows versions prior to Windows Vista had another system for documents, which is not used anymore. So any version above vista should use the same pathing in the registry. 

Share this post


Link to post
Share on other sites

I just installed this and have a small issue to report. When 3DC opens, I never get the 'Import' panel. All I see is the regular options panel (...Voxel Sculpting, Repair Scanned Mesh, Vertex Painting...etc. )

 

I exported from Max 2016 after having 'uninstalled' the Applink first go round. I restarted Max and installed and tried to export a teapot with VRay basic material. 3DC opens and then nothing else. I tried a Standard material also. I rebooted the whole machine for kicks, not necessary I realize but what the heck. No help. 

 

I searched for some .ini's or something to see if maybe a path was incorrect for something. I do see in the 'Export' folder a 'run.txt' under my Max 2016 folder that is generated. That .txt file is completely blank. Not sure if that indicates anything or not. 

 

Finally, the '.mat' files are in the proper place:  "C:\Users\%username%\Documents"

Edited by RobH2

Share this post


Link to post
Share on other sites

Are you sure that the correct Temp Files path for your version of 3D-Coat is selected? If using any version of 3D-Coat 4.5 it should be the 3D-CoatV45 in your documents. It wont import the mesh if this isn't set correctly.

 

The run.txt is supposed to be blank (it's what lets you use 'Export To' when sending files from 3D-Coat to Max). This is auto-generated for all 3D-Coat document folders when the applink is started.

When you export from Max to 3D-Coat, it should generate an an input.obj and import.txt file in the Exchange directory of your specified temp folder. 3D-Coat then deletes the import.txt as soon as its done importing the OBJ.

Edited by PolyHertz

Share this post


Link to post
Share on other sites

Hi, yes, the correct Temp File path is selected and the input.obj is indeed created. 3DC just doesn't open the 'Import' window when it automatically opens. The 'import.txt' file in the Temp File path references the correct path as well (actually, the path that it is in). 

 

Certainly, I can go import 'input.obj' manually, but that defeats the purpose a bit.  Odd...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×