Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
[SOLVED] First attempt to integrate ARkit and first questions...
-
@JonB, is it not already on main thread, since the call to main is decorated?
-
good point, yes
-
Sorry, a side note guys. Has anyone written anything either in a gist or in the forum that really explains @on_main_thread as it applies specifically to Pythonista and some simple logic to know wether you need to be using it. Or is it safe to say if you are not using objC or your own threads that you can safley say you dont need to be concerned with it?
-
According to Ole's reply in one issue. @on_main_thread is there for objc_util only. Every other module should handle this internally. If not and main thread is required, it's a bug.
See https://github.com/omz/Pythonista-Issues/issues/461 for more info.
-
-
@zrzka , ok thanks thats very clear! Just good to know
-
Back to the original problem:
per apple docs, you have to add the child view controller first:[self addChildViewController:childVC];
[self.view addSubview:childVC.view];
[childVC didMoveToParentViewController:self];The problem i think is that ui.Views don't have a viewcontroller until they are presented
-
@JonB, allright! So, by changing the
MyARView
__init__
toinitialize
and only calling it afterpresent
:v = MyARView() v.present('full_screen', hide_title_bar=True) v.initialize()
... we can follow the right order, using the "forbidden"
nextResponder
trick:self_objc.nextResponder().addChildViewController_(cvc) self_objc.addSubview_(sceneview) cvc.didMoveToParentViewController_(self_objc)
... after which
CustomViewController_viewWillAppear_
no longer needs to be called manually, i.e. things work as they should.(Here's a gist with this version of the code.)
But still, debug info does not appear, nor does the cube stay anchored to the surroundings.
-
@omz, just checking: for ARKit to really work in Pythonista, would Pythonista need to include the
arkit
key inplist
or somesuch? -
Nope, the key is not required. See https://developer.apple.com/documentation/arkit (Important section at the beginning). You only need device with >= A9 chip. Use isSupported to check if your device is supported.
-
@zrzka, thanks.
Again, just to be sure, I checked the property and got
True
on my 6S+.Would be nice if someone could run the gist from the previous post, maybe on a newer device, just to check that the results are similar.
-
@mikael and @JonB, many thanks. It's better, now, the custom view controller is correctly "mounted".
I'm investigating the ARSession problem and i'm trying to understand why its configuration stays null after a "runWithConfiguration_" call (I'm going to use some delegate methods in order to spy the initialization process...).
I will update my github ASAP.Stay tuned...
-
I'm rewriting the Apple demo (candles, ...) into Python(ista). Will share it when finished.
-
@zrzka, just curious, did you progress with this? And if not, was it due to some problems or just other more important things taking up your bandwidth?
-
@mikael simple answer, pretty busy these days :/
-
If anyone needs a bridge for SceneKit I have https://github.com/scj643/objc_tools/blob/master/objc_tools/scenekit/sk_scene.py
-
@scj643, looks good, thanks. As soon as some real programmer gets ARKit working, I am sure to use your code.
-
omg this works well. The cube scene generation example perfectly matches the local world - just set it up at (0,0,0).
-
@momorprods, thanks for the heads up. Looks like with the 3.3 beta ARKit now works on Pythonista!
-
hehe yep made my day! Struggling now into loading SceneKit SCN file, did anyone had chance with this?