accessing parameters
I want to access the smooth parameter and assign it to a variable like this
$sdiv = 'getAttr "polySmoothFace1.divisions"'; however it tells me that the syntax is incorrect, I'm new to MEL and the '" are used not correctly, how can I assign "getAttr" to a variable? thanks. |
change the single quotes to backticks: change ' to ` and it will work.
Alan |
thanks a lot! works well.
now I want to replace the value like this: setAttr polySmoothFace1.divisions $sdiv + 1; tried it with quotes as well, doesn't work, any tips? |
$sdiv = `getAttr "polySmoothFace1.divisions"`;
$sdiv += 1; setAttr "polySmoothFace1.divisions" $sdiv; that'll do it Alan |
thanks a lot. how can I get the current selected smooth param?
let's say you have obj1 select and you execute the script then you select obj2 and now the script doesn't work because no obj name is assigned to it. I'm not really familiar yet with that object model of mel, any tips in that area how I can assign to the current selected object? thanks! |
$obj = `ls -sl`
that will return the currently selected object. If you want to assign differnt levels of smooth to objects I would consider adding an attribute to the object to represent smooth value and then have the object get that value so that rather than changing the polySmooth variable directly you edit the new attribute and then the polySmooth takes it's value from there. Alan |
thanks my goal is that you later can assign that script to a key, so by simply clicking the + key the amount of smoothness increases or with - decreases.
so I thought it might be the easiest to simply increase the level. $selobj = `ls -sl`; addAttr smoothlevel by having an attribiute how do I have to declare it for the smooth operator or would you use a differnt approach? thanks. |
in the manual it says polysmooth can be applied to faces or objects, how can I apply it simply to the object?
something like $obj = `ls -sl`; polySmooth -dv 2 plg2.f[0:5]; should be possible or setAttr "polySmoothFace1.divisions" $sdiv; without the Face1: setAttr "polySmooth.divisions" $sdiv; but doesn't work. any tips appreciated. |
another attempt doing the same for subdiv surfaces:
$sdiv = `getAttr "subdivDisplaySmoothness"`; $sdiv += 1; setAttr "subdivDisplaySmoothness" -s $sdiv; any idea how I can access the subDisplay smoothness and get the current value? |
change it and then look in the script editor to see what it's changed and then use what you've learned above to get those params.
Alan |
All times are GMT. The time now is 09:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018