Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   GANI File Manipulation (https://forums.graalonline.com/forums/showthread.php?t=134261809)

fowlplay4 01-23-2011 03:38 AM

GANI File Manipulation
 
4 Attachment(s)
Being inspired to help improve the gani situation I took it upon myself to write a flexible GANI class with some functions to load, manipulate, and save the data in the correct format.

Example Script:

PHP Code:

function onCreated() {
  if (
this.testgani != NULLthis.testgani.destroy();
  
this.testgani = new TStaticVar();
  
this.testgani.join("gani");
  
this.testgani.loadgani("levels/ganis/walk.gani");
  
this.testgani.setSingleDir(true);
  
this.testgani.savegani("outputfolder/walk_messedlol.gani");
  
this.testgani.destroy();


Functions:

PHP Code:

// File I/O Functions
public function loadgani(path)
public function 
savegani(newpath)

// Animation Functions
public function getAniLength()
public function 
isLooped()
public function 
setLooped(bool)
public function 
isContinuous()
public function 
setContinuous(bool)
public function 
isSingleDir()
public function 
setSingleDir(bool)
public function 
getSetBackTo()
public function 
setSetBackTo(newbackto)

// Frame Functions
public function getFrameSprites(inddir)
public function 
setFrameSprites(inddirnewsprites)
public function 
getFrameData(inddir)
public function 
getFrameTime(ind)
public function 
getFrameSound(ind)
public function 
setFrameSound(indnewsoundoxoy)
public function 
getFrameWait(ind)
public function 
setFrameWait(indwaitvalue)
public function 
getFrameCount()

// Sprite Functions
public function addSprite(sprite_idsprite_imgsprite_xsprite_ysprite_wsprite_hsprite_com)
public function 
getSprite(spriteid)
public function 
getSpriteImage(spriteid)
public function 
setSpriteImage(spriteidnewimg)
public function 
getSpriteX(spriteid)
public function 
setSpriteX(spriteidnewval)
public function 
getSpriteY(spriteid)
public function 
setSpriteY(spriteidnewval)
public function 
getSpriteWidth(spriteid)
public function 
setSpriteWidth(spriteidnewval)
public function 
getSpriteHeight(spriteid)
public function 
setSpriteHeight(spriteidnewval)
public function 
getSpriteComment(spriteid)
public function 
setSpriteComment(spriteidcomment)

// GANI Effect Functions
public function getColorEffects()
public function 
addColorEffect(spriteidrgba)
public function 
deleteColorEffect(spriteid)
public function 
getZoomEffects()
public function 
addZoomEffect(spriteidz)
public function 
deleteZoomEffect(spriteid)
public function 
getRotateEffects()
public function 
addRotateEffect(spriteidr)
public function 
deleteRotateEffect(spriteid)
public function 
getStretchYEffects()
public function 
addStretchYEffect(spriteids)
public function 
deleteStretchYEffect(spriteid)
public function 
deleteStretchXEffect(spriteid)
public function 
addStretchXEffect(spriteids)
public function 
getStretchXEffects()
public function 
deleteModeEffect(spriteid)
public function 
addModeEffect(spriteidm)
public function 
getModeEffects() 

There could still be a few more functions added but for the most part it should be a very decent base to work off of.

I've tested it with human2_bow_shoot.gani, and some of Zodiac's ganis and all appears to work just fine after being loaded, manipulated and saved.

If my code doesn't preserve a certain element let me know but I'm pretty sure I've gotten everything.

See attached for class, and the aftermath of my example script.

cbk1994 01-23-2011 03:40 AM

Impressive.

Fulg0reSama 01-23-2011 03:45 AM

Impressed so hard that I'm confused by what exactly I'm looking at.

WhiteDragon 01-23-2011 03:51 AM

Neat.

fowlplay4 01-23-2011 03:56 AM

Next step GraalShop2.

Fulg0reSama 01-23-2011 03:58 AM

third party style program plox.
Get to it fp4/cbk.

Deas_Voice 01-23-2011 03:58 AM

Quote:

Originally Posted by fowlplay4 (Post 1624985)
Next step GraalShop2.

not a gui one, right? >_<

fowlplay4 01-23-2011 04:01 AM

Yes an external open-source alternative would be ideal.

cbk1994 01-23-2011 04:05 AM

Even if someone made a third-party program, which wouldn't be that hard, it wouldn't be able to show particles.

Fulg0reSama 01-23-2011 04:07 AM

Quote:

Originally Posted by cbk1994 (Post 1624995)
Even if someone made a third-party program, which wouldn't be that hard, it wouldn't be able to show particles.

Eh, gotta sacrifice somehow right?

Particles gotta emit on the game anyways since you have to test for lag.
Normal Sprite and Movie Ganis do not.

Edit: Oh yeah, what about movie mode ganis? @ fowlplay4
Hopefully if such thing is done it's made a lot more user friendly. I swear movie ganis are probably the most non user friendly thing I've ever seen.

fowlplay4 01-23-2011 04:13 AM

Quote:

Originally Posted by cbk1994 (Post 1624995)
Even if someone made a third-party program, which wouldn't be that hard, it wouldn't be able to show particles.

But working Zoom, Color, Rotate effects and UI-functionality for attaching sprites and a sprite cutter would surely make up for that.

Edit: Forgot about movie ganis but given the amount of usage they get it (I've never used them), **** em.
Edit2: Edited script so it'll still preserve the MOVIE section.

cbk1994 01-23-2011 06:56 AM

Quote:

Originally Posted by Fulg0reSama (Post 1624997)
Eh, gotta sacrifice somehow right?

Particles gotta emit on the game anyways since you have to test for lag.
Normal Sprite and Movie Ganis do not.

Edit: Oh yeah, what about movie mode ganis? @ fowlplay4
Hopefully if such thing is done it's made a lot more user friendly. I swear movie ganis are probably the most non user friendly thing I've ever seen.

What changes would you want to see in an updated GraalShop?

MrOmega 01-23-2011 07:37 AM

Instead of third party, use external windows? I would like the ability to actuall zoom in/out the timeline bar.

fowlplay4 01-23-2011 07:56 AM

Quote:

Originally Posted by MrOmega (Post 1625053)
Instead of third party, use external windows? I would like the ability to actuall zoom in/out the timeline bar.

The two issues with that is that you'll be tethered to Graal and the GUI issues that come with the territory which are brought up whenever discussing the scripted player-list.

The current timeline is by far one of the worst systems ever. Not only do you have to find it's T-spot, but then you also have to be careful not to extend it further than you want it.

MrOmega 01-23-2011 11:21 AM

Hmm, I see, I don't see too many issue with GShop that would come in playerlist. I think I'll work on one tomorrow and eventually post what I get.


All times are GMT +2. The time now is 12:43 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.