Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

view3dscene/tovrml: default containerField should be properly set for nodes under HAnimHumanoid. HAnimMotion is one sub-element which should not require a containerField. It should be defaulted to "motions" #69

Closed
coderextreme opened this issue Sep 26, 2023 · 18 comments
Labels
pending feedback Waits for feedback from issue submitter

Comments

@coderextreme
Copy link

$ grep children blenderLily.x3d[nada]
$ (~/Downloads/view3dscene-4.3.0-win64-x86_64/view3dscene/tovrmlx3d.exe --validate blenderLily.x3d 2>&1) |grep children

tovrmlx3d: Warning: X3D: Unknown X3D field name (indicated by containerField value) "children" by node "HAnimJoint" inside node "HAnimHumanoid"
tovrmlx3d: Warning: X3D: Unknown X3D field name (indicated by containerField value) "children" by node "HAnimMotion" inside node "HAnimHumanoid"
tovrmlx3d: Warning: X3D: Unknown X3D field name (indicated by containerField value) "children" by node "Transform" inside node "HAnimHumanoid"

Transforms go in the skin field, AFAIK there is no other choice!
HAnimMotions goes in the motions field
HAnimJoints go in the skeleton or joints field.

John
@coderextreme coderextreme changed the title view3dscene/tovrml are not defaulting HAnimContainer containerField properly for XML. There is no "children" field view3dscene/tovrml are not defaulting HAnimHumanoid containerField properly for XML. There is no "children" field Sep 26, 2023
@michaliskambi
Copy link
Member

Please attach a testcase. The default containerField for nodes like Transform is children, so possibly the input is missing containerField declaration when the nodes are USEd.

As always, attaching a testcase is appreciated.

@coderextreme
Copy link
Author

coderextreme commented Sep 27, 2023 via email

@michaliskambi
Copy link
Member

Just remove all XML containerField attributes from an HAnimHumanoid and
children. I don't know about Transform stuff, see below. I did check
X3DChildNode and X3DNode for children...no luck with those.

I don't understand this statement. To investigate this issue, please attach a testcase as I said. As far as I know, CGE/view3dscene behave correctly: they follow the containerField specified in X3D XML specification, https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfNodes.html#HAnimJoint
. Maybe the testcase just misses containerField="xxx" usage at respective "<USE ...>" elements.

@michaliskambi michaliskambi added the pending feedback Waits for feedback from issue submitter label Sep 27, 2023
@coderextreme
Copy link
Author

KoreanCharacterMotionAnnexD01Jin.x3d.txt

