Skip to content

Check about change to MMitsubaElement #3

Description

@DavidBrainard

We had a problem where Mitsuba got unhappy because there was both a filename field and a value field in the place where spectral data go. I think this happened because some default got set up as a value and then we changed it by setting a filename.

To fix this, I added code to MMitsubaElement, line 76 ff, that checks to see if there is already a value or filename field, and removes this from the structure before adding a value or filename field back in. Doing this fixed our immediate problem, and in reading the code I don't see why it should break anything else, unless there are cases where one would want both fields. Since I don't know that such cases don't exist, I'm posting this question.

Here is the code (added code above the last two lines).

        % We don't want to end up with two fields in data, one a
        % value and one a filename -- we can have only one.  So, if
        % there already is something there, we clear it before
        % adding in below what we are supposed to be adding here.
        if isfield(property.data,'value')
            property.data = rmfield(property.data,'value');
        end
        if isfield(property.data,'filename')
            property.data = rmfield(property.data,'filename');
        end
        
        % Then do the adding in.
        property.setData(attributeName, value);
        property.type = type;

@benjamin-heasly If this edit seems OK, please so indicate and close. Otherwise let us know how we might better deal with this section. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions