hey,
I’m still investigating classes and typed this at some point
class ChessGamePlayerInfo(bpy.types.PropertyGroup) :
'''
'''
name = bpy.props.StringProperty()
human = bpy.props.BoolProperty()
moves = bpy.props.CollectionProperty(type=ChessGamePlayerMoves)
<b>move = {} #[] don't work list is the same for white/black :(</b>
class ChessGamePlayer(bpy.types.PropertyGroup) :
'''
'''
white = bpy.props.PointerProperty(type=ChessGamePlayerInfo)
black = bpy.props.PointerProperty(type=ChessGamePlayerInfo)
in order to have ‘api browsable’ values like :
chess = bpy.context.scene.chess
chess.game.player.white.moves['0']['king'] # or [0]['king'] with a list
chess.game.player.black.name
etc
my question (the bold line) is that chess.game.player.white.moves and chess.game.player.white.moves point on the same dictionnary… (but name, human or any other bpy.props properties will work fine, apart between b&w)… so it’s a bit stupid for my purpose.
>>> bpy.context.scene.chess.game.player.white.move['0']['king']
[['e', '8']]
>>> bpy.context.scene.chess.game.player.<b>white</b>.move['0']['king'] = 'of the hill'
>>> bpy.context.scene.chess.game.player.<b>black</b>.move['0']['king']
'of the hill'
I could declare ChessGamePlayerInfo as a CollectionProperty but I’ll get
chess.game.player['white'].moves['0'].king
chess.game.player['black'].name
or
chess.game.player['1'].name
less pretty also I only need two players… so I’d like to keep the first way…
any help comment or pointers welcome, thanks