PDA

View Full Version : How do I refresh Material Editor sample slots with MAXScript?


macrod
10-25-2009, 01:11 AM
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!

denisT
10-25-2009, 06:43 PM
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!

1.
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()


2. 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

macrod
10-26-2009, 04:21 AM
Thank you, Denis!
This works, only the selected material is not refreshed.

denisT
10-26-2009, 03:40 PM
Thank you, Denis!
This works, only the selected material is not refreshed.

here is an another version:

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

CGTalk Moderation
10-26-2009, 03:40 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.