PDA

View Full Version : Why doesn't this work....


DaveWortley
06-30-2010, 04:12 PM
Simpliflied example....

fn thefunction m =
(
Replaceinstances m (VrayMtl())
m.texmap_opacity = checker

)

thefunction scenematerials[1]

Error:
thefunction()
-- Error occurred in thefunction()
-- Frame:
-- m: Standardmaterial:Standard
-- Unknown property: "texmap_opacity" in Standardmaterial:Standard
OK



I've replaced my standard material with a Vray material in the function but on the next line it thinks the material is still a Standardmaterial when infact it's a Vray mat.

Confused....

lo
06-30-2010, 06:38 PM
shouldn't it be replaceInstances (classof m) (Vraymtl()) ?

DaveWortley
06-30-2010, 09:16 PM
Nope, it's because m is changing classes whilst within the function, and later in the function it's still being called from the initial declaration....

lutteral
06-30-2010, 10:11 PM
"texmap_opacity" is not a property of a standard material, that's causing the error, seems to be a problem with the replaceinstances() function.
edit: sorry, I went too fast, I just got your question, Ill take a look

lutteral
06-30-2010, 10:34 PM
ok, I've found a workaround:
seems that m keeps the old value after the replaceinstances() function, even if the material passed has changed but the argument passed on replaceinstances is the variable you want to change.
I've tried this, and it works:


fn thefunction m =
(
vm = VrayMtl()
Replaceinstances m vm
vm.texmap_opacity = checker

)


my english is kinda crappy, sorry about that

cheers,

DaveWortley
07-01-2010, 09:08 AM
Thanks Lutteral, Seems like that's the best way to work it, meant I had to adjust the rest of my code accordingly but it has worked. :) Cheers

CGTalk Moderation
07-01-2010, 09:08 AM
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.