How it works new CalcGradientPixel?
-
Hello guys!
Here is my old versions Python Node code that was working perfectly before v2024:import c4d def main(): global Color,Alpha,AlphaGradient Color = Alpha = c4d.Vector() AlphaGradient = Gradient.GetAlphaGradient() irs = c4d.modules.render.InitRenderStruct() if Gradient.InitRender(irs): Color = Gradient.CalcGradientPixel(Position) Gradient.FreeRender() if AlphaGradient and AlphaGradient.InitRender(irs): Alpha = AlphaGradient.CalcGradientPixel(Position) AlphaGradient.FreeRender()
Now following a new API changes this code:
import c4d def main(): global Color,Alpha,AlphaGradient Color = Alpha = c4d.Vector() AlphaGradient = Gradient.GetAlphaGradient() irs = c4d.modules.render.InitRenderStruct() if Gradient: Color = Gradient.PrepareRenderData(irs).CalcGradientPixel(Position) if AlphaGradient: Alpha = AlphaGradient.PrepareRenderDataWithAlpha(irs).CalcGradientPixel(Position)
Traceback (most recent call last): File "Gradient", line 14, in main Exception: no converter found for 'net.maxon.interface.gradientrenderdata-C'
How it works a new Gradient now?
-
Hi, @mikeudin, you need to
import maxon
Cheers,
Maxime. -