Kanzi 3.9.7 migration guide¶
Use this migration guide to update Kanzi applications from Kanzi 3.9.6 to Kanzi 3.9.7.
Changes in the NodeCompositor2D and NodeEffect2D classes¶
Introduced the CompositionContentRequirements struct that contains the parameters for setting the requirements for composition and effect render targets:
struct CompositionContentRequirements
{
/// Required size of the source content to be used by the effect.
Vector2 size;
/// Whether the content requires alpha channel.
bool alpha;
/// Whether the content requires depth buffer.
bool depth;
/// Whether the content requires stencil buffer.
bool stencil;
/// MSAA sample count for content buffer.
unsigned int numSamples;
};
Changes in the NodeCompositor2D class:
Kanzi 3.9.6 |
Kanzi 3.9.7 |
|---|---|
|
|
|
|
|
|
|
|
Changes in the NodeEffectRenderer2D class:
Kanzi 3.9.6 |
Kanzi 3.9.7 |
|---|---|
|
|
|
|
|
|
Changes to Kanzi Java API¶
CallbackBindingProcessor¶
Kanzi Java API BindingProcessor now inherits KanziObject instead of NativeObject. This means that Kanzi Java API CallbackBindingProcessor.create now returns ObjectRef<CallbackBindingProcessor> instead of CallbackBindingProcessor.
Support for enum properties¶
Kanzi Java API now supports properties with enum data types:
In setter and getter functions, you can now use enum values instead of integers.
For example, you can replace
textNode.setProperty(TextBlock2D.FontHintingPreferenceProperty, 1); // FontHintingPreference::NativeHinting
with
textNode.setProperty(TextBlock2D.FontHintingPreferenceProperty, FontHintingPreference.NativeHinting);
In
KanziObject.getProperty, you no longer have to provide the class of an enum property as a second parameter.For example, you can replace
Node.HorizontalAlignment value = node.getProperty(Node.HorizontalAlignmentProperty, Node.HorizontalAlignment.class);
with
Node.HorizontalAlignment value = node.getProperty(Node.HorizontalAlignmentProperty);
Because of differences between Java and Kotlin in how interface inheritance works, access of built-in enums works differently.
For example, with the
metadata.NodeMetadata.HorizontalAlignmentPropertyproperty:This works in both Java and Kotlin:
NodeEnums.HorizontalAlignment.Center;
This works only in Java:
Node.HorizontalAlignment.Center;
Removed these unused enums:
Node3D.RenderModeNode2D.RenderType
Changes to setting and removing of bindings¶
The return type of these functions changed from AbstractBindingRuntimeSharedPtr to BindingRuntimeHandle:
The BindingRuntimeHandle -> operator returns a link to AbstractBindingRuntime. This way the binding runtime functions work identically.
Changes to Graphics Output and Desktop¶
In Kanzi 3.9.7, you can set on the platforms that use the GBM windowing system which graphics card you want your Kanzi application to use. The improvement introduced:
In the
makeLegacyGraphicsOutputfunction andLegacyGraphicsOutput::LegacyGraphicsOutputconstructor, thedesktopPropertiesparameter.In the
kzs_desktop.h::kzsDesktopCreateandkzs_desktop.h::kzsDesktopNativeCreatefunctions, thedesktopPropertiesRequestedparameter.
Kanzi 3.9.6 |
Kanzi 3.9.7 |
|---|---|
|
|
|
|
|
|
|
|
Changes to Java Code Behind¶
If your Kanzi application is based on one of the Android templates and you want to add Java Code Behind to the Kanzi Studio project of that application, migrate your application.
To migrate your Kanzi application:
In Android Studio, open the Android application of your Kanzi application. In the main menu select File > Project Structure. In the Project Structure window, select the Project tab, and set:
Android Gradle Plugin Version to 7.2.2
Gradle Version to 7.3.3
Click OK.
In
app/src/main/AndroidManifest.xml, from themanifestelement remove thepackageattribute.For example, change
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapplication">
to
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
In
app/build.gradle, add to theandroidscope thenamespaceproperty.The new tooling requires the
compileSdkandtargetSdkproperties to be set to Android API level 31 or higher.android { namespace 'com.example.myapplication' compileSdk 31 defaultConfig { applicationId "com.example.myapplication" minSdk 26 targetSdk 31
If your application already has a plugin as a source project or Java Code Behind, repeat the procedure for their AndroidManifest.xml and build.gradle files.
Changes to brush renderers¶
Kanzi 3.9.7 simplifies brush renderers to be more uniform. The improvement introduced these changes:
Removed the
GlBrushRendererbase class and moved most of the functionality from different brush classes to theBrushRendererbase class.Removed the
RenderValuePropertyNotificationHandlerclass.Because all brushes now use
GlRenderStateto store the render values,RenderValuePropertyNotificationHandlermembers are not needed. Kanzi now maps properties to uniforms automatically in the render state.
If you used a previous version of Kanzi to implement your own derived brush class with an associated brush renderer class, use these instructions to migrate your application to Kanzi 3.9.7:
Instead of inheriting
GlBrushRenderer, inheritBrushRenderer.The functionality of these functions is now provided by the base class:
getRenderOpacityValue()getContentTextureValue()getBlendModeValueOverride()setBlendModeOverride()setBlendModeFallback()
If you implemented any of these functions, in most cases you can just remove the implementations.
If you implemented the
bindOverride()function, modify it to use the formvoid bindOverride(Renderer3D&, PropertyObject*). SeeBrushRenderer::bindOverride.The property object is an additional object from which to fetch fallback values for properties. For
MaterialBrush, this is the material, which lets you react to property changes in the material. For all other brushes that use immutable materials, set this parameter tonullptr.The
BrushRenderer::isChangeCounterSameandBrushRenderer::updateChangeCounterfunctions are now virtual.If your brush uses mutable materials, to react to changes in the material properties, the brush must track the material change counter in these functions. If your brush uses immutable materials, do not implement these functions.
Changes to the PropertyObject API¶
To improve the Kanzi Engine code quality, changed the PropertyObject API. Deprecated PropertyObject::validatePropertyModifiers. Use PropertyObject::validatePropertyModifiersAndNotifyHandlers instead.
Changes to the bindings API¶
From binding_processor_runtime.hpp removed the m_lookupContext class member.
If your Kanzi application implements a custom binding processor runtime, replace the use of m_lookupContext with getBindingRuntime().getLookupContext().