timmwagener Posted October 19, 2013 Share Posted October 19, 2013 Hi guys, i'm new to the forum and Houdini, and i'm currently diving into Mantra (once again ). And what i would like to achieve is basically a global material override.(For AmbOcc for example) What i tried so far: 1: Adding a shop_materialpath attr. to the subnetwork that is the toplevel node of my structure and overriding it on a take. (Much like Vray Object Property Sets in Maya for example, whose attributes ripple down on all members of the sets).....but that doesnt work i guess 2: Override the shop_materialpath on each geometry node which works fine and is much less a hustle than it sounds at first. But it still needs tweaking, once i add a new object to the scene. 3:PythonFiltering: Which seems like the way to go for me! From what ive read so far, the Houdini scene translation is written in Python and properties like shader assignments can be altered during the process. So i read the documentation and did the following: -Changed the mantra commandline to: mantra -P pythToMyScript/script.py -In wrote the following script: def filterInstance():print('Filtering: {0}'.format(mantra.property('object:name')))mantra.setproperty('object:surface', '/obj/shop_net/constant_green_mt')mantra.setproperty('object:overridedetail', 1)print('Im just an a output to confirm i have been called!')[/CODE]-The script is actually called and i get the correct output in the console like so:[CODE]Filtering: ['/obj/enzo_geo_grp/glassRubberGrp/black_behind_window_thing3']Im just an a output to confirm i have been called![/CODE]-But the last line states an error:[CODE]mantra: VEX error: Unable to load file /obj/shop_net/constant_green_mt.vexRendering Finished[/CODE]-I added the declare_all_shops parameter to the mantra rop and set it to "Declare all shops" , also i checked on Force VEX Shader embedding-Both materials are just ordinary constant mtls. i dragged into my own SHOP network in /obj/shop_net/.Any ideas on what i am doing wrong here? Thx Quote Link to comment Share on other sites More sharing options...
dennis.albus Posted October 21, 2013 Share Posted October 21, 2013 (edited) Hi Timm, how are you doing? Great to see you finally working with Mantra:) After tinkering around a bit I came up with this: import mantramatDict = {}def filterMaterial(): name = mantra.property('object:name')[0] properties = mantra.property('object:surface')[0] matDict[name] = propertiesdef filterInstance(): print('Filtering: {0}'.format(mantra.property('object:name'))) mantra.setproperty('object:surface', matDict['/obj/shopnet/clay'].split()) print(mantra.property('object:surface'))[/CODE]Tschoebi Edited October 21, 2013 by dennis.weil Quote Link to comment Share on other sites More sharing options...
timmwagener Posted October 23, 2013 Author Share Posted October 23, 2013 Hey Dennis Of course, i'm looking at Mantra and Houdini in general. I quickly tried your example and it was throwing a key error. Might be something i'm doing wrong. I currently use the joy of Houdini and Mantra as a relaxation, next to learning CPP, but i'm looking forward to diving deeper into that. Hope everything is "tutti" with u dudes (and Mrs.Lotte) in Wiesbaden Take care! Quote Link to comment Share on other sites More sharing options...
dennis.albus Posted October 23, 2013 Share Posted October 23, 2013 Maybe you didn't change matDict['/obj/shopnet/clay'] to matDict['/obj/shop_net/constant_green_mt'] ? If possible send me your example file so I can have a look at it. Quote Link to comment Share on other sites More sharing options...
timmwagener Posted October 23, 2013 Author Share Posted October 23, 2013 So, i just tinkered with it again, and now it works...(......it riali woerks!! ) Problem just was that i hadnt saved the scene with the "declare_all_shops" parameter installed on the mantra node! Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.