Maya Render Setup errors out while re-importing the same json with merge option


#1

Hi,
I am extremely new to Maya programming and I am trying a tool around Render Setup but I am facing this issue (both in Maya 2016 Ext2 and 2017) while re-importing the same json with merge option.

Steps to reproduce:
In a scene s1.ma

  1. Create a render layer, say TEST

  2. Create a collection, say collection1

  3. Create an absolute override, say abs1 and add any attibute, say “visibility” of a shape node and turn it off.

  4. Create a collection, say collection2

  5. Create an absolute override, say abs2 and add any attibute, say “visibility” of a shape node.

  6. Export Selected (because below error traceback doesn’t come with Export and Import All) layer as “s1.json”

In a scene2 s2.ma

  1. Import s1.json

  2. Go back to s1.ma and turn on visibility on abs1.

  3. Re-export “s1.json”

  4. Re-import s1.json in s2.ma (no change whatsoever was made in s2.ma’s Render Setup).

  5. It errors out giving below traceback:

    Traceback (most recent call last):

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/undo.py”, line 62, in wrapper

    return f(*args, **kwargs)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/views/proxy/renderSetup.py”, line 1583, in importTemplate

    rs._decodeChildren(objList, renderSetupModel.DECODE_AND_MERGE, None)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/renderSetup.py”, line 538, in _decodeChildren

    mergeType, prependToName))

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/jsonTranslatorUtils.py”, line 131, in decodeObjectArray

    objInst.decode(d[nodeTypeName], policy._mergeType, policy._prependToName)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/serializableNode.py”, line 39, in decode

    self._decodeProperties(dict, mergeType, prependToName)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/renderLayer.py”, line 684, in _decodeProperties

    prependToName)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/renderLayer.py”, line 676, in _decodeChildren

    prependToName))

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/jsonTranslatorUtils.py”, line 131, in decodeObjectArray

    objInst.decode(d[nodeTypeName], policy._mergeType, policy._prependToName)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/serializableNode.py”, line 39, in decode

    self._decodeProperties(dict, mergeType, prependToName)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/collection.py”, line 513, in _decodeProperties

    prependToName)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/collection.py”, line 498, in _decodeChildren

    prependToName))

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/jsonTranslatorUtils.py”, line 131, in decodeObjectArray

    objInst.decode(d[nodeTypeName], policy._mergeType, policy._prependToName)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/serializableNode.py”, line 39, in decode

    self._decodeProperties(dict, mergeType, prependToName)

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/override.py”, line 513, in _decodeProperties

    plug.Plug.createAttribute(self.thisMObject(), AbsOverride.kAttrValueLong, AbsOverride.kAttrValueShort, dict[AbsOverride.kAttrValueLong])

    File “/homes/sharmah/maya/scripts/maya/app/renderSetup/model/plug.py”, line 620, in createAttribute

    nodeFn.addAttribute(attrObj)

    RuntimeError: (kInvalidParameter): Object is incompatible with this method

What I am assuming is “createAttribute” is failing because there is already an attribute on the same override level with a different value and it is trying to preserve it, but ideally it should not fail and try to only preserve anything which has been modified by the user but if nothing has been changed then it should be able to re-import.

And importing with overwrite option is wiping output even user created layers but it should only remove the data existing in the json file that is being imported.

Any help will be extremely appreciated. :slight_smile: