For datatypes.Vector

The following codes work well in 0.7 but fail or turn out to not
expected result:

if vec.normal() < 0.04045:
    return vec / 12.92
else:
    return pow((vec+0.055)/1.055, 2.4)

According to vector class in maya.OpenMaya, I admit to change it to

(vec+[0.55, 0.55, 0.55])/1.055

but it still fails the "power".

It seems not to be a bug but it will be great to have this flexibility
to make __add__(), __sub__() and even __pow__() work as an object-
friendly way.

- Drake

On Mar 4, 7:03 pm, Drake <drake.g...@gmail.com> wrote:
> It seems I am too late to see this following discussion.
>
> I also did the same test on Maya 8.5sp1 x86 and it turned out the same
> error message.
>
> As Chadrik mentioned it is a maya.OpenMaya bug, I am wondering how
> many functions/methods influenced by this bug in Maya 8.5sp1? Because
> that might be a big concern for me to decide upgrading pymel from 0.7
> to 0.9 or not. We are in rush hour such that I decided to delay
> upgrading.
>
> - Drake
>
> On Mar 4, 4:18 am, Ian Jones <shrt...@gmail.com> wrote:
>
> > Nevermind - missed the replace on the setLocked(True) in your example.
> > So only the first code snippett failed.
>
> > Again this worked:
>
> > from pymel import *
> > s = polySphere()[0]
> > s.tx.__apimplug__().setLocked(True)
> > attrs = s.listAttr(locked=True)
> > for attr in attrs:
> >         attr.__apimplug__().setLocked(False)
>
> > On Mar 3, 12:16 pm, Ian Jones <shrt...@gmail.com> wrote:
>
> > > Sorry for the incomplete example.
>
> > > However both code snippets you gave me raise the same error (output
> > > below). I noticed this did not throw an error in 2009 - so I would
> > > expect it to be 8.5 SP1 bug.
>
> > > Ian
>
> > > from pymel import *
> > > s = polySphere()[0]
> > > s.tx.setLocked(True)
> > > attrs = s.listAttr(locked=True)
> > > for attr in attrs:
> > >         attr.setLocked(False)
> > > # Error: argument number 1: Unmatched paren in format
> > > # Traceback (most recent call last):
> > > #   File "<maya console>", line 3, in ?
> > > #   File "<string>", line 2, in setLocked
> > > #   File "D:\Toolkit\trunk\sww\plat-indep\maya\all\scripts\pymel\core
> > > \factories.py", line 2615, in wrappedApiFunc
> > > #     result = method( mfn, *newargs )
> > > #   File "C:\engserv\rbuild\164\build\wrk\optim\runTime\Python\Lib
> > > \site-packages\maya\OpenMaya.py", line 7921, in setLocked
> > > # SystemError: argument number 1: Unmatched paren in format #
>
> > > s = polySphere()[0]
> > > s.tx.setLocked(True)
> > > attrs = s.listAttr(locked=True)
> > > for attr in attrs:
> > >         attr.__apimplug__().setLocked(False)
> > > # Error: argument number 1: Unmatched paren in format
> > > # Traceback (most recent call last):
> > > #   File "<maya console>", line 2, in ?
> > > #   File "<string>", line 2, in setLocked
> > > #   File "D:\Toolkit\trunk\sww\plat-indep\maya\all\scripts\pymel\core
> > > \factories.py", line 2615, in wrappedApiFunc
> > > #     result = method( mfn, *newargs )
> > > #   File "C:\engserv\rbuild\164\build\wrk\optim\runTime\Python\Lib
> > > \site-packages\maya\OpenMaya.py", line 7921, in setLocked
> > > # SystemError: argument number 1: Unmatched paren in format #
>
> > > On Mar 3, 10:40 am, chadrik <chad...@gmail.com> wrote:
>
> > > > Hey Ian,
>
> > > > > Found one issue with RC4 (8.5SP1 x86):
>
> > > > > from pymel import *
>
> > > > > dup = PyNode('my_skinned_mesh')
> > > > > attrs = dup.listAttr(locked=True)
> > > > > for attr in attrs:
> > > > >    attr.setLocked(False)
>
> > > > > results in:
>
> > > > > # Error: argument number 1: Unmatched paren in format
> > > > > # Traceback (most recent call last):
> > > > > #   File "<maya console>", line 3, in ?
> > > > > #   File "<string>", line 2, in setLocked
> > > > > #   File "C:/Documents and Settings/ijones/My Documents/maya/8.5/
> > > > > scripts/pymel\core\factories.py", line 2615, in wrappedApiFunc
> > > > > #   File "C:\engserv\rbuild\164\build\wrk\optim\runTime\Python\Lib
> > > > > \site-packages\maya\OpenMaya.py", line 7921, in setLocked
> > > > > # SystemError: argument number 1: Unmatched paren in format #
>
> > > > can you provide a full script that reproduces the problem?
>
> > > > i ran this on 2008ext2 without problems, can you test it on your  
> > > > machine?:
>
> > > > s = polySphere()[0]
> > > > s.tx.setLocked(True)
> > > > attrs = s.listAttr(locked=True)
> > > > for attr in attrs:
> > > >         attr.setLocked(False)
>
> > > > it's possible that the bug is in maya.OpenMaya.  to test this you can  
> > > > modify your code like so:
>
> > > > attrs = dup.listAttr(locked=True)
> > > > for attr in attrs:
> > > >         attr.__apimplug__().setLocked(False)
>
> > > > that will get you the api mplug for the attribute, with no pymel  
> > > > wrapper around it.
>
> > > > > and since you asked:
>
> > > > > The new treatment of non-existent objects took me a bit of time to get
> > > > > used to/port my code. No big deal, and I don't mind the new behavior
> > > > > at all - it makes sense to me. The bigger problem is that I have to
> > > > > have all the tools ported and somewhat tested before I can release the
> > > > > new version of pymel/tools to the studio. I would have much rather had
> > > > > the feature be depreciated for one release to allow me more time to
> > > > > transition smoothly. Luckily we have a nice break now to do it
> > > > > otherwise I would probably would have waited till summer to do so.
>
> > > > i'll look into the possibility of allowing greater backward  
> > > > compatibility in this regard as frustrating early adopters is a big  
> > > > concern to me.  in this version we've introduced a configuration file  
> > > > for customizing pymel, so we might be able to have a "0.7  
> > > > compatibility mode".  i would leave it off by default, but describe it  
> > > > in the docs while also underscoring that it may be removed in future  
> > > > versions.
>
> > > > thanks for the feedback, it's very much appreciated.
>
> > > > -chad
>
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to