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

--[Bugfix] - Miscellaneous minor bugfixes #2546

Merged
merged 3 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions examples/mod_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

# add tools directory so I can import things to try them in the viewer
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../tools"))
print(sys.path)
# print(sys.path)

# from tools import collision_shape_automation as csa

Expand Down Expand Up @@ -793,9 +793,11 @@ def debug_draw(self):
"""
Additional draw commands to be called during draw_event.
"""
render_camera = self.render_camera.render_camera
if self.debug_bullet_draw:
render_cam = self.render_camera.render_camera
proj_mat = render_cam.projection_matrix.__matmul__(render_cam.camera_matrix)
proj_mat = render_camera.projection_matrix.__matmul__(
render_camera.camera_matrix
)
self.sim.physics_debug_draw(proj_mat)

debug_line_render: DebugLineRender = self.sim.get_debug_line_render()
Expand All @@ -809,14 +811,14 @@ def debug_draw(self):
if self.markersets_util.marker_sets_per_obj is not None:
self.markersets_util.draw_marker_sets_debug(
debug_line_render,
self.render_camera.render_camera.node.absolute_translation,
render_camera.node.absolute_translation,
)
if self.receptacles is not None and self.display_receptacles:
self.draw_receptacles(debug_line_render)

# draw object-related visualizations managed by obj_editor
self.obj_editor.draw_obj_vis(
camera_trans=render_cam.node.absolute_translation,
camera_trans=render_camera.node.absolute_translation,
debug_line_render=debug_line_render,
)
# mouse raycast circle
Expand Down
15 changes: 15 additions & 0 deletions src/esp/core/managedContainers/ManagedFileBasedContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ManagedFileBasedContainer : public ManagedContainer<T, Access> {
const io::JsonGenericValue config = docConfig->GetObject();
ManagedFileIOPtr attr = this->buildManagedObjectFromDoc(filename, config);
attr->setActualFilename(filename);
this->setFileDirectoryFromFilePath(attr);
// Set attributes' status to saved (i.e. it matches the version on disk)
// since it was just loaded.
attr->setAttrIsSaved();
Expand Down Expand Up @@ -511,6 +512,20 @@ class ManagedFileBasedContainer : public ManagedContainer<T, Access> {
}
} // setFileDirectoryFromHandle

/**
* @brief Get directory component of managed object's specified handle and call @ref
* esp::core::managedContainers::AbstractFileBasedManagedObject::setFileDirectory
* if a legitimate directory exists in handle.
*
* @param object pointer to managed object to set
*/
void setFileDirectoryFromFilePath(ManagedFileIOPtr object) {
std::string fileName = object->getActualFilename();
auto loc = fileName.find_last_of('/');
if (loc != std::string::npos) {
object->setFileDirectory(fileName.substr(0, loc + 1));
}
} // setFileDirectoryFromHandle
// ======== Instance Variables ========
/**
* @brief The string extension for the JSON configuration file backing this
Expand Down
12 changes: 9 additions & 3 deletions src/esp/metadata/managers/AbstractAttributesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,19 @@ auto AbstractAttributesManager<T, Access>::createFromJsonOrDefaultInternal(
bool fileExists = CrPath::exists(filename);
// if filename passed is name of some kind of asset, or if it was not
// found
if (ESP_LOG_LEVEL_ENABLED(logging::LoggingLevel::Debug)) {
if (fileExists) {
// Built from non-json filename (i.e. glb file)
attrs->setActualFilename(filename);
this->setFileDirectoryFromFilePath(attrs);
// only populate msg if appropriate logging level is enabled
if (fileExists) {
if (ESP_LOG_LEVEL_ENABLED(logging::LoggingLevel::Debug)) {
msg = "File `" + filename +
"` exists but is not a recognized config filename extension, so "
"new default";
} else {
}
} else {
// only populate msg if appropriate logging level is enabled
if (ESP_LOG_LEVEL_ENABLED(logging::LoggingLevel::Debug)) {
msg = "File `" + filename + "` not found, so new default";
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/esp/metadata/managers/SensorAttributesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ AbstractSensorAttributes::ptr SensorAttributesManager::initNewObjectInternal(
}
// these attributes ignore any default settings.
auto newAttributes = (*this.*sensorTypeCtorIter->second)();

// set the attributes source filedirectory, from the attributes name
this->setFileDirectoryFromHandle(newAttributes);
if (builtFromConfig) {
ESP_VERY_VERBOSE(Mn::Debug::Flag::NoSpace)
<< "New " << sensorAttrClassName
Expand Down
Loading