Skip to content

Conversation

Copy link

Copilot AI commented Jan 18, 2026

Multiple classes maintained custom implementations of name fields and checked state with redundant userDescriptionField() and objectToggleField() overrides.

Changes

Refactored 5 classes to inherit from framework base classes:

  • RimViewControllerRimCheckableNamedObject
  • RimViewLinkerRimNamedObject
  • RimPlotAxisAnnotationRimCheckableNamedObject
  • RimTextAnnotationInViewRimCheckableObject
  • RimPolylinesAnnotationRimCheckableObject

Each refactoring:

  • Removed custom m_name/m_isActive field declarations
  • Removed userDescriptionField()/objectToggleField() overrides
  • Updated field access to use inherited methods (isChecked(), name(), setName(), nameField())
  • Added registerKeywordAlias() only where serialization keywords differ from base class

Example

Before:

class RimViewController : public caf::PdmObject {
    caf::PdmFieldHandle* userDescriptionField() override { return &m_name; }
    caf::PdmFieldHandle* objectToggleField() override { return &m_isActive; }
private:
    caf::PdmField<QString> m_name;
    caf::PdmField<bool> m_isActive;
};

After:

class RimViewController : public RimCheckableNamedObject {
    // Inherits userDescriptionField() and objectToggleField()
    // Constructor adds: m_isChecked.registerKeywordAlias("Active");
};

Backward compatibility maintained via keyword aliases. Base classes use "Name" and "IsChecked" as keywords; aliases map old keywords "Active"/"IsActive" where needed.

Original prompt

This section details on the original issue you should resolve

<issue_title>Use RimNamedObject and RimCheckableNamedObject</issue_title>
<issue_description>The name of an object and name and visible/active state can be managed by RimNamedObject and RimCheckableNamedObject.

The checked state is usually returned in objectToggleField() .

The name is usually connected to userDescriptionField() .

Find classes have a custom implementation of name and checked state. Refactor classes to use the framework classes. The current field name must be preserved using registerKeywordAlias

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits January 18, 2026 09:39
Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com>
Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com>
Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com>
Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com>
Co-authored-by: magnesj <1793152+magnesj@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor classes to use RimNamedObject and RimCheckableNamedObject Refactor classes to use RimNamedObject and RimCheckableNamedObject framework Jan 18, 2026
Copilot AI requested a review from magnesj January 18, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use RimNamedObject and RimCheckableNamedObject

2 participants