Here's the attachment that didn't make it through email (I guess they don't allow attachment of .x3d extension).

@coderextreme
Copy link
Author

coderextreme commented Sep 27, 2023

containerField="children" is for children HAnimJoints of HAnimJoints. For HAnimJoints which are children of HAnimHumanoid, containerField="skeleton" or containerField="joints" are used. There's no field "children" in an HAnimHumanoid, see spec I mentioned.

@coderextreme
Copy link
Author

There's no need to specify containerField for HAnimJoint which are children of HAnimJoint.

@coderextreme
Copy link
Author

coderextreme commented Sep 27, 2023

Also, Transform (and a few other types of nodes) children of HAnimHumanoid should use containerField="skin" to make view3dscene be quiet. It would be good if view3dscene/tovrmlx3d figured that out on its own.

@coderextreme
Copy link
Author

What I'm getting at is that view3dscene should be able to figure out automatically what containerField to use for children of HAnimHumanoid, and should not report "children" which is not an acceptable field for HAnimHumanoid.

@coderextreme
Copy link
Author

Thanks for continued troubleshooting.

Please do not do anything with containerField handling in x3d.py since it is unique to XML encoding.

Don Brutzman:
"If you encounter any incorrect handling, please provide a regular issue report that notes

Model, in .x3d/.x3dv and also .py
Error or warning that was encountered, relevant tools, etc.

I can then isolate the problem and fix it. When errors do occur, it is usually an error in the scene, but sometimes a simple omission of some sort somewhere deep in the code autogeneration of the library."

I don't have any python that is a short test case, because I am building the humanoid with a Blender X3DV addon for exporting X3DV. What I will do is generate python from XML, and then present it.

@michaliskambi
Copy link
Member

The testcase is missing the needed containerField values. You need to specify them like this:

<HAnimHumanoid ...>
  <HAnimJoint DEF='hanim_humanoid_root'  containerField="skeleton">
   ....
  </HAnimJoint>

  <HAnimJoint USE='hanim_humanoid_root' containerField="joints" />
</HAnimHumanoid>

What I'm getting at is that view3dscene should be able to figure out automatically what containerField to use for children of HAnimHumanoid, and should not report "children" which is not an acceptable field for HAnimHumanoid.

That's not how X3D XML encoding works. There's no "automatic guessing" of what is the containerField of given node. Instead: The default containerField is specified by the spec (same link as in my previous post: https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/EncodingOfNodes.html#HAnimJoint ), and if you need to use a different value -- you need to specify it explicitly by adding containerField="xxx" .

Reason: Automatic guessing would be faulty sometimes -- some nodes have a few SFNode and MFNode fields, and it is not possible to always guess where should the children go. So the spec doesn't specify any logic for guessing.

  • E.g. to which field of PhysicalMaterial do you assign ImageTexture. To baseTexture , emissiveTexture, etc.?

  • To which field of HAnimHumanoid do you assign HAnimJoint? To joints or skeleton? (because they are both possible https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/components/hanim.html#HAnimHumanoid ).

    ( Though in theory automatic guessing could do different decisions depending on whether the node is USEd or not... but that would complicate the guessing even more. That is why spec says: no guessing, you need to specify containerField. )

@coderextreme
Copy link
Author

coderextreme commented Sep 27, 2023 via email

@michaliskambi
Copy link
Member

michaliskambi commented Sep 27, 2023

Yes, I know all this. Please contact Don Brutzman and tell him that x3d.py
needs to create containerFields when outputting XML, otherwise, I have to
go in for each HAnimHumanoid I create in XML and add containerFields.

I am limited in time, too, sorry. And I don't know anything about x3d.py .

If you have found a bug you believe you should report to x3d.py and/or to Don Brutzman, please report it to that project or person. You can of course send link to Don to this ticket. This is a GitHub repo for view3dscene.

@coderextreme
Copy link
Author

coderextreme commented Sep 27, 2023

I agree time is limited. I do not want to keep on editing huge HAnim files and entering containerField's. I have already posted my issues to x3d-public, and Don told me to stop posting and only post one post per day.

My suggestion for view3dscene is to stop reporting that "children" is somehow a field of HAnimHumanoid.

I consider this issue closed beyond that.

@michaliskambi
Copy link
Member

michaliskambi commented Sep 27, 2023

My suggestion for view3dscene is to stop reporting that "children" is somehow a field of HAnimHumanoid.

view3dscene says that HAnimHumanoid doesn't have "children" field. And if you don't specify the containerField in e.g. Transform or HAnimJoint, they use the default containerField equal to "children", which is wrong inside HAnimHumanoid. There's nothing to fix here from view3dscene side, we behave as spec says (as likely just like other browsers), from what I can see.

@coderextreme
Copy link
Author

coderextreme commented Nov 14, 2023

fooGrampsXML.x3d.txt

Here is an example with a missing containerField attribute for HAnimMotion which is not defaulted to "motions" by tovrmlx3d.exe. The parent of HAnimMotion is HAnimHumanoid. This remains an issue because x3d.py checks for default containerField of HAnimMotion (perhaps just for children of HAnimHumanoid???) and does not set it if it's the default (see Andreas' changes to x3d.py to add non-default containerFields).

XML Schema:

    <xs:simpleType name="containerFieldChoicesHAnimMotion">
            <xs:annotation>
                    <xs:appinfo>containerFieldChoicesHAnimMotion lists the allowed containerField enumeration values for HAnimMotion node: default "children" if parent node is a grouping node, otherwise "motions" if parent node is HAnimHumanoid.</xs:appinfo>
                    <xs:documentation source="https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#containerField"/>
            </xs:annotation>
            <xs:restriction base="xs:NMTOKEN">
                    <xs:enumeration value="children">
                            <xs:annotation>
                                    <xs:appinfo>parent node is a grouping node</xs:appinfo>
                            </xs:annotation>
                    </xs:enumeration>
                    <xs:enumeration value="motions">
                            <xs:annotation>
                                    <xs:appinfo>parent node is HAnimHumanoid</xs:appinfo>
                            </xs:annotation>
                    </xs:enumeration>
            </xs:restriction>
    </xs:simpleType>

@coderextreme coderextreme changed the title view3dscene/tovrml are not defaulting HAnimHumanoid containerField properly for XML. There is no "children" field view3dscene/tovrml containerField properly for nodes under HAnimHumanoid. HAnimMotion is one sub-element which should not require a containerField. It should be defaulted to "motions" Nov 14, 2023
@coderextreme coderextreme changed the title view3dscene/tovrml containerField properly for nodes under HAnimHumanoid. HAnimMotion is one sub-element which should not require a containerField. It should be defaulted to "motions" view3dscene/tovrml: default containerField should be properly set for nodes under HAnimHumanoid. HAnimMotion is one sub-element which should not require a containerField. It should be defaulted to "motions" Nov 14, 2023
@michaliskambi
Copy link
Member

Ack, we'll then add auto-detection of HAnimMotion.containerField.

@michaliskambi
Copy link
Member

We now automatically account for proper HAnimMotion.containerField. Testcase: https://github.com/castle-engine/demo-models/blob/master/x3d/hanimmotion_containerfield.x3d

@coderextreme
Copy link
Author

coderextreme commented Feb 8, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending feedback Waits for feedback from issue submitter
Projects
None yet
Development

No branches or pull requests

2 participants