[Closed] Accessing Photoshop BitmapTextures
Hi all,
I’m trying to change the loaded layer in photoshop files through scripting, so that I can automate some material processing. However, I’m having some problems finding out how (if at all) it can be done…
I’ve tried using the BitmapLayerManager interface, which should be able to switch the layers using the LoadLayer function. I tried entering this into my script:
bitmapLayerManager.LoadLayer meditMaterials[1].diffusemap.filename 1 true
But that doesn’t seem to do anything.
Is there anyone out there who can give me any pointers as to what to do?
Thanks,
Rune
Rune,
I created a simple 3 layer PSD in Photoshop and saved to 3dsmax6/Images/test.psd
Then I executed the following:
theBmp = bitmapLayerManager.LoadLayer "c:/3dsmax6/images/test.psd" 1 true
meditMaterials[1].diffusemap = bitmapTexture()
meditMaterials[1].diffusemap.bitmap = theBmp
This loaded the second layer of the PSD into the diffuse slot of Medit Slot 1.
Note thay it is 0-based, so the background loads using:
theBmp = bitmapLayerManager.LoadLayer "c:/3dsmax6/images/test.psd" 0 true
meditMaterials[1].diffusemap.bitmap = theBmp
Hope this helps.
I will add this as example to the next revision of the MAXScript Reference…
Edit: Just noticed that the Reference says “Returns the name of the layer”.
It returns a bitmap value, you can even do
theBmp = bitmapLayerManager.LoadLayer "c:/3dsmax6/images/test.psd" 0 true
display theBmp
Fixing as we speak.
Oh thanks a million, Bobo!
I was doing it the other way around, by first assigning a texture and then trying to switch its layers. Thanks for getting a noob scripter back on track
I’m wondering about this Maxscript Reference updating you’re doing. We’re still on 3dsmax 5 here, and will be updating to 3dsmax 7 right after christmas. I’ve heard several times that the maxscript documentation in 7 is a huge improvement, so I’m really looking forward to that But these updates you’re doing now are for the next point update, right? Or will it be possible to download minor documentation updates from the discreet site?
Thanks, Rune
We (Discreet TechPubs and I) intend to provide frequent downloadable updates. In fact, I expect the next update to be available either today or early next week.
You can download the shipping version of the Reference from the Max 7 Demo download page…
I am constantly finding small (or big) errors in the descriptions and fixing them as I go. I hope that we can reach a new level of customer satisfaction with these updates…
Cheers,
Bobo
P.S. Congratulations on your Deadline purchase
Hey Bobo;
I was just playing with this after seeing this post… I’m guessing one can not alter and save the bmp back to the layer in the PSD file?
I’ve tried saving the bitmap after loading the layer, only to get the error :
[size=1][/size]
[size=1]– Runtime error: Cannot output to a bitmap file open for input: BitMap:D: est2.psd[/size]
[size=1][/size]
[size=1][size=2][color=#ffffff]Is there any plan on the table for this functionallity?[/size][/color][/size]
[size=1][size=2][color=#ffffff][/size][/color][/size]
[size=1][size=2][color=#ffffff]Thanks…[/size][/color][/size]
[size=1][size=2][color=#ffffff][/size][/color][/size]
[size=1][size=2][color=#ffffff]Keith Morrison[/size][/color][/size]
[size=1][size=2][color=#ffffff]focus360.com
[/size][/color][/size]
I have no idea.
MAXScript does not have any functionality to manage multiple layers – it can just read one or all and handle as a regular bitmap.
If MAX would add someday support for PSD writing, I would expect MAXScript to allow this sort of access…