On 26/03/2014 at 00:16, xxxxxxxx wrote:
import c4d
import os
def main() :
fn = c4d.storage.GeGetC4DPath(c4d.C4D_PATH_DESKTOP) #Gets the desktop path
pathToTexture = os.path.join(fn,'Feet.jpg') #Gets the specific texture image on your desktop
mat = doc.GetActiveMaterial() #Assign the active material a variable
shdr_texture = c4d.BaseList2D(c4d.Xbitmap) #Create a bitmap shader in memory
shdr_texture[c4d.BITMAPSHADER_FILENAME] = pathToTexture #Assign the path to the texture image to your shader
mat[c4d.MATERIAL_COLOR_SHADER]= shdr_texture #Assign the shader to the color channel in memory only
mat.InsertShader(shdr_texture) #Insert the shader into the color channel
mat.Update(True, True) #Re-calculate the thumbnails of the material
if __name__=='__main__':
main()
I'm trying to import jpg and above code throw error as per below:
Traceback (most recent call last) :
** File "'scriptmanager'", line 17, in <module>**
** File "'scriptmanager'", line 12, in main**
TypeError: 'NoneType' object does not support item assignment
Please help.