Does anyone know how to go about using setPerParticleAttribute in pymel?
import pymel.core.datatypes as dt
points = [(0,0,0), (1,1,1), (2,2,2)]
colors = [dt.Vector(0,1,0), dt.Vector(0,0,1), dt.Vector(1,1,1)]
pShape = particle()
mel.eval('addAttr -ln "rgbPP" -dt vectorArray %s' % pShape[1].name())
mel.eval('addAttr -ln "rgbPP0" -dt vectorArray %s' % pShape[1].name())
emit(object=pShape[0].name(), pos=points)
pShape[1].setPerParticleAttribute('rgbPP', colors)
gives me the following error
# Error: (kInvalidParameter): Unknown type
# Traceback (most recent call last):
# File "<maya console>", line 16, in <module>
# File "<string>", line 2, in setPerParticleAttribute
# File "/data/app/cent5_x86_64/Pymel/0.9/pymel/core/factories.py", line
2577, in wrappedApiFunc
# getterResult = getter( *getterArgs )
# File "<string>", line 2, in getPerParticleAttribute
# File "/data/app/cent5_x86_64/Pymel/0.9/pymel/core/factories.py", line
2615, in wrappedApiFunc
# result = method( mfn, *newargs )
# RuntimeError: (kInvalidParameter): Unknown type #
any ideas?
On Wed, Jul 1, 2009 at 9:15 AM, Justin Rosen <[email protected]> wrote:
> Heyo!
>
> Yeah, still in Vancouver. Been here a year now. You?
>
> I don't think the particle command can set the color of every particle at
> once given a different color for each particle. I was hoping not to
> iterate over the entire system setting each particle individually, I'm
> handling 4+million particles.
>
> -- iPhoneJustin Rosen
>
> On Jul 1, 2009, at 8:26 AM, Dave Nunez <[email protected]> wrote:
>
> Hey dude, whats going on.. long time.
>
>
> you can set the pt colours using the particle command. check the docs.
>
> ie
>
> particle -e -or 2 -at rgbPP -vv 1 0 0 particleShape1 ;
>
> add your attrs first of course.
>
> hth, -d
>
> Are you still in Vancouver btw ?
>
>
> On Tue, Jun 30, 2009 at 9:20 PM, Justin Rosen < <[email protected]>
> [email protected]> wrote:
>
>> Hey everyone,
>>
>> I'm having a bit of trouble trying to create and modify the rgbPP of a
>> particle system. I've tried every way possible, but can't seem to get the
>> result I'm looking for.
>>
>> I have a list of positions and colors that I'd like to create a particle
>> object with. I'm having no trouble with the positions, it's the rgbPP that
>> seems to be a pain. Is it possible to do this via the emit command?
>>
>> points = [(0,0,0), (1,1,1), (2,2,2)]
>> colors = [(0,1,0), (0,0,1), (1,1,1)]
>> pShape = particle()
>> mel.eval('addAttr -ln "rgbPP" -dt vectorArray %s' % pShape[1].name())
>> mel.eval('addAttr -ln "rgbPP0" -dt vectorArray %s' % pShape[1].name())
>> emit(object=pShape[0].name(), pos=points, attribute=('rgbPP'),
>> vectorValue=colors)
>>
>> Also, I finally fell back onto mel for adding the rgbPP, I couldn't seem
>> to get the maya stuff working.
>>
>> I know that I could iterate over all of the particle and set their rgbPP,
>> but I'm trying to do it in 1 shot. Do I need to use the API to accomplish
>> this?
>>
>> Thanks,
>> Justin
>>
>>
>>
>
>
> --
> When things get too complicated, it sometimes makes sense to stop and
> wonder: Have I asked the right question?
> -Enrico Bombieri
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---