Results 1 to 2 of 2
  1. #1

    How to store Render settings in a list for modification?

    So I want to dynamically change several render settings in a Python script. I need a function to be able to call the setting from an index or a key, so that it modifies the correct setting. Since there is about 10 settings I want to modify the only way I can get the desired result is by having a bunch of IF statements for each possible setting. That seems like a terrible way to do it. Is there a way to save the settings to a list or dictionary?


    Heres an example:


    Code:
    import bpy
    
    bpy.data.scenes[0].cycles.samples = 1 # Number of samples
    lis = [bpy.data.scenes[0].cycles.samples]
    lis[0] = (10)
    
    
    print ('Actual ' + str(bpy.data.scenes[0].cycles.samples))
    print ('Modified ' + str(lis[0]))
    Output:
    Code:
    Actual 1
    Modified 10
    It should produce:
    Code:
    Actual 10
    Modified 10
    Last edited by MisadventureFilms; 13-Mar-17 at 19:43.



  2. #2
    It appears to be a "feature" of python, http://stackoverflow.com/questions/3...ters-in-python
    The current third answer alludes to a solution similar to yours but I didn't figure it without wrapping it which you can't in this case. I think you may have to manually update at the end...



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •