OGRECave / blender2ogre

Blender exporter for the OGRE 3D engine
GNU Lesser General Public License v2.1
215 stars 70 forks source link

Settings defaults #244

Closed cryham closed 5 months ago

cryham commented 5 months ago

Hi. Versions before recently, had export settings saved for whole Blender I think. I had set them once and any new blend scene with model had it all set up. Recent versions require setting it every time I open a blend file. Seems they are saved per file now. How do I set some defaults? So I don't have to click and set it up all over again for every model.

sercero commented 5 months ago

Well, thats strange.

There was a bug in the way that settings were being saved and what happened to me with previous versions was that the settings were being reset every time.

I was not aware that there might be something per blend file.

Are you using linux?

How did you install Blender and blender2ogre?

cryham commented 5 months ago

Yes I'm on Debian 12. I got Blender 4.1.0 just by unpacking it into a folder from here I think. Unpacked blender2ogre by downloading a zip from github and following readme. Ok right, it's not saved in file. Just kept in opened Blender.

sercero commented 5 months ago

Are you saying that the settings reset every time you open Blender?

cryham commented 5 months ago

Yes, exactly.

sercero commented 5 months ago

Does the log say something when you first start Blender?

cryham commented 5 months ago

OgreMeshTool.log is written in Ogre-Next build path: /home/ch/_sr/Ogre/ogre-next/build/Release/bin/OgreMeshTool.log and has nothing suspicious:

19:07:00: XMLMeshSerializer reading mesh data from /home/ch/sr^/3d+/,trees 9+/jungle3_tall.mesh.xml...
19:07:00: Reading geometry...
19:07:00: Geometry done...
19:07:00: Reading submeshes...
19:07:00: Submeshes done.
19:07:00: Reading mesh names...
19:07:00: Mesh names done.
19:07:00: XMLMeshSerializer import successful.
19:07:01: MeshSerializer writing mesh data to stream ...
19:07:01: File header written.
19:07:01: Writing mesh data...
19:07:01: Writing submesh...
19:07:01: Submesh exported.
19:07:01: Writing submesh...
19:07:01: Submesh exported.
19:07:01: Writing submesh...
19:07:01: Submesh exported.
19:07:01: Exporting LOD level thresholds....
19:07:01: LOD level thresholds exported.
19:07:01: Exporting bounds information....
19:07:01: Bounds information exported.
19:07:01: Exporting submesh name table...
19:07:01: Submesh name table exported.
19:07:01: Exporting hash for caches...
19:07:01: Exporting hash for caches exported.
19:07:01: Mesh data exported.
19:07:01: MeshSerializer export successful.

Hmm what attributes should this have: /home/ch/.config/blender/4.1/config/scripts/io_ogre.pickle because I see 644. Same as I had for Blender 3.6.

sercero commented 5 months ago

No, the log we need here is the blender2ogre log.

I'm suprised you have the io_ogre.pickle picke file because now the file were the settings are being saved is a JSON file. That file might be from a previous blender2ogre installation.

So there might have been an issue creating the file for the new settings.

Do you run Blender from the CLI?

I want to see the Blender logs when you start it and when you export (the CLI logs).

When the export dialog shows is when the options are loaded and when the exporting process is finished the options are saved.

There might be I/O errors with permissions in the log.

cryham commented 5 months ago

Okay, but I saw io_ogre.pickle recreated again after I deleted it. Where is blender2ogre log? Sorry I forgot. So I ran Blender in CLI, loaded a palm, exported and closed.

~/_p/blender-4.1.0$ ./blender
Read prefs: "/home/ch/.config/blender/4.1/config/userpref.blend"
[ INFO] Starting io_ogre (0, 8, 5)
Add-on not loaded: "modular_tree", cause: cannot import name 'm_tree' from partially initialized module 'modular_tree' (most likely due to a circular import) (/home/ch/.config/blender/4.1/scripts/addons/modular_tree/__init__.py)
version 4 imported
Add-on not loaded: "modular_tree", cause: cannot import name 'm_tree' from partially initialized module 'modular_tree' (most likely due to a circular import) (/home/ch/.config/blender/4.1/scripts/addons/modular_tree/__init__.py)
Read blend: "/home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-/arabicpalm2.blend"
________________________________________________________________________________ 

# Blender Script:
import bpy
bpy.ops.ogre.export(
  filepath='/home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-/arabicpalm2.scene', 
  EX_ARMATURE_ANIMATION=False, 
  EX_GENERATE_TANGENTS=3, 
  EX_LOD_LEVELS=3, 
  EX_LOD_PERCENT=25, 
  EX_MATERIALS=False, 
  EX_SCENE=False, 
  EX_SHAPE_ANIMATIONS=False, 
  EX_TRIM_BONE_WEIGHTS=0.009999999776482582, 
)
________________________________________________________________________________ 

[ INFO] * Target path: /home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-
[ INFO] * Target file name: arabicpalm2.scene
[ INFO] * Blender version: 4.1.0 (release; Linux)
[ INFO] * Processing Scene: arabicpalm2, path: /home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-
[ INFO] * Exporting root node: Light 
[ INFO] * Exporting root node: Camera 
[ INFO] * Exporting root node: palm_arabic 
[ INFO] * Generating: palm_arabic.mesh.xml
[ INFO]   - Vertices: 1515
[ INFO]   - Loop triangles: 1812
[ INFO] * Writing shared geometry
Blender version >= 3.2
 + Faces [=================================================>] 99%   
