Use COMPAT_ENGINES instead of RenderEngine.use_game_engine for panel poll methods
This mostly affects physics panels. Any engines relying on RenderEngine.use_game_engine flag to show/hide panels will need to be updated. The COMPAT_ENGINES technique is how we usually deal with this. One issue with use_game_engine is that I cannot find a way to set it; it appears only the BGE can set it. This means (without this commit) external RenderEngines cannot get rid of the default physics panels. The RE_GAME flag (the C flag behind use_game_engine) is pretty hacky and we should look into removing its usage where possible.
This commit is contained in:
@@ -29,12 +29,13 @@ class PHYSICS_PT_rigidbody_panel:
|
||||
|
||||
class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
|
||||
bl_label = "Rigid Body"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.object
|
||||
return (obj and obj.rigid_body and
|
||||
(not context.scene.render.use_game_engine))
|
||||
(context.scene.render.engine in cls.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -55,12 +56,13 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
|
||||
|
||||
class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
|
||||
bl_label = "Rigid Body Collisions"
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.object
|
||||
return (obj and obj.rigid_body and
|
||||
(not context.scene.render.use_game_engine))
|
||||
(context.scene.render.engine in cls.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -99,13 +101,14 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
|
||||
class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
|
||||
bl_label = "Rigid Body Dynamics"
|
||||
bl_default_closed = True
|
||||
COMPAT_ENGINES = {'BLENDER_RENDER'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
obj = context.object
|
||||
return (obj and obj.rigid_body and
|
||||
obj.rigid_body.type == 'ACTIVE' and
|
||||
(not context.scene.render.use_game_engine))
|
||||
(context.scene.render.engine in cls.COMPAT_ENGINES))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
Reference in New Issue
Block a user