MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / FALCOR_SCRIPT_BINDING

Function FALCOR_SCRIPT_BINDING

Source/Falcor/Scene/Animation/Animation.cpp:321–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319 }
320
321 FALCOR_SCRIPT_BINDING(Animation)
322 {
323 using namespace pybind11::literals;
324
325 FALCOR_SCRIPT_BINDING_DEPENDENCY(Transform)
326
327 pybind11::class_<Animation, ref<Animation>> animation(m, "Animation");
328
329 pybind11::enum_<Animation::InterpolationMode> interpolationMode(animation, "InterpolationMode");
330 interpolationMode.value("Linear", Animation::InterpolationMode::Linear);
331 interpolationMode.value("Hermite", Animation::InterpolationMode::Hermite);
332
333 pybind11::enum_<Animation::Behavior> behavior(animation, "Behavior");
334 behavior.value("Constant", Animation::Behavior::Constant);
335 behavior.value("Linear", Animation::Behavior::Linear);
336 behavior.value("Cycle", Animation::Behavior::Cycle);
337 behavior.value("Oscillate", Animation::Behavior::Oscillate);
338
339 animation.def_property_readonly("name", &Animation::getName);
340 animation.def_property_readonly("nodeID", &Animation::getNodeID);
341 animation.def_property_readonly("duration", &Animation::getDuration);
342 animation.def_property("preInfinityBehavior", &Animation::getPreInfinityBehavior, &Animation::setPreInfinityBehavior);
343 animation.def_property("postInfinityBehavior", &Animation::getPostInfinityBehavior, &Animation::setPostInfinityBehavior);
344 animation.def_property("interpolationMode", &Animation::getInterpolationMode, &Animation::setInterpolationMode);
345 animation.def_property("enableWarping", &Animation::isWarpingEnabled, &Animation::setEnableWarping);
346 animation.def(pybind11::init(&Animation::create), "name"_a, "nodeID"_a, "duration"_a);
347 animation.def("addKeyframe", [] (Animation* pAnimation, double time, const Transform& transform) {
348 Animation::Keyframe keyframe{ time, transform.getTranslation(), transform.getScaling(), transform.getRotation() };
349 pAnimation->addKeyframe(keyframe);
350 });
351 }
352}

Callers

nothing calls this directly

Calls 3

initFunction · 0.85
addKeyframeMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected