aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/backup-delete/GLGeomObj.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-03-13 11:36:11 -0700
committerPushkar Joshi2012-03-13 11:36:11 -0700
commit6023f7c8258e660388ee33730601f1161f9299e9 (patch)
tree632484428b398f71b8481aa8e30180895ff2483c /js/helper-classes/backup-delete/GLGeomObj.js
parent76f2021618c0a6a99a1b855233e353e84ca99467 (diff)
parent4ad1650f629e7e345eade52ed6dadc233b27cc45 (diff)
downloadninja-6023f7c8258e660388ee33730601f1161f9299e9.tar.gz
Merge branch 'pentool' into brushtool
Diffstat (limited to 'js/helper-classes/backup-delete/GLGeomObj.js')
-rwxr-xr-xjs/helper-classes/backup-delete/GLGeomObj.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/js/helper-classes/backup-delete/GLGeomObj.js b/js/helper-classes/backup-delete/GLGeomObj.js
index 8946470d..54933590 100755
--- a/js/helper-classes/backup-delete/GLGeomObj.js
+++ b/js/helper-classes/backup-delete/GLGeomObj.js
@@ -158,6 +158,52 @@ function GLGeomObj()
158 return fillMaterial; 158 return fillMaterial;
159 } 159 }
160 160
161 this.exportMaterials = function()
162 {
163 var rtnStr = "";
164 if (this._materialArray && this._materialNodeArray)
165 {
166 var nMats = this._materialArray.length;
167 rtnStr += "nMaterials: " + nMats + "\n";
168 for (var i=0; i<nMats; i++)
169 {
170 var matNode = this._materialNodeArray[i];
171 rtnStr += "materialNodeName: " + matNode.name + "\n";
172
173 var material = this._materialArray[i];
174 rtnStr += material.export();
175 }
176 }
177 else
178 rtnStr += "nMaterials: 0\n" ;
179
180 return rtnStr;
181 }
182
183 this.importMaterials = function(importStr)
184 {
185 var nMaterials = Number( this.getPropertyFromString( "nMaterials: ", importStr ) );
186 for (var i=0; i<nMaterials; i++)
187 {
188 var mat;
189 var materialType = this.getPropertyFromString( "material: ", importStr );
190 switch (materialType)
191 {
192 case "flat": mat = new FlatMaterial(); break;
193
194 default:
195 console.log( "material type: " + materialType + " is not supported" );
196 break;
197 }
198
199 if (mat)
200 mat.import( importStr );
201
202 var endIndex = importStr.indexOf( "endMaterial\n" );
203 if (endIndex < 0) break;
204 importStr = importStr.substr( endIndex );
205 }
206 }
161 207
162 this.translate = function(v) 208 this.translate = function(v)
163 { 209 {