Notifications
Clear all

[Closed] How to simplifly?

[QUOTE=denisT]

try(destroydialog test) catch()

rollout test "test" width:200
(
	button change_bt "Change VRay Cameras" width:190 align:#left offset:[-8,0] \
		tooltip:"Change VRay selected cameras settints
   + Ctrl	- All"
	
[B]	fn findVrayPhysicalCameras selected:off = 
	(
                nodes = if selected then selection else cameras
		for node in nodes where iskindof node VrayPhysicalCamera collect node
	)
[/B]	local preset1 = 
	#(
		#(#f_number, 8),
		#(#shutter_speed, 60),
		#(#ISO, 100),
		#(#vignetting, off),
		#(#whiteBalance_preset, 1),
		#(#whiteBalance_preset, 4)
	)
	on change_bt pressed do undo "Change Vray Physical Cameras" on
	(
		all_cameras = keyboard.controlpressed 
		cams = findVrayPhysicalCameras selected:(not all_cameras)
		if cams.count > 0 do
		(
			for p in preset1 do setproperty cams p[1] p[2]
		)
	)
)
createdialog test



code was changed to make it works

k4noe:
Hi, thank you for your help, i get this error after insert your code:

Syntax error: at else, expected "do" or "collect"
--  In line:  else j

Hi denisT,

This work and no error message even i didn’t select anything or camera in the scene, why does it work this time? i did change

fn findVrayPhysicalCameras selected:on =

to

fn findVrayPhysicalCameras selected:off =

before, but it didn’t work :drool:

If i want disable the control click, can i change the code like this:

try(destroydialog test) catch()

rollout test "test" width:200
(
	button change_bt "Change VRay Cameras" width:190 align:#left offset:[-8,0] \
		tooltip:"Change VRay selected cameras settints
   + Ctrl	- All"
	
	fn findVrayPhysicalCameras selected:off = 
	(
			nodes = if selected then selection else cameras
		for node in nodes where iskindof node VrayPhysicalCamera collect node
	)
	local preset1 = 
	#(
		#(#f_number, 8),
		#(#shutter_speed, 60),
		#(#ISO, 100),
		#(#vignetting, off),
		#(#whiteBalance_preset, 1)
	)
	on change_bt pressed do undo "Change Vray Physical Cameras" on
	(
		cams = findVrayPhysicalCameras selected:on
		if cams.count > 0 do
		(
			for p in preset1 do setproperty cams p[1] p[2]
		)
	)
)
createdialog test

sorry for so many question.

i don’t know what VrayPhysicalCamera is.
it looks like not a camera class…
well if you change:

	fn findVrayPhysicalCameras selected:off = 
	(
		nodes = if selected then selection else [B]objects[/B]
		for node in nodes where iskindof node VrayPhysicalCamera collect node
	)

it has to work for all objects
if you want to search only in selected nodes you can do it as

fn findSelectedVrayPhysicalCameras = 
(
         for node in selection where iskindof node VrayPhysicalCamera collect node
)
 
Fn findvrayphysicalcameras selected:off =(
Cams=#() 
If selected then (for i in selection where iskindof vrayphysicalcamera [B]do[/B] appendifunique cams i) 
 else (join cams (getclassinstances VrayPhysicalCamera)) 
Cams) 

Sorry bro could you test it again using the code above, am vacation and dont have max on my hand so i cant try it out. Thanks

Page 3 / 3