Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

According to the error message, it seems that the bpy.ops.ptcache.bake() function only supports 1 or 2 arguments for the execution context. However, the code you shared does not explicitly show how many arguments are being passed. #131

Open
lxrchen opened this issue Jan 19, 2024 · 3 comments

Comments

@lxrchen
Copy link

lxrchen commented Jan 19, 2024

Python: Traceback (most recent call last):
File "C:\Users\23026\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\mmd_tools\operators\rigid_body.py", line 294, in execute
bpy.ops.ptcache.bake(override, "INVOKE_DEFAULT", bake=True)
File "E:\Blender\4.0\scripts\modules\bpy\ops.py", line 106, in call
C_exec, C_undo = _BPyOpsSubModOp._parse_args(args)
File "E:\Blender\4.0\scripts\modules\bpy\ops.py", line 60, in _parse_args
raise ValueError("1-2 args execution context is supported")
ValueError: 1-2 args execution context is supported

@Yusarina
Copy link

Yusarina commented Jan 21, 2024

Personally I would not be using MMD tools on Blender 4.0, as the developer as stated in other issues, there don't plan on releasing it unto the LTS for 4.2 comes out.

see this for more info, key word is it's under development.

There for this means the blender-v4 branch is not stable and may not be unto later this year.

@MostW
Copy link

MostW commented Mar 2, 2024

https://blender.stackexchange.com/questions/305388/valueerror-1-2-args-execution-context-is-supported-on-call-to-bpy-ops-outlin

https://docs.blender.org/api/current/bpy.ops.html#overriding-context

It was because bpy changes api, so I change the blender-v4 branch code and install mmd_tool again , and it works.

file path: mmd_tools\operators\rigid_body.py,

def execute(self, context: bpy.types.Context):
       override: Dict = context.copy()
       override.update({"scene": context.scene, "point_cache": context.scene.rigidbody_world.point_cache})
       
       # origin code 
       # bpy.ops.ptcache.bake(override, "INVOKE_DEFAULT", bake=True)
       
       #  new code
       with bpy.context.temp_override(**override):
           bpy.ops.ptcache.bake("INVOKE_DEFAULT", bake=True)
           
       return {"FINISHED"}

def execute(self, context: bpy.types.Context):
        override: Dict = context.copy()
        override.update({"scene": context.scene, "point_cache": context.scene.rigidbody_world.point_cache})

        # origin  code
        # bpy.ops.ptcache.free_bake(override, "INVOKE_DEFAULT")

        # new code
        with bpy.context.temp_override(**override):
            bpy.ops.ptcache.free_bake("INVOKE_DEFAULT")

        return {"FINISHED"}

@UuuNyaa
Copy link
Owner

UuuNyaa commented Apr 17, 2024

Please try MMD Tools v4.x and give us feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants