C.O.F.F.E.E | Tags and rendering problem

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2005   #1
C.O.F.F.E.E | Tags and rendering problem

Hi.
In my coffee adventures I learn alot but still stumble on things I don't get.
Most often fundamental stuff (thanks to my lack of programming skills).

Due to a bug that means that no more than 28 UserData entries can be present at each object, I have split them to two objects, the op and the (Coffee)Tag.
Such as:

var myfader1 = op->#ID_USERDATA:1; // for the op.
and
var myfader2 = op->GetFirstTag()#ID_USERDATA:1; // for the (coffee)Tag.

This works fine -until- I render/render preview.
Then I get a COFFEE error. First I thought it was a bug but a (very) fast answer from
MaxonSupport explained that when rendering, the scene is duplicated. This way we can still work on the scene while rendering, very cool and what we are used to.

However, what happens then is that in the rendered scene, things as Tags get reordered and thus the above example do not work. Most likely a invisible tag(s) is placed infront of the CoffeTag I use.

From support I got the following code to get around the problem:

GetFirstTag(obj, type)
{
var tag = obj->GetFirstTag();
while (tag) {
if (tag->GetType() ==type) return tag;
tag = tag->GetNext();
}
return NULL;
}

To get the first COFFEE tag, you should use then:

var coffeeTag = GetFirstTag(myObj, Tcoffeeexpression);

Now I have spent a couple of hours with every possible variation of that code I can think of and I fail.
What I get in most tries is: "Variable or Function expected"
And that is within the brackets of the very first and very last line of the code above.
In the cases of no coffee errors the code doesn't work at all.

If anybody see anything strange in this and/or know how to aproach this I'd be very happy.

Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #2
make sure that that function is outside of your main function (you can't make nested functions, just classes and structs if you need that sort of thing), i.e.

GetFirstTag(type) {
...
}

main(doc,op) {
...
var tag=GetFirstTag(Tcoffee);
...
}
__________________
The Third Party | Homepage | My Reel
"You need to know what you're doing before you start, and to start because you need what you're doing."
 
Old 10 October 2005   #3
Thank you!
I'm getting two steps closer.
First, I wouldn't know that it should be before main()....
Second, it works in editor this way (also) but still doesn't in render...

May I ask also, when later transfering this to pluginexpression (.cof)
should it be placed within the Execute or in what part before, or can it just be
placed before Execute "as is" as its own entity?


Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #4
And it was of coarse my fault!
I had misspelt GetNext (typed getNext)
It was still gray in the expression editor (should it be that?) so I missed it.
-and- it worked in editor with the wrong spelling..
Let me apologize for confusion and a big thanks for the ongoing help!

Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #5
Quote:
Originally Posted by tcastudios
May I ask also, when later transfering this to pluginexpression (.cof)
should it be placed within the Execute or in what part before, or can it just be
placed before Execute "as is" as its own entity?


Yes I may ask.
What I did was to make a new entry beforein the "private" part.

GetFirstTag()

Then further down added:
PluginName::GetFirstTag(obj,type)
And the code.

Very much "paint by numbers" and guessing from my part, but it works!
I now have to find out why....
Hope it can help.

Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #6
Hi tcastudios, I strongly recommend you read a beginners C++ book, it will really make life a lot easier for you. You only really need to learn the basic concepts and it will make a big difference. Here is a link to a free book on the web, you can download the chapters in PDF format. It's not entirely up-to-date but covers all the things you need to know and this shouldn't really affect you unless you want to do c++ programming, and then the differences are only slight. There are also a few chapters on the history of computers and languages that makes interesting reading.

cheers,
JDP
 
Old 10 October 2005   #7
Thanks.
I will/have to look into it.

Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #8
I'm sure some are sick of me babbling along about COFFEE forever and ever...
My aim is of coarse to learn as much as possible and hopefully get more people into it by leaving as much info as possible here..

(The following is probably in the "get into programming, please" area but are related to the SDK. The question is made at PluginCafe as well)

The current issue is to place UserData faders on the PluginTag created by the plugin instead of the old (now not needed) COFFEE Tag.
The code above works with the COFFEE Tag and use the line:

var coffeetag = GetFirstTag(op, Tcoffeeexpression);


In the SDK there are the options:
-Tplugin
-Tcoffeeplugin
-Texpressionplugin

I don't get any of these to work by replacing "Tcoffeeexpression".

Any input or hint what to look for?

Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #9
Not sure what type id you need but Tcoffeeplugin doesn't seem valid anymore, in 9.5 at least. Maybe you should ask on plugin cafe.

Last edited by JDP : 10 October 2005 at 10:45 AM.
 
Old 10 October 2005   #10
Thanks. Yeas I got a suggestion at PluginCafe that I will try.

Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #11
Don't know if it was suggested but it seems you need to put in your Plugin Id for the Type Id, at least that is what gets returned when i print out tag->GetType() to the console.
HTH
 
Old 10 October 2005   #12
I tried that in one of my attempts earlier but I'll see if there is another way to do it.
( I only replaced Tcoffeeexpression with the PLugin ID but I assume there is something more to it.)


Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #13
That should be all you need, works fine for me. This is exactly what I used var mytag = GetFirstTag(op, 1001368);, so must be something else wrong.
 
Old 10 October 2005   #14
Oh, it does?! Even when you render/render preview?

I'll give that another go.

Thanks!

Cheers
Lennart
__________________
MSA | OSX | xfiles ...Cinema4D Tools
 
Old 10 October 2005   #15
Well I don't know your exact situation but I have accessed a user data field on the tag and used it's data in a calculation then took the output and assigned it to a text field of a text spline attached a sketch&toon style tag and rendered in editor and to picture viewer and all worked as expected.

Cheers,
JDP
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:58 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.