Skip to content

Commit

Permalink
move phetioValueType to MaterialProperty, #273
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kauzmann <[email protected]>
  • Loading branch information
zepumph committed Jul 24, 2024
1 parent 5c559fa commit b2146d7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
4 changes: 1 addition & 3 deletions js/buoyancy/model/applications/Bottle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,8 @@ export default class Bottle extends ApplicationsMass {
Material.MATERIAL_R,
Material.MATERIAL_S
], {
valueType: Material,
reentrant: true,
tandem: materialInsidePropertyTandem,
phetioValueType: ReferenceIO( IOType.ObjectIO )
tandem: materialInsidePropertyTandem
} );

this.materialInsideVolumeProperty = new NumberProperty( BOTTLE_INITIAL_INTERIOR_VOLUME, {
Expand Down
5 changes: 1 addition & 4 deletions js/buoyancy/model/shapes/BuoyancyShapesModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import isSettingPhetioStateProperty from '../../../../../tandem/js/isSettingPhet
import MassTag from '../../../common/model/MassTag.js';
import Duck from './Duck.js';
import BuoyancyShapeModel from './BuoyancyShapeModel.js';
import ReferenceIO from '../../../../../tandem/js/types/ReferenceIO.js';
import IOType from '../../../../../tandem/js/types/IOType.js';
import MaterialProperty from '../../../common/model/MaterialProperty.js';

export type BuoyancyShapesModelOptions = DensityBuoyancyModelOptions;
Expand Down Expand Up @@ -62,8 +60,7 @@ export default class BuoyancyShapesModel extends DensityBuoyancyModel {
// This hack is a way of saying, we do not create or support a custom material in this case.
Material.WOOD,
this.availableMaterials, {
tandem: objectsTandem.createTandem( 'materialProperty' ),
phetioValueType: ReferenceIO( IOType.ObjectIO )
tandem: objectsTandem.createTandem( 'materialProperty' )
} );

this.scale = new Scale( this.engine, this.gravityProperty, {
Expand Down
5 changes: 1 addition & 4 deletions js/common/model/Mass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,7 @@ export default abstract class Mass extends PhetioObject {
phetioType: Mass.MassIO,
inputEnabledPropertyOptions: {},
materialPropertyOptions: {
valueType: Material,
reentrant: true,
phetioValueType: ReferenceIO( IOType.ObjectIO ),
phetioFeatured: true
reentrant: true
},
customMaterialOptions: {},
volumePropertyOptions: {},
Expand Down
4 changes: 4 additions & 0 deletions js/common/model/MaterialProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import MappedWrappedProperty from './MappedWrappedProperty.js';
import { combineOptions, EmptySelfOptions } from '../../../../phet-core/js/optionize.js';
import PickRequired from '../../../../phet-core/js/types/PickRequired.js';
import { PhetioObjectOptions } from '../../../../tandem/js/PhetioObject.js';
import IOType from '../../../../tandem/js/types/IOType.js';
import ReferenceIO from '../../../../tandem/js/types/ReferenceIO.js';

type SelfOptions = EmptySelfOptions;

Expand All @@ -27,6 +29,8 @@ export default class MaterialProperty extends MappedWrappedProperty<Material> {
// Note the material could be the customMaterial
public constructor( material: Material, customMaterial: Material, availableMaterials: Material[], providedOptions: MaterialPropertyOptions ) {
super( material, customMaterial, availableMaterials, combineOptions<MaterialPropertyOptions>( {
valueType: Material,
phetioValueType: ReferenceIO( IOType.ObjectIO ),
phetioFeatured: true
}, providedOptions ) );
this.densityProperty = this.dynamicValueProperty;
Expand Down
2 changes: 0 additions & 2 deletions js/common/model/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export default class Pool extends Basin {
] : [];

this.fluidMaterialProperty = new MaterialProperty( Material.WATER, customFluidMaterial, availableMaterials, {
valueType: Material,
phetioValueType: ReferenceIO( IOType.ObjectIO ),
tandem: fluidMaterialPropertyTandem,
phetioDocumentation: 'The material of the fluid in the pool'
} );
Expand Down

0 comments on commit b2146d7

Please sign in to comment.