Skip to content

Commit

Permalink
Squash merge of inline externals
Browse files Browse the repository at this point in the history
  • Loading branch information
joepal1976 committed Dec 23, 2021
1 parent 66febb0 commit 8006cf2
Show file tree
Hide file tree
Showing 39 changed files with 6,443 additions and 39 deletions.
8 changes: 0 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ pipeline {
steps {
script {
sh "rm -rf ${env.WORKSPACE}/../mhx2-makehuman-exchange"
sh "rm -rf ${env.WORKSPACE}/../community-plugins-assetdownload"
sh "rm -rf ${env.WORKSPACE}/../community-plugins-mhapi"
sh "rm -rf ${env.WORKSPACE}/../community-plugins-socket"
sh "rm -rf ${env.WORKSPACE}/../community-plugins-massproduce"
sh "rm -rf ${env.WORKSPACE}/../community-plugins-makeclothes"
sh "rm -rf ${env.WORKSPACE}/../community-plugins-makeskin"
sh "rm -rf ${env.WORKSPACE}/../community-plugins-maketarget"
Expand All @@ -149,10 +145,6 @@ pipeline {
script {
sh "pwd"
sh "git clone https://github.com/makehumancommunity/mhx2-makehuman-exchange ${env.WORKSPACE}/../mhx2-makehuman-exchange"
sh "git clone https://github.com/makehumancommunity/community-plugins-assetdownload ${env.WORKSPACE}/../community-plugins-assetdownload"
sh "git clone https://github.com/makehumancommunity/community-plugins-mhapi ${env.WORKSPACE}/../community-plugins-mhapi"
sh "git clone https://github.com/makehumancommunity/community-plugins-socket ${env.WORKSPACE}/../community-plugins-socket"
sh "git clone https://github.com/makehumancommunity/community-plugins-massproduce ${env.WORKSPACE}/../community-plugins-massproduce"
}

}
Expand Down
62 changes: 31 additions & 31 deletions buildscripts/win32/makePynsistBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,37 +140,37 @@
else:
print("MHX2 was not found in parent directory: " + mhx2)

asset = os.path.abspath(os.path.join(parentdir,'community-plugins-assetdownload'))
if os.path.exists(asset):
tocopy = os.path.abspath(os.path.join(asset,'8_asset_downloader'))
todest = os.path.abspath(os.path.join(pluginsdir,'8_asset_downloader'))
copy_tree(tocopy, todest)
else:
print("asset downloader was not found in parent directory: " + asset)

mhapi = os.path.abspath(os.path.join(parentdir,'community-plugins-mhapi'))
if os.path.exists(mhapi):
tocopy = os.path.abspath(os.path.join(mhapi,'1_mhapi'))
todest = os.path.abspath(os.path.join(pluginsdir,'1_mhapi'))
copy_tree(tocopy, todest)
else:
print("MHAPI was not found in parent directory: " + mhapi)

socket = os.path.abspath(os.path.join(parentdir,'community-plugins-socket'))
if os.path.exists(socket):
tocopy = os.path.abspath(os.path.join(socket,'8_server_socket'))
todest = os.path.abspath(os.path.join(pluginsdir,'8_server_socket'))
copy_tree(tocopy, todest)
else:
print("socket plugin was not found in parent directory: " + socket)

mp = os.path.abspath(os.path.join(parentdir,'community-plugins-massproduce'))
if os.path.exists(mp):
tocopy = os.path.abspath(os.path.join(mp,'9_massproduce'))
todest = os.path.abspath(os.path.join(pluginsdir,'9_massproduce'))
copy_tree(tocopy, todest)
else:
print("mass produce plugin was not found in parent directory: " + mp)
# asset = os.path.abspath(os.path.join(parentdir,'community-plugins-assetdownload'))
# if os.path.exists(asset):
# tocopy = os.path.abspath(os.path.join(asset,'8_asset_downloader'))
# todest = os.path.abspath(os.path.join(pluginsdir,'8_asset_downloader'))
# copy_tree(tocopy, todest)
# else:
# print("asset downloader was not found in parent directory: " + asset)
#
# mhapi = os.path.abspath(os.path.join(parentdir,'community-plugins-mhapi'))
# if os.path.exists(mhapi):
# tocopy = os.path.abspath(os.path.join(mhapi,'1_mhapi'))
# todest = os.path.abspath(os.path.join(pluginsdir,'1_mhapi'))
# copy_tree(tocopy, todest)
# else:
# print("MHAPI was not found in parent directory: " + mhapi)
#
# socket = os.path.abspath(os.path.join(parentdir,'community-plugins-socket'))
# if os.path.exists(socket):
# tocopy = os.path.abspath(os.path.join(socket,'8_server_socket'))
# todest = os.path.abspath(os.path.join(pluginsdir,'8_server_socket'))
# copy_tree(tocopy, todest)
# else:
# print("socket plugin was not found in parent directory: " + socket)
#
# mp = os.path.abspath(os.path.join(parentdir,'community-plugins-massproduce'))
# if os.path.exists(mp):
# tocopy = os.path.abspath(os.path.join(mp,'9_massproduce'))
# todest = os.path.abspath(os.path.join(pluginsdir,'9_massproduce'))
# copy_tree(tocopy, todest)
# else:
# print("mass produce plugin was not found in parent directory: " + mp)

subprocess.call(["pynsist", "pynsist.cfg"], cwd=exportDir)

Expand Down
113 changes: 113 additions & 0 deletions makehuman/plugins/1_mhapi/JsonCall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/usr/bin/python

import json
import numpy as np
# import socket


class JsonCall():

def __init__(self, jsonData=None):
self.params = {}
self.data = None
self.function = "generic"
self.error = ""
self.responseIsBinary = False

if jsonData:
self.initializeFromJson(jsonData)

def initializeFromJson(self, jsonData):
j = json.loads(jsonData)
if not j:
return
self.function = j["function"]
self.error = j["error"]
if j["params"]:
for key, value in j["params"].items():
self.params[key] = value
if j["data"]:
self.data = j["data"]

def setData(self, data=""):
self.data = data

def getData(self):
return self.data

def setParam(self, name, value):
self.params[name] = value

def getParam(self, name):
return self.params.get(name, None)

def setFunction(self, func):
self.function = func

def getFunction(self):
return self.function

def setError(self, error):
self.error = error

def getError(self):
return self.error

def serialize(self):

data = {'function': self.function,
'error': self.error,
'params': self.params,
'data': self.data
}

return json.dumps(data, cls=MHApiEncoder)

# def send(self, host = "127.0.0.1", port = 12345):
# client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# client.connect((host, port))
# client.send(bytes(self.serialize(),encoding='utf-8'))
#
# data = ""
#
# while True:
# buf = client.recv(1024)
# if len(buf) > 0:
# data += buf.strip().decode('utf-8')
# else:
# break
#
# if data:
# return JsonCall(data)
# else:
# return None


class MHApiEncoder(json.JSONEncoder):

def default(self, obj):

if isinstance(obj, np.ndarray):
if obj.dtype == np.dtype('bool'):
return obj.tolist()
else:
return obj.round(6).tolist()

if isinstance(obj, bytes):
return str(obj, encoding='utf-8')

if isinstance(obj, float) or isinstance(obj, np.float32) or isinstance(obj, np.float64):
return float(round(obj, 6))

if isinstance(obj, np.integer):
return int(obj)

# suggested by Python
# try:
# iterable = iter(obj)
# except TypeError:
# pass
# else:
# return list(iterable)

return json.JSONEncoder.default(self, obj)
12 changes: 12 additions & 0 deletions makehuman/plugins/1_mhapi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/python

__all__ = ["api","namespace","JsonCall"]

from .api import API

def load(app):
app.mhapi = API(app)

def unload(app):
pass

Loading

0 comments on commit 8006cf2

Please sign in to comment.