[Closed] call a material editor sample slot
Hi all,
How can I call a sample slot from the material editor (the action of double clicking the)?
https://docs.google.com/file/d/0B0V4AxfEEBovQ1FWcXdZN0FPNTg/edit?usp=sharing
Thanks
set this slot active and call medit.GetCurMtl()
i don’t have max to check… am i missing anything?
Hi Denis,
the medit.GetCurMtl() only returns the current bitmap, but it does not open the sample preview
you didn’t ask anything about a preview… what do you actually want?
do you want to launch magnify window for current material editor slot?
you can do it with only opened Material Editor
(
MatEditor.Open()
actionman.executeAction 2 "40296"
)
Yes this is what I needed. Thanks again
Also is there another command that closes this magnify window?
Or you can make your own window that shows the bitmap(scaled to desired size) and then can close this window via maxscript.
Ripped from my old script. You can scale the rollout and the bitmap will scale with it. You can move the rollout by draging the bitmap with the mouse.
(
global rol_MapPreview
try(destroyDialog rol_MapPreview)catch()
rollout rol_MapPreview ""
(
local theBMP = undefined
local mousedd = false
local roPos = [0,0]
on rol_MapPreview lbuttonup pos do mousedd = false
on rol_MapPreview lbuttondown pos do
(
mousedd = true
roPos = pos
)
on rol_MapPreview mousemove pos do
(
if mousedd do SetDialogPos rol_MapPreview (mouse.screenpos - roPos)
)
imgtag bm_Preview pos:[0,0] width:196 height:196 bitmap:(bitmap 1 1 color:black) enabled:off
on rol_MapPreview open do
(
theBMP = meditmaterials[1].diffuseMap.fileName
rol_MapPreview.title = filenameFromPath theBMP
bm_Preview.bitmap = (openBitmap theBMP)
bm_Preview.width = rol_MapPreview.width
bm_Preview.height = rol_MapPreview.height
)
on rol_MapPreview resized Point2 do
(
local ro_size = GetDialogSize rol_MapPreview
-- keep rollout square
rol_MapPreview.width = ro_size[1]
rol_MapPreview.height = ro_size[1]
bm_Preview.width = ro_size[1] - 2
bm_Preview.height = ro_size[1] - 2
-- rollout can't be smaller than 196x196 px
if rol_MapPreview.width < 196 do rol_MapPreview.width = 196
if rol_MapPreview.height < 196 do rol_MapPreview.height = 196
)
on rol_MapPreview close do
(
freeSceneBitmaps()
)
)
createDialog rol_MapPreview 196 196 style:#(#style_sysmenu,#style_toolwindow,#style_resizing)
)
This is fine, but the reason I need the sample preview is because I need to see the texture after I change the RBG offset spinner and invert checkbox.
You can see the image below:
https://docs.google.com/file/d/0B0V4AxfEEBovVFpqS19TUGlrZ3c/edit?usp=sharing