SceneEdit or LevelEditor

A simple upgrade :wink:

Instead of:

for obj in bpy.data.objects:
    if obj.sel:
        # etc.

you should use:

for obj in Blender.Object.GetSelected():
    # etc.

so you can remove bpy dependency and you resolve some runtime error problems.

:slight_smile:

Thanks for your work!

Thanks for the small adjustment! What does that do though? I mean, I get what the GetSelected method is doing (didn’t know about that by the way, thanks for the tip) but what is the advantage of removing the bpy dependency and what are the runtime errors you refer to?

ADDITION: On another forum where I mentioned these scripts, someone suggested that I switch

for obj in bpy.data.objects:

to

sce = bpy.data.scenes.active
for obj in sce.objects:

What does that change do? Is that related to the runtime errors you mentioned? Off the top of my head I’m guessing this is to do with errors if you run the script without any objects selected.

blender,like many other 3d-packages. can handle many different scenes.
this makes most sense when doing cg-movies where those scenes refer to pretty much the same as in real movies.
for game-development those are less important in most cases.
getting the objects of the current scene is a “just in case someone DOES use scenes” precaution. so you don’t get all the stuff from other scenes which are not even related to the stuff you see onscreen.

that would be my interpretation of that code. however. i didnt check the api so it might be off^

With your original code I’ve got a runtime error with a selected object (an object with “DupliGroup” Blender option enabled if I correctly remember) in the “obj.sel” check which doesn’t appear with the replaced code.

GetSelected method is used in Chicken exporter too, so I think it’s a good idea to use it.

:slight_smile:

Now that I’ve started playing around with Panda, I might tweak these scripts to write egg files describing scenes like this here:
discourse.panda3d.org/viewtopic … 1450#31450

I could just use the names of objects in Maya as the filename to be included.