Notifications
Clear all

[Closed] assign default vray material

I failed, =|

I m failed

I’ve changed this much but still in the box (rollout) I couldn’t execute a direct command without a dialogue window. Without dialogue, I have to assign only shortcut to all objects and a default VRayMtl element. Help me edit this code please?

macroScript AssignVRayMaterial
category:“Medit Tools”
tooltip:“Assign VRay Material”
(
rollout ro_assign_material “Assign VRay Mtl” width:120 height:40
(
button bt_default “Default” pos:[8,8] width:104 height:24
local AssignMat
global vrnames
fn IntToString pInt = formattedPrint pInt format:“03d”
fn AssignMat asCopy:false type:#default =
(
if vrnames == undefined do vrnames = #(1,1,1)
if selection.count > 0 do
(
case type of
(
#default:
(
mat = VRayMtl Diffuse:[50,50,50] Reflection:[200,200,200] name:(“VrayMtl_” + IntToString vrnames[2]) Reflection_glossiness:0.5
vrnames[2] += 1
)
)
for o in selection do o.Material = if asCopy then copy mat else mat
)
)
on bt_default pressed do AssignMat type:#default
)
createdialog ro_assign_material style:#(#style_titlebar, #style_toolwindow, #style_sysmenu)
)

Last edit

macroScript AssignVRayMaterial
category:“Medit Tools”
tooltip:“Assign VRay Material”
(
rollout ro_assign_material “VrayMtl” width:80 height:40
(
button bt_default “Assign” pos:[8,8] width:70 height:24
local AssignMat
fn AssignMat asCopy:off type:#default =
(
if selection.count > 0 do
(
#default:
mat = VRayMtl Diffuse:[50,50,50] Reflection:[200,200,200] name:“VrayMtl” Reflection_glossiness:0.5
for o in selection do o.Material = if asCopy then copy mat else mat
)
)
on bt_default pressed do AssignMat type:#default
)
)

please, help me clear rollout menu

Save this as mcr file and drag and drop it onto 3ds max viewports. Then add a hotkey to it.
Select some objects and use the hotkey.

macroScript AssignVRayMaterial
category:"Medit Tools"
tooltip:"Assign VRay Material"
(	
	on execute do
	(
		if selection.count > 0 do
		(
			mat = VRayMtl Diffuse:[50,50,50] Reflection:[200,200,200] name:"VrayMtl" Reflection_glossiness:0.5
			selection.material = mat	
-- 			for o in selection do o.Material = mat
		)
	)
)

Finally amazing, thanks you so much bro.

Page 3 / 3