How can I run a animation by the animation name generated on the cocos studio? (cocos2s-js) - cocos2d-js

It can create the animation name on the timeline at CocosStudio2.
But I don't know the way of calling it from cocos2d-js(v3.6).
How can I run a animation by the name?

I don't really know what you are looking for, but in the cocos 2d-js you can run an action or a sequence of actions (Animation), here is a tutorial: https://www.youtube.com/watch?v=s46AtHxDRdM!

Related

Xtext: Customize how Generator is called

I would like to change the way the Generator is called in my project. As default it is called when the model is safed, but I would need it to be called when enter is hit for example. Can anyone explane where and how to do this?
Thank you very much!
by default generator is called by the build. if you want to call it manually you need to do that yourself. you may use https://dietrich-it.de/xtext/2011/10/15/xtext-calling-the-generator-from-a-context-menu/ as a starting point

Incorporating a plugin into an ImageJ/FIJI Macro (bUnwarpJ)

I am trying to integrate the plugin, bUnwarpJ into an ImageJ macro I have been writing. The aim is to call this plugin, allow the user to define the parameters and run it.
This plugin has an option to save the user defined parameters, i.e., "save landmarks". I would like this to be executed as well by calling: call("bunwarpj.bUnwarpJ_.saveLandmarks", output folder) from within my plugin.
Currently, the code is:
run("bUnwarpJ");
call("bunwarpj.bUnwarpJ_.saveLandmarks", output folder);
The problem is once bUnwarpJ is completed, you cannot call 'save landmarks' method, and will lose the user input data as well. How would you solve this?
One idea was to have a pop up window (before the run command) which will NOT pause the user interaction, and when the user completes defining landmarks, they can then click OK on this window which executes call(), thereby saving the landmarks while bUnwarpJ is running. The problem I had was most of popup windows will pause the rest of the code..It would ideally be like:
#command for popup window here
run("bUnwarpJ"); #when user is finished, they click Ok on the box above
#which executes: call("bunwarpj.bUnwarpJ_.saveLandmarks", output folder);
Any help is appreciated. Thanks!
Is the user defining landmarks by creating an ROI or something else that might require them to actually interact with an image? If not, and/or those landmark values can be generated ahead of time (using a single image as a template for your batch), you might consider just adding a user interface/dialog box that requests the landmark values and then saves them as a set of variables, or an array. Let me know if that sounds like it might be on the right track and I can do my best to help you set that up.
Using the initial dialog box would definitely be the simplest method to get the input parameters. If for some reason this doesn't work, you might consider putting in a line like:
run("bUnwarpJ");
waitForUser("Input Your Parameters");
I haven't used UnwarpJ, but the waitForUser command should allow the macro to pause for the manual input if the user is meant to do steps other than just parameter inputs. Otherwise, ejkiely's suggestion will be the fastest solution.

Detecting unused methods iOS

Very simple question and hopefully isn't duplicated :).
The situation is following:
Project has been developing more then a year and by many developers.
From time to time I'm facing with unused methods (which are defined in .h and .m) obviously I'm not getting any warnings.
This is not critical, but I would like to have project cleared from all unnecessary staff. Of course I can search for all methods and define which are unused in project but I wonder if there is more elegant way?!
Thanks
A quick way to check while browsing your source code is the View > Standard Editor > Show Related Items menu (shortcut key: ^1). Place your cursor within a method body and then view the Callers.
AppCode (http://www.jetbrains.com/objc) can tell you if a method or an import is unused.
It's works in real time, but you can also inspect a whole project (menu code > inspect Code)
I don't think xCode can do it.
AppCode is not free, but it has a trial version.
Might I suggest adding an NSLOG to these methods. For example, if you have a View Controller called Home, you can go into the .m file for the Home View Controller and at the top of the function, write the following:
NSLOG(#"Method 1, has 3 buttons);
then watch the readout as you progress through the actions on that View Controller. The log should say something that would best describe the method in question. Step 2 would be to take the methods that you feel aren't showing up on the output and comment them out. That can be done by highlighting the method and then hitting Command + '/' on the keyboard. This will place '//' in front of each highlighted line commenting it out. Test your view controller again and if still no errors, you can delete that method. That's a free way to do it, but it does take some time.

Sleep Lua script without halting entire program?

I'm writing a GUI that's meant to be easily customizable by the end-users. The functions are in C++ and are called from Lua. I'm trying to make a Sleep() type function that will pause the script but not the program itself.
I was able to get it working by using threads and making one for each function. However, I want it to be an individual function. As in, instead of having it part of the CreateButton function and every other function, simply having a Delay or Sleep function that only halts the script, not the entire program.
Me being a novice at Lua, I really don't know how to go about this. Any help is appreciated.
I'd look into making a state machine using coroutines and message passing. Treat each button push like a c++ string that gets passed into coroutine resume. You can then build a little state machine that switches on the message. You can then do some UI work and then put the coroutine back to sleep till something sends it another message.
This is pretty handy if you have a state machine that does UI.
pseudo code:
c_obj:wait_for_message("mouse_down");
local message = coroutine.yield();
if(message == "mouse_down") then
update draw function.
end
c_obj:wait_for_message("mouse_up");
local message = coroutine.yield();
if(message == "mouse_up") then
Update UI..
update draw function.
end
etc...
To make your busy-waiting solution more efficient, how about using select() or similar to wait for some GUI events to process, rather than spinning? It seems like something you would need to do in the GUI regardless of the scripting side of things.

Autocomplete with Vim and Rails Datamapper

Is there a way that I can have auto completion in Vim after I load a model from the database?
So for example if I have a model of type Foo with an instance method of type bar and do the following
foo = Foo.first(:param=>'x')
foo.b
should show me bar as a possible auto complete value. I think that this is somewhat hard to accomplish with dynamic languages and you would probably have to be aware of the datamapper conventions.
Maybe I'm taking the wrong approach and should not be thinking using auto complete because there is an easier way to code?
I don't think it's possible to do semantic completion in VIM. However if you have written the instance name once, you could use the simple auto completion in VIM to avoid typing long names again.

Resources