print('Hello world!')
input('Close window to enter any key.')
execute.batの中身は以下の通りです。 @echo offがないと、set以下の内容がコマンドプロンプト上に表示されてしまいます。見栄えの問題ですね。 set xxx=yyyは変数を定義しています。この変数を利用する際には、%で挟んで上げる必要があります。 %~dp0は実行されるバッチファイルが置かれているカレントディレクトリを示します。今回の場合では、PythonUSBですね。 pyintpathはpython.exeまでのパス、codepathはcodeまでのパス、pyfileは実行したいpyファイル名の変数を設定します。 %pyintpath%python.exe %codepath%%pyfile%は、上述の変数を組み合わせてよく使うpython xxx.pyの形式になっています。
@echo off
set cwdirpath=%~dp0
set pyintpath=%cwdirpath%python\python-3.12.0\
set codepath=%cwdirpath%code\
set pyfile=hello.py
%pyintpath%python.exe %codepath%%pyfile%
import os
print("------------------------PATH---------------------------")
ePath = os.environ["PATH"]
ePath_List=ePath.split(";")
for ePath_line in ePath_List:
#for ev in environ:
print(ePath_line)
print("------------------------MAYA_SCRIPT_PATH-----------------------------")
mayaScriptPath = os.environ["MAYA_SCRIPT_PATH"]
mayaScriptPath_List=mayaScriptPath.split(";")
for mayaScriptPath_line in mayaScriptPath_List:
#for ev in environ:
print(mayaScriptPath_line)
This Project requires the ‘ShallowWater’ plugin whitch could not be found.Would you like to desable it continue?If you do you will no longer be able to open any assets created with it. if not the application will close.
cd C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles
Build.bat AmbitionEarlyHourSky Win64 Development "F:\Download\Game\AmbitionEarlyHourSky6.0NoCascade\AmbitionEarlyHourSky.uproject" -rocket
B案
cd C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\DotNET\UnrealBuildTool
UnrealBuildTool.exe AmbitionEarlyHourSky Win64 Development "F:\Download\Game\AmbitionEarlyHourSky6.0NoCascade\AmbitionEarlyHourSky.uproject" -rocket
ERROR: Unable to find plugin ‘ShallowWater’ (referenced via AmbitionEarlyHourSky.uproject). Install it and try again, or remove it from the required plugin list.
C:\Users\furcr>cd C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64\
C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64>cd ../../
C:\Program Files\Epic Games\UE_5.0\Engine>cd C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles
C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles>Build.bat AmbitionEarlyHourSky Win64 Development "F:\Download\Game\AmbitionEarlyHourSky6.0NoCascade\AmbitionEarlyHourSky.uproject" -rocket
Using bundled DotNet SDK
Log file: C:\Users\furcr\AppData\Local\UnrealBuildTool\Log.txt
Creating makefile for AmbitionEarlyHourSky (Build.version is newer)
ERROR: Unable to find plugin 'ShallowWater' (referenced via AmbitionEarlyHourSky.uproject). Install it and try again, or remove it from the required plugin list.
C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles>Build.bat AmbitionEarlyHourSky Win64 Development "F:\Download\Game\AmbitionEarlyHourSky6.0NoCascade\AmbitionEarlyHourSky.uproject" -rocket
Using bundled DotNet SDK
Log file: C:\Users\furcr\AppData\Local\UnrealBuildTool\Log.txt
Creating makefile for AmbitionEarlyHourSky (Build.version is newer)
Parsing headers for AmbitionEarlyHourSky
Running UnrealHeaderTool "F:\Download\Game\AmbitionEarlyHourSky6.0NoCascade\AmbitionEarlyHourSky.uproject" "F:\Download\Game\AmbitionEarlyHourSky6.0NoCascade\Intermediate\Build\Win64\AmbitionEarlyHourSky\Development\AmbitionEarlyHourSky.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="C:\Users\furcr\AppData\Local\UnrealBuildTool\Log_UHT.txt" -installed
Reflection code generated for AmbitionEarlyHourSky in 6.3933034 seconds
Building AmbitionEarlyHourSky...
Using Visual Studio 2019 14.29.30141 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
[Adaptive Build] Excluded from AmbitionEarlyHourSky unity file: MyBlueprintFunctionLibrary.cpp, SaveToText.cpp, TextFileToString.cpp, AmbitionEarlyHourSky.cpp, AmbitionEarlyHourSkyCharacter.cpp, AmbitionEarlyHourSkyGameMode.cpp
Distributing 23 actions to XGE
--------------------Build System Warning---------------------------------------
License is invalid:
License information is invalid. Please try reloading your license file using the Coordinator Monitor application on the Coordinator machine, or reinstall IncrediBuild.
This build will run in standalone mode.
-------------------------------------------------------------------------------
Build ID: {5E64F7BF-47B0-4AF8-8F9B-4464A50705EC}
--------------------Project: Default-------------------------------------------
[1/23] SharedPCH.Engine.ShadowErrors.cpp (0:51.37 at +0:00)
[2/23] OpenImageDenoise.dll (0:00.64 at +0:51)
[3/23] tbb.dll (0:00.26 at +0:52)
[4/23] d3d12SDKLayers.dll (0:00.31 at +0:52)
[5/23] D3D12Core.dll (0:00.28 at +0:52)
[6/23] tbb12.dll (0:00.31 at +0:52)
[7/23] AmbitionEarlyHourSkyCharacter.cpp (0:01.64 at +0:53)
[8/23] AmbitionEarlyHourSkyGameMode.cpp (0:01.01 at +0:54)
[9/23] SaveToText.cpp (0:00.60 at +0:55)
[10/23] MyBlueprintFunctionLibrary.gen.cpp (0:00.62 at +0:56)
[11/23] AmbitionEarlyHourSkyCharacter.gen.cpp (0:00.92 at +0:57)
[12/23] MyBlueprintFunctionLibrary.cpp (0:00.57 at +0:58)
[13/23] TextFileToString.gen.cpp (0:00.62 at +0:58)
[14/23] AmbitionEarlyHourSky.cpp (0:00.70 at +0:59)
[15/23] AmbitionEarlyHourSky.init.gen.cpp (0:00.64 at +1:00)
[16/23] TextFileToString.cpp (0:15.11 at +1:00)
[17/23] AmbitionEarlyHourSkyGameMode.gen.cpp (0:01.00 at +1:15)
[18/23] Default.rc2 (0:00.48 at +1:16)
[19/23] Module.KawaiiPhysics.cpp (0:03.53 at +1:17)
[20/23] Module.KawaiiPhysics.gen.cpp (0:03.40 at +1:20)
[21/23] SaveToText.gen.cpp (0:00.65 at +1:24)
[22/23] AmbitionEarlyHourSky.exe (0:26.03 at +1:24)
Creating library F:\Download\Game\AmbitionEarlyHourSky6.0NoCascade\Binaries\Win64\AmbitionEarlyHourSky.lib and object F:\Download\Game\AmbitionEarlyHourSky6.0NoCascade\Binaries\Win64\AmbitionEarlyHourSky.exp
[23/23] AmbitionEarlyHourSky.target (0:00.34 at +1:50)
---------------------- Done ----------------------
Rebuild All: 1 succeeded, 0 failed, 0 skipped
1 build system warning(s):
- License is invalid
Total time in XGE executor: 111.50 seconds
Total execution time: 128.20 seconds
C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles>
python3 Error: AttributeError: file C:\Program Files\Autodesk\Maya2023\Python\lib\site-packages\pymel\tools\mel2py\melparse.py line 438: ‘str’ object has no attribute ‘lineno‘
import logging
import time, os
#import simplejson as json
import maya.api.OpenMaya as om2
import maya.cmds as cmds
#from OM2core.plugs.utils import getPlugValue, findPlugOnNode
def findPlugOnNode(node, plugName):
"""
:param node: MObjectHandle
:return: MPlug
"""
if not node.isValid():
raise Exception("Node is no longer valid!")
mFn = om2.MFnDependencyNode(node.object())
for x in xrange(mFn.attributeCount()):
attr = om2.MFnAttribute(mFn.attribute(x))
if attr.name == plugName:
attr = mFn.attribute(plugName)
plug = om2.MPlug(node.object(), attr)
return plug
raise Exception("PlugName {} is not valid!".format(plugName))
def getPlugValue(plug):
"""
:param plug: MPlug. The node plug.
:return: The value of the passed in node plug or None
"""
pAttribute = plug.attribute()
apiType = pAttribute.apiType()
# Float Groups - rotate, translate, scale; Com2pounds
if apiType in [om2.MFn.kAttribute3Double, om2.MFn.kAttribute3Float, om2.MFn.kCompoundAttribute]:
result = []
if plug.isCompound:
for c in xrange(plug.numChildren()):
result.append(getPlugValue(plug.child(c)))
return result
# Distance
elif apiType in [om2.MFn.kDoubleLinearAttribute, om2.MFn.kFloatLinearAttribute]:
return plug.asMDistance().asCentimeters()
# Angle
elif apiType in [om2.MFn.kDoubleAngleAttribute, om2.MFn.kFloatAngleAttribute]:
return plug.asMAngle().asDegrees()
# TYPED
elif apiType == om2.MFn.kTypedAttribute:
pType = om2.MFnTypedAttribute(pAttribute).attrType()
# Matrix
if pType == om2.MFnData.kMatrix:
return om2.MFnMatrixData(plug.asMObject()).matrix()
# String
elif pType == om2.MFnData.kString:
return plug.asString()
# MATRIX
elif apiType == om2.MFn.kMatrixAttribute:
return om2.MFnMatrixData(plug.asMObject()).matrix()
# NUMBERS
elif apiType == om2.MFn.kNumericAttribute:
pType = om2.MFnNumericAttribute(pAttribute).numericType()
if pType == om2.MFnNumericData.kBoolean:
return plug.asBool()
elif pType in [om2.MFnNumericData.kShort, om2.MFnNumericData.kInt, om2.MFnNumericData.kLong,
om2.MFnNumericData.kByte]:
return plug.asInt()
elif pType in [om2.MFnNumericData.kFloat, om2.MFnNumericData.kDouble, om2.MFnNumericData.kAddr]:
return plug.asDouble()
# Enum
elif apiType == om2.MFn.kEnumAttribute:
return plug.asInt()
return None
def _iterForSkinCluster(node):
"""
:param node: MObject for the source connection
:return: MObject
"""
if node.apiType() == om2.MFn.kSkinClusterFilter:
return om2.MObjectHandle(node)
iterDg = om2.MItDependencyGraph(node,
om2.MItDependencyGraph.kDownstream,
om2.MItDependencyGraph.kPlugLevel)
while not iterDg.isDone():
currentItem = iterDg.currentNode() # use currentItem for 2017 and below
if currentItem.hasFn(om2.MFn.kSkinClusterFilter):
return om2.MObjectHandle(currentItem)
iterDg.next()
def _findSkinCluster(mesh=None):
"""
Returns a skinCluster attached to the kMesh or kNurbsCurve
@:param mesh: MObjectHandle. Not the shape! Use the transform.
:return: MObject
"""
if not mesh.isValid():
logger.warning("Destination is no longer valid!")
return
dagPath = om2.MDagPath()
geo = dagPath.getAPathTo(mesh.object())
## Does it have a valid number of shapes?
if geo.numberOfShapesDirectlyBelow() != 0:
## Fetch the shape of the geo now.
shapeMobj = geo.extendToShape().node()
mFn_shape = om2.MFnDependencyNode(shapeMobj)
apiType = shapeMobj.apiType()
if apiType == om2.MFn.kMesh:
## Look at the inMesh attr for the source
inMesh_attr = mFn_shape.attribute('inMesh')
elif apiType == om2.MFn.kNurbsCurve:
inMesh_attr = mFn_shape.attribute('create')
else:
logger.warning("This type of om2.MFn node is not supported! int: {}".format(apiType))
return
inMesh_plug = om2.MPlug(shapeMobj, inMesh_attr)
getSource = inMesh_plug.source().node()
## Now use the iterForSkinCluster() function to find the skinCluster in the connected network.
skinClusterNode_MObjH = _iterForSkinCluster(getSource)
if skinClusterNode_MObjH is not None:
return skinClusterNode_MObjH
else:
return None
return None
def _findInfluences(skinClusterMobjH=None):
"""
Returns all the valid influences from the .matrix attribute on the skinCluster node.
@:param mesh: MObjectHandle for the skinCluster. Using the handles here may be playing it a little too safe. But meh.
:return: MObject
"""
if not skinClusterMobjH.isValid():
logger.warning("Skincluster is no longer valid! Did it get deleted?")
return
skClsMFnDep = om2.MFnDependencyNode(skinClusterMobjH.object())
mtxAttr = skClsMFnDep.attribute("matrix")
matrixPlug = om2.MPlug(skinClusterMobjH.object(), mtxAttr)
## Get a list of all the valid connected indices in the matrix array now.
indices = matrixPlug.getExistingArrayAttributeIndices()
influences = []
for idx in indices:
name = om2.MFnDependencyNode(matrixPlug.elementByLogicalIndex(idx).source().node()).absoluteName()
influences.append(str(om2.MNamespace.stripNamespaceFromName(name)))
return influences
def fileExists(filePath):
if filePath is not None and os.path.isfile(filePath):
logger.info("File exists!")
return True
return False
def writetoJSON(filePath, data):
with open(filePath, 'w') as outfile:
outfile.write(json.dumps(data))
return True
def readFromJSON(filePath):
with open(filePath) as infile:
data = json.load(infile)
return data
return None
def _fetchSkinWeights(geoList=None, skipZeroWeights=True):
"""
If you send in a list of geo, we'll use that. Else we assume we're working off selected.
:param geoList: list() of string names for geometry to fetch data for
:param skipZeroWeights: if you want to avoid saving all 0.0 weight data
:return:
"""
geo = om2.MSelectionList()
if geoList is not None:
for eachGeo in geoList:
geo.add(eachGeo)
else: #Assume selected
for eachGeo in cmds.ls(sl=True):
geo.add(eachGeo)
weightData = {}
for x in range(geo.length()):
geoMObjH = om2.MObjectHandle(geo.getDependNode(x))
geoName = om2.MFnDependencyNode(geoMObjH.object()).name()
skinClusterMObjH = _findSkinCluster(geoMObjH)
if skinClusterMObjH is None:
logger.warning("Skipping {} has no skinCluster!".format(geoName))
continue
skName = str(om2.MFnDependencyNode(skinClusterMObjH.object()).name())
influences = _findInfluences(skinClusterMObjH)
## Add the data to the dict
weightData[geoName] = {}
weightData[geoName][skName] = {}
weightData[geoName][skName]['influences'] = influences
weightData[geoName][skName]['maxInf'] = cmds.skinCluster(skName, q=True, maximumInfluences=True)
weightData[geoName][skName]['weights'] = {}
## Fetch the weights now
weightPlug = findPlugOnNode(skinClusterMObjH, 'weightList')
weightCount = weightPlug.getExistingArrayAttributeIndices()
for x in range(len(weightCount)):
# .weightList[x]
p = weightPlug.elementByLogicalIndex(weightCount[x])
# .weights
c = p.child(0)
## Now fetch the list of idx numbers that should relate to the inf [23, 66, 99]
w = c.getExistingArrayAttributeIndices()
## For each idx we're going to build a tuple (idx, infName, weightVal)
weightList = list()
for i in range(len(w)):
childPlug = c.elementByLogicalIndex(w[i])
weightValue = getPlugValue(childPlug)
if skipZeroWeights and weightValue == 0.0:
continue
idx = w[i]
weightList.append((idx, weightValue))
weightData[geoName][skName]['weights'][str(x)] = weightList
print("weightData["+str(geoName)+"]["+str(skName)+"][weights]["+str(x)+"]"+"= "+str(weightList))
return weightData
weightData=_fetchSkinWeights(None,False)
#print("weightData= "+str(weightData))
_Weights=weightData[dupMesh][skincluster]["weights"][str(vert)]
print("_Weights= "+str(_Weights))
boneInt=0
bones = pm.listConnections(str(skincluster) + ".matrix")
boneslen=len(bones)
for b in range(0,boneslen):
bonename=bones[b]
if influence in str(bonename):
#print("found hit")
boneInt=b
print("boneInt= "+str(boneInt))
weight=0
for _Weight in _Weights:
#_Weight=(0, 0.8388942003250122)
boneNum=_Weight[0]
if(boneNum==boneInt):
weight=_Weight[1]
print("weight= "+str(weight))