View Full Version : Drag and Drop Issue

09-18-2008, 04:09 PM
And again...
I'm doing some drag and drop operations from files I have on my storage server, the thing is that when I drop them into an object it "downloads" the texture thus copying it (aka duplicating it) to my local disk in mydocuments/3dsmax/download. Can this be avoided? Because the file it's already in the network accessible to all computers... Thanks in advance once again.

09-18-2008, 09:49 PM
hi artur, could you explain a little more on how you are doing this? have you seen this (http://www.lonerobot.com/filedrop.html) page on my site? Using this method it doesn't exhibit the copying you mention.

09-19-2008, 12:14 AM
Pete when did you get the site up?

Just added a link in my news to you and updated my dotNet page with a link to you home page as well.


09-19-2008, 06:00 AM
Hi Paul, thanks for that. It's not been up long but im hoping to add to it when I can and bring more stuff for people to download. I just wish i understood CSS layout a bit better! :thumbsup:

09-19-2008, 09:15 AM
Hi Pete, Paul.
Yes Pete, I actually used your code but I found out that it only happens when I drag the texture to an object in the viewport and it creates a standard material with that bitmap in the downloads directory but when I drag it to the matedit or a texture slot or whatever, it works as expected :)

One thing I dont understand well are the DragEffects... Copy, All, Move, Link... do you know something about that? Thanks!

09-19-2008, 09:39 AM
hi artur,

i tried it here dropping a texture string onto an object in max from our onsite NAS and it doesn't seem to exhibit the same behaviour as you are noting. My only thought is that where you are dropping it from is making max think that it's a remote location and is threating it as i-drop. There is nothing complicated in the dotnet dragdrop, it purely wraps the filename string in a package max wants to open. I guess it must make the choice depending on the filetype or location on what it does with it, hence why you get different menus poping up. (I get a dfiferent one if i dropan XML into the viewport too)

as for the different type of dropeffects, i only know what i read on msdn, and the fact that any others don't work. hope this helps.

09-19-2008, 09:54 AM
I just used your script changing only the filenamestring and it has the same behaviour as in my script, when dragged to an object in the scene the texture is downloaded to max downloads dir.

Your function:

on btndragdrop mouseup sender args do

if (sender.clientrectangle.contains args.x args.y) then ( )
theIniFile = getdir #maxData + "3dsmax.ini"
theKeys = getIniSetting theIniFile "FileList"
maxfilearray = for o in theKeys where o != "MaxFiles" collect getIniSetting theIniFIle "FileList" o
filenameString = maxfilearray[1]
dropfile = dotnetobject "System.String[]" 1
dropfile.setvalue @"\\manager\3D STUFF\IAM\TEST\window001.JPG" 0
DataObj = dotnetobject "DataObject" ((dotnetclass "DataFormats").filedrop) dropfile
sender.dodragdrop Dataobj ((dotnetclass "DragDropEffects").Copy)


09-19-2008, 10:14 AM
hi again artur,

i'm not too sure as i've tried it on my 32bit laptop and my 64bit machine here. I will see if i get the same from any other machines. hey, what's that @ sign in front of the setvalue? does that mean you dont have to use a string object?
in any case, on my 64bit machine in 2009 it doesnt work setting the value using that method! only the way i originally wrote. strange indeed. I'll look into it. are you on vista by any chance?


09-19-2008, 10:23 AM
Maybe that's it, I'm on XP-64Bit! Max2009 also. The @ was something I saw over here on cgtalk, it's because of the \ and that stuff, you dont need to do "c:\\bla\\duh" simply put the @ before the string and voila @"c:\bla\duh" the way it's meant to be :buttrock:

09-19-2008, 11:00 AM
ah, cool. that's good to know. thanks artur. As for the string method in my code, i did it so that it could to work in earlier versions of max without error so i kept it. have you noticed we keep ping-ponging between thread conversations. i hope i dont write the wrong reply!

CGTalk Moderation
09-19-2008, 11:00 AM
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.