Giter Site home page Giter Site logo

blender2ogre's Introduction

blender2ogre

This versions requires Blender 2.8+. For Blender 2.7x: use the 2.7x-support branch

Index

Installing

  1. Copy the io_ogre folder into the $BLENDER_DIR/scripts/addons folder.
  2. Enable the addon in Blender: Edit menu > Preferences > Add-ons. Search for 'ogre' and click the box up the top left.
  3. Configure the plugin before the first run.
    • Set the correct path to OGRETOOLS_XML_CONVERTER
      • for Ogre (v1): path should point to OgreXMLConverter.exe. This can be found in the Ogre SDK
      • for OgreNext (v2): path should point to OgreMeshTool.exe. This can be found in the OgreNext SDK
    • OPTIONAL Set MESH_PREVIEWER to a path pointed to ogre-meshviewer.bat. This can be found in OGRECave/ogre-meshviewer
    • Make sure that USER_MATERIALS isn't set to a directory like "C:\". The addon scans this path recursively and will crash when it hits a path it doesn't have permissions for.

NOTE: Installing Blender using Ubuntu Snap package or Fedora Flatpak will lead to the following error: cp: cannot create directory '/snap/blender/3132/3.4/scripts/addons/io_ogre': Read-only file system (see: Installing on Ubuntu 20.04 and Blender 3.4.1. #169)

There are two possible solutions:

  • After downloading the blender2ogre repo, uncompress it somwhere and then compress the io_ogre folder as a .zip file. Go to Edit -> Preferences (CTRL-ALT-U) -> Add-ons -> Install... and then select the file io_ogre.zip
  • Copy the io_ogre folder into the folder: ~/.config/blender/3.4/scripts/addons/ (where 3.4 is the Blender version)

Updating to new versions

If you are upgrading from a previous version of blender2ogre and having problems, you may want to delete your old .json config file from $BLENDER_DIR/config/scripts/io_ogre.json and restart blender.

Video Tutorials

Exporting Meshes

To export a blender model: File Menu > Export > Ogre3D (.scene & .mesh).

If the menu button is greyed out (or you get this error: RuntimeError: Operator bpy.ops.ogre.export.poll() failed, context is incorrect), then make sure there is an active object selection in the blender Node tree (Scene collections) first. The active object selection is when there is an object with a yellow outline (in contrast to the orange outline of the passive selected objects)

  • If you have OGRETOOLS_XML_CONVERTER set to "OgreXMLConverter.exe" path, then the export dialogue will display options relevant to the Ogre (v1) mesh format.
  • If you have OGRETOOLS_XML_CONVERTER set to "OgreMeshTool.exe" path, then the export dialogue will display options relevant to the OgreNext (v2) mesh format.

Check out all the exporter and importer options in the Options Document

Materials

Materials will be exported as OGRE 1.x material files or as OGRE Next material.json files as required.

OGRE 1.x Materials

Materials are exported as RTSS OGRE 1.x materials (unless "Fixed Function Parameters" is selected). The following textures are exported: Base Color, Metallic and Roughness, Normal Map and Emission. Baked Ambient Occlusion is not supported for the moment.

Your material will be best exported if you follow the GLTF2 guidelines: glTF 2.0 - Exported Materials. Except for the Emission texture, where the Emission input of the Principled BSDF node is used as the Emission texture.

A good example of how the material should be setup for best results is the "Damaged Helmet" model found here: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/DamagedHelmet

OGRE Next JSON Materials

The current OGRE Next JSON exporter only explicitly supports a metalness workflow, however it will attempt to export materials not following that workflow regardless and may produce passable results.

For materials using metalness it expects a single image with the blue channel containing the metalness map and the green channel containing the roughness map fed into the Principled BSDF via a Separate RGB node. Not following this convention will print a warning to the console and the exported materials will likely not appear correctly when rendered.

There are numerous features in the Ogre Next JSON format that are not directly supported, see the Materials JSON notes for details.

Blender Modifiers Support

Blender has some very useful modifiers, and most of them are supported by blender2ogre but not all of them. Check out the Blender Modifiers Support Page to check out the list and also some recommendations about them.

Mesh triangulation issues

Cube with broken shading

If you are seeing some issues with the mesh triangulation (like visible triangles in your shading), check the Mesh Triangulation README to learn more about the subject and how to work around it.

OgreNext tips

If you do want to export in the OgreNext (v2.) format, make sure in the Export dialogue > General Settings > Mesh Export Version is set to V2. The following parameters are a good starting point to get a model exported to an Ogre mesh:

  • General
    • Mesh export version: v2
  • Materials
    • Export materials: ticked
  • Armature
    • Armature animation: ticked
  • Mesh
    • Export mesh: ticked
    • Edge lists: un-ticked
    • If your model's materials contain normal mapping:
      • Tangents: "generate with parity"
      • Else Tangents: "none"
    • Optimise Vertex buffers for shaders: ticked
    • Vertex buffer options: puqs

You can check the arguments passed to OgreMeshTool.exe in the Blender console. (Window Menu > Toggle System Console)

Blender will export the material format in an Ogre (V1) format. This is not compatible with OgreNext (V2.*). You should manually convert them to a material.json file. See the Ogre Wiki: HLMS Materials for more information.

Importing Meshes

As of blender2ogre version 0.8.2, the Kenshi Importer has been integrated into blender2ogre with the following features:

  • Import mesh from .xml as well as .mesh files
  • Import whole .scene files (as of version 0.8.5) with all its objects
  • Option to be able to merge imported submeshes or keep them separate
  • Parsing/Conversion of materials into Blender (just create a Principled BSDF material and add a texture with the proper UV mapping)
  • Importing of Poses
  • Importing of Skeletons works for the most part, but Ogre skeletons conventions are not like Blenders (see: How to get bone's vector and bone's length?)
  • Importing of Animations work, but depends on the skeleton which sometimes doesn't get correctly imported
  • As of Blender 4.1+, it is now possible to drag and drop files of types: .xml, .mesh or .scene and import them automatically. (https://docs.blender.org/api/4.1/bpy.types.FileHandler.html)

NOTE: Orientation of the imported mesh is assumed to be xz-y (Ogre default), the blender2ogre Axis Swapping option does not work for the importing process.

Additional Features

Merge Objects on export

You might have hundreds of objects, which you want to keep separate but have them in one .mesh on export. For this create a new collection (M) named merge.<yourname>. The output will be a single <yourname>.mesh file. Alternatively link the collection.

NOTE: The origin of the resulting merged object will be that of the last object you added to the collection (although when reloading the blend file, this order will be lost). To have control over the precise location of where the merged objects' origin will be, use the dupli_offset property of the collection. Setting any value other than the default (0, 0, 0) will result in a mesh with the origin set to that value. For example:

dupli-offset.png

Instancing and DotScene Plugin

As of OGRE 1.13 a new feature has been added to the DotScene Plugin where it now accepts the static / instanced keywords for entities. (for more information read the DotScene Plugin README).

To use this feature create a new collection (M) names as static.<Group Name> or instanced.<Instance Manager Name> and blender2ogre will automatically add the corresponding attribute to the exported entities in the Scene. This feature goes hand in hand with Exporting Particle Systems to create vegetation, debris and other static objects in your scene.

External OGRE Materials

You might already have some materials in OGRE that you do not want to export. Prefix them with extern.<yourname> and the sub-entity will have the material name set, but the material is not exported. The following material 'vertexcolor' can be defined in your OGRE project:

extern-material.png

Console Export

You might have several blender files in your project you want to export to Ogre. Do this by hand? NO! You can do better! Here is how you can export a scene with blender2ogre.

blender test.blend -b --python-expr "import bpy;bpy.ops.ogre.export(filepath='test.scene')"

Exporting Custom Vertex Groups

As shown in the picture below, you can now export SubEntities that contain a user-defined amount of faces.

blender-vertex-group.png

You simply call your vertex group with the prefix ogre.vertex.group.<yourname> and access it in Ogre similar to the following:

void example(const Ogre::Entity * entity)
{
    auto collision = entity->getSubEntity("collision");
    auto mesh = collision->getSubMesh();
    VertexData * data = nullptr;
    if (!mesh->useSharedVertices) {
        data = mesh->vertexData;
    } else {
        data = mesh->parent->sharedVertexData;
    }
    auto pos_cursor = data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
    auto vbuffer = data->vertexBufferBinding->getBuffer(pos_cursor->getSource());
    auto ibuffer = mesh->indexData->indexBuffer;

    uint16_t * indices = static_cast<uint16_t*>(ibuffer->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
    float * vertices = static_cast<float*>(vbuffer->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
    float * v;
    int count = mesh->indexData->indexCount;
    int stride = vbuffer->getVertexSize() / 4;
    for (int i = 0; i < count; i+=3) {
        uint16_t a = indices[i], b = indices[i+1], c = indices[i+2];
        pos_cursor->baseVertexPointerToElement(vertices + a * stride, &v);
        Vector3 va(v);
        pos_cursor->baseVertexPointerToElement(vertices + b * stride, &v);
        Vector3 vb(v);
        pos_cursor->baseVertexPointerToElement(vertices + c * stride, &v);
        Vector3 vc(v);
        // do something with your triangle here
    }
    ibuffer->unlock();
    vbuffer->unlock();
}

The vertex group will get the material name 'none' so you might want to add the following script:

material none {
    technique {
        pass {
           // ...
        }
    }
}

Exporting Custom Normals

Cube with Filled Edges

Custom Split Normals is a way to tweak the mesh shading by pointing normals towards directions other than the default, auto-computed ones. It is mostly used in game development, where it helps counterbalance some issues generated by low-poly objects (the most common examples are low-poly trees, bushes, grass, etc. and the ‘rounded’ corners). Check out the Custom Normals README to learn more about Custom Normals in Blender.

Exporting Skeletal Animations

skeletal-animations.png

Skeletal Animation refers to the technique of using bones to deform a mesh as if the mesh were the skin. This kind of animation is commonly used to animate characters in video games. Check out the Skeletal Animations README to see how to create and export an animated mesh.

Exporting Particle Systems

particle-system5.png

A common technique for laying out random objects on a scene in Blender is to use the Particle System. Check out the Particle System README to see how to create and export a scene where the trees, foliage and rocks are distributed randomly using a particle system.

Exporting Shape Animations

shape-animations4.png

Shape (or Pose) Animations allow animating different poses, a technique commonly used to do face animations. Check out the Shape Animations tutorial to see how to create some poses and animate them. Then you can use blender2ogre to export the poses and animations into a .mesh file.

Exporting Node Animations

Node Animations are a way to have scripted node animations in your Ogre application. Check out the Node Animations tutorial to see how to create some animations for a couple of different scenarios.

Exporting for Physics

Check out the Exporting for Physics tutorial to see some techniques and optimizations when exporting collision meshes for Physics Engines

Exporting Vertex Colors

vertex-colors.png

blender2ogre can import and export Vertex Colors, a way to assign colors to your mesh by vertex. It is also possible to asign alpha values to each vertex for transparency or other uses. Check out the Vertex Colors tutorial to see how to create the Vertex Colors in Blender and how to export them.

Exporting SkyBoxes

skyboxes1.jpg

blender2ogre can generate SkyBoxes from HDRi Maps and export them in a format that can be used in OGRE, that is a Cube Map. Check out the SkyBoxes tutorial to see how to create import the Environment Map in Blender and how to export it.

Level of Detail (LOD)

Level of Detail or LOD is an optimization technique supported by OGRE, where meshes that are far away from the camera are replaced by meshes with lower vertex count. Because you can get away with less detailed models when they are in the distance this optimizacion technique is very common, especially in games. With blender2ogre there are three ways to generate LOD levels for a mesh:

  • OgreMesh Tools: This method uses the tool OgreMeshUpgrader to automatically generate the LOD levels for the mesh by removing edges. This allows only changing the index buffer and re-use the vertex-buffer (storage efficient)
  • Blender: This method uses Blenders "Decimate" Modifier to automatically generate the LOD Leves by collapsing vertices. This can result in a visually better LOD, but needs different vertex-buffers per LOD
  • Manual: This metod requires that the user manually creates the additional LOD levels for the mesh. The meshes should be called [base mesh]_LOD_1, [base mesh]_LOD_2, etc. This method gives better control over the resulting LODs.

For the Manual method it is currently not possible to manually set the distances for each LOD, but it is possible to have different materials for each LOD level.

Mesh Previewer

If MESH_PREVIEWER is set, a button will appear allowing you to preview your mesh in Ogre3D. If the button isn't there, the path is invalid. This only works for Ogre (V1) meshes. The button is located here:

Preview mesh button location

About

The original version of this was a single monolithic Python file. This is not maintainable and contains a tremendous amount of bugs. There was the need to export Blender model to OGRE from the console, thus I rewrote the whole script and split it into several files. It has been well-tested on Linux 64-bit and should work with others.

Authors

This Blender addon was made possible by the following list of people. Anyone can contribute to the project by sending bug reports and feature requests here. Naturally, the most welcome contribution is actual code via pull requests. If you are planning to implement something "big", it's a good practice to discuss it in the issue tracker first with other authors. So that there is no overlap with other developers or the overall roadmap.

Additionally, the following companies have supported/sponsored the development efforts.

blender2ogre's People

Contributors

adamlatchem avatar alexeyknyshev avatar bdotq avatar benoitjuin avatar darksylinc avatar feuertiger86 avatar fighter19 avatar grodou avatar jamieson avatar knn217 avatar ltz675 avatar mrapplejuice avatar oancaandrei avatar ohlidalp avatar oldmanauz avatar paroj avatar planrich avatar redchillipadi avatar robjames-texas avatar rpaciorek avatar scorg avatar sercero avatar wxmerkt avatar xissburg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blender2ogre's Issues

Windows: Exporting using an older version of OgreXmlConverter will cause the export to hang

ogreconverterparametererror

I'm using OgreXmlConverter 1.7.2 on Windows 10.

In util.py xml_converter_parameters() method, it calls the exe with "-v". This crashes the older versions of the converter. The dialog box I added above will appear, and the export will not continue until it is closed.

I have fixed this locally by using the method found here:
https://stackoverflow.com/questions/5069224/handling-subprocess-crash-in-windows?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Export Path on Linux

When exporting on linux, blender 2.78c
Exported *.mesh are dropped in "~" (home) , is this a feature or a bug?
Shouldn't *.mesh files be dropped in the same directory as *.scene files are dropped?

Using on 2.78 c get error

Create new project (with cube)
Clcik Export- Ogre 3d- Export and get error

  File "D:\blender-2.78c-windows64\2.78\scripts\addons\io_ogre\ui\export.py", line 78, in execute
    scene.dot_scene(target_path, target_file_name_no_ext)
  File "D:\blender-2.78c-windows64\2.78\scripts\addons\io_ogre\ogre\scene.py", line 150, in dot_scene
    xmlparent = doc._scene_nodes
  File "D:\blender-2.78c-windows64\2.78\scripts\addons\io_ogre\ogre\scene.py", line 456, in dot_scene_node_export
    mesh.dot_mesh(ob, path, overwrite=overwrite)
  File "D:\blender-2.78c-windows64\2.78\scripts\addons\io_ogre\ogre\mesh.py", line 620, in dot_mesh
    util.xml_convert(target_file, has_uvs=dotextures)
  File "D:\blender-2.78c-windows64\2.78\scripts\addons\io_ogre\util.py", line 38, in xml_convert
    version = xml_converter_version()
  File "D:\blender-2.78c-windows64\2.78\scripts\addons\io_ogre\util.py", line 32, in xml_converter_version
    return xml_converter_parameters()[1]
  File "D:\blender-2.78c-windows64\2.78\scripts\addons\io_ogre\util.py", line 18, in xml_converter_parameters
    proc = subprocess.Popen([exe,'-v'],stdout=subprocess.PIPE)
  File "D:\blender-2.78c-windows64\2.78\python\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "D:\blender-2.78c-windows64\2.78\python\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

location: <unknown location>:-1

Materials and mesh in .scene files

I used a DotSceneLoader from the Ogre Wiki and i saw that in .scene file, mesh nodes are supposed to contain a materialFile attribute.

https://github.com/screwt/ogre_experiment_2/blob/feature/dotSceneLoader/src/DotSceneLoader.cpp#L687

But i did not found the blender2ogre code where this append.
Also, the .scene i generate to not have this attributes:

https://github.com/screwt/ogre_experiment_2/blob/feature/dotSceneLoader/bin/Data/scene4/test.scene#L3

Could you enlighten me?

Mesh vertices get exported relative to scene origin

When exporting with blender -b scene.blend --python ~/.config/blender/2.83/scripts/addons/io_ogre/console.py -- /tmp/blender 'scene abc'

The contained meshes get their vertices exported relative to the origin of the scene, as opposed to the origin of their mesh.
This makes adjusting them inside Ogitor really painful.

Wrong output model scale and pose

Dear authors,
I have a complex scene and realized that an object's pose and scaling is not respected.
I could temporarily fix it for me by changing two statements in io_ogre/ogre/mesh.py in version 0.7.1:

Line 225: x,y,z = swap(ob.matrix_world * v.co)
Line 563: x,y,z = swap( ob.matrix_world * pv.co - ob.matrix_world * v.co )

Not sure whether that's the way to fix it. I hope it clarifies the issue.
Regards, Henning

Release new version

@paroj can you do a small bump in the blender2ogre version (like 0.7.3) and release a new one?

That is because the current release (0.7.2) shows as version 0.7.1 and also it includes this evil change: #35 which you reverted in master.

Any new OGRE user will most likely download the release version and have a strange experience when exporting scenes.

Thanks!

Constant value frame animation

Mi problem is that Ogre seems to ignore constant value frames in animations.
In one of my animations, I need to do an object teleport to a near location. I have done the animation in blender using Graph Editor and making the translation constant, so it looks like It instantly changes position.
But when I export it to Ogre, I can still see the object (really fast) moving to one position to other. Is this any Ogre internal issue? Can I do it any other way? Some ideas?

Instancing and DotScene

@paroj this has let me thinking about instancing and DotScene.

Do you have any ideas in that regard?

Perhaps DotScene could have a std::map that creates a new Instance Manager when there are more than 2 instances of a mesh.

Or perpahs it can be done with a group like the merge., would be something like instance..
And modify the DotScene DTD to have a tag regarding instancing with the names of the Instance Managers and the meshes.

Originally posted by @sercero in #66 (comment)

Blender 2.9.x

Unfortunately, I use Blender 2.9.0 for my work. Is there support in the future?

Exporter duplicates mesh?

Hi all,

okay, I first off admit I am a newbie in the area. I've been fiddling with Blender since a few days only and with Ogre not much longer. Still, the effect I see is puzzling. Attached you find an entirely simple model that uses Blender's built-in monkey face (Suzanne) along with a plane a cone. If I export this with File -> Export -> Ogre3D this exports fine, but within Blender Suzanne and the plane below it appear to have been duplicated. You can try by moving the face off its initial position. A copy remains in place that hasn't been there before the export.

I'm using blender2ogre 0.8.1 with Blender 2.92.0 on Debian 10.

The effect is a nuisance mostly, since I can just close and reopen Blender and everything is as it has been before, but I don't understand why this is happening. Again, the exported .meshmodel is fine, the issue is about the state Blender is in after the export.

Here's the console output:

Read prefs: /home/quintus/.config/blender/2.92/config/userpref.blend
/run/runtime/quintus/gvfs/ non-existent directory
[ INFO] Starting io_ogre (0, 8, 1)
Read blend: /home/quintus/repos/rpg-rawdata/blends/suzanne.blend
[DEBUG] Context.blend_data: /home/quintus/repos/rpg-rawdata/blends/suzanne.blend
[DEBUG] Context.scene.name: Scene
[DEBUG] Self.filepath: /tmp/export2/suzanne.blend
[DEBUG] Self.last_export_path: None
[DEBUG] Self.filepath: /tmp/export2/suzanne.blend
________________________________________________________________________________
[ INFO] Target_path: /tmp/export2
[ INFO] Target_file_name: suzanne.blend
[DEBUG] Target_file_name_no_ext: suzanne
[ INFO] * Processing Scene: suzanne, path: /tmp/export2
[DEBUG] ABABA Suzanne
[DEBUG] ABABA Plane
[DEBUG] ABABA Cone
[ INFO] + Merge Group: merge.testmesh
[ INFO]   - Suzanne.001
[ INFO]   - Plane.001
[ INFO]   - Cone.001
[ INFO] * Processing Materials
[WARNING] No materials, not writting .material script
[ INFO] * Exporting root node: testmesh 
[ INFO] Vertices: 544
[ INFO] Loop triangles: 1032
[ INFO] * Generating: testmesh.mesh.xml
[ INFO] * Writing shared geometry
 + Faces [==================================================>] 100.0%   
[ INFO] - Done at 0.17 seconds
[ INFO] * Writing submeshes
[ INFO] - Done at 0.18 seconds
[ INFO] - Created testmesh.mesh.xml at 0.18 seconds
[ INFO] Removing generated xml file after conversion: /tmp/export2/testmesh.mesh.xml
[ INFO] - Created testmesh.mesh in total time 0.31 seconds
[ INFO] Extern material: _missing_material_
________________________________________________________________________________
Report:
  Original Vertices: 544
  Exported Vertices: 3018
  Original Faces: 1032
  Exported Triangles: 1032
  MESHES: 1

Extended Report:
  MESHES:
    . testmesh
________________________________________________________________________________
Saved session recovery to '/tmp/quit.blend'
[ INFO] Unloading io_ogre (0, 8, 1)

Blender quit

suzanne.zip

Cannot enable Exporter

oave4Ij 1
The importer works just fine. But the exporter is throwing an error. Does anyone know what I can do to fix it?

Releases naming 0.8.2 vs 0.7.4

0.8.2 vs 0.7.4, which one is the latest???
0.7.4 is newer than 0.8.2 though.

Edit: perhaps be more clear about which branch each is from

Calculate bitangents (binormals?)

Hello @paroj,

I have recently been delving into shaders and was having trouble when using the binormal from Ogre (I assume it is the same as bitangent, right?).

I thought it was being calculated by Ogre, but now I think that it should be in the mesh buffer...

So I was thinking of implementing the exporting of bitangents/binormals from blender since I saw it was in ogremeshxml.dtd.

What I wonder before going into that trouble if it is worth it, is it better to calculate it in the vertex shader or to have it as information in the mesh?

What made me stop is this sentence from the Blender manual: "Bitangent vector of this vertex for this polygon (must be computed beforehand using calc_tangents, use it only if really needed, slower access than bitangent_sign)".
MeshLoop(bpy_struct)

Outdated Version

i recently tried to install blender2ogre for blender 2.79b, i followed the steps, it did not work.

i then installed blender 2.75, and everything works

is this still getting attention? because it should.

i'd be grateful if the scripts were updated to work with the latest blender

and if it supported spline exporting to XML format for sonic generations

Thanks

Export Issue dot_scene_node_export url = url, doc = doc, rex = rex,

Hello,

Using Windows 10 Pro(if it matters).

When exporting a armature(with 1 bone -- very simple test) using versions 2.66, 2.71, and 2.75 I get the following error:

Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.66\scripts\addons\io_ogre\ui\export.py", line 78, in execute
    scene.dot_scene(target_path, target_file_name_no_ext)
  File "C:\Program Files\Blender Foundation\Blender\2.66\scripts\addons\io_ogre\ogre\scene.py", line 150, in dot_scene
    xmlparent = doc._scene_nodes
  File "C:\Program Files\Blender Foundation\Blender\2.66\scripts\addons\io_ogre\ogre\scene.py", line 583, in dot_scene_node_export
    url = url, doc = doc, rex = rex,
NameError: global name 'url' is not defined

location: <unknown location>:-1

location: <unknown location>:-1

I am using OgreSDK 1.10.4 CommandLineTools (if that matters).

Maybe I am doing something wrong as I am a programmer (not an artist), but I can export mesh files with materials just fine. Which... I also noticed when exporting materials and textures, you need to have the *.blend file name as a folder and to put the textures in there for the export to work (this may be a bug as it seems like Blender should automatically tell the script where textures are located on the drive). For example, if you have a *.blend file called "Cube.blend", you must have a folder called "Cube" and place all your textures in there for the script to work correctly.

Thanks for your time!

Default workflow is swapping axes

As in title I did very simple thing : import mesh ; slightly modify ONE vertex and exported mesh. The result is rotated mesh -- swapped axes in Ogre3d program ( yxz probably). Is that a bug or feature I cannot properly handle ;) ?

Please release new versions

Hello @paroj, sorry to bother you but I think it would be prudent to release new versions of blender2ogre branches, since there are new features and bug fixes. Besides work has subsided here.
Thanks

Blender 2.79 - Exporting error with vertex groups

Hello.

While trying to export a really basic animation (rotating cube), I am having this error :


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/oak/.config/blender/2.79/scripts/addons/io_ogre/ui/export.py", line 101, in execute
    scene.dot_scene(target_path, target_file_name_no_ext)
  File "/home/oak/.config/blender/2.79/scripts/addons/io_ogre/ogre/scene.py", line 156, in dot_scene
    xmlparent = doc._scene_nodes
  File "/home/oak/.config/blender/2.79/scripts/addons/io_ogre/ogre/scene.py", line 463, in dot_scene_node_export
    mesh.dot_mesh(ob, path, overwrite=overwrite)
  File "/home/oak/.config/blender/2.79/scripts/addons/io_ogre/ogre/mesh.py", line 230, in dot_mesh
    append_triangle_in_vertex_group(mesh, ob, vertex_groups, face, tri)
  File "/home/oak/.config/blender/2.79/scripts/addons/io_ogre/ogre/mesh.py", line 657, in append_triangle_in_vertex_group
    group = obj.vertex_groups.get(g.group)
SystemError: <built-in method get of bpy_prop_collection object at 0x7f0a29333510> returned a result with an error set

location: <unknown location>:-1

Here's the problematic .blend :
problematic.zip

The error started appearing after weight painting (which assigns vertex groups to the mesh).

It is related to error #22

Origin of merge groups

Hi all!

Which is the rule blender2ogre uses to determine the origin of a merge group? I've experimented a little and I think the rule is "it's the origin of the last object added into the collection", but it'd be nice to have that confirmed (with a note in the README maybe).

-quintus

Please release new version

Hello @paroj, I know you have a lot on your hands, but it would be good to have a new release (2.7x too please) because there have been many changes lately and most likely people are going to use the stable releases.

Code base clean up

@paroj
Is there benefit to continual code clean up?

What do you/anyone else think about my comments from #124 (below). Does anyone loose any used functionality if the 3 files are removed from the source code? To me, they look like they contain broken or unused code.

If it is chosed to remove them, do you keep a copy of the deleted code in the source somewhere for future reference or are old releases of this plugin a good enough backup?

This change started to remove a lot of code. I stopped before I got too carried away. It looks to me it looks like there is a lot of code that doesn't work due to API changes or people stopped maintaing it. But I'm not familiar enough with the code or the people using the extra features of the plugin it to make that call.
3. Removed code from ui/init.py referencing a material viewer (& editor?)

  • ui/material.py was removed. The code in material.py was moved to unused.py because it looked like someone had spent a lot of time on it and it might be useful for future efforts? I don't know what the correct action to take around this is.
    Potentially the following files could also be removed. I can't see where this code is currently used.
    • properties.py
    • game_logic.py
    • terrain.py

'merge.' prefix not working in 2.8

So the 2.80 support branch has been usable, however I have come across the the 'merge.' prefix feature to merge grouped objects, failing quite fantastically.
Main issue is the change from Groups to Collections in 2.8 and how they are set up to behave I believe. So definitely some syntax updates, but also some other bugs I can't yet figure out

Error during Ogre Material Layers execution

After preparing material in Blender I press Ogre Material Layers and I am getting next error:

In console:

Traceback (most recent call last):
File "blender-2.75-linux-glibc211-x86_64/2.75/scripts/addons/io_ogre/ui/material.py", line 130, in draw
node = nodes[ self.INDEX ]
IndexError: list index out of range

location: :-1

location: :-1

As a popup:
Traceback (most recent call last):
File "blender-2.75-linux-glibc211-x86_64/2.75/scripts/addons/io_ogre/ui/material.py", line 76, in invoke
shader.create_material_passes(mat)
File "blender-2.75-linux-glibc211-x86_64/2.75/scripts/addons/io_ogre/ui/material.py", line 85, in create_material_passes
node = tree.nodes.new(type='MATERIAL_EXT')
RUntimeError: Error: Node type MATERIAL_EXT undefined

location: : -1

resources require specific location

when exporting materials and textures, you need to have the *.blend file name as a folder and to put the textures in there for the export to work (this may be a bug as it seems like Blender should automatically tell the script where textures are located on the drive). For example, if you have a *.blend file called "Cube.blend", you must have a folder called "Cube" and place all your textures in there for the script to work correctly.

(from #3)

exporting tangents broken

XMLConverter dropped support for the -t option in 1.10, which the exporter used to generate tangents.

This unveiled the error, that we never exported tangents but actually only triggered generation.

Blender 2.80 support

for reference: https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API

Hello everybody, I wanted to use the plugin with the new blender 2.80, but - hey - as you would expect, it did not work.

So I put in my elbow-grease to patch the current version of the exporter. If somebody wants to have a look, check out this branch: 2.80-support

I know that basic mesh and material exporting works again for 2.80 after this patch, but the following features remain untested for now:

  • Textures
    • Texture image conversion (internal vs external images)
    • Texture UV maps in general
    • Multi UV map support
  • Everything physics related (I actually know that I removed some stuff there)
  • Custom variables on objects
  • Scene support (I was only interested in exporting single models)
  • I did not test whether the examples in the /examples folder still work (probably they do not)

But it is a starting point in case somebody wants to continue the conversion. Keep in mind, that I was not too keen on keeping backwards compatibility with older blender versions. I think that it will be hard to do so because the internal blender models for representing meshes have changed considerably and the code is currently not written in a way to include different exporters for different blender versions in an easy way.

NodeAnimation exporter

I started using Ogre and I need many simple animations, translation-rotation keyframes for objects.
In blender I used the standard animation keyframe giving names to animations as seen in the image:
ExportNodeAnim
Unfortunately the exporter supports only skeletal animation, but I found that http://wiki.ogre3d.org/Easy+Ogre+Exporter for 3DS Max supports them https://github.com/OGRECave/EasyOgreExporter/blob/629da70741f9bcad18466868cb3631cffdefe7f4/source/ExScene.cpp#L104
I don't know much about the blender side of the plugin, but it seems
https://github.com/OGRECave/ogre/blob/master/Tools/XMLConverter/docs/ogremeshxml.dtd
does not allow dumping ketframes directly under animation nodes so I would like to know if it simply is not developed yet or there are some Ogre version differences.

only export keyframes for node animations

This function processess the objects animation frame by frame, insted of using its keyframes

Im not fully happy with this. While I understand the need of it, there are serious drawbacks.

  • what are the FPS of the animation? 24 as the blender default? This might or might not do what the user expects.
  • by getting rid of the keyframes, there are no keyframes to easily modify the animation in code
  • unrolling the animation in .skeleton is less evil as that is a binary format not edited by humans. .scenes on the other hand seem to be designed to be human readable. But with unrolling animations you end with something like this:
    vrar20-3dvis

I think in this case, I would just for once advocate for a user-switch (default-off):

  • only write node keyframes

(we can also merge this as is and add that later)

Originally posted by @paroj in #86 (comment)

Mesh Without Material

Hello, I was wondering if Blender2Ogre could export a mesh without a material attached to it. For example, we want to have *.mesh with no predefined material so we can assign our own.

Thanks you!

An Ogre minimal loader

Is there any minimal ogre3d project or interface or even class that is able to load the generated files ?
That would be usefull.

Add Mesh Version Convertion Capabilities

As it is, the plugin do not offer the possibilty to convert the generated mesh to an other version.

In deed i was trying to load meshes to ogre2.1, i had to use the OgreMeshTool to convert from 1.10 to 2.1 to be able to load the mesh.

Targetting mesh output version would be usefull i think.

Wrong proportions

Hi,
I just managed to export files with your plugin.
However the objects are not scaled like defined in Blender.
It is always scaled down to 1x1x1 and not the wanted size.
Is this a known bug or is there a solution?

Bug with Ogre Next mesh (OgreMeshTools) export & proposed code changes.

Hi,
I've been going through the source code of the v0.8.2 release to fix a bug exporting a mesh in the Ogre Next format with (OgreMeshTools.exe) in Blender 2.93 and to look at the complexity to add functionality to export material files to Ogre Next format (*.material.json). I have some bugs/questions/suggestions below. I'm happy to work away at them but wanted to touch base with the people maintaining this plugin before getting carried away. Sorry if this isn't the correct place for all this.

  1. =BUG= -- FIXED--
    There is a bug where OgreMeshTools failes because the exporter passes the argument -None which is unrecognised.
    This is cause by io_ogre\util.py - line 306: cmd.append('-%s' %config.get('MESH_TOOL_EXPORT_VERSION')).

config.get('MESH_TOOL_EXPORT_VERSION') isn't declared anywhere.
Changing the line to cmd.append('-%s' %config.get('MESH_TOOL_VERSION')) fixes the error.
Related to this bug is the option to select V1&V2 mesh in the export dialogue doesn't show up because in io_ogre\ui\export.py, line 95 = "General" : ["EX_SWAP_AXIS", "EX_V2_MESH_TOOL_EXPORT_VERSION", "EX_XML_DELETE"], should read: "General" : ["EX_SWAP_AXIS", "EX_V2_MESH_TOOL_VERSION", "EX_XML_DELETE"],

  1. =QUESTION= --RESOLVED--
    Does the tundra related code work? Does it get used by anyone?

  2. =QUESTION= --RESOLVED--
    io_ogre\config.py - line 176 onwards --> The line "registry_key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, r'Software\blender2ogre', 0, winreg.KEY_READ)" always fails and is logged in console because there is no install process to create registry keys. Can this code be removed?

  3. =PROPOSAL=--RESOLVED--
    The source took a bit of time looking through to get an idea of what is going on. Are making changes like renaming python files to be abit more explicit about their funciton and documenting rough outline of a class' purpose worth making?
    Example: Rename material.py to OgreGenerateMaterial.py (Thinking forward to put OgreNext material export code to OgreNextGenerateMaterial.py or something similar)

  4. =PROPOSAL= --RESOLVED--
    Document in the readme where the settings file is saved: "C:\users<user>\appdata\roaming\blender foundation\blender<version>\config\scripts\io_ogre.pickle" I may have missed it but it took a while to find it.

  5. =PROPOSAL= --RESOLVED--
    Document in the readme the export output filenames.

  6. =PROPOSAL= --RESOLVED--
    The exporter seems to run fine in 2.93, should this be updated in the source or documented?

  7. =QUESTION= --RESOLVED--
    What does the code in console.py do?

can't enable the plugin on windows

Hi,
when activating the plugin in win10 it show this errors:
tested with blender 2.79 and 2.75

Exception while reading windows registry: [WinError 2] El sistema no puede encontrar el archivo especificado
Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\modules\addon_utils.py", line 331, in enable
    mod = __import__(module_name)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_ogre\__init__.py", line 36, in <module>
    from . import properties
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_ogre\properties.py", line 5, in <module>
    load_user_materials()
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_ogre\ogre\material.py", line 405, in load_user_materials
    scripts,progs = update_parent_material_path( config.get('USER_MATERIALS') )
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_ogre\ogre\material.py", line 673, in update_parent_material_path
    parse_material_and_program_scripts( path, scripts, progs, missing )
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_ogre\ogre\material.py", line 444, in parse_material_and_program_scripts
    parse_material_and_program_scripts( url, scripts, progs, missing )
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_ogre\ogre\material.py", line 466, in parse_material_and_program_scripts
    p = OgreProgram( data='\n'.join(chk) )
NameError: name 'OgreProgram' is not defined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.