RenderToolbox / RenderToolbox4

Matlab toolbox for managing 3D scenes and physically-based rendering.
MIT License
48 stars 7 forks source link

Light remove mapping requires additional parameters #16

Open hblasins opened 8 years ago

hblasins commented 8 years ago

In the mappings file I create an entry to remove a point source from the scene:

mappings{id}.name = 'PointLight';
mappings{id}.broadType = 'lights';
mappings{id}.specificType = 'point';
mappings{id}.operation = 'remove';
mappings{id}.desitnation = 'generic';

This entry causes an error:

mapping = 

       broadType: 'lights'
     destination: 'Generic'
           group: ''
           index: []
            name: 'PointLight'
       operation: 'remove'
      properties: []
    specificType: 'point'

Struct contents reference from a non-struct array object.

Error in rtbGetMappingProperty (line 26)
propertyNames = {mapping.properties.name};

Error in rtbApplyMPbrtGenericMappings>setSpectrumOrTexture (line 178)
[value, property] = rtbGetMappingProperty(mapping, getName, defaultValue);

Error in rtbApplyMPbrtGenericMappings (line 105)
                    setSpectrumOrTexture(element, mapping, ...

Error in RtbAssimpPBRTConverter/applyMappings (line 136)
            nativeScene = rtbApplyMPbrtGenericMappings(nativeScene, groupMappings);

Error in rtbMakeSceneFiles>makeSceneForCondition (line 170)
nativeScene = strategy.converter.applyMappings(scene, nativeScene, mappings, names, conditionValues, cc);

Error in rtbMakeSceneFiles (line 127)
        nativeScenes{cc} = makeSceneForCondition(strategy, ...

Error in CoralColors (line 236)
                nativeSceneFiles = rtbMakeSceneFiles(scene, 'hints', hints, ...

The issue can be avoided by adding something in the parameters field to make it non-empty, but conceptually we shouldn't need to do this, since we are removing the object anyway.

benjamin-heasly commented 8 years ago

This makes sense. I agree it's a bug. We should make it work with an empty properties field.

Thanks for posting the work-around.