Bloodknight Posted December 13, 2017 Share Posted December 13, 2017 (edited) OK, so first time playing with shape editor in any real way since I've never really needed to before now.I've created a series of models to test with Download HereNow, all appears to work perfectly wellExhibit 1Exhibit 2exhibit 3saving the result outputs the following filesingleton TSShapeConstructor(DiceCubeDts) { baseShape = "./DiceCube.dts"; }; function DiceCubeDts::onLoad(%this) { %this.setDetailLevelSize("0", "999"); %this.addMesh("DiceCube 2", "DiceCube2.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "400"); %this.addMesh("200", "DiceCube3.dts", "DiceCube 0"); } adding a 4th LOD (also edited the upper size so that the main dts pops in easier)exhibit 4 singleton TSShapeConstructor(DiceCubeDts) { baseShape = "./DiceCube.dts"; }; function DiceCubeDts::onLoad(%this) { %this.setDetailLevelSize("0", "800"); %this.addMesh("DiceCube 2", "DiceCube2.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "400"); %this.addMesh("200", "DiceCube3.dts", "DiceCube 0"); %this.addMesh("DiceCube 2", "DiceCube4.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "100"); } BUT.....exiting the mission and reentering the mission results in console errorsexhibit 5editing the file to add full paths to the files results in assertsexhibit 6And this is as far as I have gotten so far this evening, some obvious issues are the writing of the file is inconsistent %this.addMesh("DiceCube 2", "DiceCube2.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "400");vs %this.addMesh("200", "DiceCube3.dts", "DiceCube 0");for what is effectively the same operationmanually editing the file seems to have either no effect (more console errors) or similar asserts as exhibit 6. Edited January 13, 2019 by Bloodknight Quote Link to comment Share on other sites More sharing options...
Jason Campbell Posted December 13, 2017 Share Posted December 13, 2017 Hey Bloodknight,I don't know why your having these errors. I have been working with the LOD details in this same exact manner. I do know that, each time you alter the levels, you will need to add the full path again.I went in to shape editor and added all the levels of detail to your dice model and then saved and then added the paths. I then went out of the mission and back in. Everything worked with no errors to console.Here's what it looked like. Are you adding the full paths correctly? singleton TSShapeConstructor(DiceCubeDts) { baseShape = "./DiceCube.dts"; }; function DiceCubeDts::onLoad(%this) { %this.addMesh("DiceCube 2", "art/shapes/dice/DiceCube2.dts", "DiceCube 0"); %this.setDetailLevelSize("0", "600"); %this.setDetailLevelSize("2", "400"); %this.addMesh("DiceCube 2", "art/shapes/dice/DiceCube3.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "200"); %this.addMesh("DiceCube 2", "art/shapes/dice/DiceCube4.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "100"); } Quote Link to comment Share on other sites More sharing options...
Duion Posted December 14, 2017 Share Posted December 14, 2017 @Jason CampbellWhy would you add LOD levels as separate files? I mean this is more work then just letting them in the same file, since you build the LOD levels as derivatives of the original model, which means you need the original file and exporting them into separate files just makes more work in the building process, in the export process and in the import process and later in the maintenance process of the whole project, so why you do that? Quote Link to comment Share on other sites More sharing options...
Jason Campbell Posted December 14, 2017 Share Posted December 14, 2017 I'm addressing what he is trying to do. Is this not what he's attempting? Quote Link to comment Share on other sites More sharing options...
Duion Posted December 14, 2017 Share Posted December 14, 2017 Oh it sounded like you were doing LOD levels like this as well, but seems like you tried to replicated it.My point is that I cannot think of a scenario where something like this would make sense, so we are fixing a potential useless feature here.Now I see it was probably just the path names, since it is missing the ./ to make it a relative path or absolutes would work as well. Quote Link to comment Share on other sites More sharing options...
Bloodknight Posted December 14, 2017 Author Share Posted December 14, 2017 @Jason CampbellFirstly thanks for taking the time to look at this, I used your file and it works fine, which means I at least have a working reference while finding and posting and possibly fixing the other issues around this particular problem.Secondly, ignore Duion, he has been attacking me for days over this issue because his path is the one true path of righteousness and everybody who does it different is wrong.The point being there is still an error in the process well maybe 3 potentially1) The fact that the file that was written is malfunctioning, this is a bug and needs to be fixed.2) The fact that it works when according to what I understand from the documentation as written it shouldn't (all but 1 detail level is the same in the script unless the level is just an irrelevant label)3) The fact that the file writing is inconsistently orderedDespite Duions continuing mission to dump on everything I do; this issue is relevant because the process is identical regardless of whether the meshes are in one file or multiple files and resetting or tweaking LOD distances and values vis script is far more efficient than just sending the files back to the artist for trivial non-art based changes. Quote Link to comment Share on other sites More sharing options...
Jason Campbell Posted December 14, 2017 Share Posted December 14, 2017 No problem, Bloodknight,I agree that this is a bug. We should be able to alter these settings in the Shape Editor and know that they will be saved correctly.What I've found is that regardless of how inefficient it may seem, sometimes this method is needed, anyway. For instance, my art pipeline, for structures is pretty dicey and Blender fights me every step of the way. I ended up having to import the lower LOD into Blender as an .obj. Well I messed around with getting the details setup and everything was great. I get it into the game and the axis are all messed up. Spent another night trying to get it fixed. Long story short, I gave up and just added a second shape and it works fine now. Also third party assets sometimes are just easier to add as separate shape. Performance seems fine. Quote Link to comment Share on other sites More sharing options...
Bloodknight Posted December 15, 2017 Author Share Posted December 15, 2017 ok, so, the problem was caused in part by an older guide from the GG forums which no longer works as specified in the thread there This thread in case anybody is interested.Another issue was the slight inconsistency in how the editor itself works, in that it has used both of the 'working' methods for writing to the file, this should probably be looked at at the same time as addressing the path writing bug. Quote Link to comment Share on other sites More sharing options...
Bloodknight Posted December 15, 2017 Author Share Posted December 15, 2017 singleton TSShapeConstructor(DiceCubeDts) { baseShape = "./DiceCube.dts"; }; function DiceCubeDts::onLoad(%this) { // Sets the size of the baseshape %this.setDetailLevelSize("0", "600"); // This works /* %this.addMesh("DiceCube 2", "art/shapes/dice/DiceCube2.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "500"); %this.addMesh("Dicecube 2", "art/shapes/dice/DiceCube3.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "400"); %this.addMesh("Dicecube 2", "art/shapes/dice/DiceCube4.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "300"); %this.addMesh("Dicecube 2", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "200"); %this.addMesh("Dicecube 2", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "100"); */ // This also works /* %this.addMesh("DiceCube2", "art/shapes/dice/DiceCube2.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "500"); %this.addMesh("Dicecube2", "art/shapes/dice/DiceCube3.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "400"); %this.addMesh("Dicecube2", "art/shapes/dice/DiceCube4.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "300"); %this.addMesh("Dicecube2", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "200"); %this.addMesh("Dicecube2", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); %this.setDetailLevelSize("2", "100"); */ /** * the above two methods create the name+detail using the addMesh() * it then replaces the +detail part using setDetailLevelSize(old, new) * * They essentially create the following methods * It appears that names are arbitrarily irrelevent, but there must be a name. */ // This works too //%this.addMesh("DiceCube 500", "art/shapes/dice/DiceCube2.dts", "DiceCube 0"); //%this.addMesh("Dicecube 400", "art/shapes/dice/DiceCube3.dts", "DiceCube 0"); //%this.addMesh("Dicecube 300", "art/shapes/dice/DiceCube4.dts", "DiceCube 0"); //%this.addMesh("Dicecube 200", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); //%this.addMesh("Dicecube 100", "art/shapes/dice/DiceCube6.dts", "DiceCube 0"); // This works too //%this.addMesh("DiceCube500", "art/shapes/dice/DiceCube2.dts", "DiceCube 0"); //%this.addMesh("Dicecube400", "art/shapes/dice/DiceCube3.dts", "DiceCube 0"); //%this.addMesh("Dicecube300", "art/shapes/dice/DiceCube4.dts", "DiceCube 0"); //%this.addMesh("Dicecube200", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); //%this.addMesh("Dicecube100", "art/shapes/dice/DiceCube6.dts", "DiceCube 0"); // This works too // I think this method best reflects the actuality of whats going on %this.addMesh("detail500", "art/shapes/dice/DiceCube2.dts", "DiceCube 0"); %this.addMesh("detail400", "art/shapes/dice/DiceCube3.dts", "DiceCube 0"); %this.addMesh("detail300", "art/shapes/dice/DiceCube4.dts", "DiceCube 0"); %this.addMesh("detail200", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); %this.addMesh("detail100", "art/shapes/dice/DiceCube6.dts", "DiceCube 0"); // This Crashes (waahhhhh) /* %this.addMesh("500", "art/shapes/dice/DiceCube2.dts", "DiceCube 0"); %this.addMesh("400", "art/shapes/dice/DiceCube3.dts", "DiceCube 0"); %this.addMesh("300", "art/shapes/dice/DiceCube4.dts", "DiceCube 0"); %this.addMesh("200", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); %this.addMesh("100", "art/shapes/dice/DiceCube5.dts", "DiceCube 0"); */ } Quote Link to comment Share on other sites More sharing options...
Bloodknight Posted December 16, 2017 Author Share Posted December 16, 2017 I came, I saw, I failed... function DiceCubeDts::onLoad(%this) { %this.setDetailLevelSize("0", "600"); %this.addMesh("detail500", "./DiceCube2.dts", "DiceCube 0"); %this.addMesh("detail400", "./DiceCube3.dts", "DiceCube 0"); %this.addMesh("detail300", "./DiceCube4.dts", "DiceCube 0"); %this.addMesh("detail200", "./DiceCube5.dts", "DiceCube 0"); %this.addMesh("detail100", "./DiceCube6.dts", "DiceCube 0"); %this.setMeshSize("Detail 100", "105"); %this.setMeshSize("Detail 105", "110"); %this.setDetailLevelSize("110", "100"); %this.setMeshSize("Detail 100", "150"); %this.setMeshSize("Detail 150", "160"); %this.setMeshSize("Detail 160", "170"); %this.setMeshSize("Detail 170", "180"); } I'm not entirely sure what the shape editor uses to write the shapefile, I found this function DefineTSShapeConstructorMethod( writeChangeSet but trying to trace its contents and the details proved difficult, it appears to read in the current file and add a set of changed data to the end of the file. I have yet to track the source of this data, and I suspect changing this behaviour to something sensible is probably going to be even more complicated. Quote Link to comment Share on other sites More sharing options...
Bloodknight Posted December 16, 2017 Author Share Posted December 16, 2017 ok, so found the culprit... partlyhttps://github.com/GarageGames/Torque3D/blob/development/Engine/source/ts/tsShapeConstruct.cpp#L2150-L2214this is the critter that's writing the data to the shape.cs file, my tinkering so far hasn't helped much since all it does is take the data that's already been collected and tries to write it in a correct format, the issue seems to be that the data is a stack and it just outputs the stack in a pseudo formatted manner. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.