Conversion from Inventor to Open Inventor: Node Kits

Conversion from Inventor to Open Inventor: Node Kits

Post by Anca I Moso » Tue, 18 Oct 1994 04:05:07



We've recently converted to Open Inventor, and I'm running into problems
converting Node Kits.  I'm using SoShapeKits that have an arbitrary number of
children, but the addChild function is no longer available for SoShapeKits (at
least not obviously).  Is there a way to get around that, or do I have to keep
track of the number of children in another way?  I need to be able to add and
remove an arbitrary number of children from an SoShapeKit object.

Thanks,
Anca.

 
 
 

Conversion from Inventor to Open Inventor: Node Kits

Post by Paul Isaa » Wed, 19 Oct 1994 07:53:05



|> We've recently converted to Open Inventor, and I'm running into problems
|> converting Node Kits.  I'm using SoShapeKits that have an arbitrary number of
|> children, but the addChild function is no longer available for SoShapeKits (at
|> least not obviously).  Is there a way to get around that, or do I have to keep
|> track of the number of children in another way?  I need to be able to add and
|> remove an arbitrary number of children from an SoShapeKit object.
|>
|> Thanks,
|> Anca.

Anca,

You are correct, the old method is gone.  Instead, we've actually made
it possible for you to have more control over the childList than in
Inventor 1.0.

THE OLD WAY;
    I take it you are refering to the method that took this form:

    myShapeKit->addChild( "childList", myNewChildKit );

    It's purpose was to add the kit "myNewChildKit" as the last kit in the
    childList.  Childlist, in turn, was a part of the SoShapekit myShapeKit.

THE NEW WAY:
    In OpenInventor, this method is gone (reason explained below) and you
    can achieve the same effect as follows:

    // First get the list part
    SoNodeKitListPart *myChildList;
    myChildList = (SoNodeKitListPart *) myShapeKit->getPart("childList", TRUE);

    // Add to the list
    myChildList->addChild( myNewChildKit );

WHY?
    In Inventor 1.0, you could only add/delete children to lists by working
    through the nodekit that owned it.  You could never actually get at the
    list node itself and work with it directly.
    Hence, the methods SoBaseKit::addChild(), SoBaseKit::removeChilde(), etc,
    (each of which had a 1st argument that was the
    name of the list) were provided to allow this indirect access.

    We got a number of requests to be able to get an actual pointer to
    the list part itself, so we created a new class of node, SoNodeKitListPart.
    This class is a lot like a group node, except it restricts the types of
    the child nodes you can add. By created this new safeguarded class,
    we obviated the need to have such tight control of the list node itself.
    So now you can just ask for the "childList" part and then work with it
    using the same methods you would use with a group or separator.
    Just be careful that you only add nodes of type SoSeparatorKit -- otherwise
    the node will not be added! (If you use the debug library, errors will
    be printed out when this happens).

pauli.

--
  ---- New York Serenity Prayer:   -------------------------------------------
  God give me the strength to crush those in my way, the money to bribe
  those who can help me, and the wisdom to know the difference.

 
 
 

1. Open Inventor node kit hierarchies

I am using node kits to build/manipulate/animate a kinematic chain (ie robot)
with Open Inventor.  I am using the node kits "childlist" to create a hierarchy
of links and joints.  For example,

                          ...
                           |
                       ---------
                       |       |
                     link0  joint1
                               |
                           ---------
                           |       |
                        link1   joint2
                                   |
                               ---------
                               |       |
                            link3     ...

I would like to select a link/joint and popup a window with parameters for the
object selected.  However, if I select a joint it selects the object and all
of its children.

So I went back to _The Inventor Mentor_ and decided to play with the
program 10.8.PickFilterNodeKit.c++.  First, I create a sphere as child[0] of
each cube.  I converted all the 'SoPath' variables to 'SoNodeKitPath' or
'SoFullPath' variables, but I still have a problem that when I select a cube,
it selects its child sphere.

_The Inventor Toolmaker_ describes the apply() method for node kits
(Chapter 9, pp 218) and says that "if the selection path ends in a node
kit, additional work is performed to extend the path all the way down to
the selected object."

Any help/insights on selection/paths wrt node kit hierarchies would be greatly
appreciated.

Thank you,
Joe

2. PS6 Layer Stacking Order Problem

3. Inventor Q: abstract virtual methods on node kits

4. Picture to Clip Art?

5. Open Inventor Kits

6. DTED

7. Open Inventor vs others tool kits

8. AnimatedTexture2 node for Open Inventor released

9. new nodes and elements in Open Inventor

10. Please help: How to retrieve the information which affects the shape node in Open Inventor

11. Open Inventor Nodes

12. Open Inventor shape node subclasses