<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;}
span.EmailStyle20
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@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">All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My problem is that I want to be fancy and use as much of the existing Maya toolset as possible so as to not force Maya users to change their workflows in order to use the exporter.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m already walking the Maya scene graph and generating X3D code from it using x3d.py, but I was really hoping to using the spiffy Maya Node Editor to do scripting/routing.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">At the end of the day yesterday I had what I thought was an epiphany in that I could use the Node Editor to do that if I embedded x3d.py objects in Maya custom nodes.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So far, Maya seems to tolerate the multi inheritance just fine when I create custom nodes from multi inheritance classes, but it just that I seem to be throwing python code errors whenever I try to manipulate the X3D scenegraph. And from
what I can tell, I’m just not calling the properly calling __init__ for multiple inheritance.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">That said, I’m all for re-using code. And if you don’t mind me borrowing some of that code as long as I give everyone proper credit, I’ll probably snatch some of it as needed.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">@Don – I apologize for being creative.<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Segoe UI Emoji",sans-serif">😃</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Of course, I’m no Python programmer, so I may just be wasting my time trying to force the use of the Maya Node Editor.<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 style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> x3d-public <x3d-public-bounces@web3d.org> <b>On Behalf Of
</b>John Carlson via x3d-public<br>
<b>Sent:</b> Wednesday, January 15, 2025 11:43 AM<br>
<b>To:</b> Extensible 3D (X3D) Graphics public discussion <x3d-public@web3d.org><br>
<b>Cc:</b> John Carlson <yottzumm@gmail.com><br>
<b>Subject:</b> Re: [x3d-public] Question about a Python and x3d.py Error message<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">The issue is, I think, that Aaron has some kind of internal structure (DOM?) that he wants to convert to a x3d.py structure. He can create python and then run it separately, or try to instantiate x3d.py classes in his code.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I’m not saying this is a great approach, but you can look at Doug and my code for exporting from Blender. <o:p></o:p></p>
<div>
<p class="MsoNormal"><a href="https://github.com/coderextreme/BlenderX3DSupport/blob/main/io_scene_x3dv/blender/exp/x3dv_blender_export.py">https://github.com/coderextreme/BlenderX3DSupport/blob/main/io_scene_x3dv/blender/exp/x3dv_blender_export.py</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I’ve move back to constructing strings for now.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">John <o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Wed, Jan 15, 2025 at 11:25 AM Brutzman, Donald (Don) (CIV) via x3d-public <<a href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<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="m_-2681979249107581422Signature">
<p style="margin:0in"><span style="font-size:9.0pt;font-family:"Courier New"">all the best, Don</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-size:9.0pt;font-family:"Courier New"">--</span><o:p></o:p></p>
<p style="margin:0in"><span style="font-size:9.0pt;font-family:"Courier New"">Don Brutzman Naval Postgraduate School, Code USW/Br
<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a></span><o:p></o:p></p>
<p style="margin:0in"><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 style="margin:0in"><span style="font-size:9.0pt;font-family:"Courier New"">X3D graphics, virtual worlds, navy robotics
<a href="https://faculty.nps.edu/brutzman" target="_blank">https://faculty.nps.edu/brutzman</a></span><o:p></o:p></p>
<p style="margin:0in"><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="m_-2681979249107581422divRplyFwdMsg">
<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" target="_blank">x3d-public-bounces@web3d.org</a>> on behalf of Bergstrom, Aaron via x3d-public <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
<b>Sent:</b> Wednesday, January 15, 2025 9:03 AM</span><o:p></o:p></p>
</div>
</div>
<div>
<div id="m_-2681979249107581422divRplyFwdMsg">
<p class="MsoNormal"><span style="color:black"><br>
<b>To:</b> Extensible 3D (X3D) Graphics public discussion <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
<b>Cc:</b> Bergstrom, Aaron <<a href="mailto:aaron.bergstrom@und.edu" target="_blank">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 style="margin:0in">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 style="margin:0in">“'X3DScene' object has no attribute '_Scene__children'”<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">Looking up similar errors in Google basically tells me I’m not calling the inherited classes __init__ methods.<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">I’ll have to do some more digging.<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p style="margin:0in"><b>From:</b> John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">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" target="_blank">x3d-public@web3d.org</a>><br>
<b>Cc:</b> Bergstrom, Aaron <<a href="mailto:aaron.bergstrom@und.edu" target="_blank">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">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" target="_blank">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 style="margin:0in">John,<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">Thanks for responding.<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">Or am I not understanding what you are saying?<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">Thanks,<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">Aaron<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p style="margin:0in"><b>From:</b> John Carlson <<u><span style="color:blue"><a href="mailto:yottzumm@gmail.com" target="_blank">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" target="_blank">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" target="_blank">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">If you’re familiar with Java or C++, this is similar to “this”.<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">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" target="_blank">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 style="margin:0in">I need help troubleshooting a x3d.py error message.<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in"># Error: TypeError: file C:\Users\<u><span style="color:blue"><a href="http://user.name/" target="_blank">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 style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">Can anyone with some Python experience give me an idea of what I am doing wrong here?<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">Here is the code:<o:p></o:p></p>
<p style="margin:0in">#################################################################<o:p></o:p></p>
<p style="margin:0in">import x3d<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">import maya.api.OpenMaya as aom<o:p></o:p></p>
<p style="margin:0in">import maya.api.OpenMayaUI as aomui<o:p></o:p></p>
<p style="margin:0in">import maya.api.OpenMayaRender as aomr<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in"># import xmltodict<o:p></o:p></p>
<p style="margin:0in"># import json<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in">class X3DScene (aom.MPxNode, x3d.Scene):<o:p></o:p></p>
<p style="margin:0in"> TYPE_NAME = "Scene"<o:p></o:p></p>
<p style="margin:0in"> TYPE_ID = aom.MTypeId(0x00108FFF)<o:p></o:p></p>
<p style="margin:0in"> PROFILE_TYPE = "Full"<o:p></o:p></p>
<p style="margin:0in"> VERSION = "4.0"<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in"> def __init__(self):<o:p></o:p></p>
<p style="margin:0in"> super(X3DScene, self).__init__()<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in"> @classmethod<o:p></o:p></p>
<p style="margin:0in"> def creator(cls):<o:p></o:p></p>
<p style="margin:0in"> return X3DScene()<o:p></o:p></p>
<p style="margin:0in"> <o:p></o:p></p>
<p style="margin:0in"> @classmethod<o:p></o:p></p>
<p style="margin:0in"> def initialize(cls):<o:p></o:p></p>
<p style="margin:0in"> cls.x3dDoc = x3d.X3D(profile=cls.PROFILE_TYPE, version=cls.VERSION)<o:p></o:p></p>
<p style="margin:0in"> cls.x3dDoc.Scene = cls<o:p></o:p></p>
<p style="margin:0in"> #######################################################<o:p></o:p></p>
<p style="margin:0in"> # Test dump to make sure the class works as expected<o:p></o:p></p>
<p style="margin:0in"> #print(json.dumps(xmltodict.parse(cls.x3dDoc.XML()), indent=4))<o:p></o:p></p>
<p style="margin:0in"> print(cls.x3dDoc.XML())<o:p></o:p></p>
<p style="margin:0in">_______________________________________________<br>
x3d-public mailing list<br>
<u><span style="color:blue"><a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a></span></u><br>
<u><span style="color:blue"><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></span></u><o:p></o:p></p>
</blockquote>
<p style="margin:0in">_______________________________________________<br>
x3d-public mailing list<br>
<u><span style="color:blue"><a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a></span></u><br>
<u><span style="color:blue"><a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a></span></u><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal">_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>