diff --git a/CHANGELOG.md b/CHANGELOG.md index c3bbae4e5..eac6f0e8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,9 +41,9 @@ - [usd#2047](https://github.com/Autodesk/arnold-usd/issues/2047) - Shaders exports should be bound to a material - [usd#2109](https://github.com/Autodesk/arnold-usd/issues/2109) - Expose hydra parameter in the procedural - [usd#2107](https://github.com/Autodesk/arnold-usd/issues/2107) - Support procedural updates in hydra mode +- [usd#2088](https://github.com/Autodesk/arnold-usd/issues/2088) - Remove deprecated schemas - [usd#2111](https://github.com/Autodesk/arnold-usd/issues/2111) - Add support for transform_keys in xform primitives - ### Bug fixes - [usd#1961](https://github.com/Autodesk/arnold-usd/issues/1961) - Random curves width in Hydra when radius primvars are authored - [usd#1977](https://github.com/Autodesk/arnold-usd/issues/1977) - Aov shaders not set properly in hydra mode of the scene format diff --git a/schemas/createSchemaFile.py b/schemas/createSchemaFile.py index 84d351192..e41169cbe 100755 --- a/schemas/createSchemaFile.py +++ b/schemas/createSchemaFile.py @@ -275,15 +275,6 @@ class ArnoldNodeGraph "ArnoldNodeGraph" ( } ) { } -class ArnoldOptions "ArnoldOptions" ( - inherits = [] - customData = { - dictionary extraPlugInfo = { - bool providesUsdShadeConnectableAPIBehavior = 1 - } - } -) { -} ''' ) @@ -301,6 +292,14 @@ def createArnoldClass(entryName, parentClass, paramList, nentry, parentParamList file.write('class "{}"(\n'.format(schemaName)) file.write(' inherits = []\n'.format(parentClass)) + + if isAPI == False and entryName == 'options': + file.write(' customData = {\n') + file.write(' dictionary extraPlugInfo = {\n') + file.write(' bool providesUsdShadeConnectableAPIBehavior = 1') + file.write(' }\n') + file.write(' }\n') + file.write(') {\n') for param in paramList: @@ -354,7 +353,8 @@ def createArnoldClass(entryName, parentClass, paramList, nentry, parentParamList typeParams = {} # dictionary (key=nodeEntryTypeName, value= list of parameters which exist in ALL the corresponding nodeEntryName) # Loop over node entries -nodeEntryIter = ai.AiUniverseGetNodeEntryIterator(ai.AI_NODE_ALL) + +nodeEntryIter = ai.AiUniverseGetNodeEntryIterator(ai.AI_NODE_ALL & ~ai.AI_NODE_SHADER & ~ai.AI_NODE_IMAGER & ~ai.AI_NODE_OPERATOR & ~ai.AI_NODE_OVERRIDE) while not ai.AiNodeEntryIteratorFinished(nodeEntryIter): nentry = ai.AiNodeEntryIteratorGetNext(nodeEntryIter); @@ -362,12 +362,6 @@ def createArnoldClass(entryName, parentClass, paramList, nentry, parentParamList entryName = str(ai.AiNodeEntryGetName(nentry)) # Type of this AtNodeEntry (light, shape, shader, operator, etc...) entryTypeName = str(ai.AiNodeEntryGetTypeName(nentry)) - - # we don't want to create schemas for shaders, as we're relying on UsdShade schemas - # Ignore material nodes for now. Also, "options" is being hardcoded above, so it - # doesn't need to be added here - if entryTypeName == 'shader' or entryTypeName == 'material' or entryTypeName == 'options': - continue # Get the list of parameters for this node entry paramsList = [] @@ -392,7 +386,8 @@ def createArnoldClass(entryName, parentClass, paramList, nentry, parentParamList if typeParams.get(entryTypeName) is None: # first time we find a node with this type, let's simply copy all parameters for this node entry - typeParams[entryTypeName] = paramsList + typeParams[entryTypeName] = [] if entryTypeName == 'options' else paramsList + else: # We want the final list to be the union between the existing list and paramsList # So first we copy the existing list for this type @@ -414,6 +409,7 @@ def createArnoldClass(entryName, parentClass, paramList, nentry, parentParamList ignoreLightAttributes = ['intensity', 'color', 'exposure', 'diffuse', 'specular', 'normalize', 'matrix'] ignoreCameraAttributes = ['matrix', 'shutter_start', 'shutter_end', 'near_clip', 'far_clip'] +# List the parameters that should be skipped in the schemas as they exist in the usd counterpart nativeUsdList = { 'shape': ignoreShapeAttributes, 'polymesh': ignoreShapeAttributes + ['nsides', 'vidxs', 'polygon_holes', 'nidxs', 'shader'], @@ -433,14 +429,18 @@ def createArnoldClass(entryName, parentClass, paramList, nentry, parentParamList 'camera' : ignoreCameraAttributes, 'persp_camera': ignoreCameraAttributes + ['focus_distance'], 'ortho_camera': ignoreCameraAttributes, + 'options': ['xres', 'yres', 'camera'], + 'color_manager': [] } ''' Now let's create a new class for each "type", let it inherit from a meaningful schema, and let's add its parameters based on the existing dictionary ''' for key, paramList in typeParams.items(): - if key == 'override': + + if key == 'options': continue + entryNames = entryByType[key] # list of entry names for this type if entryNames == None or len(entryNames) == 0: print('This script is not working...no entries found for type {}'.format(key)) @@ -451,46 +451,56 @@ def createArnoldClass(entryName, parentClass, paramList, nentry, parentParamList print('Hey I could not find any AtNodeEntry called {}'.format(entryName)) continue - # these "base" arnold classes are typed but can't be instantiated - typeDict = {'shape' : 'Gprim', - 'light' : 'Xformable', - 'camera' : 'Xformable'} - createArnoldClass(key, typeDict[key] if key in typeDict else 'Typed', paramList, nentry, None, False, False) - # For the API schemas of arnold common types, we want to remove the attributes from the USD builtin if key in nativeUsdList: createArnoldClass(key, 'APISchemaBase', paramList, nentry, nativeUsdList[key], True) +######## +# Now author all the API schemas for arnold node entries for entry in entryList: entryName = entry[0] entryTypeName = entry[1] parametersList = entry[2] nentry = ai.AiNodeEntryLookUp(entryName) - if nentry == None: - print('I could not find any AtNodeEntry called {}'.format(entryName)) - continue - - parentClass = 'Arnold{}'.format(makeCamelCase(entryTypeName)) - if entryName == 'options' or entryName == 'override': - continue # do we want to create schemas for the options ? - - createArnoldClass(entryName, parentClass, parametersList, nentry, typeParams[entryTypeName], False) if entryName in nativeUsdList: createArnoldClass(entryName, 'APISchemaBase', parametersList, nentry, nativeUsdList[entryName], True) +######## +# Finally, add the typed schemas +includedTypedSchemas = ['shape', 'options'] +excludedTypedEntry = ['polymesh', 'curves', 'points', 'list_aggregate'] +for entry in entryList: + entryName = entry[0] + entryTypeName = entry[1] + if entryTypeName in includedTypedSchemas: + + if entryName in excludedTypedEntry: + continue + + parametersList = entry[2] + nentry = ai.AiNodeEntryLookUp(entryName) + + parentClass = 'Imageable' if entryName == 'options' else 'Gprim' + createArnoldClass(entryName, parentClass, parametersList, nentry, None, False) # --- Special case for custom procedurals. We want a schema ArnoldProceduralCustom, # with a string attribute "node_type" returning the procedural node entry +proceduralCustomAttrs = typeParams['shape'] + ['override_nodes', 'namespace', 'operator'] +createArnoldClass('procedural_custom', 'Gprim', proceduralCustomAttrs, ai.AiNodeEntryLookUp('procedural'), ignoreShapeAttributes, False) +''' file.write('class ArnoldProceduralCustom "ArnoldProceduralCustom"(\n') -file.write(' inherits = []\n') +file.write(' inherits = []\n') file.write(') {\n') file.write(' bool override_nodes = false (customData = {string apiName = "OverrideNodes"})\n') file.write(' string arnold:namespace = "" (customData = {string apiName = "Namespace"})\n') file.write(' string arnold:operator = "" (customData = {string apiName = "Operator"})\n') + + file.write('}\n') file_module.write(' TF_WRAP(UsdArnoldProceduralCustom);\n') +''' #---- file_module.write('}\n') diff --git a/testsuite/test_0245/data/test.py b/testsuite/test_0245/data/test.py index 5ac8d5558..a941a8514 100644 --- a/testsuite/test_0245/data/test.py +++ b/testsuite/test_0245/data/test.py @@ -21,32 +21,48 @@ def find_in_file(expectedTypes, filename): def test_schemas(arnold_plugin): expectedSchemas = ['ArnoldAlembic', + 'ArnoldBox', + 'ArnoldBoxAPI', 'ArnoldCameraAPI', - 'ArnoldCamera', + 'ArnoldColorManagerAPI', 'ArnoldCone', - 'ArnoldCurves', + 'ArnoldConeAPI', 'ArnoldCurvesAPI', - 'ArnoldDriverExr', + 'ArnoldCylinder', + 'ArnoldCylinderAPI', + 'ArnoldDisk', + 'ArnoldDiskLightAPI', + 'ArnoldDistantLightAPI', 'ArnoldGinstance', - 'ArnoldImagerColorCorrect', - 'ArnoldImagerDenoiserOidn', + 'ArnoldImplicit', 'ArnoldInstancer', 'ArnoldLightAPI', - 'ArnoldMaterialx', + 'ArnoldMeshLightAPI', 'ArnoldNodeGraph', - 'ArnoldOrthoCamera', + 'ArnoldNurbs', + 'ArnoldOptions', + 'ArnoldOptionsAPI', + 'ArnoldOrthoCameraAPI', 'ArnoldPerspCameraAPI', + 'ArnoldPlane', 'ArnoldPointLightAPI', - 'ArnoldPoints', 'ArnoldPointsAPI', - 'ArnoldPolymesh', 'ArnoldPolymeshAPI', 'ArnoldProcedural', + 'ArnoldProceduralCustom', + 'ArnoldQuadLightAPI', + 'ArnoldShapeAPI', 'ArnoldSkydomeLightAPI', - 'ArnoldVrCamera'] + 'ArnoldSphere', + 'ArnoldSphereAPI', + 'ArnoldUsd', + 'ArnoldUsdLuxLightFilter', + 'ArnoldVolume', + 'ArnoldVolumeImplicit'] filename = os.path.join(arnold_plugin, 'usdArnold', 'resources', 'plugInfo.json') if not os.path.exists(filename): + print('schemas file not found {}'.format(filename)) return False if not find_in_file(expectedSchemas, filename): return False