Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[arkit] Update for iOS 11 beta 1 (new framework) #2187

Merged
merged 5 commits into from
Jun 23, 2017

Conversation

VincentDondain
Copy link
Contributor

@VincentDondain VincentDondain commented Jun 8, 2017

Updated scenekit.cs SCNSceneRendererDelegate to avoid:
ARKit/ARSCNViewDelegate.g.cs(189,43): error CS0432: Alias 'Iglobal' not found


Part 2

  • Fixed the generator to avoid ARKit/ARSCNViewDelegate.g.cs(189,43): error CS0432: Alias 'Iglobal' not found
  • ARPointCloud can be tested with this sample: https://www.dropbox.com/s/0xlz0sdzjj4507s/ARPointCloudTest.zip?dl=0
    It requires deploying on devices and moving the camera around so ARKit can return some points. After 5 seconds it should print the points.
  • Added code comments about generator bugs.
  • Fixed styling.
  • Added missing simd.
  • Fixed intro tests.

@monojenkins
Copy link
Collaborator

Build failure

src/arkit.cs Outdated
nuint Count { get; }

[Export ("points")]
IntPtr Points { get; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we expose something better ?

src/arkit.cs Outdated

[Static]
[Wrap ("(SCNDebugOptions)_ARSCNDebugOptionShowWorldOrigin")]
SCNDebugOptions ShowWorldOrigin { get; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BindAsAttribute ? Cc @dalexsoto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not recall adding explicit support for Fields + BindAs but it is worth a try

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried, not working, opened bug: https://bugzilla.xamarin.com/show_bug.cgi?id=57537

src/arkit.cs Outdated

[Static]
[Wrap ("(SCNDebugOptions)_ARSCNDebugOptionShowFeaturePoints")]
SCNDebugOptions ShowFeaturePoints { get; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

src/scenekit.cs Outdated
@@ -2329,22 +2331,22 @@ interface SCNSceneRenderer {
interface SCNSceneRendererDelegate {

[Export ("renderer:willRenderScene:atTime:")]
void WillRenderScene ([Protocolize]SCNSceneRenderer renderer, SCNScene scene, double timeInSeconds);
void WillRenderScene (ISCNSceneRenderer renderer, SCNScene scene, double timeInSeconds);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That breaks classic and it seems the API is available on macOS (so we still care)

src/scenekit.cs Outdated

[Export ("renderer:didRenderScene:atTime:")]
void DidRenderScene ([Protocolize]SCNSceneRenderer renderer, SCNScene scene, double timeInSeconds);
void DidRenderScene (ISCNSceneRenderer renderer, SCNScene scene, double timeInSeconds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

src/scenekit.cs Outdated

[Mac (10,10)]
[Export ("renderer:updateAtTime:")]
void Update ([Protocolize]SCNSceneRenderer renderer, double timeInSeconds);
void Update (ISCNSceneRenderer renderer, double timeInSeconds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

src/scenekit.cs Outdated

[Mac (10,10)]
[Export ("renderer:didApplyAnimationsAtTime:")]
void DidApplyAnimations ([Protocolize]SCNSceneRenderer renderer, double timeInSeconds);
void DidApplyAnimations (ISCNSceneRenderer renderer, double timeInSeconds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

src/scenekit.cs Outdated

[Mac (10,10)]
[Export ("renderer:didSimulatePhysicsAtTime:")]
void DidSimulatePhysics ([Protocolize]SCNSceneRenderer renderer, double timeInSeconds);
void DidSimulatePhysics (ISCNSceneRenderer renderer, double timeInSeconds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good job, just some minor details 👍

src/arkit.cs Outdated
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface ARCamera : NSCopying
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, Codig guidelines, should be on the above line. Also this is present in all interfaces

src/arkit.cs Outdated

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[BaseType (typeof(NSObject))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, coding guidelines space typeof (NSObject), also present in all typeof declarations

src/arkit.cs Outdated
[BaseType (typeof(ARAnchor))]
interface ARPlaneAnchor
{
// [Export ("initWithTransform:")] marked as NS_UNAVAILABLE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any constructors? Is [DisableDefaultCtor] needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it's not available on ARAnchor so not on ARPlaneAnchor either.

src/arkit.cs Outdated
{
[Internal]
[Field ("ARSCNDebugOptionShowWorldOrigin")]
int _ARSCNDebugOptionShowWorldOrigin { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be nint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rolfbjarne Here's the enum signature: public enum SCNDebugOptions : nuint

If I use nuint instead of int I'm getting: error BI1014: bgen: Unsupported type for Fields: global::System.UInt32

If I use nint instead of int I'm getting: ARKit/ARSCNDebugOptions.g.cs(53,65): error CS0030: Cannot convert type 'System.nint' to 'SceneKit.SCNDebugOptions'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's time to look at the generator again 😄

Both of those (nuint/nint) should work.

src/arkit.cs Outdated

[Internal]
[Field ("ARSCNDebugOptionShowFeaturePoints")]
int _ARSCNDebugOptionShowFeaturePoints { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nint?

@VincentDondain VincentDondain force-pushed the arkit-b1 branch 2 times, most recently from d0443db to c6a5164 Compare June 15, 2017 22:45
@monojenkins
Copy link
Collaborator

Build failure

1 similar comment
@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build failure

Copy link
Contributor

@spouliot spouliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include a link to your test app in the commit message

@VincentDondain
Copy link
Contributor Author

@spouliot I did, it's on the commit message, the PR message and I will keep it when squashing.

@VincentDondain
Copy link
Contributor Author

build

@monojenkins
Copy link
Collaborator

Build failure

@spouliot
Copy link
Contributor

The intro error is likely because the framework does not exists on the sim
Make sure it works on device (without a model)
If that's the case then we need to exclude it from sim tests

@monojenkins
Copy link
Collaborator

Build failure

@VincentDondain
Copy link
Contributor Author

VincentDondain commented Jun 19, 2017

The intro error is likely because the framework does not exists on the sim

@spouliot looks like not: https://gist.github.com/VincentDondain/65785d63d6daa85a0b83a54245642616

This is intro on an iOS 11 device with [Model] disabled for ARSessionObserver.

@dalexsoto
Copy link
Member

dalexsoto commented Jun 19, 2017

@VincentDondain The introspection tests are correct 😉

You had in your first commit

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[Protocol]
[BaseType (typeof(NSObject))]
interface ARSessionObserver

If no ModelAttribute then also no BaseType should be present so just remove Model and BaseType and your binding should be good:

[iOS (11,0)]
[NoWatch, NoTV, NoMac]
[Protocol]
interface ARSessionObserver

@VincentDondain
Copy link
Contributor Author

Aaaaaaaah indeed indeed, nice catch thanks! <3

@dalexsoto
Copy link
Member

I totally missed that in the first review so we are even 😛

@monojenkins
Copy link
Collaborator

Build failure

@VincentDondain
Copy link
Contributor Author

Unrelated mtouch failures. Tracked here: https://bugzilla.xamarin.com/show_bug.cgi?id=57601

@VincentDondain
Copy link
Contributor Author

@rolfbjarne and you re-review and approve (especially since there are some bindings-generator.cs and generator.cs changes (:

@monojenkins
Copy link
Collaborator

Build failure

src/arkit.cs Outdated
[Field ("ARSCNDebugOptionShowWorldOrigin")]
// FIXME: Could be using [BindAs (typeof (SCNDebugOptions))]: https://bugzilla.xamarin.com/show_bug.cgi?id=57537
// FIXME: Should be nuint: https://bugzilla.xamarin.com/show_bug.cgi?id=57535
int _ARSCNDebugOptionShowWorldOrigin { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use nuint / nint / nfloat only if XAMCORE_2_0 btw

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to use nuint/nint for in Unified, otherwise it will be wrong for 64-bit code.

Copy link
Member

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check in the test project somewhere? Maybe xamarin/ios-samples, or a personal git repo. This makes it possible for others to fix any bugs 😄

src/arkit.cs Outdated
[Field ("ARSCNDebugOptionShowWorldOrigin")]
// FIXME: Could be using [BindAs (typeof (SCNDebugOptions))]: https://bugzilla.xamarin.com/show_bug.cgi?id=57537
// FIXME: Should be nuint: https://bugzilla.xamarin.com/show_bug.cgi?id=57535
int _ARSCNDebugOptionShowWorldOrigin { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to use nuint/nint for in Unified, otherwise it will be wrong for 64-bit code.

src/arkit.cs Outdated
[Field ("ARSCNDebugOptionShowFeaturePoints")]
// FIXME: Could be using [BindAs (typeof (SCNDebugOptions))]: https://bugzilla.xamarin.com/show_bug.cgi?id=57537
// FIXME: Should be nuint: https://bugzilla.xamarin.com/show_bug.cgi?id=57535
int _ARSCNDebugOptionShowFeaturePoints { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same: you must use a type of the right size.

@VincentDondain
Copy link
Contributor Author

@dalexsoto
Copy link
Member

@VincentDondain if you rebase you should be able to use FieldAttribite with enums now

@VincentDondain
Copy link
Contributor Author

Woot will try, thanks @dalexsoto !

Updated scenekit.cs `SCNSceneRendererDelegate` to avoid:
`ARKit/ARSCNViewDelegate.g.cs(189,43): error CS0432: Alias `Iglobal' not found`
- Fixed the generator to avoid `ARKit/ARSCNViewDelegate.g.cs(189,43): error CS0432: Alias 'Iglobal' not found`
- ARPointCloud can be tested with this samples: https://www.dropbox.com/s/0xlz0sdzjj4507s/ARPointCloudTest.zip?dl=0
  It requires deploying on devices and moving the camera around so ARKit can return some points. After 5 seconds it should
  print the points.
- Fixed styling.
- Added missing simd.
- Fixed intro tests.

Note: not having [Model] on ARSessionObserver got us:

```
[FAIL] iOSApiProtocolTest.ApiProtocolTest.GeneralCase : 1 types do not really conform to the protocol interfaces
[FAIL] Could not load ARKit.ARSessionObserver

          at Introspection.ApiBaseTest.AssertIfErrors (System.String s, System.Object[] parameters) [0x00054] in /Users/vidondai/Documents/xi-xcode9/xamarin-macios/tests/introspection/ApiBaseTest.cs:143
          at Introspection.ApiProtocolTest.GeneralCase () [0x001ec] in /Users/vidondai/Documents/xi-xcode9/xamarin-macios/tests/introspection/ApiProtocolTest.cs:342
          at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
          at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /Users/vidondai/Documents/xi-xcode9/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
```
@VincentDondain
Copy link
Contributor Author

Need #2233 for the enum with Field to work (;

@monojenkins
Copy link
Collaborator

Build failure

1 similar comment
@monojenkins
Copy link
Collaborator

Build failure

@VincentDondain
Copy link
Contributor Author

build

@monojenkins
Copy link
Collaborator

Build failure

@monojenkins
Copy link
Collaborator

Build success

@VincentDondain
Copy link
Contributor Author

Woot ARKit is now green!!! Merging.

@dalexsoto
Copy link
Member

Merge, Merge, Merge!!

@VincentDondain VincentDondain merged commit ad90642 into xamarin:xcode9 Jun 23, 2017
@VincentDondain VincentDondain deleted the arkit-b1 branch June 23, 2017 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants