Blender as a world editor

Community Forums/Developer Stations/Blender as a world editor

Aussie(Posted 2014) [#1]
Just wondering does anyone here use Blender as a world editor with Blitz3d. I have just noticed that you can now give objects in blender custom properties "Property Name & Property Value"

I am looking into writing a script to export Object position, rotation, scale & custom properties to a text file.
I am getting help with the script on BlenderArtists, but if anyone here uses blender like this would you mind sharing how you use it.

If i can get the script working i will share it with you all.


TheTophatDemon(Posted 2014) [#2]
Cool, I use Blender for levels too. I do it a bit different, though. Instead of trying to make a mess accessing those properties, I just put all the properties in the name of the object. For instance : MovingPlatform45,2 where 45 and 2 are the properties. I just parse the name string to get them.


Aussie(Posted 2014) [#3]
Nice, i had thought about doing that myself.
I have been working on a couple of scripts the last couple of days & am very close to getting exactly what i am after.
I currently have a working script that spits out the object name, location & rotation of the selected objects to a .txt file.
Also have a script for creating custom properties panel that i can access & spit out to the info out to same .txt file it just needs a bit more work to get some listbox stuff working. Here is an example of the .txt file.

[start]
Object:Sphere
X#:4.453246116638184
Y#:0.0
Z#:5.8991827964782715
Xrot#:0.0
Yrot#:0.0
Zrot#:0.0

Object:Cube
X#:0.0
Y#:0.0
Z#:0.0
Xrot#:0.0
Yrot#:0.0
Zrot#:0.0

[end]


The script i am still working on will add this to the txt file.
[start]
Object:Sphere
X#:4.453246116638184
Y#:0.0
Z#:5.8991827964782715
Xrot#:0.0
Yrot#:0.0
Zrot#:0.0
Field#=Value
Field%=Value

Object:Cube
X#:0.0
Y#:0.0
Z#:0.0
Xrot#:0.0
Yrot#:0.0
Zrot#:0.0
Field%=Value
Field%=Value
Field$=Value
Field#=Value

[end]



Aussie(Posted 2014) [#4]
For those who may find this useful here is a couple of scripts for Blender.
https://www.mediafire.com/folder/8h02ayr2m9oyb/Blender

Custom_prop_1.py
Will add a panel under Objects called "My Custom Properties."
It's not working 100% how i would like it at the moment but it does the job. The + & - bottons will add & remove a "Field & Value." The small + in the bottom left corner of the panel pay no attention to at the moment as when it is clicked on, the controls it opens are not set up to do anything.

Export_obj_properties.py
Will add a "Object location, scale, rotation & custom properties" to the Import Export section under User Preferences & show up as "My model format(.txt)" when you go to "File" "Export"

To do:
Custom_prop_1.py
Will at some point add a list box function so the "Fields & Values" are stored & can just simply be selected instead of having to re type them for every object.

Currently if you need to have multiple objects containing the same "Fields & Values" the original object can just be duplicated & the values will copy across to the duplicated object.

Note:
If you change the "Fields & Values" of a duplicate i will not affect the original.

This is the format it will export the information to:



Rick Nasher(Posted 2014) [#5]
Thanks that seems very useful.


Aussie(Posted 2014) [#6]
No worries Rick Nasher.

Hello all,
I have been busy since i wrote the script, haven't really had much chance to use it & have just discovered a couple of problems with the export script.
1) The script was exporting the object rotations as radians instead of degrees.
2) The X & Z rotations are opposite to the rotations in Blender. Eg 30 in Blender is -30 Blitz3d

Both have now been fixed & the export script has been updated.

Export_obj_properties_Degrees.py
Will add a "Object location, scale, rotation & custom properties V1.0" to the Import Export section under User Preferences & show up as "My model format V1.0(.txt)" when you go to "File" "Export"

Apologies to anyone who has been using the script & it not working.