Object Creation acting oddly

Hello,

I have two scripts, one of them is my actual script I’m working on, and the other is just a test.

In the test script a new object is created via this code

 obj = bpy.data.objects.new('Cube', bpy.data.meshes.new('mesh'))
 bpy.data.scenes[0].objects.link(obj)

And in the other it is createdly effectively the same way:

obj = bpy.data.objects.new('Cube', bpy.data.meshes.new('mesh')) #ONLY HANDLES MESH OBJECTS
bpy.data.scenes[0].objects.link(obj) #ONLY LINKS TO ONE SCENE

But the test script creates an object that while it has nothing in it’s mesh, is movable and shows up as a object center in 3D view.

The proper script creates an object that is visible in outliner and can be edited via python , but, although it can be selected (only via outliner), cannot be moved or have it’s mesh edited and does not show up in 3D view in any way and is generally completely absent.

You need to have something in your mesh before you link it to the scene.

Try something like this…


me = myMeshCreationRoutine()
obj = bpy.data.objects.new('Cube', me)
bpy.data.scenes[0].objects.link(obj)

What do you expect when you create a mesh with nothing in it…bugs?

Stuff is added to mesh later, and also, then control version has an empty mesh and it doesn’t fail. I’ll try it though.

I added 8 vertices to the mesh before object creation, no effect.

You have to do

me.upate()

Before you create or assign it to the object.

That didn’t work either sorry, any more ideas?

Here’s the .blend somebody please work this out, Atom you’d be good for this, it’s your script originally :p.

The instructions are written at the top of Storage.py, I’m pretty sure you can connect to yourself, pleeeeeeease have a look Atom.

Attachments

NE6.blend (345 KB)

Dang dude, you are worse than my kid…can I get you a danish while I am at it?

I know sorry, but I can’t find the problem and this thing has been broke forever, it’s annoying the crap outta me XD

Don’t want to bother you as you’ve done so much for me already but, are you actually going to fix it, or shall I keep trying myself? I’d love it if you’d fix it, but I don’t know if you have enough time or give-a-crap :p.