Hello Substance team,
I'm Colin and I am the creator of Relink Bitmaps and I love substance. I got a request from some of my users to add support for substance in Relink Bitmaps.
Relink Bitmaps is a 3dsmax script that repaths all of your textures/hdris/point caches/etc. assets to another directory, making it easy to work on different computers with drives mapped.
Here's a video on Relink Bitmaps:https://www.youtube.com/watch?v=6mxfqodWjd4While adding support I've found a bug with the integration into Max, I'm unsure if it's on your side or Autodesk's so I wanted to report it. The bug is with the Substance2 map type. The Substance(1) map type is working as intended.
Specs:Win10 - x64 Pro
3dsMax 2018.4 Update (20.0 - 20.4.0.4254)
Running this Maxscript generates an error:
MaxscriptclearListener()
-- Create a new Substance2 map
sub = Substance2()
-- put it in slot 1 of the material editor
medit.putMtlToMtlEditor sub 1
MatEditor.Open()
-- Print all of the properties of a Substance2 map
print (getPropNames sub)
-- Print the SubstanceFilePath
print sub.SubstanceFilePath
ListenerOK
Substance2:Substance2
OK
OK
#SubstanceFilePath
#ExportPresetFilePath
#ImportPresetFilePath
#numIMultipleOutputChannels
#Coordinates
OK
-- Error occurred in anonymous codeblock; filename: C:\Users\colin\Desktop\RB_Substance_Bug.ms; position: 307; line: 14
-- Known system exception
-- ########################################################################
-- Address: 0x6d32b8a9; nCode: 0x00000000C0000005
-- Desc: EXCEPTION_ACCESS_VIOLATION The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
-- Read of Address: 0x000002B53F800000
-- ########################################################################
-- MAXScript callstack:
-- thread data: threadID:20312
-- ------------------------------------------------------
-- [stack level: 0]
-- In top-level
-- ########################################################################
-- C++ callstack:
-- (maxutil): (filename not available): MaxSDK::Util::Logger::GetLogHandle
-- (maxutil): (filename not available): MaxSDK::Util::MaxString::FromUTF16
-- (maxutil): (filename not available): WStr::WStr
-- (ParamBlk2): (filename not available): NURBSTextureChannel::GetTextureSurface
-- (ParamBlk2): (filename not available): CopyParamBlock2ToParamBlock
-- (MAXScrpt): (filename not available): MAXWrapper::get_interfaces_vf
-- (MAXScrpt): (filename not available): MAXWrapper::get_property
-- (MAXScrpt): (filename not available): MAXWrapper::get_property
-- (MAXScrpt): (filename not available): PropertyThunk::eval
-- (MAXScrpt): (filename not available): MappedGeneric::apply
-- (MAXScrpt): (filename not available): CodeTree::eval
-- (MAXScrpt): (filename not available): SourceFileWrapper::eval
-- (MAXScrpt): (filename not available): Listener::set_style
-- (USER32): (filename not available): GetWindowRgnBox
-- (USER32): (filename not available): Ordinal2573
-- (USER32): (filename not available): Ordinal2573
-- (USER32): (filename not available): CallWindowProcW
-- (USER32): (filename not available): CallWindowProcW
-- (UIControls): (filename not available): InitializeCustomUI
-- (UIControls): (filename not available): (function-name not available)
-- (USER32): (filename not available): CallWindowProcW
-- (USER32): (filename not available): DispatchMessageW
-- (USER32): (filename not available): IsDialogMessageW
-- (3dsmax): (filename not available): NodeAndAnims::SetNode
-- ########################################################################
Here is the equivalent Substance (v1) map type that does not throw an error
MaxscriptclearListener()
-- Create a new Substance2 map
sub = Substance()
-- put it in slot 1 of the material editor
medit.putMtlToMtlEditor sub 1
MatEditor.Open()
-- Print all of the properties of a Substance2 map
print (getPropNames sub)
-- Print the SubstanceFilePath
print sub.SubstanceFilename
ListenerOK
Substance:Substance
OK
OK
#SubstanceFilename
#coords
#globalTextureWidth
#globalModeScale
#localRelativeTextureWidth
#localAbsoluteTextureWidth
#localMode
#globalTextureHeight
#localRelativeTextureHeight
#localAbsoluteTextureHeight
#lockAspectRatio
#rolloutStates
#numIMultipleOutputChannels
#output
OK
""
""