automated handles interface
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 07/04/2005 at 01:07, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.1
Platform: Windows ;
Language(s) : C++ ;---------
Is there any documentation about the automated handles interface? I couldnt find any, but it is mentioned in the sdk description of the so-called helperroutines GetHandle/SetHandle/GetHandleCount.It is not used in any example. They all use the MoveHandle and DetectHandle routines. The SDK says about those two routines:
"Note: You only need to override this function if you're not using the GetHandle()/SetHandle() convenience functions."
There is no hint on how to instantiate a Handle or how to use it.
TIA
P.S.
In c4d_baseobject.h there is an undocumented inlined function GetHighlightHandle() but no SetHighlightHandle()? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/04/2005 at 13:34, xxxxxxxx wrote:
In c4d_objectplugin.cpp you can see how the default implementation of DetectHandle() and MoveHandle() uses these helper functions. I think that will show you most of what you need to use them, at least combined with the documentation. Feel free to ask if you have further questions.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/04/2005 at 16:31, xxxxxxxx wrote:
!TELL US HOW TO USE THEM!!!
DetectHandle()and MoveHandle()are well enough explained in the examples.
!!! --->>>The helper functions are not <<<---!!!
In c4d_objectplugin.cpp there are only empty placeholder for the so-called helper. What i need is information about HOW to use them. There is absolutely no information about when, where, why and how these functions are called by C4D. Not the slightest hint!
So, please!!!!!! if they should be regarded as helpful in any way, tell us HOW TO USE THEM!
This is how they are implemented in c4d_objectplugin.cpp:
Vector ObjectData::GetHandle(PluginObject *op, LONG i)
{
return 0.0;
}
//this one returns 0 no matter what you dovoid ObjectData::SetHandle(PluginObject *op, LONG i, Vector p)
{
}
//this one does nothing and returns nothing no matter what you doLONG ObjectData::GetHandleCount(PluginObject *op)
{
return 0;
}
//this one does nothing and returns nothing no matter what you doPLEASE tell us HOW TO USE THEM!!!!!!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/04/2005 at 00:21, xxxxxxxx wrote:
This is the code in c4d_objectplugin.cpp that I meant:
LONG ObjectData::DetectHandle(PluginObject *op, BaseDraw *bd, LONG x, LONG y, LONG qualifier) { if (qualifier&QUALIFIER_CTRL) return NOTOK; Matrix mg = op->GetMg(); LONG i,ret=NOTOK; Vector p; for (i=0; i<GetHandleCount(op); i++) { p = GetHandle(op,i); if (bd->PointInRange(p*mg,x,y)) { ret=i; if (!(qualifier&QUALIFIER_SHIFT)) break; } } return ret; } Bool ObjectData::MoveHandle(PluginObject *op, PluginObject *undo, const Matrix &tm, LONG hit_id, LONG qualifier) { Matrix mg=op->GetMg(),mi=!mg; Vector p = ((ObjectData* )undo->GetNodeData())->GetHandle(undo,hit_id); SetHandle(op,hit_id,tm*p); return TRUE; }
So if you don't implement DetectHandle()/MoveHandle() yourself you get the above wrappers around GetHandleCount()/GetHandle()/SetHandle(). The first two should be obvious; just return how many handles you've got and then the current position of them (which you store yourself). In SetHandle() you get the position that the user moved the handle to, which you should project to the constrained movement and then store as the new handle position to be returned in GetHandle().
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/04/2005 at 01:15, xxxxxxxx wrote:
Ok, now i got it.
Whats described in the reference is NOT what Get/SetHandle DOES but what I have to implement.
They are nowhere and never called by C4D except in the DetectHandle()/MoveHandle() baseroutines, thats why i couldnt find anything about it.
And there is nothing "automatic" about it, not at all. My compliments to the author of the reference for this one.
Man, this was really confusing to get!
Maybe this could be made a little bit more clear with the next release of the SDK?something like:
virtual Vector GetHandle(...)
You must override this empty interface provided with the class ObjectData if
1. you do not override DetectHandle()/MoveHandle() and 2. use handles with your object.
It would have saved me at least two days of headaches.Its only two ways of doing exactly the same, overriding whether the one ore the other. This is why they are called helper/convenience/automated handle interface.
Three different names for one thing is not so really easy to get.And in the end it is not what i hoped it is, a workaround for the handles that loose control. Pity.
But thank you for your support.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/03/2007 at 18:48, xxxxxxxx wrote:
Hey Guys,
I have read this thread a bunch of times and I still am unable to get the handles interface to work. I am using the C4D_Falloff class for my ObjectData plugin. This is the reason why I need to use the GetHandle()/SetHandle() functions. None of the handles show up for the object. Any advice on what I'm doing wrong would be very much appreciated. My code is as follows:LONG SquashStretch::GetHandleCount(PluginObject *op) { LONG handles; BaseContainer *data = op->GetDataInstance(); return handles = 2+falloff->GetHandleCount(data); } Vector SquashStretch::GetHandle(PluginObject* op, LONG i) { BaseContainer *data = op->GetDataInstance(); //Both vectors are stored within private data of the //ObjectData class switch (i) { case 0: return strengthPos; break; case 1: return expandPos; break; } return falloff->GetHandle(i, data); return 0.0; } void SquashStretch::SetHandle(PluginObject* op, LONG i, Vector p) { BaseContainer *data = op->GetDataInstance(); Real expand = data->GetReal(SQUASHSTRETCH_EXPAND); Real strength=data->GetReal(SQUASHSTRETCH_STRENGTH); strengthHandle = size.y*(1.0 + strength); expandHandle = expand*100; strengthPos.y = strengthHandle; expandPos.x = expandHandle; switch (i) { case 0: strengthPos.y += p.y; break; case 1: expandPos.x += p.x; break; } falloff->SetHandle(i, p, data); } LONG SquashStretch::DetectHandle(PluginObject *op, BaseDraw *bd, LONG x, LONG y, LONG qualifier) { if (qualifier&QUALIFIER;_CTRL) return NOTOK; Matrix mg = op->GetMg(); LONG i,ret=NOTOK; Vector p; for (i=0; i<GetHandleCount(op); i++) { p = GetHandle(op,i); if (bd->PointInRange(p*mg,x,y)) { ret=i; if (!(qualifier&QUALIFIER;_SHIFT)) break; } } return ret; } Bool SquashStretch::MoveHandle(PluginObject *op, PluginObject *undo, const Matrix &tm;, LONG hit_id, LONG qualifier) { Vector p = ((ObjectData* )undo->GetNodeData())->GetHandle(undo, hit_id); SetHandle(op, hit_id, tm*p); return TRUE; } Josh
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2007 at 03:51, xxxxxxxx wrote:
Hi Josh,
sorry I cannot help you on this issue because C4D_Falloff is still not working for me! Does it work for you now? Do you see the falloff region? You said it didn´t work for you either back in my falloff thread:
Thanks for any input!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/03/2007 at 12:24, xxxxxxxx wrote:
Hi 3D Designer,
Initially I was having problems getting falloff to work, but the problem came down to handles. If your using C4D_Falloff and have handles on the object that is using C4D_Falloff, try disabling all code that deals with Handles. (i.e MoveHandle(), DetectHandle()) The problem is that the C4D_Falloff class requires their handle memeber functions to be called in the ObjectData handle member functions. So if something is not working in the handle code it wouldn't display. The documentation is absolutely horrible at explaining how to use handle functions that call the SetHandle() and GetHandle() functions. I remember it was something stupid like that. I'll look at the Falloff thread with your posts and see if I can remember exactly what I did.
Josh