Can't run DragonBones

I update the newest (5.0.0)DragonBones and try to run some of demos but I get following errors:

    C:/HaxeToolkit/haxe/lib/dragonbones/5,0,0/dragonBones/parsers/DataParser.hx:369: lines 369-437 : Missing return: dragonBones.objects.BoneData

I look at the class and return is missed. Is this fixed already?
Config:
openFl: 5.0.0
lime: 4.1.0

I acctually fix this by:

 var bone:BoneData=null;

and

 return bone;

but I believe library should have official fix.

Maybe this is caused by some different behavior in Haxe 3.2.1, sorry I haven’t tested the library on 3.2.1 recently :slight_smile:

Could you help me know what function this is in? That line number appears to be in the _globalToLocal function, which has no return, but maybe it’s different on your system?

Thank you :slight_smile:

I didn’t mention haxe version, sorry. I run haxe 3.4.2 on Win 7.

Here is the fix:

private function _globalToLocal(armature:ArmatureData):BoneData // Support 2.x ~ 3.x data.
	{
		var keyFrames:Vector<BoneFrameData> = new Vector<BoneFrameData>();
		var bones:Vector<BoneData> = armature.sortedBones.concat().reverse();
		
		var l:UInt = bones.length;
		var bone:BoneData=null/*FIX*/, frame:BoneFrameData, timeline:BoneTimelineData, parentTimeline:BoneTimelineData;
		var lJ:UInt;
		for (i in 0...l)
		{
			bone = bones[i];
			if (bone.parent != null) 
			{
				bone.parent.transform.toMatrix(_helpMatrix);
				_helpMatrix.invert();
				Transform.transformPoint(_helpMatrix, bone.transform.x, bone.transform.y, _helpPoint);
				bone.transform.x = _helpPoint.x;
				bone.transform.y = _helpPoint.y;
				bone.transform.rotation -= bone.parent.transform.rotation;
			}
			
			frame = null;
			for (animation in armature.animations) 
			{
				timeline = animation.getBoneTimeline(bone.name);
				
				if (timeline == null)
				{
					continue;	
				}
				
				parentTimeline = bone.parent != null? animation.getBoneTimeline(bone.parent.name): null;
				_helpTransformB.copyFrom(timeline.originalTransform);
				keyFrames.length = 0;
				
				lJ = timeline.frames.length;
				for (j in 0...lJ)
				{
					frame = cast timeline.frames[j];
					
					if (keyFrames.indexOf(frame) >= 0) 
					{
						continue;
					}
					
					keyFrames.push(frame);
					
					if (parentTimeline != null)
					{
						_getTimelineFrameMatrix(animation, parentTimeline, frame.position, _helpTransformA);
						frame.transform.add(_helpTransformB);
						_helpTransformA.toMatrix(_helpMatrix);
						_helpMatrix.invert();
						Transform.transformPoint(_helpMatrix, frame.transform.x, frame.transform.y, _helpPoint);
						frame.transform.x = _helpPoint.x;
						frame.transform.y = _helpPoint.y;
						frame.transform.rotation -= _helpTransformA.rotation;
					} 
					else 
					{
						frame.transform.add(_helpTransformB);
					}
					
					frame.transform.minus(bone.transform);
					
					if (j == 0) 
					{
						timeline.originalTransform.copyFrom(frame.transform);
						frame.transform.identity();
					} 
					else 
					{
						frame.transform.minus(timeline.originalTransform);
					}
				}
			}
		}
		
		return bone;//FIX
	}
	

Weird, it doesn’t work with a Void return type, and no return?

I didn’t tried it.
Default code was

private function _globalToLocal(armature:ArmatureData):BoneData

without return. So I add it and it works.

Strange, it’s Void here in our sources

Hmm, strange, maybe something changed during compiling time on my machine.
I just update the class with github version and it works with Void also.