Clean up dead code, fix type errors, and add publish workflow
Remove unused _append_ops_call_method, fix _property_data_from_member call signature, replace sys.version_info guard with hasattr check for __buffer__ protocol, fix implicit string concatenations, add msgbus overrides for 4.0-4.4, add conformance tests, and add publish script. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
from dataclasses import dataclass
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
from typing import cast
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def argparse_create():
|
||||
parser = argparse.ArgumentParser(
|
||||
prog=os.path.basename(sys.argv[0]) + " --command keyconfig_export",
|
||||
description="Write key-configuration to a file.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--output",
|
||||
dest="output",
|
||||
metavar="OUTPUT",
|
||||
type=str,
|
||||
help="The path to write the keymap to.",
|
||||
required=True,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-a",
|
||||
"--all",
|
||||
dest="all",
|
||||
action="store_true",
|
||||
help="Write all key-maps (not only customized key-maps).",
|
||||
required=False,
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
@dataclass
|
||||
class Arguments:
|
||||
output: str
|
||||
all: bool
|
||||
|
||||
|
||||
def keyconfig_export(argv: list[str]):
|
||||
parser = argparse_create()
|
||||
args = cast(Arguments, cast(object, parser.parse_args(argv)))
|
||||
|
||||
# Ensure the key configuration is loaded in background mode.
|
||||
bpy.utils.keyconfig_init()
|
||||
|
||||
bpy.ops.preferences.keyconfig_export(
|
||||
filepath=args.output,
|
||||
all=args.all,
|
||||
)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
cli_commands: list[object] = []
|
||||
|
||||
|
||||
def register():
|
||||
cli_commands.append(
|
||||
bpy.utils.register_cli_command("keyconfig_export", keyconfig_export)
|
||||
)
|
||||
|
||||
|
||||
def unregister():
|
||||
for cmd in cli_commands:
|
||||
bpy.utils.unregister_cli_command(cmd)
|
||||
cli_commands.clear()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
@@ -0,0 +1,75 @@
|
||||
from dataclasses import dataclass
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
from typing import cast
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def argparse_create():
|
||||
parser = argparse.ArgumentParser(
|
||||
prog=os.path.basename(sys.argv[0]) + " --command keyconfig_export",
|
||||
description="Write key-configuration to a file.",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-o",
|
||||
"--output",
|
||||
dest="output",
|
||||
metavar="OUTPUT",
|
||||
type=str,
|
||||
help="The path to write the keymap to.",
|
||||
required=True,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-a",
|
||||
"--all",
|
||||
dest="all",
|
||||
action="store_true",
|
||||
help="Write all key-maps (not only customized key-maps).",
|
||||
required=False,
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
@dataclass
|
||||
class Arguments:
|
||||
output: str
|
||||
all: bool
|
||||
|
||||
|
||||
def keyconfig_export(argv: list[str]):
|
||||
parser = argparse_create()
|
||||
args = cast(Arguments, cast(object, parser.parse_args(argv)))
|
||||
|
||||
# Ensure the key configuration is loaded in background mode.
|
||||
bpy.utils.keyconfig_init()
|
||||
|
||||
bpy.ops.preferences.keyconfig_export(
|
||||
filepath=args.output,
|
||||
all=args.all,
|
||||
)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
cli_commands: list[object] = []
|
||||
|
||||
|
||||
def register():
|
||||
cli_commands.append(
|
||||
bpy.utils.register_cli_command("keyconfig_export", keyconfig_export)
|
||||
)
|
||||
|
||||
|
||||
def unregister():
|
||||
for cmd in cli_commands:
|
||||
bpy.utils.unregister_cli_command(cmd)
|
||||
cli_commands.clear()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
@@ -14,14 +14,14 @@ shader_info.fragment_out(0, "VEC4", "FragColor")
|
||||
|
||||
shader_info.vertex_source(
|
||||
"void main()"
|
||||
"{"
|
||||
" pos = position;"
|
||||
" gl_Position = viewProjectionMatrix * vec4(position, 1.0f);"
|
||||
"}"
|
||||
+ "{"
|
||||
+ " pos = position;"
|
||||
+ " gl_Position = viewProjectionMatrix * vec4(position, 1.0f);"
|
||||
+ "}"
|
||||
)
|
||||
|
||||
shader_info.fragment_source(
|
||||
"void main()" "{" " FragColor = vec4(pos * brightness, 1.0);" "}"
|
||||
"void main()" + "{" + " FragColor = vec4(pos * brightness, 1.0);" + "}"
|
||||
)
|
||||
|
||||
shader = gpu.shader.create_from_info(shader_info)
|
||||
|
||||
Reference in New Issue
Block a user