<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI Emoji";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
@font-face
        {font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
p.elementtoproof, li.elementtoproof, div.elementtoproof
        {mso-style-name:elementtoproof;
        margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle22
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Don,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You should think of it as me extending Maya functionality, not me extending x3d.py functionality.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Unfortunately, the fancy schmantzy code I’m writing for Maya requires me to add x3d.py functionality to Maya nodes so I can do fancy GUI-based X3D Route creation in the Maya Node Editor.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Not planning on changing anything about x3d.py, I just want to add x3d.py functionality to Maya nodes.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Aaron<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Brutzman, Donald (Don) (CIV) <brutzman@nps.edu>
<br>
<b>Sent:</b> Wednesday, January 15, 2025 11:25 AM<br>
<b>To:</b> Extensible 3D (X3D) Graphics public discussion <x3d-public@web3d.org><br>
<b>Cc:</b> Bergstrom, Aaron <aaron.bergstrom@und.edu><br>
<b>Subject:</b> Re: [x3d-public] Question about a Python and x3d.py Error message<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black">Hey guys, "please don't go there."  You should never need to poke around with __init__ or inheritance or any of that internal stuff.  Those code patterns are autogenerated, so you don't have to
 do any of that.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black">Just build a scene graph.  The vocabulary is simply X3D.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black">Corrolary:   "creativity is punished"   </span><span style="font-family:"Segoe UI Emoji",sans-serif;color:black">😨</span><span style="font-family:Aptos;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
</div>
<div id="Signature">
<p><span style="font-size:9.0pt;font-family:"Courier New"">all the best, Don</span><o:p></o:p></p>
<p><span style="font-size:9.0pt;font-family:"Courier New"">--</span><o:p></o:p></p>
<p><span style="font-size:9.0pt;font-family:"Courier New"">Don Brutzman  Naval Postgraduate School, Code USW/Br       
<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a></span><o:p></o:p></p>
<p><span style="font-size:9.0pt;font-family:"Courier New"">Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149</span><o:p></o:p></p>
<p><span style="font-size:9.0pt;font-family:"Courier New"">X3D graphics, virtual worlds, navy robotics
<a href="https://faculty.nps.edu/brutzman">https://faculty.nps.edu/brutzman</a></span><o:p></o:p></p>
<p><span style="font-size:9.0pt;font-family:"Courier New""> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Aptos;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> x3d-public <<a href="mailto:x3d-public-bounces@web3d.org">x3d-public-bounces@web3d.org</a>> on behalf of Bergstrom, Aaron via x3d-public <<a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>><br>
<b>Sent:</b> Wednesday, January 15, 2025 9:03 AM<br>
<b>To:</b> Extensible 3D (X3D) Graphics public discussion <<a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>><br>
<b>Cc:</b> Bergstrom, Aaron <<a href="mailto:aaron.bergstrom@und.edu">aaron.bergstrom@und.edu</a>><br>
<b>Subject:</b> Re: [x3d-public] Question about a Python and x3d.py Error message</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<p>Apparently, I’m a bit out of my depth when it comes to multi class inheritance. Not really a good tutorial out there for mixing inheritance from Maya python classes and other classes. I’m getting another error now.<o:p></o:p></p>
<p>“'X3DScene' object has no attribute '_Scene__children'”<o:p></o:p></p>
<p> <o:p></o:p></p>
<p class="elementtoproof">Looking up similar errors in Google basically tells me I’m not calling the inherited classes __init__ methods.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>I’ll have to do some more digging.<o:p></o:p></p>
<p> <o:p></o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p><b>From:</b> John Carlson <<a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a>><br>
<b>Sent:</b> Wednesday, January 15, 2025 10:52 AM<br>
<b>To:</b> Extensible 3D (X3D) Graphics public discussion <<a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>><br>
<b>Cc:</b> Bergstrom, Aaron <<a href="mailto:aaron.bergstrom@und.edu">aaron.bergstrom@und.edu</a>><br>
<b>Subject:</b> Re: [x3d-public] Question about a Python and x3d.py Error message<o:p></o:p></p>
</div>
<p> <o:p></o:p></p>
<p>self is the first parameter to instance methods.  I don’t know about class methods.  My guess is you might want instance methods, but it’s your design.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>On Wed, Jan 15, 2025 at 10:37 AM Bergstrom, Aaron via x3d-public <<u><span style="color:blue"><a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a></span></u>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p>John,<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Thanks for responding.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>So in the case of the code below, would the instance method be the “def creator(cls):” method? If so, would I think do the following: “def creator(cls, self):”<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Or am I not understanding what you are saying?<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Thanks,<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Aaron<o:p></o:p></p>
<p> <o:p></o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p><b>From:</b> John Carlson <<u><span style="color:blue"><a href="mailto:yottzumm@gmail.com">yottzumm@gmail.com</a></span></u>><br>
<b>Sent:</b> Wednesday, January 15, 2025 10:12 AM<br>
<b>To:</b> Extensible 3D (X3D) Graphics public discussion <<u><span style="color:blue"><a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a></span></u>><br>
<b>Cc:</b> Bergstrom, Aaron <<u><span style="color:blue"><a href="mailto:aaron.bergstrom@und.edu">aaron.bergstrom@und.edu</a></span></u>><br>
<b>Subject:</b> Re: [x3d-public] Question about a Python and x3d.py Error message<o:p></o:p></p>
</div>
<p> <o:p></o:p></p>
<p>Aaron, AFAIK, you need “self” as the first parameter in your instance methods (not functions, of course).  I don’t know about class methods.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>If you’re familiar with Java or C++, this is similar to “this”.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>On Wed, Jan 15, 2025 at 10:02 AM Bergstrom, Aaron via x3d-public <<u><span style="color:blue"><a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a></span></u>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p>I need help troubleshooting a x3d.py error message.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>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<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>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.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>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.<o:p></o:p></p>
<p> <o:p></o:p></p>
<p># Error: TypeError: file C:\Users\<u><span style="color:blue"><a href="http://user.name/">user.name</a></span></u>\AppData\Roaming\Python\Python311\site-packages\x3d\x3d.py line 14984: Scene.hasChild() missing 1 required positional argument: 'self' #<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Can anyone with some Python experience give me an idea of what I am doing wrong here?<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>Here is the code:<o:p></o:p></p>
<p>#################################################################<o:p></o:p></p>
<p>import x3d<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>import maya.api.OpenMaya as aom<o:p></o:p></p>
<p>import maya.api.OpenMayaUI as aomui<o:p></o:p></p>
<p>import maya.api.OpenMayaRender as aomr<o:p></o:p></p>
<p> <o:p></o:p></p>
<p># import xmltodict<o:p></o:p></p>
<p># import json<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>class X3DScene (aom.MPxNode, x3d.Scene):<o:p></o:p></p>
<p>    TYPE_NAME    = "Scene"<o:p></o:p></p>
<p>    TYPE_ID      = aom.MTypeId(0x00108FFF)<o:p></o:p></p>
<p>    PROFILE_TYPE = "Full"<o:p></o:p></p>
<p>    VERSION      = "4.0"<o:p></o:p></p>
<p> <o:p></o:p></p>
<p>    def __init__(self):<o:p></o:p></p>
<p>        super(X3DScene, self).__init__()<o:p></o:p></p>
<p>       <o:p></o:p></p>
<p>    @classmethod<o:p></o:p></p>
<p>    def creator(cls):<o:p></o:p></p>
<p>        return X3DScene()<o:p></o:p></p>
<p>       <o:p></o:p></p>
<p>    @classmethod<o:p></o:p></p>
<p>    def initialize(cls):<o:p></o:p></p>
<p>        cls.x3dDoc = x3d.X3D(profile=cls.PROFILE_TYPE, version=cls.VERSION)<o:p></o:p></p>
<p>        cls.x3dDoc.Scene = cls<o:p></o:p></p>
<p>        #######################################################<o:p></o:p></p>
<p>        # Test dump to make sure the class works as expected<o:p></o:p></p>
<p>        #print(json.dumps(xmltodict.parse(cls.x3dDoc.XML()), indent=4))<o:p></o:p></p>
<p>        print(cls.x3dDoc.XML())<o:p></o:p></p>
<p>_______________________________________________<br>
x3d-public mailing list<br>
<u><span style="color:blue"><a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a></span></u><br>
<u><span style="color:blue"><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></span></u><o:p></o:p></p>
</blockquote>
<p>_______________________________________________<br>
x3d-public mailing list<br>
<u><span style="color:blue"><a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a></span></u><br>
<u><span style="color:blue"><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></span></u><o:p></o:p></p>
</blockquote>
</div>
</body>
</html>