Files
test/source/blender/io/usd/intern/usd_reader_skeleton.cc
Hans Goudey 976eaae02f Cleanup: Move BKE_object.hh to C++
Simplifies the fix to #111120, where the object bounds functions
may return a C++ type instead of `BoundBox`.

Pull Request: https://projects.blender.org/blender/blender/pulls/113462
2023-10-09 23:41:53 +02:00

48 lines
1.0 KiB
C++

/* SPDX-FileCopyrightText: 2021 NVIDIA Corporation. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "usd_reader_skeleton.h"
#include "usd_skel_convert.h"
#include "BKE_armature.h"
#include "BKE_idprop.h"
#include "BKE_object.hh"
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "MEM_guardedalloc.h"
#include "WM_api.hh"
#include <iostream>
namespace blender::io::usd {
bool USDSkeletonReader::valid() const
{
return skel_ && USDXformReader::valid();
}
void USDSkeletonReader::create_object(Main *bmain, const double /*motionSampleTime*/)
{
object_ = BKE_object_add_only_object(bmain, OB_ARMATURE, name_.c_str());
bArmature *arm = BKE_armature_add(bmain, name_.c_str());
object_->data = arm;
}
void USDSkeletonReader::read_object_data(Main *bmain, const double motionSampleTime)
{
if (!object_ || !object_->data || !skel_) {
return;
}
import_skeleton(bmain, object_, skel_);
USDXformReader::read_object_data(bmain, motionSampleTime);
}
} // namespace blender::io::usd