Python bpy.props.StringProperty() Examples

The following are 10 code examples of bpy.props.StringProperty(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bpy.props , or try the search function .
Example #1
Source File: oscurart_mesh_cache_tools.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
def register():
    from bpy.types import Scene
    from bpy.props import (BoolProperty,
                           IntProperty,
                           StringProperty,
                           )

    Scene.pc_pc2_rotx = BoolProperty(default=True, name="Rotx = 90")
    Scene.pc_pc2_world_space = BoolProperty(default=True, name="World Space")
    Scene.pc_pc2_modifiers = BoolProperty(default=True, name="Apply Modifiers")
    Scene.pc_pc2_subsurf = BoolProperty(default=True, name="Turn Off SubSurf")
    Scene.pc_pc2_start = IntProperty(default=0, name="Frame Start")
    Scene.pc_pc2_end = IntProperty(default=100, name="Frame End")
    Scene.pc_pc2_group = StringProperty()
    Scene.pc_pc2_folder = StringProperty(default="Set me Please!")
    Scene.pc_pc2_exclude = StringProperty(default="*")
    
    bpy.utils.register_module(__name__) 
Example #2
Source File: idproperty.py    From Blender-WMO-import-export-scripts with GNU General Public License v3.0 6 votes vote down vote up
def _create_id_property(field_name):
    def fn(*args, **kwargs):
        """ the main class.  """
        value_key = _create_value_key(kwargs["name"])
        validator = kwargs.pop("validator", None)

        kwargs["get"] = create_getter(field_name, value_key)
        kwargs["set"] = create_setter(field_name, value_key, validator)

        payload = {
            "field_name": field_name,
        }
        kwargs["description"] = json.dumps(payload)

        prop = p.StringProperty(*args, **kwargs)
        return prop

    return fn 
Example #3
Source File: segments.py    From BlenderRobotDesigner with GNU General Public License v2.0 5 votes vote down vote up
def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self)


# class CreateNewSegment(bpy.types.Operator):
#     """
#     :term:`operator` for creating a new segment in the robot model.
#
#
#     """
#     bl_idname = config.OPERATOR_PREFIX + "createbone"
#     bl_label = "Create new Bone"
#
#     boneName = StringProperty(name="Enter new bone name:")
#
#     def execute(self, context):
#         try:
#             parentBoneName = context.active_bone.name
#         except:
#             parentBoneName = None
#
#         if not context.active_object.type == 'ARMATURE':
#             raise Exception("BoneCreationException")
#             # return{'FINISHED'}
#         armatureName = context.active_object.name
#         armatures.createBone(armatureName, self.boneName, parentBoneName)
#
#         designer.ops.select_segment(boneName=self.boneName)
#         armatures.updateKinematics(armatureName, self.boneName)
#
#         # TODO: set parentMode according to own parent
#         return {'FINISHED'}
#
#     def invoke(self, context, event):
#         return context.window_manager.invoke_props_dialog(self) 
Example #4
Source File: archipack_progressbar.py    From archipack with GNU General Public License v3.0 5 votes vote down vote up
def register():
    Scene.archipack_progress = FloatProperty(
                                    options={'SKIP_SAVE'},
                                    default=-1,
                                    subtype='PERCENTAGE',
                                    precision=1,
                                    min=-1,
                                    soft_min=0,
                                    soft_max=100,
                                    max=101,
                                    update=update)

    Scene.archipack_progress_text = StringProperty(
                                    options={'SKIP_SAVE'},
                                    default="Progress",
                                    update=update)

    global info_header_draw
    info_header_draw = bpy.types.INFO_HT_header.draw

    def info_draw(self, context):
        global info_header_draw
        info_header_draw(self, context)
        if (context.scene.archipack_progress > -1 and
                context.scene.archipack_progress < 101):
            self.layout.separator()
            text = context.scene.archipack_progress_text
            self.layout.prop(context.scene,
                                "archipack_progress",
                                text=text,
                                slider=True)

    bpy.types.INFO_HT_header.draw = info_draw 
Example #5
Source File: models.py    From phobos with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def register():
    """TODO Missing documentation"""
    from bpy.types import WindowManager
    from bpy.props import StringProperty, EnumProperty, BoolProperty

    WindowManager.modelpreview = EnumProperty(items=getModelListForEnumProperty, name='Model')
    WindowManager.category = EnumProperty(items=getCategoriesForEnumProperty, name='Category')
    compileModelList() 
Example #6
Source File: band.py    From BlendLuxCore with GNU General Public License v3.0 5 votes vote down vote up
def copy(self, orig_node):
        for item in self.ramp_items:
            # We have to update the parent node's name by hand because it's a StringProperty
            item.node_name = self.name 
