Results 1 to 3 of 3

Thread: How do I traverse to a child of a SoSeparator pointer?

  1. #1
    Join Date
    Mar 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question How do I traverse to a child of a SoSeparator pointer?

    First off I am working in a large code base that I do not as yet completely understand.
    For this reason I am not entirely sure which functions were called to load the scenegraph from the file to create the structure I have but I do know that it is loading AOK and displaying. Also I am using C++.

    To the problem:
    I have a SoSeparator pointer with 3 children. The I am not sure what the first 2 are but the 3rd one seems to be all of my geometry from the file I loaded. I THINK this means that the 3rd child is the top level SoSeparator loaded from the file (see below).

    My ultimate goal here is to get a pointer to the Separators with the translations,rotations and scaling in them.
    Once I get there I can replace things on the fly. (I know how do do that bit)

    In addition, If anyone knows a good tutorial with varied SoQt coding examples in C++ I would LOVE to hear about it.

    File loaded as below
    #Inventor V2.1 ascii
    Separator {
    Material {
    ambientColor 0.55 0.45 0.25
    diffuseColor 0.55 0.45 0.25
    shininess 1.0
    }
    Separator {
    Translation {translation -30 -5.75 0 }
    RotationXYZ{
    axis Z
    angle -0.785398163
    }
    Transform {
    scaleFactor 20 8 12
    }
    Transform {
    scaleFactor 1.5 1 1
    }
    Cube {width 1 height 1 depth 1}
    }
    Separator {
    Translation { translation -10 -5.75 0 }
    RotationXYZ {
    axis Z
    angle 0.785398163
    }
    Transform {
    scaleFactor 20 8 12
    }
    Transform {
    scaleFactor 1.5 1 1
    }
    Cube {width 1 height 1 depth 1}
    }
    }

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do I traverse to a child of a SoSeparator pointer?

    You'd be far better off asking a Coin API question in a Coin forum.

  3. #3
    Join Date
    Mar 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How do I traverse to a child of a SoSeparator pointer?

    Ahh I understand. Sorry about that. I have yet to find a good one is all. The one you linked is more of a mailing list than a forum.

    Just in case someone else stumbles in here looking for the answer I think I figured it out.
    Just type cast your SoNode into a SoSeparator and it will work. (not sure this is the correct way to do things but hey it works!)

    SoSeparator * parent;
    SoSeparator * left;
    SoSeparator * right;

    parent= (SoSeparator *) Root->getChild(2); //Root->getChild(2) resolves to the top of the file I put above.
    left = (SoSeparator *) parent->getChild(2);
    right = (SoSeparator *) parent->getChild(3);
    Last edited by MisterWanderer; 9th March 2012 at 01:00.

Similar Threads

  1. Handle child of QProcess's child.
    By gcubar in forum Newbie
    Replies: 4
    Last Post: 30th November 2012, 02:59
  2. Replies: 1
    Last Post: 4th December 2010, 17:20
  3. Is there any way to traverse amount of controls in a loop?
    By mismael85 in forum Qt Programming
    Replies: 5
    Last Post: 29th November 2010, 09:31
  4. Replies: 2
    Last Post: 24th August 2008, 14:42
  5. traverse a xml tree
    By mickey in forum General Programming
    Replies: 2
    Last Post: 27th January 2008, 12:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.