6
$\begingroup$

Is it possible to mask out a string that will be a user password for loggining into an asset server?

eg.

 password1

shows

 *********
$\endgroup$
8
$\begingroup$

Yes, use the subtype='PASSWORD' for a StringProperty:

bpy.types.Scene.password = bpy.props.StringProperty(subtype='PASSWORD')

You can add it to the Scene tab for a quick test by running:

bpy.types.SCENE_PT_scene.prepend(
    lambda self, context: self.layout.prop(context.scene, "password"))

The property can be read and written like any property, but each character is drawn as an asterix if added to a panel. It is also not shown in tooltip (since 2.70), but it's possible to copy and paste. The main purpose is to hide the password on screen for video recordings, not to protect or encrypt it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.