Jump to content

Sketch Tool


Scottie Sirius

Recommended Posts

Yeah I tried a while back to figure what is wrong in the Collada file by comparing with a working one and couldn't figure what was wrong. It's broken for a long time now, would be nice if someone find the problem so we could expect a fix in an incoming release.

It could make the SketchTool quite usefull if we could export the Convex Shapes to have size reference for some modelling, without that feature, the SketchTool is quite useless :(

Link to comment
Share on other sites

I gave a closer look to the exported COllada and I think I have find what's wrong. Some space seem missing between some coordinate. Here the Position Coordinate for a base cube made with ConvexEditor:

 <float_array id="ConvexBox-Position-array" count="24">1.1940 -1.4000 1.1492-1.1940 -1.4000 1.1492-1.1940 1.4000 1.14921.1940 1.4000 1.1492-1.1940 -1.4000 -1.14921.1940 -1.4000 -1.14921.1940 1.4000 -1.1492-1.1940 1.4000 -1.1492
                   </float_array>

As you can see, some coordinate are "glued" making number with 2 dots. (-1.14921.1940). I test various 3D tool and one of them gave me a hint:

// complain if the index count doesn't fit
   if( expectedPointCount > 0 && indices.size() != expectedPointCount * numOffsets) {
       if (pPrimType == Prim_Lines) {
           // HACK: We just fix this number since SketchUp 15.3.331 writes the wrong 'count' for 'lines'
           ReportWarning( "Expected different index count in <p> element, %d instead of %d.", indices.size(), expectedPointCount * numOffsets);
           pNumPrimitives = (indices.size() / numOffsets) / 2;
       } else
           ThrowException( "Expected different index count in <p> element.");

   } else if( expectedPointCount == 0 && (indices.size() % numOffsets) != 0)
	ThrowException( "Expected different index count in <p> element.");

This is where the tool failed: Expected different index count in

element.


If you take my previous example, the count is 24 but with the bad coordinate, it doesn't fit. When you count with fixed coordinate, the result is 24. I will now attempt to fix it and see how it goes :?


EDIT: I gave up after 2 hours of trial and errors... I got my ConvexBox to load in Open3DViewer but with 3 triangles instead of 12... Something seem wrong the way T3D export the Collada, it's not just about the missing spaces in coordinate. I will need to read more about COllada format to keep investigating (Hoping someone with better skills can get through it)

Link to comment
Share on other sites

Something I did a while back to get in-game dimensions was to add a basic 1meter(unit) cube and scale it to the size I want. Then you simply set the same scaling to the cube in your 3D modelling tool. Nothing magic but it worked.


Also with the Transform Tools, you can get the dimensions of shapes so you can use a box as a ruler...

Not sure if it help, I guess you are looking for a more precise method.

Link to comment
Share on other sites

I remember dealing with this in the past and discovered a work around (back in 2010) using the Autodesk FBX converter, but was surprised to find it doesn't work anymore.

So I compared a Collada export from T3D 1.2 to the current version. Mud-H was on the right track with the spacing. It just needs to be separated line by line.


T3D 1.2

<source id="t3d1cube-Position">
                   <float_array id="t3d1cube-Position-array" count="24">
                       0.5000 -0.5000 0.5000
                       -0.5000 -0.5000 0.5000
                       -0.5000 0.5000 0.5000
                       0.5000 0.5000 0.5000
                       -0.5000 -0.5000 -0.5000
                       0.5000 -0.5000 -0.5000
                       0.5000 0.5000 -0.5000
                       -0.5000 0.5000 -0.5000
                   </float_array>

 

T3D 3.8

<source id="t3d3cube_orig-Position">
                   <float_array id="t3d3cube_orig-Position-array" count="24">0.5000 -0.5000 0.5000-0.5000 -0.5000 0.5000-0.5000 0.5000 0.50000.5000 0.5000 0.5000-0.5000 -0.5000 -0.50000.5000 -0.5000 -0.50000.5000 0.5000 -0.5000-0.5000 0.5000 -0.5000
                   </float_array>

 

Once the coordinates are separated line by line (there are 4 sections that this needs to be done), the file can be converted to FBX, then the FBX to OBJ using the latest Autodesk FBX Converter (which can be downloaded for free). Finally, the OBJ can be imported into Blender (no textures though). Obviously, editing the file line by line is way too tedious a process, so I started to delve into the source files.


At some point there were changes made in these two files (which deal with collada export information): colladaUtils.cpp and colladaUtils.h

Using WinMerge to compare the files, the differences were mostly converting 'int' to 'S32' and a 'double' to 'F64'


It would be great if a programmer could shed some light on why this would affect the line output to be one long line (with out the carriage returns). Hopefully, we can get it to function like it did in T3D 1.2 and use the converter to get our Sketch Tool creations in Blender.

Link to comment
Share on other sites

Hi Jeff.

That's correct. Even with the correct spacing, the collada file still needed to go through the conversion work around to get into Blender. (It wasn't too much of a pain since the Autodesk converter allowed for batch conversion.)


Also, I was doing some more digging last night and the collada output files changed (the spacing) with the 3.0 release. This is the release where the DIF interiors and "export DIF interior to collada" were taken out.


Finally, these files (colladaUtils.cpp and colladaUtils.h) didn't mess up the spacing as I had previously assumed. The 2.0 and 3.0 versions are the same.

Link to comment
Share on other sites

  • 1 year later...

Hey hi, I was quick reviewing this and I found the problem. I start played with the Sketch Tool and did a little more complex building and this solution fixed the load into Blender3D 2.78a and can export already dts files into Blender3D.


If you wanna tested T3D_ColladaExporter (15MB)


Open Issue: https://github.com/GarageGames/Torque3D/issues/467


Open PR: https://github.com/GarageGames/Torque3D/pull/1831

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...