Skip to content

Commit

Permalink
update RenderSetting objects copy ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
fraguada committed Jul 26, 2023
1 parent 42ca8dc commit 3e25800
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 19 deletions.
18 changes: 16 additions & 2 deletions src/bindings/bnd_dithering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,22 @@ BND_File3dmDithering::BND_File3dmDithering()

BND_File3dmDithering::BND_File3dmDithering(const BND_File3dmDithering& dit)
{
_dit = new ON_Dithering(*dit._dit);
_owned = true;
// see bnd_ground_plane.cpp for justification
_dit = dit._dit;

if (dit._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmDithering&>(dit)._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_dit = new ON_Dithering(*dit._dit);
//_owned = true;

}

BND_File3dmDithering::BND_File3dmDithering(ON_Dithering* dit)
Expand Down
17 changes: 15 additions & 2 deletions src/bindings/bnd_linear_workflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,21 @@ BND_File3dmLinearWorkflow::BND_File3dmLinearWorkflow()

BND_File3dmLinearWorkflow::BND_File3dmLinearWorkflow(const BND_File3dmLinearWorkflow& lw)
{
_lw = new ON_LinearWorkflow(*lw._lw);
_owned = true;
// see bnd_ground_plane.cpp for justification
_lw = lw._lw;

if (lw._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmLinearWorkflow&>(lw)._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_lw = new ON_LinearWorkflow(*lw._lw);
//_owned = true;
}

BND_File3dmLinearWorkflow::BND_File3dmLinearWorkflow(ON_LinearWorkflow* lw)
Expand Down
36 changes: 31 additions & 5 deletions src/bindings/bnd_post_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,22 @@ BND_File3dmPostEffect::BND_File3dmPostEffect(ON_PostEffect* pep)
}

BND_File3dmPostEffect::BND_File3dmPostEffect(const BND_File3dmPostEffect& pep)
{
_pep = new ON_PostEffect(*pep._pep);
_owned = true;
{
// see bnd_ground_plane.cpp for justification
_pep = pep._pep;

if (pep._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmPostEffect&>(pep)._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_pep = new ON_PostEffect(*pep._pep);
//_owned = true;
}

BND_File3dmPostEffect::~BND_File3dmPostEffect()
Expand Down Expand Up @@ -88,8 +101,21 @@ BND_File3dmPostEffectTable::BND_File3dmPostEffectTable()

BND_File3dmPostEffectTable::BND_File3dmPostEffectTable(const BND_File3dmPostEffectTable& pet)
{
_peps = new ON_PostEffects(*pet._peps);
_owned = true;
// see bnd_ground_plane.cpp for justification
_peps = pet._peps;

if (pet._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmPostEffectTable&>(pet)._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_peps = new ON_PostEffects(*pet._peps);
//_owned = true;
}

BND_File3dmPostEffectTable::BND_File3dmPostEffectTable(ON_PostEffects* peps)
Expand Down
17 changes: 15 additions & 2 deletions src/bindings/bnd_render_channels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,21 @@ BND_File3dmRenderChannels::BND_File3dmRenderChannels()

BND_File3dmRenderChannels::BND_File3dmRenderChannels(const BND_File3dmRenderChannels& rch)
{
_rch = new ON_RenderChannels(*rch._rch);
_owned = true;
// see bnd_ground_plane.cpp for justification
_rch = rch._rch;

if (rch._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmRenderChannels&>(rch)._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_rch = new ON_RenderChannels(*rch._rch);
//_owned = true;
}

BND_File3dmRenderChannels::BND_File3dmRenderChannels(ON_RenderChannels* rch)
Expand Down
17 changes: 15 additions & 2 deletions src/bindings/bnd_render_environments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@ BND_File3dmRenderEnvironments::BND_File3dmRenderEnvironments()

BND_File3dmRenderEnvironments::BND_File3dmRenderEnvironments(const BND_File3dmRenderEnvironments& re)
{
_rs = new ON_3dmRenderSettings(*re._rs);
_owned = true;
// see bnd_ground_plane.cpp for justification
_rs = re._rs;

if (re._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmRenderEnvironments&>(re)._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_rs = new ON_3dmRenderSettings(*re._rs);
//_owned = true;
}

BND_File3dmRenderEnvironments::BND_File3dmRenderEnvironments(ON_3dmRenderSettings* rs)
Expand Down
17 changes: 15 additions & 2 deletions src/bindings/bnd_safe_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,21 @@ BND_File3dmSafeFrame::BND_File3dmSafeFrame()

BND_File3dmSafeFrame::BND_File3dmSafeFrame(const BND_File3dmSafeFrame& sf)
{
_sf = new ON_SafeFrame(*sf._sf);
_owned = true;
// see bnd_ground_plane.cpp for justification
_sf = sf._sf;

if (sf._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmSafeFrame&>(sf._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_sf = new ON_SafeFrame(*sf._sf);
//_owned = true;
}

BND_File3dmSafeFrame::BND_File3dmSafeFrame(ON_SafeFrame* sf)
Expand Down
17 changes: 15 additions & 2 deletions src/bindings/bnd_skylight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,21 @@ BND_File3dmSkylight::BND_File3dmSkylight()

BND_File3dmSkylight::BND_File3dmSkylight(const BND_File3dmSkylight& sl)
{
_sl = new ON_Skylight(*sl._sl);
_owned = true;
// see bnd_ground_plane.cpp for justification
_sl = sl._sl;

if (sl._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmSkylight&>(sl)._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_sl = new ON_Skylight(*sl._sl);
//_owned = true;
}

BND_File3dmSkylight::BND_File3dmSkylight(ON_Skylight* sl)
Expand Down
17 changes: 15 additions & 2 deletions src/bindings/bnd_sun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,21 @@ BND_File3dmSun::BND_File3dmSun()

BND_File3dmSun::BND_File3dmSun(const BND_File3dmSun& sun)
{
_sun = new ON_Sun(*sun._sun);
_owned = true;
// see bnd_ground_plane.cpp for justification
_sun = sun._sun;

if (sun._owned)
{
// Tell the original owner that it no longer owns it.
const_cast<BND_File3dmSun&>(sun)._owned = false;

// This object now owns it instead.
_owned = true;
}

// Old code makes an actual copy of the native object -- which means changes don't stick.
//_sun = new ON_Sun(*sun._sun);
//_owned = true;
}

BND_File3dmSun::BND_File3dmSun(ON_Sun* s)
Expand Down

0 comments on commit 3e25800

Please sign in to comment.