mosra / magnum-bindings

Bindings of the Magnum C++11 graphics engine into other languages
https://magnum.graphics
Other
19 stars 13 forks source link

Added Scene downcasting to Object #8

Closed melix99 closed 4 years ago

melix99 commented 4 years ago

This is needed to manage the scene as an object, otherwise it can do nothing.

codecov-io commented 4 years ago

Codecov Report

Merging #8 into master will decrease coverage by 0.12%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #8      +/-   ##
==========================================
- Coverage   90.96%   90.84%   -0.13%     
==========================================
  Files          39       39              
  Lines        4053     4053              
==========================================
- Hits         3687     3682       -5     
- Misses        366      371       +5
Impacted Files Coverage Δ
src/python/magnum/scenegraph.trs.cpp 100% <100%> (ø) :arrow_up:
src/python/magnum/scenegraph.matrix.cpp 100% <100%> (ø) :arrow_up:
src/python/magnum/scenegraph.h 68.26% <0%> (-0.97%) :arrow_down:
src/python/magnum/gl.cpp 94.9% <0%> (-0.66%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 97062bc...9f19e72. Read the comment docs.

mosra commented 4 years ago

Err, sorry for the late reply again (I have too many repos and too many notifications :sweat_smile:).

It's deliberately done the way it is now -- the scene should not have any transformations applied or features attached, it's just root object, holding everything else. That's the same on the C++ side -- the scene will complain (or ... it should) if you try to set its transformation or attach features.

If you need something at the root, add a direct child Object.

(Vaguely relevant is that I don't provide any iterator access for object's children or features in the Python bindings -- that need to be added.)

melix99 commented 4 years ago

Oh you're right, for some reason I thought that it applies transformations, maybe because in c++ using setTranslation()/etc don't give errors, but it does in python.

(Vaguely relevant is that I don't provide any iterator access for object's children or features in the Python bindings -- that need to be added.)

Ok, maybe I can take a look to that when I have time.

mosra commented 4 years ago

don't give errors

It'll do nothing at runtime ... which isn't good, it should be asserting. Unfortunately with the current design it's hard to make it a compile-time error.

Maybe I can take a look to that when I have time.

It's a boring and time-consuming task of writing an iterator class for LinkedList and exposing it to Python, which is why I didn't do it yet :D