PDA

View Full Version : COFFEE: Layer (Manager) Creation/Manipulation and asigning objects?


mogh
03-15-2010, 07:36 PM
COFFEE: Layer (Manager) Creation/Manipulation and asigning objects?

I found few things about this in the sdk but no single script (google) that covers this topic which I could pic appart.

LayerObject
LayerData
LayerObject* GetLayerObject(BaseDocument* doc)
Bool SetLayerObject(LayerObject* layer)
const LayerData* GetLayerData(BaseDocument* doc, Bool rawdata = FALSE)
Bool SetLayerData(BaseDocument* doc, const LayerData& data)

This gives me a general idea but how to use it is beyond me, as allways I can't get any info from that to make my simple script working.
I just want to make a new layer name it give it a color disayble visibillity (and perhaps rendering and so on) and asign a bunch of objects I itterate to it.

OT: Please Maxon Make an official WIKI for coding so all the people can learn from a constant source and participate.

any help for the creative mind?
thanks in advance.
mogh

indeep
03-15-2010, 10:27 PM
interesting

Scott Ayers
03-15-2010, 11:11 PM
What you've got there is for C++. 99% of the SDK is written for C++ developers.
What Maxon expects you to do is either learn how to use C++ well enough be able to to figure out how to decipher the C++ entries in the SDK into something that can sometimes be used in coffee.
Or if you can't do that. Use xpresso instead of coffee.

Coffee documentation from Maxon is basically non-existent. Because most people are happy using xpresso now.
The only "reference" for coffee is my Coffee Bible in the scripts section. Which still doesn't cover a lot of coffee functions. But nobody else seems to want to help me expand it. So I gave up on it.

There isn't a lot of support for handling layers with coffee right now. But the script log will echo some of the things you're trying to do.
If you don't know how to use the scripting console and the script log. Download the Coffee Bible from the scripts section. It has a walk through on how to get started with scripting and using them.

-ScottA

mogh
03-16-2010, 05:06 PM
@Scott Ayers

I have your bible (have to check if ts the latest) but somehow that object oriented coding is backwards in my brain still I try to get it every half year or so ;-)

I feel you i was participation quite abit in the german wiki from jack but somehow the overall base support is missing thats why maxon needs to moderate an official source on their side, I still believe the content will come from users.

anyhow we are drifting away from the topic ...
greetings

tcastudios
03-16-2010, 05:42 PM
Coffee documentation from Maxon is basically non-existent.

To be fair, there is the COFFEE SDK 9.5 that is -very- good.
It takes you thru all the basics using COFFEE plus syntax examples
for most important stuff (even in layman terms, "Walk the Dog",
"The world of Matrices", etc )

http://www.maxon.net/en/support.html -> Older SDK Downloads -> COFFEE SDK 9.5

Cheers
Lennart

Scott Ayers
03-16-2010, 07:14 PM
I'm very new at coding. I've only been doing it a couple of months now. So I think I'm a pretty good barometer for what other newbs are struggling with.
Here's what my experience with learning to code in any language has taught me:
-The first hurdle is learning how the big picture works. And how the code structure and syntax needs to be written.

-The second big hurdle is having each and every function of the language properly documented. In a manner that uses small examples of the function in use.

- The rest is just a matter of practicing those two things.

When it comes to the first hurdle of learning the big picture. And how coffee works in the big scheme of things. The 9.5 SDK does a pretty good job of that. But in many places the examples start out well written for beginners...Then they slowly die off into obscurity as if the person writing it literally fell asleep. Leaving us beginners with only half of what we needed.
Many, many times I've screamed dirty words in Maxon's direction for doing that.:)
I'm sure I'm not alone on this one.
Luckily coffee is very similar to C++. And the C++ user base has lots of wonderful written and video tutorials that are fantastic for new people like me. It really helped to fill in all the blanks on how the coffee structure works where the SDK drifts off.

The place where the Maxon SDK really fails hard is in the documentation of the functions. And what they need around them to work.
The C++ community can help new users learn the big picture of code flow. But without knowing what the various coffee functions need in order to work. We (me) are completely lost on how to use them properly.
Once we (me) see the function used in a very simple example. It becomes very clear and easy to understand them and use them. Even as a beginner.

How can you write code if you don't know what the functions require for them to function?
That's been my biggest frustration with coffee and the SDK.
Something like: long real( real, bool, null) means nothing to us beginners.
We (me) need to see the function written in the vernacular of the coffee language to understand it.
Once it's written that way it's usually very simple to understand it. At least it is for me anyway.

Project tutorials and scripts that get posted to the various forums are great. But they only teach a few functions at a time. And they might get buried too deep inside a script for new users to understand them.
It's my opinion that what the C4D scripting community really needs the most. Is a good solid reference of every single coffee function written in the vernacular of the langue. Not in C++ vernacular. At least that's what I really need the most.
Coffee is a very easy language once you know how the functions work.
I'm sure I'd still have questions even with all the functions properly documented. But without that documentation as a guide. I'm not just new to programming, I'm flying totally blind.

I'll happily take personal responsibility for learning code structure and code flow. I don't expect everything to be spoon fed to me.
But at the very minimum. I need every single function to be documented in coffee vernacular in order to know how to use them.
C++, Java, Python... they all have reference documentation available where the programmer can look up a function and how to use it in the vernacular of the language it's written in.
Coffee doesn't. And that's what gets in my way more than anything else.

I think that's the longest post I've ever written here.:)

-ScottA

Darter
03-16-2010, 10:05 PM
Don't forget Plugin Cafe, which can be seen as an extension of the COFFEE and C++ SDKs. If you can't find an answer or code example in the extensive archive, just ask. There's a wealth of experience to draw upon from a very helpful community. For example, yesterday Matthias from Maxon support posted commented COFFEE code for finding the average of selected points. As questions are answered, the archive grows and becomes increasingly useful.

Jorge Arango
03-16-2010, 10:41 PM
I join you in your frustration Scott. I agree wit Darter in that the community is very helpful. Sometimes you just say "I need a script that does this..." and someone creates the script for you (you've done it a couple of times for me, Darter :) ). But sometimes you get stuck on a code, you ask for help, you get your help and you are immediately stuck again and you just don't want to abuse the community.

I agree with Scott, every COFFEE function should have a snippet of code for an example but I guess Maxon has other priorities.

Your Coffee Bible would be the ideal solution but of course it's too much for just one person. I haven't contributed because I'm always behind the Bible in my learning.

CGTalk Moderation
03-16-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.