Skip to content

Commit

Permalink
--fix handle (template name) not being saved to scene obj/ao instance…
Browse files Browse the repository at this point in the history
… json
  • Loading branch information
jturner65 committed Jun 13, 2024
1 parent 18a2ba6 commit bed1ba6
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/esp/metadata/attributes/SceneInstanceAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ SceneObjectInstanceAttributes::SceneObjectInstanceAttributes(
const std::string& handle,
const std::shared_ptr<AbstractObjectAttributes>& baseObjAttribs)
: SceneObjectInstanceAttributes(handle) {
// This constructor is for internally generated SceneObjectInstanceAttributes,
// to correspond to an object that is being created programmatically and saved
// to a scene instance.
// Handle is set via init in base class, which would not be written out to
// file if we did not explicitly set it.
setHandle(handle);
// set appropriate fields from abstract object attributes
// Not initialize, since these are not default values
set("shader_type", getShaderTypeName(baseObjAttribs->getShaderType()));
Expand Down Expand Up @@ -110,11 +116,10 @@ esp::physics::MotionType SceneObjectInstanceAttributes::getMotionType() const {
void SceneObjectInstanceAttributes::writeValuesToJson(
io::JsonGenericValue& jsonObj,
io::JsonAllocator& allocator) const {
// map "handle" to "template_name" key in json
writeValueToJson("handle", "template_name", jsonObj, allocator);
if (getTranslation() != Mn::Vector3()) {
writeValueToJson("translation", jsonObj, allocator);
}
// map "handle" to "template_name" key in json // This constructor is for
// internally generated SceneAOInstanceAttributes, to correspond to an object
// that is being created programmatically and saved to a scene instance.

if (getTranslationOrigin() != SceneInstanceTranslationOrigin::Unknown) {
writeValueToJson("translation_origin", jsonObj, allocator);
}
Expand Down Expand Up @@ -182,9 +187,13 @@ SceneAOInstanceAttributes::SceneAOInstanceAttributes(const std::string& handle)
SceneAOInstanceAttributes::SceneAOInstanceAttributes(
const std::string& handle,
const std::shared_ptr<ArticulatedObjectAttributes>& aObjAttribs)
: SceneObjectInstanceAttributes(handle, "SceneAOInstanceAttributes") {
// initialize default auto clamp values (only used for articulated object)
init("auto_clamp_joint_limits", false);
: SceneAOInstanceAttributes(handle) {
// This constructor is for internally generated SceneAOInstanceAttributes, to
// correspond to an object that is being created programmatically and saved to
// a scene instance.
// Handle is set via init in base class, which would not be written out to
// file if we did not explicitly set it.
setHandle(handle);

// Should not initialize these values but set them, since these are not
// default values, but from an existing AO attributes.
Expand Down

0 comments on commit bed1ba6

Please sign in to comment.