Select object in editor

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/02/2004 at 06:59, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8.207 
Platform:      
Language(s) :   C.O.F.F.E.E  ;

---------
I tried to do a simple plane...code in GetrVirtualObjects:
 Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTY_DATA);  // check if cache is valid
 if (!dirty) return op->GetCache(hh);       // if still valid, return cache

BaseContainer *pdata = op->GetDataInstance();     // get container
 LONG sizeX = pdata->GetLong( LONG_SIZEX );      // get width
 LONG sizeY = pdata->GetLong( LONG_SIZEY );      // get height
 
 PolygonObject *object = PolygonObject::Alloc( 4, 1 );   // polygon with 4 points
 Vector *ppoint = object->GetPoint();       // set corner points of plane
 
 ppoint[0] = Vector( -100, -100, 0 );
 ppoint[1] = Vector( -100, 100, 0 );
 ppoint[2] = Vector( 100, 100, 0 );
 ppoint[3] = Vector( 100, -100, 0 );

Polygon *ppolygon = object->GetPolygon();      // set point order
 *ppolygon = Polygon( 0, 1, 2, 3 );

op->Message( MSG_UPDATE );          // update

return( object );
My problem is, that I cannot activate the object when I click in the editor...at least not within the bounding box, when I click close to the center point of the plane, its activated. And the strange thing: If I dont return an object like above, but only return NULL...when I can activate the object by a click within the bouding box ( defined in GetDimension ).....

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/02/2004 at 16:36, xxxxxxxx wrote:

I think C4D automatically will use the bounding box of the actual geometry you return for selection. The problem is with this line:

    
    
    op->Message( MSG_UPDATE );

If you change it to

    
    
    object->Message( MSG_UPDATE );

then your code seems to work. With the original version "object" didn't know it had any polygons, so when C4D asked it for a bounding box it returned the null box.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/02/2004 at 23:41, xxxxxxxx wrote:

Right, that sounds logical, and it works, thank you 🙂