We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello How to get separated curves like the original hair system? I try this but i always get one curve and the curves.Count()= 1
curves.Count()= 1
public static void UpdateExistingCurves(RhinoDoc doc, AlembicScene alembicScene, Layer parentLayer) { if (alembicScene == null) { RhinoApp.WriteLine("Error: AlembicScene is null"); return; } // First, collect all existing Alembic curve objects var existingCurves = new List<RhinoObject>(); foreach (var obj in doc.Objects) { if (obj.Attributes.GetUserString("AlembicCurveName") != null) { existingCurves.Add(obj); } } // Delete all existing curves before creating new ones foreach (var obj in existingCurves) { doc.Objects.Delete(obj, true); } try { var curveIdMap = new Dictionary<string, Guid>(); IEnumerable<Stride.Graphics.DataPointer> curves; IEnumerable<Stride.Graphics.DataPointer> indices; IEnumerable<Stride.Core.Mathematics.Matrix> transforms; alembicScene.GetCurves(out curves, out indices, out transforms); if (curves == null || !curves.Any()) { RhinoApp.WriteLine("No curve data found in current frame"); return; } var names = GetCurveNames(alembicScene); if (names == null || names.Count == 0) { RhinoApp.WriteLine("Error: No valid names found in Alembic scene"); return; } var transformsList = transforms?.ToList() ?? new List<Stride.Core.Mathematics.Matrix>(); for (int i = 0; i < curves.Count(); i++) { try { var curveName = names[i]; /*/ try { Stride.Graphics.DataPointer curve_; Stride.Graphics.DataPointer index_; Stride.Core.Mathematics.Matrix transform_; alembicScene.GetCurve(names[i], out curve_, out index_, out transform_); RhinoApp.WriteLine($"Curve:{curve_.Size}, Index{index_.Size}, Transform{transform_}"); } catch { } /*/ // Try to find existing curve or create a new one Guid previousId = curveIdMap.ContainsKey(curveName) ? curveIdMap[curveName] : default; var existingCurveObject = FindOrCreateCurveObject(doc, curveName, parentLayer, previousId); // Create new curve var nurbsCurve = CreateRhinoCurve( curves.ToList()[i], indices.ToList()[i], transforms.ToList()[i] ); if (existingCurveObject == null) { existingCurveObject = CreateNewCurve(doc, curveName, nurbsCurve.ToPolyline(), parentLayer); } else { // Ensure the curve is on the correct sublayer var sublayer = GetOrCreateSublayer(doc, parentLayer, curveName); existingCurveObject.Attributes.LayerIndex = sublayer.Index; // Update existing curve geometry UpdateCurveGeometry(doc, existingCurveObject, nurbsCurve.ToNurbsCurve()); } // Update the curve ID map if (existingCurveObject != null) { curveIdMap[curveName] = existingCurveObject.Id; } } catch (Exception ex) { RhinoApp.WriteLine($"Error processing curve {i}: {ex.Message}"); } } } catch (Exception ex) { RhinoApp.WriteLine($"Error updating curves: {ex.Message}"); if (ex.InnerException != null) { RhinoApp.WriteLine($"Inner exception: {ex.InnerException.Message}"); } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello
How to get separated curves like the original hair system?
I try this but i always get one curve and the
curves.Count()= 1
The text was updated successfully, but these errors were encountered: