Hello.
I have made new object.
class myGame_object(bpy.types.Operator):
‘’’ Add myGameObject ‘’’
bl_idname = “object.myGame_object”
bl_label = “Add myGameObject”
bl_options = {‘REGISTER’, ‘UNDO’}
def init(self):
print(“start”)
def del(self):
print(“end”)
def execute(self, context):
print("Exec object
")
animaniacs = [ ( "dummy", "dummy", "myGameDummy object" ),
( "actor", "actor", "kgmActor object" ),
( "object", "object", "kgmGameObject object" )]
bpy.types.Object.type = "myGame"
bpy.types.Object.myGame = True
bpy.types.Object.myGame_player = bpy.props.BoolProperty()
bpy.types.Object.myGame_type = bpy.props.EnumProperty(name='kgm object', items=animaniacs, description='select kgm object')
bpy.types.Object.myGame_state = bpy.props.StringProperty()
bpy.types.Object.myGame_object = bpy.props.StringProperty()
bpy.ops.object.add()
a = bpy.context.object
a.name = "kgmObject"
a.myGame_player = False
a.myGame_type = "object";
a.myGame_state = "None"
a.myGame_object = "None"
return {'FINISHED'}
>>> bpy.context.active_object.myGame
True
so this object is working correctly when add in scene or save(or export). But when I open file again, object not recognized correctly
>>> bpy.context.active_object.myGame
Traceback (most recent call last):
File “<blender_console>”, line 1, in <module>
AttributeError: ‘Object’ object has no attribute ‘myGame’
so why blender can correctly save or open this object? if I already have add object and then open map, objects recognize correctly but after close and again open blender(reseted blender) it not recognize my objects.
any ideas how to solve this?