makehumancommunity / community-plugins-mhapi Goto Github PK
View Code? Open in Web Editor NEWThe MHAPI library is a hard dependency for most community plugins
The MHAPI library is a hard dependency for most community plugins
After placed the !_mhapi folder into plugin as instructed i am executing this code to mass export the following characters.
#code
from core import G
mhapi = G.app.mhapi
human = mhapi.internals.getHuman()
print("Processing...")
human.load("Middle_aged Causcasian Male\modelA001.mhm", True)
mhapi.export.exportAsFBX("/Middle_aged Causcasian Male/New folder/modelA001.fbx")
print("Done")
but I am getting the following error on this:
Kindly help me with this
Thank you
I was reading version.md which refers exclusively to hg. Either version.md needs updating or MHAPI code itself needs updating to account for use of git-based versioning.
Hi,
When I'm using the community plugin to download skin assets, the definition files want to use ../textures/xxx
path, but the path of the texture should be ./xxx
For now, I'm using a script to fixup each downloaded assets, but is this normal ?
After update to Python 3.6.3, the "metaclass workaround" seems to fail (I can't rember, I have seen this issue before):
Traceback (most recent call last):
File "./core/mhmain.py", line 548, in loadPlugin
module = imp.load_module(name, fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 245, in load_module
return load_package(name, filename)
File "/usr/lib/python3.6/imp.py", line 217, in load_package
return _load(spec)
File "", line 684, in _load
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "plugins/1_mhapi/init.py", line 5, in
from .api import API
File "plugins/1_mhapi/api.py", line 3, in
from .namespace import NameSpace
File "plugins/1_mhapi/namespace.py", line 22, in
class NameSpace(classCompat(ABCMeta)):
File "plugins/1_mhapi/namespace.py", line 19, in classCompat
return type.new(uglyWorkaroundClass,'uglyWorkaroundClass')
TypeError: type.new() takes exactly 3 arguments (1 given)
Perhaps we should permanently keep different branches for P2 and P3 instead of trying to make code that runs on both Python versions?
Since MakeHuman 1.2.0 is officially released, with moving to Python3, I'd recommend to purge all Python2 code for the sake of maintainability and readability.
Current use case: "Tài liệu". From user:
Could not load 8_asset_downloader
Traceback (most recent call last):
File "./core\mhmain.py", line 580, in loadPlugin
module.load(self)
File "C:\Program Files\makehuman-community\makehuman\plugins\8_asset_downloader\__init__.py", line 38, in load
downloadView = category.addTask(AssetDownloadTaskView(category))
File "C:\Program Files\makehuman-community\makehuman\plugins\8_asset_downloader\assetdownload.py", line 69, in __init__
self.log = mhapi.utility.getLogChannel("assetdownload")
File "C:\Program Files\makehuman-community\makehuman\plugins\1_mhapi\_utility.py", line 119, in getLogChannel
self.logChannels[name] = LogChannel(name,defaultLevel,mirrorToMHLog)
File "C:\Program Files\makehuman-community\makehuman\plugins\1_mhapi\logchannel.py", line 42, in __init__
f.write("--- " + self.fileName + " ---\n\n")
File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode character '\u0300' in position 30: character maps to <undefined>
I have a _skeleton.py in my version, but it is not here. Joel, you wrote this to support expression transfer in Blender. Is this somewhere else?
My local file is:
`#!/usr/bin/python
from .namespace import NameSpace
import getpath
import bvh
import json
import animation
from collections import OrderedDict
class Skeleton(NameSpace):
"""This namespace wraps call which work with skeleton, rig, poses and expressions."""
def __init__(self,api):
self.api = api
NameSpace.__init__(self)
self.trace()
self.human = self.api.internals.getHuman()
def getSkeleton(self):
"""Get the current skeleton, or None if no skeleton is assigned"""
return self.human.getSkeleton()
def getBaseSkeleton(self):
"""Get the internal default skeleton, which is independent on selected rig"""
return self.human.getBaseSkeleton()
def getPoseAsBoneDict(self):
"""Return a dict containing all bone rotations"""
skeleton = self.getSkeleton()
if skeleton is None:
# No rig is set
return None
return None
def getPoseAsBVH(self):
"""Return a BVH object describing the current pose"""
skeleton = self.getSkeleton()
if skeleton is None:
# No rig is set
return None
b = BVH()
b.fromSkeleton(skeleton)
return b
def getPoseAsAnimation(self):
return self.human.getActiveAnimation()
def clearPoseAndExpression(self):
"""Put skeleton back into rest pose"""
human.resetToRestPose()
human.removeAnimations()
def setPoseFromFile(self, bvh_file_name):
"""Set the pose from a BVH file"""
skeleton = self.getSkeleton()
pass
def setExpressionFromFile(self, mhposeFile):
"""Set the expression from a mhpose file"""
if mhposeFile is None:
# clear expression
original_pose = self.getPoseAsAnimation()
if original_pose and hasattr(original_pose, 'pose_backref'):
original_pose = original_pose.pose_backref
if original_pose is None:
self.human.setActiveAnimation(None)
else:
if self.human.hasAnimation(original_pose.name):
self.human.setActiveAnimation(original_pose.name)
else:
self.human.addAnimation(original_pose)
self.human.setActiveAnimation(orgiginal_pose.name)
if self.human.hasAnimation('expr-lib-pose'):
self.human.removeAnimation('expr-lib-pose')
else:
# Assign expression
base_bvh = bvh.load(getpath.getSysDataPath('poseunits/face-poseunits.bvh'), allowTranslation="none")
base_anim = base_bvh.createAnimationTrack(self.human.getBaseSkeleton(), name="Expression-Face-PoseUnits")
poseunit_json = json.load(open(getpath.getSysDataPath('poseunits/face-poseunits.json'),'r'), object_pairs_hook=OrderedDict)
poseunit_names = poseunit_json['framemapping']
base_anim = animation.PoseUnit(base_anim.name, base_anim._data, poseunit_names)
face_bone_idxs = sorted(list(set([bIdx for l in base_anim.getAffectedBones() for bIdx in l])))
new_pose = animation.poseFromUnitPose('expr-lib-pose', mhposeFile, base_anim)
current_pose = self.getPoseAsAnimation()
if current_pose is None:
current_pose = new_pose
current_pose.pose_backref = None
else:
if hasattr(current_pose,'pose_backref') and not current_pose.pose_backref is None:
current_pose = current_pose.pose_backref
org_pose = current_pose
current_pose = animation.mixPoses(org_pose, new_pose, face_bone_idxs)
current_pose.name = 'expr-lib-pose'
self.human.addAnimation(current_pose)
self.human.setActiveAnimation(current_pose.name)
self.human.setPosed(True)
self.human.refreshPose()
def _loadBvh(self, bvh_file_name):
pass
def _createAnimationTrack(self, skeleton):
pass
def _calculateBVHBoneLength(self):
pass
`
Hi,
may you add please an else statement, so that it is possible to use an userdefined output directory?
in _exports.py:
original:
def _getDummyFileEntry(self, outputFilename, useExportsDir=True):
def fileentry(ext):
of = outputFilename
if useExportsDir:
of = os.path.basename(of)
ed = mh.getPath("exports")
of = os.path.join(ed,of)
return of
return fileentry
change please to:
def _getDummyFileEntry(self, outputFilename, useExportsDir=True):
def fileentry(ext):
of = outputFilename
if useExportsDir:
of = os.path.basename(of)
ed = mh.getPath("exports")
of = os.path.join(ed,of)
else:
fileentry = outputFilename
return of
return fileentry
with this change it is possible to use an userdefined output directory with a statement like:
mhapi.exports.exportAsDAE(directory + "/" + filename,False)
without this change the export will be dropped to the root directory of makehuman, where makehuman.py is located, if the option is "useExportsDir=False".
Thanks in advance.
(sorry, my native language isn't english)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.