Coder Social home page Coder Social logo

community-plugins-mhapi's People

Contributors

joepal1976 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

community-plugins-mhapi's Issues

NoneType object has no attribute name ' mhapi'

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:
error2

Kindly help me with this
Thank you

version

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.

Path to skin diffuse map is not OK

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 ?

Metaclass workaround fails on Python 3.6.3

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?

Remove Python2 code

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.

Logchannel crash on non-utf8 home directory path.

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>

_skeleton.py missing

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

`

from core import G

please help me, after placing 1_mhapi in plugin dir/ I can't able to execute from core Import G to get the API function working.
error

exports does not take Output directory, if useExportsDir=False

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.