THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/12/2011 at 02:00, xxxxxxxx wrote:
Hi there,
I am new to scripting in C4D but I am fluent in Python. So I thought Python is probably the way to go.
However, it appears to me that the SDK API is underexposed in Python, compared to COFFEE, at least looking at the documentation API : Is there anybody to confirm or to invalidate that ?
Exemple.
I have to create a bunch of plane objects, and of each of them, a new material (with color and alpha channel).
At first this simple script fails (error is raised) :
import c4d
from c4d import *
def main() :
mat = BaseMaterial(Mmaterial)
mat.setChannelState(CHANNEL_ALPHA, True)
if __name__=='__main__':
main()
AttributeError: 'c4d.BaseMaterial' object has no attribute 'setChannelState'. Which is quite expected since the setChannelState method is declared only for subclass Material derived from BaseMaterial, but guess what, when I use Material it says that the Material symbol is not defined (despite the "from c4d import *").
What's wrong ? I simply need to crearte a new material and apply it to a freshly created plane object.
Secondly, is there any Python code snippets or samples web site where one can learn by examples ?
I find the COFFEE API better documented that the Python one.
Thank you for your help,
Elie