Disabling SoNode::copy() or SoType::createInstance()

Disabling SoNode::copy() or SoType::createInstance()

Post by Philippe F. Bertran » Sun, 14 Aug 1994 03:33:24

Keywords: shape kits, Open Inventor

I have a "strange" custom shape kit which requires access to its viewer.
I would like to disable SoNode::copy() and SoType::createInstance() with
this shape kit without disabling the normal method of creating nodes
(using new).

Disabling copy is pretty easy (just make an empty one), but createInstance
is harder.  I thought that once I've initialized the class, I could simply
call SoType::overrideType( MyKit::getClassTypeId(), NULL ).

void MyKit::initClass()
    SO_KIT_INIT_CLASS( MyKit, SoBaseKit, "BaseKit" );

    (void)SoType::overrideType( MyKit::getClassTypeId(), NULL );


Am I close ?

Disabling SoNode::copy() or SoType::createInstance()

Post by Gavin Be » Sun, 14 Aug 1994 07:34:00

Re: disabline SoType::createInstance:

Quote:>void MyKit::initClass()
>    SO_KIT_INIT_CLASS( MyKit, SoBaseKit, "BaseKit" );

>    (void)SoType::overrideType( MyKit::getClassTypeId(), NULL );
>Am I close ?

Yes.  That will make SoType::createInstance (called by SoDB::read()
and any other place where Inventor needs to create a node of your
type) dump core, I believe.

I'd be tempted to implement a createInstance method that printed out
an error message and returned a new SoInfo node, just to be safe.
That might make your program easier to debug.


Inventor on the www:  http://www.sgi.com/tech/Inventor.html


1. SoXtClipBoard and SoNode::copy() Iv2.0 question

|> Organization: NAS - NASA Ames Research Center, Moffett Field, CA
|> Lines: 34
|> NNTP-Posting-Host: win229.nas.nasa.gov
|>  I have these nodekits that are put onto the clipboard then
|>  pasted into another viewer which works fine except that my
|>  kits are derived and I want some of the other data to be
|>  copied along as well.
|>  After looking at Inventor Toolmaker, pg62, I thought I
|>   could put my local field copies in there after I put
|>   a myKit::copy() method in my class.
|>  Unfortunately,  myKit::copy() is never getting called,
|>   and I wanted to know how SoXtClipboard does the copy.
|>   Does it just get the "print" string (for an ASCII file)
|>   and give that to the clipboard?

The SoXtClipboard class just applies a write action to get the
data into the clipboard buffer. You need to make sure that
whatever data is in your kits can be written to files. The
easiest way to do this is to store all the instance data in

(By the way, check out the new comp.graphics.api.inventor newsgroup.)


  Open Inventor Web info in http://www.sgi.com/Technology/Inventor.html

2. Where is 'Render Review' (aka 'ImageView Review')???

3. Why does SoNode::copy() require a ref count?

4. PageMaker 6.51 Frame Options

5. SoNode copy() method

6. info-gnuplot-digest V1 #1925

7. SoType::getKey()

8. Error no standard conversion of SoCoordinate3* to SoNode*

9. Adding same SoNode several times screws up Material...

10. Newbie: how to get coordinates of SoNode object?

11. SoNode Question

12. SoNode::getByName() implemented with SbDict ?