| .. | .. |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | private UUID uuid = UUID.randomUUID(); |
|---|
| 26 | 26 | |
|---|
| 27 | + // TEMPORARY for mocap undo |
|---|
| 28 | + mocap.reader.BVHReader.BVHResult bvh; |
|---|
| 29 | + Object3D skeleton; |
|---|
| 30 | + // |
|---|
| 31 | + |
|---|
| 27 | 32 | ScriptNode scriptnode; |
|---|
| 28 | 33 | |
|---|
| 29 | 34 | void InitOthers() |
|---|
| .. | .. |
|---|
| 104 | 109 | |
|---|
| 105 | 110 | // transient boolean reduced; // for morph reduction |
|---|
| 106 | 111 | |
|---|
| 107 | | -transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
|---|
| 108 | | -transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
|---|
| 112 | + transient com.bulletphysics.linearmath.Transform cache; // for fast merge |
|---|
| 113 | + transient com.bulletphysics.linearmath.Transform cache_1; // for fast merge |
|---|
| 109 | 114 | |
|---|
| 110 | | -transient Object3D transientsupport; // for cloning |
|---|
| 111 | | -transient boolean transientlink2master; |
|---|
| 115 | + transient Object3D transientsupport; // for cloning |
|---|
| 116 | + transient boolean transientlink2master; |
|---|
| 112 | 117 | |
|---|
| 113 | | -void SaveSupports() |
|---|
| 114 | | -{ |
|---|
| 115 | | - if (blockloop) |
|---|
| 116 | | - return; |
|---|
| 117 | | - |
|---|
| 118 | | - transientsupport = support; |
|---|
| 119 | | - transientlink2master = link2master; |
|---|
| 120 | | - |
|---|
| 121 | | - support = null; |
|---|
| 122 | | - link2master = false; |
|---|
| 123 | | - |
|---|
| 124 | | - if (bRep != null) |
|---|
| 118 | + void SaveSupports() |
|---|
| 125 | 119 | { |
|---|
| 126 | | - bRep.SaveSupports(); |
|---|
| 120 | + if (blockloop) |
|---|
| 121 | + return; |
|---|
| 122 | + |
|---|
| 123 | + transientsupport = support; |
|---|
| 124 | + transientlink2master = link2master; |
|---|
| 125 | + |
|---|
| 126 | + support = null; |
|---|
| 127 | + link2master = false; |
|---|
| 128 | + |
|---|
| 129 | + if (bRep != null) |
|---|
| 130 | + { |
|---|
| 131 | + bRep.SaveSupports(); |
|---|
| 132 | + } |
|---|
| 133 | + |
|---|
| 134 | + for (int i = 0; i < Size(); i++) |
|---|
| 135 | + { |
|---|
| 136 | + Object3D child = (Object3D) get(i); |
|---|
| 137 | + if (child == null) |
|---|
| 138 | + continue; |
|---|
| 139 | + blockloop = true; |
|---|
| 140 | + child.SaveSupports(); |
|---|
| 141 | + blockloop = false; |
|---|
| 142 | + } |
|---|
| 127 | 143 | } |
|---|
| 128 | | - |
|---|
| 129 | | - for (int i = 0; i < Size(); i++) |
|---|
| 130 | | - { |
|---|
| 131 | | - Object3D child = (Object3D) get(i); |
|---|
| 132 | | - if (child == null) |
|---|
| 133 | | - continue; |
|---|
| 134 | | - blockloop = true; |
|---|
| 135 | | - child.SaveSupports(); |
|---|
| 136 | | - blockloop = false; |
|---|
| 137 | | - } |
|---|
| 138 | | -} |
|---|
| 139 | 144 | |
|---|
| 140 | | -void RestoreSupports() |
|---|
| 141 | | -{ |
|---|
| 142 | | - if (blockloop) |
|---|
| 143 | | - return; |
|---|
| 145 | + void RestoreSupports() |
|---|
| 146 | + { |
|---|
| 147 | + if (blockloop) |
|---|
| 148 | + return; |
|---|
| 144 | 149 | |
|---|
| 145 | | - support = transientsupport; |
|---|
| 146 | | - link2master = transientlink2master; |
|---|
| 147 | | - transientsupport = null; |
|---|
| 148 | | - transientlink2master = false; |
|---|
| 149 | | - |
|---|
| 150 | | - if (bRep != null) |
|---|
| 151 | | - { |
|---|
| 152 | | - bRep.RestoreSupports(); |
|---|
| 153 | | - } |
|---|
| 154 | | - |
|---|
| 155 | | - for (int i = 0; i < Size(); i++) |
|---|
| 156 | | - { |
|---|
| 157 | | - Object3D child = (Object3D) get(i); |
|---|
| 158 | | - if (child == null) |
|---|
| 159 | | - continue; |
|---|
| 160 | | - blockloop = true; |
|---|
| 161 | | - child.RestoreSupports(); |
|---|
| 162 | | - blockloop = false; |
|---|
| 163 | | - } |
|---|
| 164 | | -} |
|---|
| 150 | + support = transientsupport; |
|---|
| 151 | + link2master = transientlink2master; |
|---|
| 152 | + transientsupport = null; |
|---|
| 153 | + transientlink2master = false; |
|---|
| 165 | 154 | |
|---|
| 166 | | -void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
|---|
| 167 | | -{ |
|---|
| 168 | | - if (hashtable.containsKey(GetUUID())) |
|---|
| 155 | + if (bRep != null) |
|---|
| 156 | + { |
|---|
| 157 | + bRep.RestoreSupports(); |
|---|
| 158 | + } |
|---|
| 159 | + |
|---|
| 160 | + for (int i = 0; i < Size(); i++) |
|---|
| 161 | + { |
|---|
| 162 | + Object3D child = (Object3D) get(i); |
|---|
| 163 | + if (child == null) |
|---|
| 164 | + continue; |
|---|
| 165 | + blockloop = true; |
|---|
| 166 | + child.RestoreSupports(); |
|---|
| 167 | + blockloop = false; |
|---|
| 168 | + } |
|---|
| 169 | + } |
|---|
| 170 | + |
|---|
| 171 | + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
|---|
| 169 | 172 | { |
|---|
| 173 | + if (hashtable.containsKey(GetUUID())) |
|---|
| 174 | + { |
|---|
| 175 | + Object3D o = hashtable.get(GetUUID()); |
|---|
| 176 | + |
|---|
| 177 | + assert(this.bRep == o.bRep); |
|---|
| 178 | + if (this.bRep != null) |
|---|
| 179 | + assert(this.bRep.support == o.transientrep); |
|---|
| 180 | + |
|---|
| 181 | + return; |
|---|
| 182 | + } |
|---|
| 183 | + |
|---|
| 184 | + Object3D o = new Object3D(); |
|---|
| 185 | + |
|---|
| 186 | + hashtable.put(GetUUID(), o); |
|---|
| 187 | + |
|---|
| 188 | + for (int i=0; i<Size(); i++) |
|---|
| 189 | + { |
|---|
| 190 | + get(i).ExtractBigData(hashtable); |
|---|
| 191 | + } |
|---|
| 192 | + |
|---|
| 193 | + ExtractBigData(o); |
|---|
| 194 | + } |
|---|
| 195 | + |
|---|
| 196 | + void ExtractBigData(Object3D o) |
|---|
| 197 | + { |
|---|
| 198 | + o.bRep = this.bRep; |
|---|
| 199 | + if (this.bRep != null) |
|---|
| 200 | + { |
|---|
| 201 | + o.transientrep = this.bRep.support; |
|---|
| 202 | + o.bRep.support = null; |
|---|
| 203 | + } |
|---|
| 204 | + |
|---|
| 205 | + // o.support = this.support; |
|---|
| 206 | + // o.fileparent = this.fileparent; |
|---|
| 207 | + // if (this.bRep != null) |
|---|
| 208 | + // o.bRep = this.bRep.support; |
|---|
| 209 | + |
|---|
| 210 | + this.bRep = null; |
|---|
| 211 | + // if (this.bRep != null) |
|---|
| 212 | + // this.bRep.support = null; |
|---|
| 213 | + // this.support = null; |
|---|
| 214 | + // this.fileparent = null; |
|---|
| 215 | + } |
|---|
| 216 | + |
|---|
| 217 | + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
|---|
| 218 | + { |
|---|
| 219 | + if (!hashtable.containsKey(GetUUID())) |
|---|
| 220 | + return; |
|---|
| 221 | + |
|---|
| 170 | 222 | Object3D o = hashtable.get(GetUUID()); |
|---|
| 171 | 223 | |
|---|
| 172 | | - assert(this.bRep == o.bRep); |
|---|
| 173 | | - if (this.bRep != null) |
|---|
| 174 | | - assert(this.bRep.support == o.transientrep); |
|---|
| 175 | | - |
|---|
| 176 | | - return; |
|---|
| 177 | | - } |
|---|
| 178 | | - |
|---|
| 179 | | - Object3D o = new Object3D(); |
|---|
| 180 | | - o.bRep = this.bRep; |
|---|
| 181 | | - if (this.bRep != null) |
|---|
| 182 | | - { |
|---|
| 183 | | - o.transientrep = this.bRep.support; |
|---|
| 184 | | - o.bRep.support = null; |
|---|
| 185 | | - } |
|---|
| 186 | | - |
|---|
| 187 | | -// o.support = this.support; |
|---|
| 188 | | -// o.fileparent = this.fileparent; |
|---|
| 189 | | -// if (this.bRep != null) |
|---|
| 190 | | -// o.bRep = this.bRep.support; |
|---|
| 191 | | - |
|---|
| 192 | | - hashtable.put(GetUUID(), o); |
|---|
| 193 | | - |
|---|
| 194 | | - this.bRep = null; |
|---|
| 195 | | -// if (this.bRep != null) |
|---|
| 196 | | -// this.bRep.support = null; |
|---|
| 197 | | -// this.support = null; |
|---|
| 198 | | -// this.fileparent = null; |
|---|
| 199 | | - |
|---|
| 200 | | - for (int i=0; i<Size(); i++) |
|---|
| 201 | | - { |
|---|
| 202 | | - get(i).ExtractBigData(hashtable); |
|---|
| 203 | | - } |
|---|
| 204 | | -} |
|---|
| 224 | + RestoreBigData(o); |
|---|
| 205 | 225 | |
|---|
| 206 | | -void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
|---|
| 207 | | -{ |
|---|
| 208 | | - if (!hashtable.containsKey(GetUUID())) |
|---|
| 209 | | - return; |
|---|
| 210 | | - |
|---|
| 211 | | - Object3D o = hashtable.get(GetUUID()); |
|---|
| 212 | | - |
|---|
| 213 | | - this.bRep = o.bRep; |
|---|
| 214 | | - if (this.bRep != null) |
|---|
| 215 | | - this.bRep.support = o.transientrep; |
|---|
| 216 | | -// this.support = o.support; |
|---|
| 217 | | -// this.fileparent = o.fileparent; |
|---|
| 218 | | - |
|---|
| 219 | | - hashtable.remove(GetUUID()); |
|---|
| 220 | | - |
|---|
| 221 | | - for (int i=0; i<Size(); i++) |
|---|
| 222 | | - { |
|---|
| 223 | | - get(i).RestoreBigData(hashtable); |
|---|
| 226 | + hashtable.remove(GetUUID()); |
|---|
| 227 | + |
|---|
| 228 | + for (int i=0; i<Size(); i++) |
|---|
| 229 | + { |
|---|
| 230 | + get(i).RestoreBigData(hashtable); |
|---|
| 231 | + } |
|---|
| 224 | 232 | } |
|---|
| 225 | | -} |
|---|
| 233 | + |
|---|
| 234 | + void RestoreBigData(Object3D o) |
|---|
| 235 | + { |
|---|
| 236 | + this.bRep = o.bRep; |
|---|
| 237 | + if (this.bRep != null) |
|---|
| 238 | + this.bRep.support = o.transientrep; |
|---|
| 239 | + // this.support = o.support; |
|---|
| 240 | + // this.fileparent = o.fileparent; |
|---|
| 241 | + } |
|---|
| 226 | 242 | |
|---|
| 227 | 243 | // MOCAP SUPPORT |
|---|
| 228 | 244 | double tx,ty,tz,rx,ry,rz; |
|---|
| .. | .. |
|---|
| 2693 | 2709 | //Touch(); |
|---|
| 2694 | 2710 | } |
|---|
| 2695 | 2711 | |
|---|
| 2712 | + void GenNormalsMeshS() |
|---|
| 2713 | + { |
|---|
| 2714 | + selection.GenNormalsMesh(); |
|---|
| 2715 | +// for (int i=0; i<selection.size(); i++) |
|---|
| 2716 | +// { |
|---|
| 2717 | +// Object3D selectee = (Object3D) selection.elementAt(i); |
|---|
| 2718 | +// selectee.GenNormals(crease); |
|---|
| 2719 | +// } |
|---|
| 2720 | + |
|---|
| 2721 | + //Touch(); |
|---|
| 2722 | + } |
|---|
| 2723 | + |
|---|
| 2696 | 2724 | void ClearColorsS() |
|---|
| 2697 | 2725 | { |
|---|
| 2698 | 2726 | selection.ClearColors(); |
|---|
| .. | .. |
|---|
| 2824 | 2852 | if (child == null) |
|---|
| 2825 | 2853 | continue; |
|---|
| 2826 | 2854 | child.GenNormals(crease); |
|---|
| 2855 | +// Children().release(i); |
|---|
| 2856 | + } |
|---|
| 2857 | + blockloop = false; |
|---|
| 2858 | + } |
|---|
| 2859 | + |
|---|
| 2860 | + void GenNormalsMesh() |
|---|
| 2861 | + { |
|---|
| 2862 | + if (blockloop) |
|---|
| 2863 | + return; |
|---|
| 2864 | + |
|---|
| 2865 | + blockloop = true; |
|---|
| 2866 | + GenNormalsMesh0(); |
|---|
| 2867 | + for (int i = 0; i < Children().Size(); i++) |
|---|
| 2868 | + { |
|---|
| 2869 | + Object3D child = (Object3D) Children().get(i); // reserve(i); |
|---|
| 2870 | + if (child == null) |
|---|
| 2871 | + continue; |
|---|
| 2872 | + child.GenNormalsMesh(); |
|---|
| 2827 | 2873 | // Children().release(i); |
|---|
| 2828 | 2874 | } |
|---|
| 2829 | 2875 | blockloop = false; |
|---|
| .. | .. |
|---|
| 2996 | 3042 | } |
|---|
| 2997 | 3043 | } |
|---|
| 2998 | 3044 | |
|---|
| 3045 | + void GenNormalsMesh0() |
|---|
| 3046 | + { |
|---|
| 3047 | + if (bRep != null) |
|---|
| 3048 | + { |
|---|
| 3049 | + bRep.GenerateNormalsMesh(); |
|---|
| 3050 | + Touch(); |
|---|
| 3051 | + } |
|---|
| 3052 | + } |
|---|
| 3053 | + |
|---|
| 2999 | 3054 | void GenNormalsMINE0() |
|---|
| 3000 | 3055 | { |
|---|
| 3001 | 3056 | if (bRep != null) |
|---|