diff --git a/opennurbs_3dm_attributes.cpp b/opennurbs_3dm_attributes.cpp index 3892316c..2aa6ad7f 100644 --- a/opennurbs_3dm_attributes.cpp +++ b/opennurbs_3dm_attributes.cpp @@ -25,7 +25,7 @@ class ON_3dmObjectAttributesPrivate { public: - ON_3dmObjectAttributesPrivate(); + ON_3dmObjectAttributesPrivate(const ON_3dmObjectAttributes* attr); bool operator==(const ON_3dmObjectAttributesPrivate&) const; bool operator!=(const ON_3dmObjectAttributesPrivate&) const; @@ -47,7 +47,9 @@ public: ON_MeshModifiers m_mesh_modifiers; }; -ON_3dmObjectAttributesPrivate::ON_3dmObjectAttributesPrivate() +ON_3dmObjectAttributesPrivate::ON_3dmObjectAttributesPrivate(const ON_3dmObjectAttributes* attr) + : + m_decals(const_cast(attr)) { m_hatch_background_fill = ON_Color::UnsetColor; } @@ -95,8 +97,7 @@ bool ON_3dmObjectAttributesPrivate::operator!=(const ON_3dmObjectAttributesPriva return !ON_3dmObjectAttributesPrivate::operator==(other); } -static const ON_3dmObjectAttributesPrivate DefaultAttributesPrivate; - +static const ON_3dmObjectAttributesPrivate DefaultAttributesPrivate(nullptr); ON_OBJECT_IMPLEMENT( ON_3dmObjectAttributes, ON_Object, "A828C015-09F5-477c-8665-F0482F5D6996" ); @@ -147,7 +148,7 @@ void ON_3dmObjectAttributes::CopyHelper(const ON_3dmObjectAttributes& src) m_private = nullptr; if (src.m_private) { - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); *m_private = *src.m_private; } m_dmref = src.m_dmref; @@ -1302,6 +1303,10 @@ bool ON_3dmObjectAttributes::Internal_WriteV5( ON_BinaryArchive& file ) const rc = file.WriteBool(HatchBoundaryVisible()); if (!rc) break; } + + // Have the decal collection update the user data if anything has changed. + const unsigned int archive_3dm_version = file.Archive3dmVersion(); + m_private->m_decals.UpdateUserData(archive_3dm_version); } // 15 Jun 2022 S. Baer @@ -2208,7 +2213,7 @@ void ON_3dmObjectAttributes::SetClipParticipationSource(ON::ClipParticipationSou return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_clip_participation_source = source; } @@ -2225,7 +2230,7 @@ void ON_3dmObjectAttributes::SetClipParticipationForAll() void ON_3dmObjectAttributes::SetClipParticipationForNone() { if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_clipplane_list.Empty(); m_private->m_clipping_proof = true; } @@ -2235,7 +2240,7 @@ void ON_3dmObjectAttributes::SetClipParticipationList(const ON_UUID* clippingPla SetClipParticipationForAll(); if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_clipplane_list.Empty(); for (int i = 0; i < count; i++) m_private->m_clipplane_list.AddUuid(clippingPlaneIds[i], true); @@ -2278,7 +2283,7 @@ void ON_3dmObjectAttributes::SetSectionFillRule(ON::SectionFillRule rule) return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_section_fill_rule = rule; } @@ -2293,7 +2298,7 @@ void ON_3dmObjectAttributes::SetSectionHatchIndex(int index) return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_section_hatch_index = index; } @@ -2307,7 +2312,7 @@ void ON_3dmObjectAttributes::SetSectionHatchScale(double scale) return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_section_hatch_scale = scale; } @@ -2321,7 +2326,7 @@ void ON_3dmObjectAttributes::SetSectionHatchRotation(double rotation) return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_section_hatch_rotation = rotation; } @@ -2335,7 +2340,7 @@ void ON_3dmObjectAttributes::SetSectionAttributesSource(ON::SectionAttributesSou return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_section_attributes_source = source; } @@ -2352,7 +2357,7 @@ void ON_3dmObjectAttributes::SetLinetypeScale(double scale) return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_linetype_scale = scale; } @@ -2369,7 +2374,7 @@ void ON_3dmObjectAttributes::SetHatchBackgrounFillColor(const ON_Color& color) return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_hatch_background_fill = c; } bool ON_3dmObjectAttributes::HatchBoundaryVisible() const @@ -2382,29 +2387,16 @@ void ON_3dmObjectAttributes::SetHatchBoundaryVisible(bool on) return; if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate(); + m_private = new ON_3dmObjectAttributesPrivate(this); m_private->m_hatch_boundary_visible = on; } + + //https://mcneel.myjetbrains.com/youtrack/issue/RH-20531 -ON_Plane ON_3dmObjectAttributes::ObjectFrame(const ON_COMPONENT_INDEX&, bool bRaw) const +ON_Plane ON_3dmObjectAttributes::ObjectFrame(const ON_COMPONENT_INDEX& ci) const { - if (!m_object_frame.IsValid()) - { - return ON_Plane::UnsetPlane; - } - - if (bRaw) - { - return m_object_frame; - } - - ON_Plane plane = m_object_frame; - plane.xaxis.Unitize(); - plane.zaxis.Unitize(); - plane.yaxis.Unitize(); - - return plane; + return m_object_frame; } //https://mcneel.myjetbrains.com/youtrack/issue/RH-20531 @@ -2419,41 +2411,48 @@ void ON_3dmObjectAttributes::SetObjectFrame(const ON_COMPONENT_INDEX& ci, const m_object_frame = plane; } -ON_Decal* ON_3dmObjectAttributes::AddDecal(void) -{ - if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate; - - return m_private->m_decals.AddDecal(); -} - ON_MeshModifiers& ON_3dmObjectAttributes::MeshModifiers(void) const { if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate; + m_private = new ON_3dmObjectAttributesPrivate(this); return m_private->m_mesh_modifiers; } -void ON_3dmObjectAttributes::Internal_PopulateDecals(const ON_XMLRootNode& node) const -{ - if (!ON_DecalCollection::NodeContainsDecals(node)) - return; - - if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate; - - m_private->m_decals.Populate(node); -} - const ON_SimpleArray& ON_3dmObjectAttributes::GetDecalArray(void) const { if (nullptr == m_private) - m_private = new ON_3dmObjectAttributesPrivate; + m_private = new ON_3dmObjectAttributesPrivate(this); return m_private->m_decals.GetDecalArray(); } +ON_Decal* ON_3dmObjectAttributes::AddDecal(void) +{ + if (nullptr == m_private) + m_private = new ON_3dmObjectAttributesPrivate(this); + + return m_private->m_decals.AddDecal(); +} + +bool ON_3dmObjectAttributes::DeleteDecal(ON_Decal& decal) +{ + if (nullptr == m_private) + m_private = new ON_3dmObjectAttributesPrivate(this); + + return m_private->m_decals.DeleteDecal(decal); +} + +void ON_3dmObjectAttributes::DeleteAllDecals(void) +{ + //if (nullptr == m_private) + // m_private = new ON_3dmObjectAttributesPrivate(this); + + // Delete all the user data? [JOHN-DECAL-FIX] + // TODO: +// return m_private->m_decals.DeleteAllDecals(); +} + // {1403A7E4-E7AD-4a01-A2AA-41DAE6BE7ECB} const ON_UUID ON_DisplayMaterialRef::m_invisible_in_detail_id = { 0x1403a7e4, 0xe7ad, 0x4a01, { 0xa2, 0xaa, 0x41, 0xda, 0xe6, 0xbe, 0x7e, 0xcb } }; diff --git a/opennurbs_3dm_attributes.h b/opennurbs_3dm_attributes.h index f84941dc..db437418 100644 --- a/opennurbs_3dm_attributes.h +++ b/opennurbs_3dm_attributes.h @@ -434,7 +434,7 @@ public: void SetHatchBoundaryVisible(bool on); #pragma endregion - ON_Plane ObjectFrame(const ON_COMPONENT_INDEX& ci, bool bRaw = false) const; + ON_Plane ObjectFrame(const ON_COMPONENT_INDEX& ci) const; void SetObjectFrame(const ON_COMPONENT_INDEX& ci, const ON_Xform& wcs_to_ocs); void SetObjectFrame(const ON_COMPONENT_INDEX& ci, const ON_Plane& plane); @@ -517,15 +517,29 @@ public: /* Description: Get an array of decals that are stored on this attributes object. + Do not store or delete pointers from the array. */ const ON_SimpleArray& GetDecalArray(void) const; /* Description: - Add a new decal to this attributes object. + Add a new decal to this attributes object. The returned pointer points to an object + that is owned by the attributes. Do not store or delete it. */ ON_Decal* AddDecal(void); + /* + Description: + Delete a decal from this attributes object. Returns true if successful, else false. + */ + bool DeleteDecal(ON_Decal& decal); + + /* + Description: + Delete all decals from this attributes object. + */ + void DeleteAllDecals(void); + // Mesh Modifiers. /* @@ -659,9 +673,6 @@ public: private: bool Internal_WriteV5( ON_BinaryArchive& archive ) const; bool Internal_ReadV5( ON_BinaryArchive& archive ); - -public: - void Internal_PopulateDecals(const ON_XMLRootNode&) const; }; #endif diff --git a/opennurbs_3dm_properties.cpp b/opennurbs_3dm_properties.cpp index dd8edba2..5d13d1d6 100644 --- a/opennurbs_3dm_properties.cpp +++ b/opennurbs_3dm_properties.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_3dm_settings.cpp b/opennurbs_3dm_settings.cpp index 4947f2d9..4d067ad0 100644 --- a/opennurbs_3dm_settings.cpp +++ b/opennurbs_3dm_settings.cpp @@ -12,6 +12,7 @@ //////////////////////////////////////////////////////////////// #include "opennurbs.h" +#include "opennurbs_internal_defines.h" #if !defined(ON_COMPILING_OPENNURBS) // This check is included in all opennurbs source .c and .cpp files to insure @@ -820,8 +821,247 @@ unsigned int ON_3dmUnitsAndTolerances::SetInvalidTolerancesToDefaultValues() // ON_3dmRenderSettings // +// This is inside the 'current content' section. +#define ON_RENDER_BACKGROUND_ENVIRONMENT L"environment" + +// These are inside the 'rendering' section. +#define ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT_ON L"custom-env-for-refl-and-refr-on" +#define ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT L"custom-env-for-refl-and-refr" + +// These are inside the 'sun' section. +#define ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT_ON L"skylight-custom-environment-on" +#define ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT L"skylight-custom-environment" + +static const wchar_t* XMLPathBack360(void) // Not used for 'override'. +{ + return ON_RDK_DOCUMENT ON_RDK_SLASH ON_RDK_CURRENT_CONTENT; +} + +static const wchar_t* XMLPathReflRefr(void) +{ + return ON_RDK_DOCUMENT ON_RDK_SLASH ON_RDK_SETTINGS ON_RDK_SLASH ON_RDK_RENDERING; +} + +static const wchar_t* XMLPathSkylight(void) +{ + return ON_RDK_DOCUMENT ON_RDK_SLASH ON_RDK_SETTINGS ON_RDK_SLASH ON_RDK_SUN; +} + +ON_EnvironmentsPrivate::ON_EnvironmentsPrivate(const ON_EnvironmentsPrivate& ei) +{ + operator = (ei); +} + +ON_EnvironmentsPrivate& ON_EnvironmentsPrivate::operator = (const ON_EnvironmentsPrivate& ep) +{ + if (this != &ep) + { + SetBackgroundRenderEnvironment (ep.BackgroundRenderEnvironment()); + SetSkylightingRenderEnvironmentOverride(ep.SkylightingRenderEnvironmentOverride()); + SetSkylightingRenderEnvironment (ep.SkylightingRenderEnvironment()); + SetReflectionRenderEnvironmentOverride (ep.ReflectionRenderEnvironmentOverride()); + SetReflectionRenderEnvironment (ep.ReflectionRenderEnvironment()); + } + + return *this; +} + +bool ON_EnvironmentsPrivate::operator == (const ON_EnvironmentsPrivate& ep) +{ + if (BackgroundRenderEnvironment() != ep.BackgroundRenderEnvironment()) return false; + if (SkylightingRenderEnvironmentOverride() != ep.SkylightingRenderEnvironmentOverride()) return false; + if (SkylightingRenderEnvironment() != ep.SkylightingRenderEnvironment()) return false; + if (ReflectionRenderEnvironmentOverride() != ep.ReflectionRenderEnvironmentOverride()) return false; + if (ReflectionRenderEnvironment() != ep.ReflectionRenderEnvironment()) return false; + + return true; +} + +ON_UUID ON_EnvironmentsPrivate::BackgroundRenderEnvironment(void) const +{ + const wchar_t* s = ON_RENDER_BACKGROUND_ENVIRONMENT; + return GetParameter_NoType(XMLPathBack360(), s, L"uuid", ON_nil_uuid).AsUuid(); +} + +void ON_EnvironmentsPrivate::SetBackgroundRenderEnvironment(const ON_UUID& id) +{ + const wchar_t* s = ON_RENDER_BACKGROUND_ENVIRONMENT; + SetParameter_NoType(XMLPathBack360(), s, id); +} + +bool ON_EnvironmentsPrivate::SkylightingRenderEnvironmentOverride(void) const +{ + const wchar_t* s = ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT_ON; + return GetParameter(XMLPathSkylight(), s, false); +} + +void ON_EnvironmentsPrivate::SetSkylightingRenderEnvironmentOverride(bool on) +{ + const wchar_t* s = ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT_ON; + SetParameter(XMLPathSkylight(), s, on); +} + +ON_UUID ON_EnvironmentsPrivate::SkylightingRenderEnvironment(void) const +{ + const wchar_t* s = ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT; + return GetParameter_NoType(XMLPathSkylight(), s, L"uuid", ON_nil_uuid).AsUuid(); +} + +void ON_EnvironmentsPrivate::SetSkylightingRenderEnvironment(const ON_UUID& id) +{ + const wchar_t* s = ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT; + SetParameter_NoType(XMLPathSkylight(), s, id); +} + +bool ON_EnvironmentsPrivate::ReflectionRenderEnvironmentOverride(void) const +{ + const wchar_t* s = ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT_ON; + return GetParameter(XMLPathReflRefr(), s, false); +} + +void ON_EnvironmentsPrivate::SetReflectionRenderEnvironmentOverride(bool on) +{ + const wchar_t* s = ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT_ON; + SetParameter(XMLPathReflRefr(), s, on); +} + +ON_UUID ON_EnvironmentsPrivate::ReflectionRenderEnvironment(void) const +{ + const wchar_t* s = ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT; + return GetParameter_NoType(XMLPathReflRefr(), s, L"uuid", ON_nil_uuid).AsUuid(); +} + +void ON_EnvironmentsPrivate::SetReflectionRenderEnvironment(const ON_UUID& id) +{ + const wchar_t* s = ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT; + SetParameter_NoType(XMLPathReflRefr(), s, id); +} + ON_OBJECT_IMPLEMENT(ON_3dmRenderSettings, ON_Object, "58A5953A-57C5-4FD3-84F5-7D4240478D15"); +ON_3dmRenderSettingsPrivate::ON_3dmRenderSettingsPrivate() + : + _dithering (_rdk_document_data), + _ground_plane (_rdk_document_data), + _linear_workflow(_rdk_document_data), + _render_channels(_rdk_document_data), + _safe_frame (_rdk_document_data), + _skylight (_rdk_document_data), + _sun (_rdk_document_data), + _environments (_rdk_document_data) +{ +} + +const ON_3dmRenderSettingsPrivate& ON_3dmRenderSettingsPrivate::operator = (const ON_3dmRenderSettingsPrivate& p) +{ + if (this != &p) + { + // Copy the XML. + _rdk_document_data = p._rdk_document_data; + + // Check that all of the document objects now have matching properties. + ON_ASSERT(_dithering == p._dithering); + ON_ASSERT(_ground_plane == p._ground_plane); + ON_ASSERT(_linear_workflow == p._linear_workflow); + ON_ASSERT(_render_channels == p._render_channels); + ON_ASSERT(_safe_frame == p._safe_frame); + ON_ASSERT(_skylight == p._skylight); + ON_ASSERT(_sun == p._sun); + ON_ASSERT(_environments == p._environments); + } + + return *this; +} + +ON_3dmRenderSettings::~ON_3dmRenderSettings() +{ + if (nullptr != m_private) + { + delete m_private; + m_private = nullptr; + } +} + +ON_3dmRenderSettings::ON_3dmRenderSettings(const ON_3dmRenderSettings& rs) +{ + operator = (rs); +} + +ON_3dmRenderSettings& ON_3dmRenderSettings::operator = (const ON_3dmRenderSettings& rs) +{ + if (this != &rs) + { + ON_Object::operator = (rs); + + if (nullptr != rs.m_private) + { + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + *m_private = *rs.m_private; + } + else + { + if (nullptr != m_private) + { + delete m_private; + m_private = nullptr; + } + } + + m_ambient_light = rs.m_ambient_light; + m_antialias_style = rs.m_antialias_style; + m_background_bitmap_filename = rs.m_background_bitmap_filename; + m_background_bottom_color = rs.m_background_bottom_color; + m_background_color = rs.m_background_color; + m_background_style = rs.m_background_style; + m_bCustomImageSize = rs.m_bCustomImageSize; + m_bDepthCue = rs.m_bDepthCue; + m_bFlatShade = rs.m_bFlatShade; + m_bForceViewportAspectRatio = rs.m_bForceViewportAspectRatio; + m_bRenderAnnotation = rs.m_bRenderAnnotation; + m_bRenderBackfaces = rs.m_bRenderBackfaces; + m_bRenderCurves = rs.m_bRenderCurves; + m_bRenderIsoparams = rs.m_bRenderIsoparams; + m_bRenderMeshEdges = rs.m_bRenderMeshEdges; + m_bRenderPoints = rs.m_bRenderPoints; + m_bScaleBackgroundToFit = rs.m_bScaleBackgroundToFit; + m_bTransparentBackground = rs.m_bTransparentBackground; + m_bUseHiddenLights = rs.m_bUseHiddenLights; + m_bUsesAmbientAttr = rs.m_bUsesAmbientAttr; + m_bUsesAnnotationAttr = rs.m_bUsesAnnotationAttr; + m_bUsesBackfaceAttr = rs.m_bUsesBackfaceAttr; + m_bUsesBackgroundAttr = rs.m_bUsesBackgroundAttr; + m_bUsesCurvesAttr = rs.m_bUsesCurvesAttr; + m_bUsesHiddenLightsAttr = rs.m_bUsesHiddenLightsAttr; + m_bUsesIsoparmsAttr = rs.m_bUsesIsoparmsAttr; + m_bUsesMeshEdgesAttr = rs.m_bUsesMeshEdgesAttr; + m_bUsesPointsAttr = rs.m_bUsesPointsAttr; + m_embedded_image_file_id = rs.m_embedded_image_file_id; + m_image_dpi = rs.m_image_dpi; + m_image_height = rs.m_image_height; + m_image_us = rs.m_image_us; + m_image_width = rs.m_image_width; + m_named_view = rs.m_named_view; + m_rendering_source = rs.m_rendering_source; + m_reserved1 = rs.m_reserved1; + m_reserved3 = rs.m_reserved3; + m_reserved4 = rs.m_reserved4; + m_reserved5 = rs.m_reserved5; + m_reserved6 = rs.m_reserved6; + m_reserved7 = rs.m_reserved7; + m_reserved8 = rs.m_reserved8; + m_shadowmap_height = rs.m_shadowmap_height; + m_shadowmap_offset = rs.m_shadowmap_offset; + m_shadowmap_style = rs.m_shadowmap_style; + m_shadowmap_width = rs.m_shadowmap_width; + m_snapshot = rs.m_snapshot; + m_specific_viewport = rs.m_specific_viewport; + } + + return *this; +} + void ON_3dmRenderSettings::Dump( ON_TextLog& text_log ) const { text_log.Print("m_bCustomImageSize = %s\n",m_bCustomImageSize?"true":"false"); @@ -1215,7 +1455,6 @@ void ON_3dmRenderSettings::SetSpecificViewport(const ON_wString& s) m_specific_viewport = s; } - ON_wString ON_3dmRenderSettings::NamedView(void) const { return m_named_view; @@ -1226,7 +1465,6 @@ void ON_3dmRenderSettings::SetNamedView(const ON_wString& s) m_named_view = s; } - ON_wString ON_3dmRenderSettings::Snapshot(void) const { return m_snapshot; @@ -1249,12 +1487,167 @@ void ON_3dmRenderSettings::SetScaleBackgroundToFit( bool bScaleBackgroundToFit ) m_bScaleBackgroundToFit = bScaleBackgroundToFit?true:false; } +ON_SafeFrame& ON_3dmRenderSettings::SafeFrame(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_safe_frame; +} + +ON_GroundPlane& ON_3dmRenderSettings::GroundPlane(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_ground_plane; +} + +ON_LinearWorkflow& ON_3dmRenderSettings::LinearWorkflow(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_linear_workflow; +} + +ON_Skylight& ON_3dmRenderSettings::Skylight(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_skylight; +} + +ON_Sun& ON_3dmRenderSettings::Sun(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_sun; +} + +ON_Dithering& ON_3dmRenderSettings::Dithering(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_dithering; +} + +ON_RenderChannels& ON_3dmRenderSettings::RenderChannels(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_render_channels; +} + +ON_XMLNode& ON_3dmRenderSettings::RdkDocNode(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + if (m_private->_rdk_document_data.FirstChild() == nullptr) + { + // 16th November 2022 John Croudy, https://mcneel.myjetbrains.com/youtrack/issue/RH-71396 + // The RDK document data is completely empty. This used to be filled by the RDK itself using + // the CRhRdkPropertyServer class. This worked until someone inside Rhino decided to copy a + // completely default ON_3dmRenderSettings over this one, whereupon the RDK document data got + // deleted instead of simply reverting to defaults. This code is here to fix that. The core + // property server code has been moved to ON_RdkDocumentDefaults. + ON_RdkDocumentDefaults dd(ON::VersionMajor(), ON_RdkDocumentDefaults::ValueSets::All); + dd.CopyDefaultsTo(m_private->_rdk_document_data); + } + + return m_private->_rdk_document_data; +} + +ON_UUID ON_3dmRenderSettings::BackgroundRenderEnvironment(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_environments.BackgroundRenderEnvironment(); +} + +void ON_3dmRenderSettings::SetBackgroundRenderEnvironment(const ON_UUID& id) +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + m_private->_environments.SetBackgroundRenderEnvironment(id); +} + +bool ON_3dmRenderSettings::SkylightingRenderEnvironmentOverride(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_environments.SkylightingRenderEnvironmentOverride(); +} + +void ON_3dmRenderSettings::SetSkylightingRenderEnvironmentOverride(bool on) +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + m_private->_environments.SetSkylightingRenderEnvironmentOverride(on); +} + +ON_UUID ON_3dmRenderSettings::SkylightingRenderEnvironment(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_environments.SkylightingRenderEnvironment(); +} + +void ON_3dmRenderSettings::SetSkylightingRenderEnvironment(const ON_UUID& id) +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + m_private->_environments.SetSkylightingRenderEnvironment(id); +} + +bool ON_3dmRenderSettings::ReflectionRenderEnvironmentOverride(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_environments.ReflectionRenderEnvironmentOverride(); +} + +void ON_3dmRenderSettings::SetReflectionRenderEnvironmentOverride(bool on) +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + m_private->_environments.SetReflectionRenderEnvironmentOverride(on); +} + +ON_UUID ON_3dmRenderSettings::ReflectionRenderEnvironment(void) const +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + return m_private->_environments.ReflectionRenderEnvironment(); +} + +void ON_3dmRenderSettings::SetReflectionRenderEnvironment(const ON_UUID& id) +{ + if (nullptr == m_private) + m_private = new ON_3dmRenderSettingsPrivate; + + m_private->_environments.SetReflectionRenderEnvironment(id); +} + ////////////////////////////////////////////////////////////////////////////////////////// // // ON_3dmAnnotationSettings // - void ON_3dmAnnotationSettings::Dump( ON_TextLog& text_log ) const { // TODO @@ -1369,8 +1762,8 @@ bool ON_3dmAnnotationSettings::Read( ON_BinaryArchive& file ) if (bV6orLater) { // files that do not contain m_bEnableAnnotationScaling, - // set m_bEnableAnnotationScaling = false so the display - // image does not change. + // set m_bEnableAnnotationScaling = false so the display + // image does not change. m_b_V5_EnableAnnotationScaling = 1; // files that do not contain m_bEnableModelSpaceAnnotationScaling, diff --git a/opennurbs_3dm_settings.h b/opennurbs_3dm_settings.h index e27e8984..e6a7a9f8 100644 --- a/opennurbs_3dm_settings.h +++ b/opennurbs_3dm_settings.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_3DM_SETTINGS_INC_) #define OPENNURBS_3DM_SETTINGS_INC_ @@ -742,9 +739,10 @@ class ON_CLASS ON_3dmRenderSettings : public ON_Object public: ON_3dmRenderSettings() = default; - ~ON_3dmRenderSettings() = default; - ON_3dmRenderSettings(const ON_3dmRenderSettings&) = default; - ON_3dmRenderSettings& operator=(const ON_3dmRenderSettings&) = default; + virtual ~ON_3dmRenderSettings(); + + ON_3dmRenderSettings(const ON_3dmRenderSettings&); + ON_3dmRenderSettings& operator=(const ON_3dmRenderSettings&); static const ON_3dmRenderSettings Default; @@ -790,6 +788,44 @@ public: bool ScaleBackgroundToFit() const; void SetScaleBackgroundToFit( bool bScaleBackgroundToFit ); +public: + // Access to Dithering information. + class ON_Dithering& Dithering(void) const; + + // Access to Ground Plane information. + class ON_GroundPlane& GroundPlane(void) const; + + // Access to Linear Workflow information. + class ON_LinearWorkflow& LinearWorkflow(void) const; + + // Access to Render Channels information. + class ON_RenderChannels& RenderChannels(void) const; + + // Access to Safe Frame information. + class ON_SafeFrame& SafeFrame(void) const; + + // Access to Skylight information. + class ON_Skylight& Skylight(void) const; + + // Access to Sun information. + class ON_Sun& Sun(void) const; + + // Access to background rendering environment information. + ON_UUID BackgroundRenderEnvironment(void) const; + void SetBackgroundRenderEnvironment(const ON_UUID& id); + + // Access to skylighting rendering environment information. + bool SkylightingRenderEnvironmentOverride(void) const; + void SetSkylightingRenderEnvironmentOverride(bool on); + ON_UUID SkylightingRenderEnvironment(void) const; + void SetSkylightingRenderEnvironment(const ON_UUID& id); + + // Access to reflection / refraction rendering environment information. + bool ReflectionRenderEnvironmentOverride(void) const; + void SetReflectionRenderEnvironmentOverride(bool on); + ON_UUID ReflectionRenderEnvironment(void) const; + void SetReflectionRenderEnvironment(const ON_UUID& id); + private: unsigned short m_reserved1 = 0; @@ -801,8 +837,9 @@ public: // then the image height should be calculated by multiplying the m_image_width // by the viewport aspect ratio. Note that this might be affected by m_rendering_source // In this case, m_image_height should not be used. - // + // bool m_bForceViewportAspectRatio = false; + ////////////////////////////////////////////////////////////// // // Custom image size: @@ -810,15 +847,15 @@ public: // is m_image_width X m_image_height pixels. // If m_bCustomImageSize is false, then the image pixel size // is the size of the viewport being rendered. - // + // bool m_bCustomImageSize = false; - int m_image_width = 800; // image width in pixels + int m_image_width = 800; // image width in pixels int m_image_height = 600; // image height in pixels private: unsigned int m_reserved3 = 0; -public: +public: //////// // Number of dots/inch (dots=pixels) to use when printing and // saving bitmaps. The default is 72.0 dots/inch. @@ -830,7 +867,7 @@ public: ON::LengthUnitSystem m_image_us = ON::LengthUnitSystem::Inches; ON_Color m_ambient_light = ON_Color::Black; - + int m_background_style = 0; // 0 = solid color, 1 = "wallpaper" image, 2 = Gradient, 3 = Environment // m_background_color was changed from ON_Color::Gray160 to ON_Color::White for "white studio" look. @@ -838,7 +875,6 @@ public: ON_Color m_background_color = ON_Color::White; ON_Color m_background_bottom_color = ON_Color::Gray160; - ON_wString m_background_bitmap_filename; // If m_background_bitmap_filename is not empty, the file cannot be found, // and m_embedded_file_id identifes an embedded image file in the model, @@ -861,40 +897,43 @@ public: private: unsigned char m_reserved4 = 0; - unsigned int m_reserved5 = 0; + unsigned int m_reserved5 = 0; public: int m_antialias_style = 1; // 0 = none, 1 = normal, 2 = medium, 3 = best - int m_shadowmap_style = 1; // 0 = none, 1 = normal, 2 = best + int m_shadowmap_style = 1; // 0 = none, 1 = normal, 2 = best int m_shadowmap_width= 1000; int m_shadowmap_height = 1000; double m_shadowmap_offset = 0.75; - - + // Flags that are used to determine which render settings a render // plugin uses, and which ones the display pipeline should use. // Note: Render plugins set these, and they don't need to persist // in the document...Also, when set, they turn OFF their // corresponding setting in the Display Attributes Manager's // UI pages for "Rendered" mode. - bool m_bUsesAmbientAttr = true; - bool m_bUsesBackgroundAttr = true; - bool m_bUsesBackfaceAttr = false; - bool m_bUsesPointsAttr = false; - bool m_bUsesCurvesAttr = true; - bool m_bUsesIsoparmsAttr = true; - bool m_bUsesMeshEdgesAttr = false; - bool m_bUsesAnnotationAttr = true; - bool m_bUsesHiddenLightsAttr = true; + bool m_bUsesAmbientAttr = true; + bool m_bUsesBackgroundAttr = true; + bool m_bUsesBackfaceAttr = false; + bool m_bUsesPointsAttr = false; + bool m_bUsesCurvesAttr = true; + bool m_bUsesIsoparmsAttr = true; + bool m_bUsesMeshEdgesAttr = false; + bool m_bUsesAnnotationAttr = true; + bool m_bUsesHiddenLightsAttr = true; private: - unsigned char m_reserved6 = 0; + unsigned char m_reserved6 = 0; unsigned short m_reserved7 = 0; unsigned short m_reserved8 = 0; +public: // For internal use only. + ON_XMLNode& RdkDocNode(void) const; + private: - ON__INT_PTR m_reserved9 = 0; + friend class ON_3dmRenderSettingsPrivate; + mutable class ON_3dmRenderSettingsPrivate* m_private = nullptr; }; diff --git a/opennurbs_annotationbase.cpp b/opennurbs_annotationbase.cpp index 8706d168..523a4d64 100644 --- a/opennurbs_annotationbase.cpp +++ b/opennurbs_annotationbase.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_annotationbase.h b/opennurbs_annotationbase.h index 8fe1876e..ddc94bbb 100644 --- a/opennurbs_annotationbase.h +++ b/opennurbs_annotationbase.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_ANNOTATIONBASE_INC_) #define OPENNURBS_ANNOTATIONBASE_INC_ diff --git a/opennurbs_apple_nsfont.cpp b/opennurbs_apple_nsfont.cpp index 6884c100..dbaa5f09 100644 --- a/opennurbs_apple_nsfont.cpp +++ b/opennurbs_apple_nsfont.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2018 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_apple_nsfont.h b/opennurbs_apple_nsfont.h index 7318c80d..270f4783 100644 --- a/opennurbs_apple_nsfont.h +++ b/opennurbs_apple_nsfont.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2018 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_APPLE_NSFONT_INC_) #define OPENNURBS_APPLE_NSFONT_INC_ diff --git a/opennurbs_arc.cpp b/opennurbs_arc.cpp index ba4401cc..c3c57714 100644 --- a/opennurbs_arc.cpp +++ b/opennurbs_arc.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_arc.h b/opennurbs_arc.h index 7f2eafea..d94e6af7 100644 --- a/opennurbs_arc.h +++ b/opennurbs_arc.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_ARC_INC_) #define ON_ARC_INC_ diff --git a/opennurbs_arccurve.cpp b/opennurbs_arccurve.cpp index 7d8d1443..ce10663d 100644 --- a/opennurbs_arccurve.cpp +++ b/opennurbs_arccurve.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_arccurve.h b/opennurbs_arccurve.h index 03ea2804..fd3383aa 100644 --- a/opennurbs_arccurve.h +++ b/opennurbs_arccurve.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_GEOMETRY_CURVE_ARC_INC_) #define ON_GEOMETRY_CURVE_ARC_INC_ diff --git a/opennurbs_archivable_dictionary.cpp b/opennurbs_archivable_dictionary.cpp index 567f02a2..4b481d63 100644 --- a/opennurbs_archivable_dictionary.cpp +++ b/opennurbs_archivable_dictionary.cpp @@ -1268,6 +1268,27 @@ public: bool ReadDictionaryEntry(ON_BinaryArchive& binary_archive) { return m_value.Read(binary_archive); } }; +bool ON_ArchivableDictionary::TrySetMeshParameters(const wchar_t* key, const ON_MeshParameters& value) +{ + return m_private->TrySetValue(key, value); +} + +bool ON_ArchivableDictionary::TryGetMeshParameters(const wchar_t* key, ON_MeshParameters& value) const +{ + return m_private->TryGetValue(key, value); +} + +void ON_ArchivableDictionary::SetMeshParameters(const wchar_t* key, const ON_MeshParameters& value) +{ + m_private->SetValue(key, value); +} + +ON_MeshParameters ON_ArchivableDictionary::GetMeshParameters(const wchar_t* key) const +{ + return m_private->GetValue(key); +} + + //////////////////////////////////////////////////////////////////////////////// template <> class Entry : public DictionaryEntryT { diff --git a/opennurbs_archivable_dictionary.h b/opennurbs_archivable_dictionary.h index 9c4185e7..937b80c5 100644 --- a/opennurbs_archivable_dictionary.h +++ b/opennurbs_archivable_dictionary.h @@ -145,6 +145,16 @@ public: ON_ClassArray GetStringArray(const wchar_t* key) const; #pragma endregion + +#pragma region Getters-Setters Geometry + + bool TrySetMeshParameters(const wchar_t* key, const ON_MeshParameters& value); + bool TryGetMeshParameters(const wchar_t* key, ON_MeshParameters& value) const; + void SetMeshParameters(const wchar_t* key, const ON_MeshParameters& value); + ON_MeshParameters GetMeshParameters(const wchar_t* key) const; + +#pragma endregion + private: class ON_ArchivableDictionaryPrivate* m_private = nullptr; ON__UINT_PTR m_reserved = 0; diff --git a/opennurbs_archive.cpp b/opennurbs_archive.cpp index dbee7dae..a1b5c746 100644 --- a/opennurbs_archive.cpp +++ b/opennurbs_archive.cpp @@ -1,5 +1,3 @@ -/* $NoKeywords: $ */ -/* // // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -8570,10 +8567,12 @@ bool ON_BinaryArchive::Write3dmSettings( m_V3_plugin_id_list.Append( ON_opennurbs4_id ); m_V3_plugin_id_list.Append( ON_opennurbs5_id ); m_V3_plugin_id_list.Append( ON_opennurbs6_id ); + m_V3_plugin_id_list.Append( ON_opennurbs7_id ); m_V3_plugin_id_list.Append( ON_rhino3_id ); m_V3_plugin_id_list.Append( ON_rhino4_id ); m_V3_plugin_id_list.Append( ON_rhino5_id ); m_V3_plugin_id_list.Append( ON_rhino6_id ); + m_V3_plugin_id_list.Append( ON_rhino7_id ); m_V3_plugin_id_list.QuickSort( ON_UuidCompare ); } @@ -16815,6 +16814,13 @@ ON_BinaryArchive::SetArchive3dmVersion(int v) return rc; } +bool +ON_BinaryArchive::SetOpenNURBS3dmVersion(unsigned int v) +{ + m_3dm_opennurbs_version = v; + return true; +} + void ON_BinaryFile::EnableMemoryBuffer( int buffer_capacity diff --git a/opennurbs_archive.h b/opennurbs_archive.h index fd9adc1d..a2c82ddd 100644 --- a/opennurbs_archive.h +++ b/opennurbs_archive.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_ARCHIVE_INC_) #define ON_ARCHIVE_INC_ @@ -4434,6 +4432,7 @@ public: ); bool SetArchive3dmVersion(int); + bool SetOpenNURBS3dmVersion(unsigned int v); /* Description: diff --git a/opennurbs_archive_manifest.cpp b/opennurbs_archive_manifest.cpp index 96fbcec4..a952efa1 100644 --- a/opennurbs_archive_manifest.cpp +++ b/opennurbs_archive_manifest.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_array.cpp b/opennurbs_array.cpp index 1aeb3c01..3db457f3 100644 --- a/opennurbs_array.cpp +++ b/opennurbs_array.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2021 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_array.h b/opennurbs_array.h index 344aad48..a57b8e46 100644 --- a/opennurbs_array.h +++ b/opennurbs_array.h @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2021 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -152,6 +152,12 @@ public: // Decrements count by removed items. Does // not change capacity + void RemoveIf(bool predicate(const T& key)); + // Removes elements for which predicate + // returns true. Decrements count + // by removed items. + // Does not change capacity + void Empty(); // Sets count to 0, leaves capacity untouched. void Reverse(); // reverse order diff --git a/opennurbs_array_defs.h b/opennurbs_array_defs.h index aae04f00..06cd0c4e 100644 --- a/opennurbs_array_defs.h +++ b/opennurbs_array_defs.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_ARRAY_DEFS_INC_) #define ON_ARRAY_DEFS_INC_ @@ -625,6 +622,18 @@ void ON_SimpleArray::RemoveValue(const T& key) m_count = t; } +template +void ON_SimpleArray::RemoveIf(bool predicate(const T& key)) +{ + int t = 0; + for (int i = 0; i < m_count; i++) + { + if (!predicate(*(m_a + i))) + *(m_a + t++) = *(m_a + i); + } + m_count = t; +} + template void ON_SimpleArray::Empty() { diff --git a/opennurbs_base32.cpp b/opennurbs_base32.cpp index e9f624d6..c185114a 100644 --- a/opennurbs_base32.cpp +++ b/opennurbs_base32.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_base32.h b/opennurbs_base32.h index 52887bd4..782279a0 100644 --- a/opennurbs_base32.h +++ b/opennurbs_base32.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_BASE32_INC_) #define ON_BASE32_INC_ diff --git a/opennurbs_base64.cpp b/opennurbs_base64.cpp index 096eec51..5cbf29a6 100644 --- a/opennurbs_base64.cpp +++ b/opennurbs_base64.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -1093,4 +1090,150 @@ ON__UINT32 ON_Base64EncodeStream::OutCRC() const return m_out_crc; } +// ON_Base64 +static const int DecodeTab[128] = +{ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1, + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, +}; + +static bool ReadEncodedByte(int& pos, const wchar_t* wsz, ON__UINT8& byteOut) +{ + wchar_t w = wsz[pos]; + if (w >= 128) + w = 128; // Will fail validation. + + byteOut = ON__UINT8(w); + + while (byteOut != 0) + { + pos++; + + // Check that the byte is a valid Base64 character. + // The Base64 specification requires garbled data to be ignored. + if ((byteOut < 128) && (DecodeTab[byteOut] >= 0)) + return true; + + // Move on to the next byte and keep trying. + w = wsz[pos]; + if (w >= 128) + w = 128; // Will fail validation. + + byteOut = ON__UINT8(w); + } + + return false; // End of data. +} + +size_t ON_Base64::Decode(const wchar_t* wszBase64in, void* pvBufferOut, size_t maxLength) // Static. +{ + auto* pBufferOut = static_cast(pvBufferOut); + + ON__UINT32 uBytesWritten = 0; + + int iResultSize = 3; + ON__UINT8 a = 0, b = 0, c = 0, d = 0, aResult[3] = { 0 }; + + int pos = 0; + while (ReadEncodedByte(pos, wszBase64in, a)) + { + ReadEncodedByte(pos, wszBase64in, b); + ReadEncodedByte(pos, wszBase64in, c); + ReadEncodedByte(pos, wszBase64in, d); + + if ('=' == d) // Handle padding character(s). + { + iResultSize = ('=' == c) ? 1 : 2; + } + + if (pBufferOut != nullptr) + { + const auto val = (ON__UINT32)((DecodeTab[a] << 18) | (DecodeTab[b] << 12) | (DecodeTab[c] << 6) | DecodeTab[d]); + + aResult[0] = (ON__UINT8)((val & 0xFF0000) >> 16); + aResult[1] = (ON__UINT8)((val & 0x00FF00) >> 8); + aResult[2] = (ON__UINT8)((val)); + + memcpy(pBufferOut, aResult, iResultSize); + pBufferOut += iResultSize; + uBytesWritten += iResultSize; + + if (size_t(uBytesWritten) >= maxLength) + break; + } + else + { + uBytesWritten += iResultSize; + } + } + + return size_t(uBytesWritten); +} + +static const wchar_t* EncodeTab = L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +bool ON_Base64::Encode(const void* pvBufferIn, size_t bufNumBytes, ON_wString& sBase64Out, bool bAppend) // Static. +{ + // Base64 is about 133% of the data size. Use 150% plus 4 for padding. + const auto bigBufNumBytes = (bufNumBytes * 150) / 100 + 4; + + const int iExistingLen = bAppend ? sBase64Out.Length() : 0; + const auto outNumBytes = size_t(iExistingLen) + bigBufNumBytes; + auto* start = sBase64Out.SetLength(outNumBytes); + if (nullptr == start) + return false; + + auto* out = start + iExistingLen; + + const auto* p = static_cast(pvBufferIn); + const char* pEnd = p + bufNumBytes; + + ON__UINT8 a = 0, b = 0, c = 0; + while (p < pEnd) + { + out[2] = out[3] = L'='; + + a = *p++; + + out[0] = EncodeTab[a >> 2]; + + a = ON__UINT8((a & 0x03) << 4); + if (p < pEnd) + { + b = *p++; + out[1] = EncodeTab[a | (b >> 4)]; + + b = ON__UINT8((b & 0x0F) << 2); + if (p < pEnd) + { + c = *p++; + out[2] = EncodeTab[b | (c >> 6)]; + out[3] = EncodeTab[c & 0x3F]; + } + else + { + out[2] = EncodeTab[b]; + } + } + else + { + out[1] = EncodeTab[a]; + } + + out += 4; + } + + *out = 0; + + const auto realLength = out - start; + sBase64Out.SetLength(realLength); + + return true; +} diff --git a/opennurbs_base64.h b/opennurbs_base64.h index 35f8309c..219ed940 100644 --- a/opennurbs_base64.h +++ b/opennurbs_base64.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_BASE64_INC_) #define OPENNURBS_BASE64_INC_ @@ -342,4 +339,21 @@ private: }; */ +class ON_CLASS ON_Base64 final +{ +public: + // Decode a base64 string. + // buffer_out must be large enough to accomodate the decoded data. It is safe to use the + // length of base64_in because this Base64 string will always be about 33% bigger than the + // data it was created from. Returns the number of bytes written to buffer_out. + // The function stops when max_length bytes have been decoded. + // If buffer_out is null, the function simply calculates the exact required buffer size. + static size_t Decode(const wchar_t* base64_in, void* buffer_out, size_t max_length = UINT_MAX); + + // Encode data to a base64 string. If append is true, the encoded string is appended to base64_out. + // Otherwise base64_out is replaced with the encoded string. + // Returns true if ok, false if unable to allocate the output buffer. + static bool Encode(const void* buffer_in, size_t num_bytes, ON_wString& base64_out, bool append); +}; + #endif diff --git a/opennurbs_beam.h b/opennurbs_beam.h index d8b906a2..fbf803ce 100644 --- a/opennurbs_beam.h +++ b/opennurbs_beam.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_EXTRUSION_INC_) #define OPENNURBS_EXTRUSION_INC_ diff --git a/opennurbs_bezier.cpp b/opennurbs_bezier.cpp index a36ea832..1bd33e04 100644 --- a/opennurbs_bezier.cpp +++ b/opennurbs_bezier.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_bezier.h b/opennurbs_bezier.h index 9cc1e322..b28e2855 100644 --- a/opennurbs_bezier.h +++ b/opennurbs_bezier.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_BEZIER_INC_) #define OPENNURBS_BEZIER_INC_ diff --git a/opennurbs_beziervolume.cpp b/opennurbs_beziervolume.cpp index f613bf44..ef12cff8 100644 --- a/opennurbs_beziervolume.cpp +++ b/opennurbs_beziervolume.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_bitmap.cpp b/opennurbs_bitmap.cpp index 216a4b55..61571b7d 100644 --- a/opennurbs_bitmap.cpp +++ b/opennurbs_bitmap.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -997,7 +994,24 @@ ON_WindowsBitmap& ON_WindowsBitmap::operator=( const BITMAPINFO& src ) return *this; } + + +ON_WindowsBitmap::ON_WindowsBitmap( const BITMAPINFO* src ) +{ + if ( 0 != src ) + { + int color_count = ON_WindowsBitmapHelper_PaletteColorCount(src->bmiHeader.biClrUsed, src->bmiHeader.biBitCount ); + Create(src,(const unsigned char*)(&src->bmiColors[color_count]),false); + } +} + +#endif + +#if defined ON_OS_WINDOWS_GDI bool ON_WindowsBitmap::Create( const BITMAPINFO* bmi, const unsigned char* bits, bool bCopy ) +#else +bool ON_WindowsBitmap::Create( const ON_WindowsBITMAPINFO* bmi, const unsigned char* bits, bool bCopy ) +#endif { Internal_Destroy(); @@ -1009,13 +1023,13 @@ bool ON_WindowsBitmap::Create( const BITMAPINFO* bmi, const unsigned char* bits, if ( 0 != bmi ) { - if ( bCopy ) + if ( bCopy ) { // allocate a contiguous Windows device independent bitmap const size_t sizeof_palette = ON_WindowsBitmapHelper_SizeofPalette(bmi->bmiHeader.biClrUsed, bmi->bmiHeader.biBitCount ); const int sizeof_image = bmi->bmiHeader.biSizeImage; m_bmi = ON_WindowsBitmapHelper_AllocBMI( sizeof_palette, (bCopy?sizeof_image:0) ); - if ( 0 != m_bmi ) + if ( 0 != m_bmi ) { rc = true; m_bFreeBMI = 1; // ~ON_WindowsBitmap will free the m_bmi pointer @@ -1040,7 +1054,11 @@ bool ON_WindowsBitmap::Create( const BITMAPINFO* bmi, const unsigned char* bits, { // share BITMAPINFO memory rc = true; +#if defined ON_OS_WINDOWS_GDI m_bmi = const_cast(bmi); +#else + m_bmi = const_cast(bmi); +#endif m_bits = const_cast(bits); } } @@ -1048,17 +1066,6 @@ bool ON_WindowsBitmap::Create( const BITMAPINFO* bmi, const unsigned char* bits, return rc; } -ON_WindowsBitmap::ON_WindowsBitmap( const BITMAPINFO* src ) -{ - if ( 0 != src ) - { - int color_count = ON_WindowsBitmapHelper_PaletteColorCount(src->bmiHeader.biClrUsed, src->bmiHeader.biBitCount ); - Create(src,(const unsigned char*)(&src->bmiColors[color_count]),false); - } -} - -#endif - #if !defined(ON_OS_WINDOWS_GDI) bool ON_WindowsBitmap::Create(const struct ON_WindowsBITMAPINFO* src) { diff --git a/opennurbs_bitmap.h b/opennurbs_bitmap.h index 2e068684..69afda02 100644 --- a/opennurbs_bitmap.h +++ b/opennurbs_bitmap.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // @@ -317,7 +314,11 @@ public: See Also: ON_WindowsBitmap::Create */ - ON_WindowsBitmap( const BITMAPINFO& src ); +#if defined (ON_RUNTIME_WIN) + ON_WindowsBitmap(const BITMAPINFO& src); +#else + ON_WindowsBitmap(const ON_WindowsBITMAPINFO& src); +#endif /* Description: @@ -330,7 +331,11 @@ public: Remarks: ~ON_WindowsBitmap will not delete src. */ - ON_WindowsBitmap( const BITMAPINFO* src ); +#if defined (ON_RUNTIME_WIN) + ON_WindowsBitmap(const BITMAPINFO* src); +#else + ON_WindowsBitmap(const ON_WindowsBITMAPINFO* src); +#endif /* Description: @@ -341,7 +346,11 @@ public: See Also: ON_WindowsBitmap::Create */ - ON_WindowsBitmap& operator=( const BITMAPINFO& src ); +#if defined (ON_RUNTIME_WIN) + ON_WindowsBitmap& operator=(const BITMAPINFO& src); +#else + ON_WindowsBitmap& operator=(const ON_WindowsBITMAPINFO& src); +#endif /* Description: @@ -400,14 +409,25 @@ public: } */ +#endif + + +#if defined (ON_OS_WINDOWS_GDI) bool Create( const BITMAPINFO* bmi, const unsigned char* bits, bool bCopy ); - +#else + bool Create( + const ON_WindowsBITMAPINFO* bmi, + const unsigned char* bits, + bool bCopy + ); #endif + + /* Returns: True if m_bmi and m_bits are in a single contiguous diff --git a/opennurbs_bounding_box.cpp b/opennurbs_bounding_box.cpp index 6f7e72f3..99bed7ce 100644 --- a/opennurbs_bounding_box.cpp +++ b/opennurbs_bounding_box.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -1927,6 +1924,17 @@ bool ON_BoundingBox::Expand(ON_3dVector delta) return IsValid(); } +bool ON_BoundingBox::Shrink(ON_3dVector delta) +{ + m_min += delta; + m_max -= delta; + if (m_max.x < m_min.x) m_max.x = m_min.x = (m_max.x + m_min.x) * 0.5; + if (m_max.y < m_min.y) m_max.y = m_min.y = (m_max.y + m_min.y) * 0.5; + if (m_max.z < m_min.z) m_max.z = m_min.z = (m_max.z + m_min.z) * 0.5; + + return IsValid(); +} + bool ON_BoundingBox::IsDisjoint( const ON_BoundingBox& other_bbox ) const { if ( m_min.x > m_max.x || other_bbox.m_min.x > other_bbox.m_max.x diff --git a/opennurbs_bounding_box.h b/opennurbs_bounding_box.h index 91706247..fb3c0c84 100644 --- a/opennurbs_bounding_box.h +++ b/opennurbs_bounding_box.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_BOUNDING_BOX_INC_) #define ON_BOUNDING_BOX_INC_ @@ -594,6 +591,15 @@ public: */ bool Expand(ON_3dVector delta); + /* +Description: + Shrinks the box by subtracting delta to m_max and adding + it from m_min. This is not allowed to create an inverse bounding box. +Returns: + true if the result is Valid. +*/ + bool Shrink(ON_3dVector delta); + ON_3dPoint m_min; ON_3dPoint m_max; }; diff --git a/opennurbs_box.h b/opennurbs_box.h index f12a9e08..1f4214a2 100644 --- a/opennurbs_box.h +++ b/opennurbs_box.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_BOX_INC_) #define ON_BOX_INC_ diff --git a/opennurbs_brep.cpp b/opennurbs_brep.cpp index db535268..70ac6084 100644 --- a/opennurbs_brep.cpp +++ b/opennurbs_brep.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -13067,7 +13064,7 @@ int ON_BrepLoop::SurfaceIndexOf() const int ON_BrepFace::SurfaceIndexOf() const { - return (m_brep && m_si >= 0 && m_si < m_brep->m_S.Count()) ? m_si : 0; + return (m_brep && m_si >= 0 && m_si < m_brep->m_S.Count()) ? m_si : -1; } void ON_BrepTrim::UnsetPlineEdgeParameters() diff --git a/opennurbs_brep.h b/opennurbs_brep.h index d5f8b242..c075650a 100644 --- a/opennurbs_brep.h +++ b/opennurbs_brep.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_brep_extrude.cpp b/opennurbs_brep_extrude.cpp index 3a2eb995..4e7959cf 100644 --- a/opennurbs_brep_extrude.cpp +++ b/opennurbs_brep_extrude.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_brep_io.cpp b/opennurbs_brep_io.cpp index 56b39a90..ec1c3dc7 100644 --- a/opennurbs_brep_io.cpp +++ b/opennurbs_brep_io.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_brep_isvalid.cpp b/opennurbs_brep_isvalid.cpp index e4e1e903..c23f156f 100644 --- a/opennurbs_brep_isvalid.cpp +++ b/opennurbs_brep_isvalid.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_brep_region.cpp b/opennurbs_brep_region.cpp index bc205687..1c51b6d9 100644 --- a/opennurbs_brep_region.cpp +++ b/opennurbs_brep_region.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_brep_tools.cpp b/opennurbs_brep_tools.cpp index 3658f852..44fa4ad9 100644 --- a/opennurbs_brep_tools.cpp +++ b/opennurbs_brep_tools.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_brep_v2valid.cpp b/opennurbs_brep_v2valid.cpp index 47ebcb3d..efcf2cca 100644 --- a/opennurbs_brep_v2valid.cpp +++ b/opennurbs_brep_v2valid.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_calculator.cpp b/opennurbs_calculator.cpp index cd72fb40..cfddc404 100644 --- a/opennurbs_calculator.cpp +++ b/opennurbs_calculator.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_circle.cpp b/opennurbs_circle.cpp index f11322a4..db6c8b1b 100644 --- a/opennurbs_circle.cpp +++ b/opennurbs_circle.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_circle.h b/opennurbs_circle.h index 69fa5943..83ee568e 100644 --- a/opennurbs_circle.h +++ b/opennurbs_circle.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_CIRCLE_INC_) #define ON_CIRCLE_INC_ diff --git a/opennurbs_color.cpp b/opennurbs_color.cpp index f195e0df..e91c4664 100644 --- a/opennurbs_color.cpp +++ b/opennurbs_color.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" #include "opennurbs_internal_defines.h" diff --git a/opennurbs_color.h b/opennurbs_color.h index a360895e..0196a36c 100644 --- a/opennurbs_color.h +++ b/opennurbs_color.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_COLOR_INC_) #define OPENNURBS_COLOR_INC_ diff --git a/opennurbs_compress.cpp b/opennurbs_compress.cpp index f8eecfca..e543cc71 100644 --- a/opennurbs_compress.cpp +++ b/opennurbs_compress.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_compress.h b/opennurbs_compress.h index a3ae90e6..69954070 100644 --- a/opennurbs_compress.h +++ b/opennurbs_compress.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_COMPRESS_INC_) #define OPENNURBS_COMPRESS_INC_ diff --git a/opennurbs_compstat.cpp b/opennurbs_compstat.cpp index ad8fa737..b6e6802e 100644 --- a/opennurbs_compstat.cpp +++ b/opennurbs_compstat.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_compstat.h b/opennurbs_compstat.h index 33a5571e..26184b8b 100644 --- a/opennurbs_compstat.h +++ b/opennurbs_compstat.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_COMPSTAT_INC_) #define OPENNURBS_COMPSTAT_INC_ diff --git a/opennurbs_cone.cpp b/opennurbs_cone.cpp index fb96729e..2ddab38b 100644 --- a/opennurbs_cone.cpp +++ b/opennurbs_cone.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_cone.h b/opennurbs_cone.h index e478f99b..e174b336 100644 --- a/opennurbs_cone.h +++ b/opennurbs_cone.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_CONE_INC_) #define ON_CONE_INC_ diff --git a/opennurbs_convex_poly.cpp b/opennurbs_convex_poly.cpp index 550a002d..6799a4f5 100644 --- a/opennurbs_convex_poly.cpp +++ b/opennurbs_convex_poly.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_convex_poly.h b/opennurbs_convex_poly.h index a9c0b69f..d1fe8469 100644 --- a/opennurbs_convex_poly.h +++ b/opennurbs_convex_poly.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_CONVEX_POLY_INC_) #define ON_CONVEX_POLY_INC_ diff --git a/opennurbs_crc.cpp b/opennurbs_crc.cpp index 3dad923f..c6d41cc9 100644 --- a/opennurbs_crc.cpp +++ b/opennurbs_crc.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_crc.h b/opennurbs_crc.h index 62658f36..45b64d88 100644 --- a/opennurbs_crc.h +++ b/opennurbs_crc.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_CRC_INC_) #define OPENNURBS_CRC_INC_ diff --git a/opennurbs_curve.cpp b/opennurbs_curve.cpp index 0c17ebd8..858b1573 100644 --- a/opennurbs_curve.cpp +++ b/opennurbs_curve.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_curve.h b/opennurbs_curve.h index 2883f893..e66110f0 100644 --- a/opennurbs_curve.h +++ b/opennurbs_curve.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_curveonsurface.cpp b/opennurbs_curveonsurface.cpp index 00b9214e..3c9b80e7 100644 --- a/opennurbs_curveonsurface.cpp +++ b/opennurbs_curveonsurface.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_curveonsurface.h b/opennurbs_curveonsurface.h index 049aba79..5814d1bb 100644 --- a/opennurbs_curveonsurface.h +++ b/opennurbs_curveonsurface.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_CURVE_ON_SURFACE_INC_) #define OPENNURBS_CURVE_ON_SURFACE_INC_ diff --git a/opennurbs_curveproxy.cpp b/opennurbs_curveproxy.cpp index bc4cdf18..a9455a36 100644 --- a/opennurbs_curveproxy.cpp +++ b/opennurbs_curveproxy.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_curveproxy.h b/opennurbs_curveproxy.h index 9f17fdb2..61bda601 100644 --- a/opennurbs_curveproxy.h +++ b/opennurbs_curveproxy.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_cylinder.cpp b/opennurbs_cylinder.cpp index 04fcb174..ebfd7edd 100644 --- a/opennurbs_cylinder.cpp +++ b/opennurbs_cylinder.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_cylinder.h b/opennurbs_cylinder.h index 3c062541..5b08616e 100644 --- a/opennurbs_cylinder.h +++ b/opennurbs_cylinder.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_CYLINDER_INC_) #define OPENNURBS_CYLINDER_INC_ diff --git a/opennurbs_date.cpp b/opennurbs_date.cpp index fb60c08f..17a77ad0 100644 --- a/opennurbs_date.cpp +++ b/opennurbs_date.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -135,4 +132,4 @@ bool ON_GetGregorianMonthAndDayOfMonth( *date = dd; return (0 != dd); -} \ No newline at end of file +} diff --git a/opennurbs_date.h b/opennurbs_date.h index a4f9f4d1..81e0cc15 100644 --- a/opennurbs_date.h +++ b/opennurbs_date.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_DATE_INC_) #define OPENNURBS_DATE_INC_ diff --git a/opennurbs_decals.cpp b/opennurbs_decals.cpp index 40996145..1f7a232f 100644 --- a/opennurbs_decals.cpp +++ b/opennurbs_decals.cpp @@ -22,109 +22,506 @@ #error ON_COMPILING_OPENNURBS must be defined when compiling opennurbs #endif - #define ON_RDK_UD_DECALS L"decals" - #define ON_RDK_UD_DECAL L"decal" - #define ON_RDK_UD_DECAL_CUSTOM L"custom" - #define ON_RDK_UD_DECAL_CUSTOM_RENDERER L"renderer" - #define ON_RDK_UD_DECAL_CUSTOM_PARAMS L"parameters" - #define ON_RDK_UD_DECAL_INSTANCE_ID L"instance-id" + #define ON_DECALS L"decals" + #define ON_DECAL L"decal" + #define ON_DECAL_CUSTOM L"custom" + #define ON_DECAL_CUSTOM_RENDERER L"renderer" + #define ON_DECAL_CUSTOM_PARAMS L"parameters" - #define ON_RDK_UD_DECAL_MAPPING L"mapping" + #define ON_DECAL_MAPPING L"mapping" //----- +++++++++++++++++++ - #define ON_RDK_UD_DECAL_MAPPING_PLANAR L"planar" - #define ON_RDK_UD_DECAL_MAPPING_CYLINDRICAL L"cylindrical" - #define ON_RDK_UD_DECAL_MAPPING_SPHERICAL L"spherical" - #define ON_RDK_UD_DECAL_MAPPING_UV L"uv" - #define ON_RDK_UD_DECAL_MAPPING_NONE L"none" + #define ON_DECAL_MAPPING_PLANAR L"planar" + #define ON_DECAL_MAPPING_CYLINDRICAL L"cylindrical" + #define ON_DECAL_MAPPING_SPHERICAL L"spherical" + #define ON_DECAL_MAPPING_UV L"uv" + #define ON_DECAL_MAPPING_NONE L"none" - #define ON_RDK_UD_DECAL_PROJECTION L"projection" + #define ON_DECAL_PROJECTION L"projection" //----- ++++++++++++++++++++++ - #define ON_RDK_UD_DECAL_PROJECTION_FORWARD L"forward" - #define ON_RDK_UD_DECAL_PROJECTION_BACKWARD L"backward" - #define ON_RDK_UD_DECAL_PROJECTION_BOTH L"both" - #define ON_RDK_UD_DECAL_PROJECTION_NONE L"none" + #define ON_DECAL_PROJECTION_FORWARD L"forward" + #define ON_DECAL_PROJECTION_BACKWARD L"backward" + #define ON_DECAL_PROJECTION_BOTH L"both" + #define ON_DECAL_PROJECTION_NONE L"none" - #define ON_RDK_UD_DECAL_MAP_TO_INSIDE_ON L"map-to-inside-on" - #define ON_RDK_UD_DECAL_TRANSPARENCY L"transparency" - #define ON_RDK_UD_DECAL_TEXTURE_INSTANCE L"texture-instance" - #define ON_RDK_UD_DECAL_HEIGHT L"height" - #define ON_RDK_UD_DECAL_ORIGIN L"origin" - #define ON_RDK_UD_DECAL_RADIUS L"radius" - #define ON_RDK_UD_DECAL_HORZ_SWEEP_STA L"latitude-start" - #define ON_RDK_UD_DECAL_HORZ_SWEEP_END L"latitude-stop" - #define ON_RDK_UD_DECAL_VERT_SWEEP_STA L"longitude-start" - #define ON_RDK_UD_DECAL_VERT_SWEEP_END L"longitude-stop" - #define ON_RDK_UD_DECAL_VECTOR_UP L"vector-up" - #define ON_RDK_UD_DECAL_VECTOR_ACROSS L"vector-across" - #define ON_RDK_UD_DECAL_MIN_U L"min-u" - #define ON_RDK_UD_DECAL_MIN_V L"min-v" - #define ON_RDK_UD_DECAL_MAX_U L"max-u" - #define ON_RDK_UD_DECAL_MAX_V L"max-v" - #define ON_RDK_UD_DECAL_IS_TEMPORARY L"is-temporary" - #define ON_RDK_UD_DECAL_IS_VISIBLE L"is-visible" + #define ON_DECAL_MAP_TO_INSIDE_ON L"map-to-inside-on" + #define ON_DECAL_TRANSPARENCY L"transparency" + #define ON_DECAL_TEXTURE_INSTANCE L"texture-instance" + #define ON_DECAL_HEIGHT L"height" + #define ON_DECAL_ORIGIN L"origin" + #define ON_DECAL_RADIUS L"radius" + #define ON_DECAL_HORZ_SWEEP_STA L"latitude-start" + #define ON_DECAL_HORZ_SWEEP_END L"latitude-stop" + #define ON_DECAL_VERT_SWEEP_STA L"longitude-start" + #define ON_DECAL_VERT_SWEEP_END L"longitude-stop" + #define ON_DECAL_VECTOR_UP L"vector-up" + #define ON_DECAL_VECTOR_ACROSS L"vector-across" + #define ON_DECAL_MIN_U L"min-u" + #define ON_DECAL_MIN_V L"min-v" + #define ON_DECAL_MAX_U L"max-u" + #define ON_DECAL_MAX_V L"max-v" + #define ON_DECAL_IS_TEMPORARY L"is-temporary" + #define ON_DECAL_IS_VISIBLE L"is-visible" + #define ON_DECAL_INSTANCE_ID L"instance-id" // ON_Decal +static ON_4dPoint UNSET_4D_POINT = ON_4dPoint(ON_UNSET_VALUE, ON_UNSET_VALUE, ON_UNSET_VALUE, ON_UNSET_VALUE); + class ON_Decal::CImpl : public ON_InternalXMLImpl { public: - CImpl() { ON_CreateUuid(m_decal_id); } - CImpl(ON_XMLNode& n) { ON_CreateUuid(m_decal_id); Node() = n; } + CImpl() { ON_CreateUuid(_decal_id); } + CImpl(ON_DecalCollection& dc, ON_XMLNode& node) : _collection(&dc), ON_InternalXMLImpl(&node) { ON_CreateUuid(_decal_id); } - ON_UUID m_decal_id; + ON_UUID TextureInstanceId(void) const; + void SetTextureInstanceId(const ON_UUID& id); + Mappings Mapping(void) const; + void SetMapping(Mappings v); + Projections Projection(void) const; + void SetProjection(Projections v); + bool MapToInside(void) const; + void SetMapToInside(bool v); + double Transparency(void) const; + void SetTransparency(double v); + ON_3dPoint Origin(void) const; + void SetOrigin(const ON_3dPoint& v); + ON_3dVector VectorUp(void) const; + void SetVectorUp(const ON_3dVector& v); + ON_3dVector VectorAcross(void) const; + void SetVectorAcross(const ON_3dVector& v); + double Height(void) const; + void SetHeight(double d); + double Radius(void) const; + void SetRadius(double d); + bool IsVisible(void) const; + void SetIsVisible(bool b); + void GetHorzSweep(double& sta, double& end) const; + void SetHorzSweep(double sta, double end); + void GetVertSweep(double& sta, double& end) const; + void SetVertSweep(double sta, double end); + void GetUVBounds(double& min_u, double& min_v, double& max_u, double& max_v) const; + void SetUVBounds(double min_u, double min_v, double max_u, double max_v); + + ON_UUID Id(void) const { return _decal_id; } + ON_XMLVariant GetParameter(const wchar_t* param_name, const ON_XMLVariant& def) const; + void SetParameter(const wchar_t* param_name, const ON_XMLVariant& value); + ON_XMLNode* FindCustomNodeForRenderEngine(const ON_UUID& renderEngineId) const; + virtual ON_wString NameOfRootNode(void) const override { return ON_DECAL; } + + static const int unset_bool = 2; + mutable struct Cache + { + double radius = ON_UNSET_VALUE; + double height = ON_UNSET_VALUE; + double transparency = ON_UNSET_VALUE; + ON_UUID texture_instance_id = ON_nil_uuid; + ON_3dPoint origin = ON_3dPoint::UnsetPoint; + ON_3dVector vector_up = ON_3dVector::UnsetVector; + ON_3dVector vector_across = ON_3dVector::UnsetVector; + ON_2dPoint horz_sweep = ON_2dPoint::UnsetPoint; + ON_2dPoint vert_sweep = ON_2dPoint::UnsetPoint; + ON_4dPoint uv_bounds = UNSET_4D_POINT; + Mappings mapping = Mappings::None; + Projections projection = Projections::None; + bool texture_instance_id_set = false; + int visible = unset_bool; + int map_to_inside = unset_bool; + } + _cache; + +private: + ON_DecalCollection* _collection = nullptr; + ON_UUID _decal_id; }; -static const wchar_t* XMLPath(void) +static ON_Decal::Mappings MappingFromString(const ON_wString& s) { - return L""; // The node is the actual decal node. + if (s == ON_DECAL_MAPPING_PLANAR) return ON_Decal::Mappings::Planar; + else if (s == ON_DECAL_MAPPING_SPHERICAL) return ON_Decal::Mappings::Spherical; + else if (s == ON_DECAL_MAPPING_CYLINDRICAL) return ON_Decal::Mappings::Cylindrical; + else if (s == ON_DECAL_MAPPING_UV) return ON_Decal::Mappings::UV; + else if (s == ON_DECAL_MAPPING_NONE) return ON_Decal::Mappings::None; + + ON_ASSERT(false); + return ON_Decal::Mappings::None; +} + +ON_XMLVariant ON_Decal::CImpl::GetParameter(const wchar_t* param_name, const ON_XMLVariant& def) const +{ + return ON_InternalXMLImpl::GetParameter(L"", param_name, def); +} + +void ON_Decal::CImpl::SetParameter(const wchar_t* param_name, const ON_XMLVariant& value) +{ + if (nullptr != _collection) + _collection->SetChanged(); + + ON_InternalXMLImpl::SetParameter(L"", param_name, value); +} + +ON_UUID ON_Decal::CImpl::TextureInstanceId(void) const +{ + if (!_cache.texture_instance_id_set) + { + _cache.texture_instance_id = GetParameter(ON_DECAL_TEXTURE_INSTANCE, ON_nil_uuid).AsUuid(); + _cache.texture_instance_id_set = true; + } + + return _cache.texture_instance_id; +} + +void ON_Decal::CImpl::SetTextureInstanceId(const ON_UUID& id) +{ + if (!_cache.texture_instance_id_set || (_cache.texture_instance_id != id)) + { + _cache.texture_instance_id = id; + _cache.texture_instance_id_set = true; + SetParameter(ON_DECAL_TEXTURE_INSTANCE, id); + } +} + +ON_Decal::Mappings ON_Decal::CImpl::Mapping(void) const +{ + if (Mappings::None == _cache.mapping) + { + const ON_wString s = GetParameter(ON_DECAL_MAPPING, ON_DECAL_MAPPING_UV).AsString(); + _cache.mapping = MappingFromString(s); + } + + return _cache.mapping; +} + +void ON_Decal::CImpl::SetMapping(Mappings m) +{ + if (_cache.mapping != m) + { + _cache.mapping = m; + + const wchar_t* s = L""; + switch (m) + { + default: ON_ASSERT(false); + case Mappings::None: s = ON_DECAL_MAPPING_NONE; break; + case Mappings::Planar: s = ON_DECAL_MAPPING_PLANAR; break; + case Mappings::Spherical: s = ON_DECAL_MAPPING_SPHERICAL; break; + case Mappings::Cylindrical: s = ON_DECAL_MAPPING_CYLINDRICAL; break; + case Mappings::UV: s = ON_DECAL_MAPPING_UV; break; + } + + SetParameter(ON_DECAL_MAPPING, s); + } +} + +ON_Decal::Projections ON_Decal::CImpl::Projection(void) const +{ + if (Projections::None == _cache.projection) + { + const ON_wString s = GetParameter(ON_DECAL_PROJECTION, ON_DECAL_PROJECTION_NONE).AsString(); + if (s == ON_DECAL_PROJECTION_FORWARD) _cache.projection = ON_Decal::Projections::Forward; + else if (s == ON_DECAL_PROJECTION_BACKWARD) _cache.projection = ON_Decal::Projections::Backward; + else if (s == ON_DECAL_PROJECTION_BOTH) _cache.projection = ON_Decal::Projections::Both; + else if (s == ON_DECAL_PROJECTION_NONE) _cache.projection = ON_Decal::Projections::None; + else ON_ASSERT(false); + } + + return _cache.projection; +} + +void ON_Decal::CImpl::SetProjection(Projections v) +{ + if (_cache.projection != v) + { + _cache.projection = v; + + const wchar_t* s = L""; + switch (v) + { + default: ON_ASSERT(false); + case ON_Decal::Projections::None: s = ON_DECAL_PROJECTION_NONE; break; + case ON_Decal::Projections::Forward: s = ON_DECAL_PROJECTION_FORWARD; break; + case ON_Decal::Projections::Backward: s = ON_DECAL_PROJECTION_BACKWARD; break; + case ON_Decal::Projections::Both: s = ON_DECAL_PROJECTION_BOTH; break; + } + + SetParameter(ON_DECAL_PROJECTION, s); + } +} + +bool ON_Decal::CImpl::MapToInside(void) const +{ + if (unset_bool == _cache.map_to_inside) + { + _cache.map_to_inside = GetParameter(ON_DECAL_MAP_TO_INSIDE_ON, false).AsBool() ? 1 : 0; + } + + return 0 != _cache.map_to_inside; +} + +void ON_Decal::CImpl::SetMapToInside(bool b) +{ + const int i = b ? 1 : 0; + if (_cache.map_to_inside != i) + { + _cache.map_to_inside = i; + SetParameter(ON_DECAL_MAP_TO_INSIDE_ON, b); + } +} + +double ON_Decal::CImpl::Transparency(void) const +{ + if (ON_UNSET_VALUE == _cache.transparency) + { + _cache.transparency = GetParameter(ON_DECAL_TRANSPARENCY, 0.0).AsDouble(); + } + + return _cache.transparency; +} + +void ON_Decal::CImpl::SetTransparency(double v) +{ + if (_cache.transparency != v) + { + _cache.transparency = v; + SetParameter(ON_DECAL_TRANSPARENCY, v); + } +} + +ON_3dPoint ON_Decal::CImpl::Origin(void) const +{ + if (ON_3dPoint::UnsetPoint == _cache.origin) + { + _cache.origin = GetParameter(ON_DECAL_ORIGIN, ON_3dPoint::Origin).As3dPoint(); + } + + return _cache.origin; +} + +void ON_Decal::CImpl::SetOrigin(const ON_3dPoint& pt) +{ + if (_cache.origin != pt) + { + _cache.origin = pt; + SetParameter(ON_DECAL_ORIGIN, pt); + } +} + +ON_3dVector ON_Decal::CImpl::VectorUp(void) const +{ + if (ON_3dVector::UnsetVector == _cache.vector_up) + { + _cache.vector_up = GetParameter(ON_DECAL_VECTOR_UP, ON_3dPoint::Origin).As3dPoint(); + } + + return _cache.vector_up; +} + +void ON_Decal::CImpl::SetVectorUp(const ON_3dVector& v) +{ + if (_cache.vector_up != v) + { + _cache.vector_up = v; + SetParameter(ON_DECAL_VECTOR_UP, ON_3dPoint(v)); + } +} + +ON_3dVector ON_Decal::CImpl::VectorAcross(void) const +{ + if (ON_3dVector::UnsetVector == _cache.vector_across) + { + _cache.vector_across = GetParameter(ON_DECAL_VECTOR_ACROSS, ON_3dPoint::Origin).As3dPoint(); + } + + return _cache.vector_across; +} + +void ON_Decal::CImpl::SetVectorAcross(const ON_3dVector& v) +{ + if (_cache.vector_across != v) + { + _cache.vector_across = v; + SetParameter(ON_DECAL_VECTOR_ACROSS, ON_3dPoint(v)); + } +} + +double ON_Decal::CImpl::Height(void) const +{ + if (ON_UNSET_VALUE == _cache.height) + { + _cache.height = GetParameter(ON_DECAL_HEIGHT, 1.0).AsDouble(); + } + + return _cache.height; +} + +void ON_Decal::CImpl::SetHeight(double v) +{ + if (_cache.height != v) + { + _cache.height = v; + SetParameter(ON_DECAL_HEIGHT, v); + } +} + +double ON_Decal::CImpl::Radius(void) const +{ + if (ON_UNSET_VALUE == _cache.radius) + { + _cache.radius = GetParameter(ON_DECAL_RADIUS, 1.0).AsDouble(); + } + + return _cache.radius; +} + +void ON_Decal::CImpl::SetRadius(double v) +{ + if (_cache.radius != v) + { + _cache.radius = v; + SetParameter(ON_DECAL_RADIUS, v); + } +} + +bool ON_Decal::CImpl::IsVisible(void) const +{ + if (unset_bool == _cache.visible) + { + _cache.visible = GetParameter(ON_DECAL_IS_VISIBLE, true).AsBool(); + } + + return 0 != _cache.visible; +} + +void ON_Decal::CImpl::SetIsVisible(bool b) +{ + const int i = b ? 1 : 0; + if (_cache.visible != i) + { + _cache.visible = i; + SetParameter(ON_DECAL_IS_VISIBLE, b); + } +} + +void ON_Decal::CImpl::GetHorzSweep(double& sta, double& end) const +{ + if (ON_2dPoint::UnsetPoint == _cache.horz_sweep) + { + _cache.horz_sweep.x = GetParameter(ON_DECAL_HORZ_SWEEP_STA, 0.0).AsDouble(); + _cache.horz_sweep.y = GetParameter(ON_DECAL_HORZ_SWEEP_END, 0.0).AsDouble(); + } + + sta = _cache.horz_sweep.x; + end = _cache.horz_sweep.y; +} + +void ON_Decal::CImpl::SetHorzSweep(double sta, double end) +{ + const auto sweep = ON_2dPoint(sta, end); + if (_cache.horz_sweep != sweep) + { + _cache.horz_sweep = sweep; + SetParameter(ON_DECAL_HORZ_SWEEP_STA, sta); + SetParameter(ON_DECAL_HORZ_SWEEP_END, end); + } +} + +void ON_Decal::CImpl::GetVertSweep(double& sta, double& end) const +{ + if (ON_2dPoint::UnsetPoint == _cache.vert_sweep) + { + _cache.vert_sweep.x = GetParameter(ON_DECAL_VERT_SWEEP_STA, 0.0).AsDouble(); + _cache.vert_sweep.y = GetParameter(ON_DECAL_VERT_SWEEP_END, 0.0).AsDouble(); + } + + sta = _cache.vert_sweep.x; + end = _cache.vert_sweep.y; +} + +void ON_Decal::CImpl::SetVertSweep(double sta, double end) +{ + const auto sweep = ON_2dPoint(sta, end); + if (_cache.vert_sweep != sweep) + { + _cache.vert_sweep = sweep; + SetParameter(ON_DECAL_VERT_SWEEP_STA, sta); + SetParameter(ON_DECAL_VERT_SWEEP_END, end); + } +} + +void ON_Decal::CImpl::GetUVBounds(double& min_u, double& min_v, double& max_u, double& max_v) const +{ + if (UNSET_4D_POINT == _cache.uv_bounds) + { + _cache.uv_bounds.x = GetParameter(ON_DECAL_MIN_U, 0.0).AsDouble(); + _cache.uv_bounds.y = GetParameter(ON_DECAL_MIN_V, 0.0).AsDouble(); + _cache.uv_bounds.z = GetParameter(ON_DECAL_MAX_U, 1.0).AsDouble(); + _cache.uv_bounds.w = GetParameter(ON_DECAL_MAX_V, 1.0).AsDouble(); + } + + min_u = _cache.uv_bounds.x; + min_v = _cache.uv_bounds.y; + max_u = _cache.uv_bounds.z; + max_v = _cache.uv_bounds.w; +} + +void ON_Decal::CImpl::SetUVBounds(double min_u, double min_v, double max_u, double max_v) +{ + const auto bounds = ON_4dPoint(min_u, min_v, max_u, max_v); + if (_cache.uv_bounds != bounds) + { + _cache.uv_bounds = bounds; + SetParameter(ON_DECAL_MIN_U, min_u); + SetParameter(ON_DECAL_MIN_V, min_v); + SetParameter(ON_DECAL_MAX_U, max_u); + SetParameter(ON_DECAL_MAX_V, max_v); + } +} + +ON_XMLNode* ON_Decal::CImpl::FindCustomNodeForRenderEngine(const ON_UUID& renderEngineId) const +{ + ON_XMLNode* child_node = nullptr; + auto it = Node().GetChildIterator(); + while (nullptr != (child_node = it.GetNextChild())) + { + if (child_node->TagName() == ON_DECAL_CUSTOM) + { + const ON_XMLProperty* prop = child_node->GetNamedProperty(ON_DECAL_CUSTOM_RENDERER); + if ((nullptr != prop) && (prop->GetValue().AsUuid() == renderEngineId)) + return child_node; + } + } + + return nullptr; } ON_Decal::ON_Decal() { - m_impl = new CImpl; + _impl = new CImpl; } -ON_Decal::ON_Decal(ON_XMLNode& model_node) +ON_Decal::ON_Decal(ON_DecalCollection& dc, ON_XMLNode& node) { - m_impl = new CImpl(model_node); + ON_ASSERT(node.TagName() == ON_DECAL); + + _impl = new CImpl(dc, node); } ON_Decal::ON_Decal(const ON_Decal& d) { - m_impl = new CImpl; + _impl = new CImpl; operator = (d); } ON_Decal::~ON_Decal() { - delete m_impl; - m_impl = nullptr; + delete _impl; + _impl = nullptr; } const ON_Decal& ON_Decal::operator = (const ON_Decal& d) { if (this != &d) { - SetTextureInstanceId(d.TextureInstanceId()); - SetMapping(d.Mapping()); - SetProjection(d.Projection()); - SetMapToInside(d.MapToInside()); - SetTransparency(d.Transparency()); - SetOrigin(d.Origin()); - SetVectorUp(d.VectorUp()); - SetVectorAcross(d.VectorAcross()); - SetHeight(d.Height()); - SetRadius(d.Radius()); - - double sta = 0.0, end = 0.0; - d.GetHorzSweep(sta, end); - SetHorzSweep(sta, end); - d.GetVertSweep(sta, end); - SetVertSweep(sta, end); - - double min_u = 0.0, min_v = 0.0, max_u = 0.0, max_v = 0.0; - d.UVBounds(min_u, min_v, max_u, max_v); - SetUVBounds(min_u, min_v, max_u, max_v); + _impl->Node() = d._impl->Node(); } return *this; @@ -132,6 +529,8 @@ const ON_Decal& ON_Decal::operator = (const ON_Decal& d) bool ON_Decal::operator == (const ON_Decal& d) { + // This only checks if the basic parameters are equal. It ignores any custom data. + if (TextureInstanceId() != d.TextureInstanceId()) return false; if (Mapping() != d.Mapping()) return false; if (Projection() != d.Projection()) return false; @@ -156,8 +555,8 @@ bool ON_Decal::operator == (const ON_Decal& d) double min_u1 = 0.0, min_v1 = 0.0, max_u1 = 0.0, max_v1 = 0.0; double min_u2 = 0.0, min_v2 = 0.0, max_u2 = 0.0, max_v2 = 0.0; - UVBounds(min_u1, min_v1, max_u1, max_v1); - d.UVBounds(min_u2, min_v2, max_u2, max_v2); + GetUVBounds(min_u1, min_v1, max_u1, max_v1); + d.GetUVBounds(min_u2, min_v2, max_u2, max_v2); if (!IsDoubleEqual(min_u1, min_u2)) return false; if (!IsDoubleEqual(min_v1, min_v2)) return false; if (!IsDoubleEqual(max_u1, max_u2)) return false; @@ -173,201 +572,435 @@ bool ON_Decal::operator != (const ON_Decal& d) ON_UUID ON_Decal::TextureInstanceId(void) const { - return m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_TEXTURE_INSTANCE, ON_nil_uuid).AsUuid(); + return _impl->TextureInstanceId(); } void ON_Decal::SetTextureInstanceId(const ON_UUID& id) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_TEXTURE_INSTANCE, id); + _impl->SetTextureInstanceId(id); } ON_Decal::Mappings ON_Decal::Mapping(void) const { - const ON_wString s = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_MAPPING, ON_RDK_UD_DECAL_MAPPING_UV).AsString(); - - if (ON_RDK_UD_DECAL_MAPPING_UV == s) - return ON_Decal::Mappings::UV; - - if (ON_RDK_UD_DECAL_MAPPING_PLANAR == s) - return ON_Decal::Mappings::Planar; - - if (ON_RDK_UD_DECAL_MAPPING_SPHERICAL == s) - return ON_Decal::Mappings::Spherical; - - if (ON_RDK_UD_DECAL_MAPPING_CYLINDRICAL == s) - return ON_Decal::Mappings::Cylindrical; - - return ON_Decal::Mappings::None; + return _impl->Mapping(); } void ON_Decal::SetMapping(Mappings m) { - const wchar_t* s = L""; - switch (m) - { - case ON_Decal::Mappings::UV: s = ON_RDK_UD_DECAL_MAPPING_UV; break; - case ON_Decal::Mappings::Planar: s = ON_RDK_UD_DECAL_MAPPING_PLANAR; break; - case ON_Decal::Mappings::Spherical: s = ON_RDK_UD_DECAL_MAPPING_SPHERICAL; break; - case ON_Decal::Mappings::Cylindrical: s = ON_RDK_UD_DECAL_MAPPING_CYLINDRICAL; break; - case ON_Decal::Mappings::None: break; - } - - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_MAPPING, s); + _impl->SetMapping(m); } ON_Decal::Projections ON_Decal::Projection(void) const { - const ON_wString s = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_PROJECTION, ON_RDK_UD_DECAL_PROJECTION_FORWARD).AsString(); - - if (ON_RDK_UD_DECAL_PROJECTION_FORWARD == s) - return ON_Decal::Projections::Forward; - - if (ON_RDK_UD_DECAL_PROJECTION_BACKWARD == s) - return ON_Decal::Projections::Backward; - - if (ON_RDK_UD_DECAL_PROJECTION_BOTH == s) - return ON_Decal::Projections::Both; - - return ON_Decal::Projections::None; + return _impl->Projection(); } void ON_Decal::SetProjection(Projections p) { - const wchar_t* s = L""; - switch (p) - { - case ON_Decal::Projections::Forward: s = ON_RDK_UD_DECAL_PROJECTION_FORWARD; break; - case ON_Decal::Projections::Backward: s = ON_RDK_UD_DECAL_PROJECTION_BACKWARD; break; - case ON_Decal::Projections::Both: s = ON_RDK_UD_DECAL_PROJECTION_BOTH; break; - case ON_Decal::Projections::None: break; - } - - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_PROJECTION, s); + _impl->SetProjection(p); } bool ON_Decal::MapToInside(void) const { - return m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_MAP_TO_INSIDE_ON, false).AsBool(); + return _impl->MapToInside(); } void ON_Decal::SetMapToInside(bool b) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_MAP_TO_INSIDE_ON, b); + _impl->SetMapToInside(b); } double ON_Decal::Transparency(void) const { - return m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_TRANSPARENCY, 0.0).AsDouble(); + return _impl->Transparency(); } void ON_Decal::SetTransparency(double d) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_TRANSPARENCY, d); + _impl->SetTransparency(d); } ON_3dPoint ON_Decal::Origin(void) const { - return m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_ORIGIN, ON_3dPoint::Origin).As3dPoint(); + return _impl->Origin(); } void ON_Decal::SetOrigin(const ON_3dPoint& pt) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_ORIGIN, pt); + _impl->SetOrigin(pt); } ON_3dVector ON_Decal::VectorUp(void) const { - return m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_VECTOR_UP, ON_3dPoint::Origin).As3dPoint(); + return _impl->VectorUp(); } void ON_Decal::SetVectorUp(const ON_3dVector& vec) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_VECTOR_UP, ON_3dPoint(vec)); + _impl->SetVectorUp(vec); } ON_3dVector ON_Decal::VectorAcross(void) const { - return m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_VECTOR_ACROSS, ON_3dPoint::Origin).As3dPoint(); + return _impl->VectorAcross(); } void ON_Decal::SetVectorAcross(const ON_3dVector& vec) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_VECTOR_ACROSS, ON_3dPoint(vec)); + _impl->SetVectorAcross(vec); } double ON_Decal::Height(void) const { - return m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_HEIGHT, 1.0).AsDouble(); + return _impl->Height(); } void ON_Decal::SetHeight(double d) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_HEIGHT, d); + _impl->SetHeight(d); } double ON_Decal::Radius(void) const { - return m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_RADIUS, 1.0).AsDouble(); + return _impl->Radius(); } void ON_Decal::SetRadius(double d) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_RADIUS, d); + _impl->SetRadius(d); } void ON_Decal::GetHorzSweep(double& sta, double& end) const { - sta = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_HORZ_SWEEP_STA, 0.0).AsDouble(); - end = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_HORZ_SWEEP_END, 0.0).AsDouble(); + _impl->GetHorzSweep(sta, end); } void ON_Decal::SetHorzSweep(double sta, double end) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_HORZ_SWEEP_STA, sta); - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_HORZ_SWEEP_END, end); + _impl->SetHorzSweep(sta, end); } void ON_Decal::GetVertSweep(double& sta, double& end) const { - sta = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_VERT_SWEEP_STA, 0.0).AsDouble(); - end = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_VERT_SWEEP_END, 0.0).AsDouble(); + _impl->GetVertSweep(sta, end); } void ON_Decal::SetVertSweep(double sta, double end) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_VERT_SWEEP_STA, sta); - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_VERT_SWEEP_END, end); + _impl->SetVertSweep(sta, end); } -void ON_Decal::UVBounds(double& min_u, double& min_v, double& max_u, double& max_v) const +void ON_Decal::GetUVBounds(double& min_u, double& min_v, double& max_u, double& max_v) const { - min_u = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_MIN_U, 0.0).AsDouble(); - min_v = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_MIN_V, 0.0).AsDouble(); - max_u = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_MAX_U, 1.0).AsDouble(); - max_v = m_impl->GetParameter(XMLPath(), ON_RDK_UD_DECAL_MAX_V, 1.0).AsDouble(); + _impl->GetUVBounds(min_u, min_v, max_u, max_v); } void ON_Decal::SetUVBounds(double min_u, double min_v, double max_u, double max_v) { - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_MIN_U, min_u); - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_MIN_V, min_v); - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_MAX_U, max_u); - m_impl->SetParameter(XMLPath(), ON_RDK_UD_DECAL_MAX_V, max_v); + _impl->SetUVBounds(min_u, min_v, max_u, max_v); } -ON__UINT32 ON_Decal::DataCRC(ON__UINT32 crc) const +bool ON_Decal::IsVisible(void) const { - return m_impl->NodeAt(XMLPath()).DataCRC(crc); + return _impl->IsVisible(); +} + +void ON_Decal::SetIsVisible(bool b) +{ + _impl->SetIsVisible(b); } ON_UUID ON_Decal::Id(void) const { - return m_impl->m_decal_id; + return _impl->Id(); } -const ON_XMLNode& ON_Decal::XML(void) const +ON__UINT32 ON_Decal::DecalCRC(void) const { - return m_impl->Node(); + return DataCRC(0); +} + +ON__UINT32 ON_Decal::DataCRC(ON__UINT32 current_remainder) const +{ + return ComputeDecalCRC(current_remainder, _impl->Node()); +} + +void ON_Decal::GetCustomXML(const ON_UUID& renderEngineId, ON_XMLNode& custom_param_node) const +{ + custom_param_node.Clear(); + custom_param_node.SetTagName(ON_DECAL_CUSTOM_PARAMS); + + // Find the node for 'renderEngineId'. + const ON_XMLNode* custom_node = _impl->FindCustomNodeForRenderEngine(renderEngineId); + if (nullptr != custom_node) + { + // Get the parameter node and copy it to 'custom_param_node'. + const ON_XMLNode* param_node = custom_node->GetNamedChild(ON_DECAL_CUSTOM_PARAMS); + if (nullptr != param_node) + { + custom_param_node = *param_node; + } + } +} + +bool ON_Decal::SetCustomXML(const ON_UUID& renderEngineId, const ON_XMLNode& custom_param_node) +{ + if (custom_param_node.TagName() != ON_DECAL_CUSTOM_PARAMS) + return false; + + // If there is already a custom node for 'renderEngineId' then delete it. + ON_XMLNode* custom_node = _impl->FindCustomNodeForRenderEngine(renderEngineId); + if (nullptr != custom_node) + { + ON_XMLNode* parent = custom_node->GetParent(); + if (nullptr != parent) + { + delete parent->DetachChild(*custom_node); + } + } + + // Add the new custom node and set its 'renderer' property to be the render engine id. + custom_node = _impl->Node().AttachChildNode(new ON_XMLNode(ON_DECAL_CUSTOM)); + ON_XMLProperty prop(ON_DECAL_CUSTOM_RENDERER, renderEngineId); + custom_node->AddProperty(prop); + + // Attach a copy of the custom param node to the custom node. + custom_node->AttachChildNode(new ON_XMLNode(custom_param_node)); + + return true; +} + +// Copied from IRhRdkDecal::GetTextureMapping -- TODO: Refactor. [JOHN-DECAL-FIX] +bool ON_Decal::GetTextureMapping(ON_TextureMapping& mappingOut) const +{ + const auto& decal = *this; + using M = ON_Decal::Mappings; + + switch (decal.Mapping()) + { + case M::Cylindrical: + { + // Orthogonal vectors in the end plane of cylinder. + const auto vecPlaneXAxis = decal.VectorAcross(); + const auto vecPlaneYAxis = ON_CrossProduct(decal.VectorAcross(), -decal.VectorUp()); + + // Center for the end of the cylinder. + const auto ptCylinderEndCenter = decal.Origin() - decal.VectorUp() * decal.Height() * 0.5; + + // Plane for the end of the cylinder. + ON_Plane plane(ptCylinderEndCenter, vecPlaneXAxis, vecPlaneYAxis); + + // Circle for the end of the cylinder. + ON_Circle circle(plane, decal.Radius()); + + // The cylinder itself.. + ON_Cylinder cylinder(circle, decal.Height()); + + // Cylindrical mapping without caps. + mappingOut.SetCylinderMapping(cylinder, false); + + return true; + } + + case M::Spherical: + { + // Orthogonal vectors in the equatorial plane. + const auto vecPlaneXAxis = decal.VectorAcross(); + const auto vecPlaneYAxis = ON_CrossProduct(decal.VectorAcross(), -decal.VectorUp()); + + // Equatorial plane. + ON_Plane plane(decal.Origin(), vecPlaneXAxis, vecPlaneYAxis); + + // The sphere itself. + ON_Sphere sphere; + sphere.plane = plane; + sphere.radius = decal.Radius(); + + // Spherical mapping. + mappingOut.SetSphereMapping(sphere); + + return true; + } + + case M::Planar: + { + const auto vecAcross = decal.VectorAcross(); + const auto vecUp = decal.VectorUp(); + const ON_Plane plane(decal.Origin(), vecAcross, vecUp); + const ON_Interval xInterval(0.0, vecAcross.Length()); + const ON_Interval yInterval(0.0, vecUp.Length()); + const ON_Interval zInterval(0.0, 1.0); + mappingOut.SetPlaneMapping(plane, xInterval, yInterval, zInterval); + + return true; + } + + default: break; + } + + return false; +} + +/** \class ON_DecalNodeReader + + This object encapsulates the reading of all decal properties from XML nodes. + It is used by the decal CRC calculation in ComputeDecalCRC(). + + TODO: It could also be used by the ON_Decal XML node acccess. + +*/ +class ON_DecalNodeReader +{ +public: + ON_DecalNodeReader(const ON_XMLNode* p) : m_pNode(p) { } + + ON_XMLVariant Mapping(void) const { return Value(ON_DECAL_MAPPING, ON_DECAL_MAPPING_NONE); } + ON_XMLVariant Projection(void) const { return Value(ON_DECAL_PROJECTION, ON_DECAL_PROJECTION_NONE); } + ON_XMLVariant MapToInside(void) const { return Value(ON_DECAL_MAP_TO_INSIDE_ON, m_def.MapToInside()); } + ON_XMLVariant Transparency(void) const { return Value(ON_DECAL_TRANSPARENCY , m_def.Transparency()); } + ON_XMLVariant TextureInstanceId(void) const { return Value(ON_DECAL_TEXTURE_INSTANCE, m_def.TextureInstanceId()); } + ON_XMLVariant Height(void) const { return Value(ON_DECAL_HEIGHT , m_def.Height()); } + ON_XMLVariant Radius(void) const { return Value(ON_DECAL_RADIUS , m_def.Radius()); } + ON_XMLVariant Origin(void) const { return Value(ON_DECAL_ORIGIN , m_def.Origin()); } + ON_XMLVariant VectorUp(void) const { return Value(ON_DECAL_VECTOR_UP , ON_3dPoint(m_def.VectorUp())); } + ON_XMLVariant VectorAcross(void) const { return Value(ON_DECAL_VECTOR_ACROSS , ON_3dPoint(m_def.VectorAcross())); } + ON_XMLVariant HorzSweepSta(void) const { return Value(ON_DECAL_HORZ_SWEEP_STA , DefaultHorzSweepSta()); } + ON_XMLVariant HorzSweepEnd(void) const { return Value(ON_DECAL_HORZ_SWEEP_END , DefaultHorzSweepEnd()); } + ON_XMLVariant VertSweepSta(void) const { return Value(ON_DECAL_VERT_SWEEP_STA , DefaultVertSweepSta()); } + ON_XMLVariant VertSweepEnd(void) const { return Value(ON_DECAL_VERT_SWEEP_END , DefaultVertSweepEnd()); } + ON_XMLVariant MinU(void) const { return Value(ON_DECAL_MIN_U , DefaultMinU()); } + ON_XMLVariant MinV(void) const { return Value(ON_DECAL_MIN_V , DefaultMinV()); } + ON_XMLVariant MaxU(void) const { return Value(ON_DECAL_MAX_U , DefaultMaxU()); } + ON_XMLVariant MaxV(void) const { return Value(ON_DECAL_MAX_V , DefaultMaxV()); } + ON_XMLVariant IsTemporary(void) const { return Value(ON_DECAL_IS_TEMPORARY , false); } + ON_XMLVariant IsVisible(void) const { return Value(ON_DECAL_IS_VISIBLE , m_def.IsVisible()); } + ON_XMLVariant InstanceId(void) const { return Value(ON_DECAL_INSTANCE_ID , m_def.Id()); } + +private: + ON_XMLVariant Value(const wchar_t* wszName, const ON_XMLVariant& vDefault) const; + + double DefaultHorzSweepSta(void) const { double a, b; m_def.GetHorzSweep(a, b); return a; } + double DefaultHorzSweepEnd(void) const { double a, b; m_def.GetHorzSweep(a, b); return b; } + double DefaultVertSweepSta(void) const { double a, b; m_def.GetVertSweep(a, b); return a; } + double DefaultVertSweepEnd(void) const { double a, b; m_def.GetVertSweep(a, b); return b; } + + double DefaultMinU(void) const { double a, b, c, d; m_def.GetUVBounds(a, b, c, d); return a; } + double DefaultMinV(void) const { double a, b, c, d; m_def.GetUVBounds(a, b, c, d); return b; } + double DefaultMaxU(void) const { double a, b, c, d; m_def.GetUVBounds(a, b, c, d); return c; } + double DefaultMaxV(void) const { double a, b, c, d; m_def.GetUVBounds(a, b, c, d); return d; } + +private: + const ON_XMLNode* m_pNode; + const ON_Decal m_def; +}; + +ON_XMLVariant ON_DecalNodeReader::Value(const wchar_t* wszName, const ON_XMLVariant& vDefault) const +{ + ON_XMLVariant vValue = vDefault; + + if (nullptr != m_pNode) + { + const ON_XMLParameters p(*m_pNode); + p.GetParam(wszName, vValue); + } + + return vValue; +} + +static void DecalUpdateCRC(ON__UINT32& crc, const ON_XMLVariant value) +{ + crc = value.DataCRC(crc); +} + +ON__UINT32 ON_Decal::ComputeDecalCRC(ON__UINT32 crc, const ON_XMLNode& node) // Static. +{ + const ON_DecalNodeReader d(&node); + + const ON_wString s = d.Mapping().AsString(); + const auto mapping = MappingFromString(s); + + DecalUpdateCRC(crc, d.Mapping()); + DecalUpdateCRC(crc, d.IsVisible()); + DecalUpdateCRC(crc, d.IsTemporary()); + DecalUpdateCRC(crc, d.Transparency()); + DecalUpdateCRC(crc, d.TextureInstanceId()); + + if (Mappings::Planar == mapping) + { + DecalUpdateCRC(crc, d.MinU()); + DecalUpdateCRC(crc, d.MinV()); + DecalUpdateCRC(crc, d.MaxU()); + DecalUpdateCRC(crc, d.MaxV()); + } + else + { + DecalUpdateCRC(crc, d.Origin()); + DecalUpdateCRC(crc, d.VectorUp()); + DecalUpdateCRC(crc, d.VectorAcross()); + DecalUpdateCRC(crc, d.Projection()); + + if ((Mappings::Cylindrical == mapping) || (Mappings::Spherical == mapping)) + { + DecalUpdateCRC(crc, d.Radius()); + DecalUpdateCRC(crc, d.MapToInside()); + DecalUpdateCRC(crc, d.HorzSweepSta()); + DecalUpdateCRC(crc, d.HorzSweepEnd()); + + if (Mappings::Cylindrical == mapping) + { + DecalUpdateCRC(crc, d.Height()); + } + else + if (Mappings::Spherical == mapping) + { + DecalUpdateCRC(crc, d.VertSweepSta()); + DecalUpdateCRC(crc, d.VertSweepEnd()); + } + } + } + + // Look for custom data nodes and for each one, find the parameter node and then iterate over its + // children and CRC the properties. For now, we will have to rely on the raw XML. A better solution + // would be to have the plug-in that created this XML calculate the CRC itself. + auto it = node.GetChildIterator(); + ON_XMLNode* pChildNode = nullptr; + while (nullptr != (pChildNode = it.GetNextChild())) + { + if (pChildNode->TagName() != ON_DECAL_CUSTOM) + continue; // Not a custom data node. + + ON_XMLProperty* prop = pChildNode->GetNamedProperty(ON_DECAL_CUSTOM_RENDERER); + if (nullptr != prop) + { + // Include the render engine id. + const ON_UUID uuid = prop->GetValue().AsUuid(); + crc = ON_CRC32(crc, sizeof(uuid), &uuid); + } + + // Find the custom parameter node. + const ON_XMLNode* pParamNode = pChildNode->GetNamedChild(ON_DECAL_CUSTOM_PARAMS); + if (nullptr != pParamNode) + { + // Iterate over the nodes inside the custom parameter node. + const ON_XMLParameters p(*pParamNode); + auto* pIterator = p.NewIterator(); + + ON_wString sParamName; + ON_XMLVariant vParamValue; + while (pIterator->Next(sParamName, vParamValue)) + { + DecalUpdateCRC(crc, vParamValue); + } + + delete pIterator; + } + } + + // Make sure it's not zero which would mean 'nil'. + if (0 == crc) + crc--; + + return crc; } // ON_DecalCollection @@ -377,14 +1010,49 @@ ON_DecalCollection::~ON_DecalCollection() DeleteAllDecals(); } +int ON_DecalCollection::FindDecalIndex(const ON_Decal& decal) const +{ + for (int i = 0; i < m_decals.Count(); i++) + { + if (decal.Id() == m_decals[i]->Id()) + return i; + } + + return -1; +} + +bool ON_DecalCollection::DeleteDecal(ON_Decal& decal) +{ + // Ensure the array is populated before deleting a decal. + GetDecalArray(); + + const int index = FindDecalIndex(decal); + if (index < 0) + return false; + + delete m_decals[index]; + m_decals.Remove(index); + + return true; +} + void ON_DecalCollection::DeleteAllDecals(void) { + // Ensure the array is populated before deleting all the decals. This is not as silly as + // it seems because otherwise it will be populated later and they will all come back. + GetDecalArray(); + for (int i = 0; i < m_decals.Count(); i++) { delete m_decals[i]; } m_decals.Destroy(); + + m_root_node.Clear(); + m_root_node.SetTagName(L"xml"); // (sigh). + + SetChanged(); } const ON_DecalCollection& ON_DecalCollection::operator = (const ON_DecalCollection& dc) @@ -403,105 +1071,82 @@ const ON_DecalCollection& ON_DecalCollection::operator = (const ON_DecalCollecti return *this; } -bool ON_DecalCollection::NodeContainsDecals(const ON_XMLRootNode& node) // Static. +const ON_SimpleArray& ON_DecalCollection::GetDecalArray(void) const { - const wchar_t* path = ON_RDK_UD_ROOT ON_RDK_SLASH ON_RDK_UD_DECALS; - const ON_XMLNode* decals_node = node.GetNodeAtPath(path); - if (nullptr == decals_node) - return false; + if (!m_populated) + { + Populate(); - if (nullptr == decals_node->GetNamedChild(ON_RDK_UD_DECAL)) - return false; + m_populated = true; + } - return true; + return m_decals; } -void ON_DecalCollection::Populate(const ON_XMLRootNode& node) +void ON_DecalCollection::Populate(void) const { - DeleteAllDecals(); + if (nullptr == m_attr) + return; - const wchar_t* path = ON_RDK_UD_ROOT ON_RDK_SLASH ON_RDK_UD_DECALS; - ON_XMLNode* decals_node = node.GetNodeAtPath(path); - if (nullptr == decals_node) - return; // No decals. - - // Iterate over the decals under the decals node adding a new decal for each one. - // The decals copy the node into a local node which holds the XML for each decal - // in that decal. This XML will be modified by the decal setters and then repacked - // into the attribute user data later during the save process. - auto it = decals_node->GetChildIterator(); - ON_XMLNode* child_node = nullptr; - while (nullptr != (child_node = it.GetNextChild())) + if (GetEntireDecalXML(*m_attr, m_root_node)) { - m_decals.Append(new ON_Decal(*child_node)); + const wchar_t* path = ON_RDK_UD_ROOT ON_RDK_SLASH ON_DECALS; + ON_XMLNode* decals_node = m_root_node.GetNodeAtPath(path); + if (nullptr != decals_node) + { + // Iterate over the decals under the decals node adding a new decal for each one. + auto it = decals_node->GetChildIterator(); + ON_XMLNode* child_node = nullptr; + while (nullptr != (child_node = it.GetNextChild())) + { + auto* decal = new ON_Decal(*const_cast(this), *child_node); + m_decals.Append(decal); + } + } } } +void ON_DecalCollection::SetChanged(void) +{ + ON_ASSERT(m_populated); + + if (m_populated) + m_changed = true; +} + ON_Decal* ON_DecalCollection::AddDecal(void) { - ON_XMLNode node(ON_RDK_UD_DECAL); - auto* decal = new ON_Decal(node); - m_decals.Append(decal); + // Ensure the array is populated before adding a new decal. + GetDecalArray(); + + ON_Decal* decal = nullptr; + + ON_XMLNode* decals_node = m_root_node.CreateNodeAtPath(ON_RDK_UD_ROOT ON_RDK_SLASH ON_DECALS); + if (nullptr != decals_node) + { + // Add an XML node for the new decal. + auto* decal_node = new ON_XMLNode(ON_DECAL); + decals_node->AttachChildNode(decal_node); + + // Add the new decal. It stores a pointer to the new XML node. This is safe because + // the decals have the same lifetime as the root node that owns the XML nodes. + decal = new ON_Decal(*this, *decal_node); + m_decals.Append(decal); + + SetChanged(); + } return decal; } -void CreateDecalsFromXML(const ONX_Model& model, int archive_3dm_version) +void ON_DecalCollection::UpdateUserData(unsigned int archive_3dm_version) const { - ONX_ModelComponentIterator cit(model, ON_ModelComponent::Type::ModelGeometry); - - for (const ON_ModelComponent* component = cit.FirstComponent(); nullptr != component; component = cit.NextComponent()) + if (m_changed) { - const ON_3dmObjectAttributes* attr = GetComponentAttributes(*component); - if (nullptr == attr) - continue; // No attributes on component. + ON_ASSERT(m_populated); - // Get the entire XML off of the attributes user data. - ON_wString xml; - GetRDKObjectInformation(*attr, xml, archive_3dm_version); - if (xml.IsEmpty()) - continue; // No XML found on the component's attributes. + SetRDKObjectInformation(*m_attr, m_root_node.String(), archive_3dm_version); - ON_XMLRootNode node; - if (ON_XMLNode::ReadError != node.ReadFromStream(xml)) - { - attr->Internal_PopulateDecals(node); - } - else - { - ON_ERROR("Failed to read decal XML"); - } - } -} - -void CreateXMLFromDecals(const ONX_Model& model, int archive_3dm_version) -{ - ONX_ModelComponentIterator cit(model, ON_ModelComponent::Type::ModelGeometry); - - for (const ON_ModelComponent* component = cit.FirstComponent(); nullptr != component; component = cit.NextComponent()) - { - ON_3dmObjectAttributes* attr = GetComponentAttributes(*component); - if (nullptr == attr) - continue; // No attributes on component. - - const ON_SimpleArray& decals = attr->GetDecalArray(); - if (decals.Count() == 0) - continue; // No decals on attributes. - - ON_XMLRootNode root; - ON_XMLNode* decals_node = root.CreateNodeAtPath(ON_RDK_UD_ROOT ON_RDK_SLASH ON_RDK_UD_DECALS); - if (nullptr == decals_node) - continue; // Failed to create node -- not likely to happen. - - for (int i = 0; i < decals.Count(); i++) - { - const ON_Decal* decal = decals[i]; - if (nullptr != decal) - { - decals_node->AttachChildNode(new ON_XMLNode(decal->XML())); - } - } - - SetRDKObjectInformation(*attr, root.String(), archive_3dm_version); + m_changed = false; } } diff --git a/opennurbs_decals.h b/opennurbs_decals.h index a4023176..71389228 100644 --- a/opennurbs_decals.h +++ b/opennurbs_decals.h @@ -14,13 +14,13 @@ #if !defined(ON_DECALS_INC_) #define ON_DECALS_INC_ -class ON_CLASS ON_Decal final +class ON_CLASS ON_Decal { public: ON_Decal(); - ON_Decal(ON_XMLNode& model_node); + ON_Decal(class ON_DecalCollection& coll, ON_XMLNode& node); ON_Decal(const ON_Decal& d); - ~ON_Decal(); + virtual ~ON_Decal(); const ON_Decal& operator = (const ON_Decal& d); @@ -31,9 +31,9 @@ public: { None = -1, Planar = 0, // Planar mapping. Uses projection, origin, up and across vectors (not unitized). - Cylindrical = 1, // Cylindrical mapping. Uses origin, up, across, height, radius, latitude start and stop. - Spherical = 2, // Spherical mapping. Uses origin, up, across, radius, latitude/longitude start and stop. - UV = 3, // UV mapping. + Cylindrical = 1, // Cylindrical mapping. Uses origin, up, across, height, radius, horz-sweep. + Spherical = 2, // Spherical mapping. Uses origin, up, across, radius, horz-sweep, vert-sweep. + UV = 3, // UV mapping. Uses UV bounds. }; enum class Projections : ON__INT32 @@ -126,24 +126,52 @@ public: void SetVertSweep(double sta, double end); // Returns the UV bounds of the decal. Only used when mapping is UV. - void UVBounds(double& min_u, double& min_v, double& max_u, double& max_v) const; + void GetUVBounds(double& min_u, double& min_v, double& max_u, double& max_v) const; // Sets the UV bounds of the decal. Only used when mapping is UV. void SetUVBounds(double min_u, double min_v, double max_u, double max_v); - // Returns the CRC of the decal. + // Gets a texture mapping based on the properties of this decal. Only works and returns true if + // the decal mapping is Planar, Spherical or Cylindrical. Otherwise returns false. + bool GetTextureMapping(ON_TextureMapping& tm) const; + + // Returns the Decal CRC of the decal. + ON__UINT32 DecalCRC(void) const; + + // Returns the Data CRC of the decal. This is not necessarily the same as the decal CRC + // because it allows a starting current remainder. ON__UINT32 DataCRC(ON__UINT32 current_remainder) const; + // Returns true if the decal is visible in the rendering. + bool IsVisible(void) const; + + // Sets whether or not the decal is visible in the rendering. + void SetIsVisible(bool visible); + // Returns the unique id of the decal. This is a run-time id that is not persistent and is // only used for looking decals up in the model. ON_UUID Id(void) const; - // Get the decal XML. Intended for internal use only. - const ON_XMLNode& XML(void) const; + // Get the custom XML for the specified render engine. The format of the XML is described below. + void GetCustomXML(const ON_UUID& renderEngineId, ON_XMLNode& custom_param_node) const; + + // Set the custom XML for the specified render engine. This XML should have the following format: + // + // + // + // ... + // + // + // Therefore 'custom_param_node' must have a tag name of "". The easiest way to produce + // such XML is by using ON_XMLParameters. + bool SetCustomXML(const ON_UUID& renderEngineId, const ON_XMLNode& custom_param_node); + +public: // For internal use only. + static ON__UINT32 ComputeDecalCRC(ON__UINT32, const ON_XMLNode&); private: class CImpl; - CImpl* m_impl; + CImpl* _impl; }; #endif diff --git a/opennurbs_defines.cpp b/opennurbs_defines.cpp index 78554048..65e79f39 100644 --- a/opennurbs_defines.cpp +++ b/opennurbs_defines.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2021 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_detail.cpp b/opennurbs_detail.cpp index 1b3432f3..f063ec7f 100644 --- a/opennurbs_detail.cpp +++ b/opennurbs_detail.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_detail.h b/opennurbs_detail.h index f820423c..e4c68d98 100644 --- a/opennurbs_detail.h +++ b/opennurbs_detail.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_DETAIL_OBJECTY_INC_) #define ON_DETAIL_OBJECTY_INC_ diff --git a/opennurbs_dimension.cpp b/opennurbs_dimension.cpp index f8881304..7c32052f 100644 --- a/opennurbs_dimension.cpp +++ b/opennurbs_dimension.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_dimension.h b/opennurbs_dimension.h index 7b3b1d20..d8b79169 100644 --- a/opennurbs_dimension.h +++ b/opennurbs_dimension.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_DIMENSION_INC_) #define OPENNURBS_DIMENSION_INC_ diff --git a/opennurbs_dimensionformat.cpp b/opennurbs_dimensionformat.cpp index 974518fc..43b5b927 100644 --- a/opennurbs_dimensionformat.cpp +++ b/opennurbs_dimensionformat.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +9,6 @@ // // For complete openNURBS copyright information see . //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_dimensionformat.h b/opennurbs_dimensionformat.h index 628b3bbc..27510fdf 100644 --- a/opennurbs_dimensionformat.h +++ b/opennurbs_dimensionformat.h @@ -1,8 +1,5 @@ - -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -13,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ // ON_Table class #ifndef OPENNURBS_NUMBERFORMAT_H_INCLUDED diff --git a/opennurbs_dimensionstyle.cpp b/opennurbs_dimensionstyle.cpp index 7e2e3c9d..9cc97728 100644 --- a/opennurbs_dimensionstyle.cpp +++ b/opennurbs_dimensionstyle.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_dimensionstyle.h b/opennurbs_dimensionstyle.h index 82dddf8d..bd248167 100644 --- a/opennurbs_dimensionstyle.h +++ b/opennurbs_dimensionstyle.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_DIMENSIONSTYLE_INC_) #define OPENNURBS_DIMENSIONSTYLE_INC_ diff --git a/opennurbs_dithering.cpp b/opennurbs_dithering.cpp index 3294b831..d794eb29 100644 --- a/opennurbs_dithering.cpp +++ b/opennurbs_dithering.cpp @@ -1,4 +1,3 @@ -/* // // Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" #include "opennurbs_internal_defines.h" diff --git a/opennurbs_dithering.h b/opennurbs_dithering.h index 2ca3e818..e07aefd3 100644 --- a/opennurbs_dithering.h +++ b/opennurbs_dithering.h @@ -1,4 +1,3 @@ -/* // // Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_DITHERING_INC_) #define ON_DITHERING_INC_ @@ -21,13 +19,13 @@ class ON_CLASS ON_Dithering final public: ON_Dithering(); ON_Dithering(ON_XMLNode& model_node); - ON_Dithering(const ON_Dithering& lw); + ON_Dithering(const ON_Dithering& dit); ~ON_Dithering(); - const ON_Dithering& operator = (const ON_Dithering& lw); + const ON_Dithering& operator = (const ON_Dithering& dit); - bool operator == (const ON_Dithering& lw); - bool operator != (const ON_Dithering& lw); + bool operator == (const ON_Dithering& dit); + bool operator != (const ON_Dithering& dit); // Get dithering on / off state. bool On(void) const; @@ -46,7 +44,7 @@ public: // Returns the CRC of the dithering state. ON__UINT32 DataCRC(ON__UINT32 current_remainder) const; -public: +private: class CImpl; CImpl* m_impl; }; diff --git a/opennurbs_ellipse.cpp b/opennurbs_ellipse.cpp index 357a2ae7..187ed7c0 100644 --- a/opennurbs_ellipse.cpp +++ b/opennurbs_ellipse.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_ellipse.h b/opennurbs_ellipse.h index bb06f502..a2a30e93 100644 --- a/opennurbs_ellipse.h +++ b/opennurbs_ellipse.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_ELLIPSE_INC_) #define OPENNURBS_ELLIPSE_INC_ diff --git a/opennurbs_embedded_file.cpp b/opennurbs_embedded_file.cpp index 1be077b4..279ff877 100644 --- a/opennurbs_embedded_file.cpp +++ b/opennurbs_embedded_file.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_error.h b/opennurbs_error.h index 6548dace..a8db9080 100644 --- a/opennurbs_error.h +++ b/opennurbs_error.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_ERROR_INC_) #define OPENNURBS_ERROR_INC_ diff --git a/opennurbs_error_message.cpp b/opennurbs_error_message.cpp index c07eff65..0f9fc359 100644 --- a/opennurbs_error_message.cpp +++ b/opennurbs_error_message.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_evaluate_nurbs.cpp b/opennurbs_evaluate_nurbs.cpp index b1be41a7..513d2f56 100644 --- a/opennurbs_evaluate_nurbs.cpp +++ b/opennurbs_evaluate_nurbs.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_evaluate_nurbs.h b/opennurbs_evaluate_nurbs.h index dad505c3..ee196f0d 100644 --- a/opennurbs_evaluate_nurbs.h +++ b/opennurbs_evaluate_nurbs.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_EVALUATE_NURBS_INC_) #define ON_EVALUATE_NURBS_INC_ diff --git a/opennurbs_extensions.cpp b/opennurbs_extensions.cpp index 12356b6f..c3059e68 100644 --- a/opennurbs_extensions.cpp +++ b/opennurbs_extensions.cpp @@ -294,14 +294,14 @@ ON_3dmObjectAttributes* GetComponentAttributes(const ON_ModelComponent& componen return mgc->ExclusiveAttributes(); } -class ONX_Model::Extension final +class ONX_ModelPrivate final { public: - Extension(ONX_Model& m); - ~Extension(); + ONX_ModelPrivate(ONX_Model& m); + ~ONX_ModelPrivate(); using EmbeddedFileMap = std::unordered_map; - + bool GetRDKDocumentXML(ON_wString& xml, bool embedded_files, int archive_3dm_version) const; ONX_Model_UserData* GetRDKDocumentUserData(int archive_3dm_version) const; void PopulateDefaultRDKDocumentXML(ON_XMLRootNode& root) const; @@ -319,30 +319,41 @@ public: public: ONX_Model& m_model; - ON_ClassArray m_mcr_lists; - ON_XMLRootNode m_doc_node; - ON_SafeFrame m_safe_frame; - ON_GroundPlane m_ground_plane; - ON_LinearWorkflow m_linear_workflow; - ON_InternalXMLImpl m_environment_impl; - ON_Skylight m_skylight; - ON_Sun m_sun; - ON_Dithering m_dithering; - ON_RenderChannels m_render_channels; ON__UINT64 m_model_content_version_number = 0; + ON_ClassArray m_mcr_lists; }; +ON_InternalXMLImpl::~ON_InternalXMLImpl() +{ + if (nullptr != m_local_node) + { + delete m_local_node; + m_local_node = nullptr; + } +} + ON_XMLNode& ON_InternalXMLImpl::Node(void) const { + // If the model node pointer is set, return that. This is a pointer to a node owned by the ONX_Model which + // contains the entire RDK document XML. This is used by model objects (Ground Plane, etc.) that are owned + // by the ONX_Model. In the case of Ground Plane etc, it's a pointer into the ONX_Model's XML. + // In the case of decals, it's a pointer into the decal collection's XML. if (nullptr != m_model_node) return *m_model_node; - return m_local_node; + // Since the model node is not set, we need a local node to hold the XML. If one has not been created yet, + // create it. The local node is owned by this object. This case occurs for free-floating copies of model + // objects and also for free-floating copies of decals and mesh modifiers. This node only contains the XML + // data that's relevant to the object it's for, not the entire XML. + if (nullptr == m_local_node) + m_local_node = new ON_XMLNode(NameOfRootNode()); + + return *m_local_node; } -ON_XMLNode& ON_InternalXMLImpl::NodeAt(const wchar_t* path_to_node) const +ON_wString ON_InternalXMLImpl::NameOfRootNode(void) const { - return *Node().CreateNodeAtPath(path_to_node); + return ON_XMLRootNode().TagName(); } ON_XMLVariant ON_InternalXMLImpl::GetParameter(const wchar_t* path_to_node, const wchar_t* param_name, const ON_XMLVariant& def) const @@ -357,10 +368,14 @@ ON_XMLVariant ON_InternalXMLImpl::GetParameter_NoType(const wchar_t* path_to_nod ON_XMLVariant ON_InternalXMLImpl::InternalGetParameter(const wchar_t* path_to_node, const wchar_t* param_name, const wchar_t* default_type, const ON_XMLVariant& def) const { - const ON_XMLNode& node = NodeAt(path_to_node); + std::lock_guard lg(m_mutex); + + const ON_XMLNode* node_read = Node().GetNodeAtPath(path_to_node); + if (nullptr == node_read) + return def; ON_XMLVariant value; - ON_XMLParameters p(node); + ON_XMLParameters p(*node_read); p.SetDefaultReadType(default_type); if (!p.GetParam(param_name, value)) return def; @@ -380,36 +395,33 @@ bool ON_InternalXMLImpl::SetParameter_NoType(const wchar_t* path_to_node, const bool ON_InternalXMLImpl::InternalSetParameter(const wchar_t* path_to_node, const wchar_t* param_name, bool write_type, const ON_XMLVariant& value) { - ON_XMLNode& node = NodeAt(path_to_node); + std::lock_guard lg(m_mutex); - ON_XMLParameters p(node); - p.SetWriteTypeProperty(write_type); - if (nullptr == p.SetParam(param_name, value)) - return false; + bool success = false; -#ifdef DEBUG_XML - auto s = m_local_node.String(); - if (s.IsNotEmpty()) + ON_XMLNode* node_write = Node().CreateNodeAtPath(path_to_node); + if (nullptr != node_write) { - OutputDebugString(s); - OutputDebugString(L"\n"); + ON_XMLParameters p(*node_write); + p.SetWriteTypeProperty(write_type); + if (nullptr != p.SetParam(param_name, value)) + success = true; } -#endif - return true; + return success; } ONX_Model::ONX_Model() { - m_extension = new Extension(*this); + m_private = new ONX_ModelPrivate(*this); } ONX_Model::~ONX_Model() { Reset(); - delete m_extension; - m_extension = nullptr; + delete m_private; + m_private = nullptr; } void ONX_Model::Reset() @@ -426,9 +438,9 @@ void ONX_Model::Reset() } m_userdata_table.Destroy(); - for (int i = 0; i < m_extension->m_mcr_lists.Count(); i++) + for (int i = 0; i < m_private->m_mcr_lists.Count(); i++) { - ONX_ModelComponentList& list = m_extension->m_mcr_lists[i]; + ONX_ModelComponentList& list = m_private->m_mcr_lists[i]; ONX_ModelComponentReferenceLink* mcr_link = list.m_first_mcr_link; while (nullptr != mcr_link) @@ -1695,9 +1707,9 @@ ONX_Model::ONX_ModelComponentList& ONX_Model::Internal_ComponentList( { const int i = static_cast(component_type); return - (i < ONX_Model::m_extension->m_mcr_lists.Count()) - ? m_extension->m_mcr_lists[i] - : m_extension->m_mcr_lists[0]; + (i < ONX_Model::m_private->m_mcr_lists.Count()) + ? m_private->m_mcr_lists[i] + : m_private->m_mcr_lists[0]; } const ONX_Model::ONX_ModelComponentList& ONX_Model::Internal_ComponentListConst( @@ -1706,9 +1718,9 @@ const ONX_Model::ONX_ModelComponentList& ONX_Model::Internal_ComponentListConst( { const int i = static_cast(component_type); return - (i < ONX_Model::m_extension->m_mcr_lists.Count()) - ? m_extension->m_mcr_lists[i] - : m_extension->m_mcr_lists[0]; + (i < ONX_Model::m_private->m_mcr_lists.Count()) + ? m_private->m_mcr_lists[i] + : m_private->m_mcr_lists[0]; } ON_ModelComponentReference ONX_Model::Internal_AddModelComponent( @@ -1976,7 +1988,7 @@ ON_ModelComponentReference ONX_Model::MaterialFromIndex( int material_index ) const { - ON_ModelComponentReference cr = ComponentFromIndex(ON_ModelComponent::Type::RenderMaterial, material_index); + ON_ModelComponentReference cr = ComponentFromIndex(ON_ModelComponent::Type::Material, material_index); return cr.IsEmpty() ? m_default_render_material : cr; } @@ -1984,7 +1996,7 @@ ON_ModelComponentReference ONX_Model::MaterialFromId( ON_UUID material_id ) const { - ON_ModelComponentReference cr = ComponentFromId(ON_ModelComponent::Type::RenderMaterial, material_id); + ON_ModelComponentReference cr = ComponentFromId(ON_ModelComponent::Type::Material, material_id); return cr.IsEmpty() ? m_default_render_material : cr; } @@ -2985,7 +2997,7 @@ bool ONX_Model::Read(ON_BinaryArchive& archive, unsigned int table_filter, // Having read the model data, populate the RDK components. const int archive_3dm_version = archive.Archive3dmVersion(); - m_extension->PopulateRDKComponents(archive_3dm_version); + m_private->PopulateRDKComponents(archive_3dm_version); return true; } @@ -3038,7 +3050,7 @@ bool ONX_Model::Write(const wchar_t* filename, int version, ON_TextLog* error_lo bool ONX_Model::Write(ON_BinaryArchive& archive, int version, ON_TextLog* error_log) const { - m_extension->UpdateRDKUserData(version); + m_private->UpdateRDKUserData(version); if ( 0 != version ) { @@ -3608,12 +3620,12 @@ int ONX_Model::UsesIDef( ON__UINT64 ONX_Model::ModelContentVersionNumber() const { - return m_extension->m_model_content_version_number; + return m_private->m_model_content_version_number; } void ONX_Model::Internal_IncrementModelContentVersionNumber() { - m_extension->m_model_content_version_number++; + m_private->m_model_content_version_number++; } bool ONX_Model::SetDocumentUserString( const wchar_t* key, const wchar_t* string_value ) @@ -4846,17 +4858,9 @@ static const wchar_t* PostEffectTypeString(ON_PostEffect::Types type) extern int ON_ComponentManifestImpl_TableCount(void); -ONX_Model::Extension::Extension(ONX_Model& m) +ONX_ModelPrivate::ONX_ModelPrivate(ONX_Model& m) : - m_model(m), - m_safe_frame(m_doc_node), - m_ground_plane(m_doc_node), - m_linear_workflow(m_doc_node), - m_environment_impl(&m_doc_node), - m_skylight(m_doc_node), - m_sun(m_doc_node), - m_dithering(m_doc_node), - m_render_channels(m_doc_node) + m_model(m) { // If this assert fires, you must change the TableCount enum in opennurbs_archive_manifest.cpp // to be the same number as ON_ModelComponent::Type::NumOf. @@ -4864,16 +4868,16 @@ ONX_Model::Extension::Extension(ONX_Model& m) for (unsigned int i = 0; i < int(ON_ModelComponent::Type::NumOf); i++) { - ONX_ModelComponentList& list = m_mcr_lists.AppendNew(); + ONX_Model::ONX_ModelComponentList& list = m_mcr_lists.AppendNew(); list.m_component_type = ON_ModelComponent::ComponentTypeFromUnsigned(i); } } -ONX_Model::Extension::~Extension() +ONX_ModelPrivate::~ONX_ModelPrivate() { } -ONX_Model_UserData* ONX_Model::Extension::GetRDKDocumentUserData(int archive_3dm_version) const +ONX_Model_UserData* ONX_ModelPrivate::GetRDKDocumentUserData(int archive_3dm_version) const { // Try to find existing RDK document user data. for (int i = 0; i < m_model.m_userdata_table.Count(); i++) @@ -4902,7 +4906,7 @@ ONX_Model_UserData* ONX_Model::Extension::GetRDKDocumentUserData(int archive_3dm return ud; } -void ONX_Model::Extension::PopulateDefaultRDKDocumentXML(ON_XMLRootNode& root) const +void ONX_ModelPrivate::PopulateDefaultRDKDocumentXML(ON_XMLRootNode& root) const { // Populate default render content kinds. GetRenderContentSectionNode(root, RenderContentKinds::Material); @@ -4910,7 +4914,7 @@ void ONX_Model::Extension::PopulateDefaultRDKDocumentXML(ON_XMLRootNode& root) c GetRenderContentSectionNode(root, RenderContentKinds::Texture); } -bool ONX_Model::Extension::GetRDKDocumentXML(ON_wString& xml, bool embedded_files, int archive_3dm_version) const +bool ONX_ModelPrivate::GetRDKDocumentXML(ON_wString& xml, bool embedded_files, int archive_3dm_version) const { // Gets the entire RDK document XML as a string in 'xml'. If 'embedded_files' is true, // ON_EmbeddedFile objects are created for each embedded file. @@ -4938,7 +4942,7 @@ static bool ContentIsKind(const ON_RenderContent* pContent, RenderContentKinds k return false; } -ON_XMLNode* ONX_Model::Extension::GetPostEffectSectionNode(ON_XMLNode& docNode, ON_PostEffect::Types type) const +ON_XMLNode* ONX_ModelPrivate::GetPostEffectSectionNode(ON_XMLNode& docNode, ON_PostEffect::Types type) const { ON_wString s = ON_RDK_DOCUMENT ON_RDK_SLASH ON_RDK_SETTINGS ON_RDK_SLASH ON_RDK_POST_EFFECTS ON_RDK_SLASH; s += PostEffectTypeString(type); @@ -4946,7 +4950,7 @@ ON_XMLNode* ONX_Model::Extension::GetPostEffectSectionNode(ON_XMLNode& docNode, return docNode.CreateNodeAtPath(s); } -ON_XMLNode* ONX_Model::Extension::GetRenderContentSectionNode(ON_XMLNode& docNode, RenderContentKinds kind) const +ON_XMLNode* ONX_ModelPrivate::GetRenderContentSectionNode(ON_XMLNode& docNode, RenderContentKinds kind) const { ON_wString s = ON_RDK_DOCUMENT ON_RDK_SLASH; s += RenderContentKindString(kind); @@ -4955,7 +4959,7 @@ ON_XMLNode* ONX_Model::Extension::GetRenderContentSectionNode(ON_XMLNode& docNod return docNode.CreateNodeAtPath(s); } -bool ONX_Model::Extension::CreateRenderContentFromXML(ON_XMLNode& model_node, RenderContentKinds kind) +bool ONX_ModelPrivate::CreateRenderContentFromXML(ON_XMLNode& model_node, RenderContentKinds kind) { const ON_XMLNode* rc_section_node = GetRenderContentSectionNode(model_node, kind); if (nullptr == rc_section_node) @@ -4985,7 +4989,7 @@ bool ONX_Model::Extension::CreateRenderContentFromXML(ON_XMLNode& model_node, Re return true; } -bool ONX_Model::Extension::CreateXMLFromRenderContent(ON_XMLNode& model_node, RenderContentKinds kind) const +bool ONX_ModelPrivate::CreateXMLFromRenderContent(ON_XMLNode& model_node, RenderContentKinds kind) const { ON_XMLNode* rc_section_node = GetRenderContentSectionNode(model_node, kind); if (nullptr == rc_section_node) @@ -5012,7 +5016,7 @@ bool ONX_Model::Extension::CreateXMLFromRenderContent(ON_XMLNode& model_node, Re return true; } -bool ONX_Model::Extension::CreatePostEffectsFromXML(ON_XMLNode& doc_root_node, ON_PostEffect::Types type) +bool ONX_ModelPrivate::CreatePostEffectsFromXML(ON_XMLNode& doc_root_node, ON_PostEffect::Types type) { ON_XMLNode* pep_section_node = GetPostEffectSectionNode(doc_root_node, type); if (nullptr == pep_section_node) @@ -5037,7 +5041,7 @@ bool ONX_Model::Extension::CreatePostEffectsFromXML(ON_XMLNode& doc_root_node, O return true; } -bool ONX_Model::Extension::CreateXMLFromPostEffects(ON_XMLNode& doc_root_node, ON_PostEffect::Types type) const +bool ONX_ModelPrivate::CreateXMLFromPostEffects(ON_XMLNode& doc_root_node, ON_PostEffect::Types type) const { ON_XMLNode* pep_section_node = GetPostEffectSectionNode(doc_root_node, type); if (nullptr == pep_section_node) @@ -5063,7 +5067,7 @@ bool ONX_Model::Extension::CreateXMLFromPostEffects(ON_XMLNode& doc_root_node, O return true; } -bool ONX_Model::Extension::PopulateRDKComponents(int archive_3dm_version) +bool ONX_ModelPrivate::PopulateRDKComponents(int archive_3dm_version) { // Get the entire RDK document XML. This includes not only render contents // but also Sun, GroundPlane and other RDK document data. Ignore embedded files. @@ -5071,23 +5075,21 @@ bool ONX_Model::Extension::PopulateRDKComponents(int archive_3dm_version) if (!GetRDKDocumentXML(xml, true, archive_3dm_version)) return false; - // Read the entire XML into m_doc_node. - const auto read = m_doc_node.ReadFromStream(xml, false, true); + // Read the entire XML into the document node. + ON_XMLNode& doc_node = m_model.m_settings.m_RenderSettings.RdkDocNode(); + const auto read = doc_node.ReadFromStream(xml, false, true); if (ON_XMLNode::ReadError == read) return false; // Create the render contents from the relevant nodes. - CreateRenderContentFromXML(m_doc_node, RenderContentKinds::Material); - CreateRenderContentFromXML(m_doc_node, RenderContentKinds::Environment); - CreateRenderContentFromXML(m_doc_node, RenderContentKinds::Texture); + CreateRenderContentFromXML(doc_node, RenderContentKinds::Material); + CreateRenderContentFromXML(doc_node, RenderContentKinds::Environment); + CreateRenderContentFromXML(doc_node, RenderContentKinds::Texture); // Create the post effects from the relevant nodes. - CreatePostEffectsFromXML(m_doc_node, ON_PostEffect::Types::Early); - CreatePostEffectsFromXML(m_doc_node, ON_PostEffect::Types::ToneMapping); - CreatePostEffectsFromXML(m_doc_node, ON_PostEffect::Types::Late); - - // Create the decal collection. - CreateDecalsFromXML(m_model, archive_3dm_version); + CreatePostEffectsFromXML(doc_node, ON_PostEffect::Types::Early); + CreatePostEffectsFromXML(doc_node, ON_PostEffect::Types::ToneMapping); + CreatePostEffectsFromXML(doc_node, ON_PostEffect::Types::Late); // Create the mesh modifiers. CreateMeshModifiersFromXML(m_model, archive_3dm_version); @@ -5095,23 +5097,22 @@ bool ONX_Model::Extension::PopulateRDKComponents(int archive_3dm_version) return true; } -bool ONX_Model::Extension::UpdateRDKUserData(int archive_3dm_version) +bool ONX_ModelPrivate::UpdateRDKUserData(int archive_3dm_version) { if (0 == archive_3dm_version) archive_3dm_version = ON_BinaryArchive::CurrentArchiveVersion(); + ON_XMLNode& doc_node = m_model.m_settings.m_RenderSettings.RdkDocNode(); + // For each kind, convert the render content hierarchy to fresh XML. - CreateXMLFromRenderContent(m_doc_node, RenderContentKinds::Material); - CreateXMLFromRenderContent(m_doc_node, RenderContentKinds::Environment); - CreateXMLFromRenderContent(m_doc_node, RenderContentKinds::Texture); + CreateXMLFromRenderContent(doc_node, RenderContentKinds::Material); + CreateXMLFromRenderContent(doc_node, RenderContentKinds::Environment); + CreateXMLFromRenderContent(doc_node, RenderContentKinds::Texture); // For each type, convert the post effects to fresh XML. - CreateXMLFromPostEffects(m_doc_node, ON_PostEffect::Types::Early); - CreateXMLFromPostEffects(m_doc_node, ON_PostEffect::Types::ToneMapping); - CreateXMLFromPostEffects(m_doc_node, ON_PostEffect::Types::Late); - - // Convert the decal collection to fresh XML. - CreateXMLFromDecals(m_model, archive_3dm_version); + CreateXMLFromPostEffects(doc_node, ON_PostEffect::Types::Early); + CreateXMLFromPostEffects(doc_node, ON_PostEffect::Types::ToneMapping); + CreateXMLFromPostEffects(doc_node, ON_PostEffect::Types::Late); // Convert the mesh modifier collection to fresh XML. CreateXMLFromMeshModifiers(m_model, archive_3dm_version); @@ -5122,134 +5123,13 @@ bool ONX_Model::Extension::UpdateRDKUserData(int archive_3dm_version) return false; // Shouldn't happen because we were able to get the XML earlier. // Get the entire document XML as a string and set it to the user data. - ON_wString xml = m_doc_node.String(); + ON_wString xml = doc_node.String(); pUserData->m_usertable_3dm_version = archive_3dm_version; SetRDKDocumentInformation(xml, *pUserData, archive_3dm_version); return true; } -ON_SafeFrame& ONX_Model::SafeFrame(void) const -{ - return m_extension->m_safe_frame; -} - -ON_GroundPlane& ONX_Model::GroundPlane(void) const -{ - return m_extension->m_ground_plane; -} - -ON_LinearWorkflow& ONX_Model::LinearWorkflow(void) const -{ - return m_extension->m_linear_workflow; -} - -// This is inside the 'current content' section. -#define ON_RENDER_BACKGROUND_ENVIRONMENT L"environment" - -// These are inside the 'rendering' section. -#define ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT_ON L"custom-env-for-refl-and-refr-on" -#define ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT L"custom-env-for-refl-and-refr" - -// These are inside the 'sun' section. -#define ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT_ON L"skylight-custom-environment-on" -#define ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT L"skylight-custom-environment" - -static const wchar_t* XMLPathBack360(void) // Not used for 'override'. -{ - return ON_RDK_DOCUMENT ON_RDK_SLASH ON_RDK_CURRENT_CONTENT; -} - -static const wchar_t* XMLPathReflRefr(void) -{ - return ON_RDK_DOCUMENT ON_RDK_SLASH ON_RDK_SETTINGS ON_RDK_SLASH ON_RDK_RENDERING; -} - -static const wchar_t* XMLPathSkylight(void) -{ - return ON_RDK_DOCUMENT ON_RDK_SLASH ON_RDK_SETTINGS ON_RDK_SLASH ON_RDK_SUN; -} - -ON_UUID ONX_Model::BackgroundRenderEnvironment(void) const -{ - const wchar_t* s = ON_RENDER_BACKGROUND_ENVIRONMENT; - return m_extension->m_environment_impl.GetParameter_NoType(XMLPathBack360(), s, L"uuid", ON_nil_uuid).AsUuid(); -} - -void ONX_Model::SetBackgroundRenderEnvironment(const ON_UUID& id) -{ - const wchar_t* s = ON_RENDER_BACKGROUND_ENVIRONMENT; - m_extension->m_environment_impl.SetParameter_NoType(XMLPathBack360(), s, id); -} - -bool ONX_Model::SkylightingRenderEnvironmentOverride(void) const -{ - const wchar_t* s = ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT_ON; - return m_extension->m_environment_impl.GetParameter(XMLPathSkylight(), s, false); -} - -void ONX_Model::SetSkylightingRenderEnvironmentOverride(bool on) -{ - const wchar_t* s = ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT_ON; - m_extension->m_environment_impl.SetParameter(XMLPathSkylight(), s, on); -} - -ON_UUID ONX_Model::SkylightingRenderEnvironment(void) const -{ - const wchar_t* s = ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT; - return m_extension->m_environment_impl.GetParameter_NoType(XMLPathSkylight(), s, L"uuid", ON_nil_uuid).AsUuid(); -} - -void ONX_Model::SetSkylightingRenderEnvironment(const ON_UUID& id) -{ - const wchar_t* s = ON_RENDER_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT; - m_extension->m_environment_impl.SetParameter_NoType(XMLPathSkylight(), s, id); -} - -bool ONX_Model::ReflectionRenderEnvironmentOverride(void) const -{ - const wchar_t* s = ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT_ON; - return m_extension->m_environment_impl.GetParameter(XMLPathReflRefr(), s, false); -} - -void ONX_Model::SetReflectionRenderEnvironmentOverride(bool on) -{ - const wchar_t* s = ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT_ON; - m_extension->m_environment_impl.SetParameter(XMLPathReflRefr(), s, on); -} - -ON_UUID ONX_Model::ReflectionRenderEnvironment(void) const -{ - const wchar_t* s = ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT; - return m_extension->m_environment_impl.GetParameter_NoType(XMLPathReflRefr(), s, L"uuid", ON_nil_uuid).AsUuid(); -} - -void ONX_Model::SetReflectionRenderEnvironment(const ON_UUID& id) -{ - const wchar_t* s = ON_RENDER_CUSTOM_REFLECTIVE_ENVIRONMENT; - m_extension->m_environment_impl.SetParameter_NoType(XMLPathReflRefr(), s, id); -} - -ON_Skylight& ONX_Model::Skylight(void) const -{ - return m_extension->m_skylight; -} - -ON_Sun& ONX_Model::Sun(void) const -{ - return m_extension->m_sun; -} - -ON_Dithering& ONX_Model::Dithering(void) const -{ - return m_extension->m_dithering; -} - -ON_RenderChannels& ONX_Model::RenderChannels(void) const -{ - return m_extension->m_render_channels; -} - bool IsRDKDocumentInformation(const ONX_Model_UserData& docud) { return (0 == ON_UuidCompare(RdkPlugInId(), docud.m_uuid)) && (docud.m_goo.m_value >= 4) && (nullptr != docud.m_goo.m_goo); @@ -5282,7 +5162,7 @@ bool ONX_Model::GetRDKEmbeddedFiles(const ONX_Model_UserData& docud, ON_ClassArr bool ONX_Model::GetRDKDocumentInformation(const ONX_Model_UserData& docud, ON_wString& xml) // Static. { - return Extension::GetEntireRDKDocument(docud, xml, nullptr); + return ONX_ModelPrivate::GetEntireRDKDocument(docud, xml, nullptr); } static int SeekArchiveToEmbeddedFiles(ON_Read3dmBufferArchive& archive, int goo_length) @@ -5499,7 +5379,7 @@ bool ONX_Model::GetRDKEmbeddedFile(const ONX_Model_UserData& docud, const wchar_ return found; } -void ONX_Model::Extension::RemoveAllEmbeddedFiles(ONX_Model& model) +void ONX_ModelPrivate::RemoveAllEmbeddedFiles(ONX_Model& model) { ON_SimpleArray a; const auto type = ON_ModelComponent::Type::EmbeddedFile; @@ -5519,7 +5399,7 @@ void ONX_Model::Extension::RemoveAllEmbeddedFiles(ONX_Model& model) } } -bool ONX_Model::Extension::GetEntireRDKDocument(const ONX_Model_UserData& docud, ON_wString& xml, ONX_Model* model) // Static. +bool ONX_ModelPrivate::GetEntireRDKDocument(const ONX_Model_UserData& docud, ON_wString& xml, ONX_Model* model) // Static. { if (!::IsRDKDocumentInformation(docud)) return false; @@ -5603,7 +5483,7 @@ bool ONX_Model::Extension::GetEntireRDKDocument(const ONX_Model_UserData& docud, return xml.Length() > 0; } -bool ONX_Model::Extension::SetRDKDocumentInformation(const wchar_t* xml, ONX_Model_UserData& docud, int archive_3dm_version) const +bool ONX_ModelPrivate::SetRDKDocumentInformation(const wchar_t* xml, ONX_Model_UserData& docud, int archive_3dm_version) const { ON_Write3dmBufferArchive archive(0, 0, docud.m_usertable_3dm_version, docud.m_usertable_opennurbs_version); @@ -5697,7 +5577,7 @@ bool ONX_Model::IsRDKObjectInformation(const ON_UserData& objectud) // Static. return nullptr != RDKObjectUserDataHelper(&objectud); } -bool CreateArchiveBufferFromXML(const ON_wString& xml, ON_Buffer& buf, int archive_3dm_version) +static bool CreateArchiveBufferFromXML(const ON_wString& xml, ON_Buffer& buf, int archive_3dm_version) { const auto archive_opennurbs_version_number = ON::Version(); // I don't know if this is correct. @@ -5790,8 +5670,11 @@ bool SetRDKObjectInformation(ON_Object& object, const ON_wString& xml, int archi return true; } -bool GetRDKObjectInformation(const ON_Object& object, ON_wString& xml, int archive_3dm_version) // Static. +static bool GetRDKObjectInformation(const ON_Object& object, ON_wString& xml, int archive_3dm_version) { + if (0 == archive_3dm_version) + archive_3dm_version = ON_BinaryArchive::CurrentArchiveVersion(); + xml.SetLength(0); const ON_UserData* rdk_ud = nullptr; @@ -5882,6 +5765,20 @@ bool GetRDKObjectInformation(const ON_Object& object, ON_wString& xml, int archi return xml.Length() > 0; } +bool GetEntireDecalXML(const ON_3dmObjectAttributes& attr, ON_XMLRootNode& xmlOut) +{ + // Get the entire XML off of the attributes user data. At the moment (V8) this can only contain decals. + ON_wString xml; + if (!GetRDKObjectInformation(attr, xml, 0)) + return false; // No XML on attributes. + + // Read the XML into a root node. + if (ON_XMLNode::ReadError == xmlOut.ReadFromStream(xml)) + return false; // Failed to read XML. + + return true; +} + static bool GetMeshModifierUserDataXML(ON_UserData& ud, ON_wString& xml, int archive_3dm_version) { ON_Buffer buf; @@ -6026,9 +5923,10 @@ static ON_UserData* GetMeshModifierUserData(ON_Object& object, const ON_UUID& uu { new_ud->SetToDefaults(); // This doesn't work because the XML gets overwritten by the cached XML. // In fact, having cached XML in this and decals is the reason why the systems are wrong. - // I'm about to fix the decals to not have cached XML and directly use the user data. After - // that I'll do the same for mesh modifiers. Then, this should work because there is no longer - // an XML cache to overwrite the new defaults in the user data's XML. + // NO! LIGHT BULB MOMENT says that's not why it's wrong. Something else is wrong here. + // I'm about to fix the decals to not have cached XML and directly use the user data. NO! After + // that I'll do the same for mesh modifiers. NO! Then, this should work because there is no longer + // an XML cache to overwrite the new defaults in the user data's XML. NO! if (!object.AttachUserData(new_ud)) { @@ -6040,17 +5938,13 @@ static ON_UserData* GetMeshModifierUserData(ON_Object& object, const ON_UUID& uu return new_ud; } -void SetMeshModifierObjectInformation(ON_Object& object, const ON_MeshModifier* mm, const ON_XMLNode& node, int archive_3dm_version, const wchar_t* mm_node_name) +void SetMeshModifierObjectInformation(ON_Object& object, const ON_MeshModifier* mm, int archive_3dm_version) { if (nullptr == mm) - return; // Don't create user data for non-existent mesh modifiers. - - const ON_XMLNode* mm_node = node.GetNamedChild(mm_node_name); - if (nullptr == mm_node) - return; // Don't create user data for non-existent mesh modifier. + return; // Can't create user data for non-existent mesh modifiers. ON_XMLRootNode root; - root.AttachChildNode(new ON_XMLNode(*mm_node)); + mm->AddChildXML(root); ON_UserData* ud = GetMeshModifierUserData(object, mm->Uuid()); if (nullptr != ud) diff --git a/opennurbs_extensions.h b/opennurbs_extensions.h index 3d8579db..3069d56f 100644 --- a/opennurbs_extensions.h +++ b/opennurbs_extensions.h @@ -1364,9 +1364,9 @@ private: bool bUpdateComponentIdentification ); -public: - class Extension; - Extension* m_extension; +private: // Private extension. + friend class ONX_ModelPrivate; + class ONX_ModelPrivate* m_private; private: void Internal_IncrementModelContentVersionNumber(); @@ -1590,43 +1590,6 @@ public: // BEGIN Rendering information // - // Safe Frame. - ON_SafeFrame& SafeFrame(void) const; - - // Ground Plane. - ON_GroundPlane& GroundPlane(void) const; - - // Linear Workflow. - ON_LinearWorkflow& LinearWorkflow(void) const; - - // Background rendering environment. - ON_UUID BackgroundRenderEnvironment(void) const; - void SetBackgroundRenderEnvironment(const ON_UUID& id); - - // Skylighting rendering environment. - bool SkylightingRenderEnvironmentOverride(void) const; - void SetSkylightingRenderEnvironmentOverride(bool on); - ON_UUID SkylightingRenderEnvironment(void) const; - void SetSkylightingRenderEnvironment(const ON_UUID& id); - - // Reflection / refraction rendering environment. - bool ReflectionRenderEnvironmentOverride(void) const; - void SetReflectionRenderEnvironmentOverride(bool on); - ON_UUID ReflectionRenderEnvironment(void) const; - void SetReflectionRenderEnvironment(const ON_UUID& id); - - // Skylight. - ON_Skylight& Skylight(void) const; - - // Sun. - ON_Sun& Sun(void) const; - - // Dithering. - ON_Dithering& Dithering(void) const; - - // Render Channels. - ON_RenderChannels& RenderChannels(void) const; - ON_DEPRECATED_MSG("This function is deprecated.") static bool IsRDKDocumentInformation(const ONX_Model_UserData& docud); diff --git a/opennurbs_file_utilities.cpp b/opennurbs_file_utilities.cpp index b1470318..9a8df8ba 100644 --- a/opennurbs_file_utilities.cpp +++ b/opennurbs_file_utilities.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -4230,3 +4228,353 @@ bool ON_FileSystemPath::IsDirectory( { return ON_FileSystem::IsDirectory(path); } + +// ON_UnicodeTextFile + +class ON_File +{ +public: + virtual ~ON_File() { } + + bool Open(const wchar_t* filename, const wchar_t* mode) { m_pFile = ON_FileStream::Open(filename, mode); return nullptr != m_pFile; } + bool Close(void) const { return ON_FileStream::Close(m_pFile) == 0; } + bool SeekFromCurrentPosition(ON__INT64 offset) const { return ON_FileStream::SeekFromCurrentPosition(m_pFile, offset); } + bool SeekFromStart(ON__INT64 offset) const { return ON_FileStream::SeekFromStart(m_pFile, offset); } + bool SeekFromEnd(ON__INT64 offset) const { return ON_FileStream::SeekFromEnd(m_pFile, offset); } + bool Seek(ON__INT64 offset, int origin) const { return ON_FileStream::Seek(m_pFile, offset, origin); } + ON__INT64 CurrentPosition(void) const { return ON_FileStream::CurrentPosition(m_pFile); } + ON__UINT64 Read(ON__UINT64 count, void* buffer) const { return ON_FileStream::Read(m_pFile, count, buffer); } + ON__UINT64 Write(ON__UINT64 count, const void* buffer) const { return ON_FileStream::Write(m_pFile, count, buffer); } + + ON__UINT64 GetLength(void) const + { + const auto cur = CurrentPosition(); + SeekFromEnd(0); + const auto end = CurrentPosition(); + SeekFromStart(cur); + + return end; + } + +private: + FILE* m_pFile = nullptr; +}; + +class ON_UnicodeTextFile::CImpl final +{ +public: + ~CImpl() { Close(); } + + bool Open(const wchar_t* wszFullPath, Modes mode); + bool Close(void); + bool ReadString(ON_wString& s); + bool WriteString(const wchar_t* wsz); + bool ReadHeader(Types& t); + bool WriteHeader(void); + bool ReadStringFromUTF8(ON_wString& s); + bool ReadStringFromUTF16(ON_wString& s); + bool WriteStringToUTF8(const wchar_t* wsz); + bool WriteStringToUTF16(const wchar_t* wsz); + size_t ReadData(void* buf, size_t bytes_to_read); + size_t WriteData(const void* buf, size_t bytes_to_write); + +public: + ON_File m_File; + Types m_Type = Types::Unknown; +}; + +size_t ON_UnicodeTextFile::CImpl::ReadData(void* buf, size_t bytes_to_read) +{ + return m_File.Read(bytes_to_read, buf); +} + +size_t ON_UnicodeTextFile::CImpl::WriteData(const void* buf, size_t bytes_to_write) +{ + return m_File.Write(bytes_to_write, buf); +} + +static const wchar_t* FileStreamMode(ON_UnicodeTextFile::Modes m) +{ + if (m == ON_UnicodeTextFile::Modes::Read) + return L"rb"; + + if (m == ON_UnicodeTextFile::Modes::Write) + return L"wb"; + + ON_ASSERT(false); + return L""; +} + +bool ON_UnicodeTextFile::CImpl::Open(const wchar_t* wszFullPath, Modes mode) +{ + bool ok = false; + int attemptsCounter = 0; + + while (!ok && (attemptsCounter < 100)) + { + if (m_File.Open(wszFullPath, FileStreamMode(mode))) + { + ok = true; + } + else + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + attemptsCounter++; + } + } + + if (ok) + { + if (Modes::Write == mode) + { + ok = WriteHeader(); + } + else + { + ok = ReadHeader(m_Type); + } + } + + return ok; +} + +bool ON_UnicodeTextFile::CImpl::Close(void) +{ + return m_File.Close(); +} + +bool ON_UnicodeTextFile::CImpl::ReadHeader(Types& t) +{ + if (0 != m_File.CurrentPosition()) + return false; + + ON__UINT8 pBuf[3] = { 0 }; + + if (2 != ReadData(pBuf, 2)) + return false; + + if (pBuf[0] == ON__UINT8(0xFF)) + { + if (pBuf[1] == ON__UINT8(0xFE)) + { + t = Types::UTF16; + return true; + } + } + + if (pBuf[0] == ON__UINT8(0xEF)) + { + if (pBuf[1] == ON__UINT8(0xBB)) + { + if (1 == ReadData(pBuf + 2, 1)) + { + if (pBuf[2] == ON__UINT8(0xBF)) + { + t = Types::UTF8; + return true; + } + } + } + } + + // No BOM was found so rewind and assume UTF8. This allows testing with ASCII files. + m_File.SeekFromStart(0); + t = Types::UTF8; + + return true; +} + +bool ON_UnicodeTextFile::CImpl::WriteHeader(void) +{ + ON__UINT8 pBuf[3] = { 0 }; + + size_t sizeBOM = 2; + if (Types::UTF8 == m_Type) + { + sizeBOM = 3; + pBuf[0] = ON__UINT8(0xEF); + pBuf[1] = ON__UINT8(0xBB); + pBuf[2] = ON__UINT8(0xBF); + } + else + if (Types::UTF16 == m_Type) + { + pBuf[0] = ON__UINT8(0xFF); + pBuf[1] = ON__UINT8(0xFE); + } + else ON_ASSERT(false); // Did you forget to set the type in the constructor? + + if (!WriteData(pBuf, sizeBOM)) + return false; + + return true; +} + +bool ON_UnicodeTextFile::CImpl::ReadString(ON_wString& s) +{ + switch (m_Type) + { + case Types::UTF8: + return ReadStringFromUTF8(s); + + case Types::UTF16: + return ReadStringFromUTF16(s); + + case Types::Unknown: + default: + return false; + } +} + +bool ON_UnicodeTextFile::CImpl::WriteString(const wchar_t* wsz) +{ + switch (m_Type) + { + case Types::UTF8: + return WriteStringToUTF8(wsz); + + case Types::UTF16: + return WriteStringToUTF16(wsz); + + case Types::Unknown: + default: + return false; + } +} + +bool ON_UnicodeTextFile::CImpl::ReadStringFromUTF8(ON_wString& s) +{ + const auto size_in_bytes = m_File.GetLength() - m_File.CurrentPosition(); + auto p = std::unique_ptr(new ON__UINT8[size_in_bytes + 1]); + auto* pBuffer = p.get(); + + ReadData(pBuffer, size_in_bytes); + pBuffer[size_in_bytes] = 0; + + const char* pUTF8 = reinterpret_cast(pBuffer); + + const auto num_chars = ON_ConvertUTF8ToWideChar(false, pUTF8, -1, nullptr, 0, nullptr, 0, 0, nullptr); + + auto* string_buf = s.SetLength(num_chars); + if (nullptr == string_buf) + return false; + + ON_ConvertUTF8ToWideChar(false, pUTF8, -1, string_buf, num_chars+1, nullptr, 0, 0, nullptr); + + return !s.IsEmpty(); +} + +bool ON_UnicodeTextFile::CImpl::ReadStringFromUTF16(ON_wString& s) +{ + const auto char_size = sizeof(ON__UINT16); + const auto size_in_bytes = m_File.GetLength() - m_File.CurrentPosition(); + const auto size_in_chars = size_in_bytes / char_size; + +#ifdef ON_RUNTIME_WIN + // On Windows, wchar_t is UTF16 so we can load the file directly into the ON_wString. + ON_ASSERT(sizeof(wchar_t) == sizeof(ON__UINT16)); + + auto* buf = s.SetLength(size_in_chars); + if (nullptr == buf) + return false; + + if (ReadData(buf, size_in_bytes) != size_in_bytes) + return false; + + buf[size_in_chars] = 0; +#else + // On Mac wchar_t is UTF32 so we have to load the file into a buffer and then convert it to the ON_wString. + auto p = std::unique_ptr(new ON__UINT16[size_in_chars + 1]); + auto* pUTF16 = p.get(); + ReadData(pUTF16, size_in_bytes); + pUTF16[size_in_chars] = 0; + + const auto num_chars = ON_ConvertUTF16ToUTF32(false, pUTF16, -1, nullptr, 0, nullptr, 0, 0, nullptr); + auto* string_buf = s.SetLength(num_chars); + if (nullptr == string_buf) + return false; + + ON_ASSERT(sizeof(wchar_t) == sizeof(ON__UINT32)); + auto* pWide = reinterpret_cast(string_buf); + ON_ConvertUTF16ToUTF32(false, pUTF16, -1, pWide, num_chars+1, nullptr, 0, 0, nullptr); +#endif + + return true; +} + +bool ON_UnicodeTextFile::CImpl::WriteStringToUTF8(const wchar_t* wsz) +{ + const auto num_chars = ON_ConvertWideCharToUTF8(false, wsz, -1, nullptr, 0, nullptr, 0, 0, nullptr); + + auto p = std::unique_ptr(new char[size_t(num_chars) + 1]); + auto* pBuffer = p.get(); + + ON_ConvertWideCharToUTF8(false, wsz, -1, pBuffer, num_chars + 1, nullptr, 0, 0, nullptr); + + if (WriteData(pBuffer, num_chars) != num_chars) + return false; + + return true; +} + +bool ON_UnicodeTextFile::CImpl::WriteStringToUTF16(const wchar_t* wsz) +{ +#ifdef ON_RUNTIME_WIN + // On Windows, wchar_t is UTF16 so we can save the file directly from 'wsz'. + ON_ASSERT(sizeof(wchar_t) == sizeof(ON__UINT16)); + + const auto size_in_bytes = wcslen(wsz) * sizeof(wchar_t); + if (WriteData(wsz, size_in_bytes) != size_in_bytes) + return false; +#else + // On Mac wchar_t is UTF32 so we have to convert 'wsz' to UTF16 in a buffer and write the buffer to the file. + ON_ASSERT(sizeof(wchar_t) == sizeof(ON__UINT32)); + auto* pWide = reinterpret_cast(wsz); + + const auto num_chars = ON_ConvertUTF32ToUTF16(false, pWide, -1, nullptr, 0, nullptr, 0, 0, nullptr); + + const auto num_chars_inc_term = num_chars + 1; + auto p = std::unique_ptr(new ON__UINT16[num_chars_inc_term]); + auto* pUTF16 = p.get(); + + ON_ConvertUTF32ToUTF16(false, pWide, -1, pUTF16, num_chars_inc_term, nullptr, 0, 0, nullptr); + + const auto size_in_bytes = num_chars * sizeof(ON__UINT16); + if (WriteData(pUTF16, size_in_bytes) != size_in_bytes) + return false; +#endif + + return true; +} + +ON_UnicodeTextFile::ON_UnicodeTextFile(Types t) +{ + m_impl = new CImpl; + m_impl->m_Type = t; +} + +ON_UnicodeTextFile::~ON_UnicodeTextFile() +{ + m_impl->~CImpl(); + m_impl = nullptr; +} + +bool ON_UnicodeTextFile::Open(const wchar_t* wszFullPath, Modes mode) +{ + return m_impl->Open(wszFullPath, mode); +} + +bool ON_UnicodeTextFile::Close(void) +{ + return m_impl->Close(); +} + +bool ON_UnicodeTextFile::ReadString(ON_wString& s) +{ + return m_impl->ReadString(s); +} + +bool ON_UnicodeTextFile::WriteString(const wchar_t* wsz) +{ + return m_impl->WriteString(wsz); +} diff --git a/opennurbs_file_utilities.h b/opennurbs_file_utilities.h index e4f25171..909d462d 100644 --- a/opennurbs_file_utilities.h +++ b/opennurbs_file_utilities.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_FILE_UTILITIES_INC_) #define OPENNURBS_FILE_UTILITIES_INC_ @@ -1791,4 +1789,27 @@ private: class ON_DirectoryIteratorImpl* m_impl = nullptr; }; +class ON_CLASS ON_UnicodeTextFile final +{ +public: + enum class Modes { Read, Write }; + enum class Types { Unknown, UTF8, UTF16 }; + + ON_UnicodeTextFile(Types type = Types::Unknown); + ~ON_UnicodeTextFile(); + + bool Open(const wchar_t* filename, Modes mode); + bool Close(void); + + bool ReadString(ON_wString& s); + bool WriteString(const wchar_t* s); + + ON_UnicodeTextFile(const ON_UnicodeTextFile&) = delete; + const ON_UnicodeTextFile& operator = (const ON_UnicodeTextFile&) = delete; + +private: + class CImpl; + CImpl* m_impl; +}; + #endif diff --git a/opennurbs_font.cpp b/opennurbs_font.cpp index 04f3adea..99f81c60 100644 --- a/opennurbs_font.cpp +++ b/opennurbs_font.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -5015,21 +5015,60 @@ const ON_SimpleArray< const class ON_Font* >& ON_FontList::ByIndex() const return m_by_index; } +// 24 Oct 2022 A. Cormier (RH-64285) +// This functions attempts to find the local name of a font when having the english name. +// A binary search would be better than a for loop but a binary search doesn't work when searching +// for an english name +static ON_wString ON_FontList__EnNameToLocName(const ON_wString& english_name) +{ + const ON_SimpleArray& fonts = ON_Font::InstalledFontList().ByIndex(); + for (int i = 0; i < fonts.Count(); i++) + { + const ON_Font* font = fonts[i]; + if (nullptr == font) + continue; + ON_wString en_qname = font->QuartetName(ON_Font::NameLocale::English); + if (ON_wString::CompareOrdinal(english_name, en_qname, true) == 0) + { + return font->QuartetName(); + } + } + return ON_wString::EmptyString; +} + const ON_FontFaceQuartet ON_FontList::QuartetFromQuartetName( const wchar_t* quartet_name ) const { for (;;) { - const ON_FontFaceQuartet qname(quartet_name, nullptr, nullptr, nullptr, nullptr); + ON_FontFaceQuartet qname(quartet_name, nullptr, nullptr, nullptr, nullptr); if (qname.QuartetName().IsEmpty()) break; - const ON_ClassArray< ON_FontFaceQuartet >& quartet_list = ON_FontList::QuartetList(); + const ON_ClassArray& quartet_list = ON_FontList::QuartetList(); const int quartet_list_count = quartet_list.Count(); int i = quartet_list.BinarySearch(&qname, ON_FontFaceQuartet::CompareQuartetName); - if (i < 0 || i >= quartet_list_count) - break; + + bool failedOnFirstTry = i < 0 || i >= quartet_list_count; + if (failedOnFirstTry) + { + // ... then find the localized name and try again. + // The QuartetNames in the QuartetList above are localized but sometimes the quartet_name passed to + // this function is in english. In many cases the localized name and the english name are the same + // so there is no problem. It is a problem for Japanese and Chinese languages for example. RH-64285 + ON_wString locName = ON_FontList__EnNameToLocName(quartet_name); + if (locName.IsEmpty()) + { + break; + } + qname = ON_FontFaceQuartet(locName, nullptr, nullptr, nullptr, nullptr); + i = quartet_list.BinarySearch(&qname, ON_FontFaceQuartet::CompareQuartetName); + if (i < 0 || i >= quartet_list_count) + { + break; + } + } while (i > 0 && 0 == ON_FontFaceQuartet::CompareQuartetName(&qname, &quartet_list[i - 1])) i--; diff --git a/opennurbs_font.h b/opennurbs_font.h index 77883f52..6c99975f 100644 --- a/opennurbs_font.h +++ b/opennurbs_font.h @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_fpoint.h b/opennurbs_fpoint.h index a8ca099f..8037d3dc 100644 --- a/opennurbs_fpoint.h +++ b/opennurbs_fpoint.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_freetype.cpp b/opennurbs_freetype.cpp index bea3bfac..cd25ccf2 100644 --- a/opennurbs_freetype.cpp +++ b/opennurbs_freetype.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_freetype.h b/opennurbs_freetype.h index 40e8e66e..d6cf76af 100644 --- a/opennurbs_freetype.h +++ b/opennurbs_freetype.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_FREETYPE_INC_) #define OPENNURBS_FREETYPE_INC_ diff --git a/opennurbs_freetype_include.h b/opennurbs_freetype_include.h index 0f472456..89308b47 100644 --- a/opennurbs_freetype_include.h +++ b/opennurbs_freetype_include.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ // opennurbs uses FreeType to calculate font metric, glyph metric, and glyph outline information. diff --git a/opennurbs_fsp.h b/opennurbs_fsp.h index 57054b79..ff39529e 100644 --- a/opennurbs_fsp.h +++ b/opennurbs_fsp.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #if !defined(OPENNURBS_FSP_INC_) #define OPENNURBS_FSP_INC_ diff --git a/opennurbs_fsp_defs.h b/opennurbs_fsp_defs.h index d52af6a9..f2f7b8c4 100644 --- a/opennurbs_fsp_defs.h +++ b/opennurbs_fsp_defs.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_FSP_DEFS_INC_) #define ON_FSP_DEFS_INC_ diff --git a/opennurbs_function_list.cpp b/opennurbs_function_list.cpp index 07bcb287..c555028b 100644 --- a/opennurbs_function_list.cpp +++ b/opennurbs_function_list.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_function_list.h b/opennurbs_function_list.h index 89154e96..01e92521 100644 --- a/opennurbs_function_list.h +++ b/opennurbs_function_list.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_FUNCTION_LIST_INC_) diff --git a/opennurbs_geometry.cpp b/opennurbs_geometry.cpp index 827c2f79..67d560fb 100644 --- a/opennurbs_geometry.cpp +++ b/opennurbs_geometry.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_geometry.h b/opennurbs_geometry.h index 3de917ad..d3cead7f 100644 --- a/opennurbs_geometry.h +++ b/opennurbs_geometry.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_gl.cpp b/opennurbs_gl.cpp index 7450c8ac..a0941127 100644 --- a/opennurbs_gl.cpp +++ b/opennurbs_gl.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2011 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" #include "opennurbs_gl.h" // ON_GL() function declarations diff --git a/opennurbs_gl.h b/opennurbs_gl.h index 79979856..f0d89ab1 100644 --- a/opennurbs_gl.h +++ b/opennurbs_gl.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2011 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_glyph_outline.cpp b/opennurbs_glyph_outline.cpp index 3f964875..b38d7c84 100644 --- a/opennurbs_glyph_outline.cpp +++ b/opennurbs_glyph_outline.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2018 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_ground_plane.h b/opennurbs_ground_plane.h index c48826bf..7b3da12d 100644 --- a/opennurbs_ground_plane.h +++ b/opennurbs_ground_plane.h @@ -93,7 +93,7 @@ public: // Set the texture rotation of the ground plane in degrees. void SetTextureRotation(double d); -public: +private: class CImpl; CImpl* m_impl; }; diff --git a/opennurbs_group.cpp b/opennurbs_group.cpp index a3d6a33d..0f2c99d9 100644 --- a/opennurbs_group.cpp +++ b/opennurbs_group.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_group.h b/opennurbs_group.h index 04df32ce..faa6c041 100644 --- a/opennurbs_group.h +++ b/opennurbs_group.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_GROUP_INC_) #define OPENNURBS_GROUP_INC_ diff --git a/opennurbs_hash_table.cpp b/opennurbs_hash_table.cpp index 97b84dab..1fe23d67 100644 --- a/opennurbs_hash_table.cpp +++ b/opennurbs_hash_table.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_hash_table.h b/opennurbs_hash_table.h index fc9c9a2f..a74577ac 100644 --- a/opennurbs_hash_table.h +++ b/opennurbs_hash_table.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_hatch.cpp b/opennurbs_hatch.cpp index 68209d6e..21bee2b4 100644 --- a/opennurbs_hatch.cpp +++ b/opennurbs_hatch.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_hatch.h b/opennurbs_hatch.h index 641b13bd..0519a4d5 100644 --- a/opennurbs_hatch.h +++ b/opennurbs_hatch.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #ifndef OPENNURBS_HATCH_H_INCLUDED #define OPENNURBS_HATCH_H_INCLUDED diff --git a/opennurbs_instance.cpp b/opennurbs_instance.cpp index 8a5bdef5..f192eb58 100644 --- a/opennurbs_instance.cpp +++ b/opennurbs_instance.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_instance.h b/opennurbs_instance.h index 77e909b9..af3f423d 100644 --- a/opennurbs_instance.h +++ b/opennurbs_instance.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_INSTANCE_INC_) #define OPENNURBS_INSTANCE_INC_ diff --git a/opennurbs_internal_V2_annotation.cpp b/opennurbs_internal_V2_annotation.cpp index fb05cc2d..4df9ac12 100644 --- a/opennurbs_internal_V2_annotation.cpp +++ b/opennurbs_internal_V2_annotation.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_internal_V2_annotation.h b/opennurbs_internal_V2_annotation.h index 7241bad6..54d17d8a 100644 --- a/opennurbs_internal_V2_annotation.h +++ b/opennurbs_internal_V2_annotation.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_INTERNAL_V2_ANNOTATION_H_INC) #define OPENNURBS_INTERNAL_V2_ANNOTATION_H_INC diff --git a/opennurbs_internal_V5_annotation.cpp b/opennurbs_internal_V5_annotation.cpp index 9961936a..66be43ec 100644 --- a/opennurbs_internal_V5_annotation.cpp +++ b/opennurbs_internal_V5_annotation.cpp @@ -1,15 +1,5 @@ - - - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -/* -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -20,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_internal_V5_annotation.h b/opennurbs_internal_V5_annotation.h index 929ca614..f05b93e1 100644 --- a/opennurbs_internal_V5_annotation.h +++ b/opennurbs_internal_V5_annotation.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #ifndef OPENNURBS_INTERNAL_V5_ANNOTATION_H_INC #define OPENNURBS_INTERNAL_V5_ANNOTATION_H_INC diff --git a/opennurbs_internal_V5_dimstyle.cpp b/opennurbs_internal_V5_dimstyle.cpp index bc35b060..2d6aaddb 100644 --- a/opennurbs_internal_V5_dimstyle.cpp +++ b/opennurbs_internal_V5_dimstyle.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_internal_V5_dimstyle.h b/opennurbs_internal_V5_dimstyle.h index e55d471f..5fde7cd6 100644 --- a/opennurbs_internal_V5_dimstyle.h +++ b/opennurbs_internal_V5_dimstyle.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_INTERNAL_V5_DIMSTYLE_INC_) #define OPENNURBS_INTERNAL_V5_DIMSTYLE_INC_ diff --git a/opennurbs_internal_Vx_annotation.cpp b/opennurbs_internal_Vx_annotation.cpp index c8ea4a50..df7a9403 100644 --- a/opennurbs_internal_Vx_annotation.cpp +++ b/opennurbs_internal_Vx_annotation.cpp @@ -1,5 +1,5 @@ -/* -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -9,7 +9,7 @@ // // For complete openNURBS copyright information see . //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_internal_defines.h b/opennurbs_internal_defines.h index 4cb273b5..3e3e86b5 100644 --- a/opennurbs_internal_defines.h +++ b/opennurbs_internal_defines.h @@ -1,4 +1,4 @@ -/* +// // Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. @@ -6,11 +6,10 @@ // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF // MERCHANTABILITY ARE HEREBY DISCLAIMED. -// +// // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ // Internal header; not in the public SDK. @@ -31,19 +30,7 @@ #define ON_KIND_MATERIAL L"material" #define ON_KIND_ENVIRONMENT L"environment" #define ON_KIND_TEXTURE L"texture" - -#define ON_RDK_SLASH L"/" -#define ON_RDK_POSTFIX_SECTION L"-section" -#define ON_RDK_DOCUMENT L"render-content-manager-document" -#define ON_RDK_UD_ROOT L"render-content-manager-data" -#define ON_RDK_CURRENT_CONTENT L"content" -#define ON_RDK_SETTINGS L"settings" -#define ON_RDK_POST_EFFECTS L"post-effects-new" -#define ON_RDK_PEP_TYPE_EARLY L"early" -#define ON_RDK_PEP_TYPE_TONE L"tone-mapping" -#define ON_RDK_PEP_TYPE_LATE L"late" -#define ON_RDK_RENDERING L"rendering" -#define ON_RDK_SUN L"sun" +#define ON_RDK_UD_ROOT L"render-content-manager-data" inline bool IsFloatEqual (float f1, float f2) { return (fabsf(f1 - f2) < 1e-6); } inline bool IsDoubleEqual(double d1, double d2) { return (fabs (d1 - d2) < 1e-10); } @@ -60,17 +47,14 @@ ON_3dmObjectAttributes* GetComponentAttributes(const ON_ModelComponent& componen ON_RenderContent* NewRenderContentFromNode(const class ON_XMLNode& node); ON_PostEffect* NewPostEffectFromNode(ON_XMLNode& node); void SetRenderContentNodeRecursive(const ON_RenderContent& rc, ON_XMLNode& node); -bool CreateArchiveBufferFromXML(const ON_wString& xml, ON_Buffer& buf, int archive_3dm_version); ON_XMLNode* FindPostEffectNodeForId(const ON_XMLNode& sectionNode, const ON_UUID& id); -bool GetRDKObjectInformation(const ON_Object& object, ON_wString& xml, int archive_3dm_version); bool SetRDKObjectInformation(ON_Object& object, const ON_wString& xml, int archive_3dm_version); bool GetRDKEmbeddedFiles(const ONX_Model_UserData& docud, ON_ClassArray& paths, ON_SimpleArray& embedded_files_as_buffers, ON_SimpleArray& buffer_sizes); -void CreateDecalsFromXML(const ONX_Model& model, int archive_3dm_version); -void CreateXMLFromDecals(const ONX_Model& model, int archive_3dm_version); +bool GetEntireDecalXML(const ON_3dmObjectAttributes& attr, ON_XMLRootNode& xmlOut); void CreateMeshModifiersFromXML(const ONX_Model& model, int archive_3dm_version); void CreateXMLFromMeshModifiers(const ONX_Model& model, int archive_3dm_version); bool GetMeshModifierObjectInformation(const ON_Object& object, ON_wString& xml, int archive_3dm_version); -void SetMeshModifierObjectInformation(ON_Object& object, const ON_MeshModifier* mm, const ON_XMLNode& node, int archive_3dm_version, const wchar_t* mm_node_name); +void SetMeshModifierObjectInformation(ON_Object& object, const ON_MeshModifier* mm, int archive_3dm_version); bool IsRDKDocumentInformation(const ONX_Model_UserData& docud); template inline T Lerp(float t, const T& l, const T& h) { return l + T(t) * (h - l); } @@ -80,7 +64,7 @@ class ON_InternalXMLImpl { public: ON_InternalXMLImpl(ON_XMLNode* n=nullptr) : m_model_node(n) { } - virtual ~ON_InternalXMLImpl() { } + virtual ~ON_InternalXMLImpl(); ON_XMLVariant GetParameter(const wchar_t* path_to_node, const wchar_t* param_name, const ON_XMLVariant& def) const; bool SetParameter(const wchar_t* path_to_node, const wchar_t* param_name, const ON_XMLVariant& value); @@ -92,34 +76,48 @@ public: bool SetParameter_NoType(const wchar_t* path_to_node, const wchar_t* param_name, const ON_XMLVariant& value); ON_XMLNode& Node(void) const; - ON_XMLNode& NodeAt(const wchar_t* path_to_node) const; + +protected: + virtual ON_wString NameOfRootNode(void) const; private: ON_XMLVariant InternalGetParameter(const wchar_t* path_to_node, const wchar_t* param_name, const wchar_t* default_type, const ON_XMLVariant& def) const; bool InternalSetParameter(const wchar_t* path_to_node, const wchar_t* param_name, bool write_type, const ON_XMLVariant& value); public: - mutable ON_XMLRootNode m_local_node; // Used when m_model_node is null. + mutable std::recursive_mutex m_mutex; + mutable ON_XMLNode* m_local_node = nullptr; // Used when m_model_node is null. ON_XMLNode* m_model_node; }; class ON_DecalCollection final { public: - ON_DecalCollection() { } + ON_DecalCollection(ON_3dmObjectAttributes* a) : m_attr(a) { } ON_DecalCollection(const ON_DecalCollection& dc) = delete; ~ON_DecalCollection(); const ON_DecalCollection& operator = (const ON_DecalCollection& dc); - void DeleteAllDecals(void); - void Populate(const ON_XMLRootNode& node); ON_Decal* AddDecal(void); - const ON_SimpleArray& GetDecalArray(void) const { return m_decals; } - static bool NodeContainsDecals(const ON_XMLRootNode& node); + bool DeleteDecal(ON_Decal& decal); + void DeleteAllDecals(void); + const ON_SimpleArray& GetDecalArray(void) const; + + void SetChanged(void); + + void UpdateUserData(unsigned int archive_3dm_version) const; private: - ON_SimpleArray m_decals; + void Populate(void) const; + int FindDecalIndex(const ON_Decal&) const; + +private: + ON_3dmObjectAttributes* m_attr; + mutable ON_XMLRootNode m_root_node; + mutable ON_SimpleArray m_decals; + mutable bool m_populated = false; + mutable bool m_changed = false; }; template inline void hash_combine(size_t& seed, const T& v) @@ -134,19 +132,60 @@ public: inline size_t operator()(const ON_UUID& uuid) const { size_t seed = 0; - ::hash_combine(seed, uuid.Data1); - ::hash_combine(seed, uuid.Data2); - ::hash_combine(seed, uuid.Data3); - for (int i = 0; i < 8; i++) - { - ::hash_combine(seed, uuid.Data4[i]); - } + const auto* d = reinterpret_cast(&uuid); + ::hash_combine(seed, d[0]); + ::hash_combine(seed, d[1]); + ::hash_combine(seed, d[2]); + ::hash_combine(seed, d[3]); return seed; } }; +class ON_EnvironmentsPrivate final : public ON_InternalXMLImpl +{ +public: + ON_EnvironmentsPrivate() { } + ON_EnvironmentsPrivate(ON_XMLNode& n) : ON_InternalXMLImpl(&n) { } + ON_EnvironmentsPrivate(const ON_EnvironmentsPrivate&); + + ON_EnvironmentsPrivate& operator = (const ON_EnvironmentsPrivate&); + + bool operator == (const ON_EnvironmentsPrivate&); + + ON_UUID BackgroundRenderEnvironment(void) const; + void SetBackgroundRenderEnvironment(const ON_UUID& id); + bool SkylightingRenderEnvironmentOverride(void) const; + void SetSkylightingRenderEnvironmentOverride(bool on); + ON_UUID SkylightingRenderEnvironment(void) const; + void SetSkylightingRenderEnvironment(const ON_UUID& id); + bool ReflectionRenderEnvironmentOverride(void) const; + void SetReflectionRenderEnvironmentOverride(bool on); + ON_UUID ReflectionRenderEnvironment(void) const; + void SetReflectionRenderEnvironment(const ON_UUID& id); +}; + +class ON_3dmRenderSettingsPrivate final +{ +public: + ON_3dmRenderSettingsPrivate(); + ON_3dmRenderSettingsPrivate(const ON_3dmRenderSettingsPrivate&) = default; + + const ON_3dmRenderSettingsPrivate& operator = (const ON_3dmRenderSettingsPrivate&); + +public: + ON_XMLRootNode _rdk_document_data; + ON_Dithering _dithering; + ON_GroundPlane _ground_plane; + ON_LinearWorkflow _linear_workflow; + ON_RenderChannels _render_channels; + ON_SafeFrame _safe_frame; + ON_Skylight _skylight; + ON_Sun _sun; + ON_EnvironmentsPrivate _environments; +}; + //-------------------------------------------------------------------------------------------------- class ON_INTERNAL_OBSOLETE diff --git a/opennurbs_internal_glyph.h b/opennurbs_internal_glyph.h index 83178618..be868e17 100644 --- a/opennurbs_internal_glyph.h +++ b/opennurbs_internal_glyph.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #if !defined(OPENNURBS_INTERNAL_GLYPH_INC_) #define OPENNURBS_INTERNAL_GLYPH_INC_ diff --git a/opennurbs_intersect.cpp b/opennurbs_intersect.cpp index e61ce84e..bb8373ff 100644 --- a/opennurbs_intersect.cpp +++ b/opennurbs_intersect.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_intersect.h b/opennurbs_intersect.h index d2f69717..e2836132 100644 --- a/opennurbs_intersect.h +++ b/opennurbs_intersect.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_INTERSECT_INC_) #define ON_INTERSECT_INC_ diff --git a/opennurbs_ipoint.cpp b/opennurbs_ipoint.cpp index 0abbf4a1..f1631fbd 100644 --- a/opennurbs_ipoint.cpp +++ b/opennurbs_ipoint.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_ipoint.h b/opennurbs_ipoint.h index 04c522ea..a49ded0d 100644 --- a/opennurbs_ipoint.h +++ b/opennurbs_ipoint.h @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_knot.cpp b/opennurbs_knot.cpp index 5b800574..8954b8b8 100644 --- a/opennurbs_knot.cpp +++ b/opennurbs_knot.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_knot.h b/opennurbs_knot.h index 34d4a9f0..0ae6c484 100644 --- a/opennurbs_knot.h +++ b/opennurbs_knot.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_KNOT_INC_) #define OPENNURBS_KNOT_INC_ diff --git a/opennurbs_layer.cpp b/opennurbs_layer.cpp index 323a93f5..ff0b357f 100644 --- a/opennurbs_layer.cpp +++ b/opennurbs_layer.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2021 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -878,6 +878,17 @@ bool ON_Layer::IsVisible() const return IsHidden() ? false : true; } +bool ON_Layer::IsVisible(const ON_3dmView* view) const +{ + if (nullptr == view) + return IsVisible(); + + if (view->m_view_type == ON::view_type::model_view_type) + return ModelIsVisible(); + + return PerViewportIsVisible(view->m_vp.ViewportId()); +} + void ON_Layer::SetVisible( bool bVisible ) { SetHiddenModelComponentState( bVisible ? false : true ); @@ -1737,11 +1748,6 @@ ON_Color ON_Layer::PerViewportPlotColor( ON_UUID viewport_id ) const return PlotColor(); } -/*ON_Color ON_Layer::PlotColor( const ON_UUID& viewport_id ) const -{ - return PerViewportPlotColor(viewport_id); -}*/ - void ON_Layer::SetPerViewportPlotWeight( ON_UUID viewport_id, double plot_weight_mm ) { if ( ON_UuidIsNil(viewport_id) ) @@ -1762,11 +1768,6 @@ void ON_Layer::SetPerViewportPlotWeight( ON_UUID viewport_id, double plot_weight } } -//void ON_Layer::SetPlotWeight( double plot_weight_mm, const ON_UUID& viewport_id ) -//{ -// SetPerViewportPlotWeight( viewport_id, plot_weight_mm ); -//} - double ON_Layer::PerViewportPlotWeight( ON_UUID viewport_id ) const { if ( !ExtensionBit(m_extension_bits,0x01) ) @@ -1778,11 +1779,38 @@ double ON_Layer::PerViewportPlotWeight( ON_UUID viewport_id ) const return PlotWeight(); } -//double ON_Layer::PlotWeight( const ON_UUID& viewport_id ) const -//{ -// return PerViewportPlotWeight(viewport_id); -//} +// {5CCA6037-AFC7-4204-9548-EC32CD7177D6} +static const ON_UUID ON_model_viewport_id = { 0x5cca6037, 0xafc7, 0x4204, { 0x95, 0x48, 0xec, 0x32, 0xcd, 0x71, 0x77, 0xd6 } }; +bool ON_Layer::ModelIsVisible() const +{ + return PerViewportIsVisible(ON_model_viewport_id); +} + +void ON_Layer::SetModelVisible(bool bVisible) +{ + SetPerViewportVisible(ON_model_viewport_id, bVisible); +} + +bool ON_Layer::ModelPersistentVisibility() const +{ + return PerViewportPersistentVisibility(ON_model_viewport_id); +} + +void ON_Layer::SetModelPersistentVisibility(bool bPersistentVisibility) +{ + SetPerViewportPersistentVisibility(ON_model_viewport_id, bPersistentVisibility); +} + +void ON_Layer::UnsetModelPersistentVisibility() +{ + UnsetPerViewportPersistentVisibility(ON_model_viewport_id); +} + +void ON_Layer::DeleteModelVisible() +{ + DeletePerViewportVisible(ON_model_viewport_id); +} bool ON_Layer::PerViewportIsVisible( ON_UUID viewport_id ) const { diff --git a/opennurbs_layer.h b/opennurbs_layer.h index 318516e8..26c72c51 100644 --- a/opennurbs_layer.h +++ b/opennurbs_layer.h @@ -330,12 +330,21 @@ public: Returns: Returns true if objects on layer are visible. Remarks: - Does not inspect per viewport settings. + Does not inspect per viewport settings. It is better to use the + overload that take an ON_3dmView for visibility testing See Also: ON_Layer::SetVisible */ bool IsVisible() const; + /* + Returns: + Returns true if objects on layer are visible for a given view. + See Also: + ON_Layer::SetVisible + */ + bool IsVisible(const class ON_3dmView* view) const; + /* Description: Controls layer visibility @@ -405,7 +414,72 @@ public: ON_Layer::SetPersistentVisibility */ void UnsetPersistentVisibility(); - + + + /* + Returns: + Returns true if objects on layer are visible in model viewports. + See Also: + ON_Layer::IsVisible() + ON_Layer::PerViewportIsVisible() +*/ + bool ModelIsVisible() const; + + /* + Description: + Controls layer visibility in in model viewports. + Parameters: + bVisible - [in] true to make layer visible, + false to make layer invisible + See Also: + ON_Layer::SetVisible() + ON_Layer::SetPerViewportVisible() + */ + void SetModelVisible(bool bVisible); + + /* + Returns: + true: + If this layer's visibility in model viewports is + controlled by a parent object and the parent is turned on + (after being off), then this layer will also be turned on + in the specified viewport. + false: + If this layer's visibility in model viewports is + controlled by a parent object and the parent layer is + turned on (after being off), then this layer will continue + to be off in the specified viewport. + Remarks: + See ON_Layer::SetPersistentVisibility + for a description of persistent visibility. + See Also: + ON_Layer::SetModelPersistentVisibility + */ + bool ModelPersistentVisibility() const; + + /* + Description: + This function allows model viewports setting the + child visibility property. + Parameters + bPersistentVisibility - [in] + Remarks: + See ON_Layer::SetPersistentVisibility + for a description of the child visibility property. + See Also: + ON_Layer::SetPersistentVisibility + */ + void SetModelPersistentVisibility(bool bPersistentVisibility); + + void UnsetModelPersistentVisibility(); + + /* + Description: + Remove any model viewport visibility setting so the + layer's overall setting will be used for all viewports. + */ + void DeleteModelVisible(); + /* Parameters: viewport_id - [in] @@ -430,7 +504,7 @@ public: bVisible - [in] true to make layer visible, false to make layer invisible See Also: - ON_Layer::IsVisibleInViewport() + ON_Layer::PerViewportIsVisible() */ void SetPerViewportVisible( ON_UUID viewport_id, diff --git a/opennurbs_leader.cpp b/opennurbs_leader.cpp index 78984f94..1ad36709 100644 --- a/opennurbs_leader.cpp +++ b/opennurbs_leader.cpp @@ -1,5 +1,5 @@ -/* -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -9,7 +9,7 @@ // // For complete openNURBS copyright information see . //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_leader.h b/opennurbs_leader.h index 3a47fb03..3ff15184 100644 --- a/opennurbs_leader.h +++ b/opennurbs_leader.h @@ -1,8 +1,5 @@ - -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -13,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ // ON_Leader class #ifndef OPENNURBS_LEADER_H_INCLUDED diff --git a/opennurbs_light.cpp b/opennurbs_light.cpp index 9d4f9d4e..639ddd75 100644 --- a/opennurbs_light.cpp +++ b/opennurbs_light.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_light.h b/opennurbs_light.h index c8e62fd4..fe6588ed 100644 --- a/opennurbs_light.h +++ b/opennurbs_light.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_LIGHT_INC_) #define OPENNURBS_LIGHT_INC_ diff --git a/opennurbs_line.cpp b/opennurbs_line.cpp index 6e1304ed..91e17df9 100644 --- a/opennurbs_line.cpp +++ b/opennurbs_line.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_line.h b/opennurbs_line.h index 3aa83c23..10922a2a 100644 --- a/opennurbs_line.h +++ b/opennurbs_line.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_LINE_INC_) #define ON_LINE_INC_ diff --git a/opennurbs_linear_workflow.cpp b/opennurbs_linear_workflow.cpp index d6435022..54db32be 100644 --- a/opennurbs_linear_workflow.cpp +++ b/opennurbs_linear_workflow.cpp @@ -1,4 +1,3 @@ -/* // // Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" #include "opennurbs_internal_defines.h" diff --git a/opennurbs_linear_workflow.h b/opennurbs_linear_workflow.h index 36917eb5..ad999ddc 100644 --- a/opennurbs_linear_workflow.h +++ b/opennurbs_linear_workflow.h @@ -1,4 +1,3 @@ -/* // // Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_LINEAR_WORKFLOW_INC_) #define ON_LINEAR_WORKFLOW_INC_ @@ -73,7 +71,7 @@ public: // Returns the CRC of gamma and linear workflow active state. ON__UINT32 DataCRC(ON__UINT32 current_remainder) const; -public: +private: class CImpl; CImpl* m_impl; }; diff --git a/opennurbs_linecurve.cpp b/opennurbs_linecurve.cpp index 678c5804..4347f960 100644 --- a/opennurbs_linecurve.cpp +++ b/opennurbs_linecurve.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_linecurve.h b/opennurbs_linecurve.h index 68a4470c..7f5a6928 100644 --- a/opennurbs_linecurve.h +++ b/opennurbs_linecurve.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_GEOMETRY_CURVE_LINE_INC_) #define ON_GEOMETRY_CURVE_LINE_INC_ diff --git a/opennurbs_linestyle.h b/opennurbs_linestyle.h index a4fefbb0..d6a42a9a 100644 --- a/opennurbs_linestyle.h +++ b/opennurbs_linestyle.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_LINESTYLE_INC_) #define OPENNURBS_LINESTYLE_INC_ diff --git a/opennurbs_linetype.cpp b/opennurbs_linetype.cpp index 6ae74120..bc46cdcd 100644 --- a/opennurbs_linetype.cpp +++ b/opennurbs_linetype.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2021 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_linetype.h b/opennurbs_linetype.h index 3ec10ccb..70e6eab8 100644 --- a/opennurbs_linetype.h +++ b/opennurbs_linetype.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2021 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_LINETYPE_INC_) #define OPENNURBS_LINETYPE_INC_ diff --git a/opennurbs_locale.cpp b/opennurbs_locale.cpp index 8e5171cb..13300b6c 100644 --- a/opennurbs_locale.cpp +++ b/opennurbs_locale.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_locale.h b/opennurbs_locale.h index 38795d3d..3f8ea403 100644 --- a/opennurbs_locale.h +++ b/opennurbs_locale.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_LOCALE_INC_) #define OPENNURBS_LOCALE_INC_ diff --git a/opennurbs_lock.cpp b/opennurbs_lock.cpp index d3106328..1b5a1f30 100644 --- a/opennurbs_lock.cpp +++ b/opennurbs_lock.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_lookup.cpp b/opennurbs_lookup.cpp index fd690627..393d4eef 100644 --- a/opennurbs_lookup.cpp +++ b/opennurbs_lookup.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_lookup.h b/opennurbs_lookup.h index a6c09926..cca147ed 100644 --- a/opennurbs_lookup.h +++ b/opennurbs_lookup.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_MAP_INC_) #define OPENNURBS_MAP_INC_ diff --git a/opennurbs_mapchan.h b/opennurbs_mapchan.h index d9a21616..3dd62b58 100644 --- a/opennurbs_mapchan.h +++ b/opennurbs_mapchan.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_MAPPING_CHANNEL_INC_) #define OPENNURBS_MAPPING_CHANNEL_INC_ diff --git a/opennurbs_material.h b/opennurbs_material.h index 804b84ee..b9d427d7 100644 --- a/opennurbs_material.h +++ b/opennurbs_material.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_MATERIAL_INC_) #define OPENNURBS_MATERIAL_INC_ diff --git a/opennurbs_math.cpp b/opennurbs_math.cpp index 7a60d089..2d0c4d31 100644 --- a/opennurbs_math.cpp +++ b/opennurbs_math.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_math.h b/opennurbs_math.h index f4e3d88e..138b8224 100644 --- a/opennurbs_math.h +++ b/opennurbs_math.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_MATH_INC_) #define ON_MATH_INC_ diff --git a/opennurbs_matrix.cpp b/opennurbs_matrix.cpp index 618aca5b..a5c15e6e 100644 --- a/opennurbs_matrix.cpp +++ b/opennurbs_matrix.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_matrix.h b/opennurbs_matrix.h index e54f21d3..f913c78f 100644 --- a/opennurbs_matrix.h +++ b/opennurbs_matrix.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_MATRIX_INC_) #define ON_MATRIX_INC_ diff --git a/opennurbs_md5.cpp b/opennurbs_md5.cpp index 5037a1c7..891ee107 100644 --- a/opennurbs_md5.cpp +++ b/opennurbs_md5.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_md5.h b/opennurbs_md5.h index 7629106b..27a21f50 100644 --- a/opennurbs_md5.h +++ b/opennurbs_md5.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_MD5_INC_) #define OPENNURBS_MD5_INC_ diff --git a/opennurbs_memory.h b/opennurbs_memory.h index 8b522c98..8f8a4d9e 100644 --- a/opennurbs_memory.h +++ b/opennurbs_memory.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_MEMORY_INC_) #define OPENNURBS_MEMORY_INC_ diff --git a/opennurbs_memory_util.cpp b/opennurbs_memory_util.cpp index afe0e6ec..3f3f9469 100644 --- a/opennurbs_memory_util.cpp +++ b/opennurbs_memory_util.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_mesh.cpp b/opennurbs_mesh.cpp index 3faf6efa..52548607 100644 --- a/opennurbs_mesh.cpp +++ b/opennurbs_mesh.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_mesh.h b/opennurbs_mesh.h index f7dc5ad9..834459d2 100644 --- a/opennurbs_mesh.h +++ b/opennurbs_mesh.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_MESH_INC_) #define OPENNURBS_MESH_INC_ diff --git a/opennurbs_mesh_modifiers.cpp b/opennurbs_mesh_modifiers.cpp index 3522443e..de4c1283 100644 --- a/opennurbs_mesh_modifiers.cpp +++ b/opennurbs_mesh_modifiers.cpp @@ -158,16 +158,11 @@ void ON_DisplacementUserData::SetToDefaults(void) const void ON_DisplacementUserData::ReportVersionError(void) const { - //RhinoMessageBox(L"Version error", L"Displacement", MB_OK | MB_ICONERROR); + ON_ERROR("ON_DisplacementUserData: version error"); } bool ON_DisplacementUserData::Transform(const ON_Xform& xform) { -// if (nullptr != g_DisplacementUserDataTransformCallback) -// { -// (*g_DisplacementUserDataTransformCallback)(*this, xform); -// } - return ON_XMLUserData::Transform(xform); } @@ -480,6 +475,16 @@ ON_Displacement::SubItem& ON_Displacement::AddSubItem(void) return *sub; } +void ON_Displacement::DeleteSubItem(int face_index) +{ + const int index = FindSubItemArrayIndex(face_index); + if (index >= 0) + { + delete m_impl_dsp->m_subs[index]; + m_impl_dsp->m_subs.Remove(index); + } +} + void ON_Displacement::DeleteAllSubItems(void) { for (int i = 0; i < m_impl_dsp->m_subs.Count(); i++) @@ -490,16 +495,25 @@ void ON_Displacement::DeleteAllSubItems(void) m_impl_dsp->m_subs.Destroy(); } -ON_Displacement::SubItem* ON_Displacement::FindSubItem(const int index) const +int ON_Displacement::FindSubItemArrayIndex(int face_index) const { - auto it = GetSubItemIterator(); - while (SubItem* sub = it.Next()) + for (int i = 0; i < m_impl_dsp->m_subs.Count(); i++) { - if (sub->Index() == index) - return sub; + const auto* sub = m_impl_dsp->m_subs[i]; + if (sub->FaceIndex() == face_index) + return i; } - return nullptr; + return -1; +} + +ON_Displacement::SubItem* ON_Displacement::FindSubItem(int face_index) const +{ + const int index = FindSubItemArrayIndex(face_index); + if (index < 0) + return nullptr; + + return m_impl_dsp->m_subs[index]; } class ON_Displacement::SubItem::CImpl : public ON_InternalXMLImpl @@ -523,8 +537,8 @@ const ON_Displacement::SubItem& ON_Displacement::SubItem::operator = (const SubI { if (this != &sub) { - SetIndex (sub.Index()); SetOn (sub.On()); + SetFaceIndex (sub.FaceIndex()); SetTexture (sub.Texture()); SetMappingChannel (sub.MappingChannel()); SetBlackPoint (sub.BlackPoint()); @@ -536,8 +550,8 @@ const ON_Displacement::SubItem& ON_Displacement::SubItem::operator = (const SubI bool ON_Displacement::SubItem::operator == (const SubItem& sub) const { - if (Index() != sub.Index()) return false; if (On() != sub.On()) return false; + if (FaceIndex() != sub.FaceIndex()) return false; if (Texture() != sub.Texture()) return false; if (MappingChannel() != sub.MappingChannel()) return false; if (BlackPoint() != sub.BlackPoint()) return false; @@ -551,12 +565,12 @@ bool ON_Displacement::SubItem::operator != (const SubItem& c) const return !(operator == (c)); } -int ON_Displacement::SubItem::Index(void) const +int ON_Displacement::SubItem::FaceIndex(void) const { return m_impl->GetParameter(ON_DISPLACEMENT_SUB_INDEX, -1).AsInteger(); } -void ON_Displacement::SubItem::SetIndex(int i) +void ON_Displacement::SubItem::SetFaceIndex(int i) { m_impl->SetParameter(ON_DISPLACEMENT_SUB_INDEX, i); } @@ -743,7 +757,7 @@ void ON_EdgeSofteningUserData::SetToDefaults(void) const void ON_EdgeSofteningUserData::ReportVersionError(void) const { - //RhinoMessageBox(L"Version error", L"EdgeSoftening", MB_OK | MB_ICONERROR); + ON_ERROR("ON_EdgeSofteningUserData: version error"); } ON_EdgeSoftening::ON_EdgeSoftening() @@ -937,7 +951,7 @@ bool ON_ThickeningUserData::GetDescription(ON_wString& s) void ON_ThickeningUserData::ReportVersionError(void) const { - //RhinoMessageBox(L"Version error", L"Thickness", MB_OK | MB_ICONERROR); + ON_ERROR("ON_ThickeningUserData: version error"); } bool ON_ThickeningUserData::Transform(const ON_Xform& xform) @@ -1124,7 +1138,7 @@ bool ON_CurvePipingUserData::GetDescription(ON_wString& s) void ON_CurvePipingUserData::ReportVersionError(void) const { - //RhinoMessageBox(L"Version error", L"CurvePiping", MB_OK | MB_ICONERROR); + ON_ERROR("ON_CurvePipingUserData: version error"); } bool ON_CurvePipingUserData::Transform(const ON_Xform& xform) @@ -1278,7 +1292,7 @@ ON_CurvePiping::CapTypes ON_CurvePiping::Defaults::CapType(void) //////////////////////////////////////////////////////////////// // -// Shutlining +// Shut-lining // //////////////////////////////////////////////////////////////// @@ -1343,7 +1357,7 @@ bool ON_ShutLiningUserData::GetDescription(ON_wString& s) void ON_ShutLiningUserData::ReportVersionError(void) const { - //RhinoMessageBox(L"Version error", L"ShutLining", MB_OK | MB_ICONERROR); + ON_ERROR("ON_ShutLiningUserData: version error"); } bool ON_ShutLiningUserData::Transform(const ON_Xform& xform) @@ -1368,9 +1382,9 @@ ON_ShutLining::ON_ShutLining(const ON_XMLNode& sl_node) { m_impl_sl = new CImplSL; - // Iterate over the shutlining node looking at each child node's name. If the child + // Iterate over the shut-lining node looking at each child node's name. If the child // node is a curve node, create a curve object to hold the curve XML. Otherwise add - // a copy of the child node to a new shutlining node. + // a copy of the child node to a new shut-lining node. ON_XMLNode new_sl_node(sl_node.TagName()); auto it = sl_node.GetChildIterator(); @@ -1386,7 +1400,7 @@ ON_ShutLining::ON_ShutLining(const ON_XMLNode& sl_node) } } - // Copy the new shutlining node to our node. It only contains shutlining XML with no curve nodes. + // Copy the new shut-lining node to our node. It only contains shut-lining XML with no curve nodes. m_impl->Node() = new_sl_node; } @@ -1782,24 +1796,6 @@ void ON_MeshModifiers::CImpl::LoadFromXML(const ON_XMLRootNode& root) } } -void ON_MeshModifiers::CImpl::SaveToXML(ON_XMLRootNode& root) const -{ - if (nullptr != m_displacement) - m_displacement->AddChildXML(root); - - if (nullptr != m_edge_softening) - m_edge_softening->AddChildXML(root); - - if (nullptr != m_thickening) - m_thickening->AddChildXML(root); - - if (nullptr != m_curve_piping) - m_curve_piping->AddChildXML(root); - - if (nullptr != m_shut_lining) - m_shut_lining->AddChildXML(root); -} - ON_MeshModifiers::CImpl::~CImpl() { DeleteAll(); @@ -1854,11 +1850,6 @@ void ON_MeshModifiers::LoadFromXML(const ON_XMLRootNode& node) m_impl->LoadFromXML(node); } -void ON_MeshModifiers::SaveToXML(ON_XMLRootNode& node) const -{ - m_impl->SaveToXML(node); -} - const ON_MeshModifiers& ON_MeshModifiers::operator = (const ON_MeshModifiers& mm) { m_impl->DeleteAll(); @@ -1955,19 +1946,11 @@ void CreateXMLFromMeshModifiers(const ONX_Model& model, int archive_3dm_version) if (nullptr == attr) continue; // No attributes on component. - // Get all the XML for all the mesh modifiers under one root node. This is just for convenience - // and it's not how the XML will appear in the 3dm file because it's going to be distributed to - // separate user data objects by SetMeshModifierObjectInformation(). ON_MeshModifiers& mm = attr->MeshModifiers(); - ON_XMLRootNode root; - mm.SaveToXML(root); - - // 'root' will only contain XML for the mesh modifiers that exist (which may be none). - // If there are none, no user data will be added to the attributes by the following. - SetMeshModifierObjectInformation(*attr, mm.Displacement(), root, archive_3dm_version, ON_DISPLACEMENT_ROOT); - SetMeshModifierObjectInformation(*attr, mm.EdgeSoftening(), root, archive_3dm_version, ON_EDGE_SOFTENING_ROOT); - SetMeshModifierObjectInformation(*attr, mm.Thickening(), root, archive_3dm_version, ON_THICKENING_ROOT); - SetMeshModifierObjectInformation(*attr, mm.CurvePiping(), root, archive_3dm_version, ON_CURVE_PIPING_ROOT); - SetMeshModifierObjectInformation(*attr, mm.ShutLining(), root, archive_3dm_version, ON_SHUTLINING_ROOT); + SetMeshModifierObjectInformation(*attr, mm.Displacement(), archive_3dm_version); + SetMeshModifierObjectInformation(*attr, mm.EdgeSoftening(), archive_3dm_version); + SetMeshModifierObjectInformation(*attr, mm.Thickening(), archive_3dm_version); + SetMeshModifierObjectInformation(*attr, mm.CurvePiping(), archive_3dm_version); + SetMeshModifierObjectInformation(*attr, mm.ShutLining(), archive_3dm_version); } } diff --git a/opennurbs_mesh_modifiers.h b/opennurbs_mesh_modifiers.h index e5d58bd4..9f5b215c 100644 --- a/opennurbs_mesh_modifiers.h +++ b/opennurbs_mesh_modifiers.h @@ -107,45 +107,66 @@ public: bool On(void) const; void SetOn(bool b); + // Specifies which texture is used for computing displacement amount ON_UUID Texture(void) const; void SetTexture(const ON_UUID& id); + // Specifies which texture mapping channel is used for displacement texture int MappingChannel(void) const; void SetMappingChannel(int c); + // Specifies the amount of displacement for the black color in the texture double BlackPoint(void) const; void SetBlackPoint(double b); + // Specifies the amount of displacement for the white color in the texture double WhitePoint(void) const; void SetWhitePoint(double w); + // Specifies how densely the object is initially subdivided. + // The lower the value, the higher the resolution of the displaced mesh. int InitialQuality(void) const; void SetInitialQuality(int q); + // Specifies whether to perform a mesh reduction as a post process to simplify the result of displacement bool FinalMaxFacesOn(void) const; void SetFinalMaxFacesOn(bool b); + // Specifies how many faces the reduction post process should target to int FinalMaxFaces(void) const; void SetFinalMaxFaces(int f); + // Specifies whether to perform a fairing step bool FairingOn(void) const; void SetFairingOn(bool b); + // Specifies number of steps for fairing process. This straightens rough feature edges. int Fairing(void) const; void SetFairing(int f); + // Specifies the maximum angle between face normals of adjacent faces + // that will get welded together. double PostWeldAngle(void) const; void SetPostWeldAngle(double a); + // Specifies in megabytes how much memory can be allocated for use by the displacement mesh. int MeshMemoryLimit(void) const; void SetMeshMemoryLimit(int l); + // Specifies the number of refinement passes int RefineSteps(void) const; void SetRefineSteps(int s); + // Specifies how sensitive the divider for contrasts is on the displacement texture. + // Specify 1 to split all mesh edges on each refine step. + // Specify 0.99 to make even slight contrasts on the displacement texture cause edges to be split. + // Specifying 0.01 only splits edges where heavy contrast exists. double RefineSensitivity(void) const; void SetRefineSensitivity(double s); + // Specifies which formula is used to calculate sweep resolution from initial quality. + // Default = Default formula. + // AbsoluteToleranceDependent = Formula used in Rhino 5. Dependent on absolute tolerance. enum class SweepResolutionFormulas : int { Default = 0, AbsoluteToleranceDependent = 1 }; SweepResolutionFormulas SweepResolutionFormula(void) const; void SetSweepResolutionFormula(SweepResolutionFormulas f); @@ -164,9 +185,9 @@ public: bool operator != (const SubItem& sub) const; // Returns the index of this sub-item. - // When this is >= 0 it is the component index of the face. - int Index(void) const; - void SetIndex(int i); + // When this is >= 0 it is the component index of the polysurface or SubD face. + int FaceIndex(void) const; + void SetFaceIndex(int i); // Overrides displacement 'on'. bool On(void) const; @@ -210,12 +231,12 @@ public: }; SubItem& AddSubItem(void); + void DeleteSubItem(int face_index); void DeleteAllSubItems(void); - SubItem* FindSubItem(const int index) const; + int FindSubItemArrayIndex(int face_index) const; + SubItem* FindSubItem(int face_index) const; SubItemIterator GetSubItemIterator(void) const; - virtual ON_UUID Uuid(void) const override; - class ON_CLASS Defaults final { public: @@ -233,6 +254,8 @@ public: static SweepResolutionFormulas SweepResolutionFormula(void); }; + virtual ON_UUID Uuid(void) const override; + public: // For internal use only. virtual ON_XMLNode* AddChildXML(ON_XMLRootNode& root) const override; @@ -349,10 +372,10 @@ public: const ON_ThickeningUserData& operator = (const ON_ThickeningUserData& ud); - virtual void SetToDefaults(void) const; - virtual bool GetDescription(ON_wString& s); - virtual void ReportVersionError(void) const; - virtual bool Transform(const ON_Xform& xform); + virtual void SetToDefaults(void) const override; + virtual bool GetDescription(ON_wString& s) override; + virtual void ReportVersionError(void) const override; + virtual bool Transform(const ON_Xform& xform) override; }; class ON_CLASS ON_Thickening : public ON_MeshModifier @@ -371,15 +394,19 @@ public: bool On(void) const; void SetOn(bool b); + // Specifies how thick meshes will be made double Distance(void) const; void SetDistance(double d); + // Specifies whether to make open meshes solid by adding walls when thickening bool Solid(void) const; void SetSolid(bool b); + // Specifies whether to only offset the original surface bool OffsetOnly(void) const; void SetOffsetOnly(bool b); + // Specifies whether to thicken to both sides of the surface bool BothSides(void) const; void SetBothSides(bool b); @@ -420,10 +447,10 @@ public: const ON_CurvePipingUserData& operator = (const ON_CurvePipingUserData& ud); - virtual void SetToDefaults(void) const; - virtual bool GetDescription(ON_wString& s); - virtual void ReportVersionError(void) const; - virtual bool Transform(const ON_Xform& xform); + virtual void SetToDefaults(void) const override; + virtual bool GetDescription(ON_wString& s) override; + virtual void ReportVersionError(void) const override; + virtual bool Transform(const ON_Xform& xform) override; }; class ON_CLASS ON_CurvePiping : public ON_MeshModifier @@ -532,11 +559,11 @@ public: bool On(void) const; void SetOn(bool b); - // Specifies whether the shutlining is faceted or not. + // Specifies whether the shut-lining is faceted or not. bool Faceted(void) const; void SetFaceted(bool b); - // Specifies whether the shutlining automatically updates or not. + // Specifies whether the shut-lining automatically updates or not. bool AutoUpdate(void) const; void SetAutoUpdate(bool b); @@ -556,21 +583,27 @@ public: bool operator == (const Curve& c) const; bool operator != (const Curve& c) const; + // Specifies the id of the curve object to use for a shut-line. ON_UUID Id(void) const; void SetId(const ON_UUID& id); + // Specifies the radius of the pipe used to create the shut-line for this curve. double Radius(void) const; void SetRadius(double d); + // Specifies the profile of the shut-line for this curve. int Profile(void) const; void SetProfile(int p); + // Specifies whether shut-line is created for the this curve. bool Enabled(void) const; void SetEnabled(bool b); + // Specifies whether this curve is pulled to the surface before creating the shut-line. bool Pull(void) const; void SetPull(bool b); + // Specifies whether to create a bump instead of a dent for this curve. bool IsBump(void) const; void SetIsBump(bool b); @@ -605,18 +638,18 @@ public: CImpl* m_impl; }; - // Adds a new curve to the shutlining. The curve will have an id of ON_nil_uuid. + // Adds a new curve to the shut-lining. The curve will have an id of ON_nil_uuid. // After adding a curve, you should set the id to that of a curve in the model - // that will be used to calculate the shutlining. + // that will be used to calculate the shut-lining. Curve& AddCurve(void); - // Deletes all the curves from the shutlining. + // Deletes all the curves from the shut-lining. void DeleteAllCurves(void); - // Finds a curve on the shutlining by its id. Returns null if not found. + // Finds a curve on the shut-lining by its id. Returns null if not found. Curve* FindCurve(const ON_UUID& id) const; - // Gets an iterator for iterating over all the curves on the shutlining. + // Gets an iterator for iterating over all the curves on the shut-lining. CurveIterator GetCurveIterator(void) const; virtual ON_UUID Uuid(void) const override; @@ -677,7 +710,6 @@ public: public: // For internal use only. void LoadFromXML(const ON_XMLRootNode&); - void SaveToXML(ON_XMLRootNode&) const; private: class CImpl; diff --git a/opennurbs_mesh_tools.cpp b/opennurbs_mesh_tools.cpp index 25764766..cbc95154 100644 --- a/opennurbs_mesh_tools.cpp +++ b/opennurbs_mesh_tools.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_mesh_topology.cpp b/opennurbs_mesh_topology.cpp index 15507fd9..875d742c 100644 --- a/opennurbs_mesh_topology.cpp +++ b/opennurbs_mesh_topology.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_model_component.cpp b/opennurbs_model_component.cpp index cfd44693..50dcde16 100644 --- a/opennurbs_model_component.cpp +++ b/opennurbs_model_component.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_model_component.h b/opennurbs_model_component.h index 35dfc952..89375b9a 100644 --- a/opennurbs_model_component.h +++ b/opennurbs_model_component.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_MODEL_COMPONENT_INC_) #define ON_MODEL_COMPONENT_INC_ diff --git a/opennurbs_model_geometry.cpp b/opennurbs_model_geometry.cpp index deb09b04..5cf81077 100644 --- a/opennurbs_model_geometry.cpp +++ b/opennurbs_model_geometry.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_model_geometry.h b/opennurbs_model_geometry.h index fe856488..f60a3f20 100644 --- a/opennurbs_model_geometry.h +++ b/opennurbs_model_geometry.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_MODEL_GEOMETRY_INC_) #define ON_MODEL_GEOMETRY_INC_ diff --git a/opennurbs_morph.cpp b/opennurbs_morph.cpp index 23d75f58..d73ddbbb 100644 --- a/opennurbs_morph.cpp +++ b/opennurbs_morph.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_nurbscurve.cpp b/opennurbs_nurbscurve.cpp index 7a56c3aa..e9457bb6 100644 --- a/opennurbs_nurbscurve.cpp +++ b/opennurbs_nurbscurve.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_nurbscurve.h b/opennurbs_nurbscurve.h index 55f11352..337c059c 100644 --- a/opennurbs_nurbscurve.h +++ b/opennurbs_nurbscurve.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_nurbssurface.cpp b/opennurbs_nurbssurface.cpp index 6bb367d9..d4bc7537 100644 --- a/opennurbs_nurbssurface.cpp +++ b/opennurbs_nurbssurface.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_nurbssurface.h b/opennurbs_nurbssurface.h index 0188b130..1e27c22b 100644 --- a/opennurbs_nurbssurface.h +++ b/opennurbs_nurbssurface.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_nurbsvolume.cpp b/opennurbs_nurbsvolume.cpp index 0b68696c..3da8576f 100644 --- a/opennurbs_nurbsvolume.cpp +++ b/opennurbs_nurbsvolume.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_object.cpp b/opennurbs_object.cpp index d3598770..9a2db36b 100644 --- a/opennurbs_object.cpp +++ b/opennurbs_object.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -65,6 +63,8 @@ unsigned int ON_IsOpennurbsApplicationId( return 6; if (ON_opennurbs7_id == id) return 7; + if (ON_opennurbs8_id == id) + return 8; return 0; } diff --git a/opennurbs_object.h b/opennurbs_object.h index cab9a4e8..83a4d086 100644 --- a/opennurbs_object.h +++ b/opennurbs_object.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_object_history.cpp b/opennurbs_object_history.cpp index 993583a8..0e82a221 100644 --- a/opennurbs_object_history.cpp +++ b/opennurbs_object_history.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_object_history.h b/opennurbs_object_history.h index 20230a58..7019331d 100644 --- a/opennurbs_object_history.h +++ b/opennurbs_object_history.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_OBJECT_HISTORY_INC_) #define ON_OBJECT_HISTORY_INC_ diff --git a/opennurbs_objref.cpp b/opennurbs_objref.cpp index caa43444..11e925b1 100644 --- a/opennurbs_objref.cpp +++ b/opennurbs_objref.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_objref.h b/opennurbs_objref.h index e2090860..8fb39711 100644 --- a/opennurbs_objref.h +++ b/opennurbs_objref.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_OBJREF_INC_) #define ON_OBJREF_INC_ diff --git a/opennurbs_offsetsurface.cpp b/opennurbs_offsetsurface.cpp index fc703b39..68c22c79 100644 --- a/opennurbs_offsetsurface.cpp +++ b/opennurbs_offsetsurface.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_offsetsurface.h b/opennurbs_offsetsurface.h index 36c003c9..e6622d05 100644 --- a/opennurbs_offsetsurface.h +++ b/opennurbs_offsetsurface.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_OFFSETSURFACE_INC_) #define ON_OFFSETSURFACE_INC_ diff --git a/opennurbs_optimize.cpp b/opennurbs_optimize.cpp index cf16a22d..71235e77 100644 --- a/opennurbs_optimize.cpp +++ b/opennurbs_optimize.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_optimize.h b/opennurbs_optimize.h index c3e07a21..2870a3eb 100644 --- a/opennurbs_optimize.h +++ b/opennurbs_optimize.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_OPTIMIZE_INC_) #define OPENNURBS_OPTIMIZE_INC_ diff --git a/opennurbs_parse.h b/opennurbs_parse.h index 092f2959..def45e62 100644 --- a/opennurbs_parse.h +++ b/opennurbs_parse.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_PARSE_INC_) #define ON_PARSE_INC_ diff --git a/opennurbs_parse_angle.cpp b/opennurbs_parse_angle.cpp index e37306a7..031f8687 100644 --- a/opennurbs_parse_angle.cpp +++ b/opennurbs_parse_angle.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -110,4 +107,4 @@ int ON_ParseAngleArcDegreesExpression( ); return parsed_element_count; -} \ No newline at end of file +} diff --git a/opennurbs_parse_length.cpp b/opennurbs_parse_length.cpp index c80c7a1e..a4266f0a 100644 --- a/opennurbs_parse_length.cpp +++ b/opennurbs_parse_length.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_parse_number.cpp b/opennurbs_parse_number.cpp index aa165334..d63203b2 100644 --- a/opennurbs_parse_number.cpp +++ b/opennurbs_parse_number.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_parse_point.cpp b/opennurbs_parse_point.cpp index bf0d5b74..251bb157 100644 --- a/opennurbs_parse_point.cpp +++ b/opennurbs_parse_point.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_parse_settings.cpp b/opennurbs_parse_settings.cpp index 10fc513b..13e1c1a6 100644 --- a/opennurbs_parse_settings.cpp +++ b/opennurbs_parse_settings.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_photogrammetry.cpp b/opennurbs_photogrammetry.cpp index 75dbd6ec..a5719a77 100644 --- a/opennurbs_photogrammetry.cpp +++ b/opennurbs_photogrammetry.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_photogrammetry.h b/opennurbs_photogrammetry.h index c527e900..2c628d84 100644 --- a/opennurbs_photogrammetry.h +++ b/opennurbs_photogrammetry.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_PHOTOGRAMMETRY_INC_) #define OPENNURBS_PHOTOGRAMMETRY_INC_ diff --git a/opennurbs_plane.cpp b/opennurbs_plane.cpp index 85b9a349..8ead710e 100644 --- a/opennurbs_plane.cpp +++ b/opennurbs_plane.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_plane.h b/opennurbs_plane.h index 2f7e51af..3d061926 100644 --- a/opennurbs_plane.h +++ b/opennurbs_plane.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_PLANE_INC_) #define ON_PLANE_INC_ diff --git a/opennurbs_planesurface.cpp b/opennurbs_planesurface.cpp index 91c90669..78ba9f46 100644 --- a/opennurbs_planesurface.cpp +++ b/opennurbs_planesurface.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_planesurface.h b/opennurbs_planesurface.h index 911f067b..08cfb3e2 100644 --- a/opennurbs_planesurface.h +++ b/opennurbs_planesurface.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_GEOMETRY_SURFACE_PLANE_INC_) #define ON_GEOMETRY_SURFACE_PLANE_INC_ diff --git a/opennurbs_pluginlist.cpp b/opennurbs_pluginlist.cpp index df101e01..2a60761e 100644 --- a/opennurbs_pluginlist.cpp +++ b/opennurbs_pluginlist.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_pluginlist.h b/opennurbs_pluginlist.h index 94618b9c..31d4b09a 100644 --- a/opennurbs_pluginlist.h +++ b/opennurbs_pluginlist.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_PLUGINLIST_INC_) #define OPENNURBS_PLUGINLIST_INC_ diff --git a/opennurbs_point.cpp b/opennurbs_point.cpp index c85b42dd..188cf723 100644 --- a/opennurbs_point.cpp +++ b/opennurbs_point.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_point.h b/opennurbs_point.h index e1253359..db431fa9 100644 --- a/opennurbs_point.h +++ b/opennurbs_point.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_pointcloud.cpp b/opennurbs_pointcloud.cpp index 1a1d5044..5a5edd1a 100644 --- a/opennurbs_pointcloud.cpp +++ b/opennurbs_pointcloud.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_pointcloud.h b/opennurbs_pointcloud.h index cdc396a4..5a771c61 100644 --- a/opennurbs_pointcloud.h +++ b/opennurbs_pointcloud.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_POINTCLOUD_INC_) #define OPENNURBS_POINTCLOUD_INC_ diff --git a/opennurbs_pointgeometry.cpp b/opennurbs_pointgeometry.cpp index 839dc3c8..b5fa3f2a 100644 --- a/opennurbs_pointgeometry.cpp +++ b/opennurbs_pointgeometry.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_pointgeometry.h b/opennurbs_pointgeometry.h index 35dd8300..b9657e20 100644 --- a/opennurbs_pointgeometry.h +++ b/opennurbs_pointgeometry.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_POINT_GEOMETRY_INC_) #define OPENNURBS_POINT_GEOMETRY_INC_ diff --git a/opennurbs_pointgrid.cpp b/opennurbs_pointgrid.cpp index 1395cd18..5cd8a17c 100644 --- a/opennurbs_pointgrid.cpp +++ b/opennurbs_pointgrid.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_pointgrid.h b/opennurbs_pointgrid.h index 6bf223c5..9ccafc4b 100644 --- a/opennurbs_pointgrid.h +++ b/opennurbs_pointgrid.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_POINT_GRID_INC_) #define OPENNURBS_POINT_GRID_INC_ diff --git a/opennurbs_polycurve.cpp b/opennurbs_polycurve.cpp index 01396b15..7a94a004 100644 --- a/opennurbs_polycurve.cpp +++ b/opennurbs_polycurve.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_polycurve.h b/opennurbs_polycurve.h index 577c9cd1..6cc2cdbd 100644 --- a/opennurbs_polycurve.h +++ b/opennurbs_polycurve.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_polyedgecurve.h b/opennurbs_polyedgecurve.h index e311327f..63c21645 100644 --- a/opennurbs_polyedgecurve.h +++ b/opennurbs_polyedgecurve.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_POLYEDGECURVE_INC_) #define ON_POLYEDGECURVE_INC_ diff --git a/opennurbs_polyline.cpp b/opennurbs_polyline.cpp index 8a952529..5c026d2d 100644 --- a/opennurbs_polyline.cpp +++ b/opennurbs_polyline.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_polyline.h b/opennurbs_polyline.h index 7f9fe18a..4642a6b8 100644 --- a/opennurbs_polyline.h +++ b/opennurbs_polyline.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_POLYLINE_INC_) #define ON_POLYLINE_INC_ diff --git a/opennurbs_polylinecurve.cpp b/opennurbs_polylinecurve.cpp index 00453fda..ec51e0ed 100644 --- a/opennurbs_polylinecurve.cpp +++ b/opennurbs_polylinecurve.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_polylinecurve.h b/opennurbs_polylinecurve.h index efea3364..228b3015 100644 --- a/opennurbs_polylinecurve.h +++ b/opennurbs_polylinecurve.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_CURVE_POLYLINE_INC_) #define OPENNURBS_CURVE_POLYLINE_INC_ diff --git a/opennurbs_post_effects.cpp b/opennurbs_post_effects.cpp index 0609344e..eb5ab4b4 100644 --- a/opennurbs_post_effects.cpp +++ b/opennurbs_post_effects.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" #include "opennurbs_internal_defines.h" diff --git a/opennurbs_private_wrap_defs.h b/opennurbs_private_wrap_defs.h index ba4ee69a..7fa27ead 100644 --- a/opennurbs_private_wrap_defs.h +++ b/opennurbs_private_wrap_defs.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #if !defined(OPENNURBS_PRIVATE_WRAP_DEFS_INC_) #define OPENNURBS_PRIVATE_WRAP_DEFS_INC_ diff --git a/opennurbs_progress_reporter.h b/opennurbs_progress_reporter.h index afc13fb1..f2a87de4 100644 --- a/opennurbs_progress_reporter.h +++ b/opennurbs_progress_reporter.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_PROGRESS_REPORTER_INC_) #define OPENNURBS_PROGRESS_REPORTER_INC_ diff --git a/opennurbs_public_version.h b/opennurbs_public_version.h index 9fa6e4c2..a7611da3 100644 --- a/opennurbs_public_version.h +++ b/opennurbs_public_version.h @@ -14,10 +14,10 @@ // first step in each build. // #define RMA_VERSION_YEAR 2022 -#define RMA_VERSION_MONTH 9 -#define RMA_VERSION_DATE 6 -#define RMA_VERSION_HOUR 10 -#define RMA_VERSION_MINUTE 45 +#define RMA_VERSION_MONTH 11 +#define RMA_VERSION_DATE 21 +#define RMA_VERSION_HOUR 11 +#define RMA_VERSION_MINUTE 10 //////////////////////////////////////////////////////////////// // @@ -35,8 +35,8 @@ // 3 = build system release build #define RMA_VERSION_BRANCH 0 -#define VERSION_WITH_COMMAS 8,0,22249,10450 -#define VERSION_WITH_PERIODS 8.0.22249.10450 +#define VERSION_WITH_COMMAS 8,0,22325,11100 +#define VERSION_WITH_PERIODS 8.0.22325.11100 #define COPYRIGHT "Copyright (C) 1993-2022, Robert McNeel & Associates. All Rights Reserved." #define SPECIAL_BUILD_DESCRIPTION "Public OpenNURBS C++ 3dm file IO library." @@ -47,8 +47,8 @@ #define RMA_VERSION_NUMBER_SR_STRING "SR0" #define RMA_VERSION_NUMBER_SR_WSTRING L"SR0" -#define RMA_VERSION_WITH_PERIODS_STRING "8.0.22249.10450" -#define RMA_VERSION_WITH_PERIODS_WSTRING L"8.0.22249.10450" +#define RMA_VERSION_WITH_PERIODS_STRING "8.0.22325.11100" +#define RMA_VERSION_WITH_PERIODS_WSTRING L"8.0.22325.11100" diff --git a/opennurbs_quacksort_template.h b/opennurbs_quacksort_template.h index 13316a17..abbd5e01 100644 --- a/opennurbs_quacksort_template.h +++ b/opennurbs_quacksort_template.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2011 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ /* See opennurbs_sort.cpp for examples showing how to use diff --git a/opennurbs_quaternion.cpp b/opennurbs_quaternion.cpp index 52203957..7de9c428 100644 --- a/opennurbs_quaternion.cpp +++ b/opennurbs_quaternion.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_quaternion.h b/opennurbs_quaternion.h index 233843f2..d7430987 100644 --- a/opennurbs_quaternion.h +++ b/opennurbs_quaternion.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_QUATERNION_INC_) #define ON_QUATERNION_INC_ diff --git a/opennurbs_rand.cpp b/opennurbs_rand.cpp index 3251b53f..903188b4 100644 --- a/opennurbs_rand.cpp +++ b/opennurbs_rand.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_rand.h b/opennurbs_rand.h index c4681750..69ce6b47 100644 --- a/opennurbs_rand.h +++ b/opennurbs_rand.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_RANDOM_NUMBER_INC_) #define OPENNURBS_RANDOM_NUMBER_INC_ diff --git a/opennurbs_render_content.h b/opennurbs_render_content.h index 2b3ea5a1..19e09992 100644 --- a/opennurbs_render_content.h +++ b/opennurbs_render_content.h @@ -56,6 +56,7 @@ public: static BackgroundProjections ProjectionFromString(const wchar_t* proj); static const wchar_t* StringFromProjection(BackgroundProjections proj); +protected: /** Emergency virtual function for future expansion. */ virtual void* EVF(const wchar_t* wszFunc, void* pvData); @@ -151,6 +152,7 @@ public: virtual ON_RenderContent* GetNextChild(void); + protected: /** Emergency virtual function for future expansion. */ virtual void* EVF(const wchar_t* func, void* data); @@ -228,7 +230,7 @@ public: static const ON_RenderContent* FromModelComponentRef(const ON_ModelComponentReference& ref, const ON_RenderContent* none_return_value); -public: +protected: /** Emergency virtual function for future expansion. */ virtual void* EVF(const wchar_t* func, void* data); diff --git a/opennurbs_rendering.h b/opennurbs_rendering.h index 2a83bca2..55d8ae6b 100644 --- a/opennurbs_rendering.h +++ b/opennurbs_rendering.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_RENDERING_INC_) #define OPENNURBS_RENDERING_INC_ diff --git a/opennurbs_revsurface.cpp b/opennurbs_revsurface.cpp index 1c68fa54..05fe1db4 100644 --- a/opennurbs_revsurface.cpp +++ b/opennurbs_revsurface.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_revsurface.h b/opennurbs_revsurface.h index bcea17dd..b8c4a19f 100644 --- a/opennurbs_revsurface.h +++ b/opennurbs_revsurface.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_REVSURFACE_INC_) #define OPENNURBS_REVSURFACE_INC_ diff --git a/opennurbs_rtree.cpp b/opennurbs_rtree.cpp index 0f8ace6e..7c0be590 100644 --- a/opennurbs_rtree.cpp +++ b/opennurbs_rtree.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_rtree.h b/opennurbs_rtree.h index 7e19b914..fb958cb7 100644 --- a/opennurbs_rtree.h +++ b/opennurbs_rtree.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_RTREE_INC_) #define OPENNURBS_RTREE_INC_ diff --git a/opennurbs_safe_frame.cpp b/opennurbs_safe_frame.cpp index 2a22e3b2..91f89e48 100644 --- a/opennurbs_safe_frame.cpp +++ b/opennurbs_safe_frame.cpp @@ -1,4 +1,3 @@ -/* // // Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" #include "opennurbs_internal_defines.h" diff --git a/opennurbs_safe_frame.h b/opennurbs_safe_frame.h index e0588668..8c0d67d8 100644 --- a/opennurbs_safe_frame.h +++ b/opennurbs_safe_frame.h @@ -1,4 +1,3 @@ -/* // // Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_SAFE_FRAME_INC_) #define ON_SAFE_FRAME_INC_ @@ -101,7 +99,7 @@ public: // Sets the title frame Y scale. void SetTitleFrameYScale(double d); -public: +private: class CImpl; CImpl* m_impl; }; diff --git a/opennurbs_sha1.cpp b/opennurbs_sha1.cpp index 3d0c836b..faad5155 100644 --- a/opennurbs_sha1.cpp +++ b/opennurbs_sha1.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_sha1.h b/opennurbs_sha1.h index 20ae2f4e..74ed301e 100644 --- a/opennurbs_sha1.h +++ b/opennurbs_sha1.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_SHA1_INC_) #define OPENNURBS_SHA1_INC_ diff --git a/opennurbs_skylight.h b/opennurbs_skylight.h index ed45a598..c97cd66c 100644 --- a/opennurbs_skylight.h +++ b/opennurbs_skylight.h @@ -51,7 +51,7 @@ public: // Set the skylight shadow intensity. This is unused at present. void SetShadowIntensity(double d); -public: +private: class CImpl; CImpl* m_impl; }; diff --git a/opennurbs_sleeplock.cpp b/opennurbs_sleeplock.cpp index e32cb9fd..7327c761 100644 --- a/opennurbs_sleeplock.cpp +++ b/opennurbs_sleeplock.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_sleeplock.h b/opennurbs_sleeplock.h index 5020c30b..a9738075 100644 --- a/opennurbs_sleeplock.h +++ b/opennurbs_sleeplock.h @@ -1,8 +1,6 @@ #pragma once -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -13,7 +11,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_SLEEPLOCK_INC_) #define OPENNURBS_SLEEPLOCK_INC_ diff --git a/opennurbs_sphere.cpp b/opennurbs_sphere.cpp index 3bcec36c..4d269cbe 100644 --- a/opennurbs_sphere.cpp +++ b/opennurbs_sphere.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_sphere.h b/opennurbs_sphere.h index b9cb28ff..2cf6c9b9 100644 --- a/opennurbs_sphere.h +++ b/opennurbs_sphere.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_SPHERE_INC_) #define ON_SPHERE_INC_ diff --git a/opennurbs_statics.cpp b/opennurbs_statics.cpp index 8af9420a..82be538b 100644 --- a/opennurbs_statics.cpp +++ b/opennurbs_statics.cpp @@ -273,12 +273,15 @@ const ON_UUID ON_opennurbs6_id = { 0x7b0b585d, 0x7a31, 0x45d0,{ 0x92, 0x5e, 0xbd // {523bfe6e-ef49-4b75-a8d6-253faf5044d3} const ON_UUID ON_opennurbs7_id = { 0x523bfe6e, 0xef49, 0x4b75,{ 0xa8, 0xd6, 0x25, 0x3f, 0xaf, 0x50, 0x44, 0xd3 } }; +// {50EDE5C9-1487-4B4C-B3AA-6840B460E3CF} +const ON_UUID ON_opennurbs8_id = { 0x50ede5c9, 0x1487, 0x4b4c, { 0xb3, 0xaa, 0x68, 0x40, 0xb4, 0x60, 0xe3, 0xcf } }; + // ON_opennurbs_id is always set to the value for the current version // of opennurbs. ON_opennurbs_id is the id that should be used as // the userdata application id for userdata classes definitions that // are in the opennurbs library. -const ON_UUID ON_opennurbs_id = ON_opennurbs7_id; +const ON_UUID ON_opennurbs_id = ON_opennurbs8_id; const ON_UuidPairList ON_UuidPairList::EmptyList; diff --git a/opennurbs_std_string.h b/opennurbs_std_string.h index 5d67d2b3..bf763504 100644 --- a/opennurbs_std_string.h +++ b/opennurbs_std_string.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_STD_STRING_INC_) #define ON_STD_STRING_INC_ diff --git a/opennurbs_string.cpp b/opennurbs_string.cpp index 04f49531..2ec3907c 100644 --- a/opennurbs_string.cpp +++ b/opennurbs_string.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -2664,4 +2661,4 @@ https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ ON_Locale will need to have posix locale_t available for apple functions. -*/ \ No newline at end of file +*/ diff --git a/opennurbs_string.h b/opennurbs_string.h index d270c16b..a86f79f7 100644 --- a/opennurbs_string.h +++ b/opennurbs_string.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_STRING_INC_) #define ON_STRING_INC_ diff --git a/opennurbs_string_compare.cpp b/opennurbs_string_compare.cpp index 19eb90f6..55686614 100644 --- a/opennurbs_string_compare.cpp +++ b/opennurbs_string_compare.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_string_format.cpp b/opennurbs_string_format.cpp index 5fa342d4..de066572 100644 --- a/opennurbs_string_format.cpp +++ b/opennurbs_string_format.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_string_scan.cpp b/opennurbs_string_scan.cpp index c804a76d..53a64192 100644 --- a/opennurbs_string_scan.cpp +++ b/opennurbs_string_scan.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_string_value.h b/opennurbs_string_value.h index 72f67d6d..e8e186b2 100644 --- a/opennurbs_string_value.h +++ b/opennurbs_string_value.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #pragma once #if !defined(OPENNURBS_STRING_VALUE_INC_) #define OPENNURBS_STRING_VALUE_INC_ diff --git a/opennurbs_string_values.cpp b/opennurbs_string_values.cpp index e6918ba1..9fe09b1a 100644 --- a/opennurbs_string_values.cpp +++ b/opennurbs_string_values.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_subd.cpp b/opennurbs_subd.cpp index 79d02d4e..252d7727 100644 --- a/opennurbs_subd.cpp +++ b/opennurbs_subd.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,21 +23,6 @@ #include "opennurbs_subd_data.h" -/* -// -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - ON_SubDToBrepParameters::VertexProcess ON_SubDToBrepParameters::VertexProcessFromUnsigned( unsigned int vertex_process_as_unsigned diff --git a/opennurbs_subd.h b/opennurbs_subd.h index 6103c7f1..d22357e7 100644 --- a/opennurbs_subd.h +++ b/opennurbs_subd.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if 0 diff --git a/opennurbs_subd_archive.cpp b/opennurbs_subd_archive.cpp index ebc0e879..e81ee389 100644 --- a/opennurbs_subd_archive.cpp +++ b/opennurbs_subd_archive.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - static bool Internal_WriteDouble3( const double x[3], ON_BinaryArchive& archive diff --git a/opennurbs_subd_copy.cpp b/opennurbs_subd_copy.cpp index 6c1ad85d..1209148b 100644 --- a/opennurbs_subd_copy.cpp +++ b/opennurbs_subd_copy.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - unsigned int ON_SubDArchiveIdMap::ArchiveIdFromComponentPtr(ON__UINT_PTR ptr) { return (unsigned int)(ptr/(ON_SUBD_COMPONENT_FLAGS_MASK+1)); diff --git a/opennurbs_subd_data.cpp b/opennurbs_subd_data.cpp index 86c00cd7..5599bb5d 100644 --- a/opennurbs_subd_data.cpp +++ b/opennurbs_subd_data.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - const ON_SubDLevel ON_SubDLevel::Empty; ////////////////////////////////////////////////////////////////////////// diff --git a/opennurbs_subd_data.h b/opennurbs_subd_data.h index 8567e9bf..6062e635 100644 --- a/opennurbs_subd_data.h +++ b/opennurbs_subd_data.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if defined(OPENNURBS_INC_IN_PROGRESS) /////////////////////////////////////////////////////////////////// diff --git a/opennurbs_subd_fragment.cpp b/opennurbs_subd_fragment.cpp index b6571cd1..e1e37536 100644 --- a/opennurbs_subd_fragment.cpp +++ b/opennurbs_subd_fragment.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,21 +23,6 @@ #include "opennurbs_subd_data.h" -/* -// -// Copyright (c) 1993-2019 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - ///////////////////////////////////////////////////////////////////////////////////////// // // ON_SubDMeshFragment diff --git a/opennurbs_subd_frommesh.cpp b/opennurbs_subd_frommesh.cpp index 569e677a..64c9c471 100644 --- a/opennurbs_subd_frommesh.cpp +++ b/opennurbs_subd_frommesh.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - class ON_MeshNGonEdge { public: diff --git a/opennurbs_subd_heap.cpp b/opennurbs_subd_heap.cpp index 9bf3b64b..a25ead1d 100644 --- a/opennurbs_subd_heap.cpp +++ b/opennurbs_subd_heap.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - enum { diff --git a/opennurbs_subd_iter.cpp b/opennurbs_subd_iter.cpp index 02abd2d6..01626358 100644 --- a/opennurbs_subd_iter.cpp +++ b/opennurbs_subd_iter.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - ////////////////////////////////////////////////////////////////////////// // // ON_SubDVertexArray diff --git a/opennurbs_subd_limit.cpp b/opennurbs_subd_limit.cpp index d7ab441d..7f7b7d16 100644 --- a/opennurbs_subd_limit.cpp +++ b/opennurbs_subd_limit.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - bool ON_SubDQuadNeighborhood::IsValid() const { unsigned int count = 0; diff --git a/opennurbs_subd_matrix.cpp b/opennurbs_subd_matrix.cpp index 089d1ff2..326e8afd 100644 --- a/opennurbs_subd_matrix.cpp +++ b/opennurbs_subd_matrix.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - ///////////////////////////////////////////////////////// // // Built-in quad subdivision diff --git a/opennurbs_subd_mesh.cpp b/opennurbs_subd_mesh.cpp index 2f483614..36163d1f 100644 --- a/opennurbs_subd_mesh.cpp +++ b/opennurbs_subd_mesh.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - bool ON_SubDFaceRegionBreakpoint( unsigned int level0_face_id, const class ON_SubDComponentRegionIndex& region_index diff --git a/opennurbs_subd_ref.cpp b/opennurbs_subd_ref.cpp index 72f20916..e7334b5f 100644 --- a/opennurbs_subd_ref.cpp +++ b/opennurbs_subd_ref.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - ////////////////////////////////////////////////////////////////////////// // // ON_SubDRef diff --git a/opennurbs_subd_ring.cpp b/opennurbs_subd_ring.cpp index 3cba6c20..24a6b4d1 100644 --- a/opennurbs_subd_ring.cpp +++ b/opennurbs_subd_ring.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - unsigned int ON_SubD::GetQuadSectorPointRing( bool bFirstPass, bool bSecondPass, diff --git a/opennurbs_subd_sector.cpp b/opennurbs_subd_sector.cpp index b9d7f4a0..e0b3c15e 100644 --- a/opennurbs_subd_sector.cpp +++ b/opennurbs_subd_sector.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - double ON_SubDSectorType::SectorCoefficientCalculationError() { return ON_SUBD_RETURN_ERROR(ON_SubDSectorType::ErrorSectorCoefficient); diff --git a/opennurbs_subd_texture.cpp b/opennurbs_subd_texture.cpp index a9c7d5e3..cba7e47d 100644 --- a/opennurbs_subd_texture.cpp +++ b/opennurbs_subd_texture.cpp @@ -1,3 +1,16 @@ +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. +// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert +// McNeel & Associates. +// +// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. +// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF +// MERCHANTABILITY ARE HEREBY DISCLAIMED. +// +// For complete openNURBS copyright information see . +// +//////////////////////////////////////////////////////////////// + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) @@ -10,22 +23,6 @@ #include "opennurbs_subd_data.h" -/* $NoKeywords: $ */ -/* -// -// Copyright (c) 1993-2019 Robert McNeel & Associates. All rights reserved. -// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert -// McNeel & Associates. -// -// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. -// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF -// MERCHANTABILITY ARE HEREBY DISCLAIMED. -// -// For complete openNURBS copyright information see . -// -//////////////////////////////////////////////////////////////// -*/ - unsigned char ON_SubD::ObsoleteTextureDomainTypeFromTextureCoordinateType(ON_SubDTextureCoordinateType texture_coordinate_type) { /* diff --git a/opennurbs_sum.cpp b/opennurbs_sum.cpp index 3e5dfcf3..a2c2056f 100644 --- a/opennurbs_sum.cpp +++ b/opennurbs_sum.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_sumsurface.cpp b/opennurbs_sumsurface.cpp index 85f5bd59..2efcbff2 100644 --- a/opennurbs_sumsurface.cpp +++ b/opennurbs_sumsurface.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_sumsurface.h b/opennurbs_sumsurface.h index bee28345..6eca2626 100644 --- a/opennurbs_sumsurface.h +++ b/opennurbs_sumsurface.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_SUM_SURFACE_INC_) #define OPENNURBS_SUM_SURFACE_INC_ diff --git a/opennurbs_sun.h b/opennurbs_sun.h index 66df5d50..91ced153 100644 --- a/opennurbs_sun.h +++ b/opennurbs_sun.h @@ -166,7 +166,7 @@ public: // Get a color for rendering a sun light when the sun is at a particular altitude in the sky. static ON_4fColor SunColorFromAltitude(double altitude); -public: +private: class CImpl; CImpl* m_impl; }; diff --git a/opennurbs_surface.cpp b/opennurbs_surface.cpp index d7e6abf4..330ff112 100644 --- a/opennurbs_surface.cpp +++ b/opennurbs_surface.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -1195,10 +1192,12 @@ ON_Surface::EvNormal( // returns false if unable to evaluate if ( rc ) { const double len_ds = ds.Length(); const double len_dt = dt.Length(); - // do not reduce the tolerance used here - there is a retry in the code // below. - if ( len_ds > ON_SQRT_EPSILON*len_dt && len_dt > ON_SQRT_EPSILON*len_ds ) + //17 Oct 2022 - Chuck - Added test for parallel partials. + if ( len_ds > ON_SQRT_EPSILON*len_dt && len_dt > ON_SQRT_EPSILON*len_ds && + ds.IsParallelTo(dt, 0.01*ON_DEFAULT_ANGLE_TOLERANCE) == 0) + { ON_3dVector a = ds/len_ds; ON_3dVector b = dt/len_dt; diff --git a/opennurbs_surface.h b/opennurbs_surface.h index 0d54d602..2c0a10ad 100644 --- a/opennurbs_surface.h +++ b/opennurbs_surface.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_surfaceproxy.cpp b/opennurbs_surfaceproxy.cpp index 14938dbb..6d797a2b 100644 --- a/opennurbs_surfaceproxy.cpp +++ b/opennurbs_surfaceproxy.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_surfaceproxy.h b/opennurbs_surfaceproxy.h index a31db7f3..f0a3566f 100644 --- a/opennurbs_surfaceproxy.h +++ b/opennurbs_surfaceproxy.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_symmetry.cpp b/opennurbs_symmetry.cpp index b67edfb6..b9c83d45 100644 --- a/opennurbs_symmetry.cpp +++ b/opennurbs_symmetry.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2019 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_symmetry.h b/opennurbs_symmetry.h index a945ff20..307b7996 100644 --- a/opennurbs_symmetry.h +++ b/opennurbs_symmetry.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_SYMMETRY_INC_) #define OPENNURBS_SYMMETRY_INC_ diff --git a/opennurbs_system.h b/opennurbs_system.h index 1532b185..369ad5b8 100644 --- a/opennurbs_system.h +++ b/opennurbs_system.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,15 +10,12 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ -/* //////////////////////////////////////////////////////////////// // // Includes all system headers required to use the openNURBS toolkit. // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_SYSTEM_INC_) #define OPENNURBS_SYSTEM_INC_ diff --git a/opennurbs_system_compiler.h b/opennurbs_system_compiler.h index 24737249..ff7c89a5 100644 --- a/opennurbs_system_compiler.h +++ b/opennurbs_system_compiler.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,15 +10,12 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ -/* //////////////////////////////////////////////////////////////// // // Determines what compiler is being used. // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_SYSTEM_COMPILER_INC_) diff --git a/opennurbs_system_runtime.h b/opennurbs_system_runtime.h index 37fb87bd..04800941 100644 --- a/opennurbs_system_runtime.h +++ b/opennurbs_system_runtime.h @@ -1,5 +1,4 @@ -/* -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -10,18 +9,15 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_SYSTEM_RUNTIME_INC_) #define OPENNURBS_SYSTEM_RUNTIME_INC_ -/* //////////////////////////////////////////////////////////////// // // Determines the runtime environment where the code is executed. // //////////////////////////////////////////////////////////////// -*/ /* diff --git a/opennurbs_terminator.h b/opennurbs_terminator.h index 7c02ca4c..39c3157a 100644 --- a/opennurbs_terminator.h +++ b/opennurbs_terminator.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_TERMINATOR_INC_) #define OPENNURBS_TERMINATOR_INC_ diff --git a/opennurbs_testclass.h b/opennurbs_testclass.h index 8759d986..1b4988de 100644 --- a/opennurbs_testclass.h +++ b/opennurbs_testclass.h @@ -1,5 +1,4 @@ -/* -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -10,7 +9,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_TEST_CLASS_INC_) #define OPENNURBS_TEST_CLASS_INC_ diff --git a/opennurbs_text.cpp b/opennurbs_text.cpp index 62528bbc..6d8d3baf 100644 --- a/opennurbs_text.cpp +++ b/opennurbs_text.cpp @@ -1,7 +1,5 @@ - -/* $NoKeywords: $ */ -/* -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +9,7 @@ // // For complete openNURBS copyright information see . //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_text.h b/opennurbs_text.h index 4e9c36e5..9d1bd82a 100644 --- a/opennurbs_text.h +++ b/opennurbs_text.h @@ -1,8 +1,5 @@ - -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -13,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #ifndef OPENNURBS_TEXT_H_INCLUDED #define OPENNURBS_TEXT_H_INCLUDED diff --git a/opennurbs_text_style.cpp b/opennurbs_text_style.cpp index b7276697..07d7f4d3 100644 --- a/opennurbs_text_style.cpp +++ b/opennurbs_text_style.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_text_style.h b/opennurbs_text_style.h index 493a18ba..62312237 100644 --- a/opennurbs_text_style.h +++ b/opennurbs_text_style.h @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_textcontext.cpp b/opennurbs_textcontext.cpp index 2549bd9d..8ca6c4dc 100644 --- a/opennurbs_textcontext.cpp +++ b/opennurbs_textcontext.cpp @@ -1,4 +1,5 @@ -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_textcontext.h b/opennurbs_textcontext.h index 3d0221f7..2f921cab 100644 --- a/opennurbs_textcontext.h +++ b/opennurbs_textcontext.h @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -42,4 +42,4 @@ public: #endif - \ No newline at end of file + diff --git a/opennurbs_textdraw.cpp b/opennurbs_textdraw.cpp index ec18d59c..2e94d09c 100644 --- a/opennurbs_textdraw.cpp +++ b/opennurbs_textdraw.cpp @@ -1,6 +1,5 @@ -/* $NoKeywords: $ */ -/* -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -10,7 +9,7 @@ // // For complete openNURBS copyright information see . //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" //#include "opennurbs_text.h" // diff --git a/opennurbs_textdraw.h b/opennurbs_textdraw.h index 5d84875a..8b0544e9 100644 --- a/opennurbs_textdraw.h +++ b/opennurbs_textdraw.h @@ -1,8 +1,5 @@ - -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -13,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + //#if !defined(OPENNURBS_TEXTDRAW_INC_) //#define OPENNURBS_TEXTDRAW_INC_ // diff --git a/opennurbs_textglyph.cpp b/opennurbs_textglyph.cpp index 364fec55..03bb54db 100644 --- a/opennurbs_textglyph.cpp +++ b/opennurbs_textglyph.cpp @@ -1,5 +1,5 @@ -/* -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -9,7 +9,7 @@ // // For complete openNURBS copyright information see . //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_textglyph.h b/opennurbs_textglyph.h index 40c8d079..40964a7a 100644 --- a/opennurbs_textglyph.h +++ b/opennurbs_textglyph.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,7 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ + #if !defined(OPENNURBS_TEXTGLYPH_INC_) #define OPENNURBS_TEXTGLYPH_INC_ diff --git a/opennurbs_textiterator.cpp b/opennurbs_textiterator.cpp index 442f1b61..5ef9b0e5 100644 --- a/opennurbs_textiterator.cpp +++ b/opennurbs_textiterator.cpp @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2018 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -3316,7 +3314,6 @@ bool RtfComposer::Compose( { // RH-64720 - Only do this if the stack isn't from a field run_strings += L"[["; - run_strings += run->m_stacked_text->m_separator; GetRunText(run->m_stacked_text->m_top_run, run_strings, make_rtf); run_strings += run->m_stacked_text->m_separator; GetRunText(run->m_stacked_text->m_bottom_run, run_strings, make_rtf); @@ -3597,7 +3594,6 @@ const ON_wString RtfComposer::ComposeAppleRTF( if (run->IsStacked() == ON_TextRun::Stacked::kStacked && run->m_stacked_text != 0) { run_strings += L"[["; - run_strings += run->m_stacked_text->m_separator; GetRunText(run->m_stacked_text->m_top_run, run_strings, true_bool); run_strings += run->m_stacked_text->m_separator; GetRunText(run->m_stacked_text->m_bottom_run, run_strings, true_bool); diff --git a/opennurbs_textiterator.h b/opennurbs_textiterator.h index 6f1c82db..d1846214 100644 --- a/opennurbs_textiterator.h +++ b/opennurbs_textiterator.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_TEXTITERATOR_INC_) #define OPENNURBS_TEXTITERATOR_INC_ diff --git a/opennurbs_textlog.cpp b/opennurbs_textlog.cpp index 6b207a07..797f78f9 100644 --- a/opennurbs_textlog.cpp +++ b/opennurbs_textlog.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_textlog.h b/opennurbs_textlog.h index 78f7401d..23d9083a 100644 --- a/opennurbs_textlog.h +++ b/opennurbs_textlog.h @@ -1,6 +1,5 @@ -/* // -// Copyright (c) 1993-2018 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_TEXTLOG_INC_) #define ON_TEXTLOG_INC_ diff --git a/opennurbs_textobject.cpp b/opennurbs_textobject.cpp index 5fe2305a..05b099d0 100644 --- a/opennurbs_textobject.cpp +++ b/opennurbs_textobject.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_textobject.h b/opennurbs_textobject.h index 154edde0..837473e1 100644 --- a/opennurbs_textobject.h +++ b/opennurbs_textobject.h @@ -1,5 +1,5 @@ // -// Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // diff --git a/opennurbs_textrun.cpp b/opennurbs_textrun.cpp index 06d404b7..35f91626 100644 --- a/opennurbs_textrun.cpp +++ b/opennurbs_textrun.cpp @@ -1,7 +1,5 @@ - -/* $NoKeywords: $ */ -/* -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -11,7 +9,7 @@ // // For complete openNURBS copyright information see . //////////////////////////////////////////////////////////////// -*/ + #include "opennurbs.h" #if !defined(ON_COMPILING_OPENNURBS) diff --git a/opennurbs_textrun.h b/opennurbs_textrun.h index 30e43358..1fd3ff6a 100644 --- a/opennurbs_textrun.h +++ b/opennurbs_textrun.h @@ -1,8 +1,5 @@ - -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -13,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #ifndef OPENNURBS_TEXTRUN_H_INCLUDED #define OPENNURBS_TEXTRUN_H_INCLUDED diff --git a/opennurbs_texture.h b/opennurbs_texture.h index 07eae901..7aaa35c9 100644 --- a/opennurbs_texture.h +++ b/opennurbs_texture.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_texture_mapping.h b/opennurbs_texture_mapping.h index a30f475c..87a7a13a 100644 --- a/opennurbs_texture_mapping.h +++ b/opennurbs_texture_mapping.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_topology.cpp b/opennurbs_topology.cpp index 9448cdec..85b78e8e 100644 --- a/opennurbs_topology.cpp +++ b/opennurbs_topology.cpp @@ -1,17 +1,5 @@ -#include "opennurbs.h" - -#if !defined(ON_COMPILING_OPENNURBS) -// This check is included in all opennurbs source .c and .cpp files to insure -// ON_COMPILING_OPENNURBS is defined when opennurbs source is compiled. -// When opennurbs source is being compiled, ON_COMPILING_OPENNURBS is defined -// and the opennurbs .h files alter what is declared and how it is declared. -#error ON_COMPILING_OPENNURBS must be defined when compiling opennurbs -#endif - -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -22,8 +10,16 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ +#include "opennurbs.h" + +#if !defined(ON_COMPILING_OPENNURBS) +// This check is included in all opennurbs source .c and .cpp files to insure +// ON_COMPILING_OPENNURBS is defined when opennurbs source is compiled. +// When opennurbs source is being compiled, ON_COMPILING_OPENNURBS is defined +// and the opennurbs .h files alter what is declared and how it is declared. +#error ON_COMPILING_OPENNURBS must be defined when compiling opennurbs +#endif bool ON_ComponentAttributes::EdgeIsEligible( unsigned int edge_attributes_filter, diff --git a/opennurbs_topology.h b/opennurbs_topology.h index 862f8e5b..25cc51cb 100644 --- a/opennurbs_topology.h +++ b/opennurbs_topology.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2015 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_TOPOLOGY_INC_) #define OPENNURBS_TOPOLOGY_INC_ diff --git a/opennurbs_torus.cpp b/opennurbs_torus.cpp index 18b4f860..c4db9bc4 100644 --- a/opennurbs_torus.cpp +++ b/opennurbs_torus.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_torus.h b/opennurbs_torus.h index 1c09502b..6cea6312 100644 --- a/opennurbs_torus.h +++ b/opennurbs_torus.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(ON_TORUS_INC_) #define ON_TORUS_INC_ diff --git a/opennurbs_unicode.cpp b/opennurbs_unicode.cpp index beb8bd66..fc3b6ec9 100644 --- a/opennurbs_unicode.cpp +++ b/opennurbs_unicode.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_unicode.h b/opennurbs_unicode.h index d1564f21..68eef874 100644 --- a/opennurbs_unicode.h +++ b/opennurbs_unicode.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_UNICODE_INC_) #define OPENNURBS_UNICODE_INC_ diff --git a/opennurbs_unicode_cpsb.cpp b/opennurbs_unicode_cpsb.cpp index c7c84c37..2dff7860 100644 --- a/opennurbs_unicode_cpsb.cpp +++ b/opennurbs_unicode_cpsb.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_units.cpp b/opennurbs_units.cpp index da4948fe..91f138a5 100644 --- a/opennurbs_units.cpp +++ b/opennurbs_units.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_userdata.cpp b/opennurbs_userdata.cpp index 23089741..88d7694d 100644 --- a/opennurbs_userdata.cpp +++ b/opennurbs_userdata.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_userdata.h b/opennurbs_userdata.h index 5f32a7ad..33bf1145 100644 --- a/opennurbs_userdata.h +++ b/opennurbs_userdata.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_USERDATA_INC_) #define OPENNURBS_USERDATA_INC_ diff --git a/opennurbs_uuid.cpp b/opennurbs_uuid.cpp index 52b3330e..1bde5ab9 100644 --- a/opennurbs_uuid.cpp +++ b/opennurbs_uuid.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" #if defined(ON_RUNTIME_LINUX) diff --git a/opennurbs_uuid.h b/opennurbs_uuid.h index 6830cfbd..cdfa4615 100644 --- a/opennurbs_uuid.h +++ b/opennurbs_uuid.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_UUID_INC_) #define OPENNURBS_UUID_INC_ @@ -88,6 +85,7 @@ extern const ON_UUID ON_opennurbs4_id; extern const ON_UUID ON_opennurbs5_id; extern const ON_UUID ON_opennurbs6_id; extern const ON_UUID ON_opennurbs7_id; +extern const ON_UUID ON_opennurbs8_id; #endif extern ON_EXTERN_DECL const ON_UUID ON_opennurbs_id; diff --git a/opennurbs_version.h b/opennurbs_version.h index d83f9f0f..20d64461 100644 --- a/opennurbs_version.h +++ b/opennurbs_version.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,8 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ - #if !defined(OPENNURBS_VERSION_INC_) #define OPENNURBS_VERSION_INC_ diff --git a/opennurbs_version_number.h b/opennurbs_version_number.h index 907f6e5a..096cd6fe 100644 --- a/opennurbs_version_number.h +++ b/opennurbs_version_number.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2013 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_VERSION_NUMBER_INC_) #define OPENNURBS_VERSION_NUMBER_INC_ diff --git a/opennurbs_wip.h b/opennurbs_wip.h index 06a3813f..a8c0a7dd 100644 --- a/opennurbs_wip.h +++ b/opennurbs_wip.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined OPENNURBS_WIP_INC__ #define OPENNURBS_WIP_INC__ diff --git a/opennurbs_workspace.cpp b/opennurbs_workspace.cpp index 9e8b5ad5..403fba35 100644 --- a/opennurbs_workspace.cpp +++ b/opennurbs_workspace.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_workspace.h b/opennurbs_workspace.h index 94588637..ed582764 100644 --- a/opennurbs_workspace.h +++ b/opennurbs_workspace.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_WORKSPACE_INC_) #define OPENNURBS_WORKSPACE_INC_ diff --git a/opennurbs_wstring.cpp b/opennurbs_wstring.cpp index bc0603c5..41f30eee 100644 --- a/opennurbs_wstring.cpp +++ b/opennurbs_wstring.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_xform.cpp b/opennurbs_xform.cpp index da51068f..c386df9e 100644 --- a/opennurbs_xform.cpp +++ b/opennurbs_xform.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_xform.h b/opennurbs_xform.h index a2ebfa53..e10f3987 100644 --- a/opennurbs_xform.h +++ b/opennurbs_xform.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ //////////////////////////////////////////////////////////////// // diff --git a/opennurbs_xml.cpp b/opennurbs_xml.cpp index 5a6921e4..a4a0331b 100644 --- a/opennurbs_xml.cpp +++ b/opennurbs_xml.cpp @@ -77,20 +77,15 @@ std::atomic g_lPropertyCount(-1); // defaultProp below increments this to static const wchar_t* wszBase64Prefix = L"base64:"; -void SleepMS(int ms) -{ - std::this_thread::sleep_for(std::chrono::milliseconds(ms)); -} - #ifdef ON_COMPILER_MSC static _locale_t __Locale(void) { - static _locale_t loc = nullptr; + static _locale_t loc = nullptr; - if (nullptr == loc) - loc = _create_locale(LC_ALL, "C"); + if (nullptr == loc) + loc = _create_locale(LC_ALL, "C"); - return loc; + return loc; } inline double ON_wtof(const wchar_t* s) { return _wtof_l(s, __Locale()); } @@ -100,67 +95,67 @@ inline double ON_wtof(const wchar_t* s) { return wcstod(s, nullptr); } inline int ON_wtoi(const wchar_t* s) { return (int)wcstol(s, nullptr, 10); } #endif -const wchar_t* ON_StringFromUnits(ON::LengthUnitSystem units) +static const wchar_t* StringFromUnits(ON::LengthUnitSystem units) { - // These strings appear in the XML -- do not change them. + // These strings appear in the XML -- do not change them. - switch (units) - { - case ON::LengthUnitSystem::Angstroms: return L"angstroms"; - case ON::LengthUnitSystem::AstronomicalUnits: return L"astronomical"; - case ON::LengthUnitSystem::Centimeters: return L"centimeters"; - case ON::LengthUnitSystem::Decimeters: return L"decimeters"; - case ON::LengthUnitSystem::Dekameters: return L"dekameters"; - case ON::LengthUnitSystem::Feet: return L"feet"; - case ON::LengthUnitSystem::Gigameters: return L"gigameters"; - case ON::LengthUnitSystem::Hectometers: return L"hectometers"; - case ON::LengthUnitSystem::Inches: return L"inches"; - case ON::LengthUnitSystem::Kilometers: return L"kilometers"; - case ON::LengthUnitSystem::LightYears: return L"lightyears"; - case ON::LengthUnitSystem::Megameters: return L"megameters"; - case ON::LengthUnitSystem::Meters: return L"meters"; - case ON::LengthUnitSystem::Microinches: return L"microinches"; - case ON::LengthUnitSystem::Microns: return L"microns"; - case ON::LengthUnitSystem::Miles: return L"miles"; - case ON::LengthUnitSystem::Millimeters: return L"millimeters"; - case ON::LengthUnitSystem::Mils: return L"mils"; - case ON::LengthUnitSystem::Nanometers: return L"nanometers"; - case ON::LengthUnitSystem::NauticalMiles: return L"nautical-miles"; - case ON::LengthUnitSystem::Parsecs: return L"parsecs"; - case ON::LengthUnitSystem::Yards: return L"yards"; + switch (units) + { + case ON::LengthUnitSystem::Angstroms: return L"angstroms"; + case ON::LengthUnitSystem::AstronomicalUnits: return L"astronomical"; + case ON::LengthUnitSystem::Centimeters: return L"centimeters"; + case ON::LengthUnitSystem::Decimeters: return L"decimeters"; + case ON::LengthUnitSystem::Dekameters: return L"dekameters"; + case ON::LengthUnitSystem::Feet: return L"feet"; + case ON::LengthUnitSystem::Gigameters: return L"gigameters"; + case ON::LengthUnitSystem::Hectometers: return L"hectometers"; + case ON::LengthUnitSystem::Inches: return L"inches"; + case ON::LengthUnitSystem::Kilometers: return L"kilometers"; + case ON::LengthUnitSystem::LightYears: return L"lightyears"; + case ON::LengthUnitSystem::Megameters: return L"megameters"; + case ON::LengthUnitSystem::Meters: return L"meters"; + case ON::LengthUnitSystem::Microinches: return L"microinches"; + case ON::LengthUnitSystem::Microns: return L"microns"; + case ON::LengthUnitSystem::Miles: return L"miles"; + case ON::LengthUnitSystem::Millimeters: return L"millimeters"; + case ON::LengthUnitSystem::Mils: return L"mils"; + case ON::LengthUnitSystem::Nanometers: return L"nanometers"; + case ON::LengthUnitSystem::NauticalMiles: return L"nautical-miles"; + case ON::LengthUnitSystem::Parsecs: return L"parsecs"; + case ON::LengthUnitSystem::Yards: return L"yards"; default: break; - } + } - return L"none"; + return L"none"; } -ON::LengthUnitSystem ON_UnitsFromString(const ON_wString& s) +static ON::LengthUnitSystem UnitsFromString(const ON_wString& s) { - if (L"angstroms" == s) return ON::LengthUnitSystem::Angstroms; - if (L"astronomical" == s) return ON::LengthUnitSystem::AstronomicalUnits; - if (L"centimeters" == s) return ON::LengthUnitSystem::Centimeters; - if (L"decimeters" == s) return ON::LengthUnitSystem::Decimeters; - if (L"dekameters" == s) return ON::LengthUnitSystem::Dekameters; - if (L"feet" == s) return ON::LengthUnitSystem::Feet; - if (L"gigameters" == s) return ON::LengthUnitSystem::Gigameters; - if (L"hectometers" == s) return ON::LengthUnitSystem::Hectometers; - if (L"inches" == s) return ON::LengthUnitSystem::Inches; - if (L"kilometers" == s) return ON::LengthUnitSystem::Kilometers; - if (L"lightyears" == s) return ON::LengthUnitSystem::LightYears; - if (L"megameters" == s) return ON::LengthUnitSystem::Megameters; - if (L"meters" == s) return ON::LengthUnitSystem::Meters; - if (L"microinches" == s) return ON::LengthUnitSystem::Microinches; - if (L"microns" == s) return ON::LengthUnitSystem::Microns; - if (L"miles" == s) return ON::LengthUnitSystem::Miles; - if (L"millimeters" == s) return ON::LengthUnitSystem::Millimeters; - if (L"mils" == s) return ON::LengthUnitSystem::Mils; - if (L"nanometers" == s) return ON::LengthUnitSystem::Nanometers; - if (L"nautical-miles" == s) return ON::LengthUnitSystem::NauticalMiles; - if (L"parsecs" == s) return ON::LengthUnitSystem::Parsecs; - if (L"yards" == s) return ON::LengthUnitSystem::Yards; + if (L"angstroms" == s) return ON::LengthUnitSystem::Angstroms; + if (L"astronomical" == s) return ON::LengthUnitSystem::AstronomicalUnits; + if (L"centimeters" == s) return ON::LengthUnitSystem::Centimeters; + if (L"decimeters" == s) return ON::LengthUnitSystem::Decimeters; + if (L"dekameters" == s) return ON::LengthUnitSystem::Dekameters; + if (L"feet" == s) return ON::LengthUnitSystem::Feet; + if (L"gigameters" == s) return ON::LengthUnitSystem::Gigameters; + if (L"hectometers" == s) return ON::LengthUnitSystem::Hectometers; + if (L"inches" == s) return ON::LengthUnitSystem::Inches; + if (L"kilometers" == s) return ON::LengthUnitSystem::Kilometers; + if (L"lightyears" == s) return ON::LengthUnitSystem::LightYears; + if (L"megameters" == s) return ON::LengthUnitSystem::Megameters; + if (L"meters" == s) return ON::LengthUnitSystem::Meters; + if (L"microinches" == s) return ON::LengthUnitSystem::Microinches; + if (L"microns" == s) return ON::LengthUnitSystem::Microns; + if (L"miles" == s) return ON::LengthUnitSystem::Miles; + if (L"millimeters" == s) return ON::LengthUnitSystem::Millimeters; + if (L"mils" == s) return ON::LengthUnitSystem::Mils; + if (L"nanometers" == s) return ON::LengthUnitSystem::Nanometers; + if (L"nautical-miles" == s) return ON::LengthUnitSystem::NauticalMiles; + if (L"parsecs" == s) return ON::LengthUnitSystem::Parsecs; + if (L"yards" == s) return ON::LengthUnitSystem::Yards; - return ON::LengthUnitSystem::None; + return ON::LengthUnitSystem::None; } static void EncodeXML(ON_wString& s) @@ -182,510 +177,6 @@ static void DecodeXML(ON_wString& s) } } -// ON_UnicodeTextFile - -class ON_File -{ -public: - virtual ~ON_File() { } - - bool Open(const wchar_t* filename, const wchar_t* mode) { m_pFile = ON_FileStream::Open(filename, mode); return nullptr != m_pFile; } - bool Close(void) const { return ON_FileStream::Close(m_pFile) == 0; } - bool SeekFromCurrentPosition(ON__INT64 offset) const { return ON_FileStream::SeekFromCurrentPosition(m_pFile, offset); } - bool SeekFromStart(ON__INT64 offset) const { return ON_FileStream::SeekFromStart(m_pFile, offset); } - bool SeekFromEnd(ON__INT64 offset) const { return ON_FileStream::SeekFromEnd(m_pFile, offset); } - bool Seek(ON__INT64 offset, int origin) const { return ON_FileStream::Seek(m_pFile, offset, origin); } - ON__INT64 CurrentPosition(void) const { return ON_FileStream::CurrentPosition(m_pFile); } - ON__UINT64 Read(ON__UINT64 count, void* buffer) const { return ON_FileStream::Read(m_pFile, count, buffer); } - ON__UINT64 Write(ON__UINT64 count, const void* buffer) const { return ON_FileStream::Write(m_pFile, count, buffer); } - - ON__UINT64 GetLength(void) const - { - const auto cur = CurrentPosition(); - SeekFromEnd(0); - const auto end = CurrentPosition(); - SeekFromStart(cur); - - return end; - } - -private: - FILE* m_pFile = nullptr; -}; - -class ON_UnicodeTextFile::CImpl final -{ -public: - ~CImpl() { Close(); } - - bool Open(const wchar_t* wszFullPath, Modes mode); - bool Close(void); - bool ReadString(ON_wString& s); - bool WriteString(const wchar_t* wsz); - bool ReadHeader(Types& t); - bool WriteHeader(void); - bool ReadStringFromUTF8(ON_wString& s); - bool ReadStringFromUTF16(ON_wString& s); - bool WriteStringToUTF8(const wchar_t* wsz); - bool WriteStringToUTF16(const wchar_t* wsz); - size_t ReadData(void* buf, size_t bytes_to_read); - size_t WriteData(const void* buf, size_t bytes_to_write); - -public: - ON_File m_File; - Types m_Type = Types::Unknown; -}; - -size_t ON_UnicodeTextFile::CImpl::ReadData(void* buf, size_t bytes_to_read) -{ - return m_File.Read(bytes_to_read, buf); -} - -size_t ON_UnicodeTextFile::CImpl::WriteData(const void* buf, size_t bytes_to_write) -{ - return m_File.Write(bytes_to_write, buf); -} - -static const wchar_t* FileStreamMode(ON_UnicodeTextFile::Modes m) -{ - if (m == ON_UnicodeTextFile::Modes::Load) - return L"rb"; - - if (m == ON_UnicodeTextFile::Modes::Save) - return L"wb"; - - ON_ASSERT(false); - return L""; -} - -bool ON_UnicodeTextFile::CImpl::Open(const wchar_t* wszFullPath, Modes mode) -{ - bool ok = false; - int attemptsCounter = 0; - - while (!ok && (attemptsCounter < 100)) - { - if (m_File.Open(wszFullPath, FileStreamMode(mode))) - { - ok = true; - } - else - { - SleepMS(100); - - attemptsCounter++; - } - } - - if (ok) - { - if (Modes::Save == mode) - { - ok = WriteHeader(); - } - else - { - ok = ReadHeader(m_Type); - } - } - - return ok; -} - -bool ON_UnicodeTextFile::CImpl::Close(void) -{ - return m_File.Close(); -} - -bool ON_UnicodeTextFile::CImpl::ReadHeader(Types& t) -{ - if (0 != m_File.CurrentPosition()) - return false; - - ON__UINT8 pBuf[3] = { 0 }; - - if (2 != ReadData(pBuf, 2)) - return false; - - if (pBuf[0] == ON__UINT8(0xFF)) - { - if (pBuf[1] == ON__UINT8(0xFE)) - { - t = Types::UTF16; - return true; - } - } - - if (pBuf[0] == ON__UINT8(0xEF)) - { - if (pBuf[1] == ON__UINT8(0xBB)) - { - if (1 == ReadData(pBuf + 2, 1)) - { - if (pBuf[2] == ON__UINT8(0xBF)) - { - t = Types::UTF8; - return true; - } - } - } - } - - // No BOM was found so rewind and assume UTF8. This allows testing with ASCII files. - m_File.SeekFromStart(0); - t = Types::UTF8; - - return true; -} - -bool ON_UnicodeTextFile::CImpl::WriteHeader(void) -{ - ON__UINT8 pBuf[3] = { 0 }; - - size_t sizeBOM = 2; - if (Types::UTF8 == m_Type) - { - sizeBOM = 3; - pBuf[0] = ON__UINT8(0xEF); - pBuf[1] = ON__UINT8(0xBB); - pBuf[2] = ON__UINT8(0xBF); - } - else - if (Types::UTF16 == m_Type) - { - pBuf[0] = ON__UINT8(0xFF); - pBuf[1] = ON__UINT8(0xFE); - } - else ON_ASSERT(false); // Did you forget to set the type in the constructor? - - if (!WriteData(pBuf, sizeBOM)) - return false; - - return true; -} - -bool ON_UnicodeTextFile::CImpl::ReadString(ON_wString& s) -{ - switch (m_Type) - { - case Types::UTF8: - return ReadStringFromUTF8(s); - - case Types::UTF16: - return ReadStringFromUTF16(s); - - case Types::Unknown: - default: - return false; - } -} - -bool ON_UnicodeTextFile::CImpl::WriteString(const wchar_t* wsz) -{ - switch (m_Type) - { - case Types::UTF8: - return WriteStringToUTF8(wsz); - - case Types::UTF16: - return WriteStringToUTF16(wsz); - - case Types::Unknown: - default: - return false; - } -} - -bool ON_UnicodeTextFile::CImpl::ReadStringFromUTF8(ON_wString& s) -{ - const auto size_in_bytes = m_File.GetLength() - m_File.CurrentPosition(); - auto p = std::unique_ptr(new ON__UINT8[size_in_bytes + 1]); - auto* pBuffer = p.get(); - - ReadData(pBuffer, size_in_bytes); - pBuffer[size_in_bytes] = 0; - - const char* pUTF8 = reinterpret_cast(pBuffer); - - const auto num_chars = ON_ConvertUTF8ToWideChar(false, pUTF8, -1, nullptr, 0, nullptr, 0, 0, nullptr); - - auto* string_buf = s.SetLength(num_chars); - if (nullptr == string_buf) - return false; - - ON_ConvertUTF8ToWideChar(false, pUTF8, -1, string_buf, num_chars+1, nullptr, 0, 0, nullptr); - - return !s.IsEmpty(); -} - -bool ON_UnicodeTextFile::CImpl::ReadStringFromUTF16(ON_wString& s) -{ - const auto char_size = sizeof(ON__UINT16); - const auto size_in_bytes = m_File.GetLength() - m_File.CurrentPosition(); - const auto size_in_chars = size_in_bytes / char_size; - -#ifdef ON_RUNTIME_WIN - // On Windows, wchar_t is UTF16 so we can load the file directly into the ON_wString. - ON_ASSERT(sizeof(wchar_t) == sizeof(ON__UINT16)); - - auto* buf = s.SetLength(size_in_chars); - if (nullptr == buf) - return false; - - if (ReadData(buf, size_in_bytes) != size_in_bytes) - return false; - - buf[size_in_chars] = 0; -#else - // On Mac wchar_t is UTF32 so we have to load the file into a buffer and then convert it to the ON_wString. - auto p = std::unique_ptr(new ON__UINT16[size_in_chars + 1]); - auto* pUTF16 = p.get(); - ReadData(pUTF16, size_in_bytes); - pUTF16[size_in_chars] = 0; - - const auto num_chars = ON_ConvertUTF16ToUTF32(false, pUTF16, -1, nullptr, 0, nullptr, 0, 0, nullptr); - auto* string_buf = s.SetLength(num_chars); - if (nullptr == string_buf) - return false; - - ON_ASSERT(sizeof(wchar_t) == sizeof(ON__UINT32)); - auto* pWide = reinterpret_cast(string_buf); - ON_ConvertUTF16ToUTF32(false, pUTF16, -1, pWide, num_chars+1, nullptr, 0, 0, nullptr); -#endif - - return true; -} - -bool ON_UnicodeTextFile::CImpl::WriteStringToUTF8(const wchar_t* wsz) -{ - const auto num_chars = ON_ConvertWideCharToUTF8(false, wsz, -1, nullptr, 0, nullptr, 0, 0, nullptr); - - auto p = std::unique_ptr(new char[size_t(num_chars) + 1]); - auto* pBuffer = p.get(); - - ON_ConvertWideCharToUTF8(false, wsz, -1, pBuffer, num_chars + 1, nullptr, 0, 0, nullptr); - - if (WriteData(pBuffer, num_chars) != num_chars) - return false; - - return true; -} - -bool ON_UnicodeTextFile::CImpl::WriteStringToUTF16(const wchar_t* wsz) -{ -#ifdef ON_RUNTIME_WIN - // On Windows, wchar_t is UTF16 so we can save the file directly from 'wsz'. - ON_ASSERT(sizeof(wchar_t) == sizeof(ON__UINT16)); - - const auto size_in_bytes = wcslen(wsz) * sizeof(wchar_t); - if (WriteData(wsz, size_in_bytes) != size_in_bytes) - return false; -#else - // On Mac wchar_t is UTF32 so we have to convert 'wsz' to UTF16 in a buffer and write the buffer to the file. - ON_ASSERT(sizeof(wchar_t) == sizeof(ON__UINT32)); - auto* pWide = reinterpret_cast(wsz); - - const auto num_chars = ON_ConvertUTF32ToUTF16(false, pWide, -1, nullptr, 0, nullptr, 0, 0, nullptr); - - const auto num_chars_inc_term = num_chars + 1; - auto p = std::unique_ptr(new ON__UINT16[num_chars_inc_term]); - auto* pUTF16 = p.get(); - - ON_ConvertUTF32ToUTF16(false, pWide, -1, pUTF16, num_chars_inc_term, nullptr, 0, 0, nullptr); - - const auto size_in_bytes = num_chars * sizeof(ON__UINT16); - if (WriteData(pUTF16, size_in_bytes) != size_in_bytes) - return false; -#endif - - return true; -} - -ON_UnicodeTextFile::ON_UnicodeTextFile(Types t) -{ - m_impl = new (m_Impl) CImpl; IMPL_CHECK; - m_impl->m_Type = t; -} - -ON_UnicodeTextFile::~ON_UnicodeTextFile() -{ - m_impl->~CImpl(); - m_impl = nullptr; -} - -bool ON_UnicodeTextFile::Open(const wchar_t* wszFullPath, Modes mode) -{ - return m_impl->Open(wszFullPath, mode); -} - -bool ON_UnicodeTextFile::Close(void) -{ - return m_impl->Close(); -} - -bool ON_UnicodeTextFile::ReadString(ON_wString& s) -{ - return m_impl->ReadString(s); -} - -bool ON_UnicodeTextFile::WriteString(const wchar_t* wsz) -{ - return m_impl->WriteString(wsz); -} - -void* ON_UnicodeTextFile::EVF(const wchar_t*, void*) -{ - return nullptr; -} - -// ON_Base64 - -static const int DecodeTab[128] = -{ - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -}; - -static bool ReadEncodedByte(int& pos, const wchar_t* wsz, ON__UINT8& byteOut) -{ - wchar_t w = wsz[pos]; - if (w >= 128) - w = 128; // Will fail validation. - - byteOut = ON__UINT8(w); - - while (byteOut != 0) - { - pos++; - - // Check that the byte is a valid Base64 character. - // The Base64 specification requires garbled data to be ignored. - if ((byteOut < 128) && (DecodeTab[byteOut] >= 0)) - return true; - - // Move on to the next byte and keep trying. - w = wsz[pos]; - if (w >= 128) - w = 128; // Will fail validation. - - byteOut = ON__UINT8(w); - } - - return false; // End of data. -} - -size_t ON_Base64::Decode(const wchar_t* wszBase64in, void* pvBufferOut, size_t maxLength) // Static. -{ - auto* pBufferOut = static_cast(pvBufferOut); - - ON__UINT32 uBytesWritten = 0; - - int iResultSize = 3; - ON__UINT8 a = 0, b = 0, c = 0, d = 0, aResult[3] = { 0 }; - - int pos = 0; - while (ReadEncodedByte(pos, wszBase64in, a)) - { - ReadEncodedByte(pos, wszBase64in, b); - ReadEncodedByte(pos, wszBase64in, c); - ReadEncodedByte(pos, wszBase64in, d); - - if ('=' == d) // Handle padding character(s). - { - iResultSize = ('=' == c) ? 1 : 2; - } - - if (pBufferOut != nullptr) - { - const auto val = (ON__UINT32)((DecodeTab[a] << 18) | (DecodeTab[b] << 12) | (DecodeTab[c] << 6) | DecodeTab[d]); - - aResult[0] = (ON__UINT8)((val & 0xFF0000) >> 16); - aResult[1] = (ON__UINT8)((val & 0x00FF00) >> 8); - aResult[2] = (ON__UINT8)((val)); - - memcpy(pBufferOut, aResult, iResultSize); - pBufferOut += iResultSize; - uBytesWritten += iResultSize; - - if (size_t(uBytesWritten) >= maxLength) - break; - } - else - { - uBytesWritten += iResultSize; - } - } - - return size_t(uBytesWritten); -} - -static const wchar_t* EncodeTab = L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -bool ON_Base64::Encode(const void* pvBufferIn, size_t bufNumBytes, ON_wString& sBase64Out, bool bAppend) // Static. -{ - // Base64 is about 133% of the data size. Use 150% plus 4 for padding. - const auto bigBufNumBytes = (bufNumBytes * 150) / 100 + 4; - - const int iExistingLen = bAppend ? sBase64Out.Length() : 0; - const auto outNumBytes = size_t(iExistingLen) + bigBufNumBytes; - auto* start = sBase64Out.SetLength(outNumBytes); - if (nullptr == start) - return false; - - auto* out = start + iExistingLen; - - const auto* p = static_cast(pvBufferIn); - const char* pEnd = p + bufNumBytes; - - ON__UINT8 a = 0, b = 0, c = 0; - while (p < pEnd) - { - out[2] = out[3] = L'='; - - a = *p++; - - out[0] = EncodeTab[a >> 2]; - - a = ON__UINT8((a & 0x03) << 4); - if (p < pEnd) - { - b = *p++; - out[1] = EncodeTab[a | (b >> 4)]; - - b = ON__UINT8((b & 0x0F) << 2); - if (p < pEnd) - { - c = *p++; - out[2] = EncodeTab[b | (c >> 6)]; - out[3] = EncodeTab[c & 0x3F]; - } - else - { - out[2] = EncodeTab[b]; - } - } - else - { - out[1] = EncodeTab[a]; - } - - out += 4; - } - - *out = 0; - - const auto realLength = out - start; - sBase64Out.SetLength(realLength); - - return true; -} - static bool GetTimeComponents(const ON_wString& sTime, int& y, int& m, int& d, int& h, int& n, int& s) { if (19 != sTime.Length()) @@ -1036,7 +527,7 @@ bool ON_XMLVariant::operator == (const ON_XMLVariant& v) const if (m_impl->m_type != v.m_impl->m_type) return false; - if (m_impl->m_units != m_impl->m_units) + if (m_impl->m_units != v.m_impl->m_units) return false; switch (m_impl->m_type) @@ -1763,12 +1254,12 @@ bool ON_XMLVariant::IsEmpty(void) const ON::LengthUnitSystem ON_XMLVariant::Units(void) const { - return m_impl->m_units; + return m_impl->m_units; } void ON_XMLVariant::SetUnits(ON::LengthUnitSystem units) { - m_impl->m_units = units; + m_impl->m_units = units; } bool ON_XMLVariant::TypePending(void) const @@ -1954,7 +1445,7 @@ void ON_XMLVariant::Format(ON_wString& sOut) const } sOut.Format(L"Type=%s, Value=%s, Units=%s, CRC=%08X", - sType.Array(), AsString().Array(), ON_StringFromUnits(Units()), DataCRC(0)); + sType.Array(), AsString().Array(), StringFromUnits(Units()), DataCRC(0)); } #if 1 @@ -2001,7 +1492,7 @@ void AutoTypeVariant(ON_XMLVariant& v) { // Used by the XML reader to try to invent sensible types for variants read in from the stream. if (v.Type() != ON_XMLVariant::Types::String) - return; // The variant already has a type. + return; // The variant already has a type. ON_wString s = v.AsString(); v.SetTypePendingFlag(true); @@ -4301,7 +3792,7 @@ bool ON_XMLRootNode::ReadFromFile(const wchar_t* wszPath, bool bWarningsAsErrors CWarningHelper wh(bWarningsAsErrors); ON_UnicodeTextFile file; - if (!file.Open(wszPath, ON_UnicodeTextFile::Modes::Load)) + if (!file.Open(wszPath, ON_UnicodeTextFile::Modes::Read)) { ON_wString s; s.Format(L"Failed to open file %s", wszPath); @@ -4343,7 +3834,7 @@ bool ON_XMLRootNode::WriteToFile(const wchar_t* wszPath, bool includeFormatting, { const auto type = bUTF8 ? ON_UnicodeTextFile::Types::UTF8 : ON_UnicodeTextFile::Types::UTF16; ON_UnicodeTextFile file(type); - if (!file.Open(wszPath, ON_UnicodeTextFile::Modes::Save)) + if (!file.Open(wszPath, ON_UnicodeTextFile::Modes::Write)) return false; ON_XMLSegmentedStream segs; @@ -4715,7 +4206,7 @@ ON_XMLNode* ON_XMLParameters::SetParamNode(ON_XMLNode& node, const wchar_t* wszP if (ON::LengthUnitSystem::None != vValue.Units()) { prop.SetName(L"units"); - const auto* wsz = ON_StringFromUnits(vValue.Units()); + const auto* wsz = StringFromUnits(vValue.Units()); prop.SetValue(wsz); pChildNode->AddProperty(prop); } @@ -4847,7 +4338,7 @@ bool ON_XMLParameters::GetParamNode(const ON_XMLNode& node, ON_XMLVariant& vValu } else if ((sType.CompareNoCase(L"vector3d") == 0) || - (sType.CompareNoCase(L"vector") == 0)) // For backward compatibilty with old XML. + (sType.CompareNoCase(L"vector") == 0)) // For backward compatibilty with old XML. { vValueOut = ON_XMLVariant(v.As3dPoint(), ON_XMLVariant::ArrayTypes::Array3); } @@ -4886,7 +4377,7 @@ bool ON_XMLParameters::GetParamNode(const ON_XMLNode& node, ON_XMLVariant& vValu if (nullptr != pProp) { const auto sUnits = pProp->GetValue().AsString(); - vValueOut.SetUnits(ON_UnitsFromString(sUnits)); + vValueOut.SetUnits(UnitsFromString(sUnits)); } return true; @@ -5520,13 +5011,13 @@ bool ON_RunXMLTests(const wchar_t* test_folder) const auto sFile = sFolder + L"UTF8.txt"; ON_UnicodeTextFile file(ON_UnicodeTextFile::Types::UTF8); - if (file.Open(sFile, ON_UnicodeTextFile::Modes::Save)) + if (file.Open(sFile, ON_UnicodeTextFile::Modes::Write)) { Validate(file.WriteString(wszQuick)); Validate(file.Close()); } - if (file.Open(sFile, ON_UnicodeTextFile::Modes::Load)) + if (file.Open(sFile, ON_UnicodeTextFile::Modes::Read)) { ON_wString s; Validate(file.ReadString(s)); @@ -5538,13 +5029,13 @@ bool ON_RunXMLTests(const wchar_t* test_folder) const auto sFile = sFolder + L"UTF16.txt"; ON_UnicodeTextFile file(ON_UnicodeTextFile::Types::UTF16); - if (file.Open(sFile, ON_UnicodeTextFile::Modes::Save)) + if (file.Open(sFile, ON_UnicodeTextFile::Modes::Write)) { Validate(file.WriteString(wszQuick)); Validate(file.Close()); } - if (file.Open(sFile, ON_UnicodeTextFile::Modes::Load)) + if (file.Open(sFile, ON_UnicodeTextFile::Modes::Read)) { ON_wString s; Validate(file.ReadString(s)); @@ -5632,10 +5123,6 @@ bool ON_RunXMLTests(const wchar_t* test_folder) sBase64 = CallbackBuffer; #endif -// DWORD_PTR p, s; -// if (::GetProcessAffinityMask(::GetCurrentProcess(), &p, &s)) -// ::SetThreadAffinityMask(::GetCurrentThread(), p); - // Test critical section. OUTPUT_DEBUG_STRING_EOL(L"Characters should not be mixed"); std::thread th1(ThreadFunc, L'*'); @@ -5651,3 +5138,254 @@ bool ON_RunXMLTests(const wchar_t* test_folder) } #pragma warning (pop) + +//------------------------------------------------------------------------------------------------------------------- +#define INITIALIZE ON_XMLNode* pSetting = _root.CreateNodeAtPath(ON_RDK_DOCUMENT); \ + ON_XMLNode* pCurrent = pSetting; +//------------------------------------------------------------------------------------------------------------------- +#define BEGIN(child) ON_XMLNode* p##child##Temp = pCurrent->CreateNodeAtPath(ON_RDK_##child); \ + { \ + ON_XMLNode* pCurrent = p##child##Temp; \ + ON_XMLNode* p##child = pCurrent; \ + p##child; p##child##Temp; // Fixes warnings. + +#define BEGIN_SECTION(child) BEGIN(child) ON_XMLParameters section(*pCurrent); +#define PROPERTY(name, value) section.SetParam(ON_RDK_##name, ON_XMLVariant(value)); +#define CREATE(child) BEGIN(child) END +#define END } +//------------------------------------------------------------------------------------------------------------------- +#define ON_RDK_MATERIAL_SECTION L"material" ON_RDK_POSTFIX_SECTION +#define ON_RDK_ENVIRONMENT_SECTION L"environment" ON_RDK_POSTFIX_SECTION +#define ON_RDK_TEXTURE_SECTION L"texture" ON_RDK_POSTFIX_SECTION +#define ON_RDK_ENVIRONMENT L"environment" + +ON_UUID uuidPostEffect_ToneMapper_Clamp = { 0xacb8d258, 0xc1d6, 0x499d, { 0xaa, 0x23, 0x02, 0xdc, 0xde, 0xa2, 0xb0, 0xa2 } }; +ON_UUID uuidPostEffect_Gamma = { 0x84c0798d, 0xc43a, 0x4402, { 0x88, 0x91, 0xe0, 0xc8, 0x08, 0x8e, 0x67, 0xca } }; +ON_UUID chanRGBA = { 0x453a9a1c, 0x9307, 0x4976, { 0xb2, 0x82, 0x4e, 0xad, 0x4d, 0x53, 0x98, 0x79 } }; +ON_UUID chanDistanceFromCamera = { 0xb752ce0b, 0xc219, 0x4bdd, { 0xb1, 0x34, 0x26, 0x42, 0x5e, 0x1c, 0x43, 0x31 } }; +//------------------------------------------------------------------------------------------------------------------- + +#pragma ON_PRAGMA_WARNING_PUSH +#pragma ON_PRAGMA_WARNING_DISABLE_MSC(4456) + +ON_RdkDocumentDefaults::ON_RdkDocumentDefaults(int major_version, ValueSets vs, void*) + : + _vs(vs), + _reserved(nullptr) +{ + const bool bForOldFile = major_version < 6; + + INITIALIZE + + if (ValueSets::All == vs) + { + BEGIN (CURRENT_CONTENT) + BEGIN (ENVIRONMENT) + END + END + + CREATE (DEFAULT_CONTENT_SECTION) + CREATE (MATERIAL_SECTION) + CREATE (ENVIRONMENT_SECTION) + CREATE (TEXTURE_SECTION) + } + + BEGIN (SETTINGS) + + if (ValueSets::All == vs) + { + BEGIN_SECTION (NAMED_VIEWS) + PROPERTY (SORT_MODE, L""); + END + BEGIN_SECTION (NAMED_CPLANES) + PROPERTY (SORT_MODE, L""); + END + BEGIN_SECTION (NAMED_POSITIONS) + PROPERTY (SORT_MODE, L""); + END + BEGIN_SECTION (NAMED_SNAPSHOTS) + PROPERTY (SORT_MODE, L""); + END + } + + if (ValueSets::All == vs) + { + BEGIN_SECTION (MISCELLANEOUS) + + PROPERTY (CUSTOM_IMAGE_SIZE_IS_PRESET, false); + + BEGIN_SECTION(NAME_COLLISION_SUPPRESS) + PROPERTY (IMPORT, false); + PROPERTY (PASTE, false); + END + END + } + + if (ValueSets::All == vs) + { + BEGIN_SECTION(EXCLUDED_RENDER_ENGINES) + PROPERTY (UUIDS, L""); + END + } + + if (ValueSets::All == vs) + { + BEGIN_SECTION(FILTERS) + PROPERTY (NAME_FILTER, L""); + PROPERTY (NAME_FILTER_INVERT, false); + PROPERTY (SHOW_UNASSIGNED, true); + PROPERTY (SHOW_V4, true); + PROPERTY (SHOW_HIDDEN, false); + PROPERTY (SHOW_REFERENCE, false); + END + } + + if (ValueSets::All == vs) + { + BEGIN_SECTION(POST_EFFECTS) + PROPERTY (PEP_EARLY_SELECTION, ON_nil_uuid); + PROPERTY (PEP_TONE_SELECTION, uuidPostEffect_ToneMapper_Clamp); + PROPERTY (PEP_LATE_SELECTION, uuidPostEffect_Gamma); + + BEGIN_SECTION(PEP_TYPE_EARLY) + END + BEGIN_SECTION(PEP_TYPE_TONE) + END + BEGIN_SECTION(PEP_TYPE_LATE) + END + END + } + + if (ValueSets::All == vs) + { + BEGIN_SECTION(RENDERING) + BEGIN_SECTION(RENDER_CHANNELS) + ON_wString sA, sB; + ON_UuidToString(chanRGBA, sA); + ON_UuidToString(chanDistanceFromCamera, sB); + sA.MakeUpper(); sB.MakeUpper(); + PROPERTY (RCH_LIST, sA + L";" + sB); + PROPERTY (RCH_MODE, ON_RDK_RCH_MODE_AUTOMATIC); + END + + PROPERTY (EMBED_SUPPORT_FILES_ON, true /* TODO:!!!!!!!! */); // rso.EmbedFilesDocumentDefault()); + PROPERTY (DITHERING, ON_RDK_DITHERING_FLOYD_STEINBERG); + PROPERTY (USE_DITHERING, false); + PROPERTY (GAMMA, bForOldFile ? 1.0f : 2.2f); + PROPERTY (USE_POST_PROCESS_GAMMA, true); + PROPERTY (USE_LINEAR_WORKFLOW, bForOldFile ? false : true); + PROPERTY (CUSTOM_REFLECTIVE_ENVIRONMENT_ON, bForOldFile ? false : true); + PROPERTY (CUSTOM_REFLECTIVE_ENVIRONMENT, ON_nil_uuid); + END + } + else + if (bForOldFile) + { + BEGIN_SECTION(RENDERING) + PROPERTY (CUSTOM_REFLECTIVE_ENVIRONMENT_ON, false); + END + } + + if (ValueSets::All == vs) + { + BEGIN_SECTION(SUN) + PROPERTY (SUN_ENABLE_ON, false); + PROPERTY (SUN_MANUAL_CONTROL_ON, false); + PROPERTY (SUN_MANUAL_CONTROL_ALLOWED, true); + PROPERTY (SUN_AZIMUTH, 0.0); + PROPERTY (SUN_ALTITUDE, 0.0); + PROPERTY (SUN_DATE_YEAR, 2000); + PROPERTY (SUN_DATE_MONTH, 1); + PROPERTY (SUN_DATE_DAY, 1); + PROPERTY (SUN_TIME_HOURS, 12.0); + PROPERTY (SUN_DAYLIGHT_SAVING_ON, false); + PROPERTY (SUN_DAYLIGHT_SAVING_MINUTES, 60); + PROPERTY (SUN_SHADOW_INTENSITY, 1.0); + PROPERTY (SUN_INTENSITY, 1.0); + PROPERTY (SUN_OBSERVER_LATITUDE, 0.0); + PROPERTY (SUN_OBSERVER_LONGITUDE, 0.0); + PROPERTY (SUN_OBSERVER_TIMEZONE, 0.0); + PROPERTY (SUN_SKYLIGHT_ON, bForOldFile ? false : true); + PROPERTY (SUN_SKYLIGHT_SHADOW_INTENSITY, 1.0); + PROPERTY (SUN_SKYLIGHT_CUSTOM_ENVIRONMENT_ON, bForOldFile ? false : true); + PROPERTY (SUN_SKYLIGHT_CUSTOM_ENVIRONMENT, ON_nil_uuid); + END + } + + if (ValueSets::All == vs) + { + BEGIN_SECTION(SAFE_FRAME) + + PROPERTY (SF_ON, false); + PROPERTY (SF_PERSPECTIVE_ONLY, true); + PROPERTY (SF_FIELD_DISPLAY_ON, false); + + BEGIN_SECTION(SF_LIVE_FRAME) + PROPERTY (SFF_ON, true); + END + + BEGIN_SECTION(SF_ACTION_FRAME) + PROPERTY (SFF_ON, true); + PROPERTY (SFF_XSCALE, 0.9); + PROPERTY (SFF_YSCALE, 0.9); + PROPERTY (SFF_LINK, true); + END + + BEGIN_SECTION(SF_TITLE_FRAME) + PROPERTY (SFF_ON, true); + PROPERTY (SFF_XSCALE, 0.8); + PROPERTY (SFF_YSCALE, 0.8); + PROPERTY (SFF_LINK, true); + END + END + } + + if (ValueSets::All == vs) + { + BEGIN_SECTION(GROUND_PLANE) + PROPERTY (GP_ON, bForOldFile ? false : true); + PROPERTY (GP_SHOW_UNDERSIDE, false); + PROPERTY (GP_ALTITUDE, 0.0); + PROPERTY (GP_AUTO_ALTITUDE, true); + PROPERTY (GP_SHADOW_ONLY, bForOldFile ? false : true); + PROPERTY (GP_MATERIAL, L""); + PROPERTY (GP_TEXTURE_SIZE, ON_2dPoint(1.0, 1.0)); + PROPERTY (GP_TEXTURE_OFFSET, ON_2dPoint(0.0, 0.0)); + PROPERTY (GP_TEXTURE_ROTATION, 0.0); + PROPERTY (GP_OFFSET_LOCK, false); + PROPERTY (GP_REPEAT_LOCK, true); + END + } + else + if (bForOldFile) + { + BEGIN_SECTION(GROUND_PLANE) + PROPERTY (GP_SHADOW_ONLY, false); + END + } + + END +} + +const ON_XMLNode ON_RdkDocumentDefaults::Node(void) const +{ + return _root; +} + +void ON_RdkDocumentDefaults::CopyDefaultsTo(ON_XMLNode& dest) const +{ + if (_vs == ValueSets::All) + { + dest = _root; + } + else + { + dest.MergeFrom(_root); + } +} + +ON_RdkDocumentDefaults::~ON_RdkDocumentDefaults() +{ +} + +#pragma ON_PRAGMA_WARNING_POP diff --git a/opennurbs_xml.h b/opennurbs_xml.h index e46baed9..2faf74e7 100644 --- a/opennurbs_xml.h +++ b/opennurbs_xml.h @@ -16,49 +16,122 @@ typedef bool (*ON_XMLRecurseChildrenCallback)(class ON_XMLNode*, void*); -class ON_CLASS ON_UnicodeTextFile -{ -public: - enum class Modes { Load, Save }; - enum class Types { Unknown, UTF8, UTF16 }; +// This is the structure of the RDK document XML. - ON_UnicodeTextFile(Types type = Types::Unknown); - virtual ~ON_UnicodeTextFile(); +#define ON_RDK_DOCUMENT L"render-content-manager-document" - bool Open(const wchar_t* filename, Modes mode); - bool Close(void); + #define ON_RDK_CURRENT_CONTENT L"content" + #define ON_RDK_DEFAULT_CONTENT_SECTION L"default-content-section" - bool ReadString(ON_wString& s); - bool WriteString(const wchar_t* s); + #define ON_RDK_SETTINGS L"settings" + #define ON_RDK_NAMED_VIEWS L"named-views" + #define ON_RDK_NAMED_CPLANES L"named-cplanes" + #define ON_RDK_NAMED_POSITIONS L"named-positions" + #define ON_RDK_NAMED_SNAPSHOTS L"named-snapshots" + #define ON_RDK_SORT_MODE L"sort-mode" + #define ON_RDK_SORT_MODE_ASCENDING L"ascending" + #define ON_RDK_SORT_MODE_DESCENDING L"descending" + #define ON_RDK_SORT_MODE_CUSTOM L"custom" - // Emergency virtual function for future expansion. - virtual void* EVF(const wchar_t* func, void* data); + #define ON_RDK_MISCELLANEOUS L"miscellaneous" + #define ON_RDK_CUSTOM_IMAGE_SIZE_IS_PRESET L"custom-image-size-is-preset" + #define ON_RDK_NAME_COLLISION_SUPPRESS L"smart-merge-name-collision-suppress" + #define ON_RDK_IMPORT L"import" + #define ON_RDK_PASTE L"paste" - ON_UnicodeTextFile(const ON_UnicodeTextFile&) = delete; - const ON_UnicodeTextFile& operator = (const ON_UnicodeTextFile&) = delete; + #define ON_RDK_EXCLUDED_RENDER_ENGINES L"excluded-render-engines" + #define ON_RDK_UUIDS L"uuids" -private: - class CImpl; - CImpl* m_impl; - ON__UINT8 m_Impl[32]; -}; + #define ON_RDK_FILTERS L"filters" + #define ON_RDK_NAME_FILTER L"name-filter" + #define ON_RDK_NAME_FILTER_INVERT L"name-filter-invert" + #define ON_RDK_SHOW_UNASSIGNED L"show-unassigned-materials" + #define ON_RDK_SHOW_V4 L"show-v4-materials" + #define ON_RDK_SHOW_HIDDEN L"show-hidden-materials" + #define ON_RDK_SHOW_REFERENCE L"show-reference-materials" -class ON_CLASS ON_Base64 final -{ -public: - // Decode a base64 string. - // buffer_out must be large enough to accomodate the decoded data. It is safe to use the - // length of base64_in because this Base64 string will always be about 33% bigger than the - // data it was created from. Returns the number of bytes written to buffer_out. - // The function stops when max_length bytes have been decoded. - // If buffer_out is null, the function simply calculates the exact required buffer size. - static size_t Decode(const wchar_t* base64_in, void* buffer_out, size_t max_length = UINT_MAX); + #define ON_RDK_RENDERING L"rendering" + #define ON_RDK_RENDER_CHANNELS L"render-channels" + #define ON_RDK_RCH_MODE L"mode" + #define ON_RDK_RCH_MODE_AUTOMATIC L"automatic" + #define ON_RDK_RCH_MODE_CUSTOM L"custom" - // Encode data to a base64 string. If append is true, the encoded string is appended to base64_out. - // Otherwise base64_out is replaced with the encoded string. - // Returns true if ok, false if unable to allocate the output buffer. - static bool Encode(const void* buffer_in, size_t num_bytes, ON_wString& base64_out, bool append); -}; + #define ON_RDK_RCH_LIST L"list" + + #define ON_RDK_EMBED_SUPPORT_FILES_ON L"embed-support-files-on" + #define ON_RDK_GAMMA L"gamma" + #define ON_RDK_USE_DITHERING L"use-dithering" + #define ON_RDK_USE_POST_PROCESS_GAMMA L"use-post-process-gamma" + #define ON_RDK_USE_LINEAR_WORKFLOW L"use-linear-workflow" + + #define ON_RDK_CUSTOM_REFLECTIVE_ENVIRONMENT_ON L"custom-env-for-refl-and-refr-on" + #define ON_RDK_CUSTOM_REFLECTIVE_ENVIRONMENT L"custom-env-for-refl-and-refr" + + #define ON_RDK_DITHERING L"dithering" + #define ON_RDK_DITHERING_FLOYD_STEINBERG L"floyd-steinberg" + #define ON_RDK_DITHERING_SIMPLE_NOISE L"simple-noise" + + #define ON_RDK_SUN L"sun" + #define ON_RDK_SUN_ENABLE_ALLOWED L"enable-allowed" + #define ON_RDK_SUN_ENABLE_ON L"enable-on" + #define ON_RDK_SUN_MANUAL_CONTROL_ALLOWED L"manual-control-allowed" + #define ON_RDK_SUN_MANUAL_CONTROL_ON L"manual-control-on" + #define ON_RDK_SUN_NORTH L"north" + #define ON_RDK_SUN_AZIMUTH L"sun-azimuth" + #define ON_RDK_SUN_ALTITUDE L"sun-altitude" + #define ON_RDK_SUN_DATE_YEAR L"year" + #define ON_RDK_SUN_DATE_MONTH L"month" + #define ON_RDK_SUN_DATE_DAY L"day" + #define ON_RDK_SUN_TIME_HOURS L"time" + #define ON_RDK_SUN_DAYLIGHT_SAVING_ON L"daylight-saving-on" + #define ON_RDK_SUN_DAYLIGHT_SAVING_MINUTES L"daylight-saving-minutes" + #define ON_RDK_SUN_OBSERVER_LATITUDE L"observer-latitude" + #define ON_RDK_SUN_OBSERVER_LONGITUDE L"observer-longitude" + #define ON_RDK_SUN_OBSERVER_TIMEZONE L"observer-timezone" + #define ON_RDK_SUN_SKYLIGHT_ON L"skylight-on" + #define ON_RDK_SUN_SKYLIGHT_SHADOW_INTENSITY L"skylight-shadow-intensity" + #define ON_RDK_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT_ON L"skylight-custom-environment-on" + #define ON_RDK_SUN_SKYLIGHT_CUSTOM_ENVIRONMENT L"skylight-custom-environment" + #define ON_RDK_SUN_SHADOW_INTENSITY L"shadow-intensity" + #define ON_RDK_SUN_INTENSITY L"intensity" + + #define ON_RDK_SAFE_FRAME L"safe-frame" + #define ON_RDK_SF_ON L"on" + #define ON_RDK_SF_PERSPECTIVE_ONLY L"perspective-only" + #define ON_RDK_SF_FIELD_DISPLAY_ON L"field-display-on" + #define ON_RDK_SF_LIVE_FRAME L"live-frame" + #define ON_RDK_SF_ACTION_FRAME L"action-frame" + #define ON_RDK_SF_TITLE_FRAME L"title-frame" + #define ON_RDK_SFF_ON L"on" + #define ON_RDK_SFF_XSCALE L"x-scale" + #define ON_RDK_SFF_YSCALE L"y-scale" + #define ON_RDK_SFF_LINK L"link" + + #define ON_RDK_GROUND_PLANE L"ground-plane" + #define ON_RDK_GP_ON L"on" + #define ON_RDK_GP_ALTITUDE L"altitude" + #define ON_RDK_GP_MATERIAL L"material" + #define ON_RDK_GP_TEXTURE_OFFSET L"texture-offset" + #define ON_RDK_GP_TEXTURE_SIZE L"texture-size" + #define ON_RDK_GP_TEXTURE_ROTATION L"texture-rotation" + #define ON_RDK_GP_OFFSET_LOCK L"offset-lock" + #define ON_RDK_GP_REPEAT_LOCK L"repeat-lock" + #define ON_RDK_GP_SHOW_UNDERSIDE L"show-underside" + #define ON_RDK_GP_AUTO_ALTITUDE L"auto-altitude" + #define ON_RDK_GP_SHADOW_ONLY L"shadow-only" + + #define ON_RDK_POST_EFFECTS L"post-effects-new" + #define ON_RDK_PEP_TYPE_EARLY L"early" + #define ON_RDK_PEP_TYPE_TONE L"tone-mapping" + #define ON_RDK_PEP_TYPE_LATE L"late" + #define ON_RDK_PEP_SELECTION L"selection" + #define ON_RDK_PEP_SELECTION_POSTFIX L"-" ON_RDK_PEP_SELECTION + #define ON_RDK_PEP_EARLY_SELECTION ON_RDK_PEP_TYPE_EARLY ON_RDK_PEP_SELECTION_POSTFIX + #define ON_RDK_PEP_TONE_SELECTION ON_RDK_PEP_TYPE_TONE ON_RDK_PEP_SELECTION_POSTFIX + #define ON_RDK_PEP_LATE_SELECTION ON_RDK_PEP_TYPE_LATE ON_RDK_PEP_SELECTION_POSTFIX + +#define ON_RDK_POSTFIX_SECTION L"-section" +#define ON_RDK_SLASH L"/" class ON_CLASS ON_XMLVariant final { @@ -234,6 +307,7 @@ public: void Append(wchar_t* s); wchar_t* Segment(int index) const; +protected: // Emergency virtual function for future expansion. virtual void* EVF(const wchar_t* func, void* data); @@ -315,7 +389,7 @@ public: // Change data. // Removes the child node and passes ownership to the caller. // Returns the detached node or null on failure. - ON_XMLNode* DetachChild(ON_XMLNode& child); // WAS UnhookChild + ON_XMLNode* DetachChild(ON_XMLNode& child); // Removes and deletes all child nodes. void RemoveAllChildren(void); @@ -415,6 +489,7 @@ public: // Utilities. ///////////////////////////////////////////////////////////////////////////////////////////////////////// +protected: // Emergency virtual function for future expansion. virtual void* EVF(const wchar_t* func, void* data); @@ -430,6 +505,7 @@ public: // Iteration. virtual ON_XMLNode* GetNextChild(void); + protected: // Emergency virtual function for future expansion. virtual void* EVF(const wchar_t* func, void* data); @@ -525,6 +601,7 @@ public: virtual bool Write(ON_BinaryArchive&) const override; virtual bool Read(ON_BinaryArchive&) override; +protected: // Emergency virtual function for future expansion. virtual void* EVF(const wchar_t* wszFunc, void* pvData); @@ -541,16 +618,16 @@ private: CImpl& Impl(void) const; }; -ON_DECL const wchar_t* ON_StringFromUnits(ON::LengthUnitSystem units); -ON_DECL ON::LengthUnitSystem ON_UnitsFromString(const ON_wString& s); - class ON_CLASS ON_XMLParameters { public: ON_XMLParameters(ON_XMLNode& node); ON_XMLParameters(const ON_XMLNode& node); + ON_XMLParameters(const ON_XMLParameters&) = delete; virtual ~ON_XMLParameters(); + const ON_XMLParameters& operator = (const ON_XMLParameters&) = delete; + void SetWriteTypeProperty(bool b); void SetDefaultReadType(const wchar_t* type); @@ -567,6 +644,8 @@ public: virtual ~CIterator(); bool Next(ON_wString& param_name_out, ON_XMLVariant& param_value_out) const; + + protected: virtual void* EVF(const wchar_t*, void*); private: @@ -575,14 +654,10 @@ public: }; CIterator* NewIterator(void) const; - virtual void* EVF(const wchar_t*, void*); - - ON_XMLParameters(const ON_XMLParameters&) = delete; - const ON_XMLParameters& operator = (const ON_XMLParameters&) = delete; - protected: const ON_XMLNode& Node(void) const; virtual bool GetParamNode(const ON_XMLNode& node, ON_XMLVariant& param_value) const; + virtual void* EVF(const wchar_t*, void*); virtual ON_XMLNode* SetParamNode(ON_XMLNode& node, const wchar_t* param_name, const ON_XMLVariant& param_value); virtual ON_XMLNode* ObtainChildNodeForWrite(ON_XMLNode& node, const wchar_t* param_name) const; @@ -645,4 +720,28 @@ public: static void SetCallbacks(ReadCallback rc, WriteCallback wc, TransformCallback tc); }; +/////////////////////////////////////////////////////////////////////////////////////////////////////// +// This class is for internal RDK use only. +class ON_CLASS ON_RdkDocumentDefaults +{ +public: + enum class ValueSets { All, New }; + + ON_RdkDocumentDefaults(int major_version, ValueSets vs, void* reserved=nullptr); + ON_RdkDocumentDefaults(const ON_RdkDocumentDefaults&) = delete; + virtual ~ON_RdkDocumentDefaults(); + + const ON_RdkDocumentDefaults& operator = (const ON_RdkDocumentDefaults&) = delete; + + const ON_XMLNode Node(void) const; + + void CopyDefaultsTo(ON_XMLNode& dest) const; + +private: + ON_XMLRootNode _root; + const ValueSets _vs; + void* _reserved; +}; +/////////////////////////////////////////////////////////////////////////////////////////////////////// + #endif diff --git a/opennurbs_zlib.cpp b/opennurbs_zlib.cpp index c2c27ab5..ebed4ce9 100644 --- a/opennurbs_zlib.cpp +++ b/opennurbs_zlib.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" diff --git a/opennurbs_zlib.h b/opennurbs_zlib.h index 2d986b91..38bb4deb 100644 --- a/opennurbs_zlib.h +++ b/opennurbs_zlib.h @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #if !defined(OPENNURBS_ZLIB_INC_) #define OPENNURBS_ZLIB_INC_ diff --git a/opennurbs_zlib_memory.cpp b/opennurbs_zlib_memory.cpp index 9c8f60ed..f9a00636 100644 --- a/opennurbs_zlib_memory.cpp +++ b/opennurbs_zlib_memory.cpp @@ -1,7 +1,5 @@ -/* $NoKeywords: $ */ -/* // -// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved. +// Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert // McNeel & Associates. // @@ -12,7 +10,6 @@ // For complete openNURBS copyright information see . // //////////////////////////////////////////////////////////////// -*/ #include "opennurbs.h" @@ -34,4 +31,4 @@ voidpf zcalloc(voidpf, unsigned items, unsigned size) void zcfree(voidpf, voidpf ptr) { onfree(ptr); -} \ No newline at end of file +}