Author Topic: Lots of corona python commands changed in version 8?  (Read 1893 times)

2022-04-22, 14:18:47

JPeters

  • Active Users
  • **
  • Posts: 87
    • View Profile
Hi there,

After updating to Corona version 8, a load of our custom plugins have suddenly started throwing errors and it seems a ton of Corona commands were changed in this version.

For instance accessing the Corona Camera tag before could be done with this:
Tag[c4d.CORONA_CAMERA_INTENSITY_OFFSET] = 0.0

Now, this has become SimpleExposure[2017] but putting that in the tag like this throws another error:
Tag[SimpleExposure[2017]] = 0.0

Is there documentation on how to use these commands now?


Also the Tone Mapping in the render settings is now a separate menu accessible via "Configure", but how do we access the contents of this menu via python?

Another one is for instance light materials, before you could access parameters like this:
[c4d.CORONA_LIGHTMTL_EMISSION_COLOR_LEVEL]

and now this needs to be:
[c4d.CORONA_LIGHT_MATERIAL_EMISSION_COLOR_LEVEL]

=====

So in short, is there documentation somewhere on how to access the camera tag information via python and how do we access the contents of the tone mapping window in the render settings via Python?


2022-04-28, 13:43:29
Reply #1

JPeters

  • Active Users
  • **
  • Posts: 87
    • View Profile
Anyone?

Normally I ask mmarcotic but it seems he is no longer here (?) or not responding.

2022-04-28, 21:32:19
Reply #2

bnji

  • Corona Team
  • Active Users
  • ****
  • Posts: 193
  • Benjamin
    • View Profile
    • Corona Renderer
Hi,


You can use the python listener in the C4D console to find out the command syntaxis that you require.
simply open the Console, go to the python listener, and drag & drop any value you need to know its syntaxis.
Regarding the tone-mapping, you can do the same, but use the values from the Corona Camera tag.
I hope this helps.
Let us know if you managed to retrieve them.
Regards.
Benjamin Rosas | chaos-corona.com
3D Support Specialist - Corona | contact us
Corona Uploader l Upload

2022-04-29, 08:57:06
Reply #3

JPeters

  • Active Users
  • **
  • Posts: 87
    • View Profile
Hi,

Thanks for getting back to me, and as you point out the console is always a great help.

That being said, if you read my original post you'll see that I have the actual command, but how do you *USE* it, because the "classical" way of putting it behind your object, doesn't work.


As for the tone mapping in the render settings, there is no way to drop these values into the console, it doesn't work. *AND* it's hidden in a new menu for which I can't find the commands to access it.

Cheers,

2022-04-29, 12:39:30
Reply #4

Ales

  • Corona Team
  • Active Users
  • ****
  • Posts: 184
    • View Profile
Hi,
the tone mapping operators are now stored as a separate nodes under Corona camera tag and Corona video post in render settings. This is because it is now possible to e.g. re-order these operators, add duplicate ones etc.

These operators are stored as standard C4D BaseList2D nodes, first operator node can be retrieved by something like following:

Code: [Select]
CORONA_TONEMAPPING_BRANCH_ID = 1057356
PLUGINID_CORONA_CAMERA_TAG   = 1032177
PLUGINID_CORONA              = 1030480

def GetFirstTonemappingOperator(node):
    filtered = [b["head"] for b in node.GetBranchInfo() if b["id"] == CORONA_TONEMAPPING_BRANCH_ID]
    if filtered:
        return filtered[0].GetFirst()

For camera this would be used as
Code: [Select]
cameraTag = camera.GetTag(PLUGINID_CORONA_CAMERA_TAG)
firstOperator = GetFirstTonemappingOperator(cameraTag)

For render settings it could be used as:
Code: [Select]
vp = doc.GetActiveRenderData().GetFirstVideoPost()
while vp:
    if vp.IsInstanceOf(PLUGINID_CORONA):
        break
    vp = vp.GetNext()
firstOperator = GetFirstTonemappingOperator(vp)

Each operator can then be examined using IDs you can find in plugin folder in res/description/postprocess_operator.h.

For example setting all exposure operators to 4.2 could be done using:
Code: [Select]
operator = firstOperator
while operator:
    if operator[c4d.CORONA_POSTPROCESS_OPERATOR_TYPE_NAME] == "Chaos.SimpleExposureOperator.Data":
        operator[c4d.CORONA_POSTPROCESS_OPERATOR_SIMPLE_EXPOSURE_VALUE] = 4.2
    operator = operator.GetNext()

Now, is a little bit more complicated, but it is simply because tone mapping now does not have any predefined ordering and can be arbitrary modified. For all other parameters in camera tag and render settings the things should be as before, e.g setting ISO can be done as before using
Code: [Select]
cameraTag[c4d.CORONA_CAMERA_ISO] = 300
Unfortunatelly we currently don't have any unified documentation for this, but we will try to add it in the near future as there seems to be quite a need for it. We will also try to introduce some utilities for Python scripting that would simplify things... I'll write in this topic once we have some more information.

Finally, regarding CORONA_LIGHTMTL_EMISSION_COLOR_LEVEL/CORONA_LIGHT_MATERIAL_EMISSION_COLOR_LEVEL, we renamed few such parameters in v8 internally to make it more consistent with other parameters. We will add aliases for these in v8 hotfix.

2022-04-29, 14:16:21
Reply #5

JPeters

  • Active Users
  • **
  • Posts: 87
    • View Profile
Thanks a ton for explaining how to access these parameters now, that is very helpful.

I was just finishing up the latest plugin and then Version 8 came out breaking parts of it :D But at least now I can fix it again!

Do let me know if documentation becomes available, in the past mmarcotic has been very helpful with my questions but as I said, he doesn't seem to be responding anymore.

Cheers,

2022-04-29, 14:45:35
Reply #6

Beanzvision

  • Corona Team
  • Active Users
  • ****
  • Posts: 3862
  • Bengamin
    • View Profile
    • Cormats
Thanks a ton for explaining how to access these parameters now, that is very helpful.

I was just finishing up the latest plugin and then Version 8 came out breaking parts of it :D But at least now I can fix it again!

Do let me know if documentation becomes available, in the past mmarcotic has been very helpful with my questions but as I said, he doesn't seem to be responding anymore.

Cheers,
Hi JPeter, We're glad to hear the above has helped. I should inform you that Jan (mmarcotic) no longer works for us. This would explain the no response issue. ;)
Bengamin Jerrems l chaos-corona.com
3D Support Specialist - Corona l contact us
Corona Uploader l Upload
Portfolio l Click me!

2022-04-29, 16:06:38
Reply #7

JPeters

  • Active Users
  • **
  • Posts: 87
    • View Profile
Hi,
Thank you for informing me, then I'll stop trying to contact him. Shame, he was a great help!