Hi,
I’m trying to create a popup with a specified number of line, (number of objects in the scene) but I have difficulties.
Here is my code :
import bpy
from bpy.props import *
class LocationManager(bpy.types.Operator):
bl_idname = "object.location_operator"
bl_label = "Manage location on anchors"
male_string = bpy.props.StringProperty( \
name="Male locations", \
description="Here enter the locations, separated by commas" \
)
def execute(self, context):
#TODO : manage the results
return {'FINISHED'}
def invoke(self, context, event):
wm = context.window_manager
return wm.invoke_props_dialog(self, 500, 500)
def draw(self, context):
#test datas
objects = [obj for obj in bpy.context.scene.objects if obj.type == 'EMPTY']
col = self.layout.column()
col.prop(self, "male_string")
self.layout.separator()
col.label("Female locations")
# ####HERE I want to add on StringProperty by obj####
for obj in objects:
self.female_string = bpy.props.StringProperty(name="Female locations",description="Here enter the locations, separated by commas")
col.prop(self, "female_string")
#
# The OK button in the dialog
#
class OnErrorOk(bpy.types.Operator):
bl_idname = "location.validation"
def execute(self, context):
return{'FINISHED'}
bpy.utils.register_class(LocationManager)
# test call : for debug usage
bpy.ops.object.location_operator('INVOKE_DEFAULT')
The for loop seems not to add a new StringProperty by objects… Here is my main issue.
Thanks a lot for any advice/solution