Today, I created a simple clothing addon with a two-mesh coat. The addon adds everything needed for the simulation including material types for the clothes.

Python tutorials with source code, examples, guides, and tips and tricks for Windows and Linux development.


import sys
import os
import shutil
from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout, QFileDialog, QMessageBox
from PyQt6.QtCore import QDateTime
class FileRenamer(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Redenumire fișiere cu dată și index")
self.setGeometry(100, 100, 400, 150)
layout = QVBoxLayout()
self.button = QPushButton("Selectează folderul și redenumește fișierele")
self.button.clicked.connect(self.rename_files)
layout.addWidget(self.button)
self.setLayout(layout)
def rename_files(self):
folder = QFileDialog.getExistingDirectory(self, "Selectează folderul")
if not folder:
return
files = [f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f))]
files.sort() # Sortează pentru consistență
for index, filename in enumerate(files, start=1):
old_path = os.path.join(folder, filename)
try:
creation_time = os.path.getctime(old_path)
dt = QDateTime.fromSecsSinceEpoch(int(creation_time))
date_str = dt.toString("yyyyMMdd_HHmmss")
ext = os.path.splitext(filename)[1]
new_name = f"{date_str}_{index:03d}{ext}"
new_path = os.path.join(folder, new_name)
# Evită suprascrierea fișierelor existente
if not os.path.exists(new_path):
shutil.move(old_path, new_path)
except Exception as e:
QMessageBox.critical(self, "Eroare", f"Eroare la fișierul {filename}:\n{str(e)}")
continue
QMessageBox.information(self, "Succes", "Fișierele au fost redenumite cu succes!")
if __name__ == "__main__":
app = QApplication(sys.argv)
window = FileRenamer()
window.show()
sys.exit(app.exec())