Vertex Group from blender [solved]

I can’t see the full mesh.py file he uploaded. But this is exactly what I needed.

Nice I got it downloaded, Ill take a look at this!

Yes, good. Since you are not using Blender 2.80, you will need to do it this way. As I have already spent some time looking at this, I integrated it in TOB (I do not really publish this in recent memory), adding a checkbox to include it.

I refactored it into its own small class. Added a to_json_file(), if the changes to main repo cause the info to not be ignored. I am not making load code changes.

Why does something like this not get merged then? I’m sure others would find it useful.

If I upgrade to 2.8 is there a way to just pull your branch that you have done all that in and do a build for myself, or am I going to need to just make my own build from the current stuff and @ozRocker mesh.py?

Actually there are 2 separate code bases, which have much in common in the first pass. They are mutually agreed to be kept separate. @deltakosh does not want to support code generators, & I am playing solely with my own rules.

I use Netbeans to diff the few changes in the first pass. Those differences are mostly a couple of things the JSON exporter does not have, like Mesh base class name field. TOB not only generates mesh sub-classes, you can write your own sub-class in Typescript, & then export a subclass of that.

Dude, put in the PR to consult this data in the load code, & I’ll put it in. I am just not going to do that part. Also, the way @ozRocker did this would probably be objected to. Think your PR might not get accepted unless a VertexGroup class is created. Not my fight, sorry do not care, work it out.

1 Like

Thanks for the insight buddy! I’ll try to understand everything you are saying and make sure I figure something out from what you have explained.

I am willing to do what ever I gotta do to get it working was not asking you to do it for me, sorry if that’s what you got out of that. Was just mainly looking for references.

Thanks for your time thus far. I’m just kinda unclear about what you mean about the load code and some of the other things you have said.

The load code is what is done to get from the parse JSON into the framework objects.

From the old forum thread:

// Vertex groups
if (parsedMesh.vertexGroups) {
     mesh.vertexGroups = parsedMesh.vertexGroups;
}

So I am actually working on the python script a little, whats the best way to include my revisions into blender?

Do I have to uninstall the plugin each time and then install my zip? I tried to get to the appData location but it seems to not store them there.

Otherwise I think you got me all the info I needed! Thank you so much @JCPalmer

Ah, the joy’s of Blender addon dev. If you are making a .zip, then you can just install over. The safest thing to do is just cycle your Blender app. Simple one file addons do not require this, I find that if it is in memory, changes will not take effect time next run.

1 Like

UPDATE
In the meantime I was working on updating to 2.8 and now that I have installed in on that version it looks like I can change the files in the appData location! Still need to cycle the program like you mentioned it seems though.

:slight_smile: prettys stoke, thank you for all the guidance on this.

I have been doing some testing with @ozRocker’s solution and my own derived from his but it seems that a bunch of extra vertex indices are being appended.

So with both of out solutions the output on my test scene would produce this:
‘vertexIds’: [1, 3, 11, 17, 18, 19, 20, 21, 23, 24, 25, 32, 35, 48, 53, 56, 58, 59, 60, 61, 63, 64]

with mine having access to the original ones as well:
‘orignialVertexIds’: [0, 2, 8, 9, 10, 11]

The model and the Vertex group look like this:
image

I do not see how that many vertices are made… in the log it says it has num positions : 81 which can’t be correct! 20 vertices * 3 is 60 not 81.

What am I missing here? I have not even messed with that part of the script but I dont understand why the numbers are that different then what I would expect.

You are using flat shading, which would mean that your verts cannot be optimized.

Ohhhhh so because it’s flat shading it separates all the faces!!! Gotcha.

UPDATE
So I think I got it! thank you so much @JCPalmer

UPDATE

Its still not exporting the correct Vertex Points… how did @ozRocker get it to export the correct points?

for group in self.groups:                           
    if vertex_index in group['orignialVertexIds']:
        if index not in group['vertexIds']:
            group['vertexIds'].append(index)

Is how I am adding them in on line 401ish… Effectively I don’t see why this is not working on getting me the correct index values for the points after the conversion.

It it because the mesh.py structure changed, I have been sitting through trying to figure out what I am doing wrong all morning now and just don’t see it for some reason. I know you prolly dont have time for this @JCPalmer, but when you get a second from your stuff could you take a look at my mesh.py script? Its prolly something simple that Im just overlooking.

Starting to think about doing something hacky now and iterating through all the vertices on the parsed mesh and compare it to vertices on the unparsed meshes positions and if its matches and is in an included vertex group to add it to the list.

I went through and manually selected them in scene after the mesh was loaded and these are the points I came up with:
70,69,72,73,76,1747,6171,4566,4564,4563,4561,4560,6851,6826,6076,1647,1649,2421,2447

which is really close to what the system is generating:
69,73,1705,1712,1723,1812,1813,1894,2494,2525,5356,5361,6942,6944,6954,7037,7089,7707

there are even some like numbers, but it seems to be off.

On the left if what I should be getting on the right is what I am getting:

OHHHHH I bet Im dumb…
man… I was… @JCPalmer sorry to waste your time, everything was right…

I was loading the wrong babylon file… smh :crazy_face:

1 Like