Thank you @ferdinand for answer. Yes, most of the code is from chat but when I create Xpresso python it shows this command :

Thank you @ferdinand for answer. Yes, most of the code is from chat but when I create Xpresso python it shows this command :

It looks like changing OCIO View Transform doesn't work using Python
import c4d
import maxon
def main():
# Get the active document
doc = c4d.documents.GetActiveDocument()
if not doc:
print("No active document found")
return
# Create a new OCIO Config object
ocio_config = maxon.c4d.documents.OpenColorIOConfig()
# Load the OCIO configuration file (replace with your actual path)
ocio_config_path = "$OCIO"
result = ocio_config.Load(ocio_config_path)
if result != c4d.OPEN_COLOR_IO_OK:
print("Error loading OCIO configuration")
return
# Set the OCIO view transform
ocio_view_transform = "3" # Replace with your desired view transform
ocio_config.SetViewTransform(ocio_view_transform)
# Apply the OCIO configuration to the current document
doc.SetOcioConfig(ocio_config)
c4d.EventAdd()
# Only execute the main function if the script is run directly
if __name__ == '__main__':
main()
This simple version doesn't work too :
import c4d
def main():
# Get the active document
doc = c4d.documents.GetActiveDocument()
if not doc:
print("No active document found")
return
# Set the OCIO view transform
view_transform = "3" # Replace with your desired view transform
doc[c4d.DOCUMENT_OCIO_VIEW_TRANSFORM] = view_transform
c4d.EventAdd()
if __name__ == "__main__":
main()
Unfortunately this script doesn't include Specular and Displacement channels conversion.
Thank you very much for depth explanation. I didn't know that "polygons have changed" means that they need to be deleted. I thought that it will works with polygons modification too.
But using one of the code I have this error :

Regards,
Sebastian
Hi,
def message (id,data) in Interaction Tag ( scripting tab ) seems to not work :

None of the message id's from here doesn't work : https://developers.maxon.net/docs/py/2023_2/manuals/application_development/manual_message_system.html like c4d.MSG_POLYGONS_CHANGED ( id 2 )