On 03/09/2016 at 02:07, xxxxxxxx wrote:
Cinema 4D Version: 17
Platform: Mac OSX ;
Language(s) : PYTHON ;
I have started to learn Python for c4d a year ago , the python documentation helped me a lot , also the script log ,but some times I see some thing I want to use but can't understand how to use it .
for example , I insert a tag to the object (pose morph tag ) and change some settings , then I have found the character module /CaMorph , but I couldn't find how to use it , how does it work ...etc
is there a website where I can find something about this topic (the different modules )?
is it possible to add objects as pose target with python or it is impossible ?
thanks for help , (and sorry if the explanation is not clear enough )
best regards ,
On 03/09/2016 at 07:34, xxxxxxxx wrote:
The things in the SDKs are someone's idea on how to do something. Not yours.
So you need to be a detective to figure out what that person was thinking.
The most helpful thing you can study to get the most out of the SDKs is to learn about how classes, methods, and inheritance trees work.
A plugin developer needs to be able to look up the class of something in the docs. And then follow the bread crumbs to where all the other needed pieces are that make it work. Which could be scattered throughout the entire SDK.
Because people think differently. It can be very difficult to figure out. It takes a lot of practice.
And sometimes the information is just missing from the docs entirely.
The more SDKs you use. The better you will get at understanding and using them.
But that does not help the new user.
So typically the only thing you can do is ask someone with more experience for a little code to help you get started. And then once you have some code. What's in the docs will often make more sense to you. And will be easier to follow.
Here is some code to get you started
#This is an example of adding a morph to the poseMorph tag
#Note: The mixing mode option is not changeable prior to R16
def main() :
obj = doc.GetActiveObject()
if not obj: return False
#Get the PM tag and then get the first morph inside of it
pmTag = obj.GetTag(c4d.Tposemorph)
pmTag[c4d.ID_CA_POSE_MODE]=False #Enables Edit mode
baseMorph = pmTag.GetMorphBase()
#Adds a new morph entry
newMorph = pmTag.AddMorph()
#You can also get a morph by it's index#
firstMorph = pmTag.GetMorph(1)
pmTag[c4d.ID_CA_POSE_MIXING]= 0 #Sets Absolute mode
pmTag[c4d.ID_CA_POSE_MODE]=True #Enables Animate mode
#The first morph is always #1101..Then 1201..1301..etc...
On 03/09/2016 at 10:48, xxxxxxxx wrote:
thank you very much for the help
"The things in the SDKs are someone's idea on how to do something. Not yours."
actually I wanted to learn the functions , methods ...etc from the SDK , but now I have to learn classes and modules .
I checked your code and learned a lot of things and how things work .
"could be scattered throughout the entire SDK" , lol , the more I use the doc , the more I found myself going back and forth through windows , but the more I dive into this m the more I like python .
On 03/09/2016 at 12:17, xxxxxxxx wrote:
Yeah. Unfortunately you can't really learn how to use an SDK by reading the SDK.
You mostly learn how to use an SDK by looking at example code that uses that SDK. Then slowly get used to seeing the patterns they use over time.
MAXON is adding lots of examples to the docs. So it will be less painful to newbies.
But there will always be something missing that you'll need to track down yourself. Or ask others for help.
After you learn a few SDKs. You will develop a skill for it. And it gets easier.
But it's always a challenge to learn a new SDK. Especially if there are not many examples.
On 05/09/2016 at 08:52, xxxxxxxx wrote:
Just a small general side note from the SDK Team:
Not every object or tag (or other entities in C4D) needs/has its own class. For example with a Cube object you can interact completely fine just using the generic functions provided by BaseObject.
We are in the process of documenting the relationships of classes, also adding "how to work with stuff" manuals in the C++ documentation. End goal of course is to extend this for Python as well, but we need to start somewhere. But if you are not afraid of C++ and can abstract the language specifics a bit, I think these pages can already be helpful for Python developers as well. So maybe you want to take a look at for example the Basic Knowledge section.
On 05/09/2016 at 23:21, xxxxxxxx wrote:
thanks for reply ,
this will be very helpful, I will take a look