Python bpy.props 模块,FloatProperty() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用bpy.props.FloatProperty()

项目:blender-addons    作者:scorpion81    | 项目源码 | 文件源码
def setPropKeys(args):
    global theProperty
    if theProperty is None:
        return
    (name, tip, value) = theProperty
    if len(args) >= 2 and not isinstance(value, bool):
        if "BOOLEAN" in args[1]:
            value = bool(value)
        else:
            tip = tip + "," + args[1].replace(":", "=").replace('"', " ")
    #expr = "bpy.types.Object.%s = %sProperty(%s)" % (name, proptype, tip)
    if isinstance(value, bool):
        prop = BoolProperty(tip)
    elif isinstance(value, int):
        prop = IntProperty(tip)
    elif isinstance(value, float):
        prop = FloatProperty(tip)
    elif isinstance(value, string):
        prop = StringProperty(tip)
    setattr(bpy.types.Object, name, prop)
    theProperty = None
项目:blender-addons    作者:scorpion81    | 项目源码 | 文件源码
def register():
    bpy.types.Object.MhxVersionStr = StringProperty(name="Version", default="", maxlen=128)
    bpy.types.Object.MhAlpha8 = BoolProperty(default=True)
    bpy.types.Object.MhxMesh = BoolProperty(default=False)
    bpy.types.Object.MhxRig = StringProperty(default="")
    bpy.types.Object.MhxVisemeSet = StringProperty(default="")
    bpy.types.Object.MhxRigify = BoolProperty(default=False)
    bpy.types.Object.MhxSnapExact = BoolProperty(default=False)
    bpy.types.Object.MhxShapekeyDrivers = BoolProperty(default=True)
    bpy.types.Object.MhxStrength = FloatProperty(
        name = "Expression strength",
        description = "Multiply expression with this factor",
        default=1.0, min=-1.0, max=2.0
        )
    bpy.utils.register_module(__name__)
    bpy.types.INFO_MT_file_import.append(menu_func)
项目:bpy_lambda    作者:bcongdon    | 项目源码 | 文件源码
def register():
    bpy.types.WindowManager.TrackingTargetError = FloatProperty(
            name="Target Error",
            description="Refine motion track target error",
            default=0.3,
            min=0.01
            )
    bpy.types.WindowManager.TrackingSmooth = FloatProperty(
            name="Smooth Transition",
            description="Smooth weight transition on start and end of incomplete tracks",
            default=25,
            min=1
            )
    bpy.utils.register_module(__name__)
项目:archipack    作者:s-leger    | 项目源码 | 文件源码
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