Reply To: I enjoyed the course but I did spend 1.5 days trying to troubleshoot what I was doing differently (I refactor code as I wr…

Forum Archive I enjoyed the course but I did spend 1.5 days trying to troubleshoot what I was doing differently (I refactor code as I wr… Reply To: I enjoyed the course but I did spend 1.5 days trying to troubleshoot what I was doing differently (I refactor code as I wr…

#23690
gorgious
Participant

    Another way to ensure that the delay doesnt get below 1 :

    if not empty.get('_RNA_UI'):
       empty['_RNA_UI'] = {}
    
    empty['delay'] = 10
    
    empty['_RNA_UI']['delay'] = {
    "default": 10,
    "min":1,
    "max":1000}
    
    

    Found on https://blender.stackexchange.com/questions/143975/how-to-edit-a-custom-property-in-a-python-script

    But it’s always good practice to ensure Exceptions like zero division error won’t be thrown inside the code since the property can be modified by the user