Skip to content

Commit

Permalink
some progress with SubD Face
Browse files Browse the repository at this point in the history
  • Loading branch information
fraguada committed Jan 10, 2025
1 parent 13ef398 commit 6ceec6c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
30 changes: 22 additions & 8 deletions src/bindings/bnd_subd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,30 @@ BND_SubD::BND_SubD()
SetTrackedPointer(new ON_SubD(), nullptr);
}

BND_SubDFace::BND_SubDFace(const class ON_SubDFace* subdface, const ON_ModelComponentReference* compref)
/*
BND_SubDComponent::BND_SubDComponent(ON_SubDComponentBase* component, const ON_ModelComponentReference& compref)
{
SetTrackedPointer(subdface, compref);
//TODO
}
*/

void BND_SubDFace::SetTrackedPointer(const class ON_SubDFace* subdface, const ON_ModelComponentReference* compref)
// SubDFace

BND_SubDFace::BND_SubDFace(ON_SubD* subd, int index, const ON_ModelComponentReference& compref)
{

m_component_reference = compref;
m_subd = subd;
m_index = index;
m_subdface = m_subd->FaceFromId(index);

}

int BND_SubDFace::EdgeCount() const
{
//TODO: implement
if (m_subdface)
return m_subdface->m_edge_count;
return -1;
}

BND_SubDFaceList BND_SubD::GetFaces()
Expand All @@ -39,10 +55,7 @@ BND_SubDFaceList::BND_SubDFaceList(ON_SubD* subd, const ON_ModelComponentReferen

BND_SubDFace* BND_SubDFaceList::Find(int index)
{
const class ON_SubDFace* face = m_subd->FaceFromId(index);
if (nullptr == face)
return nullptr;
return new BND_SubDFace(face, &m_component_reference);
return new BND_SubDFace(m_subd, index, m_component_reference);
}

BND_SubDEdgeList BND_SubD::GetEdges()
Expand Down Expand Up @@ -74,6 +87,7 @@ void initSubDBindings(rh3dmpymodule& m)
{
py::class_<BND_SubDFace>(m, "SubDFace")
.def_property_readonly("EdgeCount", &BND_SubDFace::EdgeCount)
.def_property_readonly("Index", &BND_SubDFace::Index)
;

py::class_<BND_SubDFaceList>(m, "SubDFaceList")
Expand Down
31 changes: 21 additions & 10 deletions src/bindings/bnd_subd.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,37 @@ void initSubDBindings(rh3dmpymodule& m);
void initSubDBindings(void* m);
#endif

class BND_SubDComponent
{
ON_ModelComponentReference m_component_reference;
ON_SubDComponentBase* m_component = nullptr;
ON_SubD* m_subd = nullptr;
public:
//BND_SubDComponent(ON_SubDComponentBase* component, const ON_ModelComponentReference& compref);
protected:

};

class BND_SubDFace {

ON_SubDFace* m_subdface = nullptr;
ON_ModelComponentReference m_component_reference;
const class ON_SubDFace* m_subdface = nullptr;
ON_SubD* m_subd = nullptr;
int m_index = -1;

public:
BND_SubDFace(const class ON_SubDFace* subdface, const ON_ModelComponentReference* compref);
int EdgeCount() const { return m_subdface->m_edge_count; }

protected:
void SetTrackedPointer(const class ON_SubDFace* subdface, const ON_ModelComponentReference* compref);
BND_SubDFace(ON_SubD* subd, int index, const ON_ModelComponentReference& compref);
int Index() const { return m_index; }
int EdgeCount() const;//<--- currently here

};
class BND_SubDEdge {};
class BND_SubDEdge : public BND_SubDComponent {};

class BND_SubDVertex : public BND_SubDComponent {

class BND_SubDVertex {
ON_ModelComponentReference m_component_reference;
ON_SubDVertex* m_subdvertex = nullptr;

public:
BND_SubDVertex(ON_SubDVertex* vertex, const ON_ModelComponentReference& compref);

// properties

Expand Down

0 comments on commit 6ceec6c

Please sign in to comment.