THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/09/2010 at 08:58, xxxxxxxx wrote:
Cinema 4D Version: R12
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
Hmmmm, my generator object has an issue. It seems to register fine, and it appears in the menu, but when I select it from the menu, it's not added to the scene. I can load an existing file with the object in it and the object shows up in the object manager.
On 22/09/2010 at 09:27, xxxxxxxx wrote:
You might check the result of your Init() override and the result of MSG_MENUPREPARE (if used in a Message() override)
On 22/09/2010 at 09:46, xxxxxxxx wrote:
The code works in R9 through R11.5 (init and MSG_MENUPREPARE). Is there anything in particular I should check that would be different in R12?
On 22/09/2010 at 10:13, xxxxxxxx wrote:
Make sure your method returns and arguments are changed to the correct type from LONG. NodeData::CopyTo() especially since the lack of COPYFLAGS argument type is not caught during build. That is all it takes to wreak havoc.
On 22/09/2010 at 11:32, xxxxxxxx wrote:
OK, I found the problem in the Message() function:
BaseDocument *doc = op->GetDocument(); if(!doc) return FALSE;
... when I change the return value to "TRUE", everything is fine.
It seems that in R9 through R10.5, returning FALSE didn't cause that to happen, but from R11 on up, it causes the object not to be added to the scene. I'm glad I caught that.
I don't know why I had it returning FALSE in the first place.
On 22/09/2010 at 11:55, xxxxxxxx wrote:
Typically, I return TRUE unless there is an error such as !node. On the other hand, some examples in cinema4dsdk return TRUE at the end while others return SUPER::Message(node,type,data). It would be nice to know under which circumstances we should use one or the other - or if we should now always do the latter as the default return for NodeData::Message overrides. Again, confusing...
On 22/09/2010 at 14:42, xxxxxxxx wrote:
I think you generally just want to look into the base class implementation. For example, ObjectData::Draw actually does stuff if drawpass==DRAWPASS_HANDLES, while TagData::Draw simply returns TRUE. So if you're drawing in an ObjectData, do you want the base class to do it's thing, or not?
Also, I would not want to return FALSE unless, for example, an allocation of mine failed. If something passed to me by the system is null, that's none of my business, and I don't think it would be appropriate for me to try to handle it, so I just skip my code and pass the parameters as-supplied to the base class.