Jump to content


  • Posts

  • Joined

  • Last visited

miletbaker's Achievements


Newbie (1/14)



  1. Thanks for the heads up lucid. The plugin does indeed use the shortest distance. I will investigate how I can implement this with Moai.
  2. Okay you are not going to believe this. Talk about my mind overcomplicating the mater. On writing my response above I suddenly thought, hang on these are keyframes so should be the angle we are seeking. Outputting the angles as they are in the scml file solves the issue. The only issue now is how to resolve the spin direction. The example animation works but I suspect there are instances where this will break as I make no use of the spin value. I will push the updated code to github now and think further on this. Thanks for your help guys, if anything you helped me think it through.
  3. HI Jonny D Thanks for this. I am not sure to be honest. I am not tweening the objects myself but rather trying to leverage Moai's MOAIAnimCurve class which basically does the tweening for me. My approach is to extract the SCML file into a lua table which is stored in a .lua file and then the MOAI library I created iterates over the lua table to generate the MOAIAnimCurve keyframes. A MOAIAnimCurve is created for each property being animated here: https://github.com/miletbaker/spriter2m ... er.lua#L69 and then are linked to the MOAIAnim here https://github.com/miletbaker/spriter2m ... er.lua#L26 I have based my approach on the example the MOAI SDK provides for flash here: https://github.com/moai/moai-dev/blob/m ... n/main.lua There is another example of MOAIAnimCurve here: https://github.com/moai/moai-dev/blob/m ... s/main.lua The MOAI transform in question is linked to the Z_ROT property on the MOAITransform class (Unfortunately not very well documented here: http://getmoai.com/docs/class_m_o_a_i_transform2_d.html) But maybe I have misunderstood...
  4. Hi Guys, Still struggling with this. I recoded a video and it does look like the example in grimfang4's video for inverted angles but I have tried inverting angles which seems to make it worse and also offsetting the pivot points as also suggested. For the pivot points Moai need these as pixel offsets rather than proportions and I simply multiply the width and by the pivot_x proportion and height * pivot.y. I don't think the issue is here as the first frame shows all the parts correctly placed and if these values are adjusted the monster is all over the place. For the angles I need to work out the rotation deltas which I am doing as follows: spin = prev_spin #int(keyframe['spin']) if spin >= 0 and iii > 0 and new_angle != prev_angle: #clockwise angle = new_angle - prev_angle if new_angle > prev_angle else (360 - prev_angle) + new_angle elif spin < 0 and iii > 0 and new_angle != prev_angle: #anti-clockwise angle = new_angle - prev_angle if new_angle < prev_angle else (-360 - prev_angle) + new_angle else: angle = new_angle prev_angle = angle In the python code above from the scml2moai.py converter. spin is find the spin value on the previous keyframe rather than the current keyframe (which I believe is correct as the spin value specified the direction to be spun, not what has just been spun). iii is just a keyframe index. If we are on the first keyframe the delta is 0. For all other keyframes if we are going clockwise we would out a positive delta and if anticlockwise a negative delta. I have run through the maths manually on paper and also looked at the output in the lua file compared to this. For example for forearm_a here:https://github.com/miletbaker/spriter2moai/blob/master/example.lua#L215 and it looks okay. Thanks for the help so far guys I am sure it is something simple / obvious I am missing. Time for a break I think!
  5. I'm not too sure, you might be able to record an action and then call the action.
  6. I have made fairly good progress on the Moai library for spriter and pushed an initial commit to github here: https://github.com/miletbaker/spriter2moai There are still a few of issues with the code, in particular with the angles, which are likely down to my miscalculating the angle deltas here or not fully understanding the SCML spec. I need to go back over this and have also seen a helpful post on the forum which may point me in the right direction. Another issue is the animation isn't particularly smooth. I think this could be down to the animation easing but any help with this and the above would be gratefully received. Animations with bones in are are currently not supported. I think this should be easy to resolve and it should simply be a case of incrementing the object positions and angles by their parent bones. Correct me if I am wrong? Lastly, I have had to take the decision to require assets to be packaged into a single texture with Texture Packer. I know this probably isn't ideal but I am not sure it is possible to animate switching decks with MoaiAnimCurvs and would require taking a lower level and more time consuming approach. The added benefit is that you get the performance and memory advantages of using Texture Packer for your Spriter assets. You just need to make sure Texture Packer doesn't add and folder paths to the generated texture mapping lua file. I suspect you can use other texture / sprite packers like Texture Packer with minimal changes to the code. To use the plugin you need to convert the scml to lua. I have taken the same approach mariocaprino took with his Love2d plugin and created a python script to convert the scml file. Again I know this probably isn't the ideal solution for everyone but I wanted to avoid loading and parsing XML at runtime seeing as the most likely target platforms would be smart phones and tablets for developers using Moai. The readme on Github should have all the instructions you need. Feel free to submit comments or pull requests if anyone wants to enhance it further / or help iron out the remaining issues. I'll also post this in the Moai forum and see if anyone is interested in assisting. Thanks, Jon
  7. I have made a start on something for this. I am taking my lead from mariocaprino's Love2d plugin https://github.com/capmar/spriter-love2d, where the first step is to convert the SCML file into a lua script rather than get Moai to load the xml into memory at runtime. I have a fair few other commitments and this is just a side project for me but as soon as I have something working I will push it to github and share here. Jon
  8. Hi all, This isn't a Spriter Plugin, but a handy Photoshop one to export to Spriter. I have been working on improving my workflow and have written a simple Photoshop script to exports the contents of each top level layer group into a separate flattened png file for use as in Spriter. For example if you have layers organised as per attached image. The script creates a subfolder in the same directory as the psd, named with the psd's name and within (in this example) would be: head.png (which would have merge the sub group too) r_forearm.png r_upper_arm.png l_upper_arm.png body.png (In the example image the ungrouped layer1, a scanned image I am tracing from, is not exported) As I can't upload jsx files, just copy and paste the script below into your text editor and save it as 'Export Layer Groups to PNGs.jsx' and copy the file to your Photoshop CS6/Presets/Scripts folder. You can then access the command (after a restart) from File > Scripts > Export Layer Groups to PNGs I have only tested on CS6 but pretty sure it will work on CS5 #target photoshop function main(){ if(!documents.length) return; var doc = activeDocument; var oldPath = activeDocument.path; var docname = doc.name.replace('.psd', ''); new Folder(oldPath + "/" + docname).create(); for(var a=0;a activeDocument.activeLayer = activeDocument.layers.getByName(doc.layerSets[a].name); dupLayers(); activeDocument.mergeVisibleLayers(); activeDocument.trim(TrimType.TRANSPARENT,true,true,true,true); var saveFile= File(oldPath + "/" + docname + "/" + doc.layerSets[a].name +".png"); SavePNG(saveFile); app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); } } main(); function dupLayers() { var desc143 = new ActionDescriptor(); var ref73 = new ActionReference(); ref73.putClass( charIDToTypeID('Dcmn') ); desc143.putReference( charIDToTypeID('null'), ref73 ); desc143.putString( charIDToTypeID('Nm '), activeDocument.activeLayer.name ); var ref74 = new ActionReference(); ref74.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') ); desc143.putReference( charIDToTypeID('Usng'), ref74 ); executeAction( charIDToTypeID('Mk '), desc143, DialogModes.NO ); }; function SavePNG(saveFile){ pngSaveOptions = new PNGSaveOptions(); activeDocument.saveAs(saveFile, pngSaveOptions, true,Extension.LOWERCASE); }
  9. If you click the disclosure triangle (which are partially hidden btw) the properties panel is exposed which is great but if you then scroll to expose the rest of the panel the panel stays stationary and the window items scroll underneath (See attached screenshot) Version is new A4 release running on Mountain Lion Thanks
  10. THanks for the push to get the release out, it looks great. Any news on integration with Texture Packer?
  11. Hi, I just wanted to know if anyone was already working on a Moai SDK plugin for Spriter. If not I may have a go at creating something. Regards, Jon
  • Create New...