[x3d-public] Question about a Python and x3d.py Error message
Bergstrom, Aaron
aaron.bergstrom at und.edu
Wed Jan 15 08:01:45 PST 2025
I need help troubleshooting a x3d.py error message.
In developing a Python version of the Rawkee X3D exporter plugin for Maya, I am attempting to create nodes that inherit from both the Maya Python API 2.0 and x3d.py
As such, I have a question about python and multiple class inheritance, and an error I am seeing. Admittedly, I am not the strongest Python programmer.
I am getting the following error when I execute the Python code in Maya, and I'm pretty sure I do not of the __init__() function setup correctly.
# Error: TypeError: file C:\Users\user.name\AppData\Roaming\Python\Python311\site-packages\x3d\x3d.py line 14984: Scene.hasChild() missing 1 required positional argument: 'self' #
Can anyone with some Python experience give me an idea of what I am doing wrong here?
Here is the code:
#################################################################
import x3d
import maya.api.OpenMaya as aom
import maya.api.OpenMayaUI as aomui
import maya.api.OpenMayaRender as aomr
# import xmltodict
# import json
class X3DScene (aom.MPxNode, x3d.Scene):
TYPE_NAME = "Scene"
TYPE_ID = aom.MTypeId(0x00108FFF)
PROFILE_TYPE = "Full"
VERSION = "4.0"
def __init__(self):
super(X3DScene, self).__init__()
@classmethod
def creator(cls):
return X3DScene()
@classmethod
def initialize(cls):
cls.x3dDoc = x3d.X3D(profile=cls.PROFILE_TYPE, version=cls.VERSION)
cls.x3dDoc.Scene = cls
#######################################################
# Test dump to make sure the class works as expected
#print(json.dumps(xmltodict.parse(cls.x3dDoc.XML()), indent=4))
print(cls.x3dDoc.XML())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20250115/267311fd/attachment.html>
More information about the x3d-public
mailing list