The spine plugin for Phaser gives an error - phaser-framework

I'm trying to upload the plugin to my project, tried all the methods, but nothing works. Returns an error
Uncaught TypeError: Cannot read properties of undefined (reading 'createSkeleton')
at initialize.set Skeleton (<anonymous>:1:290667)
at new initialize (<anonymous>:1:289262)
at Game Object Factory.spine (<anonymous>:1:54310)
at MainWindow.create (MainWindow.js?21c4:53:27)
at SceneManager.create (phaser.js?d4ef:89720:1)
at SceneManager.loadComplete (phaser.js?d4ef:89632:1)
at Loader Plug in.emit (phaser.js?d4ef:1908:1)
at Leaderplugin.loadComplete (phaser.js?d4ef:192810:1)
at Loader Plug in.file Process Complete (phaser.js?d4ef:192776:1)
at t.on Process Complete (<anonymous>:1:25378)
I work on a local server. Here is a code example of how I connect everything

I think it's the same problem I had. My spine JSON data were saved in an old format. You probably used DragonBones, which exports only version 3.3 spine data.
Here are the details someone remarked what's wrong with the file. You have three options: (A) change the file manually each time you export it, (B) use the python file the dude provides there, or (C) make a function to change the data structure accordingly after they are loaded and before the skeleton is added to scene. (This is the way I went.)

Related

JODIT WYSIWYG editor 3.24.1 - how to call a function and get source filename after a base64 encoded image has been inserted

I've got images inserting into the editor as base64 encoded images (uploader option insertImageAsBase64URI is set to true). However, I'd like to call a function after the image has been inserted and also read the source filename for the inserted image.
I'm new to the JODIT editor, it seems great so far, but I need to tweak it a bit and am not sure how to register an event callback for this, or if there is another/better way. Any help is appreciated!
I think the best solution is to fork JODIT in github and edit the code. For some reason, however, I have been unable to build the code on my mac laptop for at least a couple of reasons (missing file in node module, fixed, and a build error "TypeError: require(...) is not a function" that may indicate circular dependencies in node modules?). Anyway, I found a complete and limited "HACK" for my needs and that is to actually capture the filename when the file is added by attaching an "onchange" handler function to the JODIT instance's file input element. This works roughly as follows (I'm using jQuery):
var selectedFile = null;
function setSelectedFile(){
$('.jodit').find('input[type="file"]').removeProp('multiple');
$('.jodit').find('input[type="file"]').on('change', function(){
var files = $(this).prop('files');
selectedFile = files[0].name;
});
});
$('.jodit').find('button[aria-label="Insert file"]').on('click',
function(){
setSelectedFile();
}
);
I run something like this after the page has loaded. This works only for the "change" event (where you select a file directly) and I could not figure out how to read the filename after a file is "dropped". Dropping a file does not seem to trigger the "change" event in the file input element. If anyone knows how to get the filename of a dropped file for the JODIT editor I'd appreciate sharing. I will update this if I get around to fixing that.

How to force reimport of texture in godot?

I have a sample.png file which is being changed outside godot
and after it's modified, godot recives a signal and when that signal is received
I want that specific sample.png file to be reimported
I tried this answer but I want to reimport in my script itself not create a plugin for it
(atleast that's what I'm assuming it does)
I also tried this from the documents but I'm not sure how to use it exactly
EditorFileSystem.update_file("res://Assets/sample.png")
so how do I achieve the desired result?
The class EditorFileSystem is intended for plugins.
You would call get_editor_interface() from an EditorPlugin (which would be where you would be writing code if you were making a plugin). And that gives you an EditorInterface object, on which you can call get_resource_filesystem() which gives you an EditorFileSystem object.
So the intended use is something like this:
extends EditorPlugin
func example() -> void:
var editor_file_system := get_editor_interface().get_resource_filesystem()
editor_file_system.scan_sources()
# editor_file_system.update_file("res://icon.png")
By the way, EditorInterface also has a filesystem_changed signal. Although I don't know how reliable it is.
Usually you don't have to do that. When you restore the Godot window, it will scan for changes in the project folder. So you might minimize Godot while you are working on something else and when you bring the Godot window back it will pick on the changes.
In practice, the only situations when I had to use scan or scan_sources was when I had a tool script that write a resource file which should be imported, and I wanted it to reflect right away.
Instead of making a custom plugin, I'll remind you that form a tool script (as long as it is running in the editor) you can simply create an EditorPlugin object. For example:
var ep = EditorPlugin.new()
ep.get_editor_interface().get_resource_filesystem().scan()
ep.free()
I had also shared this example in another answer I wrote for you a while back here, it is under the title "About saving resources from tool scripts".

