Results 1 to 7 of 7

Thread: Is it valid to set ID empty string?

  1. #1

    Is it valid to set ID empty string?

    I was exported a mesh via Windows 10's 3D builder, I coulnd't remember how to convert it to COLLADA. The exported COLLADA contains empty ID/Target: <geometry id="" name=""> and <instance_geometry url="#"> :

    Code :
    <library_geometries>
      <geometry id="" name="">
       <mesh>
          ...
       </mesh>
      </geometry>
     
     <library_visual_scenes>
      <visual_scene id="scene6">
       <node id="node7" name="">
        <instance_geometry url="#">...</instance_geometry>
       </node>
      </visual_scene>
     </library_visual_scenes>

    Somehow Apple's Preview shows the mesh correctly, but Blender cannot import this mesh like me. Because I wrote custom Red Black Tree with nullNode s and nullNode->key is equal to empty string :/ if empty id is valid then I must add some if statements. Xcode imported the node successfully as <untitled> node and renders correctly
    Last edited by recpas; 01-11-2017 at 10:24 AM.

  2. #2
    Don't expect much from Blender's setup!

    First of all, id="" is not meaningful and is not valid XML I believe, since it is equivalent to not defining the attribute. In any case, it isn't a "normalized" representation of the attribute.

    url="#" means "use this document." An xs:anyURI data type is an opaque resource, which means the application is free to interpret it as it likes. So technically Blender is correct, since it doesn't have to follow any URL.

    What <geometry> that URL refers to, I don't know enough to tell you. I'd have to read the manual to see if that means all geometry in the document, or just like the first geometry in the first library_geometries node.

    EDITED: It occurred to me I am probably being opaque. To answer your question, NO, url="#" does not reference id="" since that is not a valid ID. IDs also should be xs:NCName types, meaning they cannot begin with a number and some other restrictions. A trick I use is to add 'A' to the first digit so it becomes a letter.
    Last edited by Mick P.; 01-12-2017 at 09:49 AM.
    This account can Moderator spam in the COLLADA forum.
    ColladaDOM 3 (COLLADA-DOM 2016)
    https://sourceforge.net/p/collada-do...ussion/531263/

  3. #3
    Separate question; is that the "3D Objects" folder in Windows 10? Does it work well with COLLADA? Does it have a plug-in API? If you don't know, no need to say so.
    This account can Moderator spam in the COLLADA forum.
    ColladaDOM 3 (COLLADA-DOM 2016)
    https://sourceforge.net/p/collada-do...ussion/531263/

  4. #4
    EDITED: It occurred to me I am probably being opaque. To answer your question, NO, url="#" does not reference id="" since that is not a valid ID. IDs also should be xs:NCName types, meaning they cannot begin with a number and some other restrictions. A trick I use is to add 'A' to the first digit so it becomes a letter.
    It seems Apple think url="#" refers to id="" this is why Xcode and Apple Preview.app render the hexagon correctly

    Separate question; is that the "3D Objects" folder in Windows 10? Does it work well with COLLADA? Does it have a plug-in API? If you don't know, no need to say so.
    I'm using Window 10 Preview virtually on my MacOS. I couldn't remember early versions of 3D Builder supported COLLADA or not but now it seems it is not! They tried to create or adopted new 3D format (3mf). I think it is worse than COLLADA, they simulated COLLADA's ZAE format ZAE->3mf unzip it and you see crap XML. They defined every triangle with XML tag, every position with separate attrib:

    <triangles>
    <triangle v1="0" v2="1" v3="2" />
    <triangle v1="3" v2="0" v3="2" />

    Hexagon Shape.3mf is 10KB
    shape_hexagon.dae is 5KB
    shape_hexagon.stl is 1KB

    Maybe they are working on COLLADA plug-in maybe not, but I think they should support COLLADA. Anyway I think/guess they will support glTF on this app

  5. #5
    I don't know, it seems very stereolithography oriented, which is what I assumed it was, and what it obviously is, as 3-D printing is slowly becoming a household product. Thanks for the information!

    P.S. How XML files are laid out is not super important because they can and should be compressed; but what is slightly more important is how they are represented in-memory. COLLADA has some questionable uses of elements where it seems like attributes and just fewer elements would be more appropriate, but if you think about it you can come up with concerns that might have been flitting trough the designers' minds. Still in-memory there's considerable overhead for elements since they must be able to contain comments for example and many other things, so there are always going to be several bytes of overhead if an element is chosen over an attribute, or if there are elements that seem like they could have been combined or collapsed into each other. (That basically serve no present purpose; That one wonders if they are for some future purpose, or if the designers were just thinking open-endedly during the design process and failed to go back and erase their marks.)
    This account can Moderator spam in the COLLADA forum.
    ColladaDOM 3 (COLLADA-DOM 2016)
    https://sourceforge.net/p/collada-do...ussion/531263/

  6. #6
    I gotta admit though; the design of "<triangle>" I don't get. It reminds me of the joke here (http://stackoverflow.com/questions/1...ta-in-xml?rq=1) from when I was working on hexBinary for COLLADA-DOM:

    <DATA>
    <BINARY>
    <BIT index="0">0</BIT>
    <BIT index="1">0</BIT>
    <BIT index="2">1</BIT>
    ...
    <BIT index="n">1</BIT>
    </BINARY>
    </DATA>
    This account can Moderator spam in the COLLADA forum.
    ColladaDOM 3 (COLLADA-DOM 2016)
    https://sourceforge.net/p/collada-do...ussion/531263/

  7. #7
    PS: It really seems a joke I think COLLADA arrays are better than <triangle> even compressions or other reasons. Because in the future next gen CPUs may parse all array (or single string->float,int) with single CPU instruction like SIMD. IIRC Intel is working on somethins like this, I saw on Intel's forum I guess . COLLADA is not runtime format no doubt! but it can be very fast! I won't wait new CPU instructions after I finished all core lib, I'll try to parse string-to-number array e.g positions<float_array>, indices <p> (strtof, strtod, strtol) with loop, I mean with single call e.g strtof_array, all float/integer array will be parsed and converted to number with loop instead of function call(strtok/strtof) inside loop, maybe there are libs for this I'll check it, or compiler may already do this job I don't know yet
    Last edited by recpas; 01-14-2017 at 02:13 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean