View Full Version : Cannot reduce vertices from mesh (mailbox)
misukisu
8th Jan 2012, 12:55 PM
I am doing a default replacement mailbox in a scifi theme. But I cannot replace the original MailboxColonial mesh with my own. In Blender everything goes fine, but when I try to import my s3m2b to S3PE, it says:
== START == Source: mscorlib Assembly: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Source array was not long enough. Check srcIndex and length, and the array's lower bounds. at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) at System.Array.Copy(Array sourceArray, Array destinationArray, Int32 length) at s3piwrappers.VBUF.SetVertices(MLOD mlod, ChunkReference myVBI, Int64 beforeLength, Int32 count, VRTF vrtf, IEnumerable`1 vertices, Single[] uvscales) at s3piwrappers.VBUF.SetVertices(MLOD mlod, Mesh mesh, VRTF vrtf, Vertex[] vertices, Single[] uvscales) at s3ascHelper.Import.VertsToVBUFs(GenericRCOLResource rcolResource, MLOD mlod, IResourceKey defaultRK, List`1 lmverts, List`1 llverts, Boolean updateBBs) at s3ascHelper.ImportForm.Import_Shown(Object sender, EventArgs e) ----- == END ==
I've tried messing around and found that I can swap the mailbox mesh with any mesh that has at least the amount of vertices. I also modified my mesh by adding dummy vertices and was able to import after that. I also tried cloning a regular object and was able to swap the mesh just fine (decreasing the vertex count).
Maybe there is something else that I am doing wrong. This my first object that will have joints, so maybe there are some extra steps that I should be doing.
Can someone try my files to see what I am doing wrong?
To repeat:
1. Open misu_Mailbox_robot_default_120108.package in S3PE and export MLOD 0x00000000 as s3m2b
2. Open new Blender file and use cmo blender tools to import the mesh
3. In Blender, select File->Append and browse for the mailRobot2.blend, select Object->_HP_RobotBody
4. Now swap the meshes and continue normally, remember to triangulate on export
5. Import to S3PE
6. Do you get the same error?
BloomsBase
8th Jan 2012, 3:12 PM
There are a bunch duplicate meshgroups in it.
If i export the mesh as obj and view it in MS i get 8 meshgroups while the mailbox only has 3.(dropshadow/box and the lid that animates)
I bet Blender has a menu were to delete all those duplicates.
If you want to fix this you need the 3 meshgroups for the higher detail.(i think that is wat you ment by same vertice?)
And i am almost sure you also have to name the 3 meshgroups the same as the originals.
Edit,
When i had the package in TSRW and the meshes in Milkshape i fiddled a bit with them.
-high detail with dropshadow with 3 meshgroups(dropshadow/box and the lid that animates)
-low detail(box and animated lid, lower polygon)
-2 shadowmeshes made from the lower polygon.
misukisu
9th Jan 2012, 2:00 PM
Thank you, but I am afraid that you might have exported too much of my blend file to obj.
I guess you took all the meshes from my blender file and not just _HP_RobotBody? You see, I have the original meshes with all shapes separated, merged highpoly mesh and merged lowpoly mesh plus probably some of my "template-pieces" in the same blend file :)
So if you want to convert my mesh to .obj, you need to first fetch just the _HP_RobotBody mesh from the .blend file. It's the mesh on the layer 10. Otherwise you'll get a lot of extra stuff.
If you want to fix this you need the 3 meshgroups for the higher detail.(i think that is wat you ment by same vertice?)Nope, I meant mesh vertices. The ones that define the geometry of the mesh.
I'm working on the meshgroup that contains the mailbox leg and the box itself. I'm not home so I cannot check the original figures and the group name (guess its group00), but the EA meshgroup has over 1000 vertices and if I recall correctly my _HP_RobotBody has ~500 vertices.
If I add vertices to my model so that it exceeds 1000 vertices, I can swap the meshes and the import to S3PE works. If I use my _HP_RobotBody mesh with object cloned from decorative object etc. it works fine, too.
Is there some restriction that I cannot decrease the mesh vertex count on certain objects or something?
The lid and that "tag" that lifts up are on layer 11 or 12 in my model, but not prepared for swap yet. I've learn the hard way that the best way of working for me is to iteratively add parts and test in the game in between. I'm still a newbie so I make mistakes in almost every step and then it's nice to have the previous working package to return to :)
I'm really sorry that I did not give enough information in my first post and wasted a bit of your time. Sometimes I seem to think that people can read my mind :)
BloomsBase
9th Jan 2012, 4:54 PM
It is irrelevant how much vertice a mesh has, it should not give any problems.
Unless s3PE has a limit but yours is 944 triangles so no problems there.
I have very little experience with Blender and find it very unpleasant to work with, srry i cant help.
If you didn't update the ammount of meshgroups in the package you have to stick to it, wich is 3
If you are trying to import just one you prolly get the above error.
cmomoney
9th Jan 2012, 5:09 PM
I was able to replicate the error. Although, comparing the files, I was unable to see a problem that would cause this error. You may need to report this error in the meshExpImpHelper's thread at Simlogical.
BloomsBase
9th Jan 2012, 5:28 PM
isn't this because of the ammount of meshgroups you ''must'' import?
shadow(group0)
box(group1)
lid and flag(group2)
cmomoney
9th Jan 2012, 5:55 PM
When I tried it, I used the right amount of mesh groups. I used the original shadow, the robot body, and the robot lid. I still got the error.
misukisu
9th Jan 2012, 6:41 PM
Ok, Thanks for testing this for me. I'll go to Simlogical next :)
BloomsBase
9th Jan 2012, 6:56 PM
Ah, ok
Nothing wrong with the mesh itself, shows up perfect ingame. ;)
misukisu
9th Jan 2012, 7:15 PM
Thanks for testing and packaging the mesh for me. I'll use that if I don't get this solved in any other way.
misukisu
13th Jan 2012, 10:56 AM
Just a status update. Inge gave me a workaround for this. It's the lower part of the mailbox post that causes these problems and import/export goes fine if those are not removed.
misukisu
17th Jan 2012, 11:54 AM
I gave the mailbox another try today and failed miserably. I made a new clone (actually, several) of mailbox colonial with S3OC for this try.
First, I tried to just import the mesh to Blender and export it right back without touching anything. I got this when trying to export in Blender:
Traceback (most recent call last): File "C:\Users\myname\AppData\Roaming\Blender Foundation\Blender\2.61\scripts\addons\io_TS3_tools.py", line 1644, in execute self.writefile() File "C:\Users\myname\AppData\Roaming\Blender Foundation\Blender\2.61\scripts\addons\io_TS3_tools.py", line 1750, in writefile bpy.ops.object.mode_set(mode='OBJECT') File "C:\Program Files\Blender Foundation\Blender\2.61\scripts\modules\bpy\ops.py", line 180, in __call__ ret = op_call(self.idname_py(), None, kw) RuntimeError: Operator bpy.ops.object.mode_set.poll() failed, context is incorrect location:<unknown location>:-1 location:<unknown location>:-1
I was puzzled, until I realized that if I selected the mailbox, I was able to export. I tried other export formats and they did not seem to care whether I had something selected or not.
Next thing I tried to remove some vertices from the top of the mailbox (vertex selection mode, box selection). I failed in Blender export again, now with this message:
Traceback (most recent call last): File "C:\Users\---\AppData\Roaming\Blender Foundation\Blender\2.61\scripts\addons\io_TS3_tools.py", line 1644, in execute self.writefile() File "C:\Users\---\AppData\Roaming\Blender Foundation\Blender\2.61\scripts\addons\io_TS3_tools.py", line 1846, in writefile uveez += uv_list[vert_index][1] IndexError: list index out of range location:<unknown location>:-1 location:<unknown location>:-1
I tried UV mapping again, but it did not seem to work. I finally got it working after I put the "face selection" mode on. I think this mystery error that I have been getting every now and then happens because of stray vertices that cannot form a face. Since there is no face that vertex maybe is not getting UV mapped?
Cmo, can you repeat these problems?
Anyway, I tried to remove parts from here and there in the mailbox, but if I got the Blender export working, then the S3PE import did not work. If there is some part in the mailbox that can be safely removed then it is not a big part :)
After that I tried to follow what Bloom did earlier, but that path stopped even sooner. I was not able to find the mailbox from TSRW. Bloom, can you tell me in which category it is? Is there something special I need to do to my mesh to pass it through MS, or do I just export the meshgroup in .obj and import it to MS?
misukisu
17th Jan 2012, 12:41 PM
A quickie, I have missed the S3PE helper update on 15th, going to try with those!
BloomsBase
17th Jan 2012, 12:55 PM
uhm, the mailbox isn't in the category is it?
It pops up when you create a new lot.
Or do you mean you wanted to clone it with TSRW, that is not possible without losing it as default replacement.
Wat i did is clone a random object with TSRW, delete all the files in project content and import your default(s3OC) file as package.(in project content.)
I exported your meshes as obj out of Blender, fixed a few things in Milkshape on them and imported in TSRW.
cmomoney
17th Jan 2012, 1:07 PM
You don't necessarily have to have the object selected, but you do have to have a object(mesh) selected. Other formats don't care because they are just going to export everything, mine only exports the groups that are going to the .s3m2b. You can't have stray vertices, because the vertex count(x3) has to match the faces and UVs.
misukisu
17th Jan 2012, 1:51 PM
Thanks for the quick responses!
I got this working with the new fixed mesh helpers, so the actual problem is solved and I can proceed with my mailbox now.
Bloom, yes, I was asking for the clone category. I am not sure how far from original I can go while cloning in TSRW and importing. I've have couple of objects that did not have the parts that were needed and then the TSRW import from package did not show all my resources. But I take it that I cannot clone the mailbox with TSRW? Meaning that it is not there in the categories for clonable objects.
Cmo, if this is normal behaviour to the tool, would you consider checking for the errors in the code and printing a more user-friendly error message? I mean, telling user "your mesh contains vertices that do not form faces, please remove extra vertices or add missing faces" is a whole lot more informative than index out of bounds. That would save your work too as people would be able to solve their problems themselves. And it would save others work... I have made several meshes again from the scratch because of this error, when I could have just merged all vertices and rework.
BloomsBase
17th Jan 2012, 9:35 PM
i didn't see it yet in TSRW, but you dont want it anyway, like i explained.
cmomoney
17th Jan 2012, 9:55 PM
I've seen the mailbox in the Debug section in TSRW, but like Base said, it wouldn't be default anymore.
orangemittens
18th Jan 2012, 3:25 AM
My understanding is that tsrw is incapable of making default replacements. So the default loss problem isn't an issue with the mailbox per se. It's a flaw in tsrw.
misukisu
18th Jan 2012, 10:49 AM
Thanks, I did find the mailbox in debug. I thought I went that through already...
I wouldn't expect the defaultness to carry over import in TSRW. After all, that is a tool for making sims3packs, it has no reason to have default replacement support.
I'm having another "bad blender tools"-day (plus bad hair day). I get this on export now, trying to swap the lid:
Traceback (most recent call last): File "C:\Users\---\AppData\Roaming\Blender Foundation\Blender\2.61\scripts\addons\io_TS3_tools.py", line 1644, in execute self.writefile() File "C:\Users\---\AppData\Roaming\Blender Foundation\Blender\2.61\scripts\addons\io_TS3_tools.py", line 1822, in writefile if ob.uv_textures[1].name != (group + '_m2'): IndexError: bpy_prop_collection[index]: index 1 out of range, size 1 location:<unknown location>:-1 location:<unknown location>:-1
I wonder what I am doing wrong now? :blink:
I'm getting really annoyed with these index out of bound errors that to me seem to happen sporadically and don't tell me what the actual problem is. I'll not redo this mesh from scratch and I'll not UV map it again. These are simple mesh swaps that I should be proficient doing by now. I'm done redoing my work just because the tools refuse to export. What if I just had a wrong object selected or something again. I rather learn to export through MS if I don't get this working.
BloomsBase
18th Jan 2012, 11:24 AM
Have you tried to import your very first file in TSRW?(Under project contents in the menu)
I have the idea you misunderstand.
You clone the mailbox with tsrw(from the debug cat)
Then delete all files under project content
reimport your s3oc package as package in project content
misukisu
18th Jan 2012, 12:13 PM
Bloom, thanks for explaining. I don't think I misunderstood, I'm just stubborn and tried to use the Blender Tools to the end.
What you described about importing to TSRW is the way I normally work :)
But I'm still a beginner, so I was not sure what clones I can import over what clones, so I have always cloned the same object in both. Which, in some cases is nuisance since s3oc lets you clone anything and TSRW does not. While your advice to clone whatever in TSRW is valid, I'm not experienced enough to say if I'm missing something, so I wanted to find the mailboxColonial.
I really grew tired of the random errors. I ended up learning to use .wso+MS to swap my mesh and I got the lid now. On my first try. With not a single mysterious error. I'm just testing how it looks in-game :)
I think I'm still going to give Blender Tools a try, but I'll no longer try to hit my head to the wall when I face mysterious indices out of bounds errors - I'll just switch the tools then and save myself a lot of time.
Inge Jones
18th Jan 2012, 1:38 PM
But you could also have used s3pe + MS, and that would have avoided blender problems. Just adding this for the benefit of other readers who might think TSRW was the only other option :)
cmomoney
18th Jan 2012, 3:30 PM
I understand you're frustrated, but these aren't random errors. Out of bound errors come about because something is missing that the code was expecting, in this case, a UV texture. The lid and flag(group02) has two UV maps. I'm assuming you tried to swap it with a mesh that only had one, which produced the error. A simple fix is to add a UV texture to the mesh, and scale the UV down(S then 0). This doesn't happen in MS because its not capable of having multiple UV maps, so it only imports and expects one.
BloomsBase
18th Jan 2012, 4:44 PM
Wat do you mean by having 2 uvmaps?
Both meshgroups(group1 and 2) are mapped on one(and the same) uvmap.
cmomoney
18th Jan 2012, 6:14 PM
Yea, if you're looking at it in MS. In reality, each group has its own UV, and some groups have multiple UVs. In MS, the UVs are combined into one, and if a group has more than one UV, it only uses the first and the others get ignored.
BloomsBase
19th Jan 2012, 1:04 AM
The game also combines the uvmaps into one so that should not be a problem?
You can reposition uvmaps if you like, both the ones from MS or Blender(but the mailbox does only have a one texture/uvmap setup, so not needed)
cmomoney
19th Jan 2012, 1:50 AM
The mailbox has two UV maps in group02. The second UV on group02 is not combined with the other UV maps and does not use the same texture(most objects set up this way use it for normal maps). In MS this second UV gets lost on import. In Blender, it is imported and editable, and is required for export.
misukisu
19th Jan 2012, 10:02 AM
But you could also have used S3PE + MS, and that would have avoided blender problems. Just adding this for the benefit of other readers who might think TSRW was the only other option
That is absolutely true, I just picked .wso since I'm using TSRW anyway. But that is no complaint to S3PE, which would do the job too. S3PE is a wonderful tool and you are giving professional level support for it. Thanks!
CmoMoney, thanks for explaining the UV groups to me.
I understand you're frustrated, but these aren't random errors. Out of bound errors come about because something is missing that the code was expecting, in this case, a UV texture
I think you might have misunderstood what kind of a "fix" I'm thinking about. I really love your tool and want the functionality that it offers, but to be honest, the usability sucks. I think it is perfectly ok to throw that kind of errors to the user when there is a real problem in the tool that I can report to someone and get fixed. But if the problem is in what user did, she should not get back information that is not useful to her. So I'm not asking a fix for these as errors, I am asking for error handling.
User should never get an error with index out of bounds. To user, that tells that the lower level error was not wrapped, which means that it might not have been caught at all by the programmer and after that kind of error the system/plugin might be in an undetermined state and just continuing might be risky. What if it wrote half of my file before the error?
So in my opinion the correct "fix" for these kind of errors would be to add the proper bound checks to their place and report some meaningful (preferably helpful) error to user. Do not let the code to proceed to loop the index out.
And I do not want you to go through all the code and do that for all loops. I just wish you would do that for the most common user-induced errors. I'd love that when I work with the tool, it would give me at least some understandable information about what I did wrong. Now I'm in a situation where sometimes my baking fails and sometimes my export fails and I have no idea why! Of course I then try all the tricks that I now know, select something, merge vertices and split and UV map again, redo clone and try again. But doing that aimlessly gets old quite fast. Now the tool itself does not tell me what actually was wrong, instead I have to use my "trick box" and then come here and ask.
Of course I also understand that these tools are made as a hobby and with limited resources. It is perfectly fine if you say that you have not specified pleasant user experience as a feature for this tool and I stop bugging about this.
I think it is a great tool, but I personally just freak out when certain kind of errors are thrown to me. Even if the result would be that the tool really goes into undeterminate state and I need to import again to continue, I'd prefer the tool to say me that instead or the current message.
BloomsBase
19th Jan 2012, 10:20 AM
now i am really confused...
I can only find one set of textures(overlay/multi/mask and specular) used on the mailbox.
The box, lid and flag all have a perfect fit on that texture, there are no other textures used....
Normalmaps/multiple overlays have their uvcoordinates changed(either repositioned or scaled), that is is something diffrent in my opinion and not used in the mailbox(all textures used have the same uvcoordinates 3,03794986E-05; 0; 0)
You have more then one overlay(used with multiple uvmaps) in your cloned package?
cmomoney
19th Jan 2012, 5:32 PM
And I do not want you to go through all the code and do that for all loops. I just wish you would do that for the most common user-induced errors.
Well these are uncommon user-induced errors on a uncommon object with an uncommon format. It isn't common for someone to delete one or two vertices from a face. Its not all that common for a object's mesh group to have more than one UV map. As for usability, I've taken most of the process in Blender/TS3 creating and put them into a few buttons, I can't really make it any easier.
now i am really confused...
I can only find one set of textures(overlay/multi/mask and specular) used on the mailbox.
The box, lid and flag all have a perfect fit on that texture, there are no other textures used....
Normalmaps/multiple overlays have their uvcoordinates changed(either repositioned or scaled), that is is something diffrent in my opinion and not used in the mailbox(all textures used have the same uvcoordinates 3,03794986E-05; 0; 0)
You have more then one overlay(used with multiple uvmaps) in your cloned package?
UV 1 used by group02:
http://thumbs2.modthesims2.com/img/2/5/4/5/4/5/7/MTS_cmomoney-1266511-UV1.jpg
You're right, perfect fit.
UV 2 used by group02:
http://thumbs2.modthesims2.com/img/2/5/4/5/4/5/7/MTS_cmomoney-1266512-UV2.jpg
Not only does the 2nd UV not fit, it's not even the right dimensions. If the tools you use don't display this information, why are you surprised you don't see it?
From s3pe(mailbox MLOD):
http://thumbs2.modthesims2.com/img/2/5/4/5/4/5/7/MTS_cmomoney-1266513-vrtf.jpg
misukisu
19th Jan 2012, 7:26 PM
I apologise for my harsh words, CmoMoney. I did not really realize that my problems are that unique. If all the others are not having similar problems, then of course it is not justiced to require changes made just for me. Thanks for making the tools!
orangemittens
19th Jan 2012, 9:56 PM
Now I'm in a situation where sometimes my baking fails and...I have no idea why! Baking with Cmo's Blender tools is really child's play if you know how to do it and it takes only minutes to learn. I wrote a tutorial on the process for people having a tough time mastering it and it's in the tutorials section here:
http://www.modthesims.info/showthread.php?t=465766&goto=lastpost
Although it's titled for Milkshape users it really is for anyone who's struggling with Blender so it should work well for you hun. :)
BloomsBase
19th Jan 2012, 11:23 PM
i prolly am to stupid for this but i can not find these settings in the original game Mlod of the mailbox.
orangemittens
20th Jan 2012, 1:58 AM
i prolly am to stupid for this but i can not find these settings in the original game Mlod of the mailbox.If you clone this with s3oc and open it in s3pe you can see it on the right hand side. This shows you the pathway to where it is in the .package:
http://jaue.com/om/mb.jpg
Hope that helps :)
misukisu
20th Jan 2012, 8:16 AM
There are couple of words I ought to add to my previous post.
Cmo, I respect your work and I love the tools you have created. It was your Blender Tools that finally tempted me over the edge to start creating for The Sims. You have helped me every time when I have needed help. You have implemented features for me. I will not forget that. And the area you are working on is not an easy one. I could not have done as well myself.
My problem is that I keep forgetting that all these tools are people's personal hobby projects. Then I end up treating tool creators like commercial software producers, which is plain wrong thing to do. Even worse, as people always take their hobbies personally, I end up hurting their feelings, which is something I never meant to do. I want to have fun with you guys, not to hurt you.
My other problem is my unconfidence with my new skills. It annoys the hell out of me and it has been a long time since I have been a newbie on something. I'd like to be able to manage on my own and not need someone to hold my hand with every object I do.
Have I said it all now... I guess so.
Will you play with me again? :luff:
OM, thanks for the baking instructions. Baking with Blender Tools in theory is easy. It's just that the bake refuses to bake some of my UVs. But that is not a problem as I can just start the bake from Blender's own bake-button, which seems to work also in those cases. While learning the bake settings I have also found that I like to put the environment lighting a bit higher, to 0.77, and samples to 20. That results in a bake that has smoother overall look and gives the neutral areas a brightness that matches the wall brightness in game.
I guess there is just something about the way I model that causes problems. 2/3 are eaten just fine by the tool, it's the 1/3 that is giving me gray hairs.
This discussion has also given me something to thought about and I think I should stop whipping myself too. As this is a hobby, I don't have to do everything perfectly, my first objects don't need to be EA-quality and I don't have to have full sets of items before I publish them and so on. Thanks for making me think about those issues.
misukisu
20th Jan 2012, 1:58 PM
Hmm. Looks like I have found workaround for the most common error I was getting. I just need to export the mesh to .obj and import it right back. After that the export from Blender to .s3m2b works. Most interesting.
Inge Jones
20th Jan 2012, 5:18 PM
Strange... Something you had stuck in your mesh that .obj doesn't understand so dumps... which blender tries to understand and do something with, but not what any of us expected lol
BloomsBase
20th Jan 2012, 5:46 PM
the obj in Milkshape also displays 2 unindentified meshgroups, it only shows it mat.
Have you tried creating just one meshgroup and export it as .s3m2b?
@OM, thank you. i found it.
The mailbox has indeed the same setup as the objects who use a normalmap.(carused1/Counter island traditional/Bar traditional/ etc)
But since it isn't linked to one i wouldn't worry about it.
sorry CMO ;)
misukisu
21st Jan 2012, 7:57 AM
Have you tried creating just one meshgroup and export it as .s3m2b?
Well... Yes and no. For this object I need 2 meshgroups, but I am appending and exporting them one by one. So in that aspect I am using only one meshgroup at a time.
The reason you are seeing many meshgroups in my file is that I like to mesh my stuff first in one file. I may model a whole series of objects in one file. This time the file is quite "garbage-free" only because I started with the mailbox. When I take the meshes into use, I create a completely new Blender file, where I first import the clone .s3m2b meshes and then use File-Append to "import" one meshgroup from my model file. Then I swap that one meshgroup with the clone's meshgroup and export.
I earlier did wonder if my errors are due to the append operation, but I have abandoned that theory. Most of my appended meshes swap just fine. And sometimes I get error when I do just quick edits, like change floor shadow.
But anyway, I think I now have workaround to my most common error cases. And for those that I don't have workarounds, I have now an alternative way to do. So I'm quite happy now and feel I can finally concentrate doing stuff! It was a constant worry to me earlier to fear whether the results will export or not.
vBulletin v3.0.14, Copyright ©2000-2013, Jelsoft Enterprises Ltd.