Notifications
Clear all

[Closed] How do I refresh Material Editor sample slots with MAXScript?

Hello,

I have a need of switching renderers with script:

renderers.current = Default_Scanline_Renderer()
renderers.current = mental_ray_renderer()

But the Material Editor sample slots do not refresh automatically in the same way as switching renderers with Render Setup dialog.

Is there a solution to this?

Thanks in advance!

3 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

material renderer might be locked to current renderer or might be not.
if it’s not locked you have to set material editor renderer


renderers.current = mental_ray_renderer()
if not renderers.medit_locked do renderers.medit = mental_ray_renderer()
 
-- or set them both:
renderers.medit = renderers.current = mental_ray_renderer()

  1. force update all materials in meditmaterials

with undo off with redraw off for k=1 to meditmaterials.count do meditmaterials[k] = meditmaterials[k]
-- it's better to do it without undo and redraw

Thank you, Denis!
This works, only the selected material is not refreshed.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

here is an another version:


for k=1 to 24 do 
(
 mat = medit.GetTopMtlSlot k
 setMTLMeditObjType mat (getMTLMeditObjType mat)
)