Hi,
I am trying to script an interface for a script and am running into trouble.
Firstly my specific problem.
I generated a panel in which the user can chose a folder.
This works fine. I did this in the following way:
import bpy
from math import sin,cos,sqrt,exp
class OBJECT_PDB_Panel(bpy.types.Panel):
bl_label = "PDB Blender"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "render"
def draw(self, context):
layout = self.layout
scn = bpy.context.scene
row = layout.row()
row.label(text="Load a PDB file ...")
layout.operator( "fp.button_load_file" )
row = layout.row()
row.label(text="Ausgabepfad")
row = layout.row()
row.prop(scn, "entry_max_atoms")
row = layout.row()
row.label(text="Ball precision (number of sectors)")
row = layout.row()
row.prop(scn, "entry_sectors_azimuth")
row.prop(scn, "entry_sectors_zenith")
row = layout.row()
row.label(text="Scaling factors")
row = layout.row()
row.prop(scn, "entry_ball_radius")
row.prop(scn, "entry_distances")
row = layout.row()
row.label(text="Sticks connecting balls")
row = layout.row()
row.prop(scn, "entry_sticks_yesno")
row = layout.row()
row.prop(scn, "entry_sticks_sectors")
row.prop(scn, "entry_sticks_radius")
row = layout.row()
row.label(text="Center of the whole scene")
row = layout.row()
row.prop(scn, "entry_scene_x")
row.prop(scn, "entry_scene_y")
row.prop(scn, "entry_scene_z")
row = layout.row()
row = layout.row()
row = layout.row()
layout.operator( "fp.button_start" )
class CLASS_Start_Button(bpy.types.Operator):
bl_idname = "fp.button_start"
bl_label = "Start ..."
def execute(self, context):
scn = bpy.context.scene
plot("Button Start")
return {'FINISHED'}
class CLASS_Load_file__Button(bpy.types.Operator):
bl_idname = "fp.button_load_file"
bl_label = "Load file ..."
def execute(self, context):
scn = bpy.context.scene
plot("Button Load File")
return {'FINISHED'}
def register():
bpy.utils.register_class(OBJECT_PDB_Panel)
bpy.utils.register_class(CLASS_Start_Button)
bpy.utils.register_class(CLASS_Load_file__Button)
def unregister():
bpy.utils.unregister_class(OBJECT_PDB_Panel)
bpy.utils.unregister_class(CLASS_Start_Button)
bpy.utils.unregister_class(CLASS_Load_file__Button)
if __name__ == "__main__":
#bpy.types.Scene.entry_max_atoms = bpy.props.IntProperty (name="", default=5000, description = "Number of max. atoms")
bpy.types.Scene.entry_max_atoms = bpy.props.StringProperty (name="", subtype='DIR_PATH')
bpy.types.Scene.entry_sectors_azimuth = bpy.props.IntProperty (name="Azimuth", default=16, description = "")
bpy.types.Scene.entry_sectors_zenith = bpy.props.IntProperty (name="Zenith", default=16, description = "")
bpy.types.Scene.entry_ball_radius = bpy.props.FloatProperty (name="Ball", default=1.0, description = "Ball radius")
bpy.types.Scene.entry_distances = bpy.props.FloatProperty (name="Distance", default=1.0, description = "All distances")
bpy.types.Scene.entry_scene_x = bpy.props.FloatProperty (name="X", default=0.0, description = "X coordinate")
bpy.types.Scene.entry_scene_y = bpy.props.FloatProperty (name="Y", default=0.0, description = "Y coordinate")
bpy.types.Scene.entry_scene_z = bpy.props.FloatProperty (name="Z", default=0.0, description = "Z coordinate")
bpy.types.Scene.entry_sticks_yesno = bpy.props.BoolProperty (name="Yes connect balls", default=False, description = "Yes or no")
bpy.types.Scene.entry_sticks_sectors = bpy.props.IntProperty (name="Sector", default=16, description = "")
bpy.types.Scene.entry_sticks_radius = bpy.props.FloatProperty (name="Radius", default=1.0, description = "")
register()
The user can select a directory path. Now I want to use this path as an ouput path for another script I wrote. As a test I tried to simpyl implement a button which would print the output path to the console but I failed.
How can I grab the information the user inputs into this field?