Skip to main content

Library for character animation and rendering based on ogre3d

Project description

Example code 1 (fbx rendering using timeline).

import os,sys,pdb,math
from libcalab_ogre3d import *
import numpy as np


def onFrameChanged(iframe):
    global skin1, skin2
    print(iframe)
    skin1.setPose(fbx.loader.mMotion.pose(iframe))
    skin2.setPose(fbx.loader.mMotion.pose(iframe))


            

this=RE.createMainWin(sys.argv)
skelFile='../../Mixamo/fbx_withSkin/bigvegas_Walking.fbx' 
skinScale=1

fbx=RE.FBXloader(skelFile, skinScale=skinScale, useTexture=True, simplifyMesh=False)

# draw skeleton
skin1=RE.createSkin(fbx.loader)
skin1.setScale(skinScale, skinScale, skinScale)

# draw mesh
skin2=RE.createFBXskin(fbx)
skin2.setScale(skinScale, skinScale, skinScale)


g_motion2=fbx.loader.mMotion
mTimeline=RE.Timeline("Timeline", g_motion2.numFrames(), 1/g_motion2.frameRate())
m.startMainLoop() # this finishes when program finishes

example code 2 (bvh loading without using timeline).

import os, sys, pdb, math, random
from libcalab_ogre3d import *
import numpy as np

elapsedTime=0
            
def frameMove(fElapsedTime):
    global elapsedTime, mLoader, mMotion,mSkin

    elapsedTime=elapsedTime+fElapsedTime
    currFrame=round(elapsedTime*30) # assuming 120hz

    if currFrame>=mMotion.numFrames():
        return
    mLoader.setPose(mMotion.pose(currFrame))
    leftwristpos=mLoader.getBoneByName('LeftHand').getFrame().translation
    RE.draw("Sphere", leftwristpos*100, "wrist1", "red", 6)

    mSkin.setPose(mMotion.pose(currFrame))

def onCallback(w, uid):
    print(w.id())


this=RE.createMainWin(sys.argv)

this.addButton('hihi')
this.updateLayout()

mLoader=RE.createMotionLoaderExt('../Resource/motion/woody/wd2_2foot_walk_turn2.bvh')
mMotion=mLoader.mMotion

mSkin= RE.createSkin(mLoader);    # to create character
mSkin.scale(1,1,1);                    # this motion data is in cm unit 
mSkin.setPose(mMotion.pose(0));

RE.viewpoint().vpos.set(0, 50, 300)
RE.viewpoint().vat.set(0,40,0)
RE.viewpoint().update()

while True:
    if not RE.renderOneFrame(True):
        break

Other examples

https://github.com/taesoobear/IPCDNNwalk

Changelog

Version 0.1.5

  • Automatically creates the work resource folder.

Version 0.1.4

  • Improved the SceneGraph UI.

Version 0.1.3

  • Fixed null pointer errors related to Ogre::SceneNode.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

libcalab_ogre3d-0.1.8-cp312-cp312-win_amd64.whl (28.4 MB view details)

Uploaded CPython 3.12Windows x86-64

libcalab_ogre3d-0.1.8-cp312-cp312-manylinux_2_39_x86_64.whl (59.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

libcalab_ogre3d-0.1.8-cp312-cp312-macosx_13_0_arm64.whl (15.9 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

File details

Details for the file libcalab_ogre3d-0.1.8-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e45c873e97a7b8dc30f1ba293977c90aac830e2b453077149b16b98da2b9b682
MD5 f591c9027c21f1766da7fd5eae419ed0
BLAKE2b-256 907f15c6657cf13f5f5a59763f2313957736b089515c7b4d18797b68e67ae8fd

See more details on using hashes here.

File details

Details for the file libcalab_ogre3d-0.1.8-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.8-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 dab375e2cc1121f4aaa412ca8a8b5936c3b47aa33c6c970542262ebd0d05ef8a
MD5 f367068f57fa6f8ed1013c1f08144805
BLAKE2b-256 fb917f222081fede15d7cb47042d5c9e3cc52ccae9fb89e06b47696b16ff2b9e

See more details on using hashes here.

File details

Details for the file libcalab_ogre3d-0.1.8-cp312-cp312-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.8-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 6c9d7dd5ae5210cdc2bf48a66858c5b4d50eeea8776a428feacde6f1a9031306
MD5 823ef4125721141e1a3a22148bc3bd3e
BLAKE2b-256 188014a9b6b427751689ec01493298fa1c4cfb09f9b1f91d3592dc5e409ae8c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page