View Full Version : c4d python help doc
stretched 09-19-2010, 09:05 PM python help doc for c4d is a disaster. :banghead: :banghead: :banghead: :banghead: :banghead: :banghead: :banghead: :banghead: :banghead:
even for simplest code there is an example.
http://download.autodesk.com/us/maya/2011help/CommandsPython/polySphere.html
well, in our document people spending hours to add a sphere.
|
|
Per-Anders
09-19-2010, 09:21 PM
The documentation covers what's available in the API along with examples. But just like the maya documentation it doesn't help you if you don't know what it is you're searching for or how the application works.
If you want to make objects then look up BaseObject. The example at the top misses out one important step which is to add the bject into the document, completed by simply calling doc.InsertObject(myobject)
If you need help with the API then I suggest the best place is the Plugincafe forums.
rui_mac
09-19-2010, 11:23 PM
Most code resources are made for geek-type minds.
Instead of providing a pleasant text, they show up a sequence of cryptic, cold, engineer-like sequences of information that leave most people in a worse state than they were before reading them.
Even I, being someone that knows programming, become baffled with some information I read in some SDK. Sometimes, after reading the same thing over and over again, I have to start doing trial-error experiments to reach some conclusions.
Rui Batista
ernia
09-20-2010, 01:42 AM
It seems that if one doesn't know any other programming language, the SDK is not enough to start scripting in C4D. It is merely a dictionary--a syntax hash table. It only answers WHAT. It doesn't answer WHERE, WHEN, WHY, HOW, or IF. It won't tell one HOW to DO anything, aside from scant example code. Ironically, non-programmers consulting the SDK to dive in and start simple scripting begin by possibly asking these very simple questions: how do I open this; where do I type this; when do I use a that period thing; if I type it exactly as I see it in the SDK, why is it not working, etc. The Plugin Cafe shouldn't be burdened with these questions, so why not include these answers in the SDK documentation? The COFFEE docs were a good start but still didn't answer basic questions.
I can see that the SDK isn't meant to teach someone to program, just as dictionary isn't meant to teach someone how to express themselves. But, scripting for beginners could be made soooooo much better if that "dictionary" could be fleshed out a bit more with context and examples of usage. Throw in a few HOWs and WHYs. Sprinkle in a few WHEREs and WHENs.
I'm learning that you guys that code all this stuff really operate in unforgiving and exacting work, and I see it as a Herculean effort of the mind to make all this complicated stuff available to all users. You really shouldn't be expected to bridge the gap between those who know and those who don't know how to use your software. It's probably too much to ask of most developers. Therefore, I think what is needed here is for someone, some ubermensch, to bridge this gap between the hardcore code and the beginning idiot programmer.
As a beginning idiot programmer, I eagerly and desperately await this messiah.
Even though it's very frustrating for me to learn scripting in C4D, I do appreciate the hard work all you Maxon programmers and SDK coders have put in to making these amazing tools available to all of us.
Arik
Per-Anders
09-20-2010, 02:02 AM
Well it's certainly an area that can be improved, and I'm sure it will be over time. Right now Python support has only just been added in. With COFFEE there were quickstarts including tutorials on how to do yoru first few basic programs, using the interface and so on, and Python will eventually get the same things. For the language itself on the first page of the Python docs there are some links to sites that deal with learning Python. But learning the API is another thing, you can learn from the docs related to COFFEE and the C++ API which may help as the basic structure and classes are the same, but your best resource I always found was to simply search the PluginCafe forum.
In the meanwhile if anyone wishes to do so I offer up The Third Party Wiki (http://www.peranders.com/w/Main_Page)for (ab)use as a notepad for their experiments with learning the Cinema 4D Python API and the Python Language. When I have time I'll probably add a few pages for Python beginners along with the existing COFFEE for beginners content there myself. It would be nice to collate information somewhere for budding developers where everyone has access to adjust and improve content for each other.
MrBraun
09-20-2010, 06:50 AM
This code to add a spere! ;)
Hope that this help you! :)
Import c4d
from c4d import documents
def main():
# (sphere with Radius=100cm, Segments=10)
doc = documents.GetActiveDocument()
mySphere = c4d.BaseObject(c4d.Osphere)
mySphere[c4d.PRIM_SPHERE_RAD] = 100
mySphere[c4d.PRIM_SPHERE_SUB] = 10
doc.InsertObject(mySphere)
mySphere.SetName("Sfera")
ernia
09-20-2010, 01:07 PM
In the meanwhile if anyone wishes to do so I offer up The Third Party Wiki (http://www.peranders.com/w/Main_Page)for (ab)use as a notepad for their experiments with learning the Cinema 4D Python API and the Python Language.
Outstanding, Per. Someplace where complicated scripting concepts can be simplified for the beginner to understand. A beginner's Wiki for the C4D/Python API? I like that idea. Where do I sign?
Per-Anders
09-20-2010, 06:47 PM
All you have to do is sign up and log in (top right of the page on the wiki). Then it's free to edit as you wish. I have installed a few features to try and deter vandalization so you will have to enter captchas while posting/editing but apart from that it's like any other wiki. Just make/edit pages however you need.
ernia
09-20-2010, 07:37 PM
Is the Wiki a different login as the Third Party forums?
Per-Anders
09-20-2010, 09:10 PM
Yes, unfortunately I've had to keep them separate due to spammers in the past, so you will need to make a new login for the wiki. I will be looking again down the road at integrating the two, there are a few plugins available to do this, unfortunately they don't yet respect the user status (i.e. if they're banned or not), which makes controlling spammers/vandals a bit of a problem with them right now.
rui_mac
09-21-2010, 12:18 PM
I'm trying to register Per, but its giving me an SQL error :-(
Rui Batista
ernia
09-21-2010, 12:54 PM
Same error here.
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
(SQL query hidden)
from within function "SpoofUser::getConflicts". MySQL returned error "1146: Table 'perander_wikidb.mw_spoofuser' doesn't exist (localhost)"
Per-Anders
09-21-2010, 09:56 PM
Ah, seems I missed a step in one of the extensions, just working on it, once I've done try again...
Should be all sorted now, give it another try
rui_mac
09-21-2010, 09:59 PM
I tried to create a new account again and I got the error:
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
(SQL query hidden)
from within function "SpoofUser::getConflicts". MySQL returned error "1146: Table 'perander_wikidb.mw_spoofuser' doesn't exist (localhost)".
Rui Batista
Per-Anders
09-21-2010, 10:13 PM
You will have to try again Rui, it takes it a moment to update the database structure, I was able to make a new account without difficulty, the table mentioned does exist.
ernia
09-21-2010, 11:20 PM
It's working, Per.
I've started things of by starting a "What is a container" page. Hopefully those who know will share.
Thanks for making this available, Per.
Per-Anders
09-22-2010, 07:08 PM
No problem, hopefully people will start to use it and make their own amendments and changes as they explore Python.
ernia
09-23-2010, 02:21 PM
Per, is it ok to use parts of the copyrighted Maxon Python docs in TheThirdParty Wiki?
Per-Anders
09-23-2010, 07:56 PM
Most probably not, in the past they haven't allowed others to host their documentation, but you would have to ask MAXON themselves.
Per-Anders
10-06-2010, 10:00 AM
Well I've asked and got permission. So feel free to add them in to the Wiki!
ernia
10-07-2010, 12:47 AM
Hey that's great, Per. I think it will help make things clearer.
I'm just learning this stuff, so if I post something on the Wiki that isn't right I hope you'll step in and correct it before too long.
Perhaps the OP could pop in and post what he's learned, too ;)
abdelouahabb
10-07-2010, 09:08 AM
hi
i dont know if this will hep, but i think watching videos will HELP ;)
but sadly it's not about how to use it with cinema 4d but how to use python in general
this for english users
http://www.youtube.com/watch?v=YW8jtSOTRAU&p=EA1FEF17E1E5C0DA&playnext=1
and that one for french ones
http://www.youtube.com/watch?v=swGl-iPmYic
happy watching and coding ;)
Per-Anders
10-08-2010, 06:53 AM
OK, I have uploaded them, you can now make links to the docs directly on the site, the URL link is on the first page of the Python Wiki entry, and directly here (http://www.thirdpartyplugins.com/python/).
dr-sassi
10-28-2010, 10:41 PM
Hi Per,
Thanks a lot. Very useful.
Have a great Day
Sassi
CGTalk Moderation
10-28-2010, 10:41 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.