forked from bartvdbraak/blender
bugfix [#23182] Using self.report() inside poll() gives crash
poll() function is now a static method in python, this is more correct, matching C where the operator is not created to run poll. def poll(self, context): ... is now... @staticmethod def poll(context): ... Pythons way of doing static methods is a bit odd but cant be helped :| This does make subclassing poll functions with COMPAT_ENGINES break, so had to modify quite a few scripts for this.
This commit is contained in:
parent
5d18274cac
commit
163f6055d2
@ -1135,7 +1135,8 @@ class Export3DS(bpy.types.Operator):
|
||||
wm.add_fileselect(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
def poll(self, context): # Poll isnt working yet
|
||||
@staticmethod
|
||||
def poll(context): # Poll isnt working yet
|
||||
return context.active_object != None
|
||||
|
||||
# Add to a menu
|
||||
|
@ -3361,7 +3361,8 @@ class ExportFBX(bpy.types.Operator):
|
||||
BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
|
||||
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.active_object
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -165,7 +165,8 @@ class ExportMDD(bpy.types.Operator):
|
||||
frame_start = IntProperty(name="Start Frame", description="Start frame for baking", min=minframe, max=maxframe, default=1)
|
||||
frame_end = IntProperty(name="End Frame", description="End frame for baking", min=minframe, max=maxframe, default=250)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'MESH')
|
||||
|
||||
|
@ -275,7 +275,8 @@ class ExportPLY(bpy.types.Operator):
|
||||
use_uvs = BoolProperty(name="UVs", description="Exort the active UV layer", default=True)
|
||||
use_colors = BoolProperty(name="Vertex Colors", description="Exort the active vertex color layer", default=True)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -120,7 +120,8 @@ class importMDD(bpy.types.Operator):
|
||||
#fps = IntProperty(name="Frames Per Second", description="Number of frames/second", min=minfps, max=maxfps, default=25)
|
||||
frame_start = IntProperty(name="Start Frame", description="Start frame for inserting animation", min=minframe, max=maxframe, default=0)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'MESH')
|
||||
|
||||
|
@ -31,7 +31,8 @@ class RENDER_OT_netslave_bake(bpy.types.Operator):
|
||||
bl_idname = "render.netslavebake"
|
||||
bl_label = "Bake all in file"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -88,7 +89,8 @@ class RENDER_OT_netclientanim(bpy.types.Operator):
|
||||
bl_idname = "render.netclientanim"
|
||||
bl_label = "Animation on network"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -114,7 +116,8 @@ class RENDER_OT_netclientrun(bpy.types.Operator):
|
||||
bl_idname = "render.netclientstart"
|
||||
bl_label = "Start Service"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -130,7 +133,8 @@ class RENDER_OT_netclientsend(bpy.types.Operator):
|
||||
bl_idname = "render.netclientsend"
|
||||
bl_label = "Send job"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -159,7 +163,8 @@ class RENDER_OT_netclientsendframe(bpy.types.Operator):
|
||||
bl_idname = "render.netclientsendframe"
|
||||
bl_label = "Send current frame job"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -188,7 +193,8 @@ class RENDER_OT_netclientstatus(bpy.types.Operator):
|
||||
bl_idname = "render.netclientstatus"
|
||||
bl_label = "Client Status"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -227,7 +233,8 @@ class RENDER_OT_netclientblacklistslave(bpy.types.Operator):
|
||||
bl_idname = "render.netclientblacklistslave"
|
||||
bl_label = "Client Blacklist Slave"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -256,7 +263,8 @@ class RENDER_OT_netclientwhitelistslave(bpy.types.Operator):
|
||||
bl_idname = "render.netclientwhitelistslave"
|
||||
bl_label = "Client Whitelist Slave"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -286,7 +294,8 @@ class RENDER_OT_netclientslaves(bpy.types.Operator):
|
||||
bl_idname = "render.netclientslaves"
|
||||
bl_label = "Client Slaves"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -330,7 +339,8 @@ class RENDER_OT_netclientcancel(bpy.types.Operator):
|
||||
bl_idname = "render.netclientcancel"
|
||||
bl_label = "Client Cancel"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
netsettings = context.scene.network_render
|
||||
return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
|
||||
|
||||
@ -358,7 +368,8 @@ class RENDER_OT_netclientcancelall(bpy.types.Operator):
|
||||
bl_idname = "render.netclientcancelall"
|
||||
bl_label = "Client Cancel All"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -384,7 +395,8 @@ class netclientdownload(bpy.types.Operator):
|
||||
bl_idname = "render.netclientdownload"
|
||||
bl_label = "Client Download"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
netsettings = context.scene.network_render
|
||||
return netsettings.active_job_index >= 0 and len(netsettings.jobs) > 0
|
||||
|
||||
@ -428,7 +440,8 @@ class netclientscan(bpy.types.Operator):
|
||||
bl_idname = "render.netclientscan"
|
||||
bl_label = "Client Scan"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
@ -450,7 +463,8 @@ class netclientweb(bpy.types.Operator):
|
||||
bl_idname = "render.netclientweb"
|
||||
bl_label = "Open Master Monitor"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
netsettings = context.scene.network_render
|
||||
return netsettings.server_address != "[default]"
|
||||
|
||||
|
@ -82,15 +82,17 @@ class RenderButtonsPanel():
|
||||
bl_context = "render"
|
||||
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
|
||||
|
||||
def poll(self, context):
|
||||
rd = context.scene.render
|
||||
return (rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES)
|
||||
|
||||
# Setting panel, use in the scene for now.
|
||||
class RENDER_PT_network_settings(bpy.types.Panel, RenderButtonsPanel):
|
||||
bl_label = "Network Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (rd.use_game_engine==False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -125,10 +127,13 @@ class RENDER_PT_network_slave_settings(bpy.types.Panel, RenderButtonsPanel):
|
||||
bl_label = "Slave Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
return (super().poll(context)
|
||||
and scene.network_render.mode == "RENDER_SLAVE")
|
||||
### return (super().poll(context)
|
||||
### and scene.network_render.mode == "RENDER_SLAVE")
|
||||
### FIXME ^^^
|
||||
return scene.network_render.mode == "RENDER_SLAVE"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -150,10 +155,13 @@ class RENDER_PT_network_master_settings(bpy.types.Panel, RenderButtonsPanel):
|
||||
bl_label = "Master Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
return (super().poll(context)
|
||||
and scene.network_render.mode == "RENDER_MASTER")
|
||||
### return (super().poll(context)
|
||||
### and scene.network_render.mode == "RENDER_MASTER")
|
||||
### ^^^ FIXME
|
||||
return scene.network_render.mode == "RENDER_MASTER"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -168,10 +176,13 @@ class RENDER_PT_network_job(bpy.types.Panel, RenderButtonsPanel):
|
||||
bl_label = "Job Settings"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
return (super().poll(context)
|
||||
and scene.network_render.mode == "RENDER_CLIENT")
|
||||
### return (super().poll(context)
|
||||
### and scene.network_render.mode == "RENDER_CLIENT")
|
||||
### ^^^ FIXME
|
||||
return scene.network_render.mode == "RENDER_CLIENT"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -208,14 +219,17 @@ class RENDER_PT_network_slaves(bpy.types.Panel, RenderButtonsPanel):
|
||||
bl_label = "Slaves Status"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
netsettings = scene.network_render
|
||||
if netsettings.mode != "RENDER_CLIENT":
|
||||
return False
|
||||
verify_address(netsettings)
|
||||
return (super().poll(context)
|
||||
and netsettings.server_address != "[default]")
|
||||
### return (super().poll(context)
|
||||
### and netsettings.server_address != "[default]")
|
||||
### ^^^ FIXME
|
||||
return netsettings.server_address != "[default]"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -246,14 +260,16 @@ class RENDER_PT_network_slaves_blacklist(bpy.types.Panel, RenderButtonsPanel):
|
||||
bl_label = "Slaves Blacklist"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
netsettings = scene.network_render
|
||||
if netsettings.mode != "RENDER_CLIENT":
|
||||
return False
|
||||
verify_address(netsettings)
|
||||
return (super().poll(context)
|
||||
and netsettings.server_address != "[default]")
|
||||
### return (super().poll(context)
|
||||
### and netsettings.server_address != "[default]")
|
||||
return netsettings.server_address != "[default]"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -283,14 +299,17 @@ class RENDER_PT_network_jobs(bpy.types.Panel, RenderButtonsPanel):
|
||||
bl_label = "Jobs"
|
||||
COMPAT_ENGINES = {'NET_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
netsettings = scene.network_render
|
||||
if netsettings.mode != "RENDER_CLIENT":
|
||||
return False
|
||||
verify_address(netsettings)
|
||||
return (super().poll(context)
|
||||
and netsettings.server_address != "[default]")
|
||||
### return (super().poll(context)
|
||||
### and netsettings.server_address != "[default]")
|
||||
### ^^^ FIXME
|
||||
return netsettings.server_address != "[default]"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -48,7 +48,8 @@ class DiscontFilterOp(bpy.types.Operator):
|
||||
bl_idname = "graph.euler_filter"
|
||||
bl_label = "Filter out discontinuities in the active fcurves"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -28,7 +28,8 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
|
||||
bl_label = "Select Interior Faces"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'MESH')
|
||||
|
||||
@ -69,7 +70,8 @@ class MeshMirrorUV(bpy.types.Operator):
|
||||
bl_label = "Copy Mirrored UV coords"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.active_object
|
||||
return (ob and ob.type == 'MESH')
|
||||
|
||||
|
@ -80,7 +80,8 @@ class SelectCamera(bpy.types.Operator):
|
||||
bl_label = "Select Camera"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.scene.camera is not None
|
||||
|
||||
def execute(self, context):
|
||||
@ -109,7 +110,8 @@ class SelectHierarchy(bpy.types.Operator):
|
||||
|
||||
extend = BoolProperty(name="Extend", description="Extend the existing selection", default=False)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.object
|
||||
|
||||
def execute(self, context):
|
||||
@ -167,7 +169,8 @@ class SubdivisionSet(bpy.types.Operator):
|
||||
|
||||
relative = BoolProperty(name="Relative", description="Apply the subsurf level as an offset relative to the current level", default=False)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
obs = context.selected_editable_objects
|
||||
return (obs is not None)
|
||||
|
||||
@ -379,7 +382,8 @@ class ShapeTransfer(bpy.types.Operator):
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.mode != 'EDIT')
|
||||
|
||||
@ -409,7 +413,8 @@ class JoinUVs(bpy.types.Operator):
|
||||
bl_idname = "object.join_uvs"
|
||||
bl_label = "Join as UVs"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH')
|
||||
|
||||
@ -467,7 +472,8 @@ class MakeDupliFace(bpy.types.Operator):
|
||||
bl_idname = "object.make_dupli_face"
|
||||
bl_label = "Make DupliFace"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH')
|
||||
|
||||
|
@ -263,7 +263,8 @@ class AlignObjects(bpy.types.Operator):
|
||||
align_z = BoolProperty(name="Align Z",
|
||||
description="Align in the Z axis", default=False)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.mode == 'OBJECT'
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -30,7 +30,8 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
|
||||
bl_label = "Crossfade sounds"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
|
||||
return context.scene.sequence_editor.active_strip.type == 'SOUND'
|
||||
else:
|
||||
@ -83,7 +84,8 @@ class SequencerCutMulticam(bpy.types.Operator):
|
||||
camera = IntProperty(name="Camera",
|
||||
default=1, min=1, max=32, soft_min=1, soft_max=32)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
|
||||
return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
|
||||
else:
|
||||
@ -117,7 +119,8 @@ class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
|
||||
bl_label = "Deinterlace Movies"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if context.scene and context.scene.sequence_editor:
|
||||
return True
|
||||
else:
|
||||
|
@ -39,7 +39,8 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
description="File format to export the UV layout to",
|
||||
default='SVG')
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH')
|
||||
|
||||
|
@ -249,7 +249,8 @@ class FollowActiveQuads(bpy.types.Operator):
|
||||
description="Method to space UV edge loops",
|
||||
default="LENGTH")
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
obj = context.active_object
|
||||
return (obj is not None and obj.type == 'MESH')
|
||||
|
||||
|
@ -1124,7 +1124,8 @@ class SmartProject(bpy.types.Operator):
|
||||
description="Margin to reduce bleed from adjacent islands.",
|
||||
default=0.0, min=0.0, max=1.0)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -23,7 +23,8 @@ class ExportSomeData(bpy.types.Operator):
|
||||
description="Choose between two items",
|
||||
default='OPT_A')
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -9,7 +9,8 @@ class SimpleOperator(bpy.types.Operator):
|
||||
bl_idname = "object.simple_operator"
|
||||
bl_label = "Simple Object Operator"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.active_object != None
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -30,7 +30,8 @@ class UvOperator(bpy.types.Operator):
|
||||
bl_idname = "uv.simple_operator"
|
||||
bl_label = "Simple UV Operator"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
obj = context.active_object
|
||||
return (obj and obj.type == 'MESH')
|
||||
|
||||
|
@ -28,7 +28,8 @@ class DataButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.armature
|
||||
|
||||
|
||||
@ -127,7 +128,8 @@ class DATA_PT_display(DataButtonsPanel, bpy.types.Panel):
|
||||
class DATA_PT_bone_groups(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Bone Groups"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
|
||||
|
||||
def draw(self, context):
|
||||
@ -211,7 +213,8 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "iTaSC parameters"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.object
|
||||
return (ob and ob.pose)
|
||||
|
||||
@ -267,7 +270,8 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
|
||||
#bl_label = "Bones Motion Paths"
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
# XXX: include posemode check?
|
||||
return (context.object) and (context.armature)
|
||||
|
||||
@ -295,7 +299,8 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inhe
|
||||
#bl_label = "Bones Onion Skinning"
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
# XXX: include posemode check?
|
||||
return (context.object) and (context.armature)
|
||||
|
||||
|
@ -44,7 +44,8 @@ class DATA_PT_template(bpy.types.Panel):
|
||||
|
||||
templates = []
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if not context.armature:
|
||||
return False
|
||||
obj = context.object
|
||||
@ -262,7 +263,8 @@ class ActiveAssign(bpy.types.Operator):
|
||||
bl_idname = "pose.metarig_assign"
|
||||
bl_label = "Assign to the active posebone"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
bone = context.active_pose_bone
|
||||
return bool(bone and bone.id_data.mode == 'POSE')
|
||||
|
||||
@ -280,7 +282,8 @@ class ActiveClear(bpy.types.Operator):
|
||||
bl_idname = "pose.metarig_clear"
|
||||
bl_label = "Metarig Clear Type"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
bone = context.active_pose_bone
|
||||
return bool(bone and bone.id_data.mode == 'POSE')
|
||||
|
||||
|
@ -28,7 +28,8 @@ class BoneButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "bone"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.bone or context.edit_bone)
|
||||
|
||||
|
||||
@ -132,7 +133,8 @@ class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Transform Locks"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.bone
|
||||
|
||||
def draw(self, context):
|
||||
@ -209,7 +211,8 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
|
||||
class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Display"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.bone
|
||||
|
||||
def draw(self, context):
|
||||
@ -246,7 +249,8 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Inverse Kinematics"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.active_pose_bone
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -28,16 +28,17 @@ class DataButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
engine = context.scene.render.engine
|
||||
return context.camera and (engine in self.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class DATA_PT_context_camera(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = ""
|
||||
bl_show_header = False
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.camera and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -65,11 +66,21 @@ class DATA_PT_custom_props_camera(DataButtonsPanel, PropertyPanel, bpy.types.Pan
|
||||
_context_path = "object.data"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.camera and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Lens"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.camera and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -131,6 +142,11 @@ class DATA_PT_camera_display(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Display"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.camera and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -28,21 +28,24 @@ class DataButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object and context.object.type in ('CURVE', 'SURFACE', 'TEXT') and context.curve)
|
||||
|
||||
|
||||
class DataButtonsPanelCurve(DataButtonsPanel):
|
||||
'''Same as above but for curves only'''
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object and context.object.type == 'CURVE' and context.curve)
|
||||
|
||||
|
||||
class DataButtonsPanelActive(DataButtonsPanel):
|
||||
'''Same as above but for curves only'''
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
curve = context.curve
|
||||
return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
|
||||
|
||||
@ -133,7 +136,8 @@ class DATA_PT_shape_curve(DataButtonsPanel, bpy.types.Panel):
|
||||
class DATA_PT_geometry_curve(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Geometry"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
obj = context.object
|
||||
if obj and obj.type == 'SURFACE':
|
||||
return False
|
||||
@ -270,7 +274,8 @@ class DATA_PT_active_spline(DataButtonsPanelActive, bpy.types.Panel):
|
||||
class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Font"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object and context.object.type == 'TEXT' and context.curve)
|
||||
|
||||
def draw(self, context):
|
||||
@ -332,7 +337,8 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
|
||||
class DATA_PT_paragraph(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Paragraph"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object and context.object.type == 'TEXT' and context.curve)
|
||||
|
||||
def draw(self, context):
|
||||
@ -365,7 +371,8 @@ class DATA_PT_paragraph(DataButtonsPanel, bpy.types.Panel):
|
||||
class DATA_PT_textboxes(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Text Boxes"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object and context.object.type == 'TEXT' and context.curve)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -27,7 +27,8 @@ class DataButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object and context.object.type == 'EMPTY')
|
||||
|
||||
|
||||
|
@ -36,14 +36,16 @@ class DataButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
engine = context.scene.render.engine
|
||||
return context.lamp and (engine in self.COMPAT_ENGINES)
|
||||
|
||||
class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Preview"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.lamp and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
self.layout.template_preview(context.lamp)
|
||||
|
||||
@ -52,6 +54,11 @@ class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_show_header = False
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.lamp and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -79,11 +86,21 @@ class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel
|
||||
_context_path = "object.data"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.lamp and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Lamp"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.lamp and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -131,10 +148,11 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Sky & Atmosphere"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
lamp = context.lamp
|
||||
engine = context.scene.render.engine
|
||||
return (lamp and lamp.type == 'SUN') and (engine in self.COMPAT_ENGINES)
|
||||
return (lamp and lamp.type == 'SUN') and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -204,10 +222,11 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Shadow"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
lamp = context.lamp
|
||||
engine = context.scene.render.engine
|
||||
return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in self.COMPAT_ENGINES)
|
||||
return (lamp and lamp.type in ('POINT', 'SUN', 'SPOT', 'AREA')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -329,10 +348,11 @@ class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Area Shape"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
lamp = context.lamp
|
||||
engine = context.scene.render.engine
|
||||
return (lamp and lamp.type == 'AREA') and (engine in self.COMPAT_ENGINES)
|
||||
return (lamp and lamp.type == 'AREA') and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -356,10 +376,11 @@ class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Spot Shape"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
lamp = context.lamp
|
||||
engine = context.scene.render.engine
|
||||
return (lamp and lamp.type == 'SPOT') and (engine in self.COMPAT_ENGINES)
|
||||
return (lamp and lamp.type == 'SPOT') and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -393,11 +414,12 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
lamp = context.lamp
|
||||
engine = context.scene.render.engine
|
||||
|
||||
return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in self.COMPAT_ENGINES)
|
||||
return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
lamp = context.lamp
|
||||
|
@ -28,7 +28,8 @@ class DataButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.lattice
|
||||
|
||||
|
||||
|
@ -54,16 +54,17 @@ class DataButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
engine = context.scene.render.engine
|
||||
return context.mesh and (engine in self.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class DATA_PT_context_mesh(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = ""
|
||||
bl_show_header = False
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.mesh and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -91,11 +92,21 @@ class DATA_PT_custom_props_mesh(DataButtonsPanel, PropertyPanel, bpy.types.Panel
|
||||
_context_path = "object.data"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.mesh and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class DATA_PT_normals(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Normals"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.mesh and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -121,6 +132,11 @@ class DATA_PT_settings(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Settings"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.mesh and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -133,9 +149,11 @@ class DATA_PT_vertex_groups(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Vertex Groups"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return (context.object and context.object.type in ('MESH', 'LATTICE') and (engine in self.COMPAT_ENGINES))
|
||||
obj = context.object
|
||||
return (obj and obj.type in ('MESH', 'LATTICE') and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -180,9 +198,11 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Shape Keys"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return (context.object and context.object.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in self.COMPAT_ENGINES))
|
||||
obj = context.object
|
||||
return (obj and obj.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE') and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -278,6 +298,11 @@ class DATA_PT_uv_texture(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "UV Texture"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.mesh and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -301,7 +326,8 @@ class DATA_PT_texface(DataButtonsPanel):
|
||||
bl_label = "Texture Face"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.active_object
|
||||
rd = context.scene.render
|
||||
|
||||
@ -348,6 +374,11 @@ class DATA_PT_vertex_colors(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Vertex Colors"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return context.mesh and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -28,7 +28,8 @@ class DataButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "data"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.meta_ball
|
||||
|
||||
|
||||
@ -95,7 +96,8 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
|
||||
class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Active Element"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.meta_ball and context.meta_ball.active_element)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -27,16 +27,17 @@ class PhysicsButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "physics"
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.active_object
|
||||
rd = context.scene.render
|
||||
return ob and ob.game and (rd.engine in self.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Physics"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.active_object
|
||||
rd = context.scene.render
|
||||
return ob and ob.game and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -166,10 +167,11 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Collision Bounds"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
game = context.object.game
|
||||
rd = context.scene.render
|
||||
return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in self.COMPAT_ENGINES)
|
||||
return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
game = context.active_object.game
|
||||
@ -203,15 +205,16 @@ class RenderButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "render"
|
||||
|
||||
def poll(self, context):
|
||||
rd = context.scene.render
|
||||
return (rd.engine in self.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Game"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -224,6 +227,11 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Standalone Player"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -262,6 +270,11 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Stereo"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -322,6 +335,11 @@ class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Shading"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -351,6 +369,11 @@ class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Performance"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -377,6 +400,11 @@ class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Sound"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -396,17 +424,14 @@ class WorldButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "world"
|
||||
|
||||
def poll(self, context):
|
||||
scene = context.scene
|
||||
return (scene.render.engine in self.COMPAT_ENGINES) and (scene.world is not None)
|
||||
|
||||
|
||||
class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
|
||||
bl_label = ""
|
||||
bl_show_header = False
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene) and (rd.use_game_engine)
|
||||
|
||||
@ -435,6 +460,11 @@ class WORLD_PT_game_world(WorldButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "World"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
return (scene.world and scene.render.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -455,6 +485,11 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Mist"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
return (scene.world and scene.render.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
world = context.world
|
||||
|
||||
@ -481,6 +516,11 @@ class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Physics"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.scene
|
||||
return (scene.world and scene.render.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -60,11 +60,6 @@ class MaterialButtonsPanel():
|
||||
bl_context = "material"
|
||||
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
|
||||
|
||||
def poll(self, context):
|
||||
mat = context.material
|
||||
engine = context.scene.render.engine
|
||||
return mat and (engine in self.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Preview"
|
||||
@ -79,12 +74,13 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_show_header = False
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
# An exception, dont call the parent poll func because
|
||||
# this manages materials for all engine types
|
||||
|
||||
engine = context.scene.render.engine
|
||||
return (context.material or context.object) and (engine in self.COMPAT_ENGINES)
|
||||
return (context.material or context.object) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -145,15 +141,20 @@ class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Pa
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
_context_path = "material"
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.material and (context.scene.render.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Shading"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -189,10 +190,11 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = context.material
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -237,6 +239,10 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Physics"
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.material and (context.scene.render.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -261,10 +267,11 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Options"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -307,10 +314,11 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -343,10 +351,11 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Diffuse"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -414,10 +423,11 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Specular"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -484,10 +494,11 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
mat = active_node_mat(context.material)
|
||||
@ -536,10 +547,11 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
raym = active_node_mat(context.material).raytrace_mirror
|
||||
@ -596,10 +608,11 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
mat = active_node_mat(context.material)
|
||||
@ -663,10 +676,11 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = active_node_mat(context.material)
|
||||
engine = context.scene.render.engine
|
||||
return mat and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
mat = active_node_mat(context.material)
|
||||
@ -697,10 +711,11 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Halo"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = context.material
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type == 'HALO') and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -747,10 +762,11 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Flare"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = context.material
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type == 'HALO') and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
halo = context.material.halo
|
||||
@ -782,11 +798,13 @@ class VolumeButtonsPanel():
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "material"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
mat = context.material
|
||||
engine = context.scene.render.engine
|
||||
return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES)
|
||||
return mat and (mat.type == 'VOLUME') and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
|
||||
|
@ -308,7 +308,8 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
|
||||
#bl_label = "Object Motion Paths"
|
||||
bl_context = "object"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object)
|
||||
|
||||
def draw(self, context):
|
||||
@ -335,7 +336,8 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # in
|
||||
#bl_label = "Object Onion Skinning"
|
||||
bl_context = "object"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -753,7 +753,8 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Object Constraints"
|
||||
bl_context = "constraint"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.object)
|
||||
|
||||
def draw(self, context):
|
||||
@ -771,7 +772,8 @@ class BONE_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Bone Constraints"
|
||||
bl_context = "bone_constraint"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.pose_bone)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -32,14 +32,14 @@ def particle_panel_enabled(context, psys):
|
||||
return (psys.point_cache.baked is False) and (not psys.edited) and (not context.particle_system_editable)
|
||||
|
||||
|
||||
def particle_panel_poll(panel, context):
|
||||
def particle_panel_poll(cls, context):
|
||||
psys = context.particle_system
|
||||
engine = context.scene.render.engine
|
||||
if psys is None:
|
||||
return False
|
||||
if psys.settings is None:
|
||||
return False
|
||||
return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in panel.COMPAT_ENGINES)
|
||||
return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in cls.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class ParticleButtonsPanel():
|
||||
@ -47,18 +47,16 @@ class ParticleButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "particle"
|
||||
|
||||
def poll(self, context):
|
||||
return particle_panel_poll(self, context)
|
||||
|
||||
|
||||
class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_label = ""
|
||||
bl_show_header = False
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
return (context.particle_system or context.object) and (engine in self.COMPAT_ENGINES)
|
||||
return (context.particle_system or context.object) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -140,13 +138,18 @@ class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Pa
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
_context_path = "particle_system.settings"
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return particle_panel_poll(__class__, context)
|
||||
|
||||
|
||||
class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Emission"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
if particle_panel_poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if particle_panel_poll(PARTICLE_PT_emission, context):
|
||||
return not context.particle_system.point_cache.external
|
||||
else:
|
||||
return False
|
||||
@ -208,14 +211,15 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
psys = context.particle_system
|
||||
engine = context.scene.render.engine
|
||||
if psys is None:
|
||||
return False
|
||||
if psys.settings is None:
|
||||
return False
|
||||
return psys.settings.type == 'HAIR' and (engine in self.COMPAT_ENGINES)
|
||||
return psys.settings.type == 'HAIR' and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
#cloth = context.cloth.collision_settings
|
||||
@ -265,7 +269,8 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
psys = context.particle_system
|
||||
engine = context.scene.render.engine
|
||||
if psys is None:
|
||||
@ -275,7 +280,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
|
||||
phystype = psys.settings.physics_type
|
||||
if phystype == 'NO' or phystype == 'KEYED':
|
||||
return False
|
||||
return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in self.COMPAT_ENGINES
|
||||
return (psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)) and engine in __class__.COMPAT_ENGINES
|
||||
|
||||
def draw(self, context):
|
||||
psys = context.particle_system
|
||||
@ -287,8 +292,9 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Velocity"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
if particle_panel_poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if particle_panel_poll(PARTICLE_PT_velocity, context):
|
||||
psys = context.particle_system
|
||||
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
|
||||
else:
|
||||
@ -334,8 +340,9 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Rotation"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
if particle_panel_poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if particle_panel_poll(PARTICLE_PT_rotation, context):
|
||||
psys = context.particle_system
|
||||
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external
|
||||
else:
|
||||
@ -380,8 +387,9 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Physics"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
if particle_panel_poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if particle_panel_poll(PARTICLE_PT_physics, context):
|
||||
return not context.particle_system.point_cache.external
|
||||
else:
|
||||
return False
|
||||
@ -577,7 +585,8 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Boid Brain"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
psys = context.particle_system
|
||||
engine = context.scene.render.engine
|
||||
if psys is None:
|
||||
@ -586,7 +595,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
|
||||
return False
|
||||
if psys.point_cache.external:
|
||||
return False
|
||||
return psys.settings.physics_type == 'BOIDS' and engine in self.COMPAT_ENGINES
|
||||
return psys.settings.physics_type == 'BOIDS' and engine in __class__.COMPAT_ENGINES
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -677,14 +686,15 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Render"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
psys = context.particle_system
|
||||
engine = context.scene.render.engine
|
||||
if psys is None:
|
||||
return False
|
||||
if psys.settings is None:
|
||||
return False
|
||||
return engine in self.COMPAT_ENGINES
|
||||
return engine in __class__.COMPAT_ENGINES
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -848,14 +858,15 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
psys = context.particle_system
|
||||
engine = context.scene.render.engine
|
||||
if psys is None:
|
||||
return False
|
||||
if psys.settings is None:
|
||||
return False
|
||||
return engine in self.COMPAT_ENGINES
|
||||
return engine in __class__.COMPAT_ENGINES
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -907,6 +918,10 @@ class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return particle_panel_poll(__class__, context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -992,6 +1007,10 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return particle_panel_poll(__class__, context)
|
||||
|
||||
def draw(self, context):
|
||||
part = context.particle_system.settings
|
||||
effector_weights_ui(self, context, part.effector_weights)
|
||||
@ -1005,6 +1024,10 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return particle_panel_poll(__class__, context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -1033,6 +1056,10 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return particle_panel_poll(__class__, context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -45,7 +45,8 @@ class PhysicButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "physics"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.object
|
||||
rd = context.scene.render
|
||||
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
|
||||
@ -137,7 +138,8 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Cloth Cache"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.cloth
|
||||
|
||||
def draw(self, context):
|
||||
@ -149,7 +151,8 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Cloth Collision"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.cloth
|
||||
|
||||
def draw_header(self, context):
|
||||
@ -189,7 +192,8 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Cloth Stiffness Scaling"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.cloth
|
||||
|
||||
def draw_header(self, context):
|
||||
@ -226,7 +230,8 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Cloth Field Weights"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.cloth)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -31,7 +31,8 @@ class PhysicButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "physics"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.object) and (not rd.use_game_engine)
|
||||
|
||||
@ -173,7 +174,8 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Collision"
|
||||
#bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.object
|
||||
rd = context.scene.render
|
||||
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
|
||||
|
@ -27,7 +27,8 @@ class PhysicButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "physics"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.object
|
||||
rd = context.scene.render
|
||||
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
|
||||
@ -220,9 +221,10 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Domain World"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
md = context.fluid
|
||||
return md and (md.settings.type == 'DOMAIN')
|
||||
return md and md.settings and (md.settings.type == 'DOMAIN')
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -271,9 +273,10 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Domain Boundary"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
md = context.fluid
|
||||
return md and (md.settings.type == 'DOMAIN')
|
||||
return md and md.settings and (md.settings.type == 'DOMAIN')
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -300,9 +303,10 @@ class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Domain Particles"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
md = context.fluid
|
||||
return md and (md.settings.type == 'DOMAIN')
|
||||
return md and md.settings and (md.settings.type == 'DOMAIN')
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -31,7 +31,8 @@ class PhysicButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "physics"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.object
|
||||
rd = context.scene.render
|
||||
return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
|
||||
@ -130,7 +131,8 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Smoke Groups"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
md = context.smoke
|
||||
return md and (md.smoke_type == 'DOMAIN')
|
||||
|
||||
@ -159,7 +161,8 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Smoke Cache"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
md = context.smoke
|
||||
return md and (md.smoke_type == 'DOMAIN')
|
||||
|
||||
@ -179,7 +182,8 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Smoke High Resolution"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
md = context.smoke
|
||||
return md and (md.smoke_type == 'DOMAIN')
|
||||
|
||||
@ -215,7 +219,8 @@ class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Smoke High Resolution Cache"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
md = context.smoke
|
||||
return md and (md.smoke_type == 'DOMAIN') and md.domain_settings.highres
|
||||
|
||||
@ -235,7 +240,8 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Smoke Field Weights"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
smoke = context.smoke
|
||||
return (smoke and smoke.smoke_type == 'DOMAIN')
|
||||
|
||||
|
@ -35,7 +35,8 @@ class PhysicButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "physics"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.object
|
||||
rd = context.scene.render
|
||||
# return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
|
||||
@ -92,7 +93,8 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Soft Body Cache"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.soft_body
|
||||
|
||||
def draw(self, context):
|
||||
@ -104,7 +106,8 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Soft Body Goal"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.soft_body
|
||||
|
||||
def draw_header(self, context):
|
||||
@ -148,7 +151,8 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Soft Body Edges"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.soft_body
|
||||
|
||||
def draw_header(self, context):
|
||||
@ -203,7 +207,8 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Soft Body Self Collision"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.soft_body
|
||||
|
||||
def draw_header(self, context):
|
||||
@ -238,7 +243,8 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Soft Body Solver"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.soft_body
|
||||
|
||||
def draw(self, context):
|
||||
@ -275,7 +281,8 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Soft Body Field Weights"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.soft_body)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -42,15 +42,16 @@ class RenderButtonsPanel():
|
||||
bl_context = "render"
|
||||
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
|
||||
|
||||
def poll(self, context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Render"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -74,6 +75,11 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -178,6 +184,11 @@ class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Shading"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -204,6 +215,11 @@ class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -248,6 +264,11 @@ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -291,6 +312,11 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Output"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -412,7 +438,8 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
|
||||
|
||||
@ -483,6 +510,11 @@ class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Anti-Aliasing"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
rd = context.scene.render
|
||||
|
||||
@ -514,6 +546,11 @@ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
rd = context.scene.render
|
||||
|
||||
@ -533,6 +570,11 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Dimensions"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -581,6 +623,11 @@ class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
rd = context.scene.render
|
||||
|
||||
@ -627,6 +674,11 @@ class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.scene and rd.use_game_engine is False) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -28,7 +28,8 @@ class SceneButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "scene"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.scene
|
||||
|
||||
|
||||
@ -118,7 +119,8 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
|
||||
class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Active Keying Set"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.scene.active_keying_set and context.scene.active_keying_set.absolute)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -70,18 +70,16 @@ class TextureButtonsPanel():
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "texture"
|
||||
|
||||
def poll(self, context):
|
||||
tex = context.texture
|
||||
if not tex:
|
||||
return False
|
||||
engine = context.scene.render.engine
|
||||
return (tex.type != 'NONE' or tex.use_nodes) and (engine in self.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Preview"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -100,12 +98,13 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
|
||||
bl_show_header = False
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
engine = context.scene.render.engine
|
||||
if not hasattr(context, "texture_slot"):
|
||||
return False
|
||||
return ((context.material or context.world or context.lamp or context.brush or context.texture)
|
||||
and (engine in self.COMPAT_ENGINES))
|
||||
and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -170,9 +169,10 @@ class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Pane
|
||||
_context_path = "texture"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context): # use alternate poll since NONE texture type is ok
|
||||
@staticmethod
|
||||
def poll(context): # use alternate poll since NONE texture type is ok
|
||||
engine = context.scene.render.engine
|
||||
return context.texture and (engine in self.COMPAT_ENGINES)
|
||||
return context.texture and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
|
||||
@ -180,6 +180,11 @@ class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -212,19 +217,21 @@ class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
|
||||
class TextureSlotPanel(TextureButtonsPanel):
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if not hasattr(context, "texture_slot"):
|
||||
return False
|
||||
|
||||
engine = context.scene.render.engine
|
||||
return TextureButtonsPanel.poll(self, context) and (engine in self.COMPAT_ENGINES)
|
||||
return TextureButtonsPanel.poll(self, context) and (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
|
||||
bl_label = "Mapping"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
idblock = context_tex_datablock(context)
|
||||
if type(idblock) == bpy.types.Brush and not context.sculpt_object:
|
||||
return False
|
||||
@ -233,7 +240,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
|
||||
return False
|
||||
|
||||
engine = context.scene.render.engine
|
||||
return (engine in self.COMPAT_ENGINES)
|
||||
return (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -321,7 +328,8 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
|
||||
bl_label = "Influence"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
idblock = context_tex_datablock(context)
|
||||
if type(idblock) == bpy.types.Brush:
|
||||
return False
|
||||
@ -330,7 +338,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
|
||||
return False
|
||||
|
||||
engine = context.scene.render.engine
|
||||
return (engine in self.COMPAT_ENGINES)
|
||||
return (engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
|
||||
@ -443,12 +451,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
|
||||
|
||||
|
||||
class TextureTypePanel(TextureButtonsPanel):
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return ((tex and tex.type == self.tex_type and not tex.use_nodes) and (engine in self.COMPAT_ENGINES))
|
||||
pass
|
||||
|
||||
|
||||
class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel):
|
||||
@ -456,6 +459,12 @@ class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'CLOUDS'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -486,6 +495,12 @@ class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'WOOD'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -523,6 +538,12 @@ class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'MARBLE'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -555,6 +576,12 @@ class TEXTURE_PT_magic(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'MAGIC'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -576,6 +603,12 @@ class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'BLEND'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -598,6 +631,12 @@ class TEXTURE_PT_stucci(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'STUCCI'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -627,6 +666,12 @@ class TEXTURE_PT_image(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'IMAGE'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -654,6 +699,12 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'IMAGE'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -695,6 +746,12 @@ class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'IMAGE'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -753,6 +810,12 @@ class TEXTURE_PT_plugin(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'PLUGIN'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -766,6 +829,12 @@ class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'ENVIRONMENT_MAP'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -808,6 +877,12 @@ class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'ENVIRONMENT_MAP'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -821,6 +896,12 @@ class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'MUSGRAVE'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -869,6 +950,12 @@ class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'VORONOI'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -913,6 +1000,12 @@ class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel):
|
||||
tex_type = 'DISTORTED_NOISE'
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return tex and ((tex.type == __class__.tex_type and not tex.use_nodes) and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@ -941,10 +1034,11 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Voxel Data"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return (tex and tex.type == 'VOXEL_DATA' and (engine in self.COMPAT_ENGINES))
|
||||
return tex and (tex.type == 'VOXEL_DATA' and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -979,10 +1073,11 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Point Density"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES))
|
||||
return tex and (tex.type == 'POINT_DENSITY' and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -1039,10 +1134,11 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Turbulence"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
tex = context.texture
|
||||
engine = context.scene.render.engine
|
||||
return (tex and tex.type == 'POINT_DENSITY' and (engine in self.COMPAT_ENGINES))
|
||||
return tex and (tex.type == 'POINT_DENSITY' and (engine in __class__.COMPAT_ENGINES))
|
||||
|
||||
def draw_header(self, context):
|
||||
layout = self.layout
|
||||
|
@ -29,15 +29,16 @@ class WorldButtonsPanel():
|
||||
bl_context = "world"
|
||||
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
|
||||
|
||||
def poll(self, context):
|
||||
rd = context.scene.render
|
||||
return (context.world) and (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
|
||||
|
||||
|
||||
class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Preview"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (context.world) and (not rd.use_game_engine) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
self.layout.template_preview(context.world)
|
||||
|
||||
@ -47,9 +48,10 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
|
||||
bl_show_header = False
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
return (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES)
|
||||
return (not rd.use_game_engine) and (rd.engine in __class__.COMPAT_ENGINES)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@ -205,7 +207,8 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Indirect Lighting"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
light = context.world.lighting
|
||||
return light.gather_method == 'APPROXIMATE'
|
||||
|
||||
|
@ -138,7 +138,8 @@ class ConsoleAutocomplete(bpy.types.Operator):
|
||||
bl_idname = "console.autocomplete"
|
||||
bl_label = "Console Autocomplete"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return context.space_data.console_type != 'REPORT'
|
||||
|
||||
def execute(self, context):
|
||||
|
@ -335,7 +335,8 @@ class IMAGE_PT_image_properties(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Image"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
return (sima.image)
|
||||
|
||||
@ -354,7 +355,8 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Game Properties"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
rd = context.scene.render
|
||||
sima = context.space_data
|
||||
return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
|
||||
@ -399,7 +401,8 @@ class IMAGE_PT_view_histogram(bpy.types.Panel):
|
||||
bl_region_type = 'PREVIEW'
|
||||
bl_label = "Histogram"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
return (sima and sima.image)
|
||||
|
||||
@ -417,7 +420,8 @@ class IMAGE_PT_view_waveform(bpy.types.Panel):
|
||||
bl_region_type = 'PREVIEW'
|
||||
bl_label = "Waveform"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
return (sima and sima.image)
|
||||
|
||||
@ -436,7 +440,8 @@ class IMAGE_PT_view_vectorscope(bpy.types.Panel):
|
||||
bl_region_type = 'PREVIEW'
|
||||
bl_label = "Vectorscope"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
return (sima and sima.image)
|
||||
|
||||
@ -453,7 +458,8 @@ class IMAGE_PT_sample_line(bpy.types.Panel):
|
||||
bl_region_type = 'PREVIEW'
|
||||
bl_label = "Sample Line"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
return (sima and sima.image)
|
||||
|
||||
@ -470,7 +476,8 @@ class IMAGE_PT_scope_sample(bpy.types.Panel):
|
||||
bl_region_type = 'PREVIEW'
|
||||
bl_label = "Scope Samples"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
return sima
|
||||
|
||||
@ -490,7 +497,8 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Display"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
return (sima and (sima.image or sima.show_uvedit))
|
||||
|
||||
@ -553,7 +561,8 @@ class IMAGE_PT_paint(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Paint"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
return sima.show_paint
|
||||
|
||||
@ -598,7 +607,8 @@ class IMAGE_PT_tools_brush_texture(bpy.types.Panel):
|
||||
bl_label = "Texture"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
toolsettings = context.tool_settings.image_paint
|
||||
return sima.show_paint and toolsettings.brush
|
||||
@ -622,7 +632,8 @@ class IMAGE_PT_paint_stroke(bpy.types.Panel):
|
||||
bl_label = "Paint Stroke"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
toolsettings = context.tool_settings.image_paint
|
||||
return sima.show_paint and toolsettings.brush
|
||||
@ -653,7 +664,8 @@ class IMAGE_PT_paint_curve(bpy.types.Panel):
|
||||
bl_label = "Paint Curve"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
sima = context.space_data
|
||||
toolsettings = context.tool_settings.image_paint
|
||||
return sima.show_paint and toolsettings.brush
|
||||
|
@ -25,7 +25,8 @@ class LOGIC_PT_properties(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Properties"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
ob = context.active_object
|
||||
return ob and ob.game
|
||||
|
||||
|
@ -319,7 +319,8 @@ class SequencerButtonsPanel():
|
||||
def has_sequencer(self, context):
|
||||
return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return self.has_sequencer(context) and (act_strip(context) is not None)
|
||||
|
||||
|
||||
@ -330,7 +331,8 @@ class SequencerButtonsPanel_Output():
|
||||
def has_preview(self, context):
|
||||
return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return self.has_preview(context)
|
||||
|
||||
|
||||
@ -384,7 +386,8 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
|
||||
class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Effect Strip"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if not self.has_sequencer(context):
|
||||
return False
|
||||
|
||||
@ -513,7 +516,8 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
|
||||
class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Strip Input"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if not self.has_sequencer(context):
|
||||
return False
|
||||
|
||||
@ -587,7 +591,8 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
|
||||
class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Sound"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if not self.has_sequencer(context):
|
||||
return False
|
||||
|
||||
@ -627,7 +632,8 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
|
||||
class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Scene"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if not self.has_sequencer(context):
|
||||
return False
|
||||
|
||||
@ -651,7 +657,8 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
|
||||
class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Filter"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if not self.has_sequencer(context):
|
||||
return False
|
||||
|
||||
@ -712,7 +719,8 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
|
||||
class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
|
||||
bl_label = "Proxy"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
if not self.has_sequencer(context):
|
||||
return False
|
||||
|
||||
|
@ -246,7 +246,8 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
|
||||
class TEXT_MT_edit(bpy.types.Menu):
|
||||
bl_label = "Edit"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.space_data.text)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -142,7 +142,8 @@ class USERPREF_PT_interface(bpy.types.Panel):
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_show_header = False
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
userpref = context.user_preferences
|
||||
return (userpref.active_section == 'INTERFACE')
|
||||
|
||||
@ -242,7 +243,8 @@ class USERPREF_PT_edit(bpy.types.Panel):
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_show_header = False
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
userpref = context.user_preferences
|
||||
return (userpref.active_section == 'EDITING')
|
||||
|
||||
@ -356,7 +358,8 @@ class USERPREF_PT_system(bpy.types.Panel):
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_show_header = False
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
userpref = context.user_preferences
|
||||
return (userpref.active_section == 'SYSTEM')
|
||||
|
||||
@ -520,7 +523,8 @@ class USERPREF_PT_theme(bpy.types.Panel):
|
||||
for i, attr in enumerate(props_ls):
|
||||
colsub_pair[i % 2].row().prop(themedata, attr)
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
userpref = context.user_preferences
|
||||
return (userpref.active_section == 'THEMES')
|
||||
|
||||
@ -652,7 +656,8 @@ class USERPREF_PT_file(bpy.types.Panel):
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_show_header = False
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
userpref = context.user_preferences
|
||||
return (userpref.active_section == 'FILES')
|
||||
|
||||
@ -723,7 +728,8 @@ class USERPREF_PT_input(InputKeyMapPanel):
|
||||
bl_space_type = 'USER_PREFERENCES'
|
||||
bl_label = "Input"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
userpref = context.user_preferences
|
||||
return (userpref.active_section == 'INPUT')
|
||||
|
||||
@ -817,7 +823,8 @@ class USERPREF_PT_addons(bpy.types.Panel):
|
||||
|
||||
_addons_fake_modules = {}
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
userpref = context.user_preferences
|
||||
return (userpref.active_section == 'ADDONS')
|
||||
|
||||
|
@ -763,7 +763,8 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
|
||||
bl_idname = "wm.keyconfig_remove"
|
||||
bl_label = "Remove Key Config"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
wm = context.manager
|
||||
return wm.active_keyconfig.user_defined
|
||||
|
||||
|
@ -714,7 +714,8 @@ class VIEW3D_MT_object_clear(bpy.types.Menu):
|
||||
class VIEW3D_MT_object_specials(bpy.types.Menu):
|
||||
bl_label = "Specials"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
# add more special types
|
||||
return context.object
|
||||
|
||||
@ -1939,7 +1940,8 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "View"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
view = context.space_data
|
||||
return (view)
|
||||
|
||||
@ -1975,7 +1977,8 @@ class VIEW3D_PT_view3d_name(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Item"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.space_data and context.active_object)
|
||||
|
||||
def draw(self, context):
|
||||
@ -2000,7 +2003,8 @@ class VIEW3D_PT_view3d_display(bpy.types.Panel):
|
||||
bl_label = "Display"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
view = context.space_data
|
||||
return (view)
|
||||
|
||||
@ -2067,7 +2071,8 @@ class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Mesh Display"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
# The active object check is needed because of localmode
|
||||
return (context.active_object and (context.mode == 'EDIT_MESH'))
|
||||
|
||||
@ -2103,7 +2108,8 @@ class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Curve Display"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
editmesh = context.mode == 'EDIT_CURVE'
|
||||
return (editmesh)
|
||||
|
||||
@ -2125,7 +2131,8 @@ class VIEW3D_PT_background_image(bpy.types.Panel):
|
||||
bl_label = "Background Images"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
view = context.space_data
|
||||
# bg = context.space_data.background_image
|
||||
return (view)
|
||||
@ -2174,7 +2181,8 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
|
||||
bl_label = "Transform Orientations"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
view = context.space_data
|
||||
return (view)
|
||||
|
||||
@ -2201,7 +2209,8 @@ class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
|
||||
bl_label = "Skeleton Sketching"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
scene = context.space_data
|
||||
ob = context.active_object
|
||||
return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
|
||||
@ -2257,7 +2266,8 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
|
||||
|
||||
return ""
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
member = self._active_context_member(context)
|
||||
if member:
|
||||
context_member = getattr(context, member)
|
||||
|
@ -473,7 +473,8 @@ class PaintPanel():
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'TOOLS'
|
||||
|
||||
def paint_settings(self, context):
|
||||
@staticmethod
|
||||
def paint_settings(context):
|
||||
ts = context.tool_settings
|
||||
|
||||
if context.sculpt_object:
|
||||
@ -493,13 +494,14 @@ class PaintPanel():
|
||||
class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
|
||||
bl_label = "Brush"
|
||||
|
||||
def poll(self, context):
|
||||
return self.paint_settings(context)
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return __class__.paint_settings(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = self.paint_settings(context)
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
if not context.particle_edit_object:
|
||||
@ -720,15 +722,16 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
|
||||
bl_label = "Texture"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
settings = self.paint_settings(context)
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
settings = __class__.paint_settings(context)
|
||||
return (settings and settings.brush and (context.sculpt_object or
|
||||
context.texture_paint_object))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = self.paint_settings(context)
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
tex_slot = brush.texture_slot
|
||||
|
||||
@ -822,8 +825,9 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
|
||||
bl_label = "Tool"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
settings = self.paint_settings(context)
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
settings = __class__.paint_settings(context)
|
||||
return (settings and settings.brush and
|
||||
(context.sculpt_object or context.texture_paint_object or
|
||||
context.vertex_paint_object or context.weight_paint_object))
|
||||
@ -831,7 +835,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = self.paint_settings(context)
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
texture_paint = context.texture_paint_object
|
||||
sculpt = context.sculpt_object
|
||||
@ -857,8 +861,9 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
|
||||
bl_label = "Stroke"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
settings = self.paint_settings(context)
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
settings = __class__.paint_settings(context)
|
||||
return (settings and settings.brush and (context.sculpt_object or
|
||||
context.vertex_paint_object or
|
||||
context.weight_paint_object or
|
||||
@ -867,7 +872,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = self.paint_settings(context)
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
texture_paint = context.texture_paint_object
|
||||
|
||||
@ -954,14 +959,15 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
|
||||
bl_label = "Curve"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
settings = self.paint_settings(context)
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
settings = __class__.paint_settings(context)
|
||||
return (settings and settings.brush and settings.brush.curve)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
settings = self.paint_settings(context)
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
layout.template_curve_mapping(brush, "curve", brush=True)
|
||||
@ -978,7 +984,8 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
|
||||
bl_label = "Options"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.sculpt_object and context.tool_settings.sculpt)
|
||||
|
||||
def draw(self, context):
|
||||
@ -988,7 +995,7 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
sculpt = tool_settings.sculpt
|
||||
settings = self.paint_settings(context)
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
split = layout.split()
|
||||
@ -1020,7 +1027,8 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
|
||||
bl_label = "Symmetry"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.sculpt_object and context.tool_settings.sculpt)
|
||||
|
||||
def draw(self, context):
|
||||
@ -1029,7 +1037,7 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
|
||||
layout = self.layout
|
||||
|
||||
sculpt = context.tool_settings.sculpt
|
||||
settings = self.paint_settings(context)
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
split = layout.split()
|
||||
@ -1058,14 +1066,15 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
|
||||
bl_label = "Appearance"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.texture_paint_object and context.tool_settings.image_paint)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
sculpt = context.tool_settings.sculpt
|
||||
settings = self.paint_settings(context)
|
||||
settings = __class__.paint_settings(context)
|
||||
brush = settings.brush
|
||||
|
||||
col = layout.column();
|
||||
@ -1177,7 +1186,8 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
|
||||
bl_context = "texturepaint"
|
||||
bl_label = "Project Paint"
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
brush = context.tool_settings.image_paint.brush
|
||||
return (brush and brush.imagepaint_tool != 'SMEAR')
|
||||
|
||||
@ -1247,7 +1257,8 @@ class VIEW3D_PT_imagepaint_options(PaintPanel):
|
||||
bl_label = "Options"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
@staticmethod
|
||||
def poll(context):
|
||||
return (context.texture_paint_object and context.tool_settings.image_paint)
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -588,7 +588,7 @@ static void rna_def_panel(BlenderRNA *brna)
|
||||
/* poll */
|
||||
func= RNA_def_function(srna, "poll", NULL);
|
||||
RNA_def_function_ui_description(func, "If this method returns a non-null output, then the panel can be drawn.");
|
||||
RNA_def_function_flag(func, FUNC_REGISTER|FUNC_REGISTER_OPTIONAL);
|
||||
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER|FUNC_REGISTER_OPTIONAL);
|
||||
RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
|
||||
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
@ -711,7 +711,7 @@ static void rna_def_menu(BlenderRNA *brna)
|
||||
/* poll */
|
||||
func= RNA_def_function(srna, "poll", NULL);
|
||||
RNA_def_function_ui_description(func, "If this method returns a non-null output, then the menu can be drawn.");
|
||||
RNA_def_function_flag(func, FUNC_REGISTER|FUNC_REGISTER_OPTIONAL);
|
||||
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER|FUNC_REGISTER_OPTIONAL);
|
||||
RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
|
||||
parm= RNA_def_pointer(func, "context", "Context", "", "");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
@ -186,7 +186,7 @@ void RNA_api_operator(StructRNA *srna)
|
||||
/* poll */
|
||||
func= RNA_def_function(srna, "poll", NULL);
|
||||
RNA_def_function_ui_description(func, "Test if the operator can be called or not.");
|
||||
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
|
||||
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL);
|
||||
RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
|
||||
RNA_def_pointer(func, "context", "Context", "", "");
|
||||
|
||||
@ -246,7 +246,7 @@ void RNA_api_macro(StructRNA *srna)
|
||||
/* poll */
|
||||
func= RNA_def_function(srna, "poll", NULL);
|
||||
RNA_def_function_ui_description(func, "Test if the operator can be called or not.");
|
||||
RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
|
||||
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL);
|
||||
RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
|
||||
RNA_def_pointer(func, "context", "Context", "", "");
|
||||
|
||||
|
@ -4388,7 +4388,7 @@ static int rna_function_arg_count(FunctionRNA *func)
|
||||
const ListBase *lb= RNA_function_defined_parameters(func);
|
||||
PropertyRNA *parm;
|
||||
Link *link;
|
||||
int count= 1;
|
||||
int count= (RNA_function_flag(func) & FUNC_NO_SELF) ? 0 : 1;
|
||||
|
||||
for(link=lb->first; link; link=link->next) {
|
||||
parm= (PropertyRNA*)link;
|
||||
@ -4537,6 +4537,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
ParameterIterator iter;
|
||||
PointerRNA funcptr;
|
||||
int err= 0, i, flag, ret_len=0;
|
||||
int is_static = RNA_function_flag(func) & FUNC_NO_SELF;
|
||||
|
||||
PropertyRNA *pret_single= NULL;
|
||||
void *retdata_single= NULL;
|
||||
@ -4554,52 +4555,54 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
}
|
||||
|
||||
bpy_context_set(C, &gilstate);
|
||||
|
||||
if (!is_static) {
|
||||
/* exception, operators store their PyObjects for re-use */
|
||||
if(ptr->data) {
|
||||
if(RNA_struct_is_a(ptr->type, &RNA_Operator)) {
|
||||
wmOperator *op= ptr->data;
|
||||
if(op->py_instance) {
|
||||
py_class_instance= op->py_instance;
|
||||
Py_INCREF(py_class_instance);
|
||||
}
|
||||
else {
|
||||
/* store the instance here once its created */
|
||||
py_class_instance_store= &op->py_instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end exception */
|
||||
|
||||
/* exception, operators store their PyObjects for re-use */
|
||||
if(ptr->data) {
|
||||
if(RNA_struct_is_a(ptr->type, &RNA_Operator)) {
|
||||
wmOperator *op= ptr->data;
|
||||
if(op->py_instance) {
|
||||
py_class_instance= op->py_instance;
|
||||
if(py_class_instance==NULL)
|
||||
py_srna= pyrna_struct_CreatePyObject(ptr);
|
||||
|
||||
if(py_class_instance) {
|
||||
/* special case, instance is cached */
|
||||
}
|
||||
else if(py_srna == NULL) {
|
||||
py_class_instance = NULL;
|
||||
}
|
||||
else if(py_srna == Py_None) { /* probably wont ever happen but possible */
|
||||
Py_DECREF(py_srna);
|
||||
py_class_instance = NULL;
|
||||
}
|
||||
else {
|
||||
args = PyTuple_New(1);
|
||||
PyTuple_SET_ITEM(args, 0, py_srna);
|
||||
py_class_instance= PyObject_Call(py_class, args, NULL);
|
||||
Py_DECREF(args);
|
||||
|
||||
if(py_class_instance == NULL) {
|
||||
err= -1; /* so the error is not overridden below */
|
||||
}
|
||||
else if(py_class_instance_store) {
|
||||
*py_class_instance_store = py_class_instance;
|
||||
Py_INCREF(py_class_instance);
|
||||
}
|
||||
else {
|
||||
/* store the instance here once its created */
|
||||
py_class_instance_store= &op->py_instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end exception */
|
||||
|
||||
if(py_class_instance==NULL)
|
||||
py_srna= pyrna_struct_CreatePyObject(ptr);
|
||||
|
||||
if(py_class_instance) {
|
||||
/* special case, instance is cached */
|
||||
}
|
||||
else if(py_srna == NULL) {
|
||||
py_class_instance = NULL;
|
||||
}
|
||||
else if(py_srna == Py_None) { /* probably wont ever happen but possible */
|
||||
Py_DECREF(py_srna);
|
||||
py_class_instance = NULL;
|
||||
}
|
||||
else {
|
||||
args = PyTuple_New(1);
|
||||
PyTuple_SET_ITEM(args, 0, py_srna);
|
||||
py_class_instance= PyObject_Call(py_class, args, NULL);
|
||||
Py_DECREF(args);
|
||||
|
||||
if(py_class_instance == NULL) {
|
||||
err= -1; /* so the error is not overridden below */
|
||||
}
|
||||
else if(py_class_instance_store) {
|
||||
*py_class_instance_store = py_class_instance;
|
||||
Py_INCREF(py_class_instance);
|
||||
}
|
||||
}
|
||||
|
||||
if (py_class_instance) { /* Initializing the class worked, now run its invoke function */
|
||||
if (is_static || py_class_instance) { /* Initializing the class worked, now run its invoke function */
|
||||
PyObject *item= PyObject_GetAttrString(py_class, RNA_function_identifier(func));
|
||||
// flag= RNA_function_flag(func);
|
||||
|
||||
@ -4607,12 +4610,19 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
|
||||
RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
|
||||
|
||||
args = PyTuple_New(rna_function_arg_count(func)); /* first arg is included in 'item' */
|
||||
PyTuple_SET_ITEM(args, 0, py_class_instance);
|
||||
|
||||
if(is_static) {
|
||||
i= 0;
|
||||
}
|
||||
else {
|
||||
PyTuple_SET_ITEM(args, 0, py_class_instance);
|
||||
i= 1;
|
||||
}
|
||||
|
||||
RNA_parameter_list_begin(parms, &iter);
|
||||
|
||||
/* parse function parameters */
|
||||
for (i= 1; iter.valid; RNA_parameter_list_next(&iter)) {
|
||||
for (; iter.valid; RNA_parameter_list_next(&iter)) {
|
||||
parm= iter.parm;
|
||||
flag= RNA_property_flag(parm);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user