Accessing Node of Scene in Engine Source, where can this happen? - godot

Say we have a scene that starts with a spatial node named Node_of_interest with a child Mesh_of_interest, is there somewhere in the source code where we can access these nodes?
I assumed the SceneTree would be the right place to start since it has Node * current_scene , but when I step through in the debugger on a breakpoint here
I never see current_scene as not null.
I feel like with this information I'll have a much better handle on how the nodes relate to servers and drivers.
Here's the scene that I'm trying this on.

Related

How do I create a chain of lazy streams where 2 streams can fetch data from 1?

I'm creating a system where users can chain together nodes, and data flows from one node to the other. At the end is a node which constantly pulls from the node before it, and does something with that data (e.g. for audio data, plays it). If you're familiar with FL Studio's Patcher, that's essentially what I'm trying to do:
The trivial implementation, which is to just have an interface like this:
interface Node {
byte[] getData();
}
where each node stores the one before it would work fine, except that I want to be able to have 2 nodes both requesting data from a single node, like this:
The issue here is that the source node is pulled twice every "step" (the intended behavior would be for the same value to be sent to both nodes). If you had for example an audio signal in the source node, the intended behavior would be for 2 different effects to be done to it, then the signals combined, while what would actually happen is that the signal is chopped up and each effect gets a different part of the signal depending on which happens to be called first.
What is a good way to solve this?

Is it okay to create an anchor for every object in sceneform?

I am making an app where I would have to display a lot of objects and they need to stay where they are initialized. I started by creating an anchor and making all the objects as Node that are going to be children of that anchor.
This works if the objects are not to far away but, if you move quite a bit away, the anchor and, as a result, the children of that anchor also start drifting. To combat this issue I decided to establish each object as an anchor instead of a node that will then be a child of one anchor.
However, now my app is lagging a lot. Is creating too many anchors causing this?
if you make them nodes connected to one parent node they will always drift. It's ok to create multiple anchors in this way they will stay where the user has created a hit and will not drift

Profiling heapdumps in Chrome Developer Tools (memory leak)

I'm having bit trouble with a NodeJS/Express/React application that is on production as we speak.
The problem is, that it keeps climbing up on memory usage and it just doesn't stop. It is slow and steady, and eventually Node crashes. I have several heapdumps that I have been creating with the help of node-heapdump, however, I don't know how to properly identify the leak.
I will share an image of my snapshot. Please note that I sorted by shallow size so supposedly one of those objects/types that appear on top must be the problem:
As I can see below, there is this "Promis in #585" that I see in many places and that could be the one, but I'm unable to identify that line, function or component.
Anybody could help? I can share more screenshots if you want.
Thanks.
I found the problem.
I'm using React Body Classname in my app so when we load different routes we can change the body class from client side. This npm module needs to be used with the Rewind() funcion when you do server side rendering in order to avoid memory leaks:
This is the module I'm talking about:
https://github.com/iest/react-body-classname
And, in order to avoid the memory leak, we are calling:
BodyClassName.rewind()
In the render function of our main App.js container component. This way, doesn't matter what url a user is landing on, Rewind() will always be called and so the data that can be garbage collected will be properly freed in the future.
Now our app stays at a nice and steady 120mb of memory usage.
Thanks anyway :D

Nested NSManagedObjectContext for core data, how to share and manage data properly?

This is the first post in stackoverflow for me. Because I encountered the problem that I can't solve even by looking up in google and documents.
I get a small iOS project, which is a weather searching app. Basically it is easy to implement overall, but there are some rules I have to follow:
One parent context on a background thread which is linked to the persistent store (on disk);
one child context on the main thread for the UI;
one child context on a background thread for talking to the web service.
After seeing this, I found an image online:
This image shows what exactly should do for this project. And I get few problems right now.
As image shows, I use [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType] to define my main UI MOC, and use NSPrivateQueueConcurrencyType to define my webMOC and diskMOC. Question is that, shall I put everything into [UIMOC performBlock: ^{......}] ?
I am quite confused right now, isn't UI runs on main thread? so what is the point of NSMainQueueConcurrencyType?
After reading lot of documents, I found that the way to share data between childMOC and parentMOC are either make childMOC run "save" function, or call merge function through notification.
(a) for the first one, do I need to [childMOC save] then do [parentMOC save]? or after [childMOC save], parentMOC automatically get updated?
(b) I am not sure which way is more appropriate.
The image above have 3 levels MOC. If I do "save" function at the lowest level MOC and can highest level MOC get data shared?
As what I thought about, why couln't the lowest level MOC combined with highest level MOC and to read and write? meantime, the UIMOC in the middle, do I have to put it into performBlock function of Context to run NSFetchedResultController?

QAbstractItemModel Lazy Loading locks application

I have implemented canFetchMore, hasChildren and fetchMore in order to allow my model to be lazy loaded. It's very simple and based on QT's: http://doc.qt.io/archives/qt-4.7/itemviews-simpletreemodel.html
My problem is that in my application fetching children is not a very quick operation, it involves a few seconds of delay on the server side while it figures out who the children actually are.
I'm unsure how to deal with that. I can't have my application locking up for several seconds every time someone expands a node. I don't know how to go about making this happen in the background. If I was to create a sub-process or thread to actually do the work of retrieving the children and updating the client side data structure, how would I go about telling the model that this had successfully completed (and for the node to finally expand).
Also, is there a way to show that the node is currently in the process of loading the data in the background?
Apologies if these are stupid questions, GUI programming is still a bit of a mystery to me and I've never used QT before.
For the record, I'm using Python, but if answers are given in C++ I can understand them.
Thanks
If I was to
create a sub-process or thread to actually do the work of retrieving
the children and updating the client side data structure, how would I
go about telling the model that this had successfully completed (and
for the node to finally expand).
You can use signal and slots. In the thread you retrieve the data you will emit a custom signal like someDataAvailable(YourdataType) and then in the gui you will handle this signal with a slot something like handleDataReadySignal(YourdataType). The signal passes the object that you give it when emitting. Apparently you need to update the gui and the list in the handleDataReadySignal slot. Of course you need to connect the slot to the signal preferably in the constructor of the window/dialog to which the list is attached

Resources