Trees | Indices | Help |
---|
|
1 # 2 # shaderSurface - the class that defines a slum surface shader node in Maya. 3 # based on shaderBase and mayas hardware shader node. 4 # 5 # Copyright (C) 2008 - Roberto Hradec 6 # 7 # --------------------------------------------------------------------------- 8 # This file is part of SLUM. 9 # 10 # SLUM is free software: you can redistribute it and/or modify 11 # it under the terms of the GNU General Public License as published by 12 # the Free Software Foundation, either version 3 of the License, or 13 # (at your option) any later version. 14 # 15 # SLUM is distributed in the hope that it will be useful, 16 # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 # GNU General Public License for more details. 19 # 20 # You should have received a copy of the GNU General Public License 21 # along with SLUM. If not, see <http://www.gnu.org/licenses/>. 22 # --------------------------------------------------------------------------- 23 24 import maya.OpenMaya as OpenMaya 25 import maya.OpenMayaMPx as OpenMayaMPx 26 import maya.cmds as m 27 from maya.mel import eval as meval 28 import shaderBase 29 30 try: 31 #mayaBaseClass = OpenMayaMPx.MPxHardwareShader 32 mayaBaseClass = OpenMayaMPx.MPxHwShaderNode 33 except: 34 mayaBaseClass = OpenMayaMPx.MPxNode35 36 #class shaderSurface( mayaBaseClass ): 37 -class shaderSurface( mayaBaseClass, shaderBase.shaderBase ):8539 ##OpenMayaMPx.MPxNode.__init__(self) 40 mayaBaseClass.__init__(self) 41 shaderBase.shaderBase.__init__(self)42 43 @staticmethod45 return OpenMayaMPx.asMPxPtr( shaderSurface() )4654 - def geometry( self, MDrawRequest, M3dView, prim, writable, indexCount, indexArray, 55 vertexCount, vertexIDs, vertexArray, normalCount, normalArrays, 56 colorCount, colorArrays, texCoordCount, texCoordArrays ):5860 w=0 61 h=0 62 #print dir(image) 63 image.getSize( w, h ); 64 print '---->',w,h 65 ''' 66 swatch = OpenMaya.MImage(); 67 if swatch.readFromFile ( '/tmp/xx.tif' ): 68 swatch.resize (w, h, false); 69 image.setPixels(swatch.pixels(),w,h); 70 else: 71 swatch.create(w,h,3) 72 pixels = swatch.pixels() 73 count = 0 74 for y in range(h): 75 for x in range(w): 76 pixels[y*w+x] = count 77 count += 1 78 if count>255: 79 count=0 80 image.setPixels(swatch.pixels(),w,h); 81 82 dlimage.release(); 83 ''' 84 return True
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Oct 28 16:21:54 2010 | http://epydoc.sourceforge.net |