def createCharacterInstance(character, hardware):

    
    c = osg.Group()
    if hardware :
        c = osg.clone(character, osg.CopyOp.DEEP_COPY_ALL  ~osg.CopyOp.DEEP_COPY_PRIMITIVES  ~osg.CopyOp.DEEP_COPY_ARRAYS)
    c = osg.clone(character, osg.CopyOp.DEEP_COPY_ALL)

    animationManager = dynamic_cast<osgAnimation.AnimationManagerBase*>(c.getUpdateCallback())

    anim = dynamic_cast<osgAnimation.BasicAnimationManager*>(animationManager)
    list = animationManager.getAnimationList()
    v = getRandomValueinRange(list.size())
    if list[v].getName() == str("MatIpo_ipo") : 
        anim.playAnimation(list[v])
        v = (v + 1)%list.size()
        
    anim.playAnimation(list[v])

    switcher = SetupRigGeometry(hardware)
    c.accept(switcher)

    return c.release()
Esempio n. 2
0
def main(argv):

    
    viewer = osgViewer.Viewer()

    wm = osgWidget.WindowManager(
        viewer,
        1280.0,
        1024.0,
        MASK_2D,
        # osgWidget.WindowManager.WM_USE_RENDERBINS |
        osgWidget.WindowManager.WM_PICK_DEBUG
    )
    
    box = osgWidget.Box("HBOX", osgWidget.Box.HORIZONTAL)
    vbox = osgWidget.Box("vbox", osgWidget.Box.VERTICAL)
    label1 = createLabel(LABEL1)
    label2 = createLabel(LABEL2)

    # Setup the labels for horizontal box.
    label1.setPadding(10.0)
    label2.setPadding(10.0)

    label1.addSize(21.0, 22.0)
    label2.addSize(21.0, 22.0)

    label1.setColor(1.0, 0.5, 0.0, 0.0)
    label2.setColor(1.0, 0.5, 0.0, 0.5)

    label2.setImage("Images/Brick-Norman-Brown.TGA", True)

    box.addWidget(label1)
    box.addWidget(label2)
    box.attachMoveCallback()
    box.attachScaleCallback()
    box.attachRotateCallback()

    # Setup the labels for the vertical box.
    label3 = createLabel("Label 3", 80)
    label4 = createLabel("Label 4", 60)
    label5 = createLabel("ABCDEFGHIJK", 93)

    label3.setPadding(3.0)
    label4.setPadding(3.0)
    label5.setPadding(3.0)

    label3.setColor(0.0, 0.0, 0.5, 0.5)
    label4.setColor(0.0, 0.0, 0.5, 0.5)
    label5.setColor(0.0, 0.0, 0.5, 0.5)
    
    #label5.setAlignHorizontal(osgWidget.Widget.HA_LEFT)
    #label5.setAlignVertical(osgWidget.Widget.VA_BOTTOM)

    # Test our label copy construction...
    label6 = osg.clone(label5, "label6", osg.CopyOp.DEEP_COPY_ALL)

    label6.setLabel("abcdefghijklmnopqrs")

    vbox.addWidget(label3)
    vbox.addWidget(label4)
    vbox.addWidget(label5)
    vbox.addWidget(label6)
    vbox.attachMoveCallback()
    vbox.attachScaleCallback()

    vbox.resize()

    # vbox.setVisibilityMode(osgWidget.Window.VM_ENTIRE)
    # vbox.setVisibleArea(50, 50, 500, 200)
    # vbox.setAnchorVertical(osgWidget.Window.VA_TOP)
    # vbox.setAnchorHorizontal(osgWidget.Window.HA_RIGHT)

    # Test our label-in-window copy construction...
    clonedBox = osg.clone(box, "HBOX-", osg.CopyOp.DEEP_COPY_ALL)()
    
    clonedBox.getBackground().setColor(0.0, 1.0, 0.0, 0.5)

    wm.addChild(box)
    wm.addChild(vbox)
    wm.addChild(clonedBox)

    return osgWidget.createExample(viewer, wm)
    play = _createButton("play")
    pause = _createButton("pause")
    stop = _createButton("stop")
    open = _createButton("open")

    space.setCanFill(True)
    space.setColor(0.0, 0.0, 0.0, 0.0)

    _buttonBox.addWidget(space)
    _buttonBox.addWidget(back)
    _buttonBox.addWidget(next)
    _buttonBox.addWidget(play)
    _buttonBox.addWidget(pause)
    _buttonBox.addWidget(stop)
    _buttonBox.addWidget(open)
    _buttonBox.addWidget(osg.clone(space, "space1", osg.CopyOp.DEEP_COPY_ALL))
    _buttonBox.getBackground().setColor(0.0, 0.0, 0.0, 0.7)
    
    _buttonBox.setEventMask(osgWidget.EVENT_MASK_MOUSE_DRAG)
    _buttonBox.addCallback(osgWidget.Callback(eatDrag, osgWidget.EVENT_MOUSE_DRAG))

void AnimtkViewerGUI._createListBox() 
    _listBox = osgWidget.Box("listBox", osgWidget.Box.VERTICAL)

    amv = AnimtkViewerModelController.instance().getAnimationMap()
        

    for(
        i = amv.begin()
        not = amv.end()
        i++