Skip to content

Commit

Permalink
Prevent creating of RenderContent class.
Browse files Browse the repository at this point in the history
Make sure new render content has an id.
  • Loading branch information
croudyj committed Jul 24, 2023
1 parent a36b18f commit b369cf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions src/bindings/bnd_render_content.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@

#include "bindings.h"

BND_File3dmRenderContent::BND_File3dmRenderContent()
{
throw pybind11::type_error("Unable to create an instance of RenderContent. Try creating RenderMaterial, RenderEnvironment, or RenderTexture");
}

BND_File3dmRenderContent::BND_File3dmRenderContent(ON_RenderContent* rc)
{
if (nullptr == rc)
throw pybind11::value_error("NULL RenderContent");

rc->SetId();

SetTrackedPointer(rc, nullptr);
}

Expand Down Expand Up @@ -393,15 +403,8 @@ void BND_File3dmRenderTexture::SetFilename(const std::wstring& f)

void BND_File3dmRenderContentTable::Add(const BND_File3dmRenderContent& rc)
{
/*
if (nullptr != rc.m_rc)
{
m_model->AddModelComponent(*rc.m_rc);
}
*/
const ON_RenderContent* r = rc.m_rc;
m_model->AddModelComponent(*r);

}

BND_File3dmRenderContent* BND_File3dmRenderContentTable::FindIndex(int index)
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/bnd_render_content.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BND_File3dmRenderContent : public BND_ModelComponent
void SetTrackedPointer(ON_RenderContent* rc, const ON_ModelComponentReference* compref);

public:
BND_File3dmRenderContent() { }
BND_File3dmRenderContent();
BND_File3dmRenderContent(ON_RenderContent* rc);
BND_File3dmRenderContent(ON_RenderContent* rc, const ON_ModelComponentReference* compref);
BND_File3dmRenderContent(const BND_File3dmRenderContent& other);
Expand Down

0 comments on commit b369cf3

Please sign in to comment.