Kanzi 3.9.3 migration guide¶
Use this migration guide to update Kanzi applications from Kanzi 3.9.2 to Kanzi 3.9.3.
Changes in render passes¶
Moved the
CameraProperty
fromDrawObjectsRenderPass
toRenderPass
.This enables you to set in any render pass the Camera node that the render pass and its descendants use to render content.
Changed the profile of
renderOverride()
for render passes tovoid renderOverride(Renderer3D& renderer, CompositionStack& compositionStack, const CameraSettings* cameraSettings)
.Unless a
RenderPass
specialization wants to alter the camera settings, it passes the pointer down to child render pass rendering as is. The pointer can benullptr
.When you implement custom rendering that modifies the camera settings, construct a local
CameraSettings
from stack by copying from the passed parameter.Introduced
virtual void renderChildrenOverride(Renderer3D& renderer, CompositionStack& compositionStack, const CameraSettings* cameraSettings)
for render passes.This function controls how to render the children of a render pass. Typical specializations of
RenderPass
do not need to override it.
Changes in Java API¶
When you define a message type, you must now specify an associated message argument class. Accordingly, when you dispatch or handle a message, you must use the message argument class associated with the message type.
Kanzi Studio uses this association to give you a list of properties that you can set to or get from the arguments of a message.
Message argument classes must now derive from the
MessageArguments
class and provide a constructor of fixed signature:Change your message type and message argument definitions from
@Metadata public static final MessageType XMessage = new MessageType("Message.X", MessageRouting.MessageRoutingBubbling); @Metadata public interface XMessageArguments { @Metadata public static PropertyType<Integer> SomeProperty = new PropertyType<>(Integer.class); }
to
@Metadata public static final MessageType<XMessageArguments> XMessage = new MessageType<>("Message.X", MessageRouting.MessageRoutingBubbling, XMessageArguments.class); @Metadata public class XMessageArguments extends MessageArguments { // A constructor with a long argument that Kanzi uses to wrap native arguments. public XMessageArguments(long nativeObject) { super(nativeObject); } // Any additional constructors for you to use when dispatching messages. public XMessageArguments() { super(); } @Metadata public static PropertyType<Integer> SomeProperty = new PropertyType<>(Integer.class); // Accessors for properties. public Integer getSomeProperty() { return getArgument(SomeProperty); } public void setSomeProperty(Integer value) { setArgument(SomeProperty, value); } }
Change your message dispatch call from
MessageArguments args = new MessageArguments(); args.setArgument(XMessageArguments.SomeProperty, 1); node.dispatchMessage(XMessageArguments, args);
to
XMessageArguments args = new XMessageArguments(); args.setSomeProperty(1); node.dispatchMessage(XMessageArguments, args);
Change your message handlers from
node.addMessageHandler(XMessage, messageArguments -> { Integer someProperty = messageArguments.getArgument(XMessageArguments.SomeProperty); });
to
node.addMessageHandler(XMessage, messageArguments -> { Integer someProperty = messageArguments.getSomeProperty(); });
You do not have to define your own message argument class. Instead, you can use the base class
MessageArguments
in all of the above cases. Also, defining accessors for properties is only for convenience purposes. You can still use the the generic argument setter and setter.See Using messages and Creating a custom node type > Create custom message types.
Metaclass
interfacesiteratePropertyTypes()
anditerateMessageTypes()
now return iterables overAbstractPropertyType
andAbstractMessageType
respectively.Changed the type of resource id argument on these
Node
interfaces fromString
toResourceID
:addResource
removeResource
containsResource
findResourceUrl
acquireResource
tryAcquireResource
acquireResourcesAsync
Change from:
node.acquireResource("resource id");
to:
node.acquireResource(new ResourceID("resource id"));
Changes in class metadata¶
Renamed the
PropertyTargetEasingInterpolator
metaclass toKanzi.PropertyTargetEasingInterpolator
.Renamed the
PropertyTargetEasingInterpolator.SetEnabledMessageArguments
MessageArgument metaclass toKanzi.PropertyTargetEasingInterpolator.SetEnabledMessageArguments
.Renamed these
StateManager
MessageArgument metaclasses:Kanzi 3.9.2
Kanzi 3.9.3
Message.StateManagerMessageArguments
Kanzi.StateManager.StateManagerMessageArguments
Message.StateManagerStateChangeMessageArguments
Kanzi.StateManager.StateChangeMessageArguments
Message.StateManagerGoToStateMessageArguments
Kanzi.StateManager.GoToStateMessageArguments
Message.StateManagerGoToDefinedStateMessageArguments
Kanzi.StateManager.GoToDefinedStateMessageArguments
Message.StateManagerGoToNextDefinedStateMessageArguments
Kanzi.StateManager.GoToNextDefinedStateMessageArguments
Message.StateManagerGoToPreviousDefinedStateMessageArguments
Kanzi.StateManager.GoToPreviousDefinedStateMessageArguments
Message.StateManagerEnteredStateMessageArguments
Kanzi.StateManager.EnteredStateMessageArguments
Message.StateManagerLeftStateMessageArguments
Kanzi.StateManager.LeftStateMessageArguments
Message.StateManagerTransitionMessageArguments
Kanzi.StateManager.TransitionMessageArguments
Message.StateManagerTransitionStartedMessageArguments
Kanzi.StateManager.TransitionStartedMessageArguments
Message.StateManagerTransitionFinishedMessageArguments
Kanzi.StateManager.TransitionFinishedMessageArguments
Renamed these
ValueAccumulator
MessageArgument metaclasses:Kanzi 3.9.2
Kanzi 3.9.3
FloatValueAccumulator.SetAccumulatedValueBoundariesMessageArguments
Kanzi.FloatValueAccumulator.SetAccumulatedValueBoundariesMessageArguments
IntValueAccumulator.SetAccumulatedValueBoundariesMessageArguments
Kanzi.IntValueAccumulator.SetAccumulatedValueBoundariesMessageArguments
ValueAccumulator.StartMessageArguments
Kanzi.ValueAccumulator.StartMessageArguments
ValueAccumulator.StopMessageArguments
Kanzi.ValueAccumulator.StopMessageArguments
ValueAccumulator.PauseMessageArguments
Kanzi.ValueAccumulator.PauseMessageArguments
ValueAccumulator.ResumeMessageArguments
Kanzi.ValueAccumulator.ResumeMessageArguments
Changes for skinned meshes¶
To enable multiple nodes to use the same skinned mesh, Kanzi now stores the runtime data of skinned meshes in Model3D
instead of Mesh
. To make this possible, made these changes to the Mesh
API:
Removed these skinned mesh accessors:
Mesh::getBoneCount()
>size_t
Mesh::getBoneNode(size_t)
>Node3D*
Mesh::getBoneChildJoint(size_t)
>Node3D*
Added these skinned mesh accessors:
Mesh::getSkeleton
>Mesh::Skeleton
Model3D::getSkeletonRuntime
>Mesh::Skeleton
Changed these function signatures:
Kanzi 3.9.2
Kanzi 3.9.3
Mesh::updateBoundingBox(Node3D*)
Mesh::updateSkeletonTransformation(Model3D&)
Mesh::attach(Node*)
Mesh::attachSkeleton(Model3D*)
Mesh::detach(Node*)
Mesh::detachSkeleton(Model3D*)
Changes for mesh data access¶
Kanzi now supports 32-bit indices in meshes. The improvement introduces these changes in the Mesh
API:
Changed these function signatures:
Kanzi 3.9.2
Kanzi 3.9.3
void* Mesh::getVertexData(size_t)
span<const byte> Mesh::getVertexData(size_t)
uint16_t* Mesh::getClusterIndexData(size_t)
span<const byte> Mesh::getClusterIndexData(size_t)
Added
Mesh::getClusterIndexType()
for checking the index type of a mesh cluster.
Changes to the morph shader¶
The morph shader now calculates the weight for the base morph. To apply this change to a project that uses the old morph shader:
In the Library > Materials and Textures > Material Types delete the morph material type that you want to update.
For example, if you use the VertexPhongMorph material type, delete that material type.
In the Library > Materials and Textures press Alt and right-click Material Types and import the morph material type that you want to use.
For example, import the VertexPhongMorph material type.
In the Library > Materials and Textures > Materials select the material that you used with the old morph shader material type and in the Properties set the Material Type property to the morph material that you imported in the previous step.
In the Library > Materials and Textures > Materials delete the morph material that Kanzi Studio creates automatically when it imports a material type.
Changes in the application.cfg
error handling¶
If Kanzi encounters an error when parsing a application.cfg
configuration file or that file is missing, Kanzi logs an error message and no longer throws an exception.
If you are building a fault-tolerant application, in the event of a corrupted or missing application.cfg
file, you no longer have to simultaneously parse the log output for the missing file and catch the exception for the corrupted file. You only have to parse the application log output to detect both a missing and a corrupted application.cfg
file.
Kanzi Studio plugins¶
Kanzi Studio now uses .NET Framework 4.8. To migrate your Kanzi Studio plugin, in the Visual Studio project of your plugin update the target framework version to 4.8.