Author Topic: serialize related questions  (Read 1142 times)

Offline primosz67

  • byte
  • *
  • Posts: 17
    • View Profile
serialize related questions
« on: March 01, 2013, 12:05:46 am »
1. is serialize() save transformedCenterData and size information?
2. is there a way to force save this data
3. is ID change when deserialize and add to world? If not, what you suggest to make relation with another data .. like game Data?
4. is call compile and build,  clear some information? (e.g. position, rotation)

sorry for the stupidity

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: serialize related questions
« Reply #1 on: March 01, 2013, 09:52:06 pm »
  • Center and rotation pivot will be saved. Translations, rotations, scale etc. won't.
  • No. You have to save this yourself if you need it.
  • I don't get the question...
  • compile() doesn't but build() recalculates the center and the rotation pivot. Translations and rotations will remain untouched but their actual outcome may change because of the recalculated center.

Offline primosz67

  • byte
  • *
  • Posts: 17
    • View Profile
Re: serialize related questions
« Reply #2 on: March 02, 2013, 08:10:33 am »
About 3 :

I have the hero and monster object the all of them have they own object3d. and if i save the object3d[] array of all of them(as one array) and hero objects and monster objects i save as gameObjects[] array, then when i loading i need to create mapping with the heros , monster objects and objects3d ,first i thought that id is unique, but isn't. Do you have any ideas? I can use name field for this, but i would like to leave this for display purpose. 

Thanks for help

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: serialize related questions
« Reply #3 on: March 02, 2013, 08:32:22 am »
Even if the id would have been stored in the file, you can't ensure that it will be unique after loading because you might have saved multiple objects with the same id.

Offline primosz67

  • byte
  • *
  • Posts: 17
    • View Profile
Re: serialize related questions
« Reply #4 on: March 02, 2013, 09:20:38 pm »
after loading serialized object, I am trying to copy object and i getting exception in my face. Someone could tell me why?

Exception in thread "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBoundsException: 3518
   at com.threed.jpct.Object3D.copy(Unknown Source)
   at com.threed.jpct.Object3D.<init>(Unknown Source)
   at com.threed.jpct.Object3D.cloneObject(Unknown Source)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: serialize related questions
« Reply #5 on: March 02, 2013, 11:15:48 pm »
Which version of jPCT are you using? Looks like an older one to me!?

Offline primosz67

  • byte
  • *
  • Posts: 17
    • View Profile
Re: serialize related questions
« Reply #6 on: March 03, 2013, 12:37:30 am »
Manifest-Version: 1.0
Created-By: EgonOlsen
Version: 1.15beta3

well i uploaded the newest version: 2012-12-18 -  still the same. 

Exception in thread "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBoundsException: 17426
   at com.threed.jpct.Object3D.copy(Object3D.java:904)
   at com.threed.jpct.Object3D.<init>(Object3D.java:776)
   at com.threed.jpct.Object3D.cloneObject(Object3D.java:3518)

there are lines now :D
« Last Edit: March 03, 2013, 12:47:48 am by primosz67 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: serialize related questions
« Reply #7 on: March 03, 2013, 09:08:17 am »
How do you store your objects? Make sure that you aren't storing them in reduced mode.

Offline primosz67

  • byte
  • *
  • Posts: 17
    • View Profile
Re: serialize related questions
« Reply #8 on: March 03, 2013, 02:04:10 pm »
yeah that was the problem. thx!