Notifications
Clear all

[Closed] Display texture in viewport can't rightly run

Hi!
I need help! The script can’t rightly run ,How to can let it rightly run!

Thanks!

fn showMatInViewport mat =
(
if (mat != undefined) do
(

mat.showinviewport = true

if classof mat == Standardmaterial then
(

if (mat.diffusemap != undefined) then showTextureMap mat mat.diffusemap on
)

else if classof mat == Vraymtl then
(

if (mat.texmap_diffuse != undefined) then showTextureMap mat mat.texmap_diffuse on
)
if classof mat == VRayMtlWrapper then
(
if (mat.BaseMtl.texmap_diffuse != undefined) then showTextureMap mat mat.BaseMtl.texmap_diffuse on
)
)
)–end function


(
numsubs = 0

num_matls = sceneMaterials.count

for m = 1 to num_matls do
(
mat11 = sceneMaterials[m]

if (is_multi(mat11)) then
(

for i = 1 to mat11.numsubs do
(
progressEnd();
)
showMatInViewport mat11[i]
)
) else (

show_diffuse_map ma11 on
)

progressUpdate( 100.0 * m / num_matls )
)

2 Replies

I am useing vray! urgently needed help

Thanks once more !

We all need urgent help…trust me

Firstly, an introduction to your script would be nice, so I have some idea of what I’m looking at…it’s like meeting a nice girl friend of your friend, you need an introduction to get started…or at least I do…

Also, some idea of the problem…other then broken script…I don’t have much time to commit to the forums (which I regret) so the quicker I can be directed to the issue, the quicker I can try and help…

Secondly (and I admit not knowing this when I first posted), try and put your code into a code block (the # symbol on the tool bar), makes reading it SOOO much easier…

Now I’ve been nasty, lets see if I can help…you need to count your brackets…


 ( -- 1
   numsubs = 0
   
   num_matls = sceneMaterials.count
   
   for m = 1 to num_matls do
   ( -- 2
 
 	mat11 = sceneMaterials[m]
 	if (is_multi(mat11)) then 
 	( -- 3
   
 		for i = 1 to mat11.numsubs do 
 		( -- 4
 
 		  progressEnd();
 
 		) -- 4
 
 		showMatInViewport mat11[i] 
  	) -- 3
 
 	)  -- 2
 	else 
 	( -- 2
 
 	  show_diffuse_map ma11 on
 
 	 ) --2
   
 	 progressUpdate( 100.0 * m / num_matls )
 
 ) --1
 

Now, I don’t know about you, but there is a serious issue right there…lets cut out some of the crap…

  for m = 1 to num_matls do
    ( -- 2
  
  	mat11 = sceneMaterials[m]
  	if (is_multi(mat11)) then 
  	( -- 3
 
  	  -- Removed code...
 
  	) -- 3
  	-- These two are wrong...remove one of them and the if statement will compile correctly...
  	)  -- 2 
  	else 
  	( -- 2
  
  	  show_diffuse_map ma11 on
  
  	 ) --2

I couldn’t run the code fully as the “is_multi” function is missing…

Shane