def execute(self, context):
scene=bpy.context.scene
plist=scene.panel_cathide_list
#clear panel list
for i in range(len(plist)-1,-1,-1):
plist.remove(i)
#declare category list
catlistreg1=[]
catlistreg2=[]
catlistunreg1=[]
catlistunreg2=[]
catlistunreg3=[]
#find category and append them in the list
for panel in bpy.types.Panel.__subclasses__():
if hasattr(panel, 'bl_space_type'):
if hasattr(panel, 'bl_region_type'):
if hasattr(panel, 'bl_category'):
if panel.bl_space_type=="VIEW_3D":
if panel.bl_region_type=="TOOLS":
if "bl_rna" not in panel.__dict__:
catlistunreg1.append(panel.bl_category)
elif "bl_rna" in panel.__dict__:
catlistreg1.append(panel.bl_category)
for c1 in list(set(catlistreg1)):
catlistreg2.append(c1)
for c1 in list(set(catlistunreg1)):
catlistunreg2.append(c1)
l1=Counter(catlistreg2)
l2=Counter(catlistunreg2)
diff=l2-l1
for c in list(diff.elements()):
catlistunreg3.append(c)
for c2 in catlistreg2:
newcat=plist.add()
newcat.name=c2
for c3 in catlistunreg3:
newcat=plist.add()
newcat.name=c3
newcat.panelstate=False
info = 'Panel List refreshed'
self.report({'INFO'}, info)
return {'FINISHED'}
# apply cathide configuration
CatHide_v1_1.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录