[Closed] Drag and drop from winform to material editor
yes, i’m aware of this.
but at least this wouldn’t require the hardcoded hwnd which in my case didn’t happened to work.
this would not work for any other name or view…
this looks for active view name. should work with any view number or name
(
g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
slate_hwnd = undefined
slate_hwnd = (windows.getChildHWND 0 "Slate Material Editor")[1]
CurViewName = (sme.getview SME.activeView ).name
fn GetSMEWindowHandle =
(
max_hwnd = windows.getMAXHWND()
for m in windows.getChildrenHWND 0 where m[4] == "NodeJoeMainWindow" and m[5] == "Slate Material Editor" and m[6] == max_hwnd do exit with m[1]
)
sme_hwnd = GetSMEWindowHandle()
fn GetMainWindowHandle = (
for data in windows.getChildrenHWND sme_hwnd where data[4] == "DragDropWindow" and data[5] == CurViewName do exit with data[1]
)
hwnd = GetMainWindowHandle()
ptr = (dotnetobject "system.intptr" hwnd)
d = g.GetIDADWindow ptr
_pt = windows.screenToClient hwnd mouse.screenpos
pt = dotNetObject "system.drawing.point" _pt.x _pt.y
mtl_scid = (dotNetClass "Autodesk.Max.SClass_ID").Texmap
mtl = checker()
anim = g.animatable.getanimbyhandle (dotNetObject "System.UIntPtr" (getHandleByAnim mtl) )
format "OkToDrop: %\n" (d.DadMgr.OkToDrop anim ptr ptr pt mtl_scid false)
d.DadMgr.Drop anim ptr pt mtl_scid d.DadMgr false
)
do you know if i can send an hotkey (eg spacebar) event by using this function to trigger a textbox under the mouse cursor in the sme?
i tried with standard max hotkeys binding but obviously cant
i have the spacebar binded to other things in max so it should be “sme view” specific
something substance space bar pressed
it will also be nice to be able to pass the “wire” to maxscript so if you select the wire you can know the in and out parameter so you can insert a node between your parent and child
Wire between the nodes is something that user has no access whatsoever.
As of hotkey, it is possible using c# sdk.
- Make a class that derives from Autodesk.Max.Plugins.ActionItem
- Implement its methods
- Create an instance of this class
- Pass this instance to AppendOperation method of sme action table (you can find it using ActionManager class)
- Bind it to whatever key combination you like. It will work in SME context only
thank you, i will try to get something out of what you pointed
i understand it will be almost impossible with my knowledge but i will try
Hi, looks like max 2024 updated the windows structure-
“NEW in 3ds Max 2024: Functions that take a HWND argument to specify the window operated on may instead take a RolloutFloater, Rollout, or the name #max to specify the 3ds Max main window. The synopsis of those functions is updated below.”
I’m trying to update this script to get it working with 2024 but have not had any luck, have you had the chance to do so? Thanks for any possible help
EDIT: nevermind, it was simple- “nodeJoeMainWindow” is now “Qt5151QWindowIcon”. I guess because of the new SME?