From 8d8fbc4447a675914aab458488da4f8e2cb0a85f Mon Sep 17 00:00:00 2001 From: kovacsv Date: Sun, 20 Jun 2021 20:07:11 +0200 Subject: [PATCH] Import user strings for meshes, and add a todo for the whole model. --- source/external/rhinoimporter.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/external/rhinoimporter.js b/source/external/rhinoimporter.js index c179a96..0fd5c56 100644 --- a/source/external/rhinoimporter.js +++ b/source/external/rhinoimporter.js @@ -75,6 +75,7 @@ OV.Importer3dm = class extends OV.ImporterBase ImportRhinoDocument (rhinoDoc) { this.InitRhinoInstances (rhinoDoc); + this.ImportRhinoUserStrings (rhinoDoc); this.ImportRhinoGeometry (rhinoDoc); } @@ -95,6 +96,11 @@ OV.Importer3dm = class extends OV.ImporterBase } } + ImportRhinoUserStrings (rhinoDoc) + { + // TODO: https://github.com/mcneel/rhino3dm/issues/303 + } + ImportRhinoGeometry (rhinoDoc) { let rhinoObjects = rhinoDoc.objects (); @@ -113,7 +119,7 @@ OV.Importer3dm = class extends OV.ImporterBase if (rhinoAttributes.isInstanceDefinitionObject && rhinoInstanceReferences.length === 0) { return; } - + let rhinoMesh = null; let deleteMesh = false; @@ -174,6 +180,12 @@ OV.Importer3dm = class extends OV.ImporterBase let mesh = new OV.Mesh (); mesh.SetName (rhinoAttributes.name); + let userStrings = rhinoAttributes.getUserStrings (); + for (let i = 0; i < userStrings.length; i++) { + let userString = userStrings[i]; + mesh.AddProperty (new OV.Property (OV.PropertyType.Text, userString[0], userString[1])); + } + let materialIndex = this.GetMaterialIndex (rhinoDoc, rhinoObject, rhinoInstanceReferences); let threeJson = rhinoMesh.toThreejsJSON (); let vertices = threeJson.data.attributes.position.array;