@@ -278,24 +278,32 @@ def color_ramp_settings(node, file: TextIO, inner: str, node_var: str):
278278
279279    color_ramp  =  node .color_ramp 
280280    #settings 
281-     file .write ((f"{ inner } { node_var }  .color_ramp.color_mode = " 
282-                 f"\' { color_ramp .color_mode } \' \n " ))
281+     color_mode  =  enum_to_py_str (color_ramp .color_mode )
282+     file .write (f"{ inner } { node_var }  .color_ramp.color_mode = { color_mode } \n " )
283+ 
284+     hue_interpolation  =  enum_to_py_str (color_ramp .hue_interpolation )
283285    file .write ((f"{ inner } { node_var }  .color_ramp.hue_interpolation = " 
284-                 f"\' { color_ramp .hue_interpolation } \' \n " ))
286+                 f"{ hue_interpolation } \n " ))
287+     interpolation  =  enum_to_py_str (color_ramp .interpolation )
285288    file .write ((f"{ inner } { node_var }  .color_ramp.interpolation " 
286-                 f"= ' { color_ramp . interpolation } ' \n " ))
289+                 f"= { interpolation } \n " ))
287290    file .write ("\n " )
291+ 
288292    #key points 
289293    for  i , element  in  enumerate (color_ramp .elements ):
290-         file .write ((f"{ inner } { node_var }  _cre_{ i }   = " 
291-                     f"{ node_var }  .color_ramp.elements" 
292-                     f".new({ element .position }  )\n " ))
293-         file .write ((f"{ inner } { node_var }  _cre_{ i }  .alpha = " 
294+         element_var  =  f"{ node_var }  _cre_{ i }  " 
295+         if  i  <  2 :
296+             file .write (f"{ inner } { element_var }   = " 
297+                        f"{ node_var }  .color_ramp.elements[{ i }  ]\n " )
298+             file .write (f"{ inner } { element_var }  .position = { element .position } \n " )
299+         else :
300+             file .write ((f"{ inner } { element_var }   = " 
301+                         f"{ node_var }  .color_ramp.elements" 
302+                         f".new({ element .position }  )\n " ))
303+         file .write ((f"{ inner } { element_var }  .alpha = " 
294304                    f"{ element .alpha } \n " ))
295-         col  =  element .color 
296-         r , g , b , a  =  col [0 ], col [1 ], col [2 ], col [3 ]
297-         file .write ((f"{ inner } { node_var }  _cre_{ i }  .color = " 
298-                     f"({ r }  , { g }  , { b }  , { a }  )\n \n " ))
305+         color_str  =  vec4_to_py_str (element .color )
306+         file .write ((f"{ inner } { element_var }  .color = { color_str } \n \n " ))
299307
300308def  curve_node_settings (node , file : TextIO , inner : str , node_var : str ):
301309    """ 
@@ -310,37 +318,35 @@ def curve_node_settings(node, file: TextIO, inner: str, node_var: str):
310318
311319    #mapping settings 
312320    file .write (f"{ inner }  #mapping settings\n " )
313-     mapping  =  f"{ inner } { node_var }  .mapping" 
321+     mapping_var  =  f"{ inner } { node_var }  .mapping" 
314322
315323    #extend 
316-     extend  =  f" \' { node .mapping .extend } \' " 
317-     file .write (f"{ mapping }  .extend = { extend } \n " )
324+     extend  =  enum_to_py_str ( node .mapping .extend ) 
325+     file .write (f"{ mapping_var }  .extend = { extend } \n " )
318326    #tone 
319-     tone  =  f" \' { node .mapping .tone } \' " 
320-     file .write (f"{ mapping }  .tone = { tone } \n " )
327+     tone  =  enum_to_py_str ( node .mapping .tone ) 
328+     file .write (f"{ mapping_var }  .tone = { tone } \n " )
321329
322330    #black level 
323-     b_lvl  =  node .mapping .black_level 
324-     b_lvl_str  =  f"({ b_lvl [0 ]}  , { b_lvl [1 ]}  , { b_lvl [2 ]}  )" 
325-     file .write ((f"{ mapping }  .black_level = { b_lvl_str } \n " ))
331+     b_lvl_str  =  vec3_to_py_str (node .mapping .black_level )
332+     file .write ((f"{ mapping_var }  .black_level = { b_lvl_str } \n " ))
326333    #white level 
327-     w_lvl  =  node .mapping .white_level 
328-     w_lvl_str  =  f"({ w_lvl [0 ]}  , { w_lvl [1 ]}  , { w_lvl [2 ]}  )" 
329-     file .write ((f"{ mapping }  .white_level = { w_lvl_str } \n " ))
334+     w_lvl_str  =  vec3_to_py_str (node .mapping .white_level )
335+     file .write ((f"{ mapping_var }  .white_level = { w_lvl_str } \n " ))
330336
331337    #minima and maxima 
332338    min_x  =  node .mapping .clip_min_x 
333-     file .write (f"{ mapping }  .clip_min_x = { min_x } \n " )
339+     file .write (f"{ mapping_var }  .clip_min_x = { min_x } \n " )
334340    min_y  =  node .mapping .clip_min_y 
335-     file .write (f"{ mapping }  .clip_min_y = { min_y } \n " )
341+     file .write (f"{ mapping_var }  .clip_min_y = { min_y } \n " )
336342    max_x  =  node .mapping .clip_max_x 
337-     file .write (f"{ mapping }  .clip_max_x = { max_x } \n " )
343+     file .write (f"{ mapping_var }  .clip_max_x = { max_x } \n " )
338344    max_y  =  node .mapping .clip_max_y 
339-     file .write (f"{ mapping }  .clip_max_y = { max_y } \n " )
345+     file .write (f"{ mapping_var }  .clip_max_y = { max_y } \n " )
340346
341347    #use_clip 
342348    use_clip  =  node .mapping .use_clip 
343-     file .write (f"{ mapping }  .use_clip = { use_clip } \n " )
349+     file .write (f"{ mapping_var }  .use_clip = { use_clip } \n " )
344350
345351    #create curves 
346352    for  i , curve  in  enumerate (node .mapping .curves ):
@@ -351,14 +357,19 @@ def curve_node_settings(node, file: TextIO, inner: str, node_var: str):
351357            point_j  =  f"{ inner } { curve_i }  _point_{ j }  " 
352358
353359            loc  =  point .location 
354-             file .write ((f"{ point_j }   = { curve_i }  .points.new({ loc [0 ]}  , { loc [1 ]}  )\n " ))
360+             loc_str  =  f"{ loc [0 ]}  , { loc [1 ]}  " 
361+             if  j  <  2 :
362+                 file .write (f"{ point_j }   = { curve_i }  .points[{ j }  ]\n " )
363+                 file .write (f"{ point_j }  .location = ({ loc_str }  )\n " )
364+             else :
365+                 file .write ((f"{ point_j }   = { curve_i }  .points.new({ loc_str }  )\n " ))
355366
356-             handle  =  f" \' { point .handle_type } \' " 
367+             handle  =  enum_to_py_str ( point .handle_type ) 
357368            file .write (f"{ point_j }  .handle_type = { handle } \n " )
358369
359370    #update curve 
360371    file .write (f"{ inner }  #update curve after changes\n " )
361-     file .write (f"{ mapping }  .update()\n " )
372+     file .write (f"{ mapping_var }  .update()\n " )
362373
363374def  set_input_defaults (node , file : TextIO , inner : str , node_var : str , 
364375                       addon_dir : str ):
@@ -669,14 +680,16 @@ def load_image(img, file: TextIO, inner: str, img_var: str):
669680    file .write (f"{ inner }  #set image settings\n " )
670681
671682    #source 
672-     file .write (f"{ inner } { img_var }  .source = \' { img .source } \' \n " )
683+     source  =  enum_to_py_str (img .source )
684+     file .write (f"{ inner } { img_var }  .source = { source } \n " )
673685
674686    #color space settings 
675-     file . write (( f" { inner } { img_var }  .colorspace_settings.name = " 
676-                  f" \' { img .colorspace_settings .name } \' \n " ) )
687+     color_space   =   enum_to_py_str ( img .colorspace_settings .name ) 
688+     file . write ( f" { inner } { img_var }  .colorspace_settings.name =  { color_space } \n "  )
677689
678690    #alpha mode 
679-     file .write (f"{ inner } { img_var }  .alpha_mode = \' { img .alpha_mode } \' \n " )
691+     alpha_mode  =  enum_to_py_str (img .alpha_mode )
692+     file .write (f"{ inner } { img_var }  .alpha_mode = { alpha_mode } \n " )
680693
681694def  image_user_settings (node , file : TextIO , inner : str , node_var : str ):
682695    """ 
0 commit comments