This commit is contained in:
Joerg Mueller 2010-08-07 15:45:07 +00:00
commit 64b36ffbb3
102 changed files with 2107 additions and 2287 deletions

@ -161,7 +161,11 @@ ifndef CONFIG_GUESS
export WITH_TIFF ?= true
#enable raytracing optimization (currently only for i386 and x86_64)
export WITH_BF_RAYOPTIMIZATION ?= true
ifeq ($(CPU),powerpc)
export WITH_BF_RAYOPTIMIZATION ?= false
else
export WITH_BF_RAYOPTIMIZATION ?= true
endif
export WITH_LCMS ?= false
export WITH_CINEON ?= true

@ -922,7 +922,7 @@ def make_kf_obj_node(obj, name_to_id):
"""
# import BPyMessages
def save_3ds(filename, context):
def write(filename, context):
'''Save the Blender scene to a 3ds file.'''
# Time the export
@ -1107,12 +1107,7 @@ def save_3ds(filename, context):
#primary.dump()
# if __name__=='__main__':
# if struct:
# Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds'))
# else:
# Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
# # save_3ds('/test_b.3ds')
# # write('/test_b.3ds')
from bpy.props import *
class Export3DS(bpy.types.Operator):
'''Export to 3DS file format (.3ds)'''
@ -1127,7 +1122,10 @@ class Export3DS(bpy.types.Operator):
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
def execute(self, context):
save_3ds(self.properties.filepath, context)
filepath = self.properties.filepath
filepath = bpy.path.ensure_ext(filepath, ".3ds")
write(filepath, context)
return {'FINISHED'}
def invoke(self, context, event):
@ -1135,7 +1133,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

@ -75,7 +75,7 @@ def copy_images(dest_dir, textures):
image_paths = set()
for tex in textures:
image_paths.add(bpy.utils.expandpath(tex.filepath))
image_paths.add(bpy.path.abspath(tex.filepath))
# Now copy images
copyCount = 0
@ -176,7 +176,7 @@ def sane_name(data, dct):
name = 'unnamed' # blank string, ASKING FOR TROUBLE!
else:
name = bpy.utils.clean_name(name) # use our own
name = bpy.path.clean_name(name) # use our own
while name in iter(dct.values()): name = increment_string(name)
@ -200,14 +200,14 @@ def sane_groupname(data): return sane_name(data, sane_name_mapping_group)
# FORCE_CWD - dont use the basepath, just add a ./ to the filename.
# use when we know the file will be in the basepath.
# '''
# fname = bpy.utils.expandpath(fname_orig)
# fname = bpy.path.abspath(fname_orig)
# # fname = Blender.sys.expandpath(fname_orig)
# fname_strip = os.path.basename(fname)
# # fname_strip = strip_path(fname)
# if FORCE_CWD:
# fname_rel = '.' + os.sep + fname_strip
# else:
# fname_rel = bpy.utils.relpath(fname, basepath)
# fname_rel = bpy.path.relpath(fname, basepath)
# # fname_rel = Blender.sys.relpath(fname, basepath)
# if fname_rel.startswith('//'): fname_rel = '.' + os.sep + fname_rel[2:]
# return fname, fname_strip, fname_rel
@ -354,8 +354,8 @@ def write(filename, batch_objects = None, \
new_fbxpath = fbxpath # own dir option modifies, we need to keep an original
for data in data_seq: # scene or group
newname = BATCH_FILE_PREFIX + bpy.utils.clean_name(data.name)
# newname = BATCH_FILE_PREFIX + BPySys.bpy.utils.clean_name(data.name)
newname = BATCH_FILE_PREFIX + bpy.path.clean_name(data.name)
# newname = BATCH_FILE_PREFIX + BPySys.bpy.path.clean_name(data.name)
if BATCH_OWN_DIR:
@ -1250,7 +1250,7 @@ def write(filename, batch_objects = None, \
file.write('\n\t}')
def copy_image(image):
fn = bpy.utils.expandpath(image.filepath)
fn = bpy.path.abspath(image.filepath)
fn_strip = os.path.basename(fn)
if EXP_IMAGE_COPY:
@ -3361,20 +3361,24 @@ 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):
if not self.properties.filepath:
raise Exception("filepath not set")
filepath = self.properties.filepath
filepath = bpy.path.ensure_ext(filepath, ".fbx")
GLOBAL_MATRIX = mtx4_identity
GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties.TX_SCALE
if self.properties.TX_XROT90: GLOBAL_MATRIX = mtx4_x90n * GLOBAL_MATRIX
if self.properties.TX_YROT90: GLOBAL_MATRIX = mtx4_y90n * GLOBAL_MATRIX
if self.properties.TX_ZROT90: GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
write(self.properties.filepath,
write(filepath,
None, # XXX
context,
self.properties.EXP_OBS_SELECTED,
@ -3394,7 +3398,8 @@ class ExportFBX(bpy.types.Operator):
self.properties.BATCH_ENABLE,
self.properties.BATCH_GROUP,
self.properties.BATCH_FILE_PREFIX,
self.properties.BATCH_OWN_DIR)
self.properties.BATCH_OWN_DIR,
)
return {'FINISHED'}
@ -3412,7 +3417,7 @@ class ExportFBX(bpy.types.Operator):
# NOTES (all line numbers correspond to original export_fbx.py (under release/scripts)
# - Draw.PupMenu alternative in 2.5?, temporarily replaced PupMenu with print
# - get rid of bpy.utils.clean_name somehow
# - get rid of bpy.path.clean_name somehow
# + fixed: isinstance(inst, bpy.types.*) doesn't work on RNA objects: line 565
# + get rid of BPyObject_getObjectArmature, move it in RNA?
# - BATCH_ENABLE and BATCH_GROUP options: line 327
@ -3427,7 +3432,7 @@ class ExportFBX(bpy.types.Operator):
# - bpy.data.remove_scene: line 366
# - bpy.sys.time move to bpy.sys.util?
# - new scene creation, activation: lines 327-342, 368
# - uses bpy.utils.expandpath, *.relpath - replace at least relpath
# - uses bpy.path.abspath, *.relpath - replace at least relpath
# SMALL or COSMETICAL
# - find a way to get blender version, and put it in bpy.util?, old was Blender.Get('version')

@ -165,15 +165,23 @@ 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')
def execute(self, context):
if not self.properties.filepath:
raise Exception("filename not set")
write(self.properties.filepath, context.scene, context.active_object,
self.properties.frame_start, self.properties.frame_end, self.properties.fps)
filepath = self.properties.filepath
filepath = bpy.path.ensure_ext(filepath, ".mdd")
write(filepath,
context.scene,
context.active_object,
self.properties.frame_start,
self.properties.frame_end,
self.properties.fps,
)
return {'FINISHED'}
def invoke(self, context, event):

@ -66,7 +66,7 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
dest_dir = os.path.dirname(filepath)
def copy_image(image):
fn = bpy.utils.expandpath(image.filepath)
fn = bpy.path.abspath(image.filepath)
fn_strip = os.path.basename(fn)
if copy_images:
rel = fn_strip
@ -182,7 +182,7 @@ def copy_images(dest_dir):
copyCount = 0
# for bImage in uniqueImages.values():
# image_path = bpy.utils.expandpath(bImage.filepath)
# image_path = bpy.path.abspath(bImage.filepath)
# if bpy.sys.exists(image_path):
# # Make a name for the target path.
# dest_image_path = dest_dir + image_path.split('\\')[-1].split('/')[-1]
@ -790,7 +790,7 @@ def write(filepath, objects, scene,
print("OBJ Export time: %.2f" % (time.clock() - time1))
# print "OBJ Export time: %.2f" % (sys.time() - time1)
def do_export(filepath, context,
def write(filepath, context,
EXPORT_APPLY_MODIFIERS = True, # not used
EXPORT_ROTX90 = True, # wrong
EXPORT_TRI = False, # ok
@ -837,7 +837,7 @@ def do_export(filepath, context,
orig_frame = scn.frame_current
if EXPORT_ALL_SCENES: # Add scene name into the context_name
context_name[1] = '_%s' % bpy.utils.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
context_name[1] = '_%s' % bpy.path.clean_name(scn.name) # WARNING, its possible that this could cause a collision. we could fix if were feeling parranoied.
# Export an animation?
if EXPORT_ANIMATION:
@ -927,27 +927,27 @@ class ExportOBJ(bpy.types.Operator):
def execute(self, context):
filepath = self.properties.filepath
if not filepath.lower().endswith(".obj"):
filepath += ".obj"
filepath = bpy.path.ensure_ext(filepath, ".obj")
do_export(filepath, context,
EXPORT_TRI=self.properties.use_triangles,
EXPORT_EDGES=self.properties.use_edges,
EXPORT_NORMALS=self.properties.use_normals,
EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
EXPORT_UV=self.properties.use_uvs,
EXPORT_MTL=self.properties.use_materials,
EXPORT_COPY_IMAGES=self.properties.copy_images,
EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
EXPORT_ROTX90=self.properties.use_rotate90,
EXPORT_BLEN_OBS=self.properties.use_blen_objects,
EXPORT_GROUP_BY_OB=self.properties.group_by_object,
EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
EXPORT_SEL_ONLY=self.properties.use_selection,
EXPORT_ALL_SCENES=self.properties.use_all_scenes)
write(filepath, context,
EXPORT_TRI=self.properties.use_triangles,
EXPORT_EDGES=self.properties.use_edges,
EXPORT_NORMALS=self.properties.use_normals,
EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
EXPORT_UV=self.properties.use_uvs,
EXPORT_MTL=self.properties.use_materials,
EXPORT_COPY_IMAGES=self.properties.copy_images,
EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
EXPORT_ROTX90=self.properties.use_rotate90,
EXPORT_BLEN_OBS=self.properties.use_blen_objects,
EXPORT_GROUP_BY_OB=self.properties.group_by_object,
EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
EXPORT_SEL_ONLY=self.properties.use_selection,
EXPORT_ALL_SCENES=self.properties.use_all_scenes,
)
return {'FINISHED'}

@ -275,16 +275,15 @@ 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):
# print("Selected: " + context.active_object.name)
filepath = self.properties.filepath
filepath = bpy.path.ensure_ext(filepath, ".ply")
if not self.properties.filepath:
raise Exception("filename not set")
write(self.properties.filepath, context.scene, context.active_object,\
write(filepath, context.scene, context.active_object,\
EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
EXPORT_NORMALS=self.properties.use_normals,
EXPORT_UV=self.properties.use_uvs,

@ -794,7 +794,7 @@ class x3d_class:
pic = tex.image
# using .expandpath just in case, os.path may not expect //
basename = os.path.basename(bpy.utils.expandpath(pic.filepath))
basename = os.path.basename(bpy.path.abspath(pic.filepath))
pic = alltextures[i].image
# pic = alltextures[i].getImage()
@ -1140,7 +1140,7 @@ class x3d_class:
# Callbacks, needed before Main
##########################################################
def x3d_export(filename,
def write(filename,
context,
EXPORT_APPLY_MODIFIERS=False,
EXPORT_TRI=False,
@ -1175,47 +1175,6 @@ def x3d_export(filename,
)
def x3d_export_ui(filename):
if not filename.endswith(extension):
filename += extension
#if _safeOverwrite and sys.exists(filename):
# result = Draw.PupMenu("File Already Exists, Overwrite?%t|Yes%x1|No%x0")
#if(result != 1):
# return
# Get user options
EXPORT_APPLY_MODIFIERS = Draw.Create(1)
EXPORT_TRI = Draw.Create(0)
EXPORT_GZIP = Draw.Create( filename.lower().endswith('.x3dz') )
# Get USER Options
pup_block = [\
('Apply Modifiers', EXPORT_APPLY_MODIFIERS, 'Use transformed mesh data from each object.'),\
('Triangulate', EXPORT_TRI, 'Triangulate quads.'),\
('Compress', EXPORT_GZIP, 'GZip the resulting file, requires a full python install'),\
]
if not Draw.PupBlock('Export...', pup_block):
return
Blender.Window.EditMode(0)
Blender.Window.WaitCursor(1)
x3d_export(filename,\
EXPORT_APPLY_MODIFIERS = EXPORT_APPLY_MODIFIERS.val,\
EXPORT_TRI = EXPORT_TRI.val,\
EXPORT_GZIP = EXPORT_GZIP.val\
)
Blender.Window.WaitCursor(0)
#########################################################
# main routine
#########################################################
from bpy.props import *
class ExportX3D(bpy.types.Operator):
@ -1233,7 +1192,16 @@ class ExportX3D(bpy.types.Operator):
compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
def execute(self, context):
x3d_export(self.properties.filepath, context, self.properties.apply_modifiers, self.properties.triangulate, self.properties.compress)
filepath = self.properties.filepath
filepath = bpy.path.ensure_ext(filepath, ".x3d")
write(filepath,
context,
self.properties.apply_modifiers,
self.properties.triangulate,
self.properties.compress,
)
return {'FINISHED'}
def invoke(self, context, event):

@ -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')

@ -49,7 +49,7 @@ def addPointCache(job, ob, point_cache, default_path):
if name == "":
name = "".join(["%02X" % ord(c) for c in ob.name])
cache_path = bpy.utils.expandpath(point_cache.filepath) if point_cache.external else default_path
cache_path = bpy.path.abspath(point_cache.filepath) if point_cache.external else default_path
index = "%02i" % point_cache.index
@ -113,7 +113,7 @@ def clientSendJob(conn, scene, anim = False):
# LIBRARIES
###########################
for lib in bpy.data.libraries:
file_path = bpy.utils.expandpath(lib.filepath)
file_path = bpy.path.abspath(lib.filepath)
if os.path.exists(file_path):
job.addFile(file_path)
@ -122,7 +122,7 @@ def clientSendJob(conn, scene, anim = False):
###########################
for image in bpy.data.images:
if image.source == "FILE" and not image.packed_file:
file_path = bpy.utils.expandpath(image.filepath)
file_path = bpy.path.abspath(image.filepath)
if os.path.exists(file_path):
job.addFile(file_path)
@ -139,7 +139,7 @@ def clientSendJob(conn, scene, anim = False):
for object in bpy.data.objects:
for modifier in object.modifiers:
if modifier.type == 'FLUID_SIMULATION' and modifier.settings.type == "DOMAIN":
addFluidFiles(job, bpy.utils.expandpath(modifier.settings.path))
addFluidFiles(job, bpy.path.abspath(modifier.settings.path))
elif modifier.type == "CLOTH":
addPointCache(job, object, modifier.point_cache, default_path)
elif modifier.type == "SOFT_BODY":
@ -149,7 +149,7 @@ def clientSendJob(conn, scene, anim = False):
if modifier.domain_settings.highres:
addPointCache(job, object, modifier.domain_settings.point_cache_high, default_path)
elif modifier.type == "MULTIRES" and modifier.external:
file_path = bpy.utils.expandpath(modifier.filepath)
file_path = bpy.path.abspath(modifier.filepath)
job.addFile(file_path)
# particles modifier are stupid and don't contain data

@ -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]"

@ -92,7 +92,7 @@ def process(paths):
# LIBRARIES
###########################
for lib in bpy.data.libraries:
file_path = bpy.utils.expandpath(lib.filepath)
file_path = bpy.path.abspath(lib.filepath)
new_path = path_map.get(os.path.split(file_path)[1], None)
if new_path:
lib.filepath = new_path
@ -102,7 +102,7 @@ def process(paths):
###########################
for image in bpy.data.images:
if image.source == "FILE" and not image.packed_file:
file_path = bpy.utils.expandpath(image.filepath)
file_path = bpy.path.abspath(image.filepath)
new_path = path_map.get(os.path.split(file_path)[1], None)
if new_path:
image.filepath = new_path
@ -124,7 +124,7 @@ def process(paths):
if modifier.domain_settings.highres:
processPointCache(modifier.domain_settings.point_cache_high)
elif modifier.type == "MULTIRES" and modifier.external:
file_path = bpy.utils.expandpath(modifier.filepath)
file_path = bpy.path.abspath(modifier.filepath)
new_path = path_map.get(file_path, None)
if new_path:
modifier.filepath = new_path

@ -36,6 +36,11 @@ DISPATCHED = 1
DONE = 2
ERROR = 3
def base_poll(cls, context):
rd = context.scene.render
return (rd.use_game_engine==False) and (rd.engine in cls.COMPAT_ENGINES)
def init_file():
if netrender.init_file != bpy.data.filepath:
netrender.init_file = bpy.data.filepath
@ -82,15 +87,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 (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):
return base_poll(__class__, context)
def draw(self, context):
layout = self.layout
@ -125,10 +131,10 @@ 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 base_poll(__class__, context) and scene.network_render.mode == "RENDER_SLAVE"
def draw(self, context):
layout = self.layout
@ -150,10 +156,10 @@ 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 base_poll(__class__, context) and scene.network_render.mode == "RENDER_MASTER"
def draw(self, context):
layout = self.layout
@ -168,10 +174,10 @@ 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 base_poll(__class__, context) and scene.network_render.mode == "RENDER_CLIENT"
def draw(self, context):
layout = self.layout
@ -208,14 +214,14 @@ 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 base_poll(__class__, context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout
@ -246,14 +252,14 @@ 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 base_poll(__class__, context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout
@ -283,14 +289,14 @@ 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 base_poll(__class__, context) and netsettings.server_address != "[default]"
def draw(self, context):
layout = self.layout

@ -26,7 +26,7 @@ data = _bpy.data
context = _bpy.context
# python modules
from bpy import utils
from bpy import utils, path
from bpy import ops as _ops_module

@ -0,0 +1,174 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
"""
This module has a similar scope to os.path, containing utility
functions for dealing with paths in Blender.
"""
import bpy as _bpy
import os as _os
def expand(path):
"""
Returns the absolute path relative to the current blend file using the "//" prefix.
"""
if path.startswith("//"):
return _os.path.join(_os.path.dirname(_bpy.data.filepath), path[2:])
return path
def relpath(path, start=None):
"""
Returns the path relative to the current blend file using the "//" prefix.
:arg start: Relative to this path, when not set the current filename is used.
:type start: string
"""
if not path.startswith("//"):
if start is None:
start = _os.path.dirname(_bpy.data.filepath)
return "//" + _os.path.relpath(path, start)
return path
def clean_name(name, replace="_"):
"""
Returns a name with characters replaced that may cause problems under various circumstances, such as writing to a file.
All characters besides A-Z/a-z, 0-9 are replaced with "_"
or the replace argument if defined.
"""
unclean_chars = \
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\
\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\
\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\
\x2e\x2f\x3a\x3b\x3c\x3d\x3e\x3f\x40\x5b\x5c\x5d\x5e\x60\x7b\
\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\
\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\
\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\
\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\
\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\
\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\
\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\
\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\
\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe"
for ch in unclean_chars:
name = name.replace(ch, replace)
return name
def display_name(name):
"""
Creates a display string from name to be used menus and the user interface.
Capitalize the first letter in all lowercase names, mixed case names are kept as is.
Intended for use with filenames and module names.
"""
name_base = _os.path.splitext(name)[0]
# string replacements
name_base = name_base.replace("_colon_", ":")
name_base = name_base.replace("_", " ")
if name_base.islower():
return name_base.capitalize()
else:
return name_base
def resolve_ncase(path):
"""
Resolve a case insensitive path on a case sensitive system,
returning a string with the path if found else return the original path.
"""
import os
def _ncase_path_found(path):
if path=='' or os.path.exists(path):
return path, True
filename = os.path.basename(path) # filename may be a directory or a file
dirpath = os.path.dirname(path)
suffix = ""
if not filename: # dir ends with a slash?
if len(dirpath) < len(path):
suffix = path[:len(path)-len(dirpath)]
filename = os.path.basename(dirpath)
dirpath = os.path.dirname(dirpath)
if not os.path.exists(dirpath):
dirpath, found = _ncase_path_found(dirpath)
if not found:
return path, False
# at this point, the directory exists but not the file
# we are expecting 'dirpath' to be a directory, but it could be a file
if os.path.isdir(dirpath):
files = os.listdir(dirpath)
else:
return path, False
filename_low = filename.lower()
f_iter_nocase = None
for f_iter in files:
if f_iter.lower() == filename_low:
f_iter_nocase = f_iter
break
if f_iter_nocase:
return os.path.join(dirpath, f_iter_nocase) + suffix, True
else:
# cant find the right one, just return the path as is.
return path, False
ncase_path, found = _ncase_path_found(path)
return ncase_path if found else path
def ensure_ext(filepath, ext, case_sensitive=False):
"""
Return the path with the extension added its its not alredy set.
:arg ext: The extension to check for.
:type ext: string
:arg case_sensitive: Check for matching case when comparing extensions.
:type case_sensitive: bool
"""
import os
fn_base, fn_ext = os.path.splitext(filepath)
if fn_base and fn_ext:
if (case_sensitive and ext == fn_ext) or (ext.lower() == fn_ext.lower()):
return filepath
else:
return fn_base + ext
else:
return filepath + ext

@ -216,75 +216,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
_bpy_types._register_immediate = True
def expandpath(path):
"""
Returns the absolute path relative to the current blend file using the "//" prefix.
"""
if path.startswith("//"):
return _os.path.join(_os.path.dirname(_bpy.data.filepath), path[2:])
return path
def relpath(path, start=None):
"""
Returns the path relative to the current blend file using the "//" prefix.
:arg start: Relative to this path, when not set the current filename is used.
:type start: string
"""
if not path.startswith("//"):
if start is None:
start = _os.path.dirname(_bpy.data.filepath)
return "//" + _os.path.relpath(path, start)
return path
def clean_name(name, replace="_"):
"""
Returns a name with characters replaced that may cause problems under various circumstances, such as writing to a file.
All characters besides A-Z/a-z, 0-9 are replaced with "_"
or the replace argument if defined.
"""
unclean_chars = \
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\
\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\
\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\
\x2e\x2f\x3a\x3b\x3c\x3d\x3e\x3f\x40\x5b\x5c\x5d\x5e\x60\x7b\
\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\
\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\
\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\
\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\
\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\
\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\
\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\
\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\
\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe"
for ch in unclean_chars:
name = name.replace(ch, replace)
return name
def display_name(name):
"""
Creates a display string from name to be used menus and the user interface.
Capitalize the first letter in all lowercase names, mixed case names are kept as is.
Intended for use with filenames and module names.
"""
name_base = _os.path.splitext(name)[0]
# string replacements
name_base = name_base.replace("_colon_", ":")
name_base = name_base.replace("_", " ")
if name_base.islower():
return name_base.capitalize()
else:
return name_base
# base scripts

@ -718,7 +718,7 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
if f.startswith("."):
continue
preset_name = bpy.utils.display_name(f)
preset_name = bpy.path.display_name(f)
props = layout.operator(operator, text=preset_name)
for attr, value in props_default.items():

@ -537,7 +537,7 @@ def generate_test_all(context, GRAPH=False):
base_name = os.path.splitext(bpy.data.filepath)[0]
for obj, obj_new in new_objects:
for obj in (obj, obj_new):
fn = base_name + "-" + bpy.utils.clean_name(obj.name)
fn = base_name + "-" + bpy.path.clean_name(obj.name)
path_dot = fn + ".dot"
path_png = fn + ".png"

@ -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):

@ -58,7 +58,7 @@ class EditExternally(bpy.types.Operator):
def execute(self, context):
import os
import subprocess
filepath = bpy.utils.expandpath(self.properties.filepath)
filepath = bpy.path.abspath(self.properties.filepath)
if not os.path.exists(filepath):
self.report('ERROR', "Image path '%s' not found." % filepath)
@ -93,7 +93,7 @@ class SaveDirty(bpy.types.Operator):
unique_paths = set()
for image in bpy.data.images:
if image.dirty:
filepath = bpy.utils.expandpath(image.filepath)
filepath = bpy.path.abspath(image.filepath)
if "\\" not in filepath and "/" not in filepath:
self.report({'WARNING'}, "Invalid path: " + filepath)
elif filepath in unique_paths:
@ -135,7 +135,7 @@ class ProjectEdit(bpy.types.Operator):
filepath = os.path.basename(bpy.data.filepath)
filepath = os.path.splitext(filepath)[0]
# filepath = bpy.utils.clean_name(filepath) # fixes <memory> rubbish, needs checking
# filepath = bpy.path.clean_name(filepath) # fixes <memory> rubbish, needs checking
if filepath.startswith(".") or filepath == "":
# TODO, have a way to check if the file is saved, assume .B25.blend
@ -147,12 +147,12 @@ class ProjectEdit(bpy.types.Operator):
obj = context.object
if obj:
filepath += "_" + bpy.utils.clean_name(obj.name)
filepath += "_" + bpy.path.clean_name(obj.name)
filepath_final = filepath + "." + EXT
i = 0
while os.path.exists(bpy.utils.expandpath(filepath_final)):
while os.path.exists(bpy.path.abspath(filepath_final)):
filepath_final = filepath + ("%.3d.%s" % (i, EXT))
i += 1

@ -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):

@ -79,7 +79,7 @@ class PlayRenderedAnim(bpy.types.Operator):
preset = prefs.filepaths.animation_player_preset
player_path = prefs.filepaths.animation_player
file_path = bpy.utils.expandpath(rd.output_path)
file_path = bpy.path.abspath(rd.output_path)
is_movie = rd.is_movie_format
# try and guess a command line if it doesn't exist
@ -105,7 +105,7 @@ class PlayRenderedAnim(bpy.types.Operator):
# works for movies and images
file = rd.frame_path(frame=scene.frame_start)
file = bpy.utils.expandpath(file) # expand '//'
file = bpy.path.abspath(file) # expand '//'
cmd = [player_path]
# extra options, fps controls etc.

@ -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')
@ -113,7 +114,9 @@ class ExportUVLayout(bpy.types.Operator):
mode = self.properties.mode
file = open(self.properties.filepath, "w")
filepath = self.properties.filepath
filepath = bpy.path.ensure_ext(filepath, "." + mode.lower())
file = open(filepath, "w")
fw = file.write
if mode == 'SVG':

@ -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):

@ -478,7 +478,7 @@ class WM_OT_path_open(bpy.types.Operator):
import os
import subprocess
filepath = bpy.utils.expandpath(self.properties.filepath)
filepath = bpy.path.abspath(self.properties.filepath)
filepath = os.path.normpath(filepath)
if not os.path.exists(filepath):

@ -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')

@ -19,9 +19,7 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
################################################
# Generic Panels (Independent of DataType)
@ -31,15 +29,12 @@ class MotionPathButtonsPanel():
bl_label = "Motion Paths"
bl_default_closed = True
def draw_settings(self, context, avs, wide_ui, bones=False):
def draw_settings(self, context, avs, bones=False):
layout = self.layout
mps = avs.motion_paths
if wide_ui:
layout.prop(mps, "type", expand=True)
else:
layout.prop(mps, "type", text="")
layout.prop(mps, "type", expand=True)
split = layout.split()
@ -56,8 +51,7 @@ class MotionPathButtonsPanel():
if bones:
col.row().prop(mps, "bake_location", expand=True)
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Display:")
col.prop(mps, "show_frame_numbers", text="Frame Numbers")
col.prop(mps, "highlight_keyframes", text="Keyframes")
@ -77,12 +71,8 @@ class OnionSkinButtonsPanel():
layout = self.layout
arm = context.armature
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(arm, "ghost_type", expand=True)
else:
layout.prop(arm, "ghost_type", text="")
layout.prop(arm, "ghost_type", expand=True)
split = layout.split()
@ -97,8 +87,7 @@ class OnionSkinButtonsPanel():
sub.prop(arm, "ghost_step", text="Range")
sub.prop(arm, "ghost_size", text="Step")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Display:")
col.prop(arm, "ghost_only_selected", text="Selected Only")

@ -20,15 +20,14 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
def poll(self, context):
@staticmethod
def poll(context):
return context.armature
@ -42,18 +41,14 @@ class DATA_PT_context_arm(DataButtonsPanel, bpy.types.Panel):
ob = context.object
arm = context.armature
space = context.space_data
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif arm:
split.template_ID(space, "pin_id")
split.separator()
else:
layout.template_ID(ob, "data")
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif arm:
split.template_ID(space, "pin_id")
split.separator()
class DATA_PT_custom_props_arm(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
@ -67,12 +62,8 @@ class DATA_PT_skeleton(DataButtonsPanel, bpy.types.Panel):
layout = self.layout
arm = context.armature
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(arm, "pose_position", expand=True)
else:
layout.prop(arm, "pose_position", text="")
layout.prop(arm, "pose_position", expand=True)
split = layout.split()
@ -90,8 +81,7 @@ class DATA_PT_skeleton(DataButtonsPanel, bpy.types.Panel):
col.prop(arm, "deform_vertexgroups", text="Vertex Groups")
col.prop(arm, "deform_envelope", text="Envelopes")
if wide_ui:
col = split.column()
col = split.column()
col.prop(arm, "deform_quaternion", text="Quaternion")
@ -103,12 +93,8 @@ class DATA_PT_display(DataButtonsPanel, bpy.types.Panel):
ob = context.object
arm = context.armature
wide_ui = context.region.width > narrowui
if wide_ui:
layout.row().prop(arm, "drawtype", expand=True)
else:
layout.row().prop(arm, "drawtype", text="")
layout.row().prop(arm, "drawtype", expand=True)
split = layout.split()
@ -117,8 +103,7 @@ class DATA_PT_display(DataButtonsPanel, bpy.types.Panel):
col.prop(arm, "draw_axes", text="Axes")
col.prop(arm, "draw_custom_bone_shapes", text="Shapes")
if wide_ui:
col = split.column()
col = split.column()
col.prop(arm, "draw_group_colors", text="Colors")
col.prop(ob, "x_ray", text="X-Ray")
col.prop(arm, "delay_deform", text="Delay Refresh")
@ -127,7 +112,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):
@ -135,7 +121,6 @@ class DATA_PT_bone_groups(DataButtonsPanel, bpy.types.Panel):
ob = context.object
pose = ob.pose
wide_ui = context.region.width > narrowui
row = layout.row()
row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2)
@ -157,8 +142,7 @@ class DATA_PT_bone_groups(DataButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(group, "color_set")
if group.color_set:
if wide_ui:
col = split.column()
col = split.column()
col.template_triColorSet(group, "colors")
row = layout.row()
@ -181,12 +165,8 @@ class DATA_PT_ghost(DataButtonsPanel, bpy.types.Panel):
layout = self.layout
arm = context.armature
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(arm, "ghost_type", expand=True)
else:
layout.prop(arm, "ghost_type", text="")
layout.prop(arm, "ghost_type", expand=True)
split = layout.split()
@ -201,8 +181,7 @@ class DATA_PT_ghost(DataButtonsPanel, bpy.types.Panel):
sub.prop(arm, "ghost_step", text="Range")
sub.prop(arm, "ghost_size", text="Step")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Display:")
col.prop(arm, "ghost_only_selected", text="Selected Only")
@ -211,7 +190,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)
@ -221,7 +201,6 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel, bpy.types.Panel):
ob = context.object
itasc = ob.pose.ik_param
wide_ui = (context.region.width > narrowui)
row = layout.row()
row.prop(ob.pose, "ik_solver")
@ -238,8 +217,7 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(itasc, "precision")
if wide_ui:
col = split.column()
col = split.column()
col.prop(itasc, "num_iter")
@ -267,7 +245,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)
@ -275,9 +254,8 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
layout.separator()
@ -286,8 +264,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
col = split.column()
col.operator("pose.paths_calculate", text="Calculate Paths")
if wide_ui:
col = split.column()
col = split.column()
col.operator("pose.paths_clear", text="Clear Paths")
@ -295,7 +272,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)
@ -303,9 +281,8 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): #, bpy.types.Panel): # inhe
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
def register():
pass

@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
class PoseTemplateSettings(bpy.types.IDPropertyGroup):
pass
@ -44,7 +42,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
@ -212,7 +211,7 @@ class Graph(bpy.types.Operator):
import bpy
reload(graphviz_export)
obj = bpy.context.object
path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.utils.clean_name(obj.name)
path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name)
path_dot = path + ".dot"
path_png = path + ".png"
saved = graphviz_export.graph_armature(bpy.context.object, path_dot, CONSTRAINTS=False, DRIVERS=False)
@ -249,7 +248,7 @@ class AsScript(bpy.types.Operator):
def invoke(self, context, event):
import os
obj = context.object
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.utils.clean_name(obj.name) + ".py"
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + ".py"
wm = context.manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@ -262,7 +261,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 +280,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')
@ -304,7 +305,7 @@ class INFO_MT_armature_metarig_add(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
for submodule_type in rigify.get_submodule_types():
text = bpy.utils.display_name(submodule_type)
text = bpy.path.display_name(submodule_type)
layout.operator("pose.metarig_sample_add", text=text, icon='OUTLINER_OB_ARMATURE').metarig_type = submodule_type
menu_func = (lambda self, context: self.layout.menu("INFO_MT_armature_metarig_add", icon='OUTLINER_OB_ARMATURE'))

@ -20,15 +20,14 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class BoneButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "bone"
def poll(self, context):
@staticmethod
def poll(context):
return (context.bone or context.edit_bone)
@ -67,72 +66,50 @@ class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
ob = context.object
bone = context.bone
wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
if wide_ui:
row = layout.row()
row.column().prop(bone, "head")
row.column().prop(bone, "tail")
row = layout.row()
row.column().prop(bone, "head")
row.column().prop(bone, "tail")
col = row.column()
sub = col.column(align=True)
sub.label(text="Roll:")
sub.prop(bone, "roll", text="")
sub.label()
sub.prop(bone, "lock")
else:
col = layout.column()
col.prop(bone, "head")
col.prop(bone, "tail")
col.prop(bone, "roll")
col.prop(bone, "lock")
col = row.column()
sub = col.column(align=True)
sub.label(text="Roll:")
sub.prop(bone, "roll", text="")
sub.label()
sub.prop(bone, "lock")
else:
pchan = ob.pose.bones[context.bone.name]
if wide_ui:
row = layout.row()
col = row.column()
col.prop(pchan, "location")
col.active = not (bone.parent and bone.connected)
row = layout.row()
col = row.column()
col.prop(pchan, "location")
col.active = not (bone.parent and bone.connected)
col = row.column()
if pchan.rotation_mode == 'QUATERNION':
col.prop(pchan, "rotation_quaternion", text="Rotation")
elif pchan.rotation_mode == 'AXIS_ANGLE':
#col.label(text="Rotation")
#col.prop(pchan, "rotation_angle", text="Angle")
#col.prop(pchan, "rotation_axis", text="Axis")
col.prop(pchan, "rotation_axis_angle", text="Rotation")
else:
col.prop(pchan, "rotation_euler", text="Rotation")
row.column().prop(pchan, "scale")
layout.prop(pchan, "rotation_mode")
col = row.column()
if pchan.rotation_mode == 'QUATERNION':
col.prop(pchan, "rotation_quaternion", text="Rotation")
elif pchan.rotation_mode == 'AXIS_ANGLE':
#col.label(text="Rotation")
#col.prop(pchan, "rotation_angle", text="Angle")
#col.prop(pchan, "rotation_axis", text="Axis")
col.prop(pchan, "rotation_axis_angle", text="Rotation")
else:
col = layout.column()
sub = col.column()
sub.active = not (bone.parent and bone.connected)
sub.prop(pchan, "location")
col.label(text="Rotation:")
col.prop(pchan, "rotation_mode", text="")
if pchan.rotation_mode == 'QUATERNION':
col.prop(pchan, "rotation_quaternion", text="")
elif pchan.rotation_mode == 'AXIS_ANGLE':
col.prop(pchan, "rotation_axis_angle", text="")
else:
col.prop(pchan, "rotation_euler", text="")
col.prop(pchan, "scale")
col.prop(pchan, "rotation_euler", text="Rotation")
row.column().prop(pchan, "scale")
layout.prop(pchan, "rotation_mode")
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):
@ -168,7 +145,6 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
ob = context.object
bone = context.bone
arm = context.armature
wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
@ -188,8 +164,7 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
col.label(text="Bone Group:")
col.prop_object(pchan, "bone_group", ob.pose, "bone_groups", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Parent:")
if context.bone:
col.prop(bone, "parent", text="")
@ -209,7 +184,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):
@ -217,7 +193,6 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
ob = context.object
bone = context.bone
wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
@ -233,8 +208,7 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
col.prop(bone, "draw_wire", text="Wireframe")
col.prop(bone, "hide", text="Hide")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Custom Shape:")
col.prop(pchan, "custom_shape", text="")
@ -246,7 +220,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):
@ -255,7 +230,6 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
ob = context.object
bone = context.bone
pchan = ob.pose.bones[bone.name]
wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(ob.pose, "ik_solver")
@ -267,15 +241,12 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
row.active = pchan.ik_dof_x and pchan.has_ik
if wide_ui:
split = layout.split(percentage=0.25)
sub = split.row()
else:
sub = layout.column(align=True)
split = layout.split(percentage=0.25)
sub = split.row()
sub.prop(pchan, "ik_limit_x", text="Limit")
sub.active = pchan.ik_dof_x and pchan.has_ik
if wide_ui:
sub = split.row(align=True)
sub = split.row(align=True)
sub.prop(pchan, "ik_min_x", text="")
sub.prop(pchan, "ik_max_x", text="")
sub.active = pchan.ik_dof_x and pchan.ik_limit_x and pchan.has_ik
@ -287,15 +258,13 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
row.active = pchan.ik_dof_y and pchan.has_ik
if wide_ui:
split = layout.split(percentage=0.25)
sub = split.row()
else:
sub = layout.column(align=True)
split = layout.split(percentage=0.25)
sub = split.row()
sub.prop(pchan, "ik_limit_y", text="Limit")
sub.active = pchan.ik_dof_y and pchan.has_ik
if wide_ui:
sub = split.row(align=True)
sub = split.row(align=True)
sub.prop(pchan, "ik_min_y", text="")
sub.prop(pchan, "ik_max_y", text="")
sub.active = pchan.ik_dof_y and pchan.ik_limit_y and pchan.has_ik
@ -307,22 +276,18 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
sub.active = pchan.ik_dof_z and pchan.has_ik
if wide_ui:
split = layout.split(percentage=0.25)
sub = split.row()
else:
sub = layout.column(align=True)
split = layout.split(percentage=0.25)
sub = split.row()
sub.prop(pchan, "ik_limit_z", text="Limit")
sub.active = pchan.ik_dof_z and pchan.has_ik
if wide_ui:
sub = split.row(align=True)
sub = split.row(align=True)
sub.prop(pchan, "ik_min_z", text="")
sub.prop(pchan, "ik_max_z", text="")
sub.active = pchan.ik_dof_z and pchan.ik_limit_z and pchan.has_ik
split = layout.split()
split.prop(pchan, "ik_stretch", text="Stretch", slider=True)
if wide_ui:
split.label()
split.label()
split.active = pchan.has_ik
if ob.pose.ik_solver == 'ITASC':
@ -330,8 +295,7 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(pchan, "ik_rot_control", text="Control Rotation")
col.active = pchan.has_ik
if wide_ui:
col = split.column()
col = split.column()
col.prop(pchan, "ik_rot_weight", text="Weight", slider=True)
col.active = pchan.has_ik
# not supported yet
@ -356,7 +320,6 @@ class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
layout = self.layout
bone = context.bone
wide_ui = context.region.width > narrowui
if not bone:
bone = context.edit_bone
@ -378,8 +341,7 @@ class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
sub.prop(bone, "head_radius", text="Head")
sub.prop(bone, "tail_radius", text="Tail")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Curved Bones:")
sub = col.column(align=True)

@ -20,66 +20,64 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
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
ob = context.object
cam = context.camera
space = context.space_data
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif cam:
split.template_ID(space, "pin_id")
split.separator()
else:
if ob:
layout.template_ID(ob, "data")
elif cam:
layout.template_ID(space, "pin_id")
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif cam:
split.template_ID(space, "pin_id")
split.separator()
class DATA_PT_custom_props_camera(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.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
cam = context.camera
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(cam, "type", expand=True)
else:
layout.prop(cam, "type", text="")
layout.prop(cam, "type", expand=True)
split = layout.split()
@ -89,8 +87,7 @@ class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
col.prop(cam, "lens", text="Angle")
elif cam.lens_unit == 'DEGREES':
col.prop(cam, "angle")
if wide_ui:
col = split.column()
col = split.column()
col.prop(cam, "lens_unit", text="")
elif cam.type == 'ORTHO':
@ -105,8 +102,7 @@ class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
col.prop(cam, "shift_x", text="X")
col.prop(cam, "shift_y", text="Y")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.label(text="Clipping:")
col.prop(cam, "clip_start", text="Start")
col.prop(cam, "clip_end", text="End")
@ -118,10 +114,8 @@ class DATA_PT_camera(DataButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(cam, "dof_object", text="")
if wide_ui:
col = split.column()
else:
col = col.column()
col = split.column()
if cam.dof_object != None:
col.enabled = False
col.prop(cam, "dof_distance", text="Distance")
@ -131,11 +125,15 @@ 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
cam = context.camera
wide_ui = context.region.width > narrowui
split = layout.split()
@ -145,8 +143,7 @@ class DATA_PT_camera_display(DataButtonsPanel, bpy.types.Panel):
col.prop(cam, "show_title_safe", text="Title Safe")
col.prop(cam, "show_name", text="Name")
if wide_ui:
col = split.column()
col = split.column()
col.prop(cam, "draw_size", text="Size")
col.separator()
col.prop(cam, "show_passepartout", text="Passepartout")

@ -20,29 +20,30 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
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)
@ -57,20 +58,15 @@ class DATA_PT_context_curve(DataButtonsPanel, bpy.types.Panel):
ob = context.object
curve = context.curve
space = context.space_data
wide_ui = context.region.width > narrowui
split = layout.split(percentage=0.65)
if wide_ui:
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif curve:
split.template_ID(space, "pin_id")
split.separator()
else:
layout.template_ID(ob, "data")
if ob:
split.template_ID(ob, "data")
split.separator()
elif curve:
split.template_ID(space, "pin_id")
split.separator()
class DATA_PT_custom_props_curve(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
@ -85,7 +81,6 @@ class DATA_PT_shape_curve(DataButtonsPanel, bpy.types.Panel):
ob = context.object
curve = context.curve
wide_ui = context.region.width > narrowui
is_surf = (ob.type == 'SURFACE')
is_curve = (ob.type == 'CURVE')
is_text = (ob.type == 'TEXT')
@ -109,8 +104,7 @@ class DATA_PT_shape_curve(DataButtonsPanel, bpy.types.Panel):
col.label(text="Display:")
col.prop(curve, "fast", text="Fast Editing")
if wide_ui:
col = split.column()
col = split.column()
if is_surf:
sub = col.column(align=True)
@ -133,7 +127,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
@ -144,7 +139,6 @@ class DATA_PT_geometry_curve(DataButtonsPanel, bpy.types.Panel):
layout = self.layout
curve = context.curve
wide_ui = context.region.width > narrowui
split = layout.split()
@ -155,8 +149,7 @@ class DATA_PT_geometry_curve(DataButtonsPanel, bpy.types.Panel):
col.label(text="Taper Object:")
col.prop(curve, "taper_object", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Bevel:")
col.prop(curve, "bevel_depth", text="Depth")
col.prop(curve, "bevel_resolution", text="Resolution")
@ -176,7 +169,6 @@ class DATA_PT_pathanim(DataButtonsPanelCurve, bpy.types.Panel):
layout = self.layout
curve = context.curve
wide_ui = context.region.width > narrowui
layout.active = curve.use_path
@ -189,9 +181,9 @@ class DATA_PT_pathanim(DataButtonsPanelCurve, bpy.types.Panel):
col = split.column()
col.prop(curve, "use_path_follow")
col.prop(curve, "use_stretch")
col.prop(curve, "use_deform_bounds")
if wide_ui:
col = split.column()
col = split.column()
col.prop(curve, "use_radius")
col.prop(curve, "use_time_offset", text="Offset Children")
@ -270,7 +262,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):
@ -278,21 +271,16 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
text = context.curve
char = context.curve.edit_format
wide_ui = context.region.width > narrowui
layout.template_ID(text, "font", open="font.open", unlink="font.unlink")
#if wide_ui:
# layout.prop(text, "font")
#else:
# layout.prop(text, "font", text="")
#layout.prop(text, "font")
split = layout.split()
col = split.column()
col.prop(text, "text_size", text="Size")
if wide_ui:
col = split.column()
col = split.column()
col.prop(text, "shear")
split = layout.split()
@ -301,8 +289,7 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
col.label(text="Object Font:")
col.prop(text, "family", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Text on Curve:")
col.prop(text, "text_on_curve", text="")
@ -314,8 +301,7 @@ class DATA_PT_font(DataButtonsPanel, bpy.types.Panel):
colsub.prop(text, "ul_position", text="Position")
colsub.prop(text, "ul_height", text="Thickness")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Character:")
col.prop(char, "bold")
col.prop(char, "italic")
@ -332,20 +318,17 @@ 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):
layout = self.layout
text = context.curve
wide_ui = context.region.width > narrowui
layout.label(text="Align:")
if wide_ui:
layout.prop(text, "spacemode", expand=True)
else:
layout.prop(text, "spacemode", text="")
layout.prop(text, "spacemode", expand=True)
split = layout.split()
@ -355,8 +338,7 @@ class DATA_PT_paragraph(DataButtonsPanel, bpy.types.Panel):
col.prop(text, "word_spacing", text="Word")
col.prop(text, "line_dist", text="Line")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.label(text="Offset:")
col.prop(text, "offset_x", text="X")
col.prop(text, "offset_y", text="Y")
@ -365,20 +347,19 @@ 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):
layout = self.layout
text = context.curve
wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.operator("font.textbox_add", icon='ZOOMIN')
if wide_ui:
col = split.column()
col = split.column()
for i, box in enumerate(text.textboxes):
@ -394,8 +375,7 @@ class DATA_PT_textboxes(DataButtonsPanel, bpy.types.Panel):
col.prop(box, "width", text="Width")
col.prop(box, "height", text="Height")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.label(text="Offset:")
col.prop(box, "x", text="X")

@ -19,15 +19,14 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
def poll(self, context):
@staticmethod
def poll(context):
return (context.object and context.object.type == 'EMPTY')
@ -38,12 +37,8 @@ class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(ob, "empty_draw_type", text="Display")
else:
layout.prop(ob, "empty_draw_type", text="")
layout.prop(ob, "empty_draw_type", text="Display")
layout.prop(ob, "empty_draw_size", text="Size")

@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class LAMP_MT_sunsky_presets(bpy.types.Menu):
bl_label = "Sun & Sky Presets"
@ -36,14 +34,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,48 +52,53 @@ 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
ob = context.object
lamp = context.lamp
space = context.space_data
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif lamp:
split.template_ID(space, "pin_id")
split.separator()
else:
if ob:
layout.template_ID(ob, "data")
elif lamp:
layout.template_ID(space, "pin_id")
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif lamp:
split.template_ID(space, "pin_id")
split.separator()
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
lamp = context.lamp
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(lamp, "type", expand=True)
else:
layout.prop(lamp, "type", text="")
layout.prop(lamp, "type", expand=True)
split = layout.split()
@ -119,8 +124,7 @@ class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
col.prop(lamp, "distance")
col.prop(lamp, "gamma")
if wide_ui:
col = split.column()
col = split.column()
col.prop(lamp, "negative")
col.prop(lamp, "layer", text="This Layer Only")
col.prop(lamp, "specular")
@ -131,16 +135,16 @@ 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
lamp = context.lamp.sky
wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.prop(lamp, "use_sky")
@ -165,8 +169,7 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
sub.row().prop(lamp, "sky_color_space", expand=True)
sub.prop(lamp, "sky_exposure", text="Exposure")
if wide_ui:
col = split.column()
col = split.column()
col.active = lamp.use_sky
col.label(text="Horizon:")
sub = col.column()
@ -191,8 +194,7 @@ class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
col.prop(lamp, "sun_intensity", text="Sun")
col.prop(lamp, "atmosphere_distance_factor", text="Distance")
if wide_ui:
col = split.column()
col = split.column()
col.active = lamp.use_atmosphere
col.label(text="Scattering:")
sub = col.column(align=True)
@ -204,21 +206,32 @@ 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
lamp = context.lamp
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(lamp, "shadow_method", expand=True)
else:
layout.prop(lamp, "shadow_method", text="")
layout.prop(lamp, "shadow_method", expand=True)
if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA':
split = layout.split()
col= split.column()
col.label(text="Form factor sampling:")
sub=col.row(align=True)
if lamp.shape == 'SQUARE':
sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
elif lamp.shape == 'RECTANGLE':
sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
if lamp.shadow_method != 'NOSHADOW':
split = layout.split()
@ -226,65 +239,51 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(lamp, "shadow_color", text="")
if wide_ui:
col = split.column()
col = split.column()
col.prop(lamp, "shadow_layer", text="This Layer Only")
col.prop(lamp, "only_shadow")
if lamp.shadow_method == 'RAY_SHADOW':
col = layout.column()
split = layout.split()
col = split.column()
col.label(text="Sampling:")
if wide_ui:
col.row().prop(lamp, "shadow_ray_sampling_method", expand=True)
else:
col.prop(lamp, "shadow_ray_sampling_method", text="")
if lamp.type in ('POINT', 'SUN', 'SPOT'):
split = layout.split()
col = split.column()
col.prop(lamp, "shadow_soft_size", text="Soft Size")
col.prop(lamp, "shadow_ray_samples", text="Samples")
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
if wide_ui:
col = split.column()
sub = col.row()
sub.prop(lamp, "shadow_ray_samples", text="Samples")
sub.prop(lamp, "shadow_soft_size", text="Soft Size")
elif lamp.type == 'AREA':
split = layout.split()
col = split.column()
sub = col.row(align=True)
if lamp.shape == 'SQUARE':
col.prop(lamp, "shadow_ray_samples_x", text="Samples")
sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
elif lamp.shape == 'RECTANGLE':
col.prop(lamp, "shadow_ray_samples_x", text="Samples X")
col.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
if wide_ui:
col = split.column()
elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
if wide_ui:
col = split.column()
col.prop(lamp, "umbra")
col.prop(lamp, "dither")
col.prop(lamp, "jitter")
else:
if wide_ui:
col = split.column()
col.row().prop(lamp, "shadow_ray_sampling_method", expand=True)
split = layout.split()
col = split.column()
if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
col.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
col = split.column()
if lamp.type == 'AREA' and lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
col = split.column()
col = split.column()
col.prop(lamp, "umbra")
col.prop(lamp, "dither")
col.prop(lamp, "jitter")
elif lamp.shadow_method == 'BUFFER_SHADOW':
col = layout.column()
col.label(text="Buffer Type:")
if wide_ui:
col.row().prop(lamp, "shadow_buffer_type", expand=True)
else:
col.row().prop(lamp, "shadow_buffer_type", text="")
col.row().prop(lamp, "shadow_buffer_type", expand=True)
if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY', 'DEEP'):
split = layout.split()
@ -296,8 +295,7 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
sub.prop(lamp, "shadow_buffer_soft", text="Soft")
sub.prop(lamp, "shadow_buffer_bias", text="Bias")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Sample Buffers:")
col.prop(lamp, "shadow_sample_buffers", text="")
sub = col.column(align=True)
@ -317,8 +315,7 @@ class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
sub.active = not lamp.auto_clip_start
sub.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
if wide_ui:
col = split.column()
col = split.column()
col.prop(lamp, "auto_clip_end", text="Autoclip End")
sub = col.column()
sub.active = not lamp.auto_clip_end
@ -329,22 +326,23 @@ 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
lamp = context.lamp
layout = self.layout
split = layout.split()
col = split.column()
col.row().prop(lamp, "shape", expand=True)
sub = col.row(align=True)
sub = col.column(align=True)
if (lamp.shape == 'SQUARE'):
sub.prop(lamp, "size")
elif (lamp.shape == 'RECTANGLE'):
@ -356,16 +354,16 @@ 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
lamp = context.lamp
wide_ui = context.region.width > narrowui
split = layout.split()
@ -376,10 +374,8 @@ class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
col.prop(lamp, "square")
col.prop(lamp, "show_cone")
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.prop(lamp, "halo")
sub = col.column(align=True)
sub.active = lamp.halo
@ -393,11 +389,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

@ -20,15 +20,14 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
def poll(self, context):
@staticmethod
def poll(context):
return context.lattice
@ -42,21 +41,14 @@ class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel):
ob = context.object
lat = context.lattice
space = context.space_data
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif lat:
split.template_ID(space, "pin_id")
split.separator()
else:
if ob:
layout.template_ID(ob, "data")
elif lat:
layout.template_ID(space, "pin_id")
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif lat:
split.template_ID(space, "pin_id")
split.separator()
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
@ -70,27 +62,23 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
layout = self.layout
lat = context.lattice
wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(lat, "points_u")
if wide_ui:
col = split.column()
col = split.column()
col.prop(lat, "interpolation_type_u", text="")
split = layout.split()
col = split.column()
col.prop(lat, "points_v")
if wide_ui:
col = split.column()
col = split.column()
col.prop(lat, "interpolation_type_v", text="")
split = layout.split()
col = split.column()
col.prop(lat, "points_w")
if wide_ui:
col = split.column()
col = split.column()
col.prop(lat, "interpolation_type_w", text="")
row = layout.row()

@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class MESH_MT_vertex_group_specials(bpy.types.Menu):
bl_label = "Vertex Group Specials"
@ -54,53 +52,56 @@ 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
ob = context.object
mesh = context.mesh
space = context.space_data
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif mesh:
split.template_ID(space, "pin_id")
split.separator()
else:
if ob:
layout.template_ID(ob, "data")
elif mesh:
layout.template_ID(space, "pin_id")
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif mesh:
split.template_ID(space, "pin_id")
split.separator()
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
mesh = context.mesh
wide_ui = context.region.width > narrowui
split = layout.split()
@ -110,10 +111,8 @@ class DATA_PT_normals(DataButtonsPanel, bpy.types.Panel):
sub.active = mesh.autosmooth
sub.prop(mesh, "autosmooth_angle", text="Angle")
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.prop(mesh, "double_sided")
@ -121,6 +120,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 +137,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 +186,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
@ -190,7 +198,6 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
ob = context.object
key = ob.data.shape_keys
kb = ob.active_shape_key
wide_ui = context.region.width > narrowui
enable_edit = ob.mode != 'EDIT'
enable_edit_value = False
@ -223,17 +230,11 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
split = layout.split(percentage=0.4)
row = split.row()
row.enabled = enable_edit
if wide_ui:
row.prop(key, "relative")
row.prop(key, "relative")
row = split.row()
row.alignment = 'RIGHT'
if not wide_ui:
layout.prop(key, "relative")
row = layout.row()
sub = row.row(align=True)
subsub = sub.row(align=True)
subsub.active = enable_edit_value
@ -261,8 +262,7 @@ class DATA_PT_shape_keys(DataButtonsPanel, bpy.types.Panel):
col.prop(kb, "slider_min", text="Min")
col.prop(kb, "slider_max", text="Max")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.active = enable_edit_value
col.label(text="Blend:")
col.prop_object(kb, "vertex_group", ob, "vertex_groups", text="")
@ -278,6 +278,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
@ -297,11 +302,12 @@ class DATA_PT_uv_texture(DataButtonsPanel, bpy.types.Panel):
layout.prop(lay, "name")
class DATA_PT_texface(DataButtonsPanel):
class DATA_PT_texface(DataButtonsPanel, bpy.types.Panel):
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
@ -311,7 +317,6 @@ class DATA_PT_texface(DataButtonsPanel):
layout = self.layout
col = layout.column()
wide_ui = context.region.width > narrowui
me = context.mesh
tf = me.faces.active_tface
@ -329,8 +334,7 @@ class DATA_PT_texface(DataButtonsPanel):
col.prop(tf, "twoside")
col.prop(tf, "object_color")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tf, "halo")
col.prop(tf, "billboard")
@ -348,6 +352,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

@ -20,15 +20,14 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
def poll(self, context):
@staticmethod
def poll(context):
return context.meta_ball
@ -42,21 +41,14 @@ class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel):
ob = context.object
mball = context.meta_ball
space = context.space_data
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif mball:
split.template_ID(space, "pin_id")
split.separator()
else:
if ob:
layout.template_ID(ob, "data")
elif mball:
layout.template_ID(space, "pin_id")
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "data")
split.separator()
elif mball:
split.template_ID(space, "pin_id")
split.separator()
class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
@ -70,7 +62,6 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
layout = self.layout
mball = context.meta_ball
wide_ui = context.region.width > narrowui
split = layout.split()
@ -80,34 +71,27 @@ class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
sub.prop(mball, "wire_size", text="View")
sub.prop(mball, "render_size", text="Render")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Settings:")
col.prop(mball, "threshold", text="Threshold")
layout.label(text="Update:")
if wide_ui:
layout.prop(mball, "flag", expand=True)
else:
layout.prop(mball, "flag", text="")
layout.prop(mball, "flag", expand=True)
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):
layout = self.layout
metaelem = context.meta_ball.active_element
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(metaelem, "type")
else:
layout.prop(metaelem, "type", text="")
layout.prop(metaelem, "type")
split = layout.split()
@ -117,8 +101,7 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
col.prop(metaelem, "negative", text="Negative")
col.prop(metaelem, "hide", text="Hide")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
if metaelem.type in ('CUBE', 'ELLIPSOID'):
col.label(text="Size:")

@ -19,9 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
narrowmod = 260
class DataButtonsPanel():
bl_space_type = 'PROPERTIES'
@ -36,30 +33,27 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
compact_mod = context.region.width < narrowmod
layout.operator_menu_enum("object.modifier_add", "type")
for md in ob.modifiers:
box = layout.template_modifier(md, compact=compact_mod)
box = layout.template_modifier(md)
if box:
# match enum type to our functions, avoids a lookup table.
getattr(self, md.type)(box, ob, md, wide_ui)
getattr(self, md.type)(box, ob, md)
# the mt.type enum is (ab)used for a lookup on function names
# ...to avoid lengthy if statements
# so each type must have a function here.
def ARMATURE(self, layout, ob, md, wide_ui):
def ARMATURE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Vertex Group::")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
@ -73,18 +67,13 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "use_vertex_groups", text="Vertex Groups")
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Deformation:")
col.prop(md, "quaternion")
col.prop(md, "multi_modifier")
def ARRAY(self, layout, ob, md, wide_ui):
if wide_ui:
layout.prop(md, "fit_type")
else:
layout.prop(md, "fit_type", text="")
def ARRAY(self, layout, ob, md):
layout.prop(md, "fit_type")
if md.fit_type == 'FIXED_COUNT':
layout.prop(md, "count")
@ -111,8 +100,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
sub.prop(md, "merge_end_vertices", text="First Last")
sub.prop(md, "merge_distance", text="Distance")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "relative_offset")
sub = col.column()
sub.active = md.relative_offset
@ -131,14 +119,13 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "start_cap")
col.prop(md, "end_cap")
def BEVEL(self, layout, ob, md, wide_ui):
def BEVEL(self, layout, ob, md):
split = layout.split()
col = split.column()
col.prop(md, "width")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "only_vertices")
layout.label(text="Limit Method:")
@ -148,40 +135,35 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
elif md.limit_method == 'WEIGHT':
layout.row().prop(md, "edge_weight_method", expand=True)
def BOOLEAN(self, layout, ob, md, wide_ui):
def BOOLEAN(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Operation:")
col.prop(md, "operation", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
def BUILD(self, layout, ob, md, wide_ui):
def BUILD(self, layout, ob, md):
split = layout.split()
col = split.column()
col.prop(md, "frame_start")
col.prop(md, "length")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "randomize")
sub = col.column()
sub.active = md.randomize
sub.prop(md, "seed")
def CAST(self, layout, ob, md, wide_ui):
def CAST(self, layout, ob, md):
split = layout.split(percentage=0.25)
if wide_ui:
split.label(text="Cast Type:")
split.prop(md, "cast_type", text="")
else:
layout.prop(md, "cast_type", text="")
split.label(text="Cast Type:")
split.prop(md, "cast_type", text="")
split = layout.split(percentage=0.25)
@ -201,37 +183,35 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Control Object:")
col.prop(md, "object", text="")
if md.object:
col.prop(md, "use_transform")
def CLOTH(self, layout, ob, md, wide_ui):
def CLOTH(self, layout, ob, md):
layout.label(text="See Cloth panel.")
def COLLISION(self, layout, ob, md, wide_ui):
def COLLISION(self, layout, ob, md):
layout.label(text="See Collision panel.")
def CURVE(self, layout, ob, md, wide_ui):
def CURVE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
layout.label(text="Deformation Axis:")
layout.row().prop(md, "deform_axis", expand=True)
def DECIMATE(self, layout, ob, md, wide_ui):
def DECIMATE(self, layout, ob, md):
layout.prop(md, "ratio")
layout.label(text="Face Count: %s" % str(md.face_count))
def DISPLACE(self, layout, ob, md, wide_ui):
def DISPLACE(self, layout, ob, md):
split = layout.split()
col = split.column()
@ -240,8 +220,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Direction:")
col.prop(md, "direction", text="")
col.label(text="Texture Coordinates:")
@ -258,11 +237,10 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(md, "midlevel")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "strength")
def EDGE_SPLIT(self, layout, ob, md, wide_ui):
def EDGE_SPLIT(self, layout, ob, md):
split = layout.split()
col = split.column()
@ -271,11 +249,10 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
sub.active = md.use_edge_angle
sub.prop(md, "split_angle")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "use_sharp", text="Sharp Edges")
def EXPLODE(self, layout, ob, md, wide_ui):
def EXPLODE(self, layout, ob, md):
split = layout.split()
col = split.column()
@ -285,8 +262,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
sub.active = bool(md.vertex_group)
sub.prop(md, "protect")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "split_edges")
col.prop(md, "unborn")
col.prop(md, "alive")
@ -295,10 +271,10 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
layout.operator("object.explode_refresh", text="Refresh")
def FLUID_SIMULATION(self, layout, ob, md, wide_ui):
def FLUID_SIMULATION(self, layout, ob, md):
layout.label(text="See Fluid panel.")
def HOOK(self, layout, ob, md, wide_ui):
def HOOK(self, layout, ob, md):
split = layout.split()
col = split.column()
@ -307,8 +283,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
if md.object and md.object.type == 'ARMATURE':
col.label(text="Bone:")
col.prop_object(md, "subtarget", md.object.data, "bones", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@ -319,10 +294,8 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(md, "falloff")
col.prop(md, "force", slider=True)
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.operator("object.hook_reset", text="Reset")
col.operator("object.hook_recenter", text="Recenter")
@ -332,26 +305,24 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
row.operator("object.hook_select", text="Select")
row.operator("object.hook_assign", text="Assign")
def LATTICE(self, layout, ob, md, wide_ui):
def LATTICE(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Object:")
col.prop(md, "object", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
def MASK(self, layout, ob, md, wide_ui):
def MASK(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Mode:")
col.prop(md, "mode", text="")
if wide_ui:
col = split.column()
col = split.column()
if md.mode == 'ARMATURE':
col.label(text="Armature:")
col.prop(md, "armature", text="")
@ -363,15 +334,14 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
sub.active = bool(md.vertex_group)
sub.prop(md, "invert")
def MESH_DEFORM(self, layout, ob, md, wide_ui):
def MESH_DEFORM(self, layout, ob, md):
split = layout.split()
col = split.column()
sub = col.column()
sub.label(text="Object:")
sub.prop(md, "object", text="")
sub.active = not md.is_bound
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@ -391,16 +361,12 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(md, "precision")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "dynamic")
def MIRROR(self, layout, ob, md, wide_ui):
def MIRROR(self, layout, ob, md):
layout.prop(md, "merge_limit")
if wide_ui:
split = layout.split(percentage=0.25)
else:
split = layout.split(percentage=0.4)
split = layout.split(percentage=0.25)
col = split.column()
col.label(text="Axis:")
@ -408,11 +374,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "y")
col.prop(md, "z")
if wide_ui:
col = split.column()
else:
subsplit = layout.split()
col = subsplit.column()
col = split.column()
col.label(text="Options:")
col.prop(md, "clip", text="Clipping")
col.prop(md, "mirror_vertex_groups", text="Vertex Groups")
@ -426,11 +388,8 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.label(text="Mirror Object:")
col.prop(md, "mirror_object", text="")
def MULTIRES(self, layout, ob, md, wide_ui):
if wide_ui:
layout.row().prop(md, "subdivision_type", expand=True)
else:
layout.row().prop(md, "subdivision_type", text="")
def MULTIRES(self, layout, ob, md):
layout.row().prop(md, "subdivision_type", expand=True)
split = layout.split()
col = split.column()
@ -438,8 +397,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "sculpt_levels", text="Sculpt")
col.prop(md, "render_levels", text="Render")
if wide_ui:
col = split.column()
col = split.column()
col.enabled = ob.mode != 'EDIT'
col.operator("object.multires_subdivide", text="Subdivide")
@ -460,7 +418,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
row.operator("object.multires_external_save", text="Save External...")
row.label()
def PARTICLE_INSTANCE(self, layout, ob, md, wide_ui):
def PARTICLE_INSTANCE(self, layout, ob, md):
layout.prop(md, "object")
layout.prop(md, "particle_system_number", text="Particle System")
@ -471,8 +429,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "children")
col.prop(md, "size")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Show Particles When:")
col.prop(md, "alive")
col.prop(md, "unborn")
@ -488,15 +445,14 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.row().prop(md, "axis", expand=True)
col.prop(md, "keep_shape")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "position", slider=True)
col.prop(md, "random_position", text="Random", slider=True)
def PARTICLE_SYSTEM(self, layout, ob, md, wide_ui):
def PARTICLE_SYSTEM(self, layout, ob, md):
layout.label(text="See Particle panel.")
def SCREW(self, layout, ob, md, wide_ui):
def SCREW(self, layout, ob, md):
split = layout.split()
col = split.column()
@ -506,8 +462,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "steps")
col.prop(md, "render_steps")
if wide_ui:
col = split.column()
col = split.column()
row = col.row()
row.active = (md.object is None or md.use_object_screw_offset == False)
row.prop(md, "screw_offset")
@ -518,13 +473,12 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "use_normal_flip")
col.prop(md, "iterations")
def SHRINKWRAP(self, layout, ob, md, wide_ui):
def SHRINKWRAP(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Target:")
col.prop(md, "target", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@ -534,15 +488,12 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "offset")
col.prop(md, "subsurf_levels")
if wide_ui:
col = split.column()
col.label(text="Mode:")
col = split.column()
col.label(text="Mode:")
col.prop(md, "mode", text="")
if wide_ui:
split = layout.split(percentage=0.25)
else:
split = layout.split(percentage=0.35)
split = layout.split(percentage=0.25)
col = split.column()
if md.mode == 'PROJECT':
@ -556,11 +507,8 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "negative")
col.prop(md, "positive")
if wide_ui:
col = split.column()
else:
subsplit = layout.split()
col = subsplit.column()
col = split.column()
col.label(text="Cull Faces:")
col.prop(md, "cull_front_faces", text="Front")
col.prop(md, "cull_back_faces", text="Back")
@ -571,15 +519,14 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
elif md.mode == 'NEAREST_SURFACEPOINT':
layout.prop(md, "keep_above_surface")
def SIMPLE_DEFORM(self, layout, ob, md, wide_ui):
def SIMPLE_DEFORM(self, layout, ob, md):
split = layout.split()
col = split.column()
col.label(text="Mode:")
col.prop(md, "mode", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
@ -592,8 +539,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
sub.active = (md.origin != "")
sub.prop(md, "relative")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Deform:")
col.prop(md, "factor")
col.prop(md, "limits", slider=True)
@ -601,10 +547,10 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "lock_x_axis")
col.prop(md, "lock_y_axis")
def SMOKE(self, layout, ob, md, wide_ui):
def SMOKE(self, layout, ob, md):
layout.label(text="See Smoke panel.")
def SMOOTH(self, layout, ob, md, wide_ui):
def SMOOTH(self, layout, ob, md):
split = layout.split(percentage=0.25)
col = split.column()
@ -619,10 +565,10 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.label(text="Vertex Group:")
col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
def SOFT_BODY(self, layout, ob, md, wide_ui):
def SOFT_BODY(self, layout, ob, md):
layout.label(text="See Soft Body panel.")
def SOLIDIFY(self, layout, ob, md, wide_ui):
def SOLIDIFY(self, layout, ob, md):
split = layout.split()
@ -635,8 +581,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "edge_crease_outer", text="Outer")
col.prop(md, "edge_crease_rim", text="Rim")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "offset")
colsub = col.column()
@ -655,11 +600,8 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
# col.label(text="Vertex Group:")
# col.prop_object(md, "vertex_group", ob, "vertex_groups", text="")
def SUBSURF(self, layout, ob, md, wide_ui):
if wide_ui:
layout.row().prop(md, "subdivision_type", expand=True)
else:
layout.row().prop(md, "subdivision_type", text="")
def SUBSURF(self, layout, ob, md):
layout.row().prop(md, "subdivision_type", expand=True)
split = layout.split()
col = split.column()
@ -667,16 +609,15 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "levels", text="View")
col.prop(md, "render_levels", text="Render")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Options:")
col.prop(md, "subsurf_uv")
col.prop(md, "optimal_display")
def SURFACE(self, layout, ob, md, wide_ui):
def SURFACE(self, layout, ob, md):
layout.label(text="See Fields panel.")
def UV_PROJECT(self, layout, ob, md, wide_ui):
def UV_PROJECT(self, layout, ob, md):
if ob.type == 'MESH':
split = layout.split()
@ -684,8 +625,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.label(text="Image:")
col.prop(md, "image", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="UV Layer:")
col.prop_object(md, "uv_layer", ob.data, "uv_textures", text="")
@ -696,8 +636,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
for proj in md.projectors:
col.prop(proj, "object", text="")
if wide_ui:
col = split.column()
col = split.column()
sub = col.column(align=True)
sub.prop(md, "aspect_x", text="Aspect X")
sub.prop(md, "aspect_y", text="Aspect Y")
@ -706,7 +645,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
sub.prop(md, "scale_x", text="Scale X")
sub.prop(md, "scale_y", text="Scale Y")
def WAVE(self, layout, ob, md, wide_ui):
def WAVE(self, layout, ob, md):
split = layout.split()
col = split.column()
@ -715,8 +654,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "y")
col.prop(md, "cyclic")
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "normals")
sub = col.column()
sub.active = md.normals
@ -733,8 +671,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
sub.prop(md, "lifetime", text="Life")
col.prop(md, "damping_time", text="Damping")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Position:")
sub = col.column(align=True)
sub.prop(md, "start_position_x", text="X")
@ -760,8 +697,7 @@ class DATA_PT_modifiers(DataButtonsPanel, bpy.types.Panel):
col.prop(md, "speed", slider=True)
col.prop(md, "height", slider=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(md, "width", slider=True)
col.prop(md, "narrowness", slider=True)

@ -19,36 +19,31 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
class PhysicsButtonsPanel():
bl_space_type = 'PROPERTIES'
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
ob = context.active_object
game = ob.game
soft = ob.game.soft_body
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(game, "physics_type")
else:
layout.prop(game, "physics_type", text="")
layout.prop(game, "physics_type")
layout.separator()
#if game.physics_type == 'DYNAMIC':
@ -60,8 +55,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
col.prop(game, "ghost")
col.prop(ob, "hide_render", text="Invisible") # out of place but useful
if wide_ui:
col = split.column()
col = split.column()
col.prop(game, "material_physics")
col.prop(game, "rotate_from_normal")
col.prop(game, "no_sleeping")
@ -76,8 +70,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
col.prop(game, "radius")
col.prop(game, "form_factor")
if wide_ui:
col = split.column()
col = split.column()
sub = col.column()
sub.active = (game.physics_type == 'RIGID_BODY')
sub.prop(game, "anisotropic_friction")
@ -93,8 +86,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
sub.prop(game, "minimum_velocity", text="Minimum")
sub.prop(game, "maximum_velocity", text="Maximum")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Damping:")
sub = col.column(align=True)
sub.prop(game, "damping", text="Translation", slider=True)
@ -136,8 +128,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
col.prop(soft, "margin", slider=True)
col.prop(soft, "bending_const", text="Bending Constraints")
if wide_ui:
col = split.column()
col = split.column()
col.prop(soft, "shape_match")
sub = col.column()
sub.active = soft.shape_match
@ -166,10 +157,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
@ -180,21 +172,16 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
layout = self.layout
game = context.active_object.game
wide_ui = context.region.width > narrowui
layout.active = game.use_collision_bounds
if wide_ui:
layout.prop(game, "collision_bounds", text="Bounds")
else:
layout.prop(game, "collision_bounds", text="")
layout.prop(game, "collision_bounds", text="Bounds")
split = layout.split()
col = split.column()
col.prop(game, "collision_margin", text="Margin", slider=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(game, "collision_compound", text="Compound")
@ -203,15 +190,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,11 +212,15 @@ 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
gs = context.scene.game_data
wide_ui = context.region.width > narrowui
layout.prop(gs, "fullscreen")
@ -240,8 +232,7 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
sub.prop(gs, "resolution_x", slider=False, text="X")
sub.prop(gs, "resolution_y", slider=False, text="Y")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Quality:")
sub = col.column(align=True)
sub.prop(gs, "depth", text="Bit Depth", slider=False)
@ -250,10 +241,7 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
# framing:
col = layout.column()
col.label(text="Framing:")
if wide_ui:
col.row().prop(gs, "framing_type", expand=True)
else:
col.prop(gs, "framing_type", text="")
col.row().prop(gs, "framing_type", expand=True)
if gs.framing_type == 'LETTERBOX':
col.prop(gs, "framing_color", text="")
@ -262,12 +250,16 @@ 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
gs = context.scene.game_data
stereo_mode = gs.stereo
wide_ui = context.region.width > narrowui
# stereo options:
layout.prop(gs, "stereo", expand=True)
@ -279,10 +271,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
# dome:
elif stereo_mode == 'DOME':
if wide_ui:
layout.prop(gs, "dome_mode", text="Dome Type")
else:
layout.prop(gs, "dome_mode", text="")
layout.prop(gs, "dome_mode", text="Dome Type")
dome_type = gs.dome_mode
@ -296,8 +285,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
col.prop(gs, "dome_angle", slider=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
col.prop(gs, "dome_tilt")
@ -305,15 +293,14 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(gs, "dome_tesselation", text="Tesselation")
else: # cube map
col = split.column()
col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
if wide_ui:
col = split.column()
col = split.column()
layout.prop(gs, "dome_text")
@ -322,16 +309,17 @@ 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
gs = context.scene.game_data
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(gs, "material_mode", expand=True)
else:
layout.prop(gs, "material_mode", text="")
layout.prop(gs, "material_mode", expand=True)
if gs.material_mode == 'GLSL':
split = layout.split()
@ -351,11 +339,15 @@ 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
gs = context.scene.game_data
wide_ui = context.region.width > narrowui
split = layout.split()
@ -366,8 +358,8 @@ class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
col.prop(gs, "show_physics_visualization", text="Physics Visualization")
col.prop(gs, "use_deprecation_warnings")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Render:")
col.prop(gs, "use_frame_rate")
col.prop(gs, "use_display_lists")
@ -377,16 +369,18 @@ 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
scene = context.scene
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(scene, "distance_model")
else:
layout.prop(scene, "distance_model", text="")
layout.prop(scene, "distance_model")
layout.prop(scene, "speed_of_sound", text="Speed")
layout.prop(scene, "doppler_factor")
@ -396,17 +390,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)
@ -416,38 +407,34 @@ class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
scene = context.scene
world = context.world
space = context.space_data
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")
else:
if scene:
layout.template_ID(scene, "world", new="world.new")
elif world:
layout.template_ID(space, "pin_id")
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")
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
world = context.world
wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(world, "horizon_color")
if wide_ui:
col = split.column()
col = split.column()
col.prop(world, "ambient_color")
@ -455,6 +442,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
@ -464,7 +456,6 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
layout = self.layout
world = context.world
wide_ui = context.region.width > narrowui
layout.active = world.mist.use_mist
split = layout.split()
@ -472,8 +463,7 @@ class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(world.mist, "start")
if wide_ui:
col = split.column()
col = split.column()
col.prop(world.mist, "depth")
@ -481,11 +471,15 @@ 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
gs = context.scene.game_data
wide_ui = context.region.width > narrowui
layout.prop(gs, "physics_engine")
if gs.physics_engine != 'NONE':
@ -500,8 +494,7 @@ class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
sub.prop(gs, "physics_step_sub", text="Substeps")
col.prop(gs, "fps", text="FPS")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Logic Steps:")
col.prop(gs, "logic_step_max", text="Max")

@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
def active_node_mat(mat):
# TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
@ -60,11 +58,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 +72,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
@ -93,7 +87,6 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
ob = context.object
slot = context.material_slot
space = context.space_data
wide_ui = context.region.width > narrowui
if ob:
row = layout.row()
@ -112,54 +105,49 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
row.operator("object.material_slot_select", text="Select")
row.operator("object.material_slot_deselect", text="Deselect")
if wide_ui:
split = layout.split(percentage=0.65)
split = layout.split(percentage=0.65)
if ob:
split.template_ID(ob, "active_material", new="material.new")
row = split.row()
if mat:
row.prop(mat, "use_nodes", icon="NODETREE", text="")
if ob:
split.template_ID(ob, "active_material", new="material.new")
row = split.row()
if mat:
row.prop(mat, "use_nodes", icon="NODETREE", text="")
if slot:
row.prop(slot, "link", text="")
else:
row.label()
elif mat:
split.template_ID(space, "pin_id")
split.separator()
else:
if ob:
layout.template_ID(ob, "active_material", new="material.new")
elif mat:
layout.template_ID(space, "pin_id")
if slot:
row.prop(slot, "link", text="")
else:
row.label()
elif mat:
split.template_ID(space, "pin_id")
split.separator()
if mat:
if wide_ui:
layout.prop(mat, "type", expand=True)
else:
layout.prop(mat, "type", text="")
layout.prop(mat, "type", expand=True)
class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
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
mat = active_node_mat(context.material)
wide_ui = context.region.width > narrowui
if mat.type in ('SURFACE', 'WIRE'):
split = layout.split()
@ -172,8 +160,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
sub = col.column()
sub.prop(mat, "translucency")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "shadeless")
sub = col.column()
sub.active = not mat.shadeless
@ -189,17 +176,17 @@ 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
mat = context.material # dont use node material
tan = mat.strand
wide_ui = context.region.width > narrowui
split = layout.split()
@ -215,8 +202,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
sub.prop(tan, "tangent_shading")
col.prop(tan, "shape")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Shading:")
col.prop(tan, "width_fade")
ob = context.object
@ -237,11 +223,14 @@ 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
phys = context.material.physics # dont use node material
wide_ui = context.region.width > narrowui
split = layout.split()
@ -250,8 +239,7 @@ class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
col.prop(phys, "friction")
col.prop(phys, "align_to_normal")
if wide_ui:
col = split.column()
col = split.column()
col.prop(phys, "force", slider=True)
col.prop(phys, "elasticity", slider=True)
col.prop(phys, "damp", slider=True)
@ -261,16 +249,16 @@ 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
mat = active_node_mat(context.material)
wide_ui = context.region.width > narrowui
split = layout.split()
@ -290,8 +278,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
row.active = bool(mat.light_group)
row.prop(mat, "light_group_exclusive", text="Exclusive")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "face_texture")
sub = col.column()
sub.active = mat.face_texture
@ -307,16 +294,16 @@ 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
mat = active_node_mat(context.material)
wide_ui = context.region.width > narrowui
split = layout.split()
@ -327,8 +314,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
col.prop(mat, "cast_shadows_only", text="Cast Only")
col.prop(mat, "shadow_casting_alpha", text="Casting Alpha")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "cast_buffer_shadows")
sub = col.column()
sub.active = mat.cast_buffer_shadows
@ -343,16 +329,16 @@ 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
mat = active_node_mat(context.material)
wide_ui = context.region.width > narrowui
split = layout.split()
@ -362,8 +348,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
sub.active = (not mat.shadeless)
sub.prop(mat, "diffuse_intensity", text="Intensity")
if wide_ui:
col = split.column()
col = split.column()
col.active = (not mat.shadeless)
col.prop(mat, "diffuse_shader", text="")
col.prop(mat, "use_diffuse_ramp", text="Ramp")
@ -380,8 +365,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(mat, "diffuse_toon_size", text="Size")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "diffuse_toon_smooth", text="Smooth")
elif mat.diffuse_shader == 'FRESNEL':
split = col.split()
@ -389,8 +373,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(mat, "diffuse_fresnel", text="Fresnel")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "diffuse_fresnel_factor", text="Factor")
if mat.use_diffuse_ramp:
@ -403,8 +386,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(mat, "diffuse_ramp_input", text="Input")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "diffuse_ramp_blend", text="Blend")
row = layout.row()
row.prop(mat, "diffuse_ramp_factor", text="Factor")
@ -414,16 +396,16 @@ 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
mat = active_node_mat(context.material)
wide_ui = context.region.width > narrowui
layout.active = (not mat.shadeless)
@ -433,8 +415,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
col.prop(mat, "specular_color", text="")
col.prop(mat, "specular_intensity", text="Intensity")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "specular_shader", text="")
col.prop(mat, "use_specular_ramp", text="Ramp")
@ -447,8 +428,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(mat, "specular_hardness", text="Hardness")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "specular_ior", text="IOR")
elif mat.specular_shader == 'WARDISO':
col.prop(mat, "specular_slope", text="Slope")
@ -458,8 +438,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(mat, "specular_toon_size", text="Size")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "specular_toon_smooth", text="Smooth")
if mat.use_specular_ramp:
@ -471,8 +450,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(mat, "specular_ramp_input", text="Input")
if wide_ui:
col = split.column()
col = split.column()
col.prop(mat, "specular_ramp_blend", text="Blend")
row = layout.row()
@ -484,10 +462,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)
@ -501,7 +480,6 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
mat = active_node_mat(context.material)
sss = mat.subsurface_scattering
wide_ui = context.region.width > narrowui
layout.active = (sss.enabled) and (not mat.shadeless)
@ -518,8 +496,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
col.prop(sss, "color", text="")
col.prop(sss, "radius", text="RGB Radius", expand=True)
if wide_ui:
col = split.column()
col = split.column()
sub = col.column(align=True)
sub.label(text="Blend:")
sub.prop(sss, "color_factor", text="Color")
@ -536,10 +513,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
@ -551,7 +529,6 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
mat = active_node_mat(context.material)
raym = mat.raytrace_mirror
wide_ui = context.region.width > narrowui
layout.active = raym.enabled
@ -561,8 +538,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
col.prop(raym, "reflect_factor")
col.prop(mat, "mirror_color", text="")
if wide_ui:
col = split.column()
col = split.column()
col.prop(raym, "fresnel")
sub = col.column()
sub.active = raym.fresnel > 0
@ -580,8 +556,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
sub.label(text="Fade To:")
sub.prop(raym, "fade_to", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Gloss:")
col.prop(raym, "gloss_factor", text="Amount")
sub = col.column()
@ -596,10 +571,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)
@ -611,14 +587,10 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
wide_ui = context.region.width > narrowui
row = layout.row()
row.active = mat.transparency and (not mat.shadeless)
if wide_ui:
row.prop(mat, "transparency_method", expand=True)
else:
row.prop(mat, "transparency_method", text="")
row.prop(mat, "transparency_method", expand=True)
split = layout.split()
@ -628,8 +600,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
row.active = mat.transparency and (not mat.shadeless)
row.prop(mat, "specular_alpha", text="Specular")
if wide_ui:
col = split.column()
col = split.column()
col.active = (not mat.shadeless)
col.prop(rayt, "fresnel")
sub = col.column()
@ -648,8 +619,7 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
col.prop(rayt, "limit")
col.prop(rayt, "depth")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Gloss:")
col.prop(rayt, "gloss_factor", text="Amount")
sub = col.column()
@ -663,10 +633,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)
@ -678,14 +649,10 @@ class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
wide_ui = context.region.width > narrowui
row = layout.row()
row.active = mat.transparency and (not mat.shadeless)
if wide_ui:
row.prop(mat, "transparency_method", expand=True)
else:
row.prop(mat, "transparency_method", text="")
row.prop(mat, "transparency_method", expand=True)
split = layout.split()
@ -697,17 +664,17 @@ 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
mat = context.material # dont use node material
halo = mat.halo
wide_ui = context.region.width > narrowui
split = layout.split()
@ -723,8 +690,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
col.prop(halo, "shaded")
col.prop(halo, "soft")
if wide_ui:
col = split.column()
col = split.column()
col.prop(halo, "ring")
sub = col.column()
sub.active = halo.ring
@ -747,10 +713,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
@ -762,7 +729,6 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
mat = context.material # dont use node material
halo = mat.halo
wide_ui = context.region.width > narrowui
layout.active = halo.flare_mode
@ -772,8 +738,8 @@ class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
col.prop(halo, "flare_size", text="Size")
col.prop(halo, "flare_boost", text="Boost")
col.prop(halo, "flare_seed", text="Seed")
if wide_ui:
col = split.column()
col = split.column()
col.prop(halo, "flares_sub", text="Subflares")
col.prop(halo, "flare_subsize", text="Subsize")
@ -782,11 +748,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):
@ -798,14 +766,12 @@ class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
layout = self.layout
vol = context.material.volume # dont use node material
wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(vol, "density")
if wide_ui:
col = split.column()
col = split.column()
col.prop(vol, "density_scale")
@ -818,7 +784,6 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
layout = self.layout
vol = context.material.volume # dont use node material
wide_ui = context.region.width > narrowui
split = layout.split()
@ -827,8 +792,7 @@ class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
col.prop(vol, "asymmetry")
col.prop(vol, "transmission_color")
if wide_ui:
col = split.column()
col = split.column()
sub = col.column(align=True)
sub.prop(vol, "emission")
sub.prop(vol, "emission_color", text="")
@ -846,15 +810,13 @@ class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
layout = self.layout
vol = context.material.volume # dont use node material
wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(vol, "lighting_mode", text="")
if wide_ui:
col = split.column()
col = split.column()
if vol.lighting_mode == 'SHADED':
col.prop(vol, "external_shadows")
@ -883,12 +845,8 @@ class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
layout = self.layout
mat = context.material # dont use node material
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(mat, "transparency_method", expand=True)
else:
layout.prop(mat, "transparency_method", text="")
layout.prop(mat, "transparency_method", expand=True)
class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
@ -900,7 +858,6 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
layout = self.layout
vol = context.material.volume # dont use node material
wide_ui = context.region.width > narrowui
split = layout.split()
@ -910,8 +867,7 @@ class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
col = col.column(align=True)
col.prop(vol, "step_size")
if wide_ui:
col = split.column()
col = split.column()
col.label()
col.prop(vol, "depth_cutoff")
@ -925,7 +881,6 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
layout = self.layout
mat = active_node_mat(context.material)
wide_ui = context.region.width > narrowui
split = layout.split()

@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class ObjectButtonsPanel():
bl_space_type = 'PROPERTIES'
@ -53,37 +51,23 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
if wide_ui:
row = layout.row()
row = layout.row()
row.column().prop(ob, "location")
if ob.rotation_mode == 'QUATERNION':
row.column().prop(ob, "rotation_quaternion", text="Rotation")
elif ob.rotation_mode == 'AXIS_ANGLE':
#row.column().label(text="Rotation")
#row.column().prop(pchan, "rotation_angle", text="Angle")
#row.column().prop(pchan, "rotation_axis", text="Axis")
row.column().prop(ob, "rotation_axis_angle", text="Rotation")
else:
row.column().prop(ob, "rotation_euler", text="Rotation")
row.column().prop(ob, "scale")
layout.prop(ob, "rotation_mode")
row.column().prop(ob, "location")
if ob.rotation_mode == 'QUATERNION':
row.column().prop(ob, "rotation_quaternion", text="Rotation")
elif ob.rotation_mode == 'AXIS_ANGLE':
#row.column().label(text="Rotation")
#row.column().prop(pchan, "rotation_angle", text="Angle")
#row.column().prop(pchan, "rotation_axis", text="Axis")
row.column().prop(ob, "rotation_axis_angle", text="Rotation")
else:
col = layout.column()
col.prop(ob, "location")
col.label(text="Rotation:")
col.prop(ob, "rotation_mode", text="")
if ob.rotation_mode == 'QUATERNION':
col.prop(ob, "rotation_quaternion", text="")
elif ob.rotation_mode == 'AXIS_ANGLE':
col.prop(ob, "rotation_axis_angle", text="")
else:
col.prop(ob, "rotation_euler", text="")
col.prop(ob, "scale")
row.column().prop(ob, "rotation_euler", text="Rotation")
row.column().prop(ob, "scale")
layout.prop(ob, "rotation_mode")
class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
@ -94,7 +78,6 @@ class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
# wide_ui = context.region.width > narrowui
row = layout.row()
@ -120,7 +103,6 @@ class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
split = layout.split()
@ -129,8 +111,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
col.separator()
col.prop(ob, "pass_index")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Parent:")
col.prop(ob, "parent", text="")
@ -149,7 +130,6 @@ class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.operator("object.group_link", text="Add to Group")
@ -173,8 +153,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(group, "layer", text="Dupli")
if wide_ui:
col = split.column()
col = split.column()
col.prop(group, "dupli_offset", text="")
prop = col.operator("wm.context_set_value", text="From Cursor")
@ -190,14 +169,12 @@ class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(ob, "max_draw_type", text="Type")
if wide_ui:
col = split.column()
col = split.column()
row = col.row()
row.prop(ob, "draw_bounds", text="Bounds")
sub = row.row()
@ -212,8 +189,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
col.prop(ob, "draw_wire", text="Wire")
col.prop(ob, "color", text="Object Color")
if wide_ui:
col = split.column()
col = split.column()
col.prop(ob, "draw_texture_space", text="Texture Space")
col.prop(ob, "x_ray", text="X-Ray")
col.prop(ob, "draw_transparent", text="Transparency")
@ -226,12 +202,8 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(ob, "dupli_type", expand=True)
else:
layout.prop(ob, "dupli_type", text="")
layout.prop(ob, "dupli_type", expand=True)
if ob.dupli_type == 'FRAMES':
split = layout.split()
@ -240,8 +212,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
col.prop(ob, "dupli_frames_start", text="Start")
col.prop(ob, "dupli_frames_end", text="End")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.prop(ob, "dupli_frames_on", text="On")
col.prop(ob, "dupli_frames_off", text="Off")
@ -256,15 +227,12 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(ob, "use_dupli_faces_scale", text="Scale")
if wide_ui:
col = split.column()
col = split.column()
col.prop(ob, "dupli_faces_scale", text="Inherit Scale")
elif ob.dupli_type == 'GROUP':
if wide_ui:
layout.prop(ob, "dupli_group", text="Group")
else:
layout.prop(ob, "dupli_group", text="")
layout.prop(ob, "dupli_group", text="Group")
# XXX: the following options are all quite buggy, ancient hacks that should be dropped
@ -276,7 +244,6 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
split = layout.split()
@ -295,8 +262,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
col.prop(ob, "time_offset", text="Offset")
# XXX: these are still used for a few curve-related tracking features
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Tracking Axes:")
col.prop(ob, "track_axis", text="Axis")
col.prop(ob, "up_axis", text="Up Axis")
@ -308,16 +274,16 @@ 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):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.animation_visualisation, wide_ui)
self.draw_settings(context, ob.animation_visualisation)
layout.separator()
@ -326,8 +292,7 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
col = split.column()
col.operator("object.paths_calculate", text="Calculate Paths")
if wide_ui:
col = split.column()
col = split.column()
col.operator("object.paths_clear", text="Clear Paths")
@ -335,16 +300,16 @@ 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):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.animation_visualisation, wide_ui)
self.draw_settings(context, ob.animation_visualisation)
class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
_context_path = "object"

@ -19,9 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
narrowcon = 260
class ConstraintButtonsPanel():
bl_space_type = 'PROPERTIES'
@ -31,52 +28,38 @@ class ConstraintButtonsPanel():
def draw_constraint(self, context, con):
layout = self.layout
wide_ui = context.region.width > narrowui
compact_con = context.region.width < narrowcon
box = layout.template_constraint(con, compact=compact_con)
box = layout.template_constraint(con)
if box:
# match enum type to our functions, avoids a lookup table.
getattr(self, con.type)(context, box, con, wide_ui)
getattr(self, con.type)(context, box, con)
if con.type not in ('RIGID_BODY_JOINT', 'NULL'):
box.prop(con, "influence")
def space_template(self, layout, con, wide_ui, target=True, owner=True):
def space_template(self, layout, con, target=True, owner=True):
if target or owner:
split = layout.split(percentage=0.2)
if wide_ui:
split.label(text="Space:")
row = split.row()
else:
row = layout.row()
split.label(text="Space:")
row = split.row()
if target:
row.prop(con, "target_space", text="")
if wide_ui:
if target and owner:
row.label(icon='ARROW_LEFTRIGHT')
else:
row = layout.row()
if target and owner:
row.label(icon='ARROW_LEFTRIGHT')
if owner:
row.prop(con, "owner_space", text="")
def target_template(self, layout, con, wide_ui, subtargets=True):
if wide_ui:
layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
else:
layout.prop(con, "target", text="")
def target_template(self, layout, con, subtargets=True):
layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
if con.target and subtargets:
if con.target.type == 'ARMATURE':
if wide_ui:
layout.prop_object(con, "subtarget", con.target.data, "bones", text="Bone")
else:
layout.prop_object(con, "subtarget", con.target.data, "bones", text="")
layout.prop_object(con, "subtarget", con.target.data, "bones", text="Bone")
if con.type in ('COPY_LOCATION', 'STRETCH_TO', 'TRACK_TO', 'PIVOT'):
row = layout.row()
@ -85,7 +68,7 @@ class ConstraintButtonsPanel():
elif con.target.type in ('MESH', 'LATTICE'):
layout.prop_object(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
def ik_template(self, layout, con, wide_ui):
def ik_template(self, layout, con):
# only used for iTaSC
layout.prop(con, "pole_target")
@ -106,8 +89,8 @@ class ConstraintButtonsPanel():
col.prop(con, "chain_length")
col.prop(con, "use_target")
def CHILD_OF(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def CHILD_OF(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
@ -134,16 +117,14 @@ class ConstraintButtonsPanel():
col = split.column()
col.operator("constraint.childof_set_inverse")
if wide_ui:
col = split.column()
col = split.column()
col.operator("constraint.childof_clear_inverse")
def TRACK_TO(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def TRACK_TO(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
if wide_ui:
row.label(text="To:")
row.label(text="To:")
row.prop(con, "track", expand=True)
split = layout.split()
@ -151,34 +132,27 @@ class ConstraintButtonsPanel():
col = split.column()
col.prop(con, "up", text="Up")
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "target_z")
self.space_template(layout, con, wide_ui)
self.space_template(layout, con)
def IK(self, context, layout, con, wide_ui):
def IK(self, context, layout, con):
if context.object.pose.ik_solver == "ITASC":
layout.prop(con, "ik_type")
getattr(self, 'IK_' + con.ik_type)(context, layout, con, wide_ui)
getattr(self, 'IK_' + con.ik_type)(context, layout, con)
else:
# Legacy IK constraint
self.target_template(layout, con, wide_ui)
if wide_ui:
layout.prop(con, "pole_target")
else:
layout.prop(con, "pole_target", text="")
self.target_template(layout, con)
layout.prop(con, "pole_target")
if con.pole_target and con.pole_target.type == 'ARMATURE':
if wide_ui:
layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
else:
layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="")
layout.prop_object(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
if con.pole_target:
row = layout.row()
row.prop(con, "pole_angle")
if wide_ui:
row.label()
row.label()
split = layout.split()
col = split.column()
@ -191,17 +165,16 @@ class ConstraintButtonsPanel():
sub.active = con.use_rotation
sub.prop(con, "orient_weight", text="Rotation", slider=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "use_tail")
col.prop(con, "use_stretch")
col.separator()
col.prop(con, "use_target")
col.prop(con, "use_rotation")
def IK_COPY_POSE(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
self.ik_template(layout, con, wide_ui)
def IK_COPY_POSE(self, context, layout, con):
self.target_template(layout, con)
self.ik_template(layout, con)
row = layout.row()
row.label(text="Axis Ref:")
@ -234,17 +207,17 @@ class ConstraintButtonsPanel():
row.prop(con, "rot_lock_z", text="Z")
split.active = con.use_rotation
def IK_DISTANCE(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
self.ik_template(layout, con, wide_ui)
def IK_DISTANCE(self, context, layout, con):
self.target_template(layout, con)
self.ik_template(layout, con)
layout.prop(con, "limit_mode")
row = layout.row()
row.prop(con, "weight", text="Weight", slider=True)
row.prop(con, "distance", text="Distance", slider=True)
def FOLLOW_PATH(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def FOLLOW_PATH(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
@ -252,8 +225,7 @@ class ConstraintButtonsPanel():
col.prop(con, "use_curve_follow")
col.prop(con, "use_curve_radius")
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "use_fixed_position")
if con.use_fixed_position:
col.prop(con, "offset_factor", text="Offset")
@ -261,16 +233,14 @@ class ConstraintButtonsPanel():
col.prop(con, "offset")
row = layout.row()
if wide_ui:
row.label(text="Forward:")
row.label(text="Forward:")
row.prop(con, "forward", expand=True)
row = layout.row()
row.prop(con, "up", text="Up")
if wide_ui:
row.label()
row.label()
def LIMIT_ROTATION(self, context, layout, con, wide_ui):
def LIMIT_ROTATION(self, context, layout, con):
split = layout.split()
@ -281,16 +251,14 @@ class ConstraintButtonsPanel():
sub.prop(con, "minimum_x", text="Min")
sub.prop(con, "maximum_x", text="Max")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.prop(con, "use_limit_y")
sub = col.column()
sub.active = con.use_limit_y
sub.prop(con, "minimum_y", text="Min")
sub.prop(con, "maximum_y", text="Max")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.prop(con, "use_limit_z")
sub = col.column()
sub.active = con.use_limit_z
@ -299,15 +267,13 @@ class ConstraintButtonsPanel():
row = layout.row()
row.prop(con, "limit_transform")
if wide_ui:
row.label()
row.label()
row = layout.row()
if wide_ui:
row.label(text="Convert:")
row.label(text="Convert:")
row.prop(con, "owner_space", text="")
def LIMIT_LOCATION(self, context, layout, con, wide_ui):
def LIMIT_LOCATION(self, context, layout, con):
split = layout.split()
col = split.column()
@ -320,8 +286,7 @@ class ConstraintButtonsPanel():
sub.active = con.use_maximum_x
sub.prop(con, "maximum_x", text="")
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "use_minimum_y")
sub = col.column()
sub.active = con.use_minimum_y
@ -331,8 +296,7 @@ class ConstraintButtonsPanel():
sub.active = con.use_maximum_y
sub.prop(con, "maximum_y", text="")
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "use_minimum_z")
sub = col.column()
sub.active = con.use_minimum_z
@ -344,15 +308,13 @@ class ConstraintButtonsPanel():
row = layout.row()
row.prop(con, "limit_transform")
if wide_ui:
row.label()
row.label()
row = layout.row()
if wide_ui:
row.label(text="Convert:")
row.label(text="Convert:")
row.prop(con, "owner_space", text="")
def LIMIT_SCALE(self, context, layout, con, wide_ui):
def LIMIT_SCALE(self, context, layout, con):
split = layout.split()
col = split.column()
@ -365,8 +327,7 @@ class ConstraintButtonsPanel():
sub.active = con.use_maximum_x
sub.prop(con, "maximum_x", text="")
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "use_minimum_y")
sub = col.column()
sub.active = con.use_minimum_y
@ -376,8 +337,7 @@ class ConstraintButtonsPanel():
sub.active = con.use_maximum_y
sub.prop(con, "maximum_y", text="")
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "use_minimum_z")
sub = col.column()
sub.active = con.use_minimum_z
@ -389,16 +349,14 @@ class ConstraintButtonsPanel():
row = layout.row()
row.prop(con, "limit_transform")
if wide_ui:
row.label()
row.label()
row = layout.row()
if wide_ui:
row.label(text="Convert:")
row.label(text="Convert:")
row.prop(con, "owner_space", text="")
def COPY_ROTATION(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def COPY_ROTATION(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
@ -422,10 +380,10 @@ class ConstraintButtonsPanel():
layout.prop(con, "use_offset")
self.space_template(layout, con, wide_ui)
self.space_template(layout, con)
def COPY_LOCATION(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def COPY_LOCATION(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
@ -449,10 +407,10 @@ class ConstraintButtonsPanel():
layout.prop(con, "use_offset")
self.space_template(layout, con, wide_ui)
self.space_template(layout, con)
def COPY_SCALE(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def COPY_SCALE(self, context, layout, con):
self.target_template(layout, con)
row = layout.row(align=True)
row.prop(con, "use_x", text="X")
@ -461,38 +419,31 @@ class ConstraintButtonsPanel():
layout.prop(con, "use_offset")
self.space_template(layout, con, wide_ui)
self.space_template(layout, con)
def MAINTAIN_VOLUME(self, context, layout, con, wide_ui):
def MAINTAIN_VOLUME(self, context, layout, con):
row = layout.row()
if wide_ui:
row.label(text="Free:")
row.label(text="Free:")
row.prop(con, "axis", expand=True)
layout.prop(con, "volume")
self.space_template(layout, con, wide_ui)
self.space_template(layout, con)
def COPY_TRANSFORMS(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def COPY_TRANSFORMS(self, context, layout, con):
self.target_template(layout, con)
self.space_template(layout, con, wide_ui)
self.space_template(layout, con)
#def SCRIPT(self, context, layout, con):
def ACTION(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def ACTION(self, context, layout, con):
self.target_template(layout, con)
if wide_ui:
layout.prop(con, "action")
else:
layout.prop(con, "action", text="")
layout.prop(con, "action")
if wide_ui:
layout.prop(con, "transform_channel")
else:
layout.prop(con, "transform_channel", text="")
layout.prop(con, "transform_channel")
split = layout.split()
@ -501,32 +452,28 @@ class ConstraintButtonsPanel():
col.prop(con, "frame_start", text="Start")
col.prop(con, "frame_end", text="End")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.label(text="Target Range:")
col.prop(con, "minimum", text="Min")
col.prop(con, "maximum", text="Max")
row = layout.row()
if wide_ui:
row.label(text="Convert:")
row.label(text="Convert:")
row.prop(con, "target_space", text="")
def LOCKED_TRACK(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def LOCKED_TRACK(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
if wide_ui:
row.label(text="To:")
row.label(text="To:")
row.prop(con, "track", expand=True)
row = layout.row()
if wide_ui:
row.label(text="Lock:")
row.label(text="Lock:")
row.prop(con, "lock", expand=True)
def LIMIT_DISTANCE(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def LIMIT_DISTANCE(self, context, layout, con):
self.target_template(layout, con)
col = layout.column(align=True)
col.prop(con, "distance")
@ -536,70 +483,58 @@ class ConstraintButtonsPanel():
row.label(text="Clamp Region:")
row.prop(con, "limit_mode", text="")
def STRETCH_TO(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def STRETCH_TO(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
col = split.column()
col.prop(con, "original_length", text="Rest Length")
if wide_ui:
col = split.column()
col = split.column()
col.operator("constraint.stretchto_reset", text="Reset")
col = layout.column()
col.prop(con, "bulge", text="Volume Variation")
row = layout.row()
if wide_ui:
row.label(text="Volume:")
row.label(text="Volume:")
row.prop(con, "volume", expand=True)
if not wide_ui:
row = layout.row()
row.label(text="Plane:")
row.prop(con, "keep_axis", expand=True)
def FLOOR(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def FLOOR(self, context, layout, con):
self.target_template(layout, con)
split = layout.split()
col = split.column()
col.prop(con, "sticky")
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "use_rotation")
layout.prop(con, "offset")
row = layout.row()
if wide_ui:
row.label(text="Min/Max:")
row.label(text="Min/Max:")
row.prop(con, "floor_location", expand=True)
self.space_template(layout, con, wide_ui)
self.space_template(layout, con)
def RIGID_BODY_JOINT(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def RIGID_BODY_JOINT(self, context, layout, con):
self.target_template(layout, con)
if wide_ui:
layout.prop(con, "pivot_type")
else:
layout.prop(con, "pivot_type", text="")
if wide_ui:
layout.prop(con, "child")
else:
layout.prop(con, "child", text="")
layout.prop(con, "pivot_type")
layout.prop(con, "child")
split = layout.split()
col = split.column()
col.prop(con, "disable_linked_collision", text="No Collision")
if wide_ui:
col = split.column()
col = split.column()
col.prop(con, "draw_pivot", text="Display Pivot")
split = layout.split()
@ -610,8 +545,7 @@ class ConstraintButtonsPanel():
col.prop(con, "pivot_y", text="Y")
col.prop(con, "pivot_z", text="Z")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.label(text="Axis:")
col.prop(con, "axis_x", text="X")
col.prop(con, "axis_y", text="Y")
@ -619,19 +553,18 @@ class ConstraintButtonsPanel():
#Missing: Limit arrays (not wrapped in RNA yet)
def CLAMP_TO(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def CLAMP_TO(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
if wide_ui:
row.label(text="Main Axis:")
row.label(text="Main Axis:")
row.prop(con, "main_axis", expand=True)
row = layout.row()
row.prop(con, "cyclic")
def TRANSFORM(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def TRANSFORM(self, context, layout, con):
self.target_template(layout, con)
layout.prop(con, "extrapolate_motion", text="Extrapolate")
@ -646,14 +579,12 @@ class ConstraintButtonsPanel():
sub.prop(con, "from_min_x", text="Min")
sub.prop(con, "from_max_x", text="Max")
if wide_ui:
sub = split.column(align=True)
sub = split.column(align=True)
sub.label(text="Y:")
sub.prop(con, "from_min_y", text="Min")
sub.prop(con, "from_max_y", text="Max")
if wide_ui:
sub = split.column(align=True)
sub = split.column(align=True)
sub.label(text="Z:")
sub.prop(con, "from_min_z", text="Min")
sub.prop(con, "from_max_z", text="Max")
@ -674,8 +605,7 @@ class ConstraintButtonsPanel():
sub.prop(con, "to_min_x", text="Min")
sub.prop(con, "to_max_x", text="Max")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Y:")
col.row().prop(con, "map_to_y_from", expand=True)
@ -683,8 +613,7 @@ class ConstraintButtonsPanel():
sub.prop(con, "to_min_y", text="Min")
sub.prop(con, "to_max_y", text="Max")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Z:")
col.row().prop(con, "map_to_z_from", expand=True)
@ -692,10 +621,10 @@ class ConstraintButtonsPanel():
sub.prop(con, "to_min_z", text="Min")
sub.prop(con, "to_max_z", text="Max")
self.space_template(layout, con, wide_ui)
self.space_template(layout, con)
def SHRINKWRAP(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def SHRINKWRAP(self, context, layout, con):
self.target_template(layout, con)
layout.prop(con, "distance")
layout.prop(con, "shrinkwrap_type")
@ -706,16 +635,15 @@ class ConstraintButtonsPanel():
row.prop(con, "use_y")
row.prop(con, "use_z")
def DAMPED_TRACK(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def DAMPED_TRACK(self, context, layout, con):
self.target_template(layout, con)
row = layout.row()
if wide_ui:
row.label(text="To:")
row.label(text="To:")
row.prop(con, "track", expand=True)
def SPLINE_IK(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def SPLINE_IK(self, context, layout, con):
self.target_template(layout, con)
col = layout.column()
col.label(text="Spline Fitting:")
@ -726,14 +654,11 @@ class ConstraintButtonsPanel():
col = layout.column()
col.label(text="Chain Scaling:")
col.prop(con, "y_stretch")
if wide_ui:
col.prop(con, "xz_scaling_mode")
else:
col.prop(con, "xz_scaling_mode", text="")
col.prop(con, "xz_scaling_mode")
col.prop(con, "use_curve_radius")
def PIVOT(self, context, layout, con, wide_ui):
self.target_template(layout, con, wide_ui)
def PIVOT(self, context, layout, con):
self.target_template(layout, con)
if con.target:
col = layout.column()
@ -753,7 +678,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 +697,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):

@ -25,21 +25,19 @@ from properties_physics_common import effector_weights_ui
from properties_physics_common import basic_force_field_settings_ui
from properties_physics_common import basic_force_field_falloff_ui
narrowui = bpy.context.user_preferences.view.properties_width_check
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 +45,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 +136,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
@ -156,7 +157,6 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
psys = context.particle_system
part = psys.settings
wide_ui = context.region.width > narrowui
layout.enabled = particle_panel_enabled(context, psys) and not psys.multiple_caches
@ -178,10 +178,8 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
layout.row().label(text="Emit From:")
row = layout.row()
if wide_ui:
row.prop(part, "emit_from", expand=True)
else:
row.prop(part, "emit_from", text="")
row.prop(part, "emit_from", expand=True)
row = layout.row()
row.prop(part, "trand")
if part.distribution != 'GRID':
@ -189,10 +187,8 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
row = layout.row()
if wide_ui:
row.prop(part, "distribution", expand=True)
else:
row.prop(part, "distribution", text="")
row.prop(part, "distribution", expand=True)
row = layout.row()
@ -208,14 +204,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 +262,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 +273,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 +285,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 +333,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:
@ -346,7 +346,6 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
psys = context.particle_system
part = psys.settings
wide_ui = context.region.width > narrowui
layout.enabled = particle_panel_enabled(context, psys)
@ -364,10 +363,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
sub.prop(part, "random_phase_factor", text="Random", slider=True)
layout.row().label(text="Angular Velocity:")
if wide_ui:
layout.row().prop(part, "angular_velocity_mode", expand=True)
else:
layout.row().prop(part, "angular_velocity_mode", text="")
layout.row().prop(part, "angular_velocity_mode", expand=True)
split = layout.split()
sub = split.column()
@ -380,8 +376,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
@ -391,15 +388,11 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
psys = context.particle_system
part = psys.settings
wide_ui = context.region.width > narrowui
layout.enabled = particle_panel_enabled(context, psys)
row = layout.row()
if wide_ui:
row.prop(part, "physics_type", expand=True)
else:
row.prop(part, "physics_type", text="")
row.prop(part, "physics_type", expand=True)
row = layout.row()
col = row.column(align=True)
@ -577,7 +570,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 +580,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,21 +671,21 @@ 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
psys = context.particle_system
part = psys.settings
wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(part, "material")
@ -707,10 +701,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
sub.prop(part, "died")
row = layout.row()
if wide_ui:
row.prop(part, "ren_as", expand=True)
else:
row.prop(part, "ren_as", text="")
row.prop(part, "ren_as", expand=True)
split = layout.split()
@ -797,10 +788,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
sub.label(text="Align:")
row = layout.row()
if wide_ui:
row.prop(part, "billboard_align", expand=True)
else:
row.prop(part, "billboard_align", text="")
row.prop(part, "billboard_align", expand=True)
row.prop(part, "billboard_lock", text="Lock")
row = layout.row()
row.prop(part, "billboard_object")
@ -848,27 +836,24 @@ 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
psys = context.particle_system
part = psys.settings
wide_ui = context.region.width > narrowui
row = layout.row()
if wide_ui:
row.prop(part, "draw_as", expand=True)
else:
row.prop(part, "draw_as", text="")
row.prop(part, "draw_as", expand=True)
if part.draw_as == 'NONE' or (part.ren_as == 'NONE' and part.draw_as == 'RENDER'):
return
@ -907,17 +892,17 @@ 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
psys = context.particle_system
part = psys.settings
wide_ui = context.region.width > narrowui
if wide_ui:
layout.row().prop(part, "child_type", expand=True)
else:
layout.row().prop(part, "child_type", text="")
layout.row().prop(part, "child_type", expand=True)
if part.child_type == 'NONE':
return
@ -973,10 +958,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
col.label(text="hair parting controls")
layout.row().label(text="Kink:")
if wide_ui:
layout.row().prop(part, "kink", expand=True)
else:
layout.row().prop(part, "kink", text="")
layout.row().prop(part, "kink", expand=True)
split = layout.split()
@ -992,6 +974,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 +991,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 +1023,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

@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
@ -45,7 +43,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)
@ -59,7 +58,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
md = context.cloth
ob = context.object
wide_ui = context.region.width > narrowui
split = layout.split()
@ -74,8 +72,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'CLOTH'
if wide_ui:
split.label()
split.label()
if md:
cloth = md.settings
@ -99,8 +96,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
col.prop(cloth, "structural_stiffness", text="Structural")
col.prop(cloth, "bending_stiffness", text="Bending")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Damping:")
col.prop(cloth, "spring_damping", text="Spring")
@ -137,7 +133,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 +146,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):
@ -163,7 +161,6 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
cloth = context.cloth.collision_settings
md = context.cloth
wide_ui = context.region.width > narrowui
layout.active = cloth.enable_collision and cloth_panel_enabled(md)
@ -174,8 +171,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
col.prop(cloth, "min_distance", slider=True, text="Distance")
col.prop(cloth, "friction")
if wide_ui:
col = split.column()
col = split.column()
col.prop(cloth, "enable_self_collision", text="Self Collision")
sub = col.column()
sub.active = cloth.enable_self_collision
@ -189,7 +185,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):
@ -204,7 +201,6 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
md = context.cloth
ob = context.object
cloth = context.cloth.settings
wide_ui = context.region.width > narrowui
layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md)
@ -215,8 +211,7 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
col.prop_object(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="")
col.prop(cloth, "structural_stiffness_max", text="Max")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Bending Stiffness:")
col.prop_object(cloth, "bending_vertex_group", ob, "vertex_groups", text="")
col.prop(cloth, "bending_stiffness_max", text="Max")
@ -226,7 +221,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):

@ -20,15 +20,12 @@
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
def point_cache_ui(self, context, cache, enabled, cachetype):
layout = self.layout
wide_ui = context.region.width > narrowui
layout.set_context_pointer("point_cache", cache)
row = layout.row()
@ -66,8 +63,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
if cachetype != 'SMOKE':
col.prop(cache, "step")
if wide_ui:
col = split.column()
col = split.column()
if cachetype != 'SMOKE':
sub = col.column()
@ -102,8 +98,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake")
if wide_ui:
col = split.column()
col = split.column()
col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True
col.operator("ptcache.free_bake_all", text="Free All Bakes")
col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
@ -112,7 +107,6 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
def effector_weights_ui(self, context, weights):
layout = self.layout
wide_ui = context.region.width > narrowui
layout.prop(weights, "group")
@ -121,8 +115,7 @@ def effector_weights_ui(self, context, weights):
col = split.column()
col.prop(weights, "gravity", slider=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(weights, "all", slider=True)
layout.separator()
@ -137,8 +130,7 @@ def effector_weights_ui(self, context, weights):
col.prop(weights, "curveguide", slider=True)
col.prop(weights, "texture", slider=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(weights, "harmonic", slider=True)
col.prop(weights, "charge", slider=True)
col.prop(weights, "lennardjones", slider=True)
@ -150,7 +142,6 @@ def effector_weights_ui(self, context, weights):
def basic_force_field_settings_ui(self, context, field):
layout = self.layout
wide_ui = context.region.width > narrowui
split = layout.split()
@ -177,8 +168,7 @@ def basic_force_field_settings_ui(self, context, field):
else:
col.prop(field, "flow")
if wide_ui:
col = split.column()
col = split.column()
col.prop(field, "noise")
col.prop(field, "seed")
if field.type == 'TURBULENCE':
@ -193,8 +183,7 @@ def basic_force_field_settings_ui(self, context, field):
col.prop(field, "do_location")
col.prop(field, "do_rotation")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Collision:")
col.prop(field, "do_absorption")
@ -202,12 +191,9 @@ def basic_force_field_settings_ui(self, context, field):
def basic_force_field_falloff_ui(self, context, field):
layout = self.layout
wide_ui = context.region.width > narrowui
# XXX: This doesn't update for some reason.
#if wide_ui:
# split = layout.split()
#else:
#split = layout.split()
split = layout.split(percentage=0.35)
if not field or field.type == 'NONE':
@ -218,8 +204,7 @@ def basic_force_field_falloff_ui(self, context, field):
col.prop(field, "use_min_distance", text="Use Minimum")
col.prop(field, "use_max_distance", text="Use Maximum")
if wide_ui:
col = split.column()
col = split.column()
col.prop(field, "falloff_power", text="Power")
sub = col.column()

@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
from properties_physics_common import basic_force_field_settings_ui
from properties_physics_common import basic_force_field_falloff_ui
@ -31,7 +29,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)
@ -44,22 +43,15 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
ob = context.object
field = ob.field
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.2)
split.label(text="Type:")
else:
split = layout.split()
split = layout.split(percentage=0.2)
split.label(text="Type:")
split.prop(field, "type", text="")
if field.type not in ('NONE', 'GUIDE', 'TEXTURE'):
if wide_ui:
split = layout.split(percentage=0.2)
split.label(text="Shape:")
else:
split = layout.split()
split = layout.split(percentage=0.2)
split.label(text="Shape:")
split.prop(field, "shape", text="")
split = layout.split()
@ -74,8 +66,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
col.prop(field, "guide_path_add")
col.prop(field, "use_guide_path_weight")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Clumping:")
col.prop(field, "guide_clump_amount")
col.prop(field, "guide_clump_shape")
@ -98,8 +89,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
col.prop(field, "guide_kink_frequency")
col.prop(field, "guide_kink_shape")
if wide_ui:
col = split.column()
col = split.column()
col.prop(field, "guide_kink_amplitude")
elif field.type == 'TEXTURE':
@ -109,8 +99,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
col.prop(field, "texture_mode", text="")
col.prop(field, "texture_nabla")
if wide_ui:
col = split.column()
col = split.column()
col.prop(field, "use_coordinates")
col.prop(field, "root_coordinates")
col.prop(field, "force_2d")
@ -134,8 +123,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
col.prop(field, "use_radial_min", text="Use Minimum")
col.prop(field, "use_radial_max", text="Use Maximum")
if wide_ui:
col = split.column()
col = split.column()
col.prop(field, "radial_falloff", text="Power")
sub = col.column()
@ -156,8 +144,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
col.prop(field, "use_radial_min", text="Use Minimum")
col.prop(field, "use_radial_max", text="Use Maximum")
if wide_ui:
col = split.column()
col = split.column()
col.prop(field, "radial_falloff", text="Power")
sub = col.column()
@ -173,7 +160,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)
@ -182,7 +170,6 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
layout = self.layout
md = context.collision
wide_ui = context.region.width > narrowui
split = layout.split()
@ -190,8 +177,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
# remove modifier + settings
split.set_context_pointer("modifier", md)
split.operator("object.modifier_remove", text="Remove")
if wide_ui:
col = split.column()
col = split.column()
#row = split.row(align=True)
#row.prop(md, "render", text="")
@ -202,8 +188,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'COLLISION'
if wide_ui:
split.label()
split.label()
coll = None
@ -229,8 +214,7 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
sub.prop(settings, "friction_factor", text="Factor", slider=True)
sub.prop(settings, "random_friction", text="Random", slider=True)
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Soft Body and Cloth:")
sub = col.column(align=True)
sub.prop(settings, "outer_thickness", text="Outer", slider=True)

@ -19,15 +19,14 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
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)
@ -40,7 +39,6 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
layout = self.layout
md = context.fluid
wide_ui = context.region.width > narrowui
split = layout.split()
@ -58,22 +56,16 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'FLUID_SIMULATION'
if wide_ui:
split.label()
split.label()
fluid = None
if fluid:
if wide_ui:
row = layout.row()
row.prop(fluid, "type")
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
row.prop(fluid, "active", text="")
else:
layout.prop(fluid, "type", text="")
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
layout.prop(fluid, "active", text="")
row = layout.row()
row.prop(fluid, "type")
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
row.prop(fluid, "active", text="")
layout = layout.column()
if fluid.type not in ('NONE', 'DOMAIN', 'PARTICLE'):
@ -89,8 +81,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
col.label(text="Render Display:")
col.prop(fluid, "render_display_mode", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Required Memory: " + fluid.memory_estimate)
col.prop(fluid, "preview_resolution", text="Preview")
col.label(text="Viewport Display:")
@ -104,9 +95,8 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
sub.prop(fluid, "start_time", text="Start")
sub.prop(fluid, "end_time", text="End")
if wide_ui:
col = split.column()
col.label()
col = split.column()
col.label()
col.prop(fluid, "generate_speed_vectors")
col.prop(fluid, "reverse_frames")
@ -120,8 +110,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
col.prop(fluid, "volume_initialization", text="")
col.prop(fluid, "export_animated_mesh")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Initial Velocity:")
col.prop(fluid, "initial_velocity", text="")
@ -133,8 +122,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
col.prop(fluid, "volume_initialization", text="")
col.prop(fluid, "export_animated_mesh")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Slip Type:")
col.prop(fluid, "slip_type", text="")
if fluid.slip_type == 'PARTIALSLIP':
@ -152,8 +140,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
col.prop(fluid, "export_animated_mesh")
col.prop(fluid, "local_coordinates")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Inflow Velocity:")
col.prop(fluid, "inflow_velocity", text="")
@ -165,8 +152,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
col.prop(fluid, "volume_initialization", text="")
col.prop(fluid, "export_animated_mesh")
if wide_ui:
split.column()
split.column()
elif fluid.type == 'PARTICLE':
split = layout.split()
@ -176,8 +162,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
col.prop(fluid, "particle_influence", text="Size")
col.prop(fluid, "alpha_influence", text="Alpha")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Type:")
col.prop(fluid, "drops")
col.prop(fluid, "floats")
@ -193,8 +178,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
col.prop(fluid, "quality", slider=True)
col.prop(fluid, "reverse_frames")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Time:")
sub = col.column(align=True)
sub.prop(fluid, "start_time", text="Start")
@ -208,8 +192,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
sub.prop(fluid, "attraction_strength", text="Strength")
sub.prop(fluid, "attraction_radius", text="Radius")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Velocity Force:")
sub = col.column(align=True)
sub.prop(fluid, "velocity_strength", text="Strength")
@ -220,16 +203,16 @@ 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
fluid = context.fluid.settings
scene = context.scene
wide_ui = context.region.width > narrowui
split = layout.split()
@ -252,8 +235,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
col.label(text="Real World Size:")
col.prop(fluid, "real_world_size", text="Metres")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Viscosity Presets:")
sub = col.column(align=True)
sub.prop(fluid, "viscosity_preset", text="")
@ -271,15 +253,15 @@ 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
fluid = context.fluid.settings
wide_ui = context.region.width > narrowui
split = layout.split()
@ -289,8 +271,7 @@ class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
if fluid.slip_type == 'PARTIALSLIP':
col.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Surface:")
col.prop(fluid, "surface_smoothing", text="Smoothing")
col.prop(fluid, "surface_subdivisions", text="Subdivisions")
@ -300,9 +281,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

@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
@ -31,7 +29,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)
@ -45,7 +44,6 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
md = context.smoke
ob = context.object
wide_ui = context.region.width > narrowui
split = layout.split()
@ -61,14 +59,10 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'SMOKE'
if wide_ui:
split.label()
split.label()
if md:
if wide_ui:
layout.prop(md, "smoke_type", expand=True)
else:
layout.prop(md, "smoke_type", text="")
layout.prop(md, "smoke_type", expand=True)
if md.smoke_type == 'DOMAIN':
domain = md.domain_settings
@ -83,8 +77,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
col.label(text="Border Collisions:")
col.prop(domain, "smoke_domain_colli", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Behavior:")
col.prop(domain, "alpha")
col.prop(domain, "beta")
@ -114,8 +107,8 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
sub.active = flow.initial_velocity
sub.prop(flow, "velocity_multiplier", text="Multiplier")
if wide_ui:
sub = split.column()
sub = split.column()
sub.active = not md.flow_settings.outflow
sub.label(text="Behavior:")
sub.prop(flow, "temperature")
@ -130,7 +123,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')
@ -138,7 +132,6 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
layout = self.layout
group = context.smoke.domain_settings
wide_ui = context.region.width > narrowui
split = layout.split()
@ -149,8 +142,7 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
#col.label(text="Effector Group:")
#col.prop(group, "eff_group", text="")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Collision Group:")
col.prop(group, "coll_group", text="")
@ -159,7 +151,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 +172,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')
@ -192,7 +186,6 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
layout = self.layout
md = context.smoke.domain_settings
wide_ui = context.region.width > narrowui
layout.active = md.highres
@ -204,8 +197,7 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
col.prop(md, "smoothemitter")
col.prop(md, "viewhighres")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Noise Method:")
col.row().prop(md, "noise_type", text="")
col.prop(md, "strength")
@ -215,7 +207,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 +228,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')

@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
from properties_physics_common import point_cache_ui
from properties_physics_common import effector_weights_ui
@ -35,7 +33,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)
@ -51,7 +50,6 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
md = context.soft_body
ob = context.object
wide_ui = context.region.width > narrowui
split = layout.split()
@ -66,8 +64,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
else:
# add modifier
split.operator("object.modifier_add", text="Add").type = 'SOFT_BODY'
if wide_ui:
split.column()
split.column()
if md:
softbody = md.settings
@ -82,8 +79,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
col.prop(softbody, "mass")
col.prop_object(softbody, "mass_vertex_group", ob, "vertex_groups", text="Mass:")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Simulation:")
col.prop(softbody, "speed")
@ -92,7 +88,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 +101,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):
@ -119,7 +117,6 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
md = context.soft_body
softbody = md.settings
ob = context.object
wide_ui = context.region.width > narrowui
layout.active = softbody.use_goal and softbody_panel_enabled(md)
@ -135,8 +132,7 @@ class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
sub.prop(softbody, "goal_min", text="Minimum")
sub.prop(softbody, "goal_max", text="Maximum")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Goal Settings:")
col.prop(softbody, "goal_spring", text="Stiffness")
col.prop(softbody, "goal_friction", text="Damping")
@ -148,7 +144,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):
@ -163,7 +160,6 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
md = context.soft_body
softbody = md.settings
ob = context.object
wide_ui = context.region.width > narrowui
layout.active = softbody.use_edges and softbody_panel_enabled(md)
@ -179,8 +175,7 @@ class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
col.prop(softbody, "spring_length", text="Length")
col.prop_object(softbody, "spring_vertex_group", ob, "vertex_groups", text="Springs:")
if wide_ui:
col = split.column()
col = split.column()
col.prop(softbody, "stiff_quads")
sub = col.column()
sub.active = softbody.stiff_quads
@ -203,7 +198,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):
@ -217,15 +213,11 @@ class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel):
md = context.soft_body
softbody = md.settings
wide_ui = context.region.width > narrowui
layout.active = softbody.self_collision and softbody_panel_enabled(md)
layout.label(text="Collision Ball Size Calculation:")
if wide_ui:
layout.prop(softbody, "collision_type", expand=True)
else:
layout.prop(softbody, "collision_type", text="")
layout.prop(softbody, "collision_type", expand=True)
col = layout.column(align=True)
col.label(text="Ball:")
@ -238,7 +230,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):
@ -246,7 +239,6 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
md = context.soft_body
softbody = md.settings
wide_ui = context.region.width > narrowui
layout.active = softbody_panel_enabled(md)
@ -259,8 +251,7 @@ class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
col.prop(softbody, "maxstep")
col.prop(softbody, "auto_step", text="Auto-Step")
if wide_ui:
col = split.column()
col = split.column()
col.prop(softbody, "error_limit")
col.label(text="Helpers:")
col.prop(softbody, "choke")
@ -275,7 +266,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):

@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
class RENDER_MT_presets(bpy.types.Menu):
bl_label = "Render Presets"
@ -42,28 +40,27 @@ 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
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.operator("render.render", text="Image", icon='RENDER_STILL')
if wide_ui:
col = split.column()
col = split.column()
col.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
layout.prop(rd, "display_mode", text="Display")
@ -74,12 +71,16 @@ 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
scene = context.scene
rd = scene.render
wide_ui = context.region.width > narrowui
row = layout.row()
row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
@ -100,8 +101,8 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
col.label(text="")
col.prop(rl, "light_override", text="Light")
col.prop(rl, "material_override", text="Material")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rl, "visible_layers", text="Layer")
col.label(text="Mask Layers:")
col.prop(rl, "zmask_layers", text="")
@ -144,8 +145,7 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
col.prop(rl, "pass_object_index")
col.prop(rl, "pass_color")
if wide_ui:
col = split.column()
col = split.column()
col.label()
col.prop(rl, "pass_diffuse")
row = col.row()
@ -178,11 +178,15 @@ 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
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
@ -192,8 +196,7 @@ class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "use_sss", text="Subsurface Scattering")
col.prop(rd, "use_envmaps", text="Environment Map")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "use_raytracing", text="Ray Tracing")
col.prop(rd, "color_management")
col.prop(rd, "alpha_mode", text="Alpha")
@ -204,11 +207,15 @@ 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
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
@ -223,8 +230,7 @@ class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel):
sub.prop(rd, "parts_x", text="X")
sub.prop(rd, "parts_y", text="Y")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Memory:")
sub = col.column()
sub.enabled = not (rd.use_border or rd.full_sample)
@ -248,11 +254,15 @@ 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
rd = context.scene.render
wide_ui = context.region.width > narrowui
split = layout.split()
@ -260,8 +270,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "use_compositing")
col.prop(rd, "use_sequencer")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "dither_intensity", text="Dither", slider=True)
layout.separator()
@ -276,10 +285,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
sub.prop(rd, "fields_still", text="Still")
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.prop(rd, "edge")
sub = col.column()
sub.active = rd.edge
@ -291,12 +297,16 @@ 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
rd = context.scene.render
file_format = rd.file_format
wide_ui = context.region.width > narrowui
layout.prop(rd, "output_path", text="")
@ -305,8 +315,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "file_format", text="")
col.row().prop(rd, "color_mode", text="Color", expand=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "use_file_extension")
col.prop(rd, "use_overwrite")
col.prop(rd, "use_placeholder")
@ -325,8 +334,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
col.label(text="Codec:")
col.prop(rd, "exr_codec", text="")
if wide_ui:
col = split.column()
col = split.column()
elif file_format == 'OPEN_EXR':
split = layout.split()
@ -335,14 +343,12 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col.label(text="Codec:")
col.prop(rd, "exr_codec", text="")
if wide_ui:
subsplit = split.split()
col = subsplit.column()
subsplit = split.split()
col = subsplit.column()
col.prop(rd, "exr_half")
col.prop(rd, "exr_zbuf")
if wide_ui:
col = subsplit.column()
col = subsplit.column()
col.prop(rd, "exr_preview")
elif file_format == 'JPEG2000':
@ -351,8 +357,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col.label(text="Depth:")
col.row().prop(rd, "jpeg2k_depth", expand=True)
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "jpeg2k_preset", text="")
col.prop(rd, "jpeg2k_ycc")
@ -361,8 +366,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(rd, "cineon_log", text="Convert to Log")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.active = rd.cineon_log
col.prop(rd, "cineon_black", text="Black")
col.prop(rd, "cineon_white", text="White")
@ -389,21 +393,22 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
if rd.quicktime_audiocodec_type == 'LPCM':
col.prop(rd, "quicktime_audio_bitdepth", text="")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "quicktime_audio_samplerate", text="")
split = layout.split()
col = split.column()
if rd.quicktime_audiocodec_type == 'AAC':
col.prop(rd, "quicktime_audio_bitrate")
if wide_ui:
subsplit = split.split()
col = subsplit.column()
subsplit = split.split()
col = subsplit.column()
if rd.quicktime_audiocodec_type == 'AAC':
col.prop(rd, "quicktime_audio_codec_isvbr")
if wide_ui:
col = subsplit.column()
col = subsplit.column()
col.prop(rd, "quicktime_audio_resampling_hq")
@ -412,7 +417,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')
@ -420,7 +426,6 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
layout = self.layout
rd = context.scene.render
wide_ui = context.region.width > narrowui
layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
@ -429,19 +434,17 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(rd, "ffmpeg_format")
if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "ffmpeg_codec")
else:
if wide_ui:
split.label()
split.label()
split = layout.split()
col = split.column()
col.prop(rd, "ffmpeg_video_bitrate")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "ffmpeg_gopsize")
split = layout.split()
@ -452,8 +455,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "ffmpeg_maxrate", text="Maximum")
col.prop(rd, "ffmpeg_buffersize", text="Buffer")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "ffmpeg_autosplit")
col.label(text="Mux:")
@ -474,8 +476,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "ffmpeg_audio_bitrate")
col.prop(rd, "ffmpeg_audio_mixrate")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "ffmpeg_audio_volume", slider=True)
@ -483,6 +484,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
@ -492,7 +498,6 @@ class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
layout = self.layout
rd = context.scene.render
wide_ui = context.region.width > narrowui
layout.active = rd.render_antialiasing
split = layout.split()
@ -503,8 +508,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
sub.enabled = not rd.use_border
sub.prop(rd, "full_sample")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "pixel_filter", text="")
col.prop(rd, "filter_size", text="Size")
@ -514,6 +518,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,12 +542,16 @@ 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
scene = context.scene
rd = scene.render
wide_ui = context.region.width > narrowui
row = layout.row(align=True)
row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
@ -563,8 +576,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
sub.active = rd.use_border
sub.prop(rd, "crop_to_border", text="Crop")
if wide_ui:
col = split.column()
col = split.column()
sub = col.column(align=True)
sub.label(text="Frame Range:")
sub.prop(scene, "frame_start", text="Start")
@ -581,6 +593,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
@ -590,7 +607,6 @@ class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
layout = self.layout
rd = context.scene.render
wide_ui = context.region.width > narrowui
layout.active = rd.render_stamp
@ -607,8 +623,7 @@ class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "stamp_marker", text="Marker")
col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
if wide_ui:
col = split.column()
col = split.column()
col.active = rd.render_stamp
col.prop(rd, "stamp_foreground", slider=True)
col.prop(rd, "stamp_background", slider=True)
@ -627,24 +642,22 @@ 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
rd = context.scene.render
wide_ui = context.region.width > narrowui
layout.operator("object.bake_image", icon='RENDER_STILL')
if wide_ui:
layout.prop(rd, "bake_type")
else:
layout.prop(rd, "bake_type", text="")
layout.prop(rd, "bake_type")
if rd.bake_type == 'NORMALS':
if wide_ui:
layout.prop(rd, "bake_normal_space")
else:
layout.prop(rd, "bake_normal_space", text="")
layout.prop(rd, "bake_normal_space")
elif rd.bake_type in ('DISPLACEMENT', 'AO'):
layout.prop(rd, "bake_normalized")
@ -660,8 +673,7 @@ class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "bake_margin")
col.prop(rd, "bake_quad_split", text="Split")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "bake_active")
sub = col.column()
sub.active = rd.bake_active

@ -20,15 +20,14 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class SceneButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def poll(self, context):
@staticmethod
def poll(context):
return context.scene
@ -38,15 +37,10 @@ class SCENE_PT_scene(SceneButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
wide_ui = context.region.width > narrowui
scene = context.scene
if wide_ui:
layout.prop(scene, "camera")
layout.prop(scene, "set", text="Background")
else:
layout.prop(scene, "camera", text="")
layout.prop(scene, "set", text="")
layout.prop(scene, "camera")
layout.prop(scene, "set", text="Background")
class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
@ -59,7 +53,6 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
wide_ui = context.region.width > narrowui
unit = context.scene.unit_settings
col = layout.column()
@ -71,8 +64,7 @@ class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(unit, "scale_length", text="Scale")
if wide_ui:
col = split.column()
col = split.column()
col.prop(unit, "use_separate")
layout.column().prop(unit, "rotation_units")
@ -85,7 +77,6 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
layout = self.layout
scene = context.scene
wide_ui = context.region.width > narrowui
row = layout.row()
col = row.column()
@ -107,8 +98,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
op = subcol.operator("anim.keying_set_export", text="Export to File")
op.filepath = "keyingset.py"
if wide_ui:
col = row.column()
col = row.column()
col.label(text="Keyframing Settings:")
col.prop(ks, "insertkey_needed", text="Needed")
col.prop(ks, "insertkey_visual", text="Visual")
@ -118,7 +108,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):
@ -126,7 +117,6 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
scene = context.scene
ks = scene.active_keying_set
wide_ui = context.region.width > narrowui
row = layout.row()
row.label(text="Paths:")
@ -156,8 +146,7 @@ class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
if ksp.entire_array is False:
col.prop(ksp, "array_index")
if wide_ui:
col = row.column()
col = row.column()
col.label(text="F-Curve Grouping:")
col.prop(ksp, "grouping")
if ksp.grouping == 'NAMED':
@ -180,14 +169,10 @@ class SCENE_PT_physics(SceneButtonsPanel, bpy.types.Panel):
layout = self.layout
scene = context.scene
wide_ui = context.region.width > narrowui
layout.active = scene.use_gravity
if wide_ui:
layout.prop(scene, "gravity", text="")
else:
layout.column().prop(scene, "gravity", text="")
layout.prop(scene, "gravity", text="")
class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
@ -203,7 +188,6 @@ class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
layout = self.layout
scene = context.scene
rd = scene.render
wide_ui = context.region.width > narrowui
layout.active = rd.use_simplify
@ -215,8 +199,7 @@ class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
col.prop(rd, "simplify_triangulate")
if wide_ui:
col = split.column()
col = split.column()
col.prop(rd, "simplify_shadow_samples", text="Shadow Samples")
col.prop(rd, "simplify_ao_sss", text="AO and SSS")

@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class TEXTURE_MT_specials(bpy.types.Menu):
bl_label = "Texture Specials"
@ -70,18 +68,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 +96,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
@ -113,7 +110,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
node = context.texture_node
space = context.space_data
tex = context.texture
wide_ui = context.region.width > narrowui
idblock = context_tex_datablock(context)
tex_collection = space.pin_id == None and type(idblock) != bpy.types.Brush and not node
@ -127,11 +123,8 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
if wide_ui:
split = layout.split(percentage=0.65)
col = split.column()
else:
col = layout.column()
split = layout.split(percentage=0.65)
col = split.column()
if tex_collection:
col.template_ID(idblock, "active_texture", new="texture.new")
@ -143,8 +136,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
if space.pin_id:
col.template_ID(space, "pin_id")
if wide_ui:
col = split.column()
col = split.column()
if not space.pin_id:
col.prop(space, "brush_texture", text="Brush", toggle=True)
@ -159,20 +151,18 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
split.prop(slot, "output_node", text="")
else:
if wide_ui:
split.label(text="Type:")
split.prop(tex, "type", text="")
else:
layout.prop(tex, "type", text="")
split.label(text="Type:")
split.prop(tex, "type", text="")
class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
_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,11 +170,15 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
layout.prop(tex, "use_color_ramp", text="Ramp")
if tex.use_color_ramp:
@ -199,8 +193,7 @@ class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
sub.prop(tex, "factor_green", text="G")
sub.prop(tex, "factor_blue", text="B")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Adjust:")
col.prop(tex, "brightness")
col.prop(tex, "contrast")
@ -212,19 +205,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 +228,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
@ -242,7 +237,6 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
tex = context.texture_slot
# textype = context.texture
wide_ui = context.region.width > narrowui
if type(idblock) != bpy.types.Brush:
split = layout.split(percentage=0.3)
@ -294,11 +288,10 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
col.prop(tex, "from_dupli")
elif tex.texture_coordinates == 'OBJECT':
col.prop(tex, "from_original")
elif wide_ui:
else:
col.label()
if wide_ui:
col = split.column()
col = split.column()
row = col.row()
row.prop(tex, "x_mapping", text="")
row.prop(tex, "y_mapping", text="")
@ -309,10 +302,7 @@ class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
col = split.column()
col.prop(tex, "offset")
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.prop(tex, "size")
@ -321,7 +311,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 +321,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):
@ -340,7 +331,6 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
# textype = context.texture
tex = context.texture_slot
wide_ui = context.region.width > narrowui
def factor_but(layout, active, toggle, factor, name):
row = layout.row(align=True)
@ -365,8 +355,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color")
factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Shading:")
factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient")
factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit")
@ -391,9 +380,8 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering")
factor_but(col, tex.map_reflection, "map_reflection", "reflection_factor", "Reflection")
if wide_ui:
col = split.column()
col.label(text=" ")
col = split.column()
col.label(text=" ")
factor_but(col, tex.map_coloremission, "map_coloremission", "coloremission_factor", "Emission Color")
factor_but(col, tex.map_colortransmission, "map_colortransmission", "colortransmission_factor", "Transmission Color")
factor_but(col, tex.map_colorreflection, "map_colorreflection", "colorreflection_factor", "Reflection Color")
@ -404,8 +392,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
col = split.column()
factor_but(col, tex.map_color, "map_color", "color_factor", "Color")
if wide_ui:
col = split.column()
col = split.column()
factor_but(col, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
elif type(idblock) == bpy.types.World:
@ -415,8 +402,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend")
factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon")
if wide_ui:
col = split.column()
col = split.column()
factor_but(col, tex.map_zenith_up, "map_zenith_up", "zenith_up_factor", "Zenith Up")
factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down")
@ -431,8 +417,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
sub.active = tex.rgb_to_intensity
sub.prop(tex, "color", text="")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "negate", text="Negative")
col.prop(tex, "stencil")
@ -443,12 +428,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,19 +436,21 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
layout.prop(tex, "stype", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
if wide_ui:
layout.prop(tex, "noise_basis", text="Basis")
else:
layout.prop(tex, "noise_basis", text="")
layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
@ -476,8 +458,7 @@ class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel):
col.prop(tex, "noise_size", text="Size")
col.prop(tex, "noise_depth", text="Depth")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "nabla", text="Nabla")
@ -486,26 +467,25 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
layout.prop(tex, "noisebasis2", expand=True)
if wide_ui:
layout.prop(tex, "stype", expand=True)
else:
layout.prop(tex, "stype", text="")
layout.prop(tex, "stype", expand=True)
col = layout.column()
col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
col.label(text="Noise:")
col.row().prop(tex, "noise_type", text="Type", expand=True)
if wide_ui:
layout.prop(tex, "noise_basis", text="Basis")
else:
layout.prop(tex, "noise_basis", text="")
layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
split.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
@ -523,20 +503,22 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
layout.prop(tex, "stype", expand=True)
layout.prop(tex, "noisebasis2", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
if wide_ui:
layout.prop(tex, "noise_basis", text="Basis")
else:
layout.prop(tex, "noise_basis", text="")
layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
@ -544,8 +526,7 @@ class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel):
col.prop(tex, "noise_size", text="Size")
col.prop(tex, "noise_depth", text="Depth")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "turbulence")
col.prop(tex, "nabla")
@ -555,19 +536,23 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
split = layout.split()
col = split.column()
col.prop(tex, "noise_depth", text="Depth")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "turbulence")
@ -576,16 +561,18 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(tex, "progression")
else:
layout.prop(tex, "progression", text="")
layout.prop(tex, "progression")
sub = layout.row()
@ -598,27 +585,28 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
layout.prop(tex, "stype", expand=True)
layout.label(text="Noise:")
layout.prop(tex, "noise_type", text="Type", expand=True)
if wide_ui:
layout.prop(tex, "noise_basis", text="Basis")
else:
layout.prop(tex, "noise_basis", text="")
layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
col.prop(tex, "noise_size", text="Size")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "turbulence")
@ -627,6 +615,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,12 +648,17 @@ 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
tex = context.texture
# slot = context.texture_slot
wide_ui = context.region.width > narrowui
split = layout.split()
@ -671,10 +670,8 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
col.separator()
col.prop(tex, "flip_axis", text="Flip X/Y Axis")
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.prop(tex, "normal_map")
row = col.row()
row.active = tex.normal_map
@ -695,16 +692,18 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(tex, "extension")
else:
layout.prop(tex, "extension", text="")
layout.prop(tex, "extension")
split = layout.split()
@ -714,8 +713,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
col.prop(tex, "repeat_x", text="X")
col.prop(tex, "repeat_y", text="Y")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.label(text="Mirror:")
col.prop(tex, "mirror_x", text="X")
col.prop(tex, "mirror_y", text="Y")
@ -727,8 +725,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
row.prop(tex, "checker_even", text="Even")
row.prop(tex, "checker_odd", text="Odd")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "checker_distance", text="Distance")
layout.separator()
@ -741,8 +738,7 @@ class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
col.prop(tex, "crop_min_x", text="X")
col.prop(tex, "crop_min_y", text="Y")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.label(text="Crop Maximum:")
col.prop(tex, "crop_max_x", text="X")
col.prop(tex, "crop_max_y", text="Y")
@ -753,6 +749,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,13 +768,18 @@ 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
tex = context.texture
env = tex.environment_map
wide_ui = context.region.width > narrowui
row = layout.row()
row.prop(env, "source", expand=True)
@ -794,8 +801,7 @@ class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
col.prop(env, "resolution")
col.prop(env, "depth")
if wide_ui:
col = split.column(align=True)
col = split.column(align=True)
col.label(text="Clipping:")
col.prop(env, "clip_start", text="Start")
@ -808,6 +814,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,16 +833,18 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(tex, "musgrave_type")
else:
layout.prop(tex, "musgrave_type", text="")
layout.prop(tex, "musgrave_type")
split = layout.split()
@ -839,8 +853,7 @@ class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
col.prop(tex, "lacunarity")
col.prop(tex, "octaves")
if wide_ui:
col = split.column()
col = split.column()
if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
col.prop(tex, "offset")
if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
@ -849,18 +862,14 @@ class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
layout.label(text="Noise:")
if wide_ui:
layout.prop(tex, "noise_basis", text="Basis")
else:
layout.prop(tex, "noise_basis", text="")
layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
col = split.column()
col.prop(tex, "noise_size", text="Size")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "nabla")
@ -869,11 +878,16 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
split = layout.split()
@ -887,8 +901,7 @@ class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel):
col.prop(tex, "coloring", text="")
col.prop(tex, "noise_intensity", text="Intensity")
if wide_ui:
col = split.column()
col = split.column()
sub = col.column(align=True)
sub.label(text="Feature Weights:")
sub.prop(tex, "weight_1", text="1", slider=True)
@ -903,8 +916,7 @@ class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel):
col = split.column()
col.prop(tex, "noise_size", text="Size")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "nabla")
@ -913,18 +925,19 @@ 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
tex = context.texture
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(tex, "noise_distortion")
layout.prop(tex, "noise_basis", text="Basis")
else:
layout.prop(tex, "noise_distortion", text="")
layout.prop(tex, "noise_basis", text="")
layout.prop(tex, "noise_distortion")
layout.prop(tex, "noise_basis", text="Basis")
split = layout.split()
@ -932,8 +945,7 @@ class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel):
col.prop(tex, "distortion", text="Distortion")
col.prop(tex, "noise_size", text="Size")
if wide_ui:
col = split.column()
col = split.column()
col.prop(tex, "nabla")
@ -941,10 +953,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,22 +992,19 @@ 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
tex = context.texture
pd = tex.pointdensity
wide_ui = context.region.width > narrowui
if wide_ui:
layout.prop(pd, "point_source", expand=True)
else:
layout.prop(pd, "point_source", text="")
layout.prop(pd, "point_source", expand=True)
split = layout.split()
@ -1025,8 +1035,7 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'):
layout.template_color_ramp(pd, "color_ramp", expand=True)
if wide_ui:
col = split.column()
col = split.column()
col.label()
col.prop(pd, "radius")
col.label(text="Falloff:")
@ -1039,10 +1048,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
@ -1058,7 +1068,6 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
tex = context.texture
pd = tex.pointdensity
layout.active = pd.turbulence
wide_ui = context.region.width > narrowui
split = layout.split()
@ -1068,9 +1077,8 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
col.label(text="Noise Basis:")
col.prop(pd, "noise_basis", text="")
if wide_ui:
col = split.column()
col.label()
col = split.column()
col.label()
col.prop(pd, "turbulence_size")
col.prop(pd, "turbulence_depth")
col.prop(pd, "turbulence_strength")

@ -20,8 +20,6 @@
import bpy
from rna_prop_ui import PropertyPanel
narrowui = bpy.context.user_preferences.view.properties_width_check
class WorldButtonsPanel():
bl_space_type = 'PROPERTIES'
@ -29,15 +27,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 +46,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
@ -57,17 +57,12 @@ class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
scene = context.scene
world = context.world
space = context.space_data
wide_ui = context.region.width > narrowui
if wide_ui:
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")
else:
layout.template_ID(scene, "world", new="world.new")
split = layout.split(percentage=0.65)
if scene:
split.template_ID(scene, "world", new="world.new")
elif world:
split.template_ID(space, "pin_id")
class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
@ -81,19 +76,12 @@ class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
wide_ui = context.region.width > narrowui
world = context.world
if wide_ui:
row = layout.row()
row.prop(world, "paper_sky")
row.prop(world, "blend_sky")
row.prop(world, "real_sky")
else:
col = layout.column()
col.prop(world, "paper_sky")
col.prop(world, "blend_sky")
col.prop(world, "real_sky")
row = layout.row()
row.prop(world, "paper_sky")
row.prop(world, "blend_sky")
row.prop(world, "real_sky")
row = layout.row()
row.column().prop(world, "horizon_color")
@ -115,7 +103,6 @@ class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
wide_ui = context.region.width > narrowui
world = context.world
layout.active = world.mist.use_mist
@ -126,8 +113,7 @@ class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
col.prop(world.mist, "intensity", slider=True)
col.prop(world.mist, "start")
if wide_ui:
col = split.column()
col = split.column()
col.prop(world.mist, "depth")
col.prop(world.mist, "height")
@ -146,7 +132,6 @@ class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
wide_ui = context.region.width > narrowui
world = context.world
layout.active = world.stars.use_stars
@ -157,8 +142,7 @@ class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
col.prop(world.stars, "size")
col.prop(world.stars, "color_randomization", text="Colors")
if wide_ui:
col = split.column()
col = split.column()
col.prop(world.stars, "min_distance", text="Min. Dist")
col.prop(world.stars, "average_separation", text="Separation")
@ -205,7 +189,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):

@ -19,8 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
class IMAGE_MT_view(bpy.types.Menu):
bl_label = "View"
@ -335,7 +333,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 +353,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')
@ -364,7 +364,6 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
sima = context.space_data
ima = sima.image
wide_ui = context.region.width > narrowui
split = layout.split()
@ -385,8 +384,7 @@ class IMAGE_PT_game_properties(bpy.types.Panel):
sub.prop(ima, "tiles_x", text="X")
sub.prop(ima, "tiles_y", text="Y")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Clamp:")
col.prop(ima, "clamp_x", text="X")
col.prop(ima, "clamp_y", text="Y")
@ -399,7 +397,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 +416,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 +436,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 +454,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 +472,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 +493,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))
@ -501,7 +505,6 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
ima = sima.image
show_uvedit = sima.show_uvedit
uvedit = sima.uv_editor
wide_ui = context.region.width > narrowui
split = layout.split()
@ -509,8 +512,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
if ima:
col.prop(ima, "display_aspect", text="Aspect Ratio")
if wide_ui:
col = split.column()
col = split.column()
col.label(text="Coordinates:")
col.prop(sima, "draw_repeated", text="Repeat")
if show_uvedit:
@ -528,10 +530,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
col = layout.column()
col.label(text="UVs:")
row = col.row()
if wide_ui:
row.prop(uvedit, "edge_draw_type", expand=True)
else:
row.prop(uvedit, "edge_draw_type", text="")
row.prop(uvedit, "edge_draw_type", expand=True)
split = layout.split()
col = split.column()
@ -540,8 +539,7 @@ class IMAGE_PT_view_properties(bpy.types.Panel):
#col.prop(uvedit, "draw_edges")
#col.prop(uvedit, "draw_faces")
if wide_ui:
col = split.column()
col = split.column()
col.prop(uvedit, "draw_stretch", text="Stretch")
sub = col.column()
sub.active = uvedit.draw_stretch
@ -553,7 +551,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 +597,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 +622,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 +654,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

@ -316,22 +316,26 @@ class SequencerButtonsPanel():
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
def has_sequencer(self, context):
@staticmethod
def has_sequencer(context):
return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
def poll(self, context):
return self.has_sequencer(context) and (act_strip(context) is not None)
@staticmethod
def poll(context):
return __class__.has_sequencer(context) and (act_strip(context) is not None)
class SequencerButtonsPanel_Output():
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
def has_preview(self, context):
@staticmethod
def has_preview(context):
return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
def poll(self, context):
return self.has_preview(context)
@staticmethod
def poll(context):
return __class__.has_preview(context)
class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
@ -384,8 +388,9 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Effect Strip"
def poll(self, context):
if not self.has_sequencer(context):
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
return False
strip = act_strip(context)
@ -513,8 +518,9 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Strip Input"
def poll(self, context):
if not self.has_sequencer(context):
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
return False
strip = act_strip(context)
@ -580,15 +586,16 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
col = layout.column(align=True)
col.label(text="Trim Duration:")
col.prop(strip, "animation_start_offset", text="Start")
col.prop(strip, "animation_end_offset", text="End")
col.prop(strip, "frame_offset_start", text="Start")
col.prop(strip, "frame_offset_end", text="End")
class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
def poll(self, context):
if not self.has_sequencer(context):
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
return False
strip = act_strip(context)
@ -627,8 +634,9 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Scene"
def poll(self, context):
if not self.has_sequencer(context):
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
return False
strip = act_strip(context)
@ -651,8 +659,9 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Filter"
def poll(self, context):
if not self.has_sequencer(context):
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
return False
strip = act_strip(context)
@ -712,8 +721,9 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Proxy"
def poll(self, context):
if not self.has_sequencer(context):
@staticmethod
def poll(context):
if not __class__.has_sequencer(context):
return False
strip = act_strip(context)

@ -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')
@ -175,12 +176,6 @@ class USERPREF_PT_interface(bpy.types.Panel):
sub.prop(view, "mini_axis_brightness", text="Brightness")
col.separator()
col.separator()
col.separator()
col.label(text="Properties Window:")
col.prop(view, "properties_width_check")
row.separator()
row.separator()
@ -242,7 +237,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 +352,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 +517,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 +650,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 +722,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 +817,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'
@ -2244,7 +2253,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
bl_label = "Properties"
bl_default_closed = True
def _active_context_member(self, context):
def _active_context_member(context):
obj = context.object
if obj:
mode = obj.mode
@ -2257,8 +2266,9 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
return ""
def poll(self, context):
member = self._active_context_member(context)
@staticmethod
def poll(context):
member = __class__._active_context_member(context)
if member:
context_member = getattr(context, member)
return context_member and context_member.keys()
@ -2268,7 +2278,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
def draw(self, context):
import rna_prop_ui
# reload(rna_prop_ui)
member = self._active_context_member(context)
member = __class__._active_context_member(context)
if member:
# Draw with no edit button

@ -19,7 +19,6 @@
# <pep8 compliant>
import bpy
narrowui = bpy.context.user_preferences.view.properties_width_check
class View3DPanel():
bl_space_type = 'VIEW_3D'
@ -473,7 +472,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 +493,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 +721,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
@ -739,7 +741,6 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
if context.sculpt_object:
#XXX duplicated from properties_texture.py
wide_ui = context.region.width > narrowui
col.separator()
@ -784,10 +785,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
col = split.column()
col.prop(tex_slot, "offset")
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.prop(tex_slot, "size")
@ -822,8 +820,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 +830,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 +856,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 +867,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 +954,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,17 +979,17 @@ 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):
layout = self.layout
wide_ui = context.region.width > narrowui
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()
@ -1003,10 +1004,7 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.label(text="Lock:")
row = col.row(align=True)
@ -1020,16 +1018,16 @@ 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):
wide_ui = context.region.width > narrowui
layout = self.layout
sculpt = context.tool_settings.sculpt
settings = self.paint_settings(context)
settings = __class__.paint_settings(context)
brush = settings.brush
split = layout.split()
@ -1041,10 +1039,7 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
col.prop(sculpt, "symmetry_y", text="Y")
col.prop(sculpt, "symmetry_z", text="Z")
if wide_ui:
col = split.column()
else:
col.separator()
col = split.column()
col.prop(sculpt, "radial_symm", text="Radial")
@ -1058,14 +1053,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 +1173,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 +1244,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):

@ -40,15 +40,15 @@ struct ListBase;
struct BezTriple;
struct BevList;
#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_NURB_CYCLIC) ? (nu->orderu-1) : 0) )
#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_NURB_CYCLIC) ? (nu->orderv-1) : 0) )
#define KNOTSU(nu) ( (nu)->orderu+ (nu)->pntsu+ (((nu)->flagu & CU_NURB_CYCLIC) ? ((nu)->orderu-1) : 0) )
#define KNOTSV(nu) ( (nu)->orderv+ (nu)->pntsv+ (((nu)->flagv & CU_NURB_CYCLIC) ? ((nu)->orderv-1) : 0) )
/* Non cyclic nurbs have 1 less segment */
#define SEGMENTSU(nu) ( ((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu-1 )
#define SEGMENTSV(nu) ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv-1 )
#define CU_DO_TILT(cu, nu) (((nu->flag & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1)
#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || cu->bevobj || cu->ext1!=0.0 || cu->ext2!=0.0) ? 1:0)
#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0 || (cu)->ext2!=0.0) ? 1:0)
void unlink_curve( struct Curve *cu);

@ -136,6 +136,7 @@ void ntreeMakeOwnType(struct bNodeTree *ntree);
void ntreeUpdateType(struct bNodeTree *ntree, struct bNodeType *ntype);
void ntreeFreeTree(struct bNodeTree *ntree);
struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree, int internal_select);
void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to);
void ntreeMakeLocal(struct bNodeTree *ntree);
void ntreeSocketUseFlags(struct bNodeTree *ntree);

@ -127,7 +127,7 @@ Curve *add_curve(char *name, int type)
cu= alloc_libblock(&G.main->curve, ID_CU, name);
cu->size[0]= cu->size[1]= cu->size[2]= 1.0;
cu->flag= CU_FRONT|CU_BACK|CU_PATH_RADIUS;
cu->flag= CU_FRONT|CU_BACK|CU_DEFORM_BOUNDS_OFF|CU_PATH_RADIUS;
cu->pathlen= 100;
cu->resolu= cu->resolv= 12;
cu->width= 1.0;
@ -1222,6 +1222,8 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
// XXX if( ob == obedit && ob->type == OB_FONT ) return;
if(cu->bevobj) {
if (cu->bevobj->type!=OB_CURVE) return;
bevcu= cu->bevobj->data;
if(bevcu->ext1==0.0 && bevcu->ext2==0.0) {
ListBase bevdisp= {NULL, NULL};

@ -1129,7 +1129,7 @@ float calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
Curve *cu;
DispList *dl;
if(taperobj==NULL) return 1.0;
if(taperobj==NULL || taperobj->type!=OB_CURVE) return 1.0;
cu= taperobj->data;
dl= cu->disp.first;
@ -1682,15 +1682,6 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
float (*deformedVerts)[3];
int numVerts;
/* Bevel and taper objects should always be curves */
if (cu->bevobj && cu->bevobj->type != OB_CURVE) {
cu->bevobj = NULL;
}
if (cu->taperobj && cu->taperobj->type != OB_CURVE) {
cu->taperobj = NULL;
}
nubase= BKE_curve_nurbs(cu);
BLI_freelistN(&(cu->bev));

@ -175,7 +175,7 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
bp= lt->def;
for (i=0; i<lt->pntsu*lt->pntsv*lt->pntsw; i++,bp++) {
VECCOPY(bp->vec, vertexCos[i]);
copy_v3_v3(bp->vec, vertexCos[i]);
}
MEM_freeN(vertexCos);
@ -474,7 +474,9 @@ static void init_curve_deform(Object *par, Object *ob, CurveDeform *cd, int dloc
invert_m4_m4(par->imat, par->obmat);
mul_v3_m4v3(cd->dloc, par->imat, ob->obmat[3]);
}
else cd->dloc[0]=cd->dloc[1]=cd->dloc[2]= 0.0f;
else {
cd->dloc[0]=cd->dloc[1]=cd->dloc[2]= 0.0f;
}
cd->no_rot_axis= 0;
}
@ -507,15 +509,15 @@ static int where_on_path_deform(Object *ob, float ctime, float *vec, float *dir,
if(ctime < 0.0) {
sub_v3_v3v3(dvec, path->data[1].vec, path->data[0].vec);
mul_v3_fl(dvec, ctime*(float)path->len);
VECADD(vec, vec, dvec);
if(quat) QUATCOPY(quat, path->data[0].quat);
add_v3_v3(vec, dvec);
if(quat) copy_qt_qt(quat, path->data[0].quat);
if(radius) *radius= path->data[0].radius;
}
else if(ctime > 1.0) {
sub_v3_v3v3(dvec, path->data[path->len-1].vec, path->data[path->len-2].vec);
mul_v3_fl(dvec, (ctime-1.0)*(float)path->len);
VECADD(vec, vec, dvec);
if(quat) QUATCOPY(quat, path->data[path->len-1].quat);
add_v3_v3(vec, dvec);
if(quat) copy_qt_qt(quat, path->data[path->len-1].quat);
if(radius) *radius= path->data[path->len-1].radius;
/* weight - not used but could be added */
}
@ -608,7 +610,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
/* this is not exactly the same as 2.4x, since the axis is having rotation removed rather then
* changing the axis before calculating the tilt but serves much the same purpose */
float dir_flat[3]={0,0,0}, q[4];
VECCOPY(dir_flat, dir);
copy_v3_v3(dir_flat, dir);
dir_flat[cd->no_rot_axis-1]= 0.0f;
normalize_v3(dir);
@ -686,11 +688,11 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C
mul_qt_v3(quat, cent);
/* translation */
VECADD(co, cent, loc);
add_v3_v3v3(co, cent, loc);
if(quatp)
QUATCOPY(quatp, quat);
copy_qt_qt(quatp, quat);
return 1;
}
return 0;
@ -711,7 +713,18 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, DerivedMesh
cu->flag |= (CU_PATH|CU_FOLLOW); // needed for path & bevlist
init_curve_deform(cuOb, target, &cd, (cu->flag & CU_STRETCH)==0);
/* dummy bounds, keep if CU_DEFORM_BOUNDS_OFF is set */
if(defaxis < 3) {
cd.dmin[0]= cd.dmin[1]= cd.dmin[2]= 0.0f;
cd.dmax[0]= cd.dmax[1]= cd.dmax[2]= 1.0f;
}
else {
/* negative, these bounds give a good rest position */
cd.dmin[0]= cd.dmin[1]= cd.dmin[2]= -1.0f;
cd.dmax[0]= cd.dmax[1]= cd.dmax[2]= 0.0f;
}
/* check whether to use vertex groups (only possible if target is a Mesh)
* we want either a Mesh with no derived data, or derived data with
* deformverts
@ -726,62 +739,84 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, DerivedMesh
use_vgroups = 0;
if(vgroup && vgroup[0] && use_vgroups) {
bDeformGroup *curdef;
Mesh *me= target->data;
int index;
/* find the group (weak loop-in-loop) */
for(index = 0, curdef = target->defbase.first; curdef;
curdef = curdef->next, index++)
if (!strcmp(curdef->name, vgroup))
break;
int index= defgroup_name_index(target, vgroup);
if(curdef && (me->dvert || dm)) {
if(index != -1 && (me->dvert || dm)) {
MDeformVert *dvert = me->dvert;
float vec[3];
int j;
float weight;
INIT_MINMAX(cd.dmin, cd.dmax);
for(a = 0; a < numVerts; a++, dvert++) {
if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
for(j = 0; j < dvert->totweight; j++) {
if(dvert->dw[j].def_nr == index) {
if(cu->flag & CU_DEFORM_BOUNDS_OFF) {
/* dummy bounds */
cd.dmin[0]= cd.dmin[1]= cd.dmin[2]= 0.0f;
cd.dmax[0]= cd.dmax[1]= cd.dmax[2]= 1.0f;
dvert = me->dvert;
for(a = 0; a < numVerts; a++, dvert++) {
if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
weight= defvert_find_weight(dvert, index);
if(weight > 0.0f) {
mul_m4_v3(cd.curvespace, vertexCos[a]);
copy_v3_v3(vec, vertexCos[a]);
calc_curve_deform(scene, cuOb, vec, defaxis, &cd, NULL);
interp_v3_v3v3(vertexCos[a], vertexCos[a], vec, weight);
mul_m4_v3(cd.objectspace, vertexCos[a]);
}
}
}
else {
/* set mesh min/max bounds */
INIT_MINMAX(cd.dmin, cd.dmax);
for(a = 0; a < numVerts; a++, dvert++) {
if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
if(defvert_find_weight(dvert, index) > 0.0f) {
mul_m4_v3(cd.curvespace, vertexCos[a]);
DO_MINMAX(vertexCos[a], cd.dmin, cd.dmax);
break;
}
}
}
dvert = me->dvert;
for(a = 0; a < numVerts; a++, dvert++) {
if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
for(j = 0; j < dvert->totweight; j++) {
if(dvert->dw[j].def_nr == index) {
VECCOPY(vec, vertexCos[a]);
dvert = me->dvert;
for(a = 0; a < numVerts; a++, dvert++) {
if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
weight= defvert_find_weight(dvert, index);
if(weight > 0.0f) {
copy_v3_v3(vec, vertexCos[a]);
calc_curve_deform(scene, cuOb, vec, defaxis, &cd, NULL);
interp_v3_v3v3(vertexCos[a], vertexCos[a], vec,
dvert->dw[j].weight);
interp_v3_v3v3(vertexCos[a], vertexCos[a], vec, weight);
mul_m4_v3(cd.objectspace, vertexCos[a]);
break;
}
}
}
}
} else {
INIT_MINMAX(cd.dmin, cd.dmax);
for(a = 0; a < numVerts; a++) {
mul_m4_v3(cd.curvespace, vertexCos[a]);
DO_MINMAX(vertexCos[a], cd.dmin, cd.dmax);
}
else {
if(cu->flag & CU_DEFORM_BOUNDS_OFF) {
for(a = 0; a < numVerts; a++) {
mul_m4_v3(cd.curvespace, vertexCos[a]);
calc_curve_deform(scene, cuOb, vertexCos[a], defaxis, &cd, NULL);
mul_m4_v3(cd.objectspace, vertexCos[a]);
}
}
for(a = 0; a < numVerts; a++) {
calc_curve_deform(scene, cuOb, vertexCos[a], defaxis, &cd, NULL);
mul_m4_v3(cd.objectspace, vertexCos[a]);
else {
/* set mesh min max bounds */
INIT_MINMAX(cd.dmin, cd.dmax);
for(a = 0; a < numVerts; a++) {
mul_m4_v3(cd.curvespace, vertexCos[a]);
DO_MINMAX(vertexCos[a], cd.dmin, cd.dmax);
}
for(a = 0; a < numVerts; a++) {
calc_curve_deform(scene, cuOb, vertexCos[a], defaxis, &cd, NULL);
mul_m4_v3(cd.objectspace, vertexCos[a]);
}
}
}
cu->flag = flag;
@ -803,8 +838,8 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target, float *orco
init_curve_deform(cuOb, target, &cd, 0); /* 0 no dloc */
cd.no_rot_axis= no_rot_axis; /* option to only rotate for XY, for example */
VECCOPY(cd.dmin, orco);
VECCOPY(cd.dmax, orco);
copy_v3_v3(cd.dmin, orco);
copy_v3_v3(cd.dmax, orco);
mul_m4_v3(cd.curvespace, vec);
@ -973,7 +1008,7 @@ float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3]
vertexCos = MEM_mallocN(sizeof(*vertexCos)*numVerts,"lt_vcos");
for (i=0; i<numVerts; i++) {
VECCOPY(vertexCos[i], lt->def[i].vec);
copy_v3_v3(vertexCos[i], lt->def[i].vec);
}
return vertexCos;
@ -985,7 +1020,7 @@ void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3])
int i, numVerts = lt->pntsu*lt->pntsv*lt->pntsw;
for (i=0; i<numVerts; i++) {
VECCOPY(lt->def[i].vec, vertexCos[i]);
copy_v3_v3(lt->def[i].vec, vertexCos[i]);
}
}

@ -1064,6 +1064,7 @@ bNodeTree *ntreeAddTree(int type)
* - internal_select is only 1 when used for duplicating selected nodes (i.e. Shift-D duplicate operator)
* - this gets called when executing compositing updates (for threaded previews)
* - when the nodetree datablock needs to be copied (i.e. when users get copied)
* - for scene duplication use ntreeSwapID() after so we dont have stale pointers.
*/
bNodeTree *ntreeCopyTree(bNodeTree *ntree, int internal_select)
{
@ -1142,6 +1143,18 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree, int internal_select)
return newtree;
}
/* use when duplicating scenes */
void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to)
{
bNode *node;
/* for scene duplication only */
for(node= ntree->nodes.first; node; node= node->next) {
if(node->id==id_from) {
node->id= id_to;
}
}
}
/* *************** preview *********** */
/* if node->preview, then we assume the rect to exist */

@ -1627,10 +1627,7 @@ float bsystem_time(struct Scene *scene, Object *ob, float cfra, float ofs)
void object_scale_to_mat3(Object *ob, float mat[][3])
{
float vec[3];
vec[0]= ob->size[0]+ob->dsize[0];
vec[1]= ob->size[1]+ob->dsize[1];
vec[2]= ob->size[2]+ob->dsize[2];
add_v3_v3v3(vec, ob->size, ob->dsize);
size_to_mat3( mat,vec);
}
@ -1688,7 +1685,7 @@ void object_mat3_to_rot(Object *ob, float mat[][3], int use_compat)
void object_apply_mat4(Object *ob, float mat[][4])
{
float mat3[3][3];
VECCOPY(ob->loc, mat[3]);
copy_v3_v3(ob->loc, mat[3]);
mat4_to_size(ob->size, mat);
copy_m3_m4(mat3, mat);
object_mat3_to_rot(ob, mat3, 0);
@ -1796,7 +1793,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
copy_m4_m4(mat, rmat);
}
VECCOPY(mat[3], vec);
copy_v3_v3(mat[3], vec);
}
}
@ -1823,7 +1820,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4])
copy_m4_m4(mat, pchan->pose_mat);
/* but for backwards compatibility, the child has to move to the tail */
VECCOPY(vec, mat[1]);
copy_v3_v3(vec, mat[1]);
mul_v3_fl(vec, pchan->bone->length);
add_v3_v3(mat[3], vec);
}

@ -172,9 +172,12 @@ Scene *copy_scene(Main *bmain, Scene *sce, int type)
BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces));
BLI_duplicatelist(&(scen->r.layers), &(sce->r.layers));
BKE_keyingsets_copy(&(scen->keyingsets), &(sce->keyingsets));
scen->nodetree= ntreeCopyTree(sce->nodetree, 0);
if(sce->nodetree) {
scen->nodetree= ntreeCopyTree(sce->nodetree, 0);
ntreeSwitchID(scen->nodetree, &sce->id, &scen->id);
}
obase= sce->base.first;
base= scen->base.first;
while(base) {

@ -72,7 +72,7 @@ typedef struct ViewDepths {
float *give_cursor(struct Scene *scene, struct View3D *v3d);
void initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
int initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
void window_to_3d(struct ARegion *ar, float *vec, short mx, short my);
void window_to_3d_delta(struct ARegion *ar, float *vec, short mx, short my);
void view3d_unproject(struct bglMats *mats, float out[3], const short x, const short y, const float z);

@ -1511,11 +1511,6 @@ void init_userdef_do_versions(void)
if (U.v2d_min_gridsize == 0) {
U.v2d_min_gridsize= 35;
}
/* Single Column UI Value */
if (U.propwidth == 0) {
U.propwidth = 200;
}
/* funny name, but it is GE stuff, moves userdef stuff to engine */
// XXX space_set_commmandline_options();

@ -563,7 +563,6 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
if(verts) MEM_freeN(verts);
if(tris) MEM_freeN(tris);
if(fsmesh.channelVertices) MEM_freeN(fsmesh.channelVertices);
}
}

@ -48,6 +48,7 @@
#include "ED_screen.h"
#include "ED_screen_types.h"
#include "ED_space_api.h"
#include "ED_types.h"
#include "ED_fileselect.h"
@ -343,6 +344,8 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
else if(at->draw) {
at->draw(C, ar);
}
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
uiFreeInactiveBlocks(C, &ar->uiblocks);

@ -776,8 +776,6 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
/* draw Grease Pencil - screen space only */
draw_image_grease_pencil((bContext *)C, 0);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
/* scrollers? */
/*scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);

@ -174,12 +174,13 @@ void flatten_string_free(FlattenString *fs)
static int find_builtinfunc(char *string)
{
int a, i;
char builtinfuncs[][11] = {"and", "as", "assert", "break", "class", "continue", "def",
char builtinfuncs[][9] = {"and", "as", "assert", "break", "class", "continue", "def",
"del", "elif", "else", "except", "exec", "finally",
"for", "from", "global", "if", "import", "in",
"is", "lambda", "not", "or", "pass", "print",
"raise", "return", "try", "while", "yield"};
for(a=0; a<30; a++) {
"raise", "return", "try", "while", "yield", "with"};
for(a=0; a < sizeof(builtinfuncs)/sizeof(builtinfuncs[0]); a++) {
i = 0;
while(1) {
/* If we hit the end of a keyword... (eg. "def") */

@ -584,8 +584,10 @@ void TEXT_OT_run_script(wmOperatorType *ot)
/* api callbacks */
ot->poll= run_script_poll;
ot->exec= run_script_exec;
}
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
/******************* refresh pyconstraints operator *********************/

@ -2727,7 +2727,8 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha;
if(obedit && ob!=obedit && ob->data==obedit->data) {
if(ob_get_key(ob));
if(ob_get_key(ob) || ob_get_key(obedit));
else if(ob->modifiers.first || obedit->modifiers.first);
else drawlinked= 1;
}

@ -2433,8 +2433,6 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
ob= OBACT;
if(U.uiflag & USER_DRAWVIEWINFO)
draw_selected_name(scene, ob, v3d);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
/* XXX here was the blockhandlers for floating panels */

@ -2396,7 +2396,7 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
short mx, my, mval[2];
// short ctrl= 0; // XXX
int flip;
fp= give_cursor(scene, v3d);
// if(obedit && ctrl) lr_click= 1;
@ -2404,9 +2404,18 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
mx= event->x - ar->winrct.xmin;
my= event->y - ar->winrct.ymin;
project_short_noclip(ar, fp, mval);
initgrabz(rv3d, fp[0], fp[1], fp[2]);
project_short_noclip(ar, fp, mval);
flip= initgrabz(rv3d, fp[0], fp[1], fp[2]);
/* reset the depth based on the view offset */
if(flip) {
negate_v3_v3(fp, rv3d->ofs);
/* re initialize */
project_short_noclip(ar, fp, mval);
flip= initgrabz(rv3d, fp[0], fp[1], fp[2]);
}
if(mval[0]!=IS_CLIPPED) {
short depth_used = 0;

@ -588,11 +588,13 @@ void viewvector(RegionView3D *rv3d, float coord[3], float vec[3])
normalize_v3(vec);
}
void initgrabz(RegionView3D *rv3d, float x, float y, float z)
int initgrabz(RegionView3D *rv3d, float x, float y, float z)
{
if(rv3d==NULL) return;
int flip= FALSE;
if(rv3d==NULL) return flip;
rv3d->zfac= rv3d->persmat[0][3]*x+ rv3d->persmat[1][3]*y+ rv3d->persmat[2][3]*z+ rv3d->persmat[3][3];
if (rv3d->zfac < 0.0f)
flip= TRUE;
/* if x,y,z is exactly the viewport offset, zfac is 0 and we don't want that
* (accounting for near zero values)
* */
@ -605,6 +607,8 @@ void initgrabz(RegionView3D *rv3d, float x, float y, float z)
// -- Aligorith, 2009Aug31
//if (rv3d->zfac < 0.0f) rv3d->zfac = 1.0f;
if (rv3d->zfac < 0.0f) rv3d->zfac= -rv3d->zfac;
return flip;
}
/* always call initgrabz */

@ -245,7 +245,7 @@ typedef struct Curve {
#define CU_PATH 8
#define CU_FOLLOW 16
#define CU_UV_ORCO 32
#define CU_DEPRECATED 64
#define CU_DEFORM_BOUNDS_OFF 64
#define CU_STRETCH 128
#define CU_OFFS_PATHDIST 256
#define CU_FAST 512 /* Font: no filling inside editmode */

@ -364,7 +364,7 @@ typedef struct UserDef {
short scrcastfps; /* frame rate for screencast to be played back */
short scrcastwait; /* milliseconds between screencast snapshots */
short propwidth, pad[3]; /* Value for Dual/Single Column UI */
short pad8, pad[3]; /* Value for Dual/Single Column UI */
char versemaster[160];
char verseuser[160];

@ -108,20 +108,21 @@ static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, char *da
static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *fcu)
{
if(fcu->grp) {
if (fcu->grp) {
if (BLI_findindex(&act->groups, fcu->grp) == -1) {
BKE_reportf(reports, RPT_ERROR, "FCurve's ActionGroup '%s' not found in action '%s'", fcu->grp->name, act->id.name+2);
return;
}
action_groups_remove_channel(act, fcu);
free_fcurve(fcu);
}
else {
if(BLI_findindex(&act->curves, fcu) == -1) {
if (BLI_findindex(&act->curves, fcu) == -1) {
BKE_reportf(reports, RPT_ERROR, "FCurve not found in action '%s'", act->id.name+2);
return;
}
BLI_remlink(&act->curves, fcu);
free_fcurve(fcu);
}

@ -76,13 +76,19 @@ static PointerRNA rna_Context_region_get(PointerRNA *ptr)
return newptr;
}
/*static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
{
bContext *C= (bContext*)ptr->data;
PointerRNA newptr;
RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_RegionData, CTX_wm_region_data(C), &newptr);
return newptr;
}*/
/* only exists for one space still, no generic system yet */
if(CTX_wm_view3d(C)) {
PointerRNA newptr;
RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_RegionView3D, CTX_wm_region_data(C), &newptr);
return newptr;
}
return PointerRNA_NULL;
}
static PointerRNA rna_Context_main_get(PointerRNA *ptr)
{
@ -175,10 +181,10 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Region");
RNA_def_property_pointer_funcs(prop, "rna_Context_region_get", NULL, NULL, NULL);
/*prop= RNA_def_property(srna, "region_data", PROP_POINTER, PROP_NONE);
prop= RNA_def_property(srna, "region_data", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "RegionData");
RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);*/
RNA_def_property_struct_type(prop, "RegionView3D");
RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);
/* Data */
prop= RNA_def_property(srna, "main", PROP_POINTER, PROP_NONE);

@ -699,7 +699,12 @@ static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH);
RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: makes deformed child to stretch along entire path");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop= RNA_def_property(srna, "use_deform_bounds", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_DEFORM_BOUNDS_OFF);
RNA_def_property_ui_text(prop, "Bounds Clamp", "Use the mesh bounds to clamp the deformation");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop= RNA_def_property(srna, "use_time_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_OFFS_PATHDIST);
RNA_def_property_ui_text(prop, "Offset Path Distance", "Children will use TimeOffs value as path distance offset");

@ -1286,7 +1286,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -100, 100, 10, 2);
RNA_def_property_ui_range(prop, -100, 100, 10, 3);
RNA_def_property_ui_text(prop, "Strength", "");
RNA_def_property_update(prop, 0, "rna_Modifier_update");

@ -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);

@ -2048,13 +2048,6 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL);
RNA_def_property_ui_text(prop, "TimeCode Style", "Format of Time Codes displayed when not displaying timing in terms of frames");
RNA_def_property_update(prop, 0, "rna_userdef_update");
/* Properties Window */
prop= RNA_def_property(srna, "properties_width_check", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "propwidth");
RNA_def_property_range(prop, 150, 400);
RNA_def_property_ui_text(prop, "Width Check", "Dual Column layout will change to single column layout when the width of the area gets below this value (needs restart to take effect)");
RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_edit(BlenderRNA *brna)

@ -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", "", "");

@ -61,39 +61,45 @@ typedef struct ScrewVertIter {
MEdge *e;
} ScrewVertIter;
#define ScrewVertIter_INIT(iter, array, v_init, dir)\
iter.v_array = array;\
iter.v = v_init;\
if (v_init>=0) {\
iter.v_poin = &array[v_init];\
iter.v_other = iter.v_poin->v[dir];\
if (dir)\
iter.e = iter.v_poin->e[0];\
else\
iter.e = iter.v_poin->e[1];\
} else {\
iter.v_poin= NULL;\
iter.e= NULL;\
static void screwvert_iter_init(ScrewVertIter *iter, ScrewVertConnect *array, int v_init, int dir)
{
iter->v_array = array;
iter->v = v_init;
if (v_init >= 0) {
iter->v_poin = &array[v_init];
iter->v_other = iter->v_poin->v[dir];
iter->e = iter->v_poin->e[!dir];
}
else {
iter->v_poin= NULL;
iter->e= NULL;
}
}
#define ScrewVertIter_NEXT(iter)\
if (iter.v_poin->v[0] == iter.v_other) {\
iter.v_other= iter.v;\
iter.v= iter.v_poin->v[1];\
} else if (iter.v_poin->v[1] == iter.v_other) {\
iter.v_other= iter.v;\
iter.v= iter.v_poin->v[0];\
}\
if (iter.v >=0) {\
iter.v_poin= &iter.v_array[iter.v];\
if ( iter.v_poin->e[0] != iter.e ) iter.e= iter.v_poin->e[0];\
else iter.e= iter.v_poin->e[1];\
} else {\
iter.e= NULL;\
iter.v_poin= NULL;\
static void screwvert_iter_step(ScrewVertIter *iter)
{
if (iter->v_poin->v[0] == iter->v_other) {
iter->v_other= iter->v;
iter->v= iter->v_poin->v[1];
}
else if (iter->v_poin->v[1] == iter->v_other) {
iter->v_other= iter->v;
iter->v= iter->v_poin->v[0];
}
if (iter->v >= 0) {
iter->v_poin= &iter->v_array[iter->v];
iter->e= iter->v_poin->e[(iter->v_poin->e[0] == iter->e)];
}
else {
iter->e= NULL;
iter->v_poin= NULL;
}
}
static void initData(ModifierData *md)
{
ScrewModifierData *ltmd= (ScrewModifierData*) md;
@ -131,9 +137,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
int *origindex;
int mface_index=0;
int step;
int i, j;
int i1,i2;
int steps= ltmd->steps;
int step_tot= ltmd->steps;
const int do_flip = ltmd->flag & MOD_SCREW_NORMAL_FLIP ? 1 : 0;
int maxVerts=0, maxEdges=0, maxFaces=0;
int totvert= dm->getNumVerts(dm);
int totedge= dm->getNumEdges(dm);
@ -167,7 +175,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (!totvert)
return CDDM_from_template(dm, 0, 0, 0);
steps= useRenderParams ? ltmd->render_steps : ltmd->steps;
step_tot= useRenderParams ? ltmd->render_steps : ltmd->steps;
switch(ltmd->axis) {
case 0:
@ -187,16 +195,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
axis_vec[ltmd->axis]= 1.0f;
if (ltmd->ob_axis) {
float mtx3_tx[3][3];
/* calc the matrix relative to the axis object */
invert_m4_m4(mtx_tmp_a, ob->obmat);
copy_m4_m4(mtx_tx_inv, ltmd->ob_axis->obmat);
mul_m4_m4m4(mtx_tx, mtx_tx_inv, mtx_tmp_a);
copy_m3_m4(mtx3_tx, mtx_tx);
/* calc the axis vec */
mul_m3_v3(mtx3_tx, axis_vec);
mul_mat3_m4_v3(mtx_tx, axis_vec); /* only rotation component */
normalize_v3(axis_vec);
/* screw */
@ -218,7 +223,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
#if 0 // cant incluide this, not pradictable enough, though quite fun,.
if(ltmd->flag & MOD_SCREW_OBJECT_ANGLE) {
float mtx3_tx[3][3];
copy_m3_m4(mtx3_tx, mtx_tx);
float vec[3] = {0,1,0};
float cross1[3];
@ -261,30 +267,30 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
screw_ofs *= ltmd->iter;
/* multiplying the steps is a bit tricky, this works best */
steps = ((steps + 1) * ltmd->iter) - (ltmd->iter - 1);
step_tot = ((step_tot + 1) * ltmd->iter) - (ltmd->iter - 1);
/* will the screw be closed?
* Note! smaller then FLT_EPSILON*100 gives problems with float precission so its never closed. */
if (fabs(screw_ofs) <= (FLT_EPSILON*100) && fabs(fabs(angle) - (M_PI * 2)) <= (FLT_EPSILON*100)) {
close= 1;
steps--;
if(steps < 2) steps= 2;
step_tot--;
if(step_tot < 2) step_tot= 2;
maxVerts = totvert * steps; /* -1 because we're joining back up */
maxEdges = (totvert * steps) + /* these are the edges between new verts */
(totedge * steps); /* -1 because vert edges join */
maxFaces = totedge * steps;
maxVerts = totvert * step_tot; /* -1 because we're joining back up */
maxEdges = (totvert * step_tot) + /* these are the edges between new verts */
(totedge * step_tot); /* -1 because vert edges join */
maxFaces = totedge * step_tot;
screw_ofs= 0.0f;
}
else {
close= 0;
if(steps < 2) steps= 2;
if(step_tot < 2) step_tot= 2;
maxVerts = totvert * steps; /* -1 because we're joining back up */
maxEdges = (totvert * (steps-1)) + /* these are the edges between new verts */
(totedge * steps); /* -1 because vert edges join */
maxFaces = totedge * (steps-1);
maxVerts = totvert * step_tot; /* -1 because we're joining back up */
maxEdges = (totvert * (step_tot-1)) + /* these are the edges between new verts */
(totedge * step_tot); /* -1 because vert edges join */
maxFaces = totedge * (step_tot-1);
}
result= CDDM_from_template(dm, maxVerts, maxEdges, maxFaces);
@ -398,11 +404,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
for (i=0; i<totedge; i++, med_new++) {
vc= &vert_connect[med_new->v1];
if (vc->v[0]==-1) { /* unused */
if (vc->v[0] == -1) { /* unused */
vc->v[0]= med_new->v2;
vc->e[0]= med_new;
}
else if (vc->v[1]==-1) {
else if (vc->v[1] == -1) {
vc->v[1]= med_new->v2;
vc->e[1]= med_new;
}
@ -413,11 +419,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vc= &vert_connect[med_new->v2];
/* same as above but swap v1/2 */
if (vc->v[0]==-1) { /* unused */
if (vc->v[0] == -1) { /* unused */
vc->v[0]= med_new->v1;
vc->e[0]= med_new;
}
else if (vc->v[1]==-1) {
else if (vc->v[1] == -1) {
vc->v[1]= med_new->v1;
vc->e[1]= med_new;
}
@ -429,7 +435,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* find the first vert */
vc= vert_connect;
for (i=0; i < totvert; i++, vc++) {
int VBEST=-1, ed_loop_closed=0; /* vert and vert new */
int v_best=-1, ed_loop_closed=0; /* vert and vert new */
int ed_loop_flip;
float fl= -1.0f;
ScrewVertIter lt_iter;
@ -437,14 +443,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* Now do search for connected verts, order all edges and flip them
* so resulting faces are flipped the right way */
vc_tot_linked= 0; /* count the number of linked verts for this loop */
if (vc->flag==0) {
if (vc->flag == 0) {
/*printf("Loop on connected vert: %i\n", i);*/
for(j=0; j<2; j++) {
/*printf("\tSide: %i\n", j);*/
ScrewVertIter_INIT(lt_iter, vert_connect, i, j);
if (j==1) {
ScrewVertIter_NEXT(lt_iter);
screwvert_iter_init(&lt_iter, vert_connect, i, j);
if (j == 1) {
screwvert_iter_step(&lt_iter);
}
while (lt_iter.v_poin) {
/*printf("\t\tVERT: %i\n", lt_iter.v);*/
@ -459,10 +465,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/*printf("Testing 2 floats %f : %f\n", fl, lt_iter.v_poin->dist);*/
if (fl <= lt_iter.v_poin->dist) {
fl= lt_iter.v_poin->dist;
VBEST= lt_iter.v;
/*printf("\t\t\tVERT BEST: %i\n", VBEST);*/
v_best= lt_iter.v;
/*printf("\t\t\tVERT BEST: %i\n", v_best);*/
}
ScrewVertIter_NEXT(lt_iter);
screwvert_iter_step(&lt_iter);
if (!lt_iter.v_poin) {
/*printf("\t\t\tFound End Also Num %i\n", j);*/
/*endpoints[j]= lt_iter.v_other;*/ /* other is still valid */
@ -472,14 +478,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
/* now we have a collection of used edges. flip their edges the right way*/
/*if (VBEST !=-1) - */
/*if (v_best != -1) - */
/*printf("Done Looking - vc_tot_linked: %i\n", vc_tot_linked);*/
if (vc_tot_linked>1) {
float vf_1, vf_2, vf_best;
vc_tmp= &vert_connect[VBEST];
vc_tmp= &vert_connect[v_best];
tmpf1= vert_connect[vc_tmp->v[0]].co;
tmpf2= vert_connect[vc_tmp->v[1]].co;
@ -503,7 +509,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
else {
/* not so simple to work out which edge is higher */
sub_v3_v3v3(tmp_vec1, tmpf1, vc_tmp->co);
sub_v3_v3v3(tmp_vec1, tmpf2, vc_tmp->co);
sub_v3_v3v3(tmp_vec2, tmpf2, vc_tmp->co);
normalize_v3(tmp_vec1);
normalize_v3(tmp_vec2);
@ -531,9 +537,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/*printf("flip direction %i\n", ed_loop_flip);*/
/* switch the flip option if set */
if (ltmd->flag & MOD_SCREW_NORMAL_FLIP)
/* switch the flip option if set
* note: flip is now done at face level so copying vgroup slizes is easier */
/*
if (do_flip)
ed_loop_flip= !ed_loop_flip;
*/
if (angle < 0.0f)
ed_loop_flip= !ed_loop_flip;
@ -542,7 +551,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
for(j=ed_loop_closed; j<2; j++) {
/*printf("Ordering Side J %i\n", j);*/
ScrewVertIter_INIT(lt_iter, vert_connect, VBEST, j);
screwvert_iter_init(&lt_iter, vert_connect, v_best, j);
/*printf("\n\nStarting - Loop\n");*/
lt_iter.v_poin->flag= 1; /* so a non loop will traverse the other side */
@ -550,7 +559,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* If this is the vert off the best vert and
* the best vert has 2 edges connected too it
* then swap the flip direction */
if (j==1 && (vc_tmp->v[0] > -1) && (vc_tmp->v[1] > -1))
if (j == 1 && (vc_tmp->v[0] > -1) && (vc_tmp->v[1] > -1))
ed_loop_flip= !ed_loop_flip;
while (lt_iter.v_poin && lt_iter.v_poin->flag != 2) {
@ -559,7 +568,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
lt_iter.v_poin->flag= 2;
if (lt_iter.e) {
if (lt_iter.v == lt_iter.e->v1) {
if (ed_loop_flip==0) {
if (ed_loop_flip == 0) {
/*printf("\t\t\tFlipping 0\n");*/
SWAP(int, lt_iter.e->v1, lt_iter.e->v2);
}/* else {
@ -567,7 +576,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}*/
}
else if (lt_iter.v == lt_iter.e->v2) {
if (ed_loop_flip==1) {
if (ed_loop_flip == 1) {
/*printf("\t\t\tFlipping 1\n");*/
SWAP(int, lt_iter.e->v1, lt_iter.e->v2);
}/* else {
@ -579,7 +588,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}/* else {
printf("\t\tNo Edge at this point\n");
}*/
ScrewVertIter_NEXT(lt_iter);
screwvert_iter_step(&lt_iter);
}
}
}
@ -591,8 +600,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
*
* calculate vertex normals that can be propodated on lathing
* use edge connectivity work this out */
if (vc->v[0]>=0) {
if (vc->v[1]>=0) {
if (vc->v[0] >= 0) {
if (vc->v[1] >= 0) {
/* 2 edges connedted */
/* make 2 connecting vert locations relative to the middle vert */
sub_v3_v3v3(tmp_vec1, mvert_new[vc->v[0]].co, mvert_new[i].co);
@ -647,34 +656,24 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
}
else {
mv_orig= mvert_orig;
mv_new= mvert_new;
if (ltmd->flag & MOD_SCREW_NORMAL_FLIP) {
mv_orig= mvert_orig;
mv_new= mvert_new + (totvert-1);
for (i=0; i < totvert; i++, mv_new--, mv_orig++) {
copy_v3_v3(mv_new->co, mv_orig->co);
}
}
else {
mv_orig= mvert_orig;
mv_new= mvert_new;
for (i=0; i < totvert; i++, mv_new++, mv_orig++) {
copy_v3_v3(mv_new->co, mv_orig->co);
}
for (i=0; i < totvert; i++, mv_new++, mv_orig++) {
copy_v3_v3(mv_new->co, mv_orig->co);
}
}
/* done with edge connectivity based normal flipping */
DM_copy_vert_data(dm, result, 0, 0, totvert);
/* Add Faces */
for (i=1; i < steps; i++) {
for (step=1; step < step_tot; step++) {
const int varray_stride= totvert * step;
float step_angle;
float no_tx[3];
float nor_tx[3];
/* Rotation Matrix */
if (close) step_angle= (angle / steps) * i;
else step_angle= (angle / (steps-1)) * i;
step_angle= (angle / (step_tot - (!close))) * step;
if (ltmd->ob_axis) {
axis_angle_to_mat3(mat3, axis_vec, step_angle);
@ -687,18 +686,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
if(screw_ofs)
madd_v3_v3fl(mat[3], axis_vec, screw_ofs * ((float)i / (float)(steps-1)));
madd_v3_v3fl(mat[3], axis_vec, screw_ofs * ((float)step / (float)(step_tot-1)));
/* copy a slice */
DM_copy_vert_data(dm, result, 0, varray_stride, totvert);
mv_new_base= mvert_new;
mv_new= &mvert_new[totvert*i]; /* advance to the next slice */
mv_new= &mvert_new[varray_stride]; /* advance to the next slice */
for (j=0; j<totvert; j++, mv_new_base++, mv_new++) {
/* set normal */
if(vert_connect) {
mul_v3_m3v3(no_tx, mat3, vert_connect[j].no);
mul_v3_m3v3(nor_tx, mat3, vert_connect[j].no);
/* set the normal now its transformed */
normal_float_to_short_v3(mv_new->no, no_tx);
normal_float_to_short_v3(mv_new->no, nor_tx);
}
/* set location */
@ -719,7 +721,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
/* add the new edge */
med_new->v1= j+(i*totvert);
med_new->v1= varray_stride + j;
med_new->v2= med_new->v1 - totvert;
med_new->flag= ME_EDGEDRAW|ME_EDGERENDER;
med_new++;
@ -734,9 +736,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (close) {
/* last loop of edges, previous loop dosnt account for the last set of edges */
const int varray_stride= (step_tot - 1) * totvert;
for (i=0; i<totvert; i++) {
med_new->v1= i;
med_new->v2= i+((steps-1)*totvert);
med_new->v2= varray_stride + i;
med_new->flag= ME_EDGEDRAW|ME_EDGERENDER;
med_new++;
}
@ -749,14 +753,22 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* for each edge, make a cylinder of quads */
i1= med_new_firstloop->v1;
i2= med_new_firstloop->v2;
for (j=0; j < steps-1; j++) {
for (step=0; step < step_tot-1; step++) {
/* new face */
mf_new->v1= i1;
mf_new->v2= i2;
mf_new->v3= i2 + totvert;
mf_new->v4= i1 + totvert;
if(do_flip) {
mf_new->v4= i1;
mf_new->v3= i2;
mf_new->v2= i2 + totvert;
mf_new->v1= i1 + totvert;
}
else {
mf_new->v1= i1;
mf_new->v2= i2;
mf_new->v3= i2 + totvert;
mf_new->v4= i1 + totvert;
}
if( !mf_new->v3 || !mf_new->v4 ) {
SWAP(int, mf_new->v1, mf_new->v3);
@ -768,7 +780,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
mface_index++;
/* new vertical edge */
if (j) { /* The first set is already dome */
if (step) { /* The first set is already dome */
med_new->v1= i1;
med_new->v2= i2;
med_new->flag= med_new_firstloop->flag;
@ -781,10 +793,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
/* close the loop*/
if (close) {
mf_new->v1= i1;
mf_new->v2= i2;
mf_new->v3= med_new_firstloop->v2;
mf_new->v4= med_new_firstloop->v1;
if(do_flip) {
mf_new->v4= i1;
mf_new->v3= i2;
mf_new->v2= med_new_firstloop->v2;
mf_new->v1= med_new_firstloop->v1;
}
else {
mf_new->v1= i1;
mf_new->v2= i2;
mf_new->v3= med_new_firstloop->v2;
mf_new->v4= med_new_firstloop->v1;
}
if( !mf_new->v3 || !mf_new->v4 ) {
SWAP(int, mf_new->v1, mf_new->v3);
@ -804,7 +824,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
med_new++;
}
if((ltmd->flag & MOD_SCREW_NORMAL_CALC)==0) {
if((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) {
CDDM_calc_normals(result);
}

@ -362,6 +362,7 @@ def rna2sphinx(BASEPATH):
# py modules
fw(" bpy.utils.rst\n\n")
fw(" bpy.path.rst\n\n")
fw(" bpy.app.rst\n\n")
# C modules
@ -443,6 +444,9 @@ def rna2sphinx(BASEPATH):
from bpy import utils as module
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
from bpy import path as module
pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)")
# C modules
from bpy import app as module
pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)")

@ -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);

@ -1528,6 +1528,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
totchild=psys->totchild;
/* can happen for disconnected/global hair */
if(part->type==PART_HAIR && !psys->childcache)
totchild= 0;
if(G.rendering == 0) { /* preview render */
totchild = (int)((float)totchild * (float)part->disp / 100.0f);
}

@ -2509,6 +2509,7 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float *colf)
if (R.r.scemode & R_NO_TEX) return;
mtex= har->mat->mtex[0];
if(har->mat->septex & (1<<0)) return;
if(mtex->tex==NULL) return;
/* no normal mapping */

Some files were not shown because too many files have changed in this diff Show More