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

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.2-cp312-cp312-win_arm64.whl (20.6 MB view details)

Uploaded CPython 3.12Windows ARM64

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

Uploaded CPython 3.12Windows x86-64

libcalab_ogre3d-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl (59.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

libcalab_ogre3d-0.1.2-cp312-cp312-macosx_13_0_arm64.whl (15.1 MB view details)

Uploaded CPython 3.12macOS 13.0+ ARM64

libcalab_ogre3d-0.1.2-cp311-cp311-macosx_13_0_arm64.whl (15.6 MB view details)

Uploaded CPython 3.11macOS 13.0+ ARM64

File details

Details for the file libcalab_ogre3d-0.1.2-cp312-cp312-win_arm64.whl.

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.2-cp312-cp312-win_arm64.whl
Algorithm Hash digest
SHA256 a041b1b5fb6ddd57e62fde532701b35e637d4d0d894c5cb4e4285914e698a3e1
MD5 640265eccdfa4f0159ddde191f3ed9ef
BLAKE2b-256 10dd6c81f8554ccdfc07138bddbda164093100c48a2efbd9e3869bb0a25c1704

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b5dade3a37b6eef209ac96edadac678c6107b18f4d154d732a9ac38d4800d6d6
MD5 d6e8d6a8b11eccbd57be32df3fd5f9d0
BLAKE2b-256 68cf5ec23674f8d37e20837966940eed17eef209f9b887278e4d045738352bda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.2-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 156e61328fb7faac3146d9093ed3f103570850adcef7416f5d38a8dcf6b5f385
MD5 afc71b68c91de7a2f62e8446cd928162
BLAKE2b-256 872fbdb84caa7febde6f8fde0fe6c3edc4e202533f80a8e9d30a6ae6603738ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.2-cp312-cp312-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 921f03537a2274bb11c586b4a5f4ee050c5ceaf7e693bbcc816a613e696b8d3d
MD5 c38077050ec555e4b757fb1adaf5fa6b
BLAKE2b-256 6bbad773cfe5c0d02533c8022cdba98190a1dc3e8d4467b0c83b430b5d3b1bb7

See more details on using hashes here.

File details

Details for the file libcalab_ogre3d-0.1.2-cp311-cp311-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for libcalab_ogre3d-0.1.2-cp311-cp311-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 85efb4aff908e1828141173ec959c871f721a80e5b1593de1840ab0f66fd94e7
MD5 5fa5527fa5193f79844aabd9f48daf59
BLAKE2b-256 55477e7df157d627594d65a05ce90bd8238ed446c4b4b29d87db344eff7c377b

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