-
Notifications
You must be signed in to change notification settings - Fork 81
Override visual object colors with tags #4920
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
Conversation
source/MRMesh/MRObject.h
Outdated
/// provides read-only access to the metadata storage | ||
/// the storage is a set of unique strings | ||
const std::unordered_set<std::string>& getMetadata() const { return metadata_; } | ||
/// provides read-write access to the metadata storage | ||
std::unordered_set<std::string>& getMutableMetadata() { return metadata_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can both functions be named just tags()
? (also we usually virtualize non-const getters) (for models we have mesh()
and varMesh()
for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also it seems that set
and update
functions are required (to set needRedraw_
flag internally)
@@ -216,6 +216,8 @@ class MRVOXELS_CLASS ObjectVoxels : public ObjectMeshHolder | |||
/// nullptr means serialize in defaultSerializeVoxelsFormat() | |||
MRVOXELS_API void setSerializeFormat( const char * newFormat ); | |||
|
|||
MRVOXELS_API void resetFrontColor() override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add comments
source/MRMesh/MRObject.h
Outdated
/// provides read-only access to the tag storage | ||
/// the storage is a set of unique strings | ||
const std::unordered_set<std::string>& getTags() const { return tags_; } | ||
/// provides read-write access to the tag storage | ||
std::unordered_set<std::string>& getMutableTags() { return tags_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getTags
-> tags
getMutableTags
-> virtual varTags
(to be more like existing functions)
source/MRVoxels/MRObjectVoxels.cpp
Outdated
void ObjectVoxels::resetFrontColor() | ||
{ | ||
setDefaultColors_(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add comment in all such places, that we cannot do
setDefaultColors_
{
resetColors();
}
to keep setDefaultColors_
non-virtual and resetColors
- virtual
source/MRViewer/MRVisualObjectTag.h
Outdated
/// add the tag to the object and apply related visual object properties | ||
MRVIEWER_API static void applyTag( VisualObject& visObj, const std::string& visTagId, bool force = false ); | ||
/// remove the tag from the object and reset the visual object properties | ||
MRVIEWER_API static void revertTag( VisualObject& visObj, const std::string& visTagId, bool force = false ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert->remove?
source/MRViewer/MRVisualObjectTag.h
Outdated
/// add the tag to the object and apply related visual object properties | ||
MRVIEWER_API static void applyTag( VisualObject& visObj, const std::string& visTagId, bool force = false ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apply->add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mb we should separate add/remove/apply:
for example create add/remove
Tag functions to MR::Object and call apply on these function via signals or tagApplyCallback registry or something?
/// update visual object properties according to whether given object has the visual object tag or not | ||
MRVIEWER_API static void update( VisualObject& visObj, const std::string& visTagId ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be able to update all tags present in storage at once?
No description provided.