I'm writing a script, where an operator is registered in the Add->Mesh menu. Clicking this menu displays a panel, where the user can enter certain parameters and then invoke another operator using a button in the panel.
I'm using custom scene properties for the parameters, as shown in this code snippet.
The text property is set to an empty string whenever I edit it. It starts out with the default value "Lorem ipsum". Whenever I change the value in the panel text box, and then click away, the text box loses its value.
Here's my stripped down code, which still doesn't work:
def initSceneProperties(scene):
bpy.types.Scene.photoPath = StringProperty(
name="Path to photos",
description="Path to the folder containing the JPG photos")
scene["photoPath"] = "Lorem ipsum"
return
initSceneProperties(bpy.context.scene)
# ==============================================================
class add_mesh_point_cloud(bpy.types.Operator):
bl_idname = "mesh.point_cloud_add"
bl_label = "Add Point Cloud"
bl_options = {'REGISTER', 'UNDO'}
bl_description = "Generate a point cloud from photographs"
def execute(self, context):
return {'FINISHED'}
def invoke(self, context, event):
return {'FINISHED'}
def draw(self, context):
layout = self.layout
layout.prop(context.scene, "photoPath")
What's happening? How can I fix it?