add back create vertex group node

This commit is contained in:
BennyKok
2023-09-11 21:01:05 +08:00
parent 76baf4308a
commit dc5c64f84d
3 changed files with 31 additions and 19 deletions
+17 -18
View File
@@ -91,25 +91,24 @@ class EditOps(ObjectOps):
def map_args(bpy, func):
print(func, type(func))
# print(func, type(func))
if str(type(func)) == "<class 'bpy_func'>":
func = func.__init__
print(func)
print(dir(func))
# bpy.context.object.vertex_groups.new
# if str(type(func)) == "<class 'bpy_func'>":
# func = func.__init__
# print(func)
# print(dir(func))
if callable(func):
sig = inspect.signature(func)
print(sig)
args_dict = {
name: param.default
for name, param in sig.parameters.items()
if param.default is not inspect.Parameter.empty
}
print(args_dict)
return args_dict
# if callable(func):
# sig = inspect.signature(func)
# print(sig)
# args_dict = {
# name: param.default
# for name, param in sig.parameters.items()
# if param.default is not inspect.Parameter.empty
# }
# print(args_dict)
# return args_dict
# if isinstance(func, bpy.types.Function):
# print('is class')
@@ -179,7 +178,7 @@ def print_blender_functions(path):
def create_ops_class(cls, path, name=None):
node_name = snake_to_camel(
name if name is not None else path.split('.')[-1])
print(node_name)
# print(node_name)
return type(
node_name, (cls, object),
{
+1 -1
View File
@@ -52,5 +52,5 @@ NODE_CLASS_MAPPINGS = {
}
NODE_DISPLAY_NAME_MAPPINGS = {
"CreateVertexGroup": "Vertex Group"
"CreateVertexGroup": "Vertex Group (Old)"
}
+13
View File
@@ -0,0 +1,13 @@
import blender_node
class CreateVertexGroup(blender_node.EditOps):
EXTRA_INPUT_TYPES = {
"name": ("STRING", {
"multiline": False,
"default": "Group"
}),
}
def blender_process(self, bpy, BPY_OBJ, name, **props):
bpy.context.object.vertex_groups.new(name=name)