Skip to content

Instantly share code, notes, and snippets.

@whaison
Created February 7, 2017 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whaison/3e6bce5d2e640b71f5df54afe98df950 to your computer and use it in GitHub Desktop.
Save whaison/3e6bce5d2e640b71f5df54afe98df950 to your computer and use it in GitHub Desktop.
ImportScene_00100.py
# -*- coding: utf-8 -*-
from fbx import *
import os, sys
import re
#===================class Node=========================
import FbxCommon
#===================class Node=========================
#====================================================
#================== DisplayCommon.py ===================
#====================================================
def DisplayString(pHeader, pValue="" , pSuffix=""):
lString = pHeader
lString += str(pValue)
lString += pSuffix
print(lString)
def DisplayBool(pHeader, pValue, pSuffix=""):
lString = pHeader
if pValue:
lString += "true"
else:
lString += "false"
lString += pSuffix
print(lString)
def DisplayInt(pHeader, pValue, pSuffix=""):
lString = pHeader
lString += str(pValue)
lString += pSuffix
print(lString)
def DisplayDouble(pHeader, pValue, pSuffix=""):
print("%s%f%s" % (pHeader, pValue, pSuffix))
DebugLog("DisplayDouble () pHeader =" +str(pHeader)+" pValue= "+ str(pValue)+" pSuffix ="+str(pSuffix) )
#(pHeader, pValue, pSuffix))
def Display2DVector(pHeader, pValue, pSuffix=""):
print("%s%f, %f%s" % (pHeader, pValue[0], pValue[1], pSuffix))
DebugLog("Display2DVector () pHeader =" +str(pHeader)+" pValue[0]= "+ str(pValue[0])+" pValue[1] ="+str(pValue[1]) +" pSuffix ="+str(pSuffix) )
def Display3DVector(pHeader, pValue, pSuffix=""):
print("%s%f, %f, %f%s" % (pHeader, pValue[0], pValue[1], pValue[2], pSuffix))
DebugLog("Display3DVector () pHeader =" +str(pHeader)+" pValue[0]= "+ str(pValue[0])+" pValue[1] ="+str(pValue[1]) +" pValue[2] ="+str(pValue[2]) +" pSuffix ="+str(pSuffix) )
def Display4DVector(pHeader, pValue, pSuffix=""):
print("%s%f, %f, %f, %f%s" % (pHeader, pValue[0], pValue[1], pValue[2], pValue[3], pSuffix))
DebugLog("Display4DVector () pHeader =" +str(pHeader)+" pValue[0]= "+ str(pValue[0])+" pValue[1] ="+str(pValue[1]) +" pValue[2] ="+str(pValue[2]) +" pValue[3] ="+str(pValue[3]) +" pSuffix ="+str(pSuffix) )
def DisplayColor(pHeader, pValue, pSuffix=""):
print("%s%f (red), %f (green), %f (blue)%s" % (pHeader, pValue.mRed, pValue.mGreen, pValue.mBlue, pSuffix))
DebugLog("DisplayColor () pHeader =" +str(pHeader)+" pValue.mRed= "+ str(pValue.mRed)+" pValue.mGreen ="+str(pValue.mGreen) +" pValue.mBlue ="+str(pValue.mBlue) +" pSuffix ="+str(pSuffix) )
#====================================================
#================== DisplayCommon.py ===================END
#====================================================
#====================================================
#================== DisplayGlobalSettings.py ===================STA
#====================================================
#from DisplayGlobalSettings import *
from fbx import FbxGlobalLightSettings
from fbx import FbxGlobalCameraSettings
def DisplayGlobalLightSettings(pScene):
lGlobalLightSettings = pScene.GlobalLightSettings()
DisplayColor("Ambient Color: ", lGlobalLightSettings.GetAmbientColor())
DisplayBool("Fog Enabled: ", lGlobalLightSettings.GetFogEnable())
DisplayColor("Fog Color: ", lGlobalLightSettings.GetFogColor())
lFogMode = lGlobalLightSettings.GetFogMode()
if(lFogMode == FbxGlobalLightSettings.eLinear):
DisplayString("Fog Mode: Linear")
elif(lFogMode == FbxGlobalLightSettings.eExponential):
DisplayString("Fog Mode: Exponential")
elif(lFogMode == FbxGlobalLightSettings.eExponentialSquareRoot):
DisplayString("Fog Mode: Exponential Square Root")
else:
DisplayString("Fog Mode: UNKNOWN")
DisplayDouble("Fog Density: ", lGlobalLightSettings.GetFogDensity())
DisplayDouble("Fog Start: ", lGlobalLightSettings.GetFogStart())
DisplayDouble("Fog End: ", lGlobalLightSettings.GetFogEnd())
DisplayBool("Shadow Enabled: ", lGlobalLightSettings.GetShadowEnable())
DisplayDouble("Fog Density: ", lGlobalLightSettings.GetShadowIntensity())
DisplayInt("Shadow Planes Count: ", lGlobalLightSettings.GetShadowPlaneCount())
DisplayString("")
def DisplayGlobalCameraSettings(pScene):
lGlobalSettings = pScene.GetGlobalSettings()
DisplayString("Default Camera: ", lGlobalSettings.GetDefaultCamera().Buffer())
DisplayString("")
def DisplayGlobalTimeSettings(pGlobalSettings):
lTimeModes = [ "Default Mode", "Cinema", "PAL", "Frames 30",
"NTSC Drop Frame", "Frames 50", "Frames 60",
"Frames 100", "Frames 120", "NTSC Full Frame",
"Frames 30 Drop", "Frames 1000" ]
DisplayString("Time Mode: ", lTimeModes[pGlobalSettings.GetTimeMode()])
lTs = pGlobalSettings.GetTimelineDefaultTimeSpan()
lStart = lTs.GetStart()
lEnd = lTs.GetStop()
DisplayString("Timeline default timespan: ")
lTmpStr=""
DisplayString(" Start: ", lStart.GetTimeString(lTmpStr, 10))
DisplayString(" Stop : ", lEnd.GetTimeString(lTmpStr, 10))
DisplayString("")
#====================================================
#================== DisplayGlobalLightSettings.py ===================END
#====================================================
#====================================================
#====================================================
#================== DisplayHierarchy.py ===================STA
#====================================================
#====================================================
def DisplayHierarchy(pScene):
lRootNode = pScene.GetRootNode()
for i in range(lRootNode.GetChildCount()):
DisplayNodeHierarchy(lRootNode.GetChild(i), 0)
def DisplayNodeHierarchy(pNode, pDepth):
lString = ""
for i in range(pDepth):
lString += " "
lString += pNode.GetName()
print(lString)
for i in range(pNode.GetChildCount()):
DisplayNodeHierarchy(pNode.GetChild(i), pDepth + 1)
#====================================================
#====================DisplayHierarchy .py =================== END
#================================================================
#====================================================
#====================================================
#==================== DisplayMarker.py ============== STA
#====================================================
#from DisplayCommon import *
from fbx import FbxMarker
from fbx import FbxColor
def DisplayMarker(pNode):
lMarker = pNode.GetNodeAttribute()
DisplayString("Marker Name: ", pNode.GetName())
# Type
lString = " Marker Type: "
if lMarker.GetType() == FbxMarker.eStandard:
lString += "Standard"
elif lMarker.GetType() == FbxMarker.eOptical:
lString += "Optical"
elif lMarker.GetType() == FbxMarker.eEffectorIK:
lString += "IK Effector"
elif lMarker.GetType() == FbxMarker.eEffectorFK:
lString += "FK Effector"
DisplayString(lString)
# Look
lString = " Marker Look: "
if lMarker.Look.Get() == FbxMarker.eCube:
lString += "Cube"
elif lMarker.Look.Get() == FbxMarker.eHardCross:
lString += "Hard Cross"
elif lMarker.Look.Get() == FbxMarker.eLightCross:
lString += "Light Cross"
elif lMarker.Look.Get() == FbxMarker.eSphere:
lString += "Sphere"
DisplayString(lString)
# Size
#lString = " Size: "
#lString += str(lMarker.Size.Get())
DisplayDouble(" Size: ", lMarker.Size.Get())
# Color
c = lMarker.Color.Get()
color = FbxColor(c[0], c[1], c[2])
DisplayColor(" Color: ", color)
# IKPivot
Display3DVector(" IKPivot: ", lMarker.IKPivot.Get())
#====================================================
#==================== DisplayMarker.py ============== END
#====================================================
#====================================================
#====================================================
#=====================================
#====================================================
#==================== DisplayMesh.py =========================STA
#====================================================
#from DisplayCommon import *
from fbx import FbxLayerElement
from fbx import FbxSurfaceMaterial
from fbx import FbxLayeredTexture
from fbx import FbxTexture
from fbx import FbxCriteria
#from DisplayMaterial import DisplayMaterial
#from DisplayTexture import DisplayTexture
#from DisplayLink import DisplayLink
#from DisplayShape import DisplayShape
def DisplayMesh(pNode):
lMesh = pNode.GetNodeAttribute ()
DisplayString("Mesh Name: ", pNode.GetName())
DisplayControlsPoints(lMesh)
DisplayPolygons(lMesh)
DisplayMaterialMapping(lMesh)
DisplayMaterial(lMesh)
DisplayTexture(lMesh)
DisplayMaterialConnections(lMesh)
DisplayLink(lMesh)
DisplayShape(lMesh)
def DisplayControlsPoints(pMesh):
lControlPointsCount = pMesh.GetControlPointsCount()
lControlPoints = pMesh.GetControlPoints()
DisplayString(" Control Points")
for i in range(lControlPointsCount):
DisplayInt(" Control Point ", i)
Display3DVector(" Coordinates: ", lControlPoints[i])
for j in range(pMesh.GetLayerCount()):
leNormals = pMesh.GetLayer(j).GetNormals()
if leNormals:
if leNormals.GetMappingMode() == FbxLayerElement.eByControlPoint:
header = " Normal Vector (on layer %d): " % j
if leNormals.GetReferenceMode() == FbxLayerElement.eDirect:
Display3DVector(header, leNormals.GetDirectArray().GetAt(i))
DisplayString("")
def DisplayPolygons(pMesh):
lPolygonCount = pMesh.GetPolygonCount()
lControlPoints = pMesh.GetControlPoints()
DisplayString(" Polygons")
vertexId = 0
for i in range(lPolygonCount):
DisplayInt(" Polygon ", i)
for l in range(pMesh.GetLayerCount()):
lePolgrp = pMesh.GetLayer(l).GetPolygonGroups()
if lePolgrp:
if lePolgrp.GetMappingMode() == FbxLayerElement.eByPolygon:
if lePolgrp.GetReferenceMode() == FbxLayerElement.eIndex:
header = " Assigned to group (on layer %d): " % l
polyGroupId = lePolgrp.GetIndexArray().GetAt(i)
DisplayInt(header, polyGroupId)
else:
# any other mapping modes don't make sense
DisplayString(" \"unsupported group assignment\"")
lPolygonSize = pMesh.GetPolygonSize(i)
for j in range(lPolygonSize):
lControlPointIndex = pMesh.GetPolygonVertex(i, j)
Display3DVector(" Coordinates: ", lControlPoints[lControlPointIndex])
for l in range(pMesh.GetLayerCount()):
leVtxc = pMesh.GetLayer(l).GetVertexColors()
if leVtxc:
header = " Color vertex (on layer %d): " % l
if leVtxc.GetMappingMode() == FbxLayerElement.eByControlPoint:
if leVtxc.GetReferenceMode() == FbxLayerElement.eDirect:
DisplayColor(header, leVtxc.GetDirectArray().GetAt(lControlPointIndex))
elif leVtxc.GetReferenceMode() == FbxLayerElement.eIndexToDirect:
id = leVtxc.GetIndexArray().GetAt(lControlPointIndex)
DisplayColor(header, leVtxc.GetDirectArray().GetAt(id))
elif leVtxc.GetMappingMode() == FbxLayerElement.eByPolygonVertex:
if leVtxc.GetReferenceMode() == FbxLayerElement.eDirect:
DisplayColor(header, leVtxc.GetDirectArray().GetAt(vertexId))
elif leVtxc.GetReferenceMode() == FbxLayerElement.eIndexToDirect:
id = leVtxc.GetIndexArray().GetAt(vertexId)
DisplayColor(header, leVtxc.GetDirectArray().GetAt(id))
elif leVtxc.GetMappingMode() == FbxLayerElement.eByPolygon or \
leVtxc.GetMappingMode() == FbxLayerElement.eAllSame or \
leVtxc.GetMappingMode() == FbxLayerElement.eNone:
# doesn't make much sense for UVs
pass
leUV = pMesh.GetLayer(l).GetUVs()
if leUV:
header = " Texture UV (on layer %d): " % l
if leUV.GetMappingMode() == FbxLayerElement.eByControlPoint:
if leUV.GetReferenceMode() == FbxLayerElement.eDirect:
Display2DVector(header, leUV.GetDirectArray().GetAt(lControlPointIndex))
elif leUV.GetReferenceMode() == FbxLayerElement.eIndexToDirect:
id = leUV.GetIndexArray().GetAt(lControlPointIndex)
Display2DVector(header, leUV.GetDirectArray().GetAt(id))
elif leUV.GetMappingMode() == FbxLayerElement.eByPolygonVertex:
lTextureUVIndex = pMesh.GetTextureUVIndex(i, j)
if leUV.GetReferenceMode() == FbxLayerElement.eDirect or \
leUV.GetReferenceMode() == FbxLayerElement.eIndexToDirect:
Display2DVector(header, leUV.GetDirectArray().GetAt(lTextureUVIndex))
elif leUV.GetMappingMode() == FbxLayerElement.eByPolygon or \
leUV.GetMappingMode() == FbxLayerElement.eAllSame or \
leUV.GetMappingMode() == FbxLayerElement.eNone:
# doesn't make much sense for UVs
pass
# # end for layer
vertexId += 1
# # end for polygonSize
# # end for polygonCount
# check visibility for the edges of the mesh
for l in range(pMesh.GetLayerCount()):
leVisibility=pMesh.GetLayer(0).GetVisibility()
if leVisibility:
header = " Edge Visibilty (on layer %d): " % l
DisplayString(header)
# should be eByEdge
if leVisibility.GetMappingMode() == FbxLayerElement.eByEdge:
# should be eDirect
for j in range(pMesh.GetMeshEdgeCount()):
DisplayInt(" Edge ", j)
DisplayBool(" Edge visibilty: ", leVisibility.GetDirectArray().GetAt(j))
DisplayString("")
def DisplayTextureNames(pProperty):
lTextureName = ""
lLayeredTextureCount = pProperty.GetSrcObjectCount(FbxCriteria.ObjectType(FbxLayeredTexture.ClassId))
if lLayeredTextureCount > 0:
for j in range(lLayeredTextureCount):
lLayeredTexture = pProperty.GetSrcObject(FbxCriteria.ObjectType(FbxLayeredTexture.ClassId), j)
lNbTextures = lLayeredTexture.GetSrcObjectCount(FbxCriteria.ObjectType(FbxTexture.ClassId))
lTextureName = " Texture "
for k in range(lNbTextures):
lTextureName += "\""
lTextureName += lLayeredTexture.GetName()
lTextureName += "\""
lTextureName += " "
lTextureName += "of "
lTextureName += pProperty.GetName().Buffer()
lTextureName += " on layer "
lTextureName += j
lTextureName += " |"
else:
#no layered texture simply get on the property
lNbTextures = pProperty.GetSrcObjectCount(FbxCriteria.ObjectType(FbxTexture.ClassId))
if lNbTextures > 0:
lTextureName = " Texture "
lTextureName += " "
for j in range(lNbTextures):
lTexture = pProperty.GetSrcObject(FbxCriteria.ObjectType(FbxTexture.ClassId),j)
if lTexture:
lTextureName += "\""
lTextureName += lTexture.GetName()
lTextureName += "\""
lTextureName += " "
lTextureName += "of "
lTextureName += pProperty.GetName().Buffer()
lTextureName += " |"
return lTextureName
def DisplayMaterialTextureConnections(pMaterial, pMatId, l ):
lConnectionString = " Material " + str(pMatId) + " (on layer " + str(l) +") -- "
#Show all the textures
#Diffuse Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sDiffuse)
lConnectionString += DisplayTextureNames(lProperty)
#DiffuseFactor Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sDiffuseFactor)
lConnectionString += DisplayTextureNames(lProperty)
#Emissive Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sEmissive)
lConnectionString += DisplayTextureNames(lProperty)
#EmissiveFactor Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sEmissiveFactor)
lConnectionString += DisplayTextureNames(lProperty)
#Ambient Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sAmbient)
lConnectionString += DisplayTextureNames(lProperty)
#AmbientFactor Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sAmbientFactor)
lConnectionString += DisplayTextureNames(lProperty)
#Specular Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sSpecular)
lConnectionString += DisplayTextureNames(lProperty)
#SpecularFactor Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sSpecularFactor)
lConnectionString += DisplayTextureNames(lProperty)
#Shininess Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sShininess)
lConnectionString += DisplayTextureNames(lProperty)
#Bump Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sBump)
lConnectionString += DisplayTextureNames(lProperty)
#Normal Map Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sNormalMap)
lConnectionString += DisplayTextureNames(lProperty)
#Transparent Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sTransparentColor)
lConnectionString += DisplayTextureNames(lProperty)
#TransparencyFactor Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sTransparencyFactor)
lConnectionString += DisplayTextureNames(lProperty)
#Reflection Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sReflection)
lConnectionString += DisplayTextureNames(lProperty)
#ReflectionFactor Textures
lProperty = pMaterial.FindProperty(FbxSurfaceMaterial.sReflectionFactor)
lConnectionString += DisplayTextureNames(lProperty)
#if(lMaterial != NULL)
DisplayString(lConnectionString)
def DisplayMaterialConnections(pMesh):
lPolygonCount = pMesh.GetPolygonCount()
DisplayString(" Polygons Material Connections")
#check whether the material maps with only one mesh
lIsAllSame = True
for l in range(pMesh.GetLayerCount()):
lLayerMaterial = pMesh.GetLayer(l).GetMaterials()
if lLayerMaterial:
if lLayerMaterial.GetMappingMode() == FbxLayerElement.eByPolygon:
lIsAllSame = False
break
#For eAllSame mapping type, just out the material and texture mapping info once
if lIsAllSame:
for l in range(pMesh.GetLayerCount()):
lLayerMaterial = pMesh.GetLayer(l).GetMaterials()
if lLayerMaterial:
if lLayerMaterial.GetMappingMode() == FbxLayerElement.eAllSame:
lMaterial = pMesh.GetNode().GetMaterial(lLayerMaterial.GetIndexArray().GetAt(0))
lMatId = lLayerMaterial.GetIndexArray().GetAt(0)
if lMatId >=0:
DisplayInt(" All polygons share the same material on layer ", l)
DisplayMaterialTextureConnections(lMaterial, lMatId, l)
else:
#layer 0 has no material
if l == 0:
DisplayString(" no material applied")
#For eByPolygon mapping type, just out the material and texture mapping info once
else:
for i in range(lPolygonCount):
DisplayInt(" Polygon ", i)
for l in range(pMesh.GetLayerCount()):
lLayerMaterial = pMesh.GetLayer(l).GetMaterials()
if lLayerMaterial:
lMatId = -1
lMaterial = pMesh.GetNode().GetMaterial(lLayerMaterial.GetIndexArray().GetAt(i))
lMatId = lLayerMaterial.GetIndexArray().GetAt(i)
if lMatId >= 0:
DisplayMaterialTextureConnections(lMaterial, lMatId, l)
def DisplayMaterialMapping(pMesh):
lMappingTypes = [ "None", "By Control Point", "By Polygon Vertex", "By Polygon", "By Edge", "All Same" ]
lReferenceMode = [ "Direct", "Index", "Index to Direct"]
lMtrlCount = 0
lNode = None
if pMesh:
lNode = pMesh.GetNode()
if lNode:
lMtrlCount = lNode.GetMaterialCount()
for l in range(pMesh.GetLayerCount()):
leMat = pMesh.GetLayer(l).GetMaterials()
if leMat:
header = " Material layer %d: " % l
DisplayString(header)
DisplayString(" Mapping: ", lMappingTypes[leMat.GetMappingMode()])
DisplayString(" ReferenceMode: ", lReferenceMode[leMat.GetReferenceMode()])
lMaterialCount = 0
if leMat.GetReferenceMode() == FbxLayerElement.eDirect or \
leMat.GetReferenceMode() == FbxLayerElement.eIndexToDirect:
lMaterialCount = lMtrlCount
if leMat.GetReferenceMode() == FbxLayerElement.eIndex or \
leMat.GetReferenceMode() == FbxLayerElement.eIndexToDirect:
lString = " Indices: "
lIndexArrayCount = leMat.GetIndexArray().GetCount()
for i in range(lIndexArrayCount):
lString += str(leMat.GetIndexArray().GetAt(i))
if i < lIndexArrayCount - 1:
lString += ", "
DisplayString(lString)
DisplayString("")
#=====================================
#====================================================
#==================== DisplayMesh.py ========================= END
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== DisplayMaterial.py ===================
#====================================================
#====================================================
def DisplayMaterial(pGeometry):
lMaterialCount = 0
lNode = None
if pGeometry:
lNode = pGeometry.GetNode()
if lNode:
lMaterialCount = lNode.GetMaterialCount()
for l in range(pGeometry.GetLayerCount()):
leMat = pGeometry.GetLayer(l).GetMaterials()
if leMat:
if leMat.GetReferenceMode() == FbxLayerElement.eIndex:
#Materials are in an undefined external table
continue
if lMaterialCount > 0:
theColor = FbxColor()
header = " Materials on layer %d: " % l
DisplayString(header)
for lCount in range(lMaterialCount):
DisplayInt(" Material ", lCount)
lMaterial = lNode.GetMaterial(lCount)
DisplayString(" Name: \"", lMaterial.GetName(), "\"")
#Get the implementation to see if it's a hardware shader.
lImplementation = GetImplementation(lMaterial, "ImplementationHLSL")
lImplemenationType = "HLSL"
if not lImplementation:
lImplementation = GetImplementation(lMaterial, "ImplementationCGFX")
lImplemenationType = "CGFX"
if lImplementation:
#Now we have a hardware shader, let's read it
print(" Hardware Shader Type: %s\n" % lImplemenationType.Buffer())
lRootTable = lImplementation.GetRootTable()
lFileName = lRootTable.DescAbsoluteURL.Get()
lTechniqueName = lRootTable.DescTAG.Get()
lTable = lImplementation.GetRootTable()
lEntryNum = lTable.GetEntryCount()
for i in range(lEntryNum):
lEntry = lTable.GetEntry(i)
lEntry.GetEntryType(True)
lTest = lEntry.GetSource()
print(" Entry: %s\n" % lTest.Buffer())
if cmp( FbxPropertyEntryView.sEntryType, lEntrySrcType ) == 0:
lFbxProp = lMaterial.FindPropertyHierarchical(lEntry.GetSource())
if not lFbxProp.IsValid():
lFbxProp = lMaterial.RootProperty.FindHierarchical(lEntry.GetSource())
elif cmp( FbxConstantEntryView.sEntryType, lEntrySrcType ) == 0:
lFbxProp = lImplementation.GetConstants().FindHierarchical(lEntry.GetSource())
if lFbxProp.IsValid():
if lFbxProp.GetSrcObjectCount( FbxCriteria.ObjectType(FbxTexture.ClassId) ) > 0:
#do what you want with the texture
for j in range(lFbxProp.GetSrcObjectCount(FbxCriteria.ObjectType(FbxTexture.ClassId))):
lTex = lFbxProp.GetSrcObject(FbxCriteria.ObjectType(FbxTexture.ClassId),j)
print(" Texture: %s\n" % lTex.GetFileName())
else:
lFbxType = lFbxProp.GetPropertyDataType()
if (lFbxType == eFbxBool):
lFbxProp = FbxPropertyBool1(lFbxProp)
DisplayBool(" Bool: ", lFbxProp.Get())
elif (lFbxType == eFbxInt):
lFbxProp = FbxPropertyInteger1(lFbxProp)
DisplayInt(" Int: ", lFbxProp.Get())
elif (lFbxType == eFbxEnum):
lFbxProp = FbxPropertyEnum(lFbxProp)
DisplayInt(" Enum: ", lFbxProp.Get())
elif (lFbxType == eFbxFloat):
lFbxProp = FbxPropertyFloat1(lFbxProp)
DisplayDouble(" Float: ", lFbxProp.Get())
elif ( lFbxType == eFbxDouble):
lFbxProp = FbxPropertyDouble1(lFbxProp)
DisplayDouble(" Double: ", lFbxProp.Get())
elif ( lFbxType == eFbxString ):
lFbxProp = FbxPropertyString(lFbxProp)
DisplayString(" String: ", lFbxProp.Get())
elif ( lFbxType == eFbxDouble2):
lFbxProp = FbxPropertyDouble2(lFbxProp)
res, lDouble2= lFbxProp.Get()
lVect = []
lVect[0] = lDouble2[0]
lVect[1] = lDouble2[1]
Display2DVector(" 2D vector: ", lVect)
elif ( lFbxType == eFbxDouble3):
lFbxProp = FbxPropertyDouble3(lFbxProp)
res, lDouble3 = lFbxProp.Get()
lVect = []
lVect[0] = lDouble3[0]
lVect[1] = lDouble3[1]
lVect[2] = lDouble3[2]
Display3DVector(" 3D vector: ", lVect)
elif ( lFbxType == eFbxDouble4):
lFbxProp = FbxPropertyDouble4(lFbxProp)
res, lDouble4 = lFbxProp.Get()
lVect = []
lVect[0] = lDouble4[0]
lVect[1] = lDouble4[1]
lVect[2] = lDouble4[2]
lVect[3] = lDouble4[3]
Display4DVector(" 4D vector: ", lVect)
elif ( lFbxType == eFbxDouble4x4):
lFbxProp = FbxPropertyXMatrix(lFbxProp)
res, lDouble44 = lFbxProp.Get(EFbxType.eFbxDouble44)
for j in range(4):
lVect = []
lVect[0] = lDouble44[j][0]
lVect[1] = lDouble44[j][1]
lVect[2] = lDouble44[j][2]
lVect[3] = lDouble44[j][3]
Display4DVector(" 4x4D vector: ", lVect)
elif (lMaterial.GetClassId().Is(FbxSurfacePhong.ClassId)):
# We found a Phong material. Display its properties.
# Display the Ambient Color
lFbxDouble3 = lMaterial.Ambient
theColor.Set(lFbxDouble3.Get()[0], lFbxDouble3.Get()[1], lFbxDouble3.Get()[2])
DisplayColor(" Ambient: ", theColor)
# Display the Diffuse Color
lFbxDouble3 = lMaterial.Diffuse
theColor.Set(lFbxDouble3.Get()[0], lFbxDouble3.Get()[1], lFbxDouble3.Get()[2])
DisplayColor(" Diffuse: ", theColor)
# Display the Specular Color (unique to Phong materials)
lFbxDouble3 = lMaterial.Specular
theColor.Set(lFbxDouble3.Get()[0], lFbxDouble3.Get()[1], lFbxDouble3.Get()[2])
DisplayColor(" Specular: ", theColor)
# Display the Emissive Color
lFbxDouble3 = lMaterial.Emissive
theColor.Set(lFbxDouble3.Get()[0], lFbxDouble3.Get()[1], lFbxDouble3.Get()[2])
DisplayColor(" Emissive: ", theColor)
# Opacity is Transparency factor now
lFbxDouble1 = lMaterial.TransparencyFactor
DisplayDouble(" Opacity: ", 1.0-lFbxDouble1.Get())
# Display the Shininess
lFbxDouble1 = lMaterial.Shininess
DisplayDouble(" Shininess: ", lFbxDouble1.Get())
# Display the Reflectivity
lFbxDouble3 = lMaterial.Reflection
theColor.Set(lFbxDouble3.Get()[0], lFbxDouble3.Get()[1], lFbxDouble3.Get()[2])
DisplayColor(" Reflectivity: ", theColor)
elif lMaterial.GetClassId().Is(FbxSurfaceLambert.ClassId):
# We found a Lambert material. Display its properties.
# Display the Ambient Color
lFbxDouble3 = lMaterial.Ambient
theColor.Set(lFbxDouble3.Get()[0], lFbxDouble3.Get()[1], lFbxDouble3.Get()[2])
DisplayColor(" Ambient: ", theColor)
# Display the Diffuse Color
lFbxDouble3 = lMaterial.Diffuse
theColor.Set(lFbxDouble3.Get()[0], lFbxDouble3.Get()[1], lFbxDouble3.Get()[2])
DisplayColor(" Diffuse: ", theColor)
# Display the Emissive
lFbxDouble3 = lMaterial.Emissive
theColor.Set(lFbxDouble3.Get()[0], lFbxDouble3.Get()[1], lFbxDouble3.Get()[2])
DisplayColor(" Emissive: ", theColor)
# Display the Opacity
lFbxDouble1 = lMaterial.TransparencyFactor
DisplayDouble(" Opacity: ", 1.0-lFbxDouble1.Get())
else:
DisplayString("Unknown type of Material")
lString = lMaterial.ShadingModel
DisplayString(" Shading Model: ", lString.Get().Buffer())
DisplayString("")
#====================================================
#====================================================
#================== DisplayMaterial.py =================== END
#====================================================
#====================================================
#====================================================
#====================================================
#================== DisplayTextureInfo.py =================== STA
#====================================================
#====================================================
from fbx import FbxSurfaceMaterial
from fbx import FbxLayerElement
from fbx import FbxLayeredTexture
from fbx import FbxTexture
from fbx import FbxCriteria
def DisplayTextureInfo(pTexture, pBlendMode):
DisplayString(" Name: \"", pTexture.GetName(), "\"")
DisplayString(" File Name: \"", pTexture.GetFileName(), "\"")
DisplayDouble(" Scale U: ", pTexture.GetScaleU())
DisplayDouble(" Scale V: ", pTexture.GetScaleV())
DisplayDouble(" Translation U: ", pTexture.GetTranslationU())
DisplayDouble(" Translation V: ", pTexture.GetTranslationV())
DisplayBool(" Swap UV: ", pTexture.GetSwapUV())
DisplayDouble(" Rotation U: ", pTexture.GetRotationU())
DisplayDouble(" Rotation V: ", pTexture.GetRotationV())
DisplayDouble(" Rotation W: ", pTexture.GetRotationW())
lAlphaSources = [ "None", "RGB Intensity", "Black" ]
DisplayString(" Alpha Source: ", lAlphaSources[pTexture.GetAlphaSource()])
DisplayDouble(" Cropping Left: ", pTexture.GetCroppingLeft())
DisplayDouble(" Cropping Top: ", pTexture.GetCroppingTop())
DisplayDouble(" Cropping Right: ", pTexture.GetCroppingRight())
DisplayDouble(" Cropping Bottom: ", pTexture.GetCroppingBottom())
lMappingTypes = [ "Null", "Planar", "Spherical", "Cylindrical", "Box", "Face", "UV", "Environment"]
DisplayString(" Mapping Type: ", lMappingTypes[pTexture.GetMappingType()])
if pTexture.GetMappingType() == FbxTexture.ePlanar:
lPlanarMappingNormals = ["X", "Y", "Z" ]
DisplayString(" Planar Mapping Normal: ", lPlanarMappingNormals[pTexture.GetPlanarMappingNormal()])
lBlendModes = ["Translucent", "Add", "Modulate", "Modulate2"]
if pBlendMode >= 0:
DisplayString(" Blend Mode: ", lBlendModes[pBlendMode])
DisplayDouble(" Alpha: ", pTexture.GetDefaultAlpha())
lMaterialUses = ["Model Material", "Default Material"]
DisplayString(" Material Use: ", lMaterialUses[pTexture.GetMaterialUse()])
pTextureUses = ["Standard", "Shadow Map", "Light Map", "Spherical Reflexion Map", "Sphere Reflexion Map"]
DisplayString(" Texture Use: ", pTextureUses[pTexture.GetTextureUse()])
DisplayString("")
def FindAndDisplayTextureInfoByProperty(pProperty, pDisplayHeader, pMaterialIndex):
if pProperty.IsValid():
#Here we have to check if it's layeredtextures, or just textures:
lLayeredTextureCount = pProperty.GetSrcObjectCount(FbxCriteria.ObjectType(FbxLayeredTexture.ClassId))
if lLayeredTextureCount > 0:
for j in range(lLayeredTextureCount):
DisplayInt(" Layered Texture: ", j)
lLayeredTexture = pProperty.GetSrcObject(FbxCriteria.ObjectType(FbxLayeredTexture.ClassId), j)
lNbTextures = lLayeredTexture.GetSrcObjectCount(FbxCriteria.ObjectType(FbxTexture.ClassId))
for k in range(lNbTextures):
lTexture = lLayeredTexture.GetSrcObject(FbxCriteria.ObjectType(FbxTexture.ClassId),k)
if lTexture:
if pDisplayHeader:
DisplayInt(" Textures connected to Material ", pMaterialIndex)
pDisplayHeader = False
# NOTE the blend mode is ALWAYS on the LayeredTexture and NOT the one on the texture.
# Why is that? because one texture can be shared on different layered textures and might
# have different blend modes.
lBlendMode = lLayeredTexture.GetTextureBlendMode(k)
DisplayString(" Textures for ", pProperty.GetName())
DisplayInt(" Texture ", k)
DisplayTextureInfo(lTexture, lBlendMode)
else:
# no layered texture simply get on the property
lNbTextures = pProperty.GetSrcObjectCount(FbxCriteria.ObjectType(FbxTexture.ClassId))
for j in range(lNbTextures):
lTexture = pProperty.GetSrcObject(FbxCriteria.ObjectType(FbxTexture.ClassId),j)
if lTexture:
# display connectMareial header only at the first time
if pDisplayHeader:
DisplayInt(" Textures connected to Material ", pMaterialIndex)
pDisplayHeader = False
DisplayString(" Textures for ", pProperty.GetName().Buffer())
DisplayInt(" Texture ", j)
DisplayTextureInfo(lTexture, -1)
lNbTex = pProperty.GetSrcObjectCount(FbxCriteria.ObjectType(FbxTexture.ClassId))
for lTextureIndex in range(lNbTex):
lTexture = pProperty.GetSrcObject(FbxCriteria.ObjectType(FbxTexture.ClassId), lTextureIndex)
def DisplayTexture(pGeometry):
lNbMat = pGeometry.GetNode().GetSrcObjectCount(FbxCriteria.ObjectType(FbxSurfaceMaterial.ClassId))
for lMaterialIndex in range(lNbMat):
lMaterial = pGeometry.GetNode().GetSrcObject(FbxCriteria.ObjectType(FbxSurfaceMaterial.ClassId), lMaterialIndex)
lDisplayHeader = True
#go through all the possible textures
if lMaterial:
for lTextureIndex in range(FbxLayerElement.sTypeTextureCount()):
lProperty = lMaterial.FindProperty(FbxLayerElement.sTextureChannelNames(lTextureIndex))
FindAndDisplayTextureInfoByProperty(lProperty, lDisplayHeader, lMaterialIndex)
#====================================================
#====================================================
#================== DisplayTextureInfo.py =================== END
#====================================================
#====================================================
#====================================================
#====================================================
#================== DisplayLink.py =================== STA
#====================================================
#====================================================
#from DisplayCommon import *
from fbx import FbxDeformer
from fbx import FbxAMatrix
#from fbx import FbxLayeredTexture
#from fbx import FbxTexture
def DisplayLink(pGeometry):
#Display cluster now
lSkinCount=pGeometry.GetDeformerCount(FbxDeformer.eSkin)
#lLinkCount = pGeometry.GetLinkCount()
for i in range(lSkinCount):
lClusterCount = pGeometry.GetDeformer(i, FbxDeformer.eSkin).GetClusterCount()
for j in range(lClusterCount):
DisplayInt(" Cluster ", i)
lCluster = pGeometry.GetDeformer(i, FbxDeformer.eSkin).GetCluster(j)
#lLink = pGeometry.GetLink(i)
lClusterModes = [ "Normalize", "Additive", "Total1" ]
DisplayString(" Mode: ", lClusterModes[lCluster.GetLinkMode()])
if lCluster.GetLink():
DisplayString(" Name: ", lCluster.GetLink().GetName())
lString1 = " Link Indices: "
lString2 = " Weight Values: "
lIndexCount = lCluster.GetControlPointIndicesCount()
lIndices = lCluster.GetControlPointIndices()
lWeights = lCluster.GetControlPointWeights()
for k in range(lIndexCount):
lString1 += str(lIndices[k])
lString2 += str(lWeights[k])
if k < lIndexCount - 1:
lString1 += ", "
lString2 += ", "
print(lString1)
print(lString2)
DisplayString("")
lMatrix = FbxAMatrix()
lMatrix = lCluster.GetTransformMatrix(lMatrix)
Display3DVector(" Transform Translation: ", lMatrix.GetT())
Display3DVector(" Transform Rotation: ", lMatrix.GetR())
Display3DVector(" Transform Scaling: ", lMatrix.GetS())
lMatrix = lCluster.GetTransformLinkMatrix(lMatrix)
Display3DVector(" Transform Link Translation: ", lMatrix.GetT())
Display3DVector(" Transform Link Rotation: ", lMatrix.GetR())
Display3DVector(" Transform Link Scaling: ", lMatrix.GetS())
if lCluster.GetAssociateModel():
lMatrix = lCluster.GetTransformAssociateModelMatrix(lMatrix)
DisplayString(" Associate Model: ", lCluster.GetAssociateModel().GetName())
Display3DVector(" Associate Model Translation: ", lMatrix.GetT())
Display3DVector(" Associate Model Rotation: ", lMatrix.GetR())
Display3DVector(" Associate Model Scaling: ", lMatrix.GetS())
DisplayString("")
#====================================================
#====================================================
#================== DisplayLink.py =================== END
#====================================================
#====================================================
#====================================================
#====================================================
#================== DisplayShape.py =================== STA
#====================================================
#====================================================
from fbx import FbxDeformer
#from DisplayCommon import *
def DisplayShape(pGeometry):
lBlendShapeCount = pGeometry.GetDeformerCount(FbxDeformer.eBlendShape)
for lBlendShapeIndex in range(lBlendShapeCount):
lBlendShape = pGeometry.GetDeformer(lBlendShapeIndex, FbxDeformer.eBlendShape)
DisplayString(" BlendShape ", lBlendShape.GetName())
lBlendShapeChannelCount = lBlendShape.GetBlendShapeChannelCount()
for lBlendShapeChannelIndex in range(lBlendShapeChannelCount):
lBlendShapeChannel = lBlendShape.GetBlendShapeChannel(lBlendShapeChannelIndex)
DisplayString(" BlendShapeChannel ", lBlendShapeChannel.GetName())
DisplayDouble(" Default Deform Value: ", lBlendShapeChannel.DeformPercent.Get())
lTargetShapeCount = lBlendShapeChannel.GetTargetShapeCount()
for lTargetShapeIndex in range(lTargetShapeCount):
lShape = lBlendShapeChannel.GetTargetShape(lTargetShapeIndex)
DisplayString(" TargetShape ", lShape.GetName())
lControlPointsCount = lShape.GetControlPointsCount()
lControlPoints = lShape.GetControlPoints()
lNormals = lShape.GetLayer(0).GetNormals().GetDirectArray()
for j in range(lControlPointsCount):
DisplayInt(" Control Point ", j)
Display3DVector(" Coordinates: ", lControlPoints[j])
if lNormals.GetCount() == lControlPointsCount:
Display3DVector(" Normal Vector: ", lNormals.GetAt(j))
DisplayString("")
#====================================================
#====================================================
#================== DisplayShape.py =================== END
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== DisplaySkeleton.py ================== = STA
#====================================================
#====================================================
from fbx import FbxSkeleton
def DisplaySkeleton(pNode):
lSkeleton = pNode.GetNodeAttribute()
DisplayString("Skeleton Name: ", pNode.GetName())
lSkeletonTypes = [ "Root", "Limb", "Limb Node", "Effector" ]
DisplayString(" Type: ", lSkeletonTypes[lSkeleton.GetSkeletonType()])
if lSkeleton.GetSkeletonType() == FbxSkeleton.eLimb:
DisplayDouble(" Limb Length: ", lSkeleton.LimbLength.Get())
elif lSkeleton.GetSkeletonType() == FbxSkeleton.eLimbNode:
DisplayDouble(" Limb Node Size: ", lSkeleton.Size.Get())
elif lSkeleton.GetSkeletonType() == FbxSkeleton.eRoot:
DisplayDouble(" Limb Root Size: ", lSkeleton.Size.Get())
DisplayColor(" Color: ", lSkeleton.GetLimbNodeColor())
#====================================================
#====================================================
#================== DisplaySkeleton.py =================== END
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== DisplayUserProperties.py =================== STA
#====================================================
#====================================================
from fbx import FbxProperty
from fbx import FbxPropertyFlags
from fbx import FbxPropertyDouble1
from fbx import FbxPropertyDouble3
from fbx import FbxPropertyBool1
from fbx import FbxPropertyInteger1
from fbx import FbxPropertyString
from fbx import FbxPropertyFloat1
from fbx import eFbxBool
from fbx import eFbxDouble
from fbx import eFbxDouble4
from fbx import eFbxInt
from fbx import eFbxDouble3
from fbx import eFbxFloat
from fbx import eFbxString
from fbx import eFbxEnum
#from fbx import DTColor3
#from fbx import DTColor4
def DisplayUserProperties(pObject):
lCount = 0
lTitleStr = " Property Count: "
lProperty = pObject.GetFirstProperty()
while lProperty.IsValid():
if lProperty.GetFlag(FbxPropertyFlags.eUserDefined):
lCount += 1
lProperty = pObject.GetNextProperty(lProperty)
if lCount == 0:
return # there are no user properties to display
DisplayInt(lTitleStr, lCount)
lProperty = pObject.GetFirstProperty()
i = 0
while lProperty.IsValid():
if lProperty.GetFlag(FbxPropertyFlags.eUserDefined):
DisplayInt(" Property ", i)
lString = lProperty.GetLabel()
DisplayString(" Display Name: ", lString.Buffer())
lString = lProperty.GetName()
DisplayString(" Internal Name: ", lString.Buffer())
DisplayString(" Type: ", lProperty.GetPropertyDataType().GetName())
if lProperty.HasMinLimit():
DisplayDouble(" Min Limit: ", lProperty.GetMinLimit())
if lProperty.HasMaxLimit():
DisplayDouble(" Max Limit: ", lProperty.GetMaxLimit())
DisplayBool (" Is Animatable: ", lProperty.GetFlag(FbxPropertyFlags.eAnimatable))
lPropertyDataType=lProperty.GetPropertyDataType()
# BOOL
if lPropertyDataType.GetType() == eFbxBool:
lProperty = FbxPropertyBool1(lProperty)
val = lProperty.Get()
DisplayBool(" Default Value: ", val)
# REAL
elif lPropertyDataType.GetType() == eFbxDouble:
lProperty = FbxPropertyDouble1(lProperty)
val = lProperty.Get()
DisplayDouble(" Default Value: ", val)
elif lPropertyDataType.GetType() == eFbxFloat:
lProperty = FbxPropertyFloat1(lProperty)
val = lProperty.Get()
DisplayDouble(" Default Value: ",val)
# COLOR
#elif lPropertyDataType.Is(DTColor3) or lPropertyDataType.Is(DTColor4):
#val = lProperty.Get()
#lDefault=FbxGet <FbxColor> (lProperty)
#sprintf(lBuf, "R=%f, G=%f, B=%f, A=%f", lDefault.mRed, lDefault.mGreen, lDefault.mBlue, lDefault.mAlpha)
#DisplayString(" Default Value: ", lBuf)
# pass
# INTEGER
elif lPropertyDataType.GetType() == eFbxInt:
lProperty = FbxPropertyInteger1(lProperty)
val = lProperty.Get()
DisplayInt(" Default Value: ", val)
# VECTOR
elif lPropertyDataType.GetType() == eFbxDouble3:
lProperty = FbxPropertyDouble3(lProperty)
val = lProperty.Get()
lBuf = "X=%f, Y=%f, Z=%f", (val[0], val[1], val[2])
DisplayString(" Default Value: ", lBuf)
elif lPropertyDataType.GetType() == eFbxDouble4:
lProperty = FbxPropertyDouble4(lProperty)
val = lProperty.Get()
lBuf = "X=%f, Y=%f, Z=%f, W=%f", (val[0], val[1], val[2], val[3])
DisplayString(" Default Value: ", lBuf)
# # LIST
# elif lPropertyDataType.GetType() == eFbxEnum:
# val = lProperty.Get()
# DisplayInt(" Default Value: ", val)
# UNIDENTIFIED
else:
DisplayString(" Default Value: UNIDENTIFIED")
i += 1
lProperty = pObject.GetNextProperty(lProperty)
#====================================================
#====================================================
#================== DisplayUserProperties.py =================== END
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== DisplayPivotsAndLimits.py =================== STA
#====================================================
#====================================================
from fbx import FbxNode
def DisplayPivotsAndLimits(pNode):
# Pivots
print(" Pivot Information")
lPivotState = pNode.GetPivotState(FbxNode.eSourcePivot)
if lPivotState == FbxNode.ePivotActive:
print(" Pivot State: Active")
else:
print(" Pivot State: Reference")
lTmpVector = pNode.GetPreRotation(FbxNode.eSourcePivot)
print(" Pre-Rotation: %f %f %f" % (lTmpVector[0], lTmpVector[1], lTmpVector[2]))
lTmpVector = pNode.GetPostRotation(FbxNode.eSourcePivot)
print(" Post-Rotation: %f %f %f" % (lTmpVector[0], lTmpVector[1], lTmpVector[2]))
lTmpVector = pNode.GetRotationPivot(FbxNode.eSourcePivot)
print(" Rotation Pivot: %f %f %f" % (lTmpVector[0], lTmpVector[1], lTmpVector[2]))
lTmpVector = pNode.GetRotationOffset(FbxNode.eSourcePivot)
print(" Rotation Offset: %f %f %f" % (lTmpVector[0], lTmpVector[1], lTmpVector[2]))
lTmpVector = pNode.GetScalingPivot(FbxNode.eSourcePivot)
print(" Scaling Pivot: %f %f %f" % (lTmpVector[0], lTmpVector[1], lTmpVector[2]))
lTmpVector = pNode.GetScalingOffset(FbxNode.eSourcePivot)
print(" Scaling Offset: %f %f %f" % (lTmpVector[0], lTmpVector[1], lTmpVector[2]))
print(" Limits Information")
lIsActive = pNode.TranslationActive
lMinXActive = pNode.TranslationMinX
lMinYActive = pNode.TranslationMinY
lMinZActive = pNode.TranslationMinZ
lMaxXActive = pNode.TranslationMaxX
lMaxYActive = pNode.TranslationMaxY
lMaxZActive = pNode.TranslationMaxZ
lMinValues = pNode.TranslationMin
lMaxValues = pNode.TranslationMax
if lIsActive:
print(" Translation limits: Active")
else:
print(" Translation limits: Inactive")
print(" X")
if lMinXActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f" % lMinValues.Get()[0])
if lMaxXActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[0])
print(" Y")
if lMinYActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f" % lMinValues.Get()[1])
if lMaxYActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[1])
print(" Z")
if lMinZActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f"% lMinValues.Get()[2])
if lMaxZActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[2])
lIsActive = pNode.RotationActive
lMinXActive = pNode.RotationMinX
lMinYActive = pNode.RotationMinY
lMinZActive = pNode.RotationMinZ
lMaxXActive = pNode.RotationMaxX
lMaxYActive = pNode.RotationMaxY
lMaxZActive = pNode.RotationMaxZ
lMinValues = pNode.RotationMin
lMaxValues = pNode.RotationMax
if lIsActive:
print(" Rotation limits: Active")
else:
print(" Rotation limits: Inactive")
print(" X")
if lMinXActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f" % lMinValues.Get()[0])
if lMaxXActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[0])
print(" Y")
if lMinYActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f" % lMinValues.Get()[1])
if lMaxYActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[1])
print(" Z")
if lMinZActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f"% lMinValues.Get()[2])
if lMaxZActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[2])
lIsActive = pNode.ScalingActive
lMinXActive = pNode.ScalingMinX
lMinYActive = pNode.ScalingMinY
lMinZActive = pNode.ScalingMinZ
lMaxXActive = pNode.ScalingMaxX
lMaxYActive = pNode.ScalingMaxY
lMaxZActive = pNode.ScalingMaxZ
lMinValues = pNode.ScalingMin
lMaxValues = pNode.ScalingMax
if lIsActive:
print(" Scaling limits: Active")
else:
print(" Scaling limits: Inactive")
print(" X")
if lMinXActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f" % lMinValues.Get()[0])
if lMaxXActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[0])
print(" Y")
if lMinYActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f" % lMinValues.Get()[1])
if lMaxYActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[1])
print(" Z")
if lMinZActive:
print(" Min Limit: Active")
else:
print(" Min Limit: Inactive")
print(" Min Limit Value: %f"% lMinValues.Get()[2])
if lMaxZActive:
print(" Max Limit: Active")
else:
print(" Max Limit: Inactive")
print(" Max Limit Value: %f" % lMaxValues.Get()[2])
#====================================================
#====================================================
#================== DisplayPivotsAndLimits.py =================== END
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#====================================================
#================== ===================
#====================================================
#====================================================
#====================================================
#================== DisplayCommon.py ===================
#====================================================
"""
from DisplayHierarchy import DisplayHierarchy
from DisplayMarker import DisplayMarker
from DisplayMesh import DisplayMesh
from DisplayUserProperties import DisplayUserProperties
from DisplayPivotsAndLimits import DisplayPivotsAndLimits
from DisplaySkeleton import DisplaySkeleton
from DisplayNurb import DisplayNurb
from DisplayPatch import DisplayPatch
from DisplayCamera import DisplayCamera
from DisplayLight import DisplayLight
from DisplayLodGroup import DisplayLodGroup
from DisplayPose import DisplayPose
from DisplayAnimation import DisplayAnimation
from DisplayGenericInfo import DisplayGenericInfo
"""
"""
import DisplayHierarchy
import DisplayMarker
import DisplayMesh
import DisplayUserProperties
import DisplayPivotsAndLimits
import DisplaySkeleton
import DisplayNurb
import DisplayPatch
import DisplayCamera
import DisplayLight
import DisplayLodGroup
import DisplayPose
import DisplayAnimation
import DisplayGenericInfo
"""
#====================================================
#================== ImportScene.py ===================
#====================================================
#===================class Node=========================
class ImportScene_00100() :
#======================================================================================================
#======================================================================================================
#============= ==============================================
#======================================================================================================
#======================================================================================================
#======================================================================================================
def DisplayString(self,pHeader, pValue="" , pSuffix=""):
lString = "ImportScene_00100.py ImportScene_00100 Class Method 017 DisplayString() "
lString += " pHeader = "
lString += pHeader
lString += " pValue = "
lString += str(pValue)
lString += " pSuffix = "
lString += pSuffix
#print(lString)
DebugLog(str(lString))
#====================================================
#================== ImportScene.py ===================
#====================================================
def DisplayMetaData(self,pScene):
sceneInfo = pScene.GetSceneInfo()
if sceneInfo:
self.DebugLog("--------------------")
self.DebugLog(" Meta-Data ")
self.DebugLog("--------------------")
self.DebugLog(" 00100 Title : " + str( sceneInfo.mTitle.Buffer () ) )
self.DebugLog(" 00200 Subject : " + str( sceneInfo.mSubject.Buffer () ) )
self.DebugLog(" 00300 Author : " + str( sceneInfo.mAuthor.Buffer () ) )
self.DebugLog(" 00400 Keywords: " + str( sceneInfo.mKeywords.Buffer () ) )
self.DebugLog(" 00500 Revision: " + str( sceneInfo.mRevision.Buffer () ) )
self.DebugLog(" 00600 Comment : " + str( sceneInfo.mComment.Buffer () ) )
thumbnail = sceneInfo.GetSceneThumbnail()
if thumbnail:
self.DebugLog(" Thumbnail:")
if thumbnail.GetDataFormat() == FbxThumbnail.eRGB_24 :
self.DebugLog(" Format: RGB")
elif thumbnail.GetDataFormat() == FbxThumbnail.eRGBA_32:
self.DebugLog(" Format: RGBA")
if thumbnail.GetSize() == FbxThumbnail.eNOT_SET:
self.DebugLog(" Size: no dimensions specified ("+ str( thumbnail.GetSizeInBytes() ) +" bytes)")
elif thumbnail.GetSize() == FbxThumbnail.e64x64:
self.DebugLog(" Size: 64 x 64 pixels ("+ str( thumbnail.GetSizeInBytes() ) +" bytes)")
elif thumbnail.GetSize() == FbxThumbnail.e128x128:
self.DebugLog(" Size: 128 x 128 pixels ("+ str( thumbnail.GetSizeInBytes() ) +" bytes)")
def DisplayContent(self,pScene):
lNode = pScene.GetRootNode()
if lNode:
for i in range(lNode.GetChildCount()):
self.DisplayNodeContent(lNode.GetChild(i))
def DisplayNodeContent(self,pNode):
if pNode.GetNodeAttribute() == None:
self.DebugLog("NULL Node Attribute \n")
else:
lAttributeType = ( pNode.GetNodeAttribute().GetAttributeType() )
if lAttributeType == FbxNodeAttribute.eMarker:
self.DisplayMarker(pNode)
elif lAttributeType == FbxNodeAttribute.eSkeleton:
DisplaySkeleton(pNode)
elif lAttributeType == FbxNodeAttribute.eMesh:
self.DisplayMesh(pNode)
elif lAttributeType == FbxNodeAttribute.eNurbs:
self.DisplayNurb(pNode)
elif lAttributeType == FbxNodeAttribute.ePatch:
self.DisplayPatch(pNode)
elif lAttributeType == FbxNodeAttribute.eCamera:
self.DisplayCamera(pNode)
elif lAttributeType == FbxNodeAttribute.eLight:
self.DisplayLight(pNode)
DisplayUserProperties(pNode)
self.DisplayTarget(pNode)
DisplayPivotsAndLimits(pNode)
self.DisplayTransformPropagation(pNode)
self.DisplayGeometricTransform(pNode)
for i in range(pNode.GetChildCount()):
self.DisplayNodeContent( pNode.GetChild(i) )
def DisplayTarget(self,pNode):
if pNode.GetTarget():
self.DisplayString(" Target Name: ", pNode.GetTarget().GetName())
def DisplayTransformPropagation(self,pNode):
self.DebugLog(" Transformation Propagation")
# Rotation Space
lRotationOrder = pNode.GetRotationOrder(FbxNode.eSourcePivot)
self.DebugLog(" Rotation Space:")
if lRotationOrder == eEulerXYZ:
self.DebugLog("Euler XYZ")
elif lRotationOrder == eEulerXZY:
self.DebugLog("Euler XZY")
elif lRotationOrder == eEulerYZX:
self.DebugLog("Euler YZX")
elif lRotationOrder == eEulerYXZ:
self.DebugLog("Euler YXZ")
elif lRotationOrder == eEulerZXY:
self.DebugLog("Euler ZXY")
elif lRotationOrder == eEulerZYX:
self.DebugLog("Euler ZYX")
elif lRotationOrder == eSphericXYZ:
self.DebugLog("Spheric XYZ")
# Use the Rotation space only for the limits
# (keep using eEULER_XYZ for the rest)
if pNode.GetUseRotationSpaceForLimitOnly(FbxNode.eSourcePivot):
self.DebugLog(" Use the Rotation Space for Limit specification only: Yes")
else:
self.DebugLog(" Use the Rotation Space for Limit specification only: No")
# Inherit Type
lInheritType = pNode.GetTransformationInheritType()
self.DebugLog(" Transformation Inheritance:")
if lInheritType == FbxTransform.eInheritRrSs:
self.DebugLog("RrSs")
elif lInheritType == FbxTransform.eInheritRSrs:
self.DebugLog("RSrs")
elif lInheritType == FbxTransform.eInheritRrs:
self.DebugLog("Rrs")
def DisplayGeometricTransform(self,pNode):
print(" Geometric Transformations")
# Translation
lTmpVector = pNode.GetGeometricTranslation(FbxNode.eSourcePivot)
self.DebugLog(" Translation: "+ str(lTmpVector[0])+","+str( lTmpVector[1])+","+ str(lTmpVector[2]) )
# Rotation
lTmpVector = pNode.GetGeometricRotation(FbxNode.eSourcePivot)
#print(" Rotation: %f %f %f" % (lTmpVector[0], lTmpVector[1], lTmpVector[2]))
self.DebugLog(" Rotation: "+ str(lTmpVector[0])+","+str( lTmpVector[1])+","+ str(lTmpVector[2]) )
# Scaling
lTmpVector = pNode.GetGeometricScaling(FbxNode.eSourcePivot)
#print(" Scaling: %f %f %f" % (lTmpVector[0], lTmpVector[1], lTmpVector[2]))
self.DebugLog(" Scaling: "+ str(lTmpVector[0])+","+str( lTmpVector[1])+","+ str(lTmpVector[2]) )
#====================================================
#================== ImportScene.py ===================
#====================================================
Yen="\\"
FileName= "ImportScene_00100__Log.csv"
#print("HD FULL PATH =")
#HD_FULL_PATH=os.path.abspath(__file__)
#print("os.path.abspath(__file__) = " + HD_FULL_PATH)
FullPass_DustDataTextFile_TXT= "D:"+Yen+"vs"+Yen+"py"+Yen+FileName
def ImportScene_00100(self):
print("ImportScene_00100_Start............. filepath = "+str(filepath))
#self.FullPass_DustDataTextFile_TXT=filepath
#文字をエスケープする/エスケープを外す ///////////////////////http://lightson.dip.jp/zope/ZWiki/053_e6_96_87_e5_ad_97_e3_82_92_e3_82_a8_e3_82_b9_e3_82_b1_e3_83_bc_e3_83_97_e3_81_99_e3_82_8b_ef_bc_8f_e3_82_a8_e3_82_b9_e3_82_b1_e3_83_bc_e3_83_97_e3_82_92_e5_a4_96_e3_81_99
def escape(self,s, quoted=u'\'"\\', escape=u'\\'):
return re.sub(u'[%s]' % re.escape(quoted),lambda mo: escape + mo.group(),s)
def unescape(self,s, quoted=u'\'"\\', escape=u'\\'):
return re.sub(ur'%s([%s])' % (re.escape(escape), re.escape(quoted)),ur'\1',s)
def DebugLog(self,strData):
mystr=strData
print(mystr)
if mystr=="":
print("DebugLog (mystr ) is empty....................")
else:
#mystr=str(mystr)+","
mystr=str(mystr)+"\n"
#mystr=mystr+"\n"
escapedStrData=self.escape(mystr)
self.fileReWrite(self.FullPass_DustDataTextFile_TXT,escapedStrData)
#fileReWrite(FullPass_DustDataTextFile_TXT,mystr)
#fileWrite(FullPass_DustDataTextFile_TXT,mystr)
#fileWrite("C:\Users\akiyaman\AppData\Roaming\Adobe\Common","ABC")
#----------------ファイルを作る------------------
def ExportWrite(self,strData):
strData_str=str(strData)
e_infinity_str_first_to_end_count=strData_str.find("e")
new_float_string= strData_str
if e_infinity_str_first_to_end_count==-1:
new_float_string= strData_str
else:
new_float_string= strData_str[0:e_infinity_str_first_to_end_count]
#new_float_string= strData_str[0:4]
self.DebugLog(new_float_string)
def fileWrite(self,fullPass,DataStr):
print("fileWrite fullPass= "+fullPass)
print("fileWrite DataStr= "+DataStr)
f = open(fullPass, 'w') # 書き込みモードで開く
#str = "This Data is Temp Please Delete" # 書き込む文字列
#f = open('text.txt', 'w') # 書き込みモードで開く
#f.write(str) # 引数の文字列をファイルに書き込む
f.write(DataStr) # 引数の文字列をファイルに書き込む
f.close() # ファイルを閉じる
def fileDataZeroReset(self):
self.fileWrite(self.FullPass_DustDataTextFile_TXT,"")
def fileReWrite(self,fullPass,DataStr):
print("fileWrite fullPass= "+fullPass)#///////////////////////////////////////////////////////////////////////////////////////////////////////////
print("fileWrite DataStr= "+DataStr)
f = open(fullPass, 'a') # 追記書き込みモードで開く
#str = "This Data is Temp Please Delete" # 書き込む文字列
#f = open('text.txt', 'w') # 書き込みモードで開く
#f.write(str) # 引数の文字列をファイルに書き込む
f.write(DataStr) # 引数の文字列をファイルに書き込む
f.close() # ファイルを閉じる
def fileWriteTemp(self,fullPass):
fileWrite(fullPass,"DustDataTextFile")
#//////////////////////////////////////////////////////////////////////////////////////////////////
#//////////////////////////////////// Class Unit Test /////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////////////////////////////////
def getClassName(self):
print( u"className= " + self.__class__.__name__)
return self.__class__.__name__
class TxtReaderTrans_Z_00320() :
def fileRead(self,filepath):
print("088 fileRead() filepath = "+str(filepath))
returnData=""
f = open(filepath, 'r')
#returnData = f
poolStr=""
for row in f:
print row
poolStr=poolStr+row
f.close()
print("099 fileRead() poolStr = "+poolStr)
returnData=str(poolStr)
print("101 fileRead() returnData = "+returnData)
return returnData
def ReadTransFile(self):
returnData=""
ImportScene_00100_Instance = ImportScene_00100()
returnData =self.fileRead(ImportScene_00100_Instance.FullPass_DustDataTextFile_TXT)
print("107 ReadSimple() returnData = "+ str(returnData))
return returnData
#//////////////////////////////////////////////////////////////////////////////////////////////////
#//////////////////////////////////// Class Unit Test /////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////////////////////////////////
def getClassName(self):
print( u"className= " + self.__class__.__name__)
return self.__class__.__name__
ImportScene_00100_Instance = ImportScene_00100() # Class export instance.
print(" ImportScene_00100 Class __name__="+__name__)
#//////////////////////////////////////////////////////////////////////////////////////////////////
#//////////////////////////////////// Class Unit Test /////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////////////////////////////////
def DebugLog(DataStr):
ImportScene_00100_Instance.DebugLog( str(DataStr) )
def StartMainLine(ImportScene_00100_Instance):
print("StartMainLine")
ImportScene_00100_Instance.fileDataZeroReset()
# Prepare the FBX SDK.
#lSdkManager, lScene = InitializeSdkObjects()
Yen="\\"
IMPORT_FBX_FileName ="walkTest.fbx"
FBX_FILE_PATH_AND_NAME_AND_EXT= "D:"+Yen+"vs"+Yen+"py"+Yen+IMPORT_FBX_FileName
manager = FbxManager.Create()
ios = FbxIOSettings.Create(manager, IOSROOT)
manager.SetIOSettings(ios)
importer = FbxImporter.Create(manager, "")
fbxImportSuccesBool=importer.Initialize(FBX_FILE_PATH_AND_NAME_AND_EXT, -1, manager.GetIOSettings())
#DebugLog("fbxImportSuccesBool=")
if not fbxImportSuccesBool:
DebugLog("fbxImportSuccesBool==False")
print ("==============Failed to load file.==============")
return
else:
DebugLog("fbxImportSuccesBool==True")
scene = FbxScene.Create(manager, "MyScene")
lScene=scene
importer.Import(scene)
#==========================================================
#importScene.py Timeing
#==========================================================
ImportScene_00100_Instance.DisplayMetaData(lScene)
DebugLog("\n\n---------------------\nGlobal Light Settings\n---------------------\n")
DisplayGlobalLightSettings(lScene)
DebugLog("\n\n----------------------\nGlobal Camera Settings\n----------------------\n")
DisplayGlobalCameraSettings(lScene)
DebugLog("\n\n--------------------\nGlobal Time Settings\n--------------------\n")
DisplayGlobalTimeSettings(lScene.GetGlobalSettings())
DebugLog("\n\n---------\nHierarchy\n---------\n")
DisplayHierarchy(lScene)
DebugLog("\n\n------------\nNode Content\n------------\n")
ImportScene_00100_Instance.DisplayContent(lScene)
DebugLog("\n\n----\nPose\n----\n")
#ImportScene_00100_Instance.DisplayPose(lScene)
DebugLog("\n\n---------\nAnimation\n---------\n")
#ImportScene_00100_Instance.DisplayAnimation(lScene)
#now display generic information
DebugLog("\n\n---------\nGeneric Information\n---------\n")
#ImportScene_00100_Instance.DisplayGenericInfo(lScene)
#ImportScene_00100_Instance.ExportWrite("0.111");
#ImportScene_00100_Instance.ExportWrite("0.222");
#ImportScene_00100_Instance.ExportWrite("0.333");
#ImportScene_00100_Instance.ExportWrite("0.444");
"""
#=============================================================================
print("========================= Write Start==========================")
floatList = [1.111, 1.222, 1.333, 1.444, 1.555]
floatListLength=len(floatList)
for i in range(0, floatListLength):
print( str(i) )
print(floatList[i])
floatNum=floatList[i]
floatNumstr=str(floatNum)
#ImportScene_00100_Instance.ExportWrite("0.111");
ImportScene_00100_Instance.ExportWrite( str(floatNumstr) );
#=============================================================================
print("========================= Read Start==========================")
ImportScene_00100_Instance2 = TxtReaderTrans_Z_00320() # Class export instance.
TransZstrData = ImportScene_00100_Instance2.ReadTransFile()
TransZstr=str(TransZstrData)
print("TransZstr = _ "+str(TransZstr)+" _ END ")
print("========================= add list Start==========================")
TransZstrList=TransZstr.split(",") # 「,」を区切り文字としてリストを返す
print("TransZstrList = _ "+str(TransZstrList)+" _ END ")
TransZstrListLength=len(TransZstrList)
print("TransZstrListLength = "+str(TransZstrListLength))
#==========================================
#==========================================
TransZ_list = [0]
#指定のインデックスの要素を削除する
TransZ_list.pop(0)
#----------------------------------------------
for j in range(0, TransZstrListLength):
print( "TransZ Loop "+str(j) )
print(TransZstrList[j])
TransZnumStr=TransZstrList[j]
print("TransZnumStr= "+TransZnumStr)
if(TransZnumStr == ""):
print("TransZ empty string ")
else:
TransZnumFloat=float(TransZnumStr)
TransZ_list.append(TransZnumFloat)
#===================TransZ_list debug==============================
print("========================= =TransZ_list debug Start==========================")
TransZ_listLength=len(TransZ_list)
for d in range(0, TransZ_listLength):
print( "TransZ_list Loop Debug "+str(d) )
TransZnumFloat_d=TransZ_list[d]
TransZnumStr_d = str(TransZnumFloat_d)
print("TransZnumStr_d = "+TransZnumStr_d)
#DebugLog (u"__name__==self.__class__.__name__ Same!! File Test")
#DebugLog (u"=============Simple Single Class Unit Test Start==========")
#Instance.ImportScene_00100() #Call Method
"""
#//////////////////////////////////////////////////////////////////////////////////////////////////
#////////////////////////////////////ImportScene_00100_Instance Class Unit Test /////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////////////////////////////////
if(__name__ == ImportScene_00100_Instance.getClassName()):
print (u"=============Simple Single Class Unit Test Start====Instance.getClassName() = "+ImportScene_00100_Instance.getClassName()+" =====")
#StartMainLine(ImportScene_00100_Instance)
elif(__name__ == "ImportScene_00100"):
print (u"=============Simple Single Class Unit Test Start===== StartMainLine =====")
StartMainLine(ImportScene_00100_Instance)
#Instance.loadFile(FBX_FILE_PATH_AND_NAME_AND_EXT)
elif(__name__ == "__main__"):
print (u"=============Simple Single Class Unit Test Start===== __main__ =====")
StartMainLine(ImportScene_00100_Instance)
else:
print (u"__name__!=self.__class__.__name__ Othor File Import")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment