commit 594bbce08a61a2f08f81acca74b86944cccf9b09
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Oct 27 23:55:53 2021 +0200

    Progress with PuzzleTester app.

diff --git a/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java b/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
index a3812f49..4505fd9f 100644
--- a/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
+++ b/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
@@ -19,9 +19,6 @@
 
 package org.distorted.objectlib.helpers;
 
-import org.distorted.library.main.DistortedFramebuffer;
-
-import org.distorted.objectlib.main.ObjectControl;
 import org.distorted.objectlib.main.ObjectType;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -35,6 +32,7 @@ public interface ObjectLibInterface
   void onFinishRotation(int axis, int row, int angle);
   void failedToDrag();
   void onSolved();
+  void onObjectCreated(long time);
 
   // objectlib calls those to figure out app's state
   int getCurrentColor();
diff --git a/src/main/java/org/distorted/objectlib/json/JsonReader.java b/src/main/java/org/distorted/objectlib/json/JsonReader.java
index 6675ae3d..7a5d6d4a 100644
--- a/src/main/java/org/distorted/objectlib/json/JsonReader.java
+++ b/src/main/java/org/distorted/objectlib/json/JsonReader.java
@@ -688,7 +688,7 @@ public class JsonReader
 
   public ObjectType intGetObjectType()
     {
-    return ObjectType.TEST;
+    return null;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectControl.java b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
index 3b73812f..b3097806 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectControl.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
@@ -81,7 +81,9 @@ public class ObjectControl
     private static final Static4D mQuat= new Static4D(-0.25189602f,0.3546389f,0.009657208f,0.90038127f);
     private static final Static4D mTemp= new Static4D(0,0,0,1);
 
-    private static boolean mForcedIconMode = false, mForcedCreateMesh = false;
+    private static boolean mForcedIconMode = false;
+    private static boolean mForcedDmeshMode= false;
+    private static boolean mForcedJsonMode = false;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // cast the 3D axis we are currently rotating along (which is already casted to the surface of the
@@ -522,9 +524,16 @@ public class ObjectControl
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public static void setForcedMesh(boolean mode)
+    public static void setDmeshMode(boolean mode)
       {
-      mForcedCreateMesh = mode;
+      mForcedDmeshMode = mode;
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public static void setJsonMode(boolean mode)
+      {
+      mForcedJsonMode = mode;
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -536,9 +545,16 @@ public class ObjectControl
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public static boolean isInCreateMesh()
+    public static boolean isInDmeshMode()
+      {
+      return mForcedDmeshMode;
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public static boolean isInJsonMode()
       {
-      return mForcedCreateMesh;
+      return mForcedJsonMode;
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
index 8e7fc620..6dc64068 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
@@ -27,10 +27,8 @@ import android.content.SharedPreferences;
 import android.content.res.Resources;
 
 import org.distorted.library.message.EffectListener;
-
 import org.distorted.library.type.Static3D;
 
-import org.distorted.objectlib.R;
 import org.distorted.objectlib.helpers.ObjectLibInterface;
 import org.distorted.objectlib.effects.BaseEffect;
 import org.distorted.objectlib.effects.scramble.ScrambleEffect;
@@ -109,16 +107,25 @@ public class ObjectPreRender implements EffectListener
     Static3D move = new Static3D(mMoveX,mMoveY,0);
     Resources res = mAct.get().getResources();
 
-    if( object!=ObjectType.TEST )
+    long time1 = System.currentTimeMillis();
+
+    int meshID = object.getMeshID();
+    InputStream meshStream = ( meshID!=0 && ObjectControl.isInDmeshMode() ) ? res.openRawResource(meshID) : null;
+
+    if( !ObjectControl.isInJsonMode() )
       {
-      mNewObject = object.create( mController.getQuat(), move, res);
+      mNewObject = object.create( mController.getQuat(), move, meshStream);
       }
     else
       {
-      InputStream jsonStream = res.openRawResource(R.raw.test);
-      mNewObject = new TwistyJson(jsonStream, mController.getQuat(), move, null);
+      int jsonID = object.getJsonID();
+      InputStream jsonStream = jsonID!=0 ? res.openRawResource(jsonID) : null;
+      mNewObject = new TwistyJson(jsonStream, mController.getQuat(), move, meshStream);
       }
 
+    long time2 = System.currentTimeMillis();
+    mInterface.onObjectCreated(time2-time1);
+
     if( mNewObject!=null )
       {
       TwistyObjectNode node = mController.getNode();
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectType.java b/src/main/java/org/distorted/objectlib/main/ObjectType.java
index 472846b4..308a0d6c 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectType.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectType.java
@@ -21,8 +21,6 @@ package org.distorted.objectlib.main;
 
 import java.io.InputStream;
 
-import android.content.res.Resources;
-
 import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
 
@@ -33,43 +31,41 @@ import org.distorted.objectlib.objects.*;
 
 public enum ObjectType
   {
-  CUBE_2 ( new int[] {2,2,2}      , 12, R.raw.cube_2, R.drawable.cube_2s, R.drawable.cube_2m, R.drawable.cube_2b, R.drawable.cube_2h),
-  CUBE_3 ( new int[] {3,3,3}      , 17, R.raw.cube_3, R.drawable.cube_3s, R.drawable.cube_3m, R.drawable.cube_3b, R.drawable.cube_3h),
-  CUBE_4 ( new int[] {4,4,4}      , 24, R.raw.cube_4, R.drawable.cube_4s, R.drawable.cube_4m, R.drawable.cube_4b, R.drawable.cube_4h),
-  CUBE_5 ( new int[] {5,5,5}      , 28, R.raw.cube_5, R.drawable.cube_5s, R.drawable.cube_5m, R.drawable.cube_5b, R.drawable.cube_5h),
-  JING_2 ( new int[] {2,2,2,2}    , 11, R.raw.jing_2, R.drawable.jing_2s, R.drawable.jing_2m, R.drawable.jing_2b, R.drawable.jing_2h),
-  PYRA_3 ( new int[] {3,3,3,3}    , 10, R.raw.pyra_3, R.drawable.pyra_3s, R.drawable.pyra_3m, R.drawable.pyra_3b, R.drawable.pyra_3h),
-  PYRA_4 ( new int[] {4,4,4,4}    , 17, R.raw.pyra_4, R.drawable.pyra_4s, R.drawable.pyra_4m, R.drawable.pyra_4b, R.drawable.pyra_4h),
-  PYRA_5 ( new int[] {5,5,5,5}    , 23, R.raw.pyra_5, R.drawable.pyra_5s, R.drawable.pyra_5m, R.drawable.pyra_5b, R.drawable.pyra_5h),
-  KILO_3 ( new int[] {3,3,3,3,3,3}, 18, R.raw.kilo_3, R.drawable.kilo_3s, R.drawable.kilo_3m, R.drawable.kilo_3b, R.drawable.kilo_3h),
-  KILO_5 ( new int[] {5,5,5,5,5,5}, 33, R.raw.kilo_5, R.drawable.kilo_5s, R.drawable.kilo_5m, R.drawable.kilo_5b, R.drawable.kilo_5h),
-  MEGA_3 ( new int[] {3,3,3,3,3,3}, 21, R.raw.mega_3, R.drawable.mega_3s, R.drawable.mega_3m, R.drawable.mega_3b, R.drawable.mega_3h),
-  MEGA_5 ( new int[] {5,5,5,5,5,5}, 37, R.raw.mega_5, R.drawable.mega_5s, R.drawable.mega_5m, R.drawable.mega_5b, R.drawable.mega_5h),
-  ULTI_2 ( new int[] {2,2,2,2}    , 18, R.raw.ulti_2, R.drawable.ulti_2s, R.drawable.ulti_2m, R.drawable.ulti_2b, R.drawable.ulti_2h),
-  DIAM_2 ( new int[] {2,2,2,2}    , 12, R.raw.diam_2, R.drawable.diam_2s, R.drawable.diam_2m, R.drawable.diam_2b, R.drawable.diam_2h),
-  DIAM_3 ( new int[] {3,3,3,3}    , 24, R.raw.diam_3, R.drawable.diam_3s, R.drawable.diam_3m, R.drawable.diam_3b, R.drawable.diam_3h),
-  DIAM_4 ( new int[] {4,4,4,4}    , 32, R.raw.diam_4, R.drawable.diam_4s, R.drawable.diam_4m, R.drawable.diam_4b, R.drawable.diam_4h),
-  DINO_3 ( new int[] {3,3,3,3}    , 10, R.raw.dino_3, R.drawable.dino_3s, R.drawable.dino_3m, R.drawable.dino_3b, R.drawable.dino_3h),
-  DIN4_3 ( new int[] {3,3,3,3}    ,  7, R.raw.dino_3, R.drawable.din4_3s, R.drawable.din4_3m, R.drawable.din4_3b, R.drawable.din4_3h),
-  REDI_3 ( new int[] {3,3,3,3}    , 16, R.raw.redi_3, R.drawable.redi_3s, R.drawable.redi_3m, R.drawable.redi_3b, R.drawable.redi_3h),
-  HELI_3 ( new int[] {3,3,3,3,3,3}, 20, R.raw.heli_3, R.drawable.heli_3s, R.drawable.heli_3m, R.drawable.heli_3b, R.drawable.heli_3h),
-  SKEW_2 ( new int[] {2,2,2,2}    , 11, R.raw.skew_2, R.drawable.skew_2s, R.drawable.skew_2m, R.drawable.skew_2b, R.drawable.skew_2h),
-  SKEW_3 ( new int[] {3,3,3,3}    , 21, R.raw.skew_3, R.drawable.skew_3s, R.drawable.skew_3m, R.drawable.skew_3b, R.drawable.skew_3h),
-  IVY_2  ( new int[] {2,2,2,2}    ,  8, R.raw.ivy_2 , R.drawable.ivy_2s , R.drawable.ivy_2m , R.drawable.ivy_2b , R.drawable.ivy_2h ),
-  REX_3  ( new int[] {3,3,3,3}    , 19, R.raw.rex_3 , R.drawable.rex_3s , R.drawable.rex_3m , R.drawable.rex_3b , R.drawable.rex_3h ),
-  BAN1_3 ( new int[] {3,3,3}      , 16, R.raw.ban1_3, R.drawable.ban1_3s, R.drawable.ban1_3m, R.drawable.ban1_3b, R.drawable.ban1_3h),
-  BAN2_3 ( new int[] {3,3,3}      , 16, R.raw.ban2_3, R.drawable.ban2_3s, R.drawable.ban2_3m, R.drawable.ban2_3b, R.drawable.ban2_3h),
-  BAN3_3 ( new int[] {3,3,3}      , 16, R.raw.ban3_3, R.drawable.ban3_3s, R.drawable.ban3_3m, R.drawable.ban3_3b, R.drawable.ban3_3h),
-  BAN4_3 ( new int[] {3,3,3}      , 16, R.raw.ban4_3, R.drawable.ban4_3s, R.drawable.ban4_3m, R.drawable.ban4_3b, R.drawable.ban4_3h),
-  SQU1_3 ( new int[] {3,2,3}      , 24, R.raw.squ1_3, R.drawable.squ1_3s, R.drawable.squ1_3m, R.drawable.squ1_3b, R.drawable.squ1_3h),
-  SQU2_3 ( new int[] {3,2,3}      , 24, R.raw.squ2_3, R.drawable.squ2_3s, R.drawable.squ2_3m, R.drawable.squ2_3b, R.drawable.squ2_3h),
-  MIRR_2 ( new int[] {2,2,2}      , 12, R.raw.mirr_2, R.drawable.mirr_2s, R.drawable.mirr_2m, R.drawable.mirr_2b, R.drawable.mirr_2h),
-  MIRR_3 ( new int[] {3,3,3}      , 17, R.raw.mirr_3, R.drawable.mirr_3s, R.drawable.mirr_3m, R.drawable.mirr_3b, R.drawable.mirr_3h),
-  CU_323 ( new int[] {3,2,3}      , 15, R.raw.cu_323, R.drawable.cu_323s, R.drawable.cu_323m, R.drawable.cu_323b, R.drawable.cu_323h),
-  CU_232 ( new int[] {2,3,2}      , 16, R.raw.cu_232, R.drawable.cu_232s, R.drawable.cu_232m, R.drawable.cu_232b, R.drawable.cu_232h),
-  CU_343 ( new int[] {3,4,3}      , 23, R.raw.cu_343, R.drawable.cu_343s, R.drawable.cu_343m, R.drawable.cu_343b, R.drawable.cu_343h),
-
-  TEST   ( new int[] {2,2,2}      , 12, R.raw.cube_2, R.drawable.cube_2s, R.drawable.cube_2m, R.drawable.cube_2b, R.drawable.cube_2h),
+  CUBE_2 ( new int[] {2,2,2}      , 12, R.raw.json_cube_2, R.raw.cube_2, R.drawable.cube_2s, R.drawable.cube_2m, R.drawable.cube_2b, R.drawable.cube_2h),
+  CUBE_3 ( new int[] {3,3,3}      , 17, R.raw.json_cube_3, R.raw.cube_3, R.drawable.cube_3s, R.drawable.cube_3m, R.drawable.cube_3b, R.drawable.cube_3h),
+  CUBE_4 ( new int[] {4,4,4}      , 24, R.raw.json_cube_4, R.raw.cube_4, R.drawable.cube_4s, R.drawable.cube_4m, R.drawable.cube_4b, R.drawable.cube_4h),
+  CUBE_5 ( new int[] {5,5,5}      , 28, R.raw.json_cube_5, R.raw.cube_5, R.drawable.cube_5s, R.drawable.cube_5m, R.drawable.cube_5b, R.drawable.cube_5h),
+  JING_2 ( new int[] {2,2,2,2}    , 11, R.raw.json_jing_2, R.raw.jing_2, R.drawable.jing_2s, R.drawable.jing_2m, R.drawable.jing_2b, R.drawable.jing_2h),
+  PYRA_3 ( new int[] {3,3,3,3}    , 10, R.raw.json_pyra_3, R.raw.pyra_3, R.drawable.pyra_3s, R.drawable.pyra_3m, R.drawable.pyra_3b, R.drawable.pyra_3h),
+  PYRA_4 ( new int[] {4,4,4,4}    , 17, R.raw.json_pyra_4, R.raw.pyra_4, R.drawable.pyra_4s, R.drawable.pyra_4m, R.drawable.pyra_4b, R.drawable.pyra_4h),
+  PYRA_5 ( new int[] {5,5,5,5}    , 23, R.raw.json_pyra_5, R.raw.pyra_5, R.drawable.pyra_5s, R.drawable.pyra_5m, R.drawable.pyra_5b, R.drawable.pyra_5h),
+  KILO_3 ( new int[] {3,3,3,3,3,3}, 18, R.raw.json_kilo_3, R.raw.kilo_3, R.drawable.kilo_3s, R.drawable.kilo_3m, R.drawable.kilo_3b, R.drawable.kilo_3h),
+  KILO_5 ( new int[] {5,5,5,5,5,5}, 33, R.raw.json_kilo_3, R.raw.kilo_3, R.drawable.kilo_5s, R.drawable.kilo_5m, R.drawable.kilo_5b, R.drawable.kilo_5h),
+  MEGA_3 ( new int[] {3,3,3,3,3,3}, 21, R.raw.json_mega_3, R.raw.mega_3, R.drawable.mega_3s, R.drawable.mega_3m, R.drawable.mega_3b, R.drawable.mega_3h),
+  MEGA_5 ( new int[] {5,5,5,5,5,5}, 37, R.raw.json_mega_5, R.raw.mega_5, R.drawable.mega_5s, R.drawable.mega_5m, R.drawable.mega_5b, R.drawable.mega_5h),
+  ULTI_2 ( new int[] {2,2,2,2}    , 18, R.raw.json_ulti_2, R.raw.ulti_2, R.drawable.ulti_2s, R.drawable.ulti_2m, R.drawable.ulti_2b, R.drawable.ulti_2h),
+  DIAM_2 ( new int[] {2,2,2,2}    , 12, R.raw.json_diam_2, R.raw.diam_2, R.drawable.diam_2s, R.drawable.diam_2m, R.drawable.diam_2b, R.drawable.diam_2h),
+  DIAM_3 ( new int[] {3,3,3,3}    , 24, R.raw.json_diam_3, R.raw.diam_3, R.drawable.diam_3s, R.drawable.diam_3m, R.drawable.diam_3b, R.drawable.diam_3h),
+  DIAM_4 ( new int[] {4,4,4,4}    , 32, R.raw.json_diam_4, R.raw.diam_4, R.drawable.diam_4s, R.drawable.diam_4m, R.drawable.diam_4b, R.drawable.diam_4h),
+  DINO_3 ( new int[] {3,3,3,3}    , 10, R.raw.json_dino_3, R.raw.dino_3, R.drawable.dino_3s, R.drawable.dino_3m, R.drawable.dino_3b, R.drawable.dino_3h),
+  DIN4_3 ( new int[] {3,3,3,3}    ,  7, R.raw.json_dino_3, R.raw.dino_3, R.drawable.din4_3s, R.drawable.din4_3m, R.drawable.din4_3b, R.drawable.din4_3h),
+  REDI_3 ( new int[] {3,3,3,3}    , 16, R.raw.json_redi_3, R.raw.redi_3, R.drawable.redi_3s, R.drawable.redi_3m, R.drawable.redi_3b, R.drawable.redi_3h),
+  HELI_3 ( new int[] {3,3,3,3,3,3}, 20, R.raw.json_heli_3, R.raw.heli_3, R.drawable.heli_3s, R.drawable.heli_3m, R.drawable.heli_3b, R.drawable.heli_3h),
+  SKEW_2 ( new int[] {2,2,2,2}    , 11, R.raw.json_skew_2, R.raw.skew_2, R.drawable.skew_2s, R.drawable.skew_2m, R.drawable.skew_2b, R.drawable.skew_2h),
+  SKEW_3 ( new int[] {3,3,3,3}    , 21, R.raw.json_skew_3, R.raw.skew_3, R.drawable.skew_3s, R.drawable.skew_3m, R.drawable.skew_3b, R.drawable.skew_3h),
+  IVY_2  ( new int[] {2,2,2,2}    ,  8, R.raw.json_ivy_2 , R.raw.ivy_2 , R.drawable.ivy_2s , R.drawable.ivy_2m , R.drawable.ivy_2b , R.drawable.ivy_2h ),
+  REX_3  ( new int[] {3,3,3,3}    , 19, R.raw.json_rex_3 , R.raw.rex_3 , R.drawable.rex_3s , R.drawable.rex_3m , R.drawable.rex_3b , R.drawable.rex_3h ),
+  BAN1_3 ( new int[] {3,3,3}      , 16, R.raw.json_ban1_3, R.raw.ban1_3, R.drawable.ban1_3s, R.drawable.ban1_3m, R.drawable.ban1_3b, R.drawable.ban1_3h),
+  BAN2_3 ( new int[] {3,3,3}      , 16, R.raw.json_ban2_3, R.raw.ban2_3, R.drawable.ban2_3s, R.drawable.ban2_3m, R.drawable.ban2_3b, R.drawable.ban2_3h),
+  BAN3_3 ( new int[] {3,3,3}      , 16, R.raw.json_ban3_3, R.raw.ban3_3, R.drawable.ban3_3s, R.drawable.ban3_3m, R.drawable.ban3_3b, R.drawable.ban3_3h),
+  BAN4_3 ( new int[] {3,3,3}      , 16, R.raw.json_ban4_3, R.raw.ban4_3, R.drawable.ban4_3s, R.drawable.ban4_3m, R.drawable.ban4_3b, R.drawable.ban4_3h),
+  SQU1_3 ( new int[] {3,2,3}      , 24, R.raw.json_squ1_3, R.raw.squ1_3, R.drawable.squ1_3s, R.drawable.squ1_3m, R.drawable.squ1_3b, R.drawable.squ1_3h),
+  SQU2_3 ( new int[] {3,2,3}      , 24, R.raw.json_squ2_3, R.raw.squ2_3, R.drawable.squ2_3s, R.drawable.squ2_3m, R.drawable.squ2_3b, R.drawable.squ2_3h),
+  MIRR_2 ( new int[] {2,2,2}      , 12, R.raw.json_mirr_2, R.raw.mirr_2, R.drawable.mirr_2s, R.drawable.mirr_2m, R.drawable.mirr_2b, R.drawable.mirr_2h),
+  MIRR_3 ( new int[] {3,3,3}      , 17, R.raw.json_mirr_3, R.raw.mirr_3, R.drawable.mirr_3s, R.drawable.mirr_3m, R.drawable.mirr_3b, R.drawable.mirr_3h),
+  CU_323 ( new int[] {3,2,3}      , 15, R.raw.json_cu_323, R.raw.cu_323, R.drawable.cu_323s, R.drawable.cu_323m, R.drawable.cu_323b, R.drawable.cu_323h),
+  CU_232 ( new int[] {2,3,2}      , 16, R.raw.json_cu_232, R.raw.cu_232, R.drawable.cu_232s, R.drawable.cu_232m, R.drawable.cu_232b, R.drawable.cu_232h),
+  CU_343 ( new int[] {3,4,3}      , 23, R.raw.json_cu_343, R.raw.cu_343, R.drawable.cu_343s, R.drawable.cu_343m, R.drawable.cu_343b, R.drawable.cu_343h),
   ;
 
   public static final int NUM_OBJECTS = values().length;
@@ -78,7 +74,7 @@ public enum ObjectType
   private final int[] mNumLayers;
   private final int mNumScrambles;
   private final int mSmallIcon, mMediumIcon, mBigIcon, mHugeIcon;
-  private final int mMeshID;
+  private final int mMeshID, mJsonID;
 
   private static final ObjectType[] objects;
 
@@ -126,10 +122,11 @@ public enum ObjectType
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  ObjectType(int[] numLayers, int scrambles, int meshID, int sIcon, int mIcon, int bIcon, int hIcon)
+  ObjectType(int[] numLayers, int scrambles, int jsonID, int meshID, int sIcon, int mIcon, int bIcon, int hIcon)
     {
     mNumLayers   = numLayers;
     mNumScrambles= scrambles;
+    mJsonID      = jsonID;
     mMeshID      = meshID;
     mSmallIcon   = sIcon;
     mMediumIcon  = mIcon;
@@ -161,11 +158,24 @@ public enum ObjectType
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public TwistyObject create(Static4D quat, Static3D move, Resources res)
+  public int getMeshID()
+    {
+    return mMeshID;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public int getJsonID()
+    {
+    return mJsonID;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public TwistyObject create(Static4D quat, Static3D move, InputStream stream)
     {
     int ord = ordinal();
     int[] numL= objects[ord].mNumLayers;
-    InputStream stream = ( mMeshID!=0 && !ObjectControl.isInCreateMesh() ) ? res.openRawResource(mMeshID) : null;
 
     switch(ord)
       {