[ INFO] - Done at 0.13 seconds
[ INFO] * Writing submeshes
[ INFO] - Done at 0.13 seconds
[ INFO] - Created palm_arabic.mesh.xml at 0.13 seconds
[ INFO] Converting mesh from XML to binary: /home/ch/_sr/Ogre/ogre-next/build/Release/bin/OgreMeshTool -e -t -ts 3 -O puqs -o -v2 -l 3 -d 300 -p 25 /home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-/palm_arabic.mesh.xml
[ INFO] Removing generated xml file after conversion: /home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-/palm_arabic.mesh.xml
[ INFO] - Created palm_arabic.mesh in total time 0.18 seconds
[ INFO] - Done at 0.19 seconds
________________________________________________________________________________
Report:
  Original Vertices: 1515
  Exported Vertices: 1924
  Original Faces: 1812
  Exported Triangles: 1812
  MESHES: 1
  LIGHTS: 1
  CAMERAS: 1

Extended Report:
  MESHES:
    . palm_arabic
  LIGHTS:
    . Light
  CAMERAS:
    . Camera
________________________________________________________________________________
Saved session recovery to "/tmp/quit.blend"
[ INFO] Unloading io_ogre (0, 8, 5)

Blender quit
cryham commented 5 months ago

Ah okay. I got the latest version installed now 0.9.0 and did that again. It seems to save settings now. Strangely sometimes I don't have export .log in same dir as .mesh

~/_p/blender-4.1.0$ ./blender
Read prefs: "/home/ch/.config/blender/4.1/config/userpref.blend"
[ INFO] Starting io_ogre (0, 9, 0)
Add-on not loaded: "modular_tree", cause: cannot import name 'm_tree' from partially initialized module 'modular_tree' (most likely due to a circular import) (/home/ch/.config/blender/4.1/scripts/addons/modular_tree/__init__.py)
version 4 imported
Add-on not loaded: "modular_tree", cause: cannot import name 'm_tree' from partially initialized module 'modular_tree' (most likely due to a circular import) (/home/ch/.config/blender/4.1/scripts/addons/modular_tree/__init__.py)
Read blend: "/home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-/arabicpalm2.blend"
________________________________________________________________________________ 

# Blender Export Script:

import bpy
bpy.ops.ogre.export(
  filepath='/home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-/arabicpalm2.scene', 
  EX_ARMATURE_ANIMATION=False, 
  EX_EXPORT_HIDDEN=False, 
  EX_FORCE_CAMERA=False, 
  EX_FORCE_LIGHTS=False, 
  EX_GENERATE_TANGENTS='3', 
  EX_LOD_LEVELS=3, 
  EX_LOD_PERCENT=25, 
  EX_MATERIALS=False, 
  EX_NODE_ANIMATION=False, 
  EX_SCENE=False, 
  EX_SELECTED_ONLY=False, 
  EX_SHAPE_ANIMATIONS=False, 
  EX_TRIM_BONE_WEIGHTS=0.009999999776482582, 
)

________________________________________________________________________________ 

[ INFO] * Creating Text Block 'ogre_export-202406152226' with export script
[ INFO] * Saving config to: /home/ch/.config/blender/4.1/config/scripts/io_ogre.json
[ INFO] * Target path: /home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-
[ INFO] * Target file name: arabicpalm2.scene
[ INFO] * Blender version: 4.1.0 (release; Linux)
[ INFO] * Processing Scene: arabicpalm2, path: /home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-
[ INFO] * Exporting root node: Light 
[ INFO] * Exporting root node: Camera 
[ INFO] * Exporting root node: palm_arabic 
[ INFO] * Generating: palm_arabic.mesh.xml
[ INFO]   - Vertices: 1515
[ INFO]   - Loop triangles: 1812
[ INFO] * Writing shared geometry
 + Faces [=================================================>] 99%   
[ INFO] - Done at 0.12 seconds
[ INFO] * Writing submeshes
[ INFO] - Done at 0.13 seconds
[ INFO] - Created palm_arabic.mesh.xml at 0.13 seconds
[ INFO] Converting mesh from XML to binary: /home/ch/_sr/Ogre/ogre-next/build/Release/bin/OgreMeshTool -e -t -ts 3 -O puqs -v2 -l 3 -d 300 -p 25 /home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-/palm_arabic.mesh.xml
[ INFO] Removing generated xml file after conversion: /home/ch/sr^/3d+/,trees 9+/3 palm+/arabic-palmtree``-/palm_arabic.mesh.xml
[ INFO] - Created palm_arabic.mesh in total time 0.18 seconds
[ INFO] - Done at 0.19 seconds
________________________________________________________________________________
Report:
  Original Vertices: 1515
  Exported Vertices: 1924
  Original Faces: 1812
  Exported Triangles: 1812
  MESHES: 1
  LIGHTS: 1
  CAMERAS: 1

Extended Report:
  MESHES:
    . palm_arabic
  LIGHTS:
    . Light
  CAMERAS:
    . Camera
________________________________________________________________________________
Saved session recovery to "/tmp/quit.blend"
[ INFO] Unloading io_ogre (0, 9, 0)
[ INFO] * Saving config to: /home/ch/.config/blender/4.1/config/scripts/io_ogre.json

Blender quit

So it works now.