Save a tensorflow.js model in node

I am trying to save a tensorflow.js model I have as a json file but it's not working.
var exampleModel = {input:1,name:'model'}
fs.writeFileSync('model.json', JSON.stringify(model,null,2))
//=> '"{\"input\":1, \"name\": \"model\"}"'
It's not in json format. I wasted a lot of time trying to manually create a json but that didn't work either and I will have to redo it by copying it to a normal object or something.
Seems noone knows anything about this. The problem was that I was using node and I needed to require "#tensorflow/tfjs-node" underneath my tfjs require line. I had to search for this page specifically as there wasn't anything about it in their documentation: https://js.tensorflow.org/tutorials/model-save-load.html
Here's another helpful link: https://github.com/tensorflow/tfjs-node

Read DICOM images

i am trying to read dicom images without using imageviewer and i came across VtkGdmReader.. when i am trying to execute it, its giving me an error:
code => vtkGdmReader example
error C2039: 'SetInput' : is not a member of 'vtkTexture'
error C2039: 'SetInput' : is not a member of 'vtkPolyDataMapper'
please can any one tell me why am i facing this problem, is this error related to vtk version ? if so then how can i go about it ?
please help me resolving the problem..
As said in the comments, this error is related to the VTK version. SetInput() was removed in VTK 6.
You can either work in VTK 5 or update the code. If you decide to update it, this error gets fixed by replacing SetInput() with either SetInputData() or SetInputConnection() with a few modifications. You should use SetInputConnection() if you want the filters to go through the pipeline.
As an example of fixing the errors you mentioned, you should replace the following lines in the code you provided:
VTKtexture->SetInput(ima); and
VTKplaneMapper->SetInput(VTKplane->GetOutput());
to:
VTKtexture->SetInputConnection(reader->GetOutputPort()); and
VTKplaneMapper->SetInputConnection(VTKplane->GetOutputPort());
In the second modification (VTKplaneMapper), note that we just changed GetOutput() to GetOutputPort(), while in the first one (VTKtexture) we completely changed the argument passed to SetInputConnection(). That happens because data objects (such as ima) no longer have dependency on pipeline objects (such as algorithms and executives). In this case, we give the algorithm that generated that data object as the argument - if you look for it, you can see the line vtkImageData* ima = reader->GetOutput();, you just have to replace GetOutput() by GetOutputPort() as we did in the second modification.
I recommend looking into the VTK Wiki's VTK 6 Migration pages (and guide) for more information on this error and other errors that you might run into.

Build is producing a .momd in the bundle that is missing the .mom file

I have an app that has been running fine on the iPhone simulator for some time. Recently, I decided I wanted to re-use the data model and related classes in another project - so I dragged them from this project window to the other then told Xcode not to copy, just to make references. At first this didn't work so I jumped through a number of hoops to try to fix it (I may be asking more about that in another post). After all this, I re-compiled and tried to run the original app -- and it's not working any more. On further investigation, I discovered that when I re-compile the original app, I end up with a bundle that contains a .momd package but it contains only a Versioninfo.plist file - no .mom file, no .omo file like I'm expecting to see. I don't recall making any changes to the original app. I don't get any warnings. I just get an incomplete .momd package (and, not surprisingly, my app now crashes).
What's going on here?
BTW, the app now crashes with this message:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
Which I get when executing this line of code:
self.productRegistry = [[UIManagedDocument alloc] initWithFileURL:self.productRegistryURL];
I figured this out by looking more closely at the file locations in the project directory using Finder. In the Xcode window, everything looks normal but in the actual project directory I found that the .datamodeld package had ended up at the top level of the project directory -- at the same level as the project package itself. Xcode apparently did not like this but unfortunately it did not complain -- it just created a partial build output. Once I moved the .datamodeld package into the same folder as the rest of the project's code, everything worked just fine.
This would appear to be just a quirk. I would expect that Xcode would either see that all is well and build correctly OR it would see that things weren't quite as they should be and fail. In this case, it did not build correctly but was silent about it.
Hope this answer helps someone else someday.

Resources