swf icon indicating copy to clipboard operation
swf copied to clipboard

cpp fix

Open barisyild opened this issue 4 years ago • 3 comments

Problems caused by type and class name have been resolved.

barisyild avatar Apr 26 '21 23:04 barisyild

Thank you for your help!

In principle, the class name should be formatted properly by the time it reaches the Symbol classes. If there is a problem formatting the class name, it should be done within AnimateLibraryExporter.

I can see how C++ would crash if the Shape code references a Sprite. I'm inclined to believe though that it is a bug in the implementation if it hits a Sprite instead of a Shape. I wonder if it would still work properly if it ignores the copyFrom if the target object is a Sprite and not a Shape?

If you have a SWF (or better yet, small project) that reproduces this issue, it would be very helpful :smile:

jgranick avatar Oct 27 '21 17:10 jgranick

If there is a channel where I can communicate, I can send it, assets are private, I cannot share them public.

barisyild avatar Oct 31 '22 17:10 barisyild

Thank you for your help!

In principle, the class name should be formatted properly by the time it reaches the Symbol classes. If there is a problem formatting the class name, it should be done within AnimateLibraryExporter.

I can see how C++ would crash if the Shape code references a Sprite. I'm inclined to believe though that it is a bug in the implementation if it hits a Sprite instead of a Shape. I wonder if it would still work properly if it ignores the copyFrom if the target object is a Sprite and not a Shape?

If you have a SWF (or better yet, small project) that reproduces this issue, it would be very helpful 😄

Following is reproduce file of cpp className formatting issue.

Issue available only cpp target

cppFormatBug.zip

Here is fixes:

https://github.com/openfl/swf/blob/dac8adf44ef9bf2d96d12e11be330c5f63589163/src/swf/exporters/animate/AnimateSpriteSymbol.hx

https://github.com/openfl/swf/blob/dac8adf44ef9bf2d96d12e11be330c5f63589163/src/swf/exporters/animate/AnimateButtonSymbol.hx

barisyild avatar Oct 31 '22 22:10 barisyild

Adding missing project.xml for @barisyild's sample project:

<?xml version="1.0" encoding="utf-8"?>
<project>
	<meta title="CppFormatBug" package="org.openfl.CppFormatBug" version="1.0.0" company="OpenFL" />
	<app main="Main" file="CppFormatBug" />

	<window allow-high-dpi="true"/>
	<window fps="60"/>
	
	<source path="Source" />
	
	<haxelib name="openfl"/>
	<haxelib name="swf"/>

	<library path="assets/formatBug.swf" preload="true" generate="true"/>
</project>

joshtynjala avatar Jul 11 '23 16:07 joshtynjala

More context to the sample project, for future reference.

If the sample project is run on the cpp target, it will crash, and the following output will be printed to the debug console:

Source/com/sample/progress/ProgressView.hx:16: view.bar.animation is null Source/com/sample/progress/ProgressView.hx:19: null

On other targets, it will render a black rectangle, and the following output will be printed in the debug console:

Source/com/sample/progress/ProgressView.hx:19: [object MovieClip]

joshtynjala avatar Jul 11 '23 16:07 joshtynjala

I've merged the class name formatting fix for the cpp target with some tweaks.

Since the sample project does not reproduce the second issue with the cast in AnimateTimeline, I'll wait to merge that one until @barisyild can share another project where it can reproduce.

joshtynjala avatar Jul 11 '23 17:07 joshtynjala