Make RimMultiPlot column/row count scriptable via gRPC#14043
Merged
magnesj merged 3 commits intoMay 26, 2026
Conversation
The `m_columnCount` and `m_rowsPerPage` fields on RimMultiPlot are
initialized from RiaPreferencesSummary (the user's interactive
"Edit -> Preferences -> Plotting -> Multi Plot Defaults" setting),
which is backed by the on-disk preferences file shared between every
ResInsight process on the machine.
There is no way for a Python script using rips to override these
fields per multi-plot, because they were declared with
CAF_PDM_InitFieldNoDefault and the containing class RimSummaryMultiPlot
was registered with the non-scriptable CAF_PDM_InitObject. The fields
therefore did not surface in the generated Python bindings, so an
interactive preference change in one session silently changed the
output of unrelated headless scripts.
Make the fields scriptable by switching to CAF_PDM_InitScriptableField,
and register RimSummaryMultiPlot itself as a scriptable class via
CAF_PDM_InitScriptableObject. Add the missing include of
cafPdmObjectScriptingCapability.h in RimSummaryMultiPlot.cpp.
After this change, the generated rips classes expose
MultiSummaryPlot.number_of_columns / .rows_per_page as int-valued
attributes that round-trip through update(). Python clients can now:
mp = ri.project.descendants(rips.MultiSummaryPlot)[-1]
mp.number_of_columns = 1
mp.rows_per_page = 1
mp.update()
to neutralize the user's interactive preference.
The change does not touch CAF_PDM_InitObject vs InitScriptableObject
for RimMultiPlot itself or for RimHistogramMultiPlot; only
RimSummaryMultiPlot is covered here. Subsequent commits can expand
coverage as needed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
|
This feature is a useful improvement. Please add unit tests as |
Covers the new scriptable RimSummaryMultiPlot fields exposed in the previous commit: - number_of_columns / rows_per_page are readable over gRPC and round-trip through update() - forcing a 1x1 layout works regardless of the Multi Plot Defaults preference (the deterministic-output case headless export relies on) Follows the existing rips test conventions (rips_instance / initialize_test fixtures, dataroot.PATH test data, SIMPLE_SUMMARY2). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
|
This looks good. GitHub has issues running tests today, I will give a review when the tests has passed. |
Member
|
Can you please add a dummy commit to trigger CI? GitHub had some issues with Actions earlier today. |
Empty commit to re-trigger GitHub Actions, which had issues running earlier today (per maintainer request on the PR).
Member
|
Thanks for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exposes the multi-plot grid layout (
number_of_columns/rows_per_page) to theripsPython client so scripts can set it per multi-plot, instead of silently inheriting the user's interactive preference.Motivation:
RimMultiPlot::m_columnCountandm_rowsPerPageare initialized fromRiaPreferencesSummary— the user's interactiveEdit → Preferences → Plotting → Multi Plot Defaultssetting, backed by the on-disk preferences file that is shared between every ResInsight process on the machine. A headless, rips-driven script had no way to override them, so a preference change made in one interactive session silently altered the output of unrelated scripts. The fields did not surface in the generated Python bindings at all, because they were declared withCAF_PDM_InitFieldNoDefaultand the containing classRimSummaryMultiPlotwas registered with the non-scriptableCAF_PDM_InitObject.Changes
RimMultiPlot.cpp— declarem_columnCount/m_rowsPerPagewithCAF_PDM_InitScriptableField(seeding the default fromRiaPreferencesSummaryas before), instead ofCAF_PDM_InitFieldNoDefault.RimSummaryMultiPlot.cpp— register the class withCAF_PDM_InitScriptableObject(wasCAF_PDM_InitObject) so it appears in the generated bindings, and add the missingcafPdmObjectScriptingCapability.hinclude.Result
The generated
ripsclasses now exposeMultiSummaryPlot.number_of_columns/.rows_per_pageas int-valued attributes that round-trip throughupdate():This lets a headless export force a deterministic layout (e.g. 1×1) regardless of the user's interactive preference.
Scope
Only
RimSummaryMultiPlotis made scriptable here;RimMultiPlotitself andRimHistogramMultiPlotkeepCAF_PDM_InitObject. Coverage can be expanded in a follow-up if other multi-plot types need the same.Notes
CODE_HEAD_FILESCMake typo fix) and Expose snapshot size to gRPC / rips clients #14042 (snapshot size). Building this branch with-DRESINSIGHT_ENABLE_GRPC=ONrequires the Fix CODE_HEAD_FILES typo so gRPC headers reach MOC #14041 fix; it is otherwise independent of Expose snapshot size to gRPC / rips clients #14042 (no file overlap).CAF_PDM_InitScriptableFielduses the same serialization asCAF_PDM_InitFieldNoDefault, just with extra scripting metadata).Test plan
ripsexposesMultiSummaryPlot.number_of_columns/.rows_per_page; setting +update()round-trips (verified 2 → 1).Multi Plot Defaultspreference.