Skip to content

Commit

Permalink
Merge pull request #75 from AIGODLIKE/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
KarryCharon authored Mar 29, 2024
2 parents ea44dfc + 0579133 commit 8a76c75
Show file tree
Hide file tree
Showing 26 changed files with 37 additions and 35 deletions.
Binary file removed External/SDN-1.0/lualib/libimage.dylib
Binary file not shown.
Binary file removed External/SDN-1.0/lupa/lua54.cpython-310-darwin.so
Binary file not shown.
File renamed without changes.
Binary file added External/SDN-1.1/lualib/libimage.dylib
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added External/SDN-1.1/lupa/lua54.cp311-win_amd64.pyd
Binary file not shown.
Binary file added External/SDN-1.1/lupa/lua54.cp312-win_amd64.pyd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added External/SDN-1.1/lupa/luajit.cp311-win_amd64.pyd
Binary file not shown.
Binary file added External/SDN-1.1/lupa/luajit.cp312-win_amd64.pyd
Binary file not shown.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion External/lupawrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import Enum
from pathlib import Path
from platform import system
__VERSION__ = "1.0"
__VERSION__ = "1.1"
SDN = f"SDN-{__VERSION__}"
RT_ROOT = Path(__file__).parent.joinpath(SDN)
if system() == "Windows":
Expand Down
15 changes: 15 additions & 0 deletions SDNode/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,21 @@ def pre_filter(s, nname, desc):
support_fmt.append("image/webp")
desc["input"]["required"]["format"] = [support_fmt]

def load_pre(s, self: NodeBase, data, with_id=True):
wv = data.get("widgets_values", {})
if isinstance(wv, list):
return data
frame_rate = wv.get("frame_rate", 8)
loop_count = wv.get("loop_count", 0)
filename_prefix = wv.get("filename_prefix", "AnimateDiff")
format = wv.get("format", "image/gif")
if format not in {"image/gif", "image/webp"}:
format = "image/gif"
pingpong = wv.get("pingpong", False)
save_output = wv.get("save_output", True)
data["widgets_values"] = [frame_rate, loop_count, filename_prefix, format, pingpong, save_output]
return data

def free(s, self: NodeBase):
if self.prev_name in s.PLAYERS:
player = s.PLAYERS.pop(self.prev_name)
Expand Down
2 changes: 1 addition & 1 deletion SDNode/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_port():


def get_url():
return TaskManager.server.get_url()
return TaskManager.server.get_url().replace("0.0.0.0", "localhost")


WITH_PROXY = False
Expand Down
51 changes: 19 additions & 32 deletions SDNode/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import inspect
import types
from hashlib import md5
from string import ascii_letters
from string import ascii_letters, digits
from bpy.app.translations import pgettext
from threading import Thread
from functools import partial
Expand Down Expand Up @@ -932,6 +932,7 @@ def gen_cat_id(idstr):
return f"NODE_MT_{idstr}"


registered_menus = {}
def reg_nodetree(identifier, cat_list, sub=False):
if not cat_list:
return
Expand All @@ -956,8 +957,16 @@ def draw_node_item(self, context):
"poll": cat.poll,
"draw": draw_node_item,
}
menu_type = type(gen_cat_id(cat.identifier), (bpy.types.Menu,), __data__)
class_name = gen_cat_id(cat.identifier)
registered_menu = registered_menus.pop(class_name, None)
if registered_menu and getattr(registered_menu, "is_registered"):
try:
bpy.utils.unregister_class(registered_menu)
except Exception:
pass
menu_type = type(class_name, (bpy.types.Menu,), __data__)
menu_types.append(menu_type)
registered_menus[class_name] = menu_type
bpy.utils.register_class(menu_type)
if sub:
return
Expand All @@ -976,12 +985,13 @@ def load_node(nodetree_desc, root="", proot=""):
node_cat = []
for cat, nodes in nodetree_desc.items():
ocat = cat
rep_chars = [" ", "-", "(", ")", "[", "]", "{", "}", ",", ".", ":", ";", "'", '"', "/", "\\", "|", "?", "*", "<", ">", "=", "+", "&", "^", "%", "$", "#", "@", "!", "`", "~"]
for c in rep_chars:
cat = cat.replace(c, "_")
rep_chars = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ """
chars = ascii_letters + digits
for i, c in enumerate(rep_chars):
cat = cat.replace(c, chars[i])
# 替换所有非ascii字符为X
cat = "".join([c if c in ascii_letters else "X" for c in cat])
if cat and cat[-1] not in ascii_letters:
cat = "".join([c if c in chars else "X" for c in cat])
if cat and cat[-1] not in chars:
cat = cat[:-1] + "z"
items = []
menus = []
Expand Down Expand Up @@ -1026,7 +1036,7 @@ def unregister():
reg, unreg = register_classes_factory(clss)


def reg_node_reroute():
def reg_class_internal():
from .nodes import NodeBase, SDNConfig
bpy.types.NodeSocketColor.slot_index = bpy.props.IntProperty(default=0)
bpy.types.NodeSocketColor.index = bpy.props.IntProperty(default=-1)
Expand All @@ -1046,30 +1056,7 @@ def reg_node_reroute():
inode.sdn_hide = bpy.props.BoolProperty(default=False)
inode.sdn_socket_visible_in = bpy.props.CollectionProperty(type=SDNConfig)
inode.sdn_socket_visible_out = bpy.props.CollectionProperty(type=SDNConfig)
# inode.is_dirty = NodeBase.is_dirty
# inode.set_dirty = NodeBase.set_dirty
# inode.is_group = NodeBase.is_group
# inode.get_tree = NodeBase.get_tree
# inode.load = NodeBase.load
# inode.dump = NodeBase.dump
# inode.update = NodeBase.update
# inode.serialize_pre = NodeBase.serialize_pre
# inode.serialize = NodeBase.serialize
# inode.post_fn = NodeBase.post_fn
# inode.pre_fn = NodeBase.pre_fn
# inode.apply_unique_id = NodeBase.apply_unique_id
# inode.unique_id = NodeBase.unique_id
# inode.calc_slot_index = NodeBase.calc_slot_index
# inode.is_base_type = NodeBase.is_base_type
inode.get_meta = NodeBase.get_meta
# inode.query_stats = NodeBase.query_stats
# inode.query_stat = NodeBase.query_stat
# inode.set_stat = NodeBase.set_stat
# inode.switch_socket_widget = NodeBase.switch_socket_widget
# inode.get_from_link = NodeBase.get_from_link
# inode.get_ctxt = NodeBase.get_ctxt
# inode.get_blueprints = NodeBase.get_blueprints
# inode.draw_socket = NodeBase.draw_socket

inode.class_type = inode.__name__
inode.__metadata__ = {}
Expand Down Expand Up @@ -1175,7 +1162,7 @@ def rtnode_reg_diff():

def rtnode_reg():
nodes_reg()
reg_node_reroute()
reg_class_internal()
clss.append(CFNodeTree)
t1 = time.time()
# nt_desc = {name: {items:[], menus:[nt_desc...]}}
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bl_info = {
'name': '无限圣杯-节点',
'author': '幻之境开发小组-会飞的键盘侠、只剩一瓶辣椒酱',
'version': (1, 4, 8),
'version': (1, 4, 9),
'blender': (3, 0, 0),
'location': '3DView->Panel',
'category': '辣椒出品',
Expand Down

0 comments on commit 8a76c75

Please sign in to comment.