I really do not like 2.5, as they flipped the GUI all over, and took out needed things like after you spacebar>add>object>cylinder, it adds one without asking how many rings/stuff you want. I tried right-clicking the object, and I looked for ways to set it but I saw none. Also right-clicking a border between to panels didn't let me split or anything like that....Yah, every release you have to re-learn blender.
Its not hard to re-learn you know. And I think the changes are worth it. Some quick research on the website and you'll be up to speed. The 'space bar' add function is now mapped to 'shift+A' as the space bar is used for something else. By clicking on the corners you can separate and merge workspaces and to change the number of faces on a newly added object you can add the stuff in the tools panel which u can get by pressing T.
I really recommend 2.5x to the older version :)
loveheaven made one (animations missing):The problem is, no animations = nearly useless. The majority of models will be animated, and thus must be exported as so. We really need that script to be expanded before it will be of use.
https://forum.megaglest.org/index.php?topic=7230.msg73922#msg73922
I would really like to add it to our git so it doesn't get lost but it kinda lacks a license... have to contact him.
Hmmmm, what is actually the issue with the animations?There is no issue, the script maker simply didn't include a way to export them.
So it's just a question of fixing it, not how to fix it? Alrighty, good.Well, think of it like if multiplayer was removed in MegaGlest, it's suddenly useless until we add the multiplayer. Animations are to G3D as Multiplayer is to MegaGlest, and just like multiplayer, animations are a difficult part of the script. I think the entire reason that they aren't in the script was that the script writing didn't know how to add them. Though, the inactivity shows that it's unlikely to be updated, so if any individual wishes to give it a shot, go ahead.
I have the feeling we all need glasses... Especially me because i just noticed now that loveheaven posted an _import_ script, no export at all. Sorry if i confused someone....
Thanks. I added animation support (at least i hope so) but your cube looks a bit weird. Texture seems to be wrong too. Do you have another model which is textured correctly in blender (texture view)? Exporting an imported archmage model looks correct.
Btw, customcolor aka 'make alpha appear in teamcolor' is now always enabled. How do you set it in blender? Or was it always on?
PS: The link above always points to the newest version of the script.
Now Exporting File: C:\Users\Frederick\Desktop\Cube.g3d
Traceback (most recent call last):
File "C:\Program Files (x86)\Blender Foundation\Blender\2.60\scripts\addons\ex
portg3d.py", line 607, in execute
G3DSaver(self.filepath, context)
File "C:\Program Files (x86)\Blender Foundation\Blender\2.60\scripts\addons\ex
portg3d.py", line 495, in G3DSaver
texname = bpy.path.basename(material.active_texture.image.filepath)
AttributeError: 'Texture' object has no attribute 'image'
Currently in the 2.49 version, it is set by making the object single or double sided. This is definitely not the right way. I don't have a copy of 2.5 on hand but 2.49 has a switch in the map-to section of the material settings for that. Alternatively, the main material section has a switch for using the alpha channel in tex face images, so I think that would also be suitable.
In Blender 2.60a, I get that the exported .g3d file is 7Kb if i Ctrl-T them,(that means making every triangles.)All faces need to be triangles otherwise they're ignored. There is no warning shown yet as i haven't found an easy way to do that.
however one time i got a larger file out of it.
EDIT:2.60a Importing work i tried the Archmage like you and it worked, but i could not export him again.There was a problem with the mesh count if you deleted a mesh before exporting. Should be fixed now.
This is the output from megaglestg3dviewer When i tro to open a Initate.g3d file i have IMPORTED From game Folder then EXPORTED (with a resulting file size of..134KB.Looks like the texture couldn't be found. I'm no MG dev... In GAE you get a default texture.
the Original File size is 126
TEH OUTPUT
http://pastebin.com/ZKuvY7tN
Also if a try to export a cube made of triangles it gives this error in blenders command promt.I added a check to make sure the active texture in the (first) material is an image texture. Texture is ignored if it's not the case.Code: [Select]Now Exporting File: C:\Users\Frederick\Desktop\Cube.g3d
Traceback (most recent call last):
File "C:\Program Files (x86)\Blender Foundation\Blender\2.60\scripts\addons\ex
portg3d.py", line 607, in execute
G3DSaver(self.filepath, context)
File "C:\Program Files (x86)\Blender Foundation\Blender\2.60\scripts\addons\ex
portg3d.py", line 495, in G3DSaver
texname = bpy.path.basename(material.active_texture.image.filepath)
AttributeError: 'Texture' object has no attribute 'image'
Importing Works but have some quirks when i imported some of my own models it sorta imports some weird ghost particles or something like that model file link is hereWorks fine for me. I don't see any "particles".(click to show/hide)
Currently in the 2.49 version, it is set by making the object single or double sided. This is definitely not the right way. I don't have a copy of 2.5 on hand but 2.49 has a switch in the map-to section of the material settings for that. Alternatively, the main material section has a switch for using the alpha channel in tex face images, so I think that would also be suitable.Do you mean something like that (Face Textures):
| Anyway, I encountered a few problems. Firstly, I was unable to get the texture on my cube to export correctly when I tried, despite it rendering correctly (F12), and being set to map to "UV" (though with past exporters, they always exported the texture coords by the UV, regardless of what you have set for Blender's internal renderer. The image is very much properly linked as it would be necessary with the older exporter. It still does export, but the UV coords (which tell where each point of the 3D model's faces should be "mapped" to the 2D image) seem messed up, as seen in the image to to the right (the left cube is the G3D viewer, the right cube is the rendered Blender version, showing how it should look). In addition, when I tried to apply bone animation (which the majority of animated models will use), the exporter totally ignored the bones and exported the mesh as though they didn't exist, yet the G3D viewer recognizes there are multiple frames, just the exact same unchanged model in every frame. I think this may be because you were working with an imported archmage. Imported models use shape keys, instead of bones (since bones are not preserved in the G3D model). This sadly is a huge limitation, as bones are crucial for glest modeling. And of course, here is the zip file from my test, containing the blend file with a textured and animated cube, the PNG for the texture (Blender defaults to PNG now!), and the exported G3D: [big]Download ZIP (http://www.mediafire.com/?jz7tokgab06fgya) (60.5 KB)[/big] | (http://img706.imageshack.us/img706/4623/unledajc.png) |
Regarding triangles, is there a way to have the export script automatically convert quads to triangles? Quads are vastly easier to work with because they preserve edge loops.Yeah, i can do that if it's needed. But don't expect the importer to make quads again.
I made some more fixes and added support for armature animation. Both cubes, Coldfusionstorm's and Omega's, work now. An imported archmage model works too. customcolor is still hardcoded.Awesome job! I can confirm that both the textures and animations worked flawlessly.
Sorry for this noob question.... But don't I need a .py file? All I get when I click Yggdrasil's link is a big page of code...Uh, that is the python file. Save it as .py and place it in the scripts/addons folder, then enable it in the addons menu of user preferences.
Sorry for this noob question.... But don't I need a .py file? All I get when I click Yggdrasil's link is a big page of code...Uh, that is the python file. Save it as .py and place it in the scripts/addons folder, then enable it in the addons menu of user preferences.
Save it in any text editor? Just like xml, c++, etc etc.Sorry for this noob question.... But don't I need a .py file? All I get when I click Yggdrasil's link is a big page of code...Uh, that is the python file. Save it as .py and place it in the scripts/addons folder, then enable it in the addons menu of user preferences.
Yes I got that... just how do I save it as .py file :-[? Sorry. I haven't really touched Blender scripts before.
I just tried this script (From this URL: http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD (http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD)) and when importing g3d's into blender 2.57 (the latest release) i see no proper animation sequences when i 'play' the model. Has anyone been able to confirm animations work (without them this is kindof useless).Wait, no longer? When did it ever import animations? There was shape keys in the past, but they were pretty useless, and G3D doesn't contain bones (yet another reason why MD5 should replace it), so those can't be imported.
Thanks
enum MeshPropertyFlag{
mpfCustomColor= 1,
mpfTwoSided= 2
};
I made another fix. I switched the values of the mesh properties teamcolor and double sided. The format spec described in this thread:Done.
https://forum.megaglest.org/index.php?topic=713
is wrong. Every glest has it the other way around, even vanilla. This is probably one cause why the old exporter used double sided to trigger teamcolor.
Can some moderator please edit the old post by martino and change it to this:Code: [Select]enum MeshPropertyFlag{
mpfCustomColor= 1,
mpfTwoSided= 2
};
Here the link again:
http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blob_plain;f=source/glexemel/g3d_support.py;hb=HEAD
(Right-click 'Save As', name it g3d_support.py, in blender: File->User Preferences -> Addons -> Install Addon (bottom), pick the downloaded file, enable it)Oh, and the wiki has a new page (https://docs.megaglest.org/G3D support) detailing this script, including installation and preparation.
I changed the script to respect your selection. If nothing is selected it's still exporting all meshes.Cool, I updated the wiki page (https://docs.megaglest.org/G3D support) and its links.
I changed the script to respect your selection. If nothing is selected it's still exporting all meshes.Perfect. :)
I don't really know what you mean with scaling and how i should fix it. Could you please provide a blend file which illustrates this problem?If you scale or move something in object mode, the export script acts as if the change weren't made... or at least that's what I was experiencing with one of my blend files. When I tried it on a new scene, scaling a moving a cube in object mode, it stayed moved and scaled properly in the g3d. Upon further testing, it seems that the exporter does take the object-mode transformations into account, but they have a tendency to turn out wrong. Basically, this makes it so you have to apply all your object data before exporting, which isn't a big problem but isn't exactly ideal either. This also makes it so you can't reliably use object transformations for animation -- i.e. if you want to make a wheel rotate, it needs an armature.
G3DSaver(self.filepath, context, self)
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.63\scripts\ad
dons\source_glexemel_g3d_support.py", line 534, in G3DSaver
for face in mesh.faces:
AttributeError: 'Mesh' object has no attribute 'faces'
Now Exporting File: C:\Glest-mods\untitled.g3d
Traceback (most recent call last):
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.63\scripts\ad
dons\source_glexemel_g3d_support.py", line 683, in execute
G3DSaver(self.filepath, context, self)
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.63\scripts\ad
dons\source_glexemel_g3d_support.py", line 534, in G3DSaver
for face in mesh.faces:
AttributeError: 'Mesh' object has no attribute 'faces'
Nice yggdrasil, But when you uhmm, say oushed the fix, where exactly?Same link, bro. That's the link to the "head" version, which is always up to date. The diff can be seen here (http://glestae.git.sourceforge.net/git/gitweb.cgi?p=glestae/glestae;a=blobdiff;f=source/glexemel/g3d_support.py;h=7a9336bd73ad728e9b6fa46c3fc74ab1fcef8a08;hp=f3d6564f96147c2cb5f5885ef9071c107e2d4c63;hb=af742d511477cfd4947a426e2027e1bbb7cbebda;hpb=33ea21bcc69741e9179efae452d1f4046e2893b5).
@Yggdrasil: We try to keep a copy of teh blender exporter in the MG repository too, because we want to deliver it with MG.Yes to all three questions.
Where do we find the latest version ?
Is it here?: https://docs.megaglest.org/Exportscript
And do you know if this is compatible with MegaGlests g3d format?
@Coldfusionstorm: done, please test ...
@Yggdrasil: We try to keep a copy of teh blender exporter in the MG repository too, because we want to deliver it with MG.
Where do we find the latest version ?
Is it here?: https://docs.megaglest.org/Exportscript
And do you know if this is compatible with MegaGlests g3d format?
I updated the importer and exporter. It's now possible to export imported models with animations, but you have to use a workaround to make it work. After importing you have to click into the list of shape keys for each mesh you imported. After that the animation should work normally and you can export the meshes again. I probably forgot to update/recalculate something but i can't find a way to trigger it. You have to live with this workaround for now.Nice work, Yggdrasil. It's a very unusual work around, but beats nothing. Should make modifying older mods much more bearable.
Yggdrasil, is there a way to make the script default to having "rotate to glest orientation" checked?
I like working in blender's default axes better than glest's default axes
default=True)(replaces False with True)I made it default to false mainly because it's a new option and modifies the mesh. Maybe not everyone wants to use it. I don't know how your workflow in blender looks like. If the majority of the modelers use this option, it should be enabled by default. Opinions?I like using default orientation, but if anyone is opposed to it, I'm fine with editing the line after downloading
Importer and exporter now support multiple texture slots. The first slot in the
material is the diffuse map, second and third slot are specular and normal map.
Other slots are ignored. All textures share the same coordinates.
The option to rotate the mesh is now enabled by default in importer and
exporter.
trunk/source/shared_lib/sources/graphics/model.cpp
r4057 r4219
771 771 specularPower= meshHeader.specularPower;
772 772 opacity= meshHeader.opacity;
773
773 if(opacity==0){
774 printf("found a mesh with opacity=0 in header, using opacity=1 to see it now \n");
775 printf("file: %s\n",modelFile.c_str());
776 opacity=1.0f;
777 }
774 778 textureFlags= meshHeader.textures;
775 779
I mean you magically set it from invisible to fully opaque. Invisible objects are probably useless, but still...Are they really useless? I feel they could be used to help the selection of units. For example, the Undead faction used a "ghost" unit that was pretty much just particle effects. The model as I remember it was a small cube, which made it difficult to select the unit. A larger, invisible cube would have worked better. Of course, we could still mimic invisibility with a transparent texture, but setting the model transparent could remove the need for a texture entirely.
added new option 'fully opaque' to blender addon
This new option is a mesh property located in the G3D properties panel. If
enabled it sets the opacity of the mesh to 1.0, ignoring what's set as alpha in
materials which is normally used for the opacity. This allows the modder to set
alpha in materials to 0 and see the alpha effects of the texture in the 3D view
of blender.
for i in range(1,header.framecount-1):bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.remove_doubles()
bpy.ops.object.mode_set(mode='OBJECT')