3
$\begingroup$

i have added preset base in my code, now is there any way to save data of RGB curve , so we can use it from saved dropdown menu at any time in any file ,

i have added preset base

this gives me only 1 point data , it does save it but only one , if i add extra points and then save it as preset even after that it didnt count extra curvepoints , it only gives x and y values of single point

do let me know if there are any way to save RGB curve property for compositor

class add_comp_preset(AddPresetBase, bpy.types.Operator):
"""Add a new render preset."""
bl_idname = 'comp.add'
bl_label = 'Add My comp Preset'
bl_options = {'REGISTER', 'UNDO'}
preset_menu = 'comp_presets'
preset_subdir = 'weybec_comp_preset'





preset_defines = [
    "nc  = bpy.context.scene.nc",
    "scene  = bpy.context.scene",
    "render = bpy.context.scene.render",
    ""for i in bpy.data.node_groups['nevercomp'].nodes['RGB'].mapping.curves[3].points:c = i.location"

preset_values = [
    'c'
    ]
$\endgroup$
3
$\begingroup$

The properties of every point of RGB curves node can be accessed using the following snippet. Generally, the location of the point in XY plane is useful. Hence to access that property:

(RGB_Curves_Node).mapping.curves[0].points[id].location_x

Similarly,

(RGB_Curves_Node).mapping.curves[0].points[id].location_y

id is used to access which point you want the property from. Also, the 'R', 'G', 'B' and 'C' curves are separated by id 0, 1, 2, 3 respectively.

As you want to save the data as a preset, you would probably want to do something like

preset = [[], [], [], []]
for i in range(0, 5):
    for point in bpy.context.scene.node_tree.nodes['RGB'].mapping.curves[i].points:
       preset[i].append((point.location.x, point.location.y))
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.