Is there any way to set the octree grid size/resolution for MMeshIntersector?
Finding closest points on too small objects seem to be problematic. (If its
smaller than 1 unit size)
Any ideas?
--
You received this message because you are subscribed to the Google Groups
"Python Programming for A
Sorry if this is late info but, the Maya hasAttr is meant to check for the
existence of attributes on an object. But these are not functions as
everything in Maya command API are string references and you use function
calls only to perform certain operations on string references
Python has a simil
Oh, weird,
I could have sworn i just tried that and it didn't work.. but it works,
thanks ;-)
On Tuesday, June 17, 2014 3:58:43 PM UTC-7, Kurian wrote:
>
> I replied already I think :)
>
> python built in hasattr will also work for you
>
> import maya.cmds as cmd
>
> import pymel.core as pm
I replied already I think :)
python built in hasattr will also work for you
import maya.cmds as cmd
import pymel.core as pm
list = cmd.ls(sl=True)
for obj in list:
obj = pm.PyNode(obj)
print hasattr(obj,'getShape')
https://docs.python.org/2/library/functions.html#hasattr
On Tue,
Oh, that's brilliant, thanks! Wasn't aware of 'try'.. so this seems to
work:
import maya.cmds as cmd
import pymel.core as pm
list = pm.ls(sl=1)
for obj in list:
obj = pm.PyNode(obj)
try:
print obj.getShape()
except:
pm.warning('no shape!')
If anyone knows why
Just a note hasattr is not a pymel function its a python built in method.
https://docs.python.org/2/library/functions.html#hasattr
On Tue, Jun 17, 2014 at 3:42 PM, Kurian O.S wrote:
>
>
> import maya.cmds as cmd
>
> import pymel.core as pm
>
> list = cmd.ls(sl=True)
>
> for obj in list:
>
>
import maya.cmds as cmd
import pymel.core as pm
list = cmd.ls(sl=True)
for obj in list:
obj = pm.PyNode(obj)
print hasattr(obj,'getShape')
On Tue, Jun 17, 2014 at 3:40 PM, Kurian O.S wrote:
> I didn't use pymel much, but I am not sure you can check a function with
> hasAttr. Maybe
I didn't use pymel much, but I am not sure you can check a function with
hasAttr. Maybe some one will have better idea, I would go for a
AttributeError check with try.
On Tue, Jun 17, 2014 at 3:35 PM, Brian Eyre
wrote:
> No, sorry. That returns an error if *obj* happens to have no getShape()
>
No, sorry. That returns an error if *obj* happens to have no getShape()
method, which is what i'm rying to check for...
On Tuesday, June 17, 2014 3:27:16 PM UTC-7, Kurian wrote:
>
> import maya.cmds as cmd
>
> import pymel.core as pm
>
> list = cmd.ls(sl=True)
>
> for obj in list:
>
> obj
import maya.cmds as cmd
import pymel.core as pm
list = cmd.ls(sl=True)
for obj in list:
obj = pm.PyNode(obj)
if obj.getShape():
print obj.getShape()
Are you looking for this ?
On Tue, Jun 17, 2014 at 3:24 PM, Brian Eyre
wrote:
> It's actually a function that returns the s
It's actually a function that returns the shape node, yes. Do I need a
different syntax for that? obj.getShape() definitely works, which is why
i'm puzzled.
On Tuesday, June 17, 2014 3:20:19 PM UTC-7, Kurian wrote:
>
> hasAttr will check only for existing attribute.
>
> import maya.cmds as c
http://download.autodesk.com/us/maya/2011help/PyMel/generated/functions/pymel.core.general/pymel.core.general.hasAttr.html
On Tue, Jun 17, 2014 at 3:19 PM, Kurian O.S wrote:
> hasAttr will check only for existing attribute.
>
> import maya.cmds as cmd
>
> import pymel.core as pm
>
> list = cm
hasAttr will check only for existing attribute.
import maya.cmds as cmd
import pymel.core as pm
list = cmd.ls(sl=True)
for obj in list:
obj = pm.PyNode(obj)
print pm.hasAttr(obj,'tx')
This will work and what is getShape ?, is it a function ? or is it
attribute which is existed in s
Hi,
I'm trying to add a line that error checks for whether the getShape()
method exists for selected objects, by using *hasAttr*, but it keeps
returning *false* even when getShape() exists for the obj:
import maya.cmds as cmd
import pymel.core as pm
list = cmd.ls(sl=True)
for obj in list:
14 matches
Mail list logo