Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need more coding examples #2

Closed
samsonsite1 opened this issue Jun 24, 2022 · 2 comments
Closed

Need more coding examples #2

samsonsite1 opened this issue Jun 24, 2022 · 2 comments

Comments

@samsonsite1
Copy link

samsonsite1 commented Jun 24, 2022

Hello,

I'm new to OpenGEX, however the coding examples are a bit lacking, especially on the import side.
There are absolutely no coding examples on how to access any of the data we need.

We need to see C++ coding examples on how to access data from every OpenGEX structure available:
Metric
GeometryNode
GeometryObject
Material
etc...

Or we need at least a basic C++ program that loads in a OGEX file and prints out every bit of information
as text to the commandline.

For example, starting with this:

const Structure *structure = openGexDataDescription.GetRootStructure()->GetFirstSubnode();
while (structure)
{
// This loops over all top-level structures in the file.
// Do something with the data...

   structure = structure->GetNextSubnode();

}

How do we access the 'key' attribute here?

Metric (key = "distance") {float {1}}
Metric (key = "angle") {float {1}}
Metric (key = "time") {float {1}}
Metric (key = "up") {string {"z"}}
Metric (key = "forward") {string {"x"}}

Another example, how do we access the 'primitive' attribute here?

GeometryObject $geometry1 // Box001, Box002
{
Mesh (primitive = "triangles")
{
}
}

If there's some hidden OpenDDL polymorphism going on, then it's not being adequately explained, which is very frustrating.

Thanks for any help.

@EricLengyel
Copy link
Owner

Properties like 'key' and 'primitive' are stored in members of the structures to which they belong. For example, the MetricStructure class has a string member called metricKey, and it holds the value of the 'key' property for that structure. Similarly, the MeshStructure class has a member called meshPrimitive.

@samsonsite1
Copy link
Author

samsonsite1 commented Jun 25, 2022

Thanks for the reply.

Ok, but these members are private, and i see no 'get' functions to retrieve them. I was under the impression that all the information I needed was retrievable, but it seems now I have to hack into it and add my own 'get' functions. If I misunderstand,
then please show a single code of line that demonstrates how to retrieve these data from the structure, without having to modify the OpenGEX library as it stands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants