MizunagiKB / gd_cubism

Unofficial Live2D Player for Godot Engine
https://mizunagikb.github.io/gd_cubism/
Other
143 stars 17 forks source link

Build Error (Problem Caused by API Change in SCons) #90

Closed Yunxi-awa closed 1 month ago

Yunxi-awa commented 2 months ago

Problem: To fix the error you need to replace "from SCons.Variables import *" with "from SCons.Variables.BoolVariable import BoolVariable" in all files in gd_cubism/godot-cpp/tools/

And in targets.py you also need to add "from SCons.Variables.EnumVariable import EnumVariable"

Here is the error info (It's just one of them):

E:\gd_cubism>scons platform=windows arch=x86_64 target=template_debug
scons: Reading SConscript files ...
NameError: name 'BoolVariable' is not defined:
  File "E:\gd_cubism\SConstruct", line 9:
    env = SConscript("godot-cpp/SConstruct")
  File "H:\Python\3.12.4\Lib\site-packages\SCons\Script\SConscript.py", line 684:
    return method(*args, **kw)
  File "H:\Python\3.12.4\Lib\site-packages\SCons\Script\SConscript.py", line 620:
    return _SConscript(self.fs, *files, **subst_kw)
  File "H:\Python\3.12.4\Lib\site-packages\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "E:\gd_cubism\godot-cpp\SConstruct", line 33:
    cpp_tool.options(opts, env)
  File "E:\gd_cubism\godot-cpp\tools\godotcpp.py", line 181:
    tool.options(opts)
  File "E:\gd_cubism\godot-cpp\tools\linux.py", line 6:
    opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler - only effective when targeting Linux", False))

Build enviroment: Visual Studio version: 2022 with C++ Python version: 3.12.4 SCons version: 4.8.0

There is also a problem that how high are the hardware requirements and is there any room for optimization of the given View.tscn?. Although it runs smoothly on my computer and mobile platforms, I'd like to know exactly how much performance it requires. This way I can quickly make optimization adjustments

MizunagiKB commented 2 months ago

@Yunxi-awa Thank you for reporting the issue during compilation. It appears that this problem is related to SCons version 4.8 or higher, rather than GDCubism.

Upon searching the Godot Engine issues, I found the following report. Does this match the situation you encountered? https://github.com/godotengine/godot/issues/94489

The godot-cpp folder is not managed by GDCubism and refers to https://github.com/godotengine/godot-cpp.

Therefore, it is advisable not to modify the code. At this time, I recommend using a version of SCons below 4.8 and waiting for a fix from the Godot Engine side.

Performance Requirements for GDCubism While GDCubism itself has some weight, the complexity of the Live2D model you wish to render also impacts performance. GDCubism focuses on reproducing the loaded Live2D model as seamlessly as possible. Therefore, it uses the Cubism Framework from Live2D Inc. without any proprietary systems. For rendering, it uses standard features (Node2D + SubViewport) to enhance compatibility.

The high load might be due to recreating Node2D and SubViewport every frame. Using RenderingServer could bypass these and potentially reduce processing load.

Alternatively, since each Live2D model is rendered to an independent SubViewport, parallelizing the process might reduce the load when rendering multiple Live2D models.

At present, we are not considering implementing such features or merging pull requests. However, if such implementations were to be made public, it would increase the options for those who wish to use Live2D with Godot Engine, which we believe would be a welcome development.

MizunagiKB commented 1 month ago

We have confirmed that with SCons 4.8, builds cannot be performed on both Windows and macOS. The documentation has been updated to specify the use of version 4.7 or below, and instructions on how to install a specific version have been added.