b-init / ImagePaste

A simple Blender addon to grab images from your clipboard and paste as a reference image in viewport or onto the image editor.
GNU General Public License v3.0
251 stars 9 forks source link

Filename customization feature #18

Closed thanhph111 closed 3 years ago

thanhph111 commented 3 years ago

Proposed changes

This pull request adds a feature that allows the user to customize the filename of the pasted image with the help of some predefined variables:

Variable Description Example
${addonName} Name of the add-on ImagePaste
${yearLong} Year with the century 2021, 2022, …
${yearShort} Year without the century 21, 22, …
${monthNumber} Month as a zero-padded decimal number 01, 02, …, 12
${monthNameLong} Full month name January, February, …, December
${monthNameShort} Abbreviated month name Jan, Feb, …, Dec
${day} Day of the month as a zero-padded decimal number 01, 02, …, 31
${weekdayNumber} Weekday as a decimal number 0, 1, …, 6
${weekdayNameLong} Full weekday name Sunday, Monday, …, Saturday
${weekdayNameShort} Abbreviated weekday name Sun, Mon, …, Sat
${hour24} Hour (24-hour clock) as a zero-padded decimal number 00, 01, …, 23
${hour12} Hour (12-hour clock) as a zero-padded decimal number 01, 02, …, 12
${minute} Minute as a zero-padded decimal number 00, 01, …, 59
${second} Second as a zero-padded decimal number 00, 01, …, 59
${index} Order of the image 1, 2, …
${index:N} N-digits image order number with zero padding ${index:2} gives 01, 02, …

The add-on preferences introduces a new section where the user enters the custom name: custom-filename

There are some filename restrictions depending on each operating system. If the input filenames are not valid, the field will warn by turning red and the new image name will fall back to default name ${addonName}-${yearShort}${monthNumber}${day}-${hour24}${minute}${second}: custom-filename-failed

Further comments