JCPalmer Posted June 16, 2014 Share Posted June 16, 2014 Hey,This is coming from couple other topics, one where Mira had a problem with the arbitrary names of MultiMaterials colliding when load separate .babylon files, and the action thread where I say I have my own version of the python Blender script. In the collision thread I wrote suedo code which added a timestamp to the name to make it unique. This is the simplest, but not the best, since the bug or neccessity to keep all the materials with unique names is unchanged. I did not want layout some complicated change. In my own version, I implemented a namespace approach, which turned out easier than I thought. Upshot is I got the latest io_export_babylon.py from github and made the changes. Do not have any multimaterials to test, maybe Mira can help. I have attached it. How it works is say you have a file: /dir/dir/scene1.blend, or c:\dir\dir\scene1.blend. If you also had a material 'red', it would be put in the .babylon file as 'scene1.red'. If there was also a 'red' in a scene2.blend, it would end up as 'scene2.red'. I did lie a little just above, technically the namespace is the base file of the .babylon file not .blend file, but by default they are the same. Enjoy! Whoops, guess you are not allowed to upload a .py. What now? Jeff gryff 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 16, 2014 Author Share Posted June 16, 2014 Extension renamed to .txt. Change back to .py for use.io_export_babylon.txt Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 16, 2014 Share Posted June 16, 2014 You can make a pull request if you consider this version production stable Quote Link to comment Share on other sites More sharing options...
gryff Posted June 17, 2014 Share Posted June 17, 2014 Jeff, hope you can work with DK on this through github. It is a useful fix and obviously necessary if you use the Import of additional meshes to a scene. I try to avoid Multimaterials if possible through using a "texture atlas" - but that can be a lot more work. cheers, gryff Quote Link to comment Share on other sites More sharing options...
Temechon Posted June 17, 2014 Share Posted June 17, 2014 Hey Jeff, I think like the guys above me : could you make a pull request in Github ? This could be very useful and time-saving for me. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 17, 2014 Author Share Posted June 17, 2014 Does any one have a blend file with multi-materials or know how to make a multi-material in blender? Seems obvious that should be tested, since that actually prompted the fix. I am pretty confident it should work, but probably no rush since you have to being using multiple Blend file to see the problem. Quote Link to comment Share on other sites More sharing options...
gryff Posted June 17, 2014 Share Posted June 17, 2014 Here are a couple of simple files Jeff. Gem has one object with 3 materials (shades of blue). Dodo has one object with 7 materials (bold basic colours). Both files have a light and a camera - so it should not matter which is loaded first. Blend Files They are in a zip file at my dropbox - which seems to be slow this morning cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 17, 2014 Author Share Posted June 17, 2014 Ok, got this to work. Was a little tricky either missing having the multimaterial namespace not mentioned in the mesh, or getting the name space duplicated in the multimaterial def itself. We are now ready to go. Assume I do not know what this "pull request is". tell me more. I guess I need a github account? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 17, 2014 Author Share Posted June 17, 2014 Ok have an account, never bothered with this stuff before, as I did not start out wanting to send anything back and was just grabbing the zip file. Found the Github docs on forking and pull requests. Will get there. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 17, 2014 Author Share Posted June 17, 2014 And the monkey pulls the lever! gwenael 1 Quote Link to comment Share on other sites More sharing options...
Temechon Posted June 17, 2014 Share Posted June 17, 2014 Welcome on the wonderful world of Github Congrats for your first pull request, I just saw it has been accepted. And thank you for your work ! Quote Link to comment Share on other sites More sharing options...
gryff Posted June 17, 2014 Share Posted June 17, 2014 And the monkey pulls the lever! That made me laugh. Something about it appeals to my sense of humour. I see it is up - useful addition Jeff. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 17, 2014 Author Share Posted June 17, 2014 It is a quote from the movie "Lost In Space", which fairly unremarkable other than Heather Graham was in in. Quote Link to comment Share on other sites More sharing options...
gryff Posted June 18, 2014 Share Posted June 18, 2014 Jeff, I tested it with the two files I posted - worked well. I also tested it by merging the two blend files and exporting as a .babylon file - also seemed to work well. From the merged file:"multiMaterials":[{"name":"gem1.Multimaterial#0","id":"gem1.Multimaterial#0","materials":["gem1.top","gem1.mid","gem1.bottom"]},{"name":"gem1.Multimaterial#1","id":"gem1.Multimaterial#1","materials":["gem1.black","gem1.blue","gem1.red","gem1.green","gem1.purple","gem1.yellow","gem1.orange"]}]And, even if I then tried to import a mesh from one of the original single files (heaven knows why) I would get:"multiMaterials":[{"name":"gem.Multimaterial#0","id":"gem.Multimaterial#0","materials":["gem.top","gem.mid","gem.bottom"]}]a different Multimaterial. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 18, 2014 Author Share Posted June 18, 2014 Gryff,Good to know that I did not put up the wrong version of the file or something. I appreciated the files I could not create myself. This exercise brought to light that I have overweighted Blender export & the Babylon side of object creation over actually knowing how to make objects. For now, I have changed, and have started the character animation tutorial http://wiki.blender.org/uploads/6/66/Introduction_to_Character_Animation_19_Sept_2006.pdf . It covers a lot more than animation. It is old, but much more intense than the Gus the gingerbread man, which I did not fully finish. There is a lot of ground to cover to do development, a little round robin is probably the only way to get up to speed on it. Jeff Quote Link to comment Share on other sites More sharing options...
gryff Posted June 19, 2014 Share Posted June 19, 2014 For now, I have changed, and have started the character animation tutorial http://wiki.blender....9_Sept_2006.pdf . Actually Jeff it is very very old - Blender 2.42. First version I ever tried was 2.48. A lot has changed both with the Interface and "under the hood". There is a very nice series of 15 YouTube videos by BornCG (aka cgboorman) that assumes you know nothing and takes you through Blender. Blender 2.6 Basics I can give you more links if you want to useful videos.. And if you need something just ask - and if I have the time, will see what I can do. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 9, 2015 Author Share Posted December 9, 2015 I am revisiting the scene of the crime of my first PR. Tower of Babel development was already underway, but this was just a patch to fix a problem with loading 2 .babylon files that each had a material of the same name. I prefixed the name of the babylon file name to the name of the material, so if you had 2 blend files with the material 'red', the same names would not cause only the first to be loaded. That is what BJS would do at the time. I am not sure now that first wins with all the changes. I am implementing the last change for the next release. Here I wanted to give someone the option to share a material across .blend files, by optionally changing the name space (prefix). See blue in panel (ignore red, not in official release). Could be useful, especially materials with textures. For TOB, was just going to put in check to implement: if(!scene.getMaterialByName(name) ){ new Material(name, )... }. For .babylon, think the same logic should also be put in for both Material & multi-material. Ok to add checking to respective parse() methods? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 9, 2015 Author Share Posted December 9, 2015 forget the MultiMaterials part. Just an array of materials. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 10, 2015 Share Posted December 10, 2015 This is a smart idea. If we do not find the requested material, we can create one for sure. But this material will be nothing different than the default one correct? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 10, 2015 Author Share Posted December 10, 2015 DK, by your answer, I think I need to explain better. Let's say you have 3 Make Human characters: Adam, Eve, & Steve, and you want each of them in their own Blend file from a work flow point of view. Make Humans can have common meshes for teeth, tongue, eyes, eye browses, eye lashes, hair, & shoes. You probably do not need teeth & tongue if they are more like 'stand-in' characters, with no lines, but they dramatically increase the realism in speech morphing. The materials for those and therefore textures could be shared, if:they all reference the material by same name, eg 'shared.teeth', instead of 'Adam.teeth', 'Eve.teeth', or 'Steve.teeth' (the default is 'Same as Filename') and,It is checked first whether the material can already be found & only add if not. Things can loaded in any order that way.There is no real advantage to keeping the humans in the same blend file for instancing & cloning, since teeth, tongue, eye browses, & eye lashes all have shape keys. Changing of a meshes vertices is impossible with clones & instances. It is also far easier to deal with these meshes if they & their keys were merged with the body, prior to export (MHX2 properties tab has a button which does this). Any clearer? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 10, 2015 Share Posted December 10, 2015 Yep but what is the impact on bjs then? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 10, 2015 Author Share Posted December 10, 2015 Make sure the file loader route only creates a material of the same name once, by checking by name or ID that it is not already in the scene. I do not see that being done in Material.Parse() Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 10, 2015 Share Posted December 10, 2015 It should so I'm completely for this Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted December 10, 2015 Author Share Posted December 10, 2015 It will then be on the PR with io_export_babylon.py. 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.
Note: Your post will require moderator approval before it will be visible.