dirtyharry
09-20-2012, 10:14 AM
i would like to write a script to import all textures from a folder onto card with alpha
like the imageplane coffee-script (dont know the author) which works, but only for a single image.
so i have a python-code snippet which asks for the folder and creates materials and more,
but im not a programmer and so not able to finish it and make it work.
heres what i got so far:
import c4d
from c4d import gui
import os
def main():
path=c4d.storage.LoadDialog(c4d.FILESELECTTYPE_ANYTHING, "Please choose a folder", c4d.FILESELECT_DIRECTORY)
dirList=os.listdir(path)
for fname in dirList:
print fname
c4d.CallCommand(600000042) # Material
mat = doc.GetFirstMaterial()
if mat is None: return False
#mat()[c4d.MATERIAL_USE_ALPHA]=True
#mat()[c4d.MATERIAL_USE_SPECULAR]=False
mat[c4d.ID_BASELIST_NAME]= fname
shd = c4d.BaseList2D(c4d.Xbitmap)
shd[c4d.BITMAPSHADER_FILENAME] = fname
myPlane = c4d.BaseObject(c4d.Oplane)
doc.InsertObject(myPlane)
mat[c4d.MATERIAL_COLOR_SHADER] = shd
mat.InsertShader(shd)
mat[c4d.MATERIAL_ALPHA_SHADER] = shd
mat.InsertShader(shd)
mat[c4d.MATERIAL_USE_ALPHA]=True
mat[c4d.MATERIAL_USE_SPECULAR]=False
#mat.Update(True, True)
#mat.Message(c4d.MSG_UPDATE)
if __name__=='__main__':
main()
the wish-list for this is:
choose a folder
import texture from folder into color and alphachannel
apply to standing plane with height/width same as bitmap in pixels
put pivot on lower end of plane
so please when someone has an idea how to do that would be great....
thanks and
greets dharry
like the imageplane coffee-script (dont know the author) which works, but only for a single image.
so i have a python-code snippet which asks for the folder and creates materials and more,
but im not a programmer and so not able to finish it and make it work.
heres what i got so far:
import c4d
from c4d import gui
import os
def main():
path=c4d.storage.LoadDialog(c4d.FILESELECTTYPE_ANYTHING, "Please choose a folder", c4d.FILESELECT_DIRECTORY)
dirList=os.listdir(path)
for fname in dirList:
print fname
c4d.CallCommand(600000042) # Material
mat = doc.GetFirstMaterial()
if mat is None: return False
#mat()[c4d.MATERIAL_USE_ALPHA]=True
#mat()[c4d.MATERIAL_USE_SPECULAR]=False
mat[c4d.ID_BASELIST_NAME]= fname
shd = c4d.BaseList2D(c4d.Xbitmap)
shd[c4d.BITMAPSHADER_FILENAME] = fname
myPlane = c4d.BaseObject(c4d.Oplane)
doc.InsertObject(myPlane)
mat[c4d.MATERIAL_COLOR_SHADER] = shd
mat.InsertShader(shd)
mat[c4d.MATERIAL_ALPHA_SHADER] = shd
mat.InsertShader(shd)
mat[c4d.MATERIAL_USE_ALPHA]=True
mat[c4d.MATERIAL_USE_SPECULAR]=False
#mat.Update(True, True)
#mat.Message(c4d.MSG_UPDATE)
if __name__=='__main__':
main()
the wish-list for this is:
choose a folder
import texture from folder into color and alphachannel
apply to standing plane with height/width same as bitmap in pixels
put pivot on lower end of plane
so please when someone has an idea how to do that would be great....
thanks and
greets dharry
