Skip to content

non-PCH binding for CreateObjectArrayMetasoundLiteral is generated but can't compile. #92

@geekrelief

Description

@geekrelief

This is somewhat related to #91. In trying to bind MetasoundEngine to get access to CreateObjectArrayMetasoundLiteral the binding is generated, but the Nim generated C++ doesn't compile.

A workaround was to make a duplicate of the binding, createObjectArrayMetaSoundLiteral2 from the exported bindings and use that instead.

proc createObjectArrayMetaSoundLiteral2*(self : UMetaSoundBuilderSubsystemPtr;
                                        value : var TArray[UObjectPtr]): FMetasoundFrontendLiteral {.
    exportcpp: "$1_", ufunc.} =
  type
    Params  = object
      value: TArray[UObjectPtr]
      returnValue: FMetasoundFrontendLiteral
  var param  = Params(value: value)
  let fnName {.used.} = f "CreateObjectArrayMetaSoundLiteral"
  var cls  = uobject.getClass(ueCast[UObject](self))
  when false:
    cls = getClassByName("MetaSoundBuilderSubsystem").getSuperClass()
  let fn {.used.} = uobject.getFunctionByNameWithPrefixes(cls, fnName)
  self.processEvent(fn, param.addr)
  value = param.value
  return param.returnValue

However, when creating PCH bindings, by including "Runtime/Metasound" plugin in game.json's "enginePluginsByPath" and the appropriate header in nuegame.h and regenerating the bindings:

game.json:

{
  "extraModuleNames": ["MetasoundEngine", "MetasoundFrontend", "MetasoundEditor"],
  "enginePluginsByPath": ["Runtime/Metasound"]
}

nuegame.h:

  #include "MetasoundBuilderSubsystem.h" // for Engine\Plugins\Runtime\Metasound\Source\MetasoundEngine\Public\MetasoundBuilderSubsystem.h

the generated binding for createObjectArrayMetasoundLiteral now works. Maybe it has something to do with how FMetasoundFrontendLiteral? See: Engine\Plugins\Runtime\Metasound\Source\MetasoundFrontend\Public\MetasoundFrontendLiteral.h

proc createObjectArrayMetaSoundLiteral*(self : UMetaSoundBuilderSubsystemPtr;
                                        value : var TArray[UObjectPtr]): FMetasoundFrontendLiteral {.
    exportcpp: "$1_", ufunc.} =
  type
    Params  = object
      value: TArray[UObjectPtr]
      returnValue: FMetasoundFrontendLiteral
  var param  = Params(value: value)
  let fnName {.used.} = f "CreateObjectArrayMetaSoundLiteral"
  var cls  = uobject.getClass(ueCast[UObject](self))
  when false:
    cls = getClassByName("MetaSoundBuilderSubsystem").getSuperClass()
  let fn {.used.} = uobject.getFunctionByNameWithPrefixes(cls, fnName)
  self.processEvent(fn, param.addr)
  value = param.value
  return param.returnValue

Note UMetasoundFrontendLiteralBlueprintAccess also defines a static function of the same name here: Engine\Plugins\Runtime\Metasound\Source\MetasoundEngine\Public\MetasoundFrontendLiteralBlueprintAccess.h see #93.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions