Show node panels only when applicable

This commit is contained in:
Moritz Brückner 2020-10-11 00:24:11 +02:00
parent d8a5e9edea
commit 8f7e99530c
2 changed files with 15 additions and 2 deletions

View file

@ -159,6 +159,10 @@ class ARM_PT_LogicNodePanel(bpy.types.Panel):
bl_region_type = 'UI'
bl_category = 'Node'
@classmethod
def poll(cls, context):
return context.space_data.tree_type == 'ArmLogicTreeType' and context.space_data.edit_tree
def draw(self, context):
layout = self.layout
layout.use_property_split = True
@ -222,7 +226,6 @@ class ArmOpenNodeWikiEntry(bpy.types.Operator):
return{'FINISHED'}
#Node Variables Panel
class ARM_PT_Variables(bpy.types.Panel):
bl_label = 'Armory Node Variables'
bl_idname = 'ARM_PT_Variables'
@ -230,6 +233,10 @@ class ARM_PT_Variables(bpy.types.Panel):
bl_region_type = 'UI'
bl_category = 'Node'
@classmethod
def poll(cls, context):
return context.space_data.tree_type == 'ArmLogicTreeType' and context.space_data.edit_tree
def draw(self, context):
layout = self.layout

View file

@ -1394,7 +1394,7 @@ class ARM_PT_BakePanel(bpy.types.Panel):
row = layout.row(align=True)
row.operator("tlm.remove_uv_selection")
row = layout.row(align=True)
class ArmGenLodButton(bpy.types.Operator):
'''Automatically generate LoD levels'''
@ -1767,6 +1767,12 @@ class ARM_PT_MaterialNodePanel(bpy.types.Panel):
bl_region_type = 'UI'
bl_category = 'Node'
@classmethod
def poll(cls, context):
return (context.space_data.tree_type == 'ShaderNodeTree'
and context.space_data.edit_tree
and context.space_data.shader_type == 'OBJECT')
def draw(self, context):
layout = self.layout
layout.use_property_split = True