|
48 | 48 | #include "RimViewLinker.h" |
49 | 49 | #include "RimWellPath.h" |
50 | 50 |
|
| 51 | +#include "cafPdmFieldScriptingCapability.h" |
| 52 | +#include "cafPdmObjectScriptingCapability.h" |
51 | 53 | #include "cafPdmUiDoubleValueEditor.h" |
52 | 54 | #include "cafPdmUiTreeSelectionEditor.h" |
53 | 55 |
|
@@ -77,15 +79,15 @@ CAF_PDM_SOURCE_INIT( RimGeoMechResultDefinition, "GeoMechResultDefinition" ); |
77 | 79 | //-------------------------------------------------------------------------------------------------- |
78 | 80 | RimGeoMechResultDefinition::RimGeoMechResultDefinition() |
79 | 81 | { |
80 | | - CAF_PDM_InitObject( "Color Result", ":/CellResult.png" ); |
| 82 | + CAF_PDM_InitScriptableObjectWithNameAndComment( "Color Result", ":/CellResult.png", "", "", "GeoMechResult", "A geomechanical result definition" ); |
81 | 83 |
|
82 | | - CAF_PDM_InitFieldNoDefault( &m_resultPositionType, "ResultPositionType", "Result Position" ); |
| 84 | + CAF_PDM_InitScriptableFieldNoDefault( &m_resultPositionType, "ResultPositionType", "Result Position" ); |
83 | 85 | m_resultPositionType.uiCapability()->setUiHidden( true ); |
84 | 86 |
|
85 | | - CAF_PDM_InitField( &m_resultFieldName, "ResultFieldName", QString( "" ), "Field Name" ); |
| 87 | + CAF_PDM_InitScriptableField( &m_resultFieldName, "ResultFieldName", QString( "" ), "Field Name" ); |
86 | 88 | m_resultFieldName.uiCapability()->setUiHidden( true ); |
87 | 89 |
|
88 | | - CAF_PDM_InitField( &m_resultComponentName, "ResultComponentName", QString( "" ), "Component" ); |
| 90 | + CAF_PDM_InitScriptableField( &m_resultComponentName, "ResultComponentName", QString( "" ), "Component" ); |
89 | 91 | m_resultComponentName.uiCapability()->setUiHidden( true ); |
90 | 92 |
|
91 | 93 | CAF_PDM_InitField( &m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigFemResultAddress::noTimeLapseValue(), "Base Time Step" ); |
@@ -541,6 +543,14 @@ void RimGeoMechResultDefinition::initAfterRead() |
541 | 543 | { |
542 | 544 | if ( m_resultComponentName() == "STM" || m_resultComponentName() == "SEM" ) m_resultComponentName = "SM"; |
543 | 545 |
|
| 546 | + updateUiFieldsFromActiveResult(); |
| 547 | +} |
| 548 | + |
| 549 | +//-------------------------------------------------------------------------------------------------- |
| 550 | +/// Sync the UI fields after the result fields are set directly, e.g. from scripting |
| 551 | +//-------------------------------------------------------------------------------------------------- |
| 552 | +void RimGeoMechResultDefinition::updateUiFieldsFromActiveResult() |
| 553 | +{ |
544 | 554 | m_resultPositionTypeUiField = m_resultPositionType; |
545 | 555 | m_resultVariableUiField = composeFieldCompString( m_resultFieldName(), m_resultComponentName() ); |
546 | 556 | m_compactionRefLayerUiField = m_compactionRefLayer; |
|
0 commit comments