Example #7
Source File: __init__.py    From Fluid-Designer with GNU General Public License v3.0 4 votes vote down vote up
def register():
    bpy.utils.register_module(__name__)

    # space_userprefs.py
    from bpy.props import StringProperty, EnumProperty
    from bpy.types import WindowManager

    def addon_filter_items(self, context):
        import addon_utils

        items = [('All', "All", "All Add-ons"),
                 ('User', "User", "All Add-ons Installed by User"),
                 ('Enabled', "Enabled", "All Enabled Add-ons"),
                 ('Disabled', "Disabled", "All Disabled Add-ons"),
                 ]

        items_unique = set()

        for mod in addon_utils.modules(refresh=False):
            info = addon_utils.module_bl_info(mod)
            items_unique.add(info["category"])

        items.extend([(cat, cat, "") for cat in sorted(items_unique)])
        return items

    WindowManager.addon_search = StringProperty(
            name="Search",
            description="Search within the selected filter",
            options={'TEXTEDIT_UPDATE'},
            )
    WindowManager.addon_filter = EnumProperty(
            items=addon_filter_items,
            name="Category",
            description="Filter add-ons by category",
            )

    WindowManager.addon_support = EnumProperty(
            items=[('OFFICIAL', "Official", "Officially supported"),
                   ('COMMUNITY', "Community", "Maintained by community developers"),
                   ('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)")
                   ],
            name="Support",
            description="Display support level",
            default={'OFFICIAL', 'COMMUNITY'},
            options={'ENUM_FLAG'},
            )
    # done... 
Example #8
Source File: __init__.py    From Fluid-Designer with GNU General Public License v3.0 4 votes vote down vote up
def register():
    from bpy.utils import register_class
    for mod in _modules_loaded:
        for cls in mod.classes:
            register_class(cls)

    # space_userprefs.py
    from bpy.props import StringProperty, EnumProperty
    from bpy.types import WindowManager

    def addon_filter_items(self, context):
        import addon_utils

        items = [('All', "All", "All Add-ons"),
                 ('User', "User", "All Add-ons Installed by User"),
                 ('Enabled', "Enabled", "All Enabled Add-ons"),
                 ('Disabled', "Disabled", "All Disabled Add-ons"),
                 ]

        items_unique = set()

        for mod in addon_utils.modules(refresh=False):
            info = addon_utils.module_bl_info(mod)
            items_unique.add(info["category"])

        items.extend([(cat, cat, "") for cat in sorted(items_unique)])
        return items

    WindowManager.addon_search = StringProperty(
            name="Search",
            description="Search within the selected filter",
            options={'TEXTEDIT_UPDATE'},
            )
    WindowManager.addon_filter = EnumProperty(
            items=addon_filter_items,
            name="Category",
            description="Filter add-ons by category",
            )

    WindowManager.addon_support = EnumProperty(
            items=[('OFFICIAL', "Official", "Officially supported"),
                   ('COMMUNITY', "Community", "Maintained by community developers"),
                   ('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)")
                   ],
            name="Support",
            description="Display support level",
            default={'OFFICIAL', 'COMMUNITY'},
            options={'ENUM_FLAG'},
            )
    # done... 
Example #9
Source File: __init__.py    From io_kspblender with GNU General Public License v2.0 4 votes vote down vote up
def execute(self,context):
        scn = bpy.context.scene
        selected = bpy.context.selected_objects
        shippart = selected.pop(0)
        bpy.ops.object.select_all(action = 'DESELECT')
        shippart.select = True
        shipname = shippart["ship"]

        mergelist = []

        for obj in scn.objects:
            if obj.type == 'MESH' and obj["ship"] == shipname and not obj.hide:
                mergelist.append(obj)

        bpy.ops.object.select_all(action = 'DESELECT')         
        for obj in mergelist:
            obj.select = True
        
        bpy.ops.object.join()
        bpy.ops.object.parent_clear(type='CLEAR')
        result = bpy.context.active_object
        result.name = "RESULT"
        #result.scale = (10,10,10)
        bpy.ops.object.mode_set(mode='EDIT')
        bpy.ops.mesh.remove_doubles(threshold = 0.001)
        bpy.ops.mesh.normals_make_consistent(inside = False)
        bpy.ops.object.mode_set(mode='OBJECT')
        
        return {'FINISHED'}

##class LoadFlagPartOperator(bpy.types.Operator, ImportHelper):
##    bl_idname = "object.loadflag"
##    bl_label = "Load Flag"
##
##    filename_ext = "Image file"
##    filter_glob = StringProperty(default="*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.bmp;*.BMP;*.tiff;*.TIFF", options={'HIDDEN'})
##    #Add more file types if necessary, I guess
##    
##    def execute(self, context):
##        from . import load_flag
##
## 
Example #10
Source File: sdf_export.py    From BlenderRobotDesigner with GNU General Public License v2.0 4 votes vote down vote up
def invoke(self, context, event):
        self.filepath = context.active_object.RobotEditor.modelMeta.model_folder.replace(" ", "_")
        if self.filepath == "":
                self.filepath = global_properties.model_name.get(bpy.context.scene).replace(" ", "_")
        context.window_manager.fileselect_add(self)
        return {'RUNNING_MODAL'}

    #
    #
    # filepath = StringProperty(name="Filename", subtype='FILE_PATH')
    # gazebo = BoolProperty(name="Export Gazebo tags", default=True)
    #
    # package_url = BoolProperty(name="Package URL", default=True)
    #
    # base_link_name = StringProperty(name="Base link:", default="root_link")
    #
    # @RDOperator.OperatorLogger
    # @RDOperator.Postconditions(ModelSelected, ObjectMode)
    # def execute(self, context):
    #     """
    #     Code snipped from `<http://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory>`_
    #     """
    #     import zipfile
    #
    #     if os.path.isdir(self.filepath):
    #         self.logger.debug(self.filepath)
    #         self.report({'ERROR'}, "No File selected!")
    #         return {'FINISHED'}
    #
    #     def zipdir(path, ziph):
    #         # ziph is zipfile handle
    #         for root, dirs, files in os.walk(path):
    #             self.logger.debug("%s, %s, %s,", root, dirs, files)
    #             for file in files:
    #                 file_path = os.path.join(root, file)
    #                 ziph.write(file_path, os.path.relpath(file_path, path))
    #
    #     with tempfile.TemporaryDirectory() as target:
    #         create_package(self, context, target, self.base_link_name)
    #
    #         with zipfile.ZipFile(self.filepath, 'w') as zipf:
    #             zipdir(target, zipf)
    #
    #     return {'FINISHED'}
    #
    # def invoke(self, context, event):
    #     context.window_manager.fileselect_add(self)
    #     return {'RUNNING_MODAL'}