The example works for me, except your example should have a equals
sign to the right of alpha and it does not.
# Implement transparency
charPixelPtr = image.pixels()
for i in range( 0, size, 4 ):
alphaIndex = (i*4)+3
alpha = OpenMayaScript.getCharArrayItem(charPixelPtr,alphaIndex)
OpenMayaScript.setCharArray( alpha * (1.0 - self.fTransparency),
alphaIndex )
If you load the customImagePlane.py plugin using the Maya plugin
manager form the file in folder:
C:\Program Files (x86)\Autodesk\Maya2008\devkit\plug-ins\scripted
\customImagePlane.py
Then you can follow the comments in the script that says:
import maya
maya.cmds.loadPlugin("customImagePlane.py")
imageP = maya.cmds.createNode("spCustomImagePlane")
maya.cmds.connectAttr( imageP + ".message", "perspShape.imagePlane
[0]", force = True )
After that if you select the spCustomImagePlane node you can give it a
image which works.
maya.cmds.select(imageP)
Then just give the node a image path name for a image on your hard
drive.
Ryan
Character TD
www.rtrowbridge.com/blog
NaughtyDog Inc.
On Aug 25, 10:20 am, Praxis <[email protected]> wrote:
> I have a problem with the customImagePlane example in the maya docs.
> It seams not to work and I guessed that it is this part of the code
> which is wrong, but I can not solve it on my one.
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> charPixelPtr = image.pixels()
> for i in range( 0, size, 4):
> alphaIndex = (i*4)+3
> alpha scriptUtil.getUcharArrayItem(charPixelPrt, alphaIndex)
>
> #Here it comes:
> scriptUtil.setUcharArray( alpha*(1.0 – self.fTransparency),
> alphaIndex)
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> In the docs it said that this need to be a unsigned pointer, than the
> index and than a value.
> setUcharArray <cid:[email protected]>(unsigned
> char *var, unsigned int index, int value)
>
> In the maya example it is obvious wrong, or am I missing a point?
> Alpha seams to be a unsigned int, but not a pointer.
> It would be great if anybody could help me with this.
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---