mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
remove CLASS_REMAP, use __init__ as constructor name
This commit is contained in:
parent
d1e912e5e7
commit
fff971a04c
@ -17,40 +17,6 @@ All use of this software is subject to the terms of the revised BSD
|
|||||||
license. You should have received a copy of this license along
|
license. You should have received a copy of this license along
|
||||||
with this source code in a file named \"LICENSE.\"""".split("\n")
|
with this source code in a file named \"LICENSE.\"""".split("\n")
|
||||||
|
|
||||||
# Copied from interrogateMakerPythonNative.cxx.
|
|
||||||
CLASS_REMAP = {
|
|
||||||
"Loader" : "PandaLoader",
|
|
||||||
"LMatrix4f" : "Mat4",
|
|
||||||
"LMatrix3f" : "Mat3",
|
|
||||||
"LVecBase4f" : "VBase4",
|
|
||||||
"LVector4f" : "Vec4",
|
|
||||||
"LPoint4f" : "Point4",
|
|
||||||
"LVecBase3f" : "VBase3",
|
|
||||||
"LVector3f" : "Vec3",
|
|
||||||
"LPoint3f" : "Point3",
|
|
||||||
"LVecBase2f" : "VBase2",
|
|
||||||
"LVector2f" : "Vec2",
|
|
||||||
"LPoint2f" : "Point2",
|
|
||||||
"LQuaternionf" : "Quat",
|
|
||||||
"LMatrix4d" : "Mat4D",
|
|
||||||
"LMatrix3d" : "Mat3D",
|
|
||||||
"LVecBase4d" : "VBase4D",
|
|
||||||
"LVector4d" : "Vec4D",
|
|
||||||
"LPoint4d" : "Point4D",
|
|
||||||
"LVecBase3d" : "VBase3D",
|
|
||||||
"LVector3d" : "Vec3D",
|
|
||||||
"LPoint3d" : "Point3D",
|
|
||||||
"LVecBase2d" : "VBase2D",
|
|
||||||
"LVector2d" : "Vec2D",
|
|
||||||
"LPoint2d" : "Point2D",
|
|
||||||
"LQuaterniond" : "QuatD",
|
|
||||||
"Plane" : "PlaneBase",
|
|
||||||
"Planef" : "Plane",
|
|
||||||
"Planed" : "PlaneD",
|
|
||||||
"Frustum" : "FrustumBase",
|
|
||||||
"Frustumf" : "Frustum",
|
|
||||||
"Frustumd" : "FrustumD" }
|
|
||||||
|
|
||||||
libraries = {}
|
libraries = {}
|
||||||
for m, lib in panda3d.modules.items():
|
for m, lib in panda3d.modules.items():
|
||||||
if not isinstance(lib, str):
|
if not isinstance(lib, str):
|
||||||
@ -88,7 +54,6 @@ def comment(code):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
def translateFunctionName(name):
|
def translateFunctionName(name):
|
||||||
name = CLASS_REMAP.get(name, name)
|
|
||||||
new = ""
|
new = ""
|
||||||
for i in name.split("_"):
|
for i in name.split("_"):
|
||||||
if new == "":
|
if new == "":
|
||||||
@ -103,12 +68,6 @@ def translateFunctionName(name):
|
|||||||
|
|
||||||
def translated_type_name(type):
|
def translated_type_name(type):
|
||||||
typename = interrogate_type_name(type)
|
typename = interrogate_type_name(type)
|
||||||
for old, new in CLASS_REMAP.items():
|
|
||||||
if typename == old:
|
|
||||||
typename = new
|
|
||||||
else:
|
|
||||||
typename = re.sub("\\b%s\\b" % old, new, typename)
|
|
||||||
|
|
||||||
typename = typename.replace("< ", "").replace(" >", "")
|
typename = typename.replace("< ", "").replace(" >", "")
|
||||||
return typename
|
return typename
|
||||||
|
|
||||||
@ -117,10 +76,6 @@ def translateTypeSpec(name):
|
|||||||
name = name.replace("BitMask< unsigned int, 32 >", "BitMask32")
|
name = name.replace("BitMask< unsigned int, 32 >", "BitMask32")
|
||||||
name = name.replace("atomic ", "")
|
name = name.replace("atomic ", "")
|
||||||
name = name.replace("< ", "").replace(" >", "")
|
name = name.replace("< ", "").replace(" >", "")
|
||||||
for old, new in CLASS_REMAP.items():
|
|
||||||
if name == old:
|
|
||||||
return new
|
|
||||||
name = re.sub("\\b%s\\b" % old, new, name)
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def processFunction(handle, function, isConstructor = False):
|
def processFunction(handle, function, isConstructor = False):
|
||||||
@ -137,7 +92,10 @@ def processFunction(handle, function, isConstructor = False):
|
|||||||
print >>handle, translateTypeSpec(translated_type_name(interrogate_wrapper_return_type(wrapper))),
|
print >>handle, translateTypeSpec(translated_type_name(interrogate_wrapper_return_type(wrapper))),
|
||||||
else:
|
else:
|
||||||
pass#print >>handle, "void",
|
pass#print >>handle, "void",
|
||||||
print >>handle, translateFunctionName(interrogate_function_name(function)) + "(",
|
|
||||||
|
print >>handle, translateFunctionName(interrogate_function_name(function)) + "(",
|
||||||
|
else:
|
||||||
|
print >>handle, "__init__(",
|
||||||
|
|
||||||
first = True
|
first = True
|
||||||
for i_param in range(interrogate_wrapper_number_of_parameters(wrapper)):
|
for i_param in range(interrogate_wrapper_number_of_parameters(wrapper)):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user