def arnoldToUsdParamString(paramEntry, scope): ret = '' paramName = ai.AiParamGetName(paramEntry) if paramName == 'name': return '' # nothing to return for attribute 'name' # Add the arnold scope to the attribute namespace, so that the token can be compiled if paramName == 'namespace' and len(scope) == 0: scope = 'arnold:' optionsStr = "customData = {string apiName = \"arnold_%s\"}" % paramName if len(paramName) == 1: paramName = paramName.lower() ''' // TODO: // AI_TYPE_POINTER // AI_TYPE_NODE // AI_TYPE_USHORT // AI_TYPE_HALF // AI_TYPE_UNDEFINED // AI_TYPE_NONE ''' paramType = ai.AiParamGetType(paramEntry) paramDefault = ai.AiParamGetDefault(paramEntry) paramVal = '' optionsStr = '' if paramType != ai.AI_TYPE_ARRAY: typeStr, valueStr, optionsValStr = getParameterStr(paramType, paramDefault, paramEntry) if typeStr is None or typeStr == '': return '' ret += typeStr paramVal = valueStr optionsStr += optionsValStr ret += ' {}{} = {} ({})'.format(scope, paramName, paramVal, optionsStr) else: # Array parameter arrayVal = paramDefault.contents.ARRAY if arrayVal is None or arrayVal[0] is None: return '' arrayVal = arrayVal[0] arrayType = ai.AiArrayGetType(arrayVal) typeStr, valueStr, optionsValStr = getParameterStr(arrayType) if typeStr is None or typeStr == '': return '' ret += '{}[] {}{}'.format(typeStr, scope, paramName) # FIXME do we need to set the API name ? # ret += ' (customData = {string apiName = "arnold{}"}\n'.format(GetCamelCase(paramName)) return ret
def arnoldToUsdParamString(paramEntry, scope): ret = '' paramName = ai.AiParamGetName(paramEntry) if paramName == 'name': return '' # nothing to return for attribute 'name' # Add the arnold scope to the attribute namespace, so that the token can be compiled if (paramName == 'namespace' or paramName == 'operator') and len(scope) == 0: scope = 'arnold:' if len(paramName) == 1: paramName = paramName.lower() ''' // TODO: // AI_TYPE_POINTER // AI_TYPE_USHORT // AI_TYPE_HALF // AI_TYPE_UNDEFINED // AI_TYPE_NONE ''' paramType = ai.AiParamGetType(paramEntry) paramDefault = ai.AiParamGetDefault(paramEntry) paramVal = '' optionsStr = 'customData = {string apiName = "' optionsStr += makeCamelCase(paramName) optionsStr += '"}' if paramType != ai.AI_TYPE_ARRAY: typeStr, valueStr, optionsValStr = getParameterStr( paramType, paramDefault, paramEntry) if typeStr is None or typeStr == '': return '' ret += typeStr paramVal = valueStr if len(optionsValStr) > 0: if len(optionsStr) > 0: optionsStr = '\n {}{}\n '.format( optionsStr, optionsValStr) else: optionsStr = optionsValStr ret += ' {}{} = {} ({})'.format(scope, paramName, paramVal, optionsStr) else: # Array parameter arrayVal = paramDefault.contents.ARRAY if arrayVal is None or arrayVal[0] is None: return '' arrayVal = arrayVal[0] arrayType = ai.AiArrayGetType(arrayVal) typeStr, valueStr, optionsValStr = getParameterStr(arrayType) if typeStr is None or typeStr == '': return '' if len(optionsValStr) > 0: if len(optionsStr) > 0: optionsStr = '\n {}{}\n '.format( optionsStr, optionsValStr) else: optionsStr = optionsValStr ret += '{}[] {}{} ({})'.format(typeStr, scope, paramName, optionsStr) return ret