Notifications
Clear all

[Closed] XRef maxscript problem

I am working on a tool of managing all xref objects in one scene. Is it possible to suppress the Duplicate Material Name dialog just like mergeMaxFile quiet:true? Another problem is by default showTextures is off on newly imported xref object, how to turn on the display of texture by maxscript? Thanks in advance.

2 Replies

Not directly, I think – you can with the dialog monitor ops and the UI accessor… essentially triggering code that presses the desired button when the dialog pops up:


dialogMonitorOps.unRegisterNotification id:#test
fn checkDialog = (
	local hwnd = dialogMonitorOps.getWindowHandle()
	if (uiAccessor.getWindowText hwnd == "Duplicate Material Name") then (
		-- uiAccessor.pressButtonByName hwnd "Use Merged Material"
		uiAccessor.pressButtonByName hwnd "Use Scene Material"
		-- uiAccessor.pressButtonByName hwnd "Auto-Rename Merged Material"
	)
	true
)

dialogMonitorOps.enabled = true
dialogMonitorOps.interactive = false
dialogMonitorOps.registerNotification checkDialog id:#test
xrefs.addNewXrefObject ((getdir #scene) + "\\sphere01.max") "GeoSphere01"
dialogMonitorOps.enabled = false


-- where myObj is an XRef's object
showTextureMap myObj.material true

Thanks a lot, ZeBoxx2! I will try your methods right away. Thanks.