From f9b19d54b5a07c5d654ecb634aefc5690e07e6fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 31 Oct 2009 19:31:45 +0000 Subject: [PATCH] tabs to spaces, remove trailing white space. (apart of pep8) didnt do "release/scripts/io" since some exporters cant be auto converted --- release/datafiles/datatoc.py | 28 +- release/scripts/modules/bpy_ext/Object.py | 2 +- release/scripts/modules/bpy_ops.py | 10 +- release/scripts/modules/bpy_sys.py | 8 +- release/scripts/modules/dynamic_menu.py | 144 +- release/scripts/templates/gamelogic.py | 126 +- release/scripts/templates/gamelogic_basic.py | 20 +- release/scripts/templates/gamelogic_module.py | 18 +- release/scripts/templates/operator.py | 72 +- release/scripts/templates/operator_simple.py | 28 +- release/scripts/ui/buttons_data_armature.py | 302 +-- release/scripts/ui/buttons_data_bone.py | 386 +-- release/scripts/ui/buttons_data_camera.py | 156 +- release/scripts/ui/buttons_data_curve.py | 374 +-- release/scripts/ui/buttons_data_empty.py | 30 +- release/scripts/ui/buttons_data_lamp.py | 532 ++-- release/scripts/ui/buttons_data_lattice.py | 86 +- release/scripts/ui/buttons_data_mesh.py | 362 +-- release/scripts/ui/buttons_data_metaball.py | 178 +- release/scripts/ui/buttons_data_modifier.py | 826 +++--- release/scripts/ui/buttons_data_text.py | 282 +- release/scripts/ui/buttons_game.py | 670 ++--- release/scripts/ui/buttons_material.py | 1284 ++++----- release/scripts/ui/buttons_object.py | 352 +-- .../scripts/ui/buttons_object_constraint.py | 1390 +++++----- release/scripts/ui/buttons_particle.py | 1728 ++++++------ release/scripts/ui/buttons_physics_cloth.py | 300 +-- release/scripts/ui/buttons_physics_common.py | 310 +-- release/scripts/ui/buttons_physics_field.py | 362 +-- release/scripts/ui/buttons_physics_fluid.py | 468 ++-- release/scripts/ui/buttons_physics_smoke.py | 314 +-- .../scripts/ui/buttons_physics_softbody.py | 402 +-- release/scripts/ui/buttons_render.py | 752 +++--- release/scripts/ui/buttons_scene.py | 226 +- release/scripts/ui/buttons_texture.py | 1332 +++++----- release/scripts/ui/buttons_world.py | 284 +- release/scripts/ui/space_buttons.py | 42 +- release/scripts/ui/space_filebrowser.py | 80 +- release/scripts/ui/space_image.py | 696 ++--- release/scripts/ui/space_info.py | 420 +-- release/scripts/ui/space_logic.py | 46 +- release/scripts/ui/space_node.py | 150 +- release/scripts/ui/space_outliner.py | 118 +- release/scripts/ui/space_sequencer.py | 1034 ++++---- release/scripts/ui/space_text.py | 374 +-- release/scripts/ui/space_time.py | 240 +- release/scripts/ui/space_userpref.py | 1196 ++++----- release/scripts/ui/space_view3d.py | 2332 ++++++++--------- release/scripts/ui/space_view3d_toolbar.py | 1378 +++++----- source/blender/python/epy_doc_gen.py | 1290 ++++----- source/blender/python/rna_dump.py | 196 +- source/blender/python/simple_enum_gen.py | 70 +- 52 files changed, 11903 insertions(+), 11903 deletions(-) diff --git a/release/datafiles/datatoc.py b/release/datafiles/datatoc.py index 362d4ddc126..70bb348ad02 100755 --- a/release/datafiles/datatoc.py +++ b/release/datafiles/datatoc.py @@ -27,23 +27,23 @@ import sys, os if len(sys.argv) < 2: - sys.stdout.write("Usage: datatoc \n") - sys.exit(1) + sys.stdout.write("Usage: datatoc \n") + sys.exit(1) filename = sys.argv[1] try: - fpin = open(filename, "rb"); + fpin = open(filename, "rb"); except: - sys.stdout.write("Unable to open input %s\n" % sys.argv[1]) - sys.exit(1) + sys.stdout.write("Unable to open input %s\n" % sys.argv[1]) + sys.exit(1) fpin.seek(0, os.SEEK_END) size = fpin.tell() fpin.seek(0) if filename[0] == ".": - filename = filename[1:] + filename = filename[1:] cname = filename + ".c" sys.stdout.write("Making C file <%s>\n" % cname) @@ -52,10 +52,10 @@ filename = filename.replace(".", "_") sys.stdout.write(str(size)) sys.stdout.write("\n") try: - fpout = open(cname, "w") + fpout = open(cname, "w") except: - sys.stdout.write("Unable to open output %s\n" % cname) - sys.exit(1) + sys.stdout.write("Unable to open output %s\n" % cname) + sys.exit(1) fpout.write("/* DataToC output of file <%s> */\n\n" % filename) fpout.write("int datatoc_%s_size= %d;\n" % (filename, size)) @@ -63,11 +63,11 @@ fpout.write("int datatoc_%s_size= %d;\n" % (filename, size)) fpout.write("char datatoc_%s[]= {\n" % filename) while size > 0: - size -= 1 - if size % 32 == 31: - fpout.write("\n") - - fpout.write("%3d," % ord(fpin.read(1))) + size -= 1 + if size % 32 == 31: + fpout.write("\n") + + fpout.write("%3d," % ord(fpin.read(1))) fpout.write("\n 0};\n\n") diff --git a/release/scripts/modules/bpy_ext/Object.py b/release/scripts/modules/bpy_ext/Object.py index a842318844e..6419e1f1017 100644 --- a/release/scripts/modules/bpy_ext/Object.py +++ b/release/scripts/modules/bpy_ext/Object.py @@ -1,4 +1,4 @@ import bpy class_obj = bpy.types.Object -class_obj.getChildren = lambda ob: [child for child in bpy.data.objects if child.parent == ob] \ No newline at end of file +class_obj.getChildren = lambda ob: [child for child in bpy.data.objects if child.parent == ob] diff --git a/release/scripts/modules/bpy_ops.py b/release/scripts/modules/bpy_ops.py index 1f6d6bf8526..ce6e85da4e7 100644 --- a/release/scripts/modules/bpy_ops.py +++ b/release/scripts/modules/bpy_ops.py @@ -220,11 +220,11 @@ class WM_OT_context_set_boolean(bpy.types.Operator): '''Set a context value.''' bl_idname = "wm.context_set_boolean" bl_label = "Context Set" - + path = rna_path_prop value = BoolProperty(name="Value", description="Assignment value", default=True) - + execute = execute_context_assign @@ -232,10 +232,10 @@ class WM_OT_context_set_int(bpy.types.Operator): # same as enum '''Set a context value.''' bl_idname = "wm.context_set_int" bl_label = "Context Set" - + path = rna_path_prop value = IntProperty(name="Value", description="Assign value", default=0) - + execute = execute_context_assign @@ -255,7 +255,7 @@ class WM_OT_context_set_string(bpy.types.Operator): # same as enum '''Set a context value.''' bl_idname = "wm.context_set_string" bl_label = "Context Set" - + path = rna_path_prop value = StringProperty(name="Value", description="Assign value", maxlen=1024, default="") diff --git a/release/scripts/modules/bpy_sys.py b/release/scripts/modules/bpy_sys.py index e60e8b01d09..a56d2dc62f1 100644 --- a/release/scripts/modules/bpy_sys.py +++ b/release/scripts/modules/bpy_sys.py @@ -2,10 +2,10 @@ import bpy import os def expandpath(path): - if path.startswith("//"): - return os.path.join(os.path.dirname(bpy.data.filename), path[2:]) - - return path + if path.startswith("//"): + return os.path.join(os.path.dirname(bpy.data.filename), path[2:]) + + return path import types bpy.sys = types.ModuleType("bpy.sys") diff --git a/release/scripts/modules/dynamic_menu.py b/release/scripts/modules/dynamic_menu.py index ce51dc9937b..664271ab33f 100644 --- a/release/scripts/modules/dynamic_menu.py +++ b/release/scripts/modules/dynamic_menu.py @@ -1,86 +1,86 @@ import bpy def collect_baseclasses(_class, bases): - - if _class is type or _class is object: - return bases - - bases.append(_class) - for _superclass in _class.__bases__: - collect_baseclasses(_superclass, bases) - - return bases + + if _class is type or _class is object: + return bases + + bases.append(_class) + for _superclass in _class.__bases__: + collect_baseclasses(_superclass, bases) + + return bases def collect_subclasses(_class, subs): - - if _class is type or _class is object: - return subs - - subs.append(_class) - for _subclass in _class.__subclasses__(): - collect_subclasses(_subclass, subs) - - return subs + + if _class is type or _class is object: + return subs + + subs.append(_class) + for _subclass in _class.__subclasses__(): + collect_subclasses(_subclass, subs) + + return subs class DynMenu(bpy.types.Menu): - - def draw(self, context): - ''' - This is a draw function that is used to call all subclasses draw functions - starting from the registered classes draw function and working down. - - DynMenu.setup() must be called first. - - Sort/group classes could be nice - ''' - - subclass_ls = [] - collect_subclasses(self.__class__, subclass_ls) - # print(subclass_ls) - - for subclass in subclass_ls: - # print("drawwing", subclass) # , dir(subclass)) - subclass.internal_draw(self, context) - # print("subclass.internal_draw", subclass.internal_draw) + + def draw(self, context): + ''' + This is a draw function that is used to call all subclasses draw functions + starting from the registered classes draw function and working down. + + DynMenu.setup() must be called first. + + Sort/group classes could be nice + ''' + + subclass_ls = [] + collect_subclasses(self.__class__, subclass_ls) + # print(subclass_ls) + + for subclass in subclass_ls: + # print("drawwing", subclass) # , dir(subclass)) + subclass.internal_draw(self, context) + # print("subclass.internal_draw", subclass.internal_draw) def setup(menu_class): - ''' - Setup subclasses (not needed when self.add() is used) - ''' - bases = collect_baseclasses(menu_class, []) - - # Incase 'DynMenu' isnt last - while bases[-1] is not DynMenu: - bases.pop() - bases.pop() # remove 'DynMenu' - - root_class = bases[-1] # this is the registered class - - for subclass in collect_subclasses(root_class, []): - #print(subclass) - - draw = getattr(subclass, 'draw', None) - if draw and not hasattr(subclass, 'internal_draw'): - # print("replace", subclass, draw) - try: - del subclass.draw - except: - pass - subclass.internal_draw = draw - - root_class.draw = DynMenu.draw + ''' + Setup subclasses (not needed when self.add() is used) + ''' + bases = collect_baseclasses(menu_class, []) + + # Incase 'DynMenu' isnt last + while bases[-1] is not DynMenu: + bases.pop() + bases.pop() # remove 'DynMenu' + + root_class = bases[-1] # this is the registered class + + for subclass in collect_subclasses(root_class, []): + #print(subclass) + + draw = getattr(subclass, 'draw', None) + if draw and not hasattr(subclass, 'internal_draw'): + # print("replace", subclass, draw) + try: + del subclass.draw + except: + pass + subclass.internal_draw = draw + + root_class.draw = DynMenu.draw def add(menu_class, func): - ''' - Add a single function directly without having to make a class - - important that the returned value should be stored in the module that called it. - ''' - - newclass = type('', (menu_class,), {}) - newclass.internal_draw = func - setup(menu_class) - return newclass + ''' + Add a single function directly without having to make a class + + important that the returned value should be stored in the module that called it. + ''' + + newclass = type('', (menu_class,), {}) + newclass.internal_draw = func + setup(menu_class) + return newclass ''' # so we dont need to import this module diff --git a/release/scripts/templates/gamelogic.py b/release/scripts/templates/gamelogic.py index af9dbd8a56a..8bfe799bacf 100644 --- a/release/scripts/templates/gamelogic.py +++ b/release/scripts/templates/gamelogic.py @@ -4,75 +4,75 @@ # GameLogic has been added to the global namespace no need to import # for keyboard event comparison -# import GameKeys +# import GameKeys # support for Vector(), Matrix() types and advanced functions like AngleBetweenVecs(v1,v2) and RotationMatrix(...) -# import Mathutils +# import Mathutils # for functions like getWindowWidth(), getWindowHeight() # import Rasterizer def main(): - cont = GameLogic.getCurrentController() - - # The KX_GameObject that owns this controller. - own = cont.owner - - # for scripts that deal with spacial logic - own_pos = own.worldPosition - - - # Some example functions, remove to write your own script. - # check for a positive sensor, will run on any object without errors. - print 'Logic info for KX_GameObject', own.name - input = False - - for sens in cont.sensors: - # The sensor can be on another object, we may want to use it - own_sens = sens.owner - print ' sensor:', sens.name, - if sens.positive: - print '(true)' - input = True - else: - print '(false)' - - for actu in cont.actuators: - # The actuator can be on another object, we may want to use it - own_actu = actu.owner - print ' actuator:', actu.name - - # This runs the actuator or turns it off - # note that actuators will continue to run unless explicitly turned off. - if input: - cont.activate(actu) - else: - cont.deactivate(actu) - - # Its also good practice to get sensors and actuators by name - # rather then index so any changes to their order wont break the script. - - # sens_key = cont.sensors['key_sensor'] - # actu_motion = cont.actuators['motion'] - - - # Loop through all other objects in the scene - sce = GameLogic.getCurrentScene() - print 'Scene Objects:', sce.name - for ob in sce.objects: - print ' ', ob.name, ob.worldPosition - - - # Example where collision objects are checked for their properties - # adding to our objects "life" property - """ - actu_collide = cont.sensors['collision_sens'] - for ob in actu_collide.objectHitList: - # Check to see the object has this property - if ob.has_key('life'): - own['life'] += ob['life'] - ob['life'] = 0 - print own['life'] - """ + cont = GameLogic.getCurrentController() + + # The KX_GameObject that owns this controller. + own = cont.owner + + # for scripts that deal with spacial logic + own_pos = own.worldPosition + + + # Some example functions, remove to write your own script. + # check for a positive sensor, will run on any object without errors. + print 'Logic info for KX_GameObject', own.name + input = False + + for sens in cont.sensors: + # The sensor can be on another object, we may want to use it + own_sens = sens.owner + print ' sensor:', sens.name, + if sens.positive: + print '(true)' + input = True + else: + print '(false)' + + for actu in cont.actuators: + # The actuator can be on another object, we may want to use it + own_actu = actu.owner + print ' actuator:', actu.name + + # This runs the actuator or turns it off + # note that actuators will continue to run unless explicitly turned off. + if input: + cont.activate(actu) + else: + cont.deactivate(actu) + + # Its also good practice to get sensors and actuators by name + # rather then index so any changes to their order wont break the script. + + # sens_key = cont.sensors['key_sensor'] + # actu_motion = cont.actuators['motion'] + + + # Loop through all other objects in the scene + sce = GameLogic.getCurrentScene() + print 'Scene Objects:', sce.name + for ob in sce.objects: + print ' ', ob.name, ob.worldPosition + + + # Example where collision objects are checked for their properties + # adding to our objects "life" property + """ + actu_collide = cont.sensors['collision_sens'] + for ob in actu_collide.objectHitList: + # Check to see the object has this property + if ob.has_key('life'): + own['life'] += ob['life'] + ob['life'] = 0 + print own['life'] + """ main() diff --git a/release/scripts/templates/gamelogic_basic.py b/release/scripts/templates/gamelogic_basic.py index c9c2a594309..5e7d19672fe 100644 --- a/release/scripts/templates/gamelogic_basic.py +++ b/release/scripts/templates/gamelogic_basic.py @@ -1,15 +1,15 @@ def main(): - cont = GameLogic.getCurrentController() - own = cont.owner - - sens = cont.sensors['mySensor'] - actu = cont.actuators['myActuator'] - - if sens.positive: - cont.activate(actu) - else: - cont.deactivate(actu) + cont = GameLogic.getCurrentController() + own = cont.owner + + sens = cont.sensors['mySensor'] + actu = cont.actuators['myActuator'] + + if sens.positive: + cont.activate(actu) + else: + cont.deactivate(actu) main() diff --git a/release/scripts/templates/gamelogic_module.py b/release/scripts/templates/gamelogic_module.py index 1bc221e727d..5a61a3592dc 100644 --- a/release/scripts/templates/gamelogic_module.py +++ b/release/scripts/templates/gamelogic_module.py @@ -13,14 +13,14 @@ import GameLogic # with multiple objects. def main(cont): - own = cont.owner - - sens = cont.sensors['mySensor'] - actu = cont.actuators['myActuator'] - - if sens.positive: - cont.activate(actu) - else: - cont.deactivate(actu) + own = cont.owner + + sens = cont.sensors['mySensor'] + actu = cont.actuators['myActuator'] + + if sens.positive: + cont.activate(actu) + else: + cont.deactivate(actu) # dont call main(GameLogic.getCurrentController()), the py controller will diff --git a/release/scripts/templates/operator.py b/release/scripts/templates/operator.py index c03d5850237..3e9e65f13f8 100644 --- a/release/scripts/templates/operator.py +++ b/release/scripts/templates/operator.py @@ -1,46 +1,46 @@ import bpy def write_some_data(context, path, use_some_setting): - pass + pass from bpy.props import * class ExportSomeData(bpy.types.Operator): - '''This appiers in the tooltip of the operator and in the generated docs.''' - bl_idname = "export.some_data" # this is important since its how bpy.ops.export.some_data is constructed - bl_label = "Export Some Data" - - # List of operator properties, the attributes will be assigned - # to the class instance from the operator settings before calling. - - # TODO, add better example props - path = StringProperty(name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= "") - use_some_setting = BoolProperty(name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default= True) - - def poll(self, context): - return context.active_object != None - - def execute(self, context): - if not self.is_property_set("path"): - raise Exception("filename not set") - - write(self.path, context, use_setting, SOME_SETTING = self.use_some_setting) + '''This appiers in the tooltip of the operator and in the generated docs.''' + bl_idname = "export.some_data" # this is important since its how bpy.ops.export.some_data is constructed + bl_label = "Export Some Data" - return ('FINISHED',) - - def invoke(self, context, event): - wm = context.manager - - if True: - # File selector - wm.add_fileselect(self.__operator__) # will run self.execute() - return ('RUNNING_MODAL',) - else if 0: - # Redo popup - wm.invoke_props_popup(self.__operator__, event) # - return ('RUNNING_MODAL',) - else if 0: - return self.execute(context) + # List of operator properties, the attributes will be assigned + # to the class instance from the operator settings before calling. + + # TODO, add better example props + path = StringProperty(name="File Path", description="File path used for exporting the PLY file", maxlen= 1024, default= "") + use_some_setting = BoolProperty(name="Apply Modifiers", description="Apply Modifiers to the exported mesh", default= True) + + def poll(self, context): + return context.active_object != None + + def execute(self, context): + if not self.is_property_set("path"): + raise Exception("filename not set") + + write(self.path, context, use_setting, SOME_SETTING = self.use_some_setting) + + return ('FINISHED',) + + def invoke(self, context, event): + wm = context.manager + + if True: + # File selector + wm.add_fileselect(self.__operator__) # will run self.execute() + return ('RUNNING_MODAL',) + else if 0: + # Redo popup + wm.invoke_props_popup(self.__operator__, event) # + return ('RUNNING_MODAL',) + else if 0: + return self.execute(context) bpy.ops.add(ExportSomeData) @@ -52,4 +52,4 @@ menu_item = dynamic_menu.add(bpy.types.INFO_MT_file_export, menu_func) # Use for running this script directly if __name__ == "__main__": - bpy.ops.export.some_data(path="/tmp/test.ply") \ No newline at end of file + bpy.ops.export.some_data(path="/tmp/test.ply") diff --git a/release/scripts/templates/operator_simple.py b/release/scripts/templates/operator_simple.py index f0f4b104950..b19ce981833 100644 --- a/release/scripts/templates/operator_simple.py +++ b/release/scripts/templates/operator_simple.py @@ -1,20 +1,20 @@ def main(context): - for ob in context.scene.objects: - print(ob) - + for ob in context.scene.objects: + print(ob) + class SimpleOperator(bpy.types.Operator): - '''''' - bl_idname = "object.simple_operator" - bl_label = "Simple Object Operator" - - def poll(self, context): - return context.active_object != None - - def execute(self, context): - main(context) - return ('FINISHED',) + '''''' + bl_idname = "object.simple_operator" + bl_label = "Simple Object Operator" + + def poll(self, context): + return context.active_object != None + + def execute(self, context): + main(context) + return ('FINISHED',) bpy.ops.add(SimpleOperator) if __name__ == "__main__": - bpy.ops.object.simple_operator() + bpy.ops.object.simple_operator() diff --git a/release/scripts/ui/buttons_data_armature.py b/release/scripts/ui/buttons_data_armature.py index 75264f5d7ec..b4abce01e4d 100644 --- a/release/scripts/ui/buttons_data_armature.py +++ b/release/scripts/ui/buttons_data_armature.py @@ -1,180 +1,180 @@ import bpy - + class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - def poll(self, context): - return context.armature + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return context.armature class DATA_PT_context_arm(DataButtonsPanel): - bl_label = "" - bl_show_header = False - - def draw(self, context): - layout = self.layout - - ob = context.object - arm = context.armature - space = context.space_data + bl_label = "" + bl_show_header = False - split = layout.split(percentage=0.65) + def draw(self, context): + layout = self.layout - if ob: - split.template_ID(ob, "data") - split.itemS() - elif arm: - split.template_ID(space, "pin_id") - split.itemS() + ob = context.object + arm = context.armature + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif arm: + split.template_ID(space, "pin_id") + split.itemS() class DATA_PT_skeleton(DataButtonsPanel): - bl_label = "Skeleton" - - def draw(self, context): - layout = self.layout - - ob = context.object - arm = context.armature - space = context.space_data - - layout.itemR(arm, "pose_position", expand=True) - - split = layout.split() + bl_label = "Skeleton" + + def draw(self, context): + layout = self.layout + + ob = context.object + arm = context.armature + space = context.space_data + + layout.itemR(arm, "pose_position", expand=True) + + split = layout.split() + + col = split.column() + col.itemL(text="Layers:") + col.itemR(arm, "layer", text="") + col.itemL(text="Protected Layers:") + col.itemR(arm, "layer_protection", text="") + + col = split.column() + col.itemL(text="Deform:") + col.itemR(arm, "deform_vertexgroups", text="Vertex Groups") + col.itemR(arm, "deform_envelope", text="Envelopes") + col.itemR(arm, "deform_quaternion", text="Quaternion") + col.itemR(arm, "deform_bbone_rest", text="B-Bones Rest") - col = split.column() - col.itemL(text="Layers:") - col.itemR(arm, "layer", text="") - col.itemL(text="Protected Layers:") - col.itemR(arm, "layer_protection", text="") - - col = split.column() - col.itemL(text="Deform:") - col.itemR(arm, "deform_vertexgroups", text="Vertex Groups") - col.itemR(arm, "deform_envelope", text="Envelopes") - col.itemR(arm, "deform_quaternion", text="Quaternion") - col.itemR(arm, "deform_bbone_rest", text="B-Bones Rest") - class DATA_PT_display(DataButtonsPanel): - bl_label = "Display" - - def draw(self, context): - layout = self.layout - - arm = context.armature + bl_label = "Display" - layout.row().itemR(arm, "drawtype", expand=True) + def draw(self, context): + layout = self.layout - flow = layout.column_flow() - flow.itemR(arm, "draw_names", text="Names") - flow.itemR(arm, "draw_axes", text="Axes") - flow.itemR(arm, "draw_custom_bone_shapes", text="Shapes") - flow.itemR(arm, "draw_group_colors", text="Colors") - flow.itemR(arm, "delay_deform", text="Delay Refresh") + arm = context.armature + + layout.row().itemR(arm, "drawtype", expand=True) + + flow = layout.column_flow() + flow.itemR(arm, "draw_names", text="Names") + flow.itemR(arm, "draw_axes", text="Axes") + flow.itemR(arm, "draw_custom_bone_shapes", text="Shapes") + flow.itemR(arm, "draw_group_colors", text="Colors") + flow.itemR(arm, "delay_deform", text="Delay Refresh") class DATA_PT_bone_groups(DataButtonsPanel): - bl_label = "Bone Groups" - - def poll(self, context): - return (context.object and context.object.type=='ARMATURE' and context.object.pose) + bl_label = "Bone Groups" - def draw(self, context): - layout = self.layout - - ob = context.object - pose = ob.pose - - row = layout.row() - row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2) - - col = row.column(align=True) - col.active = (ob.proxy == None) - col.itemO("pose.group_add", icon='ICON_ZOOMIN', text="") - col.itemO("pose.group_remove", icon='ICON_ZOOMOUT', text="") - - group = pose.active_bone_group - if group: - col = layout.column() - col.active= (ob.proxy == None) - col.itemR(group, "name") - - split = layout.split(0.5) - split.active= (ob.proxy == None) - split.itemR(group, "color_set") - if group.color_set: - split.template_triColorSet(group, "colors") - - row = layout.row(align=True) - row.active = (ob.proxy == None) - - row.itemO("pose.group_assign", text="Assign") - row.itemO("pose.group_remove", text="Remove") #row.itemO("pose.bone_group_remove_from", text="Remove") - #row.itemO("object.bone_group_select", text="Select") - #row.itemO("object.bone_group_deselect", text="Deselect") + def poll(self, context): + return (context.object and context.object.type=='ARMATURE' and context.object.pose) + + def draw(self, context): + layout = self.layout + + ob = context.object + pose = ob.pose + + row = layout.row() + row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2) + + col = row.column(align=True) + col.active = (ob.proxy == None) + col.itemO("pose.group_add", icon='ICON_ZOOMIN', text="") + col.itemO("pose.group_remove", icon='ICON_ZOOMOUT', text="") + + group = pose.active_bone_group + if group: + col = layout.column() + col.active= (ob.proxy == None) + col.itemR(group, "name") + + split = layout.split(0.5) + split.active= (ob.proxy == None) + split.itemR(group, "color_set") + if group.color_set: + split.template_triColorSet(group, "colors") + + row = layout.row(align=True) + row.active = (ob.proxy == None) + + row.itemO("pose.group_assign", text="Assign") + row.itemO("pose.group_remove", text="Remove") #row.itemO("pose.bone_group_remove_from", text="Remove") + #row.itemO("object.bone_group_select", text="Select") + #row.itemO("object.bone_group_deselect", text="Deselect") class DATA_PT_paths(DataButtonsPanel): - bl_label = "Paths" + bl_label = "Paths" - def draw(self, context): - layout = self.layout - - arm = context.armature - - layout.itemR(arm, "paths_type", expand=True) - - split = layout.split() - - col = split.column() - sub = col.column(align=True) - if (arm.paths_type == 'CURRENT_FRAME'): - sub.itemR(arm, "path_before_current", text="Before") - sub.itemR(arm, "path_after_current", text="After") - elif (arm.paths_type == 'RANGE'): - sub.itemR(arm, "path_start_frame", text="Start") - sub.itemR(arm, "path_end_frame", text="End") + def draw(self, context): + layout = self.layout - sub.itemR(arm, "path_size", text="Step") - col.row().itemR(arm, "paths_location", expand=True) - - col = split.column() - col.itemL(text="Display:") - col.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers") - col.itemR(arm, "paths_highlight_keyframes", text="Keyframes") - col.itemR(arm, "paths_show_keyframe_numbers", text="Keyframe Numbers") - - layout.itemS() - - row = layout.row() - row.itemO("pose.paths_calculate", text="Calculate Paths") - row.itemO("pose.paths_clear", text="Clear Paths") + arm = context.armature + + layout.itemR(arm, "paths_type", expand=True) + + split = layout.split() + + col = split.column() + sub = col.column(align=True) + if (arm.paths_type == 'CURRENT_FRAME'): + sub.itemR(arm, "path_before_current", text="Before") + sub.itemR(arm, "path_after_current", text="After") + elif (arm.paths_type == 'RANGE'): + sub.itemR(arm, "path_start_frame", text="Start") + sub.itemR(arm, "path_end_frame", text="End") + + sub.itemR(arm, "path_size", text="Step") + col.row().itemR(arm, "paths_location", expand=True) + + col = split.column() + col.itemL(text="Display:") + col.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers") + col.itemR(arm, "paths_highlight_keyframes", text="Keyframes") + col.itemR(arm, "paths_show_keyframe_numbers", text="Keyframe Numbers") + + layout.itemS() + + row = layout.row() + row.itemO("pose.paths_calculate", text="Calculate Paths") + row.itemO("pose.paths_clear", text="Clear Paths") class DATA_PT_ghost(DataButtonsPanel): - bl_label = "Ghost" + bl_label = "Ghost" - def draw(self, context): - layout = self.layout - - arm = context.armature - - layout.itemR(arm, "ghost_type", expand=True) - - split = layout.split() + def draw(self, context): + layout = self.layout - col = split.column() + arm = context.armature - sub = col.column(align=True) - if arm.ghost_type == 'RANGE': - sub.itemR(arm, "ghost_start_frame", text="Start") - sub.itemR(arm, "ghost_end_frame", text="End") - sub.itemR(arm, "ghost_size", text="Step") - elif arm.ghost_type == 'CURRENT_FRAME': - sub.itemR(arm, "ghost_step", text="Range") - sub.itemR(arm, "ghost_size", text="Step") + layout.itemR(arm, "ghost_type", expand=True) - col = split.column() - col.itemL(text="Display:") - col.itemR(arm, "ghost_only_selected", text="Selected Only") + split = layout.split() + + col = split.column() + + sub = col.column(align=True) + if arm.ghost_type == 'RANGE': + sub.itemR(arm, "ghost_start_frame", text="Start") + sub.itemR(arm, "ghost_end_frame", text="End") + sub.itemR(arm, "ghost_size", text="Step") + elif arm.ghost_type == 'CURRENT_FRAME': + sub.itemR(arm, "ghost_step", text="Range") + sub.itemR(arm, "ghost_size", text="Step") + + col = split.column() + col.itemL(text="Display:") + col.itemR(arm, "ghost_only_selected", text="Selected Only") bpy.types.register(DATA_PT_context_arm) bpy.types.register(DATA_PT_skeleton) diff --git a/release/scripts/ui/buttons_data_bone.py b/release/scripts/ui/buttons_data_bone.py index 706c418d0ce..962cb871377 100644 --- a/release/scripts/ui/buttons_data_bone.py +++ b/release/scripts/ui/buttons_data_bone.py @@ -1,225 +1,225 @@ import bpy - + class BoneButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "bone" - - def poll(self, context): - return (context.bone or context.edit_bone) + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "bone" + + def poll(self, context): + return (context.bone or context.edit_bone) class BONE_PT_context_bone(BoneButtonsPanel): - bl_label = "" - bl_show_header = False + bl_label = "" + bl_show_header = False - def draw(self, context): - layout = self.layout - - bone = context.bone - if not bone: - bone = context.edit_bone - - row = layout.row() - row.itemL(text="", icon='ICON_BONE_DATA') - row.itemR(bone, "name", text="") + def draw(self, context): + layout = self.layout + + bone = context.bone + if not bone: + bone = context.edit_bone + + row = layout.row() + row.itemL(text="", icon='ICON_BONE_DATA') + row.itemR(bone, "name", text="") class BONE_PT_transform(BoneButtonsPanel): - bl_label = "Transform" + bl_label = "Transform" - def draw(self, context): - layout = self.layout - - ob = context.object - bone = context.bone - if not bone: - bone = context.edit_bone + def draw(self, context): + layout = self.layout - row = layout.row() - row.column().itemR(bone, "head") - row.column().itemR(bone, "tail") + ob = context.object + bone = context.bone + if not bone: + bone = context.edit_bone - col = row.column() - sub = col.column(align=True) - sub.itemL(text="Roll:") - sub.itemR(bone, "roll", text="") - sub.itemL() - sub.itemR(bone, "locked") + row = layout.row() + row.column().itemR(bone, "head") + row.column().itemR(bone, "tail") - else: - pchan = ob.pose.pose_channels[context.bone.name] + col = row.column() + sub = col.column(align=True) + sub.itemL(text="Roll:") + sub.itemR(bone, "roll", text="") + sub.itemL() + sub.itemR(bone, "locked") - row = layout.row() - col = row.column() - col.itemR(pchan, "location") - col.active = not (bone.parent and bone.connected) + else: + pchan = ob.pose.pose_channels[context.bone.name] - col = row.column() - if pchan.rotation_mode == 'QUATERNION': - col.itemR(pchan, "rotation_quaternion", text="Rotation") - elif pchan.rotation_mode == 'AXIS_ANGLE': - #col.itemL(text="Rotation") - #col.itemR(pchan, "rotation_angle", text="Angle") - #col.itemR(pchan, "rotation_axis", text="Axis") - col.itemR(pchan, "rotation_axis_angle", text="Rotation") - else: - col.itemR(pchan, "rotation_euler", text="Rotation") + row = layout.row() + col = row.column() + col.itemR(pchan, "location") + col.active = not (bone.parent and bone.connected) + + col = row.column() + if pchan.rotation_mode == 'QUATERNION': + col.itemR(pchan, "rotation_quaternion", text="Rotation") + elif pchan.rotation_mode == 'AXIS_ANGLE': + #col.itemL(text="Rotation") + #col.itemR(pchan, "rotation_angle", text="Angle") + #col.itemR(pchan, "rotation_axis", text="Axis") + col.itemR(pchan, "rotation_axis_angle", text="Rotation") + else: + col.itemR(pchan, "rotation_euler", text="Rotation") + + row.column().itemR(pchan, "scale") + + layout.itemR(pchan, "rotation_mode") - row.column().itemR(pchan, "scale") - - layout.itemR(pchan, "rotation_mode") - class BONE_PT_transform_locks(BoneButtonsPanel): - bl_label = "Transform Locks" - bl_default_closed = True - - def poll(self, context): - return context.bone - - def draw(self, context): - layout = self.layout - - ob = context.object - bone = context.bone - pchan = ob.pose.pose_channels[context.bone.name] - - row = layout.row() - col = row.column() - col.itemR(pchan, "lock_location") - col.active = not (bone.parent and bone.connected) - - col = row.column() - if pchan.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'): - col.itemR(pchan, "lock_rotations_4d", text="Lock Rotation") - if pchan.lock_rotations_4d: - col.itemR(pchan, "lock_rotation_w", text="W") - col.itemR(pchan, "lock_rotation", text="") - else: - col.itemR(pchan, "lock_rotation", text="Rotation") - - row.column().itemR(pchan, "lock_scale") + bl_label = "Transform Locks" + bl_default_closed = True + + def poll(self, context): + return context.bone + + def draw(self, context): + layout = self.layout + + ob = context.object + bone = context.bone + pchan = ob.pose.pose_channels[context.bone.name] + + row = layout.row() + col = row.column() + col.itemR(pchan, "lock_location") + col.active = not (bone.parent and bone.connected) + + col = row.column() + if pchan.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'): + col.itemR(pchan, "lock_rotations_4d", text="Lock Rotation") + if pchan.lock_rotations_4d: + col.itemR(pchan, "lock_rotation_w", text="W") + col.itemR(pchan, "lock_rotation", text="") + else: + col.itemR(pchan, "lock_rotation", text="Rotation") + + row.column().itemR(pchan, "lock_scale") class BONE_PT_relations(BoneButtonsPanel): - bl_label = "Relations" + bl_label = "Relations" - def draw(self, context): - layout = self.layout - - ob = context.object - bone = context.bone - arm = context.armature - - if not bone: - bone = context.edit_bone - pchan = None - else: - pchan = ob.pose.pose_channels[context.bone.name] + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - col.itemL(text="Layers:") - col.itemR(bone, "layer", text="") - - col.itemS() - - if ob and pchan: - col.itemL(text="Bone Group:") - col.item_pointerR(pchan, "bone_group", ob.pose, "bone_groups", text="") - - col = split.column() - col.itemL(text="Parent:") - if context.bone: - col.itemR(bone, "parent", text="") - else: - col.item_pointerR(bone, "parent", arm, "edit_bones", text="") - - sub = col.column() - sub.active = bone.parent != None - sub.itemR(bone, "connected") - sub.itemR(bone, "hinge", text="Inherit Rotation") - sub.itemR(bone, "inherit_scale", text="Inherit Scale") + ob = context.object + bone = context.bone + arm = context.armature + + if not bone: + bone = context.edit_bone + pchan = None + else: + pchan = ob.pose.pose_channels[context.bone.name] + + split = layout.split() + + col = split.column() + col.itemL(text="Layers:") + col.itemR(bone, "layer", text="") + + col.itemS() + + if ob and pchan: + col.itemL(text="Bone Group:") + col.item_pointerR(pchan, "bone_group", ob.pose, "bone_groups", text="") + + col = split.column() + col.itemL(text="Parent:") + if context.bone: + col.itemR(bone, "parent", text="") + else: + col.item_pointerR(bone, "parent", arm, "edit_bones", text="") + + sub = col.column() + sub.active = bone.parent != None + sub.itemR(bone, "connected") + sub.itemR(bone, "hinge", text="Inherit Rotation") + sub.itemR(bone, "inherit_scale", text="Inherit Scale") class BONE_PT_display(BoneButtonsPanel): - bl_label = "Display" - - def poll(self, context): - return context.bone - - def draw(self, context): - layout = self.layout - - ob = context.object - bone = context.bone - arm = context.armature - - if not bone: - bone = context.edit_bone - pchan = None - else: - pchan = ob.pose.pose_channels[context.bone.name] - - if ob and pchan: - - split = layout.split() - - col = split.column() - - col.itemR(bone, "draw_wire", text="Wireframe") - col.itemR(bone, "hidden", text="Hide") - - col = split.column() - - col.itemL(text="Custom Shape:") - col.itemR(pchan, "custom_shape", text="") + bl_label = "Display" + + def poll(self, context): + return context.bone + + def draw(self, context): + layout = self.layout + + ob = context.object + bone = context.bone + arm = context.armature + + if not bone: + bone = context.edit_bone + pchan = None + else: + pchan = ob.pose.pose_channels[context.bone.name] + + if ob and pchan: + + split = layout.split() + + col = split.column() + + col.itemR(bone, "draw_wire", text="Wireframe") + col.itemR(bone, "hidden", text="Hide") + + col = split.column() + + col.itemL(text="Custom Shape:") + col.itemR(pchan, "custom_shape", text="") class BONE_PT_deform(BoneButtonsPanel): - bl_label = "Deform" - bl_default_closed = True + bl_label = "Deform" + bl_default_closed = True - def draw_header(self, context): - bone = context.bone - - if not bone: - bone = context.edit_bone - - self.layout.itemR(bone, "deform", text="") + def draw_header(self, context): + bone = context.bone - def draw(self, context): - layout = self.layout - - bone = context.bone - - if not bone: - bone = context.edit_bone - - layout.active = bone.deform - - split = layout.split() + if not bone: + bone = context.edit_bone - col = split.column() - col.itemL(text="Envelope:") - - sub = col.column(align=True) - sub.itemR(bone, "envelope_distance", text="Distance") - sub.itemR(bone, "envelope_weight", text="Weight") - col.itemR(bone, "multiply_vertexgroup_with_envelope", text="Multiply") + self.layout.itemR(bone, "deform", text="") - sub = col.column(align=True) - sub.itemL(text="Radius:") - sub.itemR(bone, "head_radius", text="Head") - sub.itemR(bone, "tail_radius", text="Tail") + def draw(self, context): + layout = self.layout - col = split.column() - col.itemL(text="Curved Bones:") - - sub = col.column(align=True) - sub.itemR(bone, "bbone_segments", text="Segments") - sub.itemR(bone, "bbone_in", text="Ease In") - sub.itemR(bone, "bbone_out", text="Ease Out") - - col.itemL(text="Offset:") - col.itemR(bone, "cyclic_offset") + bone = context.bone + + if not bone: + bone = context.edit_bone + + layout.active = bone.deform + + split = layout.split() + + col = split.column() + col.itemL(text="Envelope:") + + sub = col.column(align=True) + sub.itemR(bone, "envelope_distance", text="Distance") + sub.itemR(bone, "envelope_weight", text="Weight") + col.itemR(bone, "multiply_vertexgroup_with_envelope", text="Multiply") + + sub = col.column(align=True) + sub.itemL(text="Radius:") + sub.itemR(bone, "head_radius", text="Head") + sub.itemR(bone, "tail_radius", text="Tail") + + col = split.column() + col.itemL(text="Curved Bones:") + + sub = col.column(align=True) + sub.itemR(bone, "bbone_segments", text="Segments") + sub.itemR(bone, "bbone_in", text="Ease In") + sub.itemR(bone, "bbone_out", text="Ease Out") + + col.itemL(text="Offset:") + col.itemR(bone, "cyclic_offset") bpy.types.register(BONE_PT_context_bone) bpy.types.register(BONE_PT_transform) diff --git a/release/scripts/ui/buttons_data_camera.py b/release/scripts/ui/buttons_data_camera.py index 1321e42b97d..f0c39dc2593 100644 --- a/release/scripts/ui/buttons_data_camera.py +++ b/release/scripts/ui/buttons_data_camera.py @@ -2,97 +2,97 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return context.camera - def poll(self, context): - return context.camera - class DATA_PT_context_camera(DataButtonsPanel): - bl_label = "" - bl_show_header = False - - def draw(self, context): - layout = self.layout - - ob = context.object - cam = context.camera - space = context.space_data + bl_label = "" + bl_show_header = False - split = layout.split(percentage=0.65) + def draw(self, context): + layout = self.layout - if ob: - split.template_ID(ob, "data") - split.itemS() - elif cam: - split.template_ID(space, "pin_id") - split.itemS() + ob = context.object + cam = context.camera + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif cam: + split.template_ID(space, "pin_id") + split.itemS() class DATA_PT_camera(DataButtonsPanel): - bl_label = "Lens" + bl_label = "Lens" - def draw(self, context): - layout = self.layout - - cam = context.camera + def draw(self, context): + layout = self.layout - layout.itemR(cam, "type", expand=True) - - row = layout.row() - if cam.type == 'PERSP': - if cam.lens_unit == 'MILLIMETERS': - row.itemR(cam, "lens", text="Angle") - elif cam.lens_unit == 'DEGREES': - row.itemR(cam, "angle") - row.itemR(cam, "lens_unit", text="") + cam = context.camera - elif cam.type == 'ORTHO': - row.itemR(cam, "ortho_scale") + layout.itemR(cam, "type", expand=True) + + row = layout.row() + if cam.type == 'PERSP': + if cam.lens_unit == 'MILLIMETERS': + row.itemR(cam, "lens", text="Angle") + elif cam.lens_unit == 'DEGREES': + row.itemR(cam, "angle") + row.itemR(cam, "lens_unit", text="") + + elif cam.type == 'ORTHO': + row.itemR(cam, "ortho_scale") + + layout.itemR(cam, "panorama") + + split = layout.split() + + col = split.column(align=True) + col.itemL(text="Shift:") + col.itemR(cam, "shift_x", text="X") + col.itemR(cam, "shift_y", text="Y") + + col = split.column(align=True) + col.itemL(text="Clipping:") + col.itemR(cam, "clip_start", text="Start") + col.itemR(cam, "clip_end", text="End") + + layout.itemL(text="Depth of Field:") + + row = layout.row() + row.itemR(cam, "dof_object", text="") + row.itemR(cam, "dof_distance", text="Distance") - layout.itemR(cam, "panorama") - - split = layout.split() - - col = split.column(align=True) - col.itemL(text="Shift:") - col.itemR(cam, "shift_x", text="X") - col.itemR(cam, "shift_y", text="Y") - - col = split.column(align=True) - col.itemL(text="Clipping:") - col.itemR(cam, "clip_start", text="Start") - col.itemR(cam, "clip_end", text="End") - - layout.itemL(text="Depth of Field:") - - row = layout.row() - row.itemR(cam, "dof_object", text="") - row.itemR(cam, "dof_distance", text="Distance") - class DATA_PT_camera_display(DataButtonsPanel): - bl_label = "Display" + bl_label = "Display" - def draw(self, context): - layout = self.layout - - cam = context.camera + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - col.itemR(cam, "show_limits", text="Limits") - col.itemR(cam, "show_mist", text="Mist") - col.itemR(cam, "show_title_safe", text="Title Safe") - col.itemR(cam, "show_name", text="Name") - - col = split.column() - col.itemR(cam, "draw_size", text="Size") - col.itemS() - col.itemR(cam, "show_passepartout", text="Passepartout") - sub = col.column() - sub.active = cam.show_passepartout - sub.itemR(cam, "passepartout_alpha", text="Alpha", slider=True) + cam = context.camera + + split = layout.split() + + col = split.column() + col.itemR(cam, "show_limits", text="Limits") + col.itemR(cam, "show_mist", text="Mist") + col.itemR(cam, "show_title_safe", text="Title Safe") + col.itemR(cam, "show_name", text="Name") + + col = split.column() + col.itemR(cam, "draw_size", text="Size") + col.itemS() + col.itemR(cam, "show_passepartout", text="Passepartout") + sub = col.column() + sub.active = cam.show_passepartout + sub.itemR(cam, "passepartout_alpha", text="Alpha", slider=True) bpy.types.register(DATA_PT_context_camera) bpy.types.register(DATA_PT_camera) diff --git a/release/scripts/ui/buttons_data_curve.py b/release/scripts/ui/buttons_data_curve.py index 90d84dc09ed..fdb24cab2b1 100644 --- a/release/scripts/ui/buttons_data_curve.py +++ b/release/scripts/ui/buttons_data_curve.py @@ -2,94 +2,94 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - def poll(self, context): - return (context.object and context.object.type in ('CURVE', 'SURFACE') and context.curve) - + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return (context.object and context.object.type in ('CURVE', 'SURFACE') and context.curve) + class DataButtonsPanelCurve(DataButtonsPanel): - ''' - Same as above but for curves only - ''' - def poll(self, context): - return (context.object and context.object.type == 'CURVE' and context.curve) + ''' + Same as above but for curves only + ''' + def poll(self, 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): - curve = context.curve - return (curve and curve.active_spline) + ''' + Same as above but for curves only + ''' + def poll(self, context): + curve = context.curve + return (curve and curve.active_spline) class DATA_PT_context_curve(DataButtonsPanel): - bl_label = "" - bl_show_header = False - - def draw(self, context): - layout = self.layout - - ob = context.object - curve = context.curve - space = context.space_data + bl_label = "" + bl_show_header = False - split = layout.split(percentage=0.65) + def draw(self, context): + layout = self.layout - if ob: - split.template_ID(ob, "data") - split.itemS() - elif curve: - split.template_ID(space, "pin_id") - split.itemS() + ob = context.object + curve = context.curve + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif curve: + split.template_ID(space, "pin_id") + split.itemS() class DATA_PT_shape_curve(DataButtonsPanel): - bl_label = "Shape" - - def draw(self, context): - layout = self.layout - - ob = context.object - curve = context.curve - space = context.space_data - is_surf = (ob.type == 'SURFACE') + bl_label = "Shape" - if not is_surf: - row = layout.row() - row.itemR(curve, "dimensions", expand=True) - - split = layout.split() - - col = split.column() - - if not is_surf: - sub = col.column() - sub.active = (curve.dimensions=='2D') - sub.itemL(text="Caps:") - row = sub.row() - row.itemR(curve, "front") - row.itemR(curve, "back") - - col.itemL(text="Textures:") + def draw(self, context): + layout = self.layout + + ob = context.object + curve = context.curve + space = context.space_data + is_surf = (ob.type == 'SURFACE') + + if not is_surf: + row = layout.row() + row.itemR(curve, "dimensions", expand=True) + + split = layout.split() + + col = split.column() + + if not is_surf: + sub = col.column() + sub.active = (curve.dimensions=='2D') + sub.itemL(text="Caps:") + row = sub.row() + row.itemR(curve, "front") + row.itemR(curve, "back") + + col.itemL(text="Textures:") # col.itemR(curve, "uv_orco") - col.itemR(curve, "auto_texspace") - - col = split.column() - col.itemL(text="Resolution:") - sub = col.column(align=True) - sub.itemR(curve, "resolution_u", text="Preview U") - sub.itemR(curve, "render_resolution_u", text="Render U") + col.itemR(curve, "auto_texspace") - if is_surf: - sub = col.column(align=True) - sub.itemR(curve, "resolution_v", text="Preview V") - sub.itemR(curve, "render_resolution_v", text="Render V") - - # XXX - put somewhere nicer. - row= layout.row() - row.itemR(curve, "twist_mode") - row.itemR(curve, "twist_smooth") # XXX - may not be kept + col = split.column() + col.itemL(text="Resolution:") + sub = col.column(align=True) + sub.itemR(curve, "resolution_u", text="Preview U") + sub.itemR(curve, "render_resolution_u", text="Render U") + + if is_surf: + sub = col.column(align=True) + sub.itemR(curve, "resolution_v", text="Preview V") + sub.itemR(curve, "render_resolution_v", text="Render V") + + # XXX - put somewhere nicer. + row= layout.row() + row.itemR(curve, "twist_mode") + row.itemR(curve, "twist_smooth") # XXX - may not be kept # col.itemL(text="Display:") # col.itemL(text="HANDLES") @@ -97,127 +97,127 @@ class DATA_PT_shape_curve(DataButtonsPanel): # col.itemR(curve, "vertex_normal_flip") class DATA_PT_geometry_curve(DataButtonsPanel): - bl_label = "Geometry" + bl_label = "Geometry" - def draw(self, context): - layout = self.layout - - curve = context.curve + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - col.itemL(text="Modification:") - col.itemR(curve, "width") - col.itemR(curve, "extrude") - col.itemL(text="Taper Object:") - col.itemR(curve, "taper_object", text="") - - col = split.column() - col.itemL(text="Bevel:") - col.itemR(curve, "bevel_depth", text="Depth") - col.itemR(curve, "bevel_resolution", text="Resolution") - col.itemL(text="Bevel Object:") - col.itemR(curve, "bevel_object", text="") + curve = context.curve + + split = layout.split() + + col = split.column() + col.itemL(text="Modification:") + col.itemR(curve, "width") + col.itemR(curve, "extrude") + col.itemL(text="Taper Object:") + col.itemR(curve, "taper_object", text="") + + col = split.column() + col.itemL(text="Bevel:") + col.itemR(curve, "bevel_depth", text="Depth") + col.itemR(curve, "bevel_resolution", text="Resolution") + col.itemL(text="Bevel Object:") + col.itemR(curve, "bevel_object", text="") class DATA_PT_pathanim(DataButtonsPanelCurve): - bl_label = "Path Animation" - - def draw_header(self, context): - curve = context.curve + bl_label = "Path Animation" - self.layout.itemR(curve, "use_path", text="") + def draw_header(self, context): + curve = context.curve - def draw(self, context): - layout = self.layout - - curve = context.curve - - layout.active = curve.use_path - - split = layout.split() - - col = split.column() - col.itemR(curve, "path_length", text="Frames") - col.itemR(curve, "use_path_follow") + self.layout.itemR(curve, "use_path", text="") + + def draw(self, context): + layout = self.layout + + curve = context.curve + + layout.active = curve.use_path + + split = layout.split() + + col = split.column() + col.itemR(curve, "path_length", text="Frames") + col.itemR(curve, "use_path_follow") + + col = split.column() + col.itemR(curve, "use_stretch") + col.itemR(curve, "use_radius") + col.itemR(curve, "use_time_offset", text="Offset Children") - col = split.column() - col.itemR(curve, "use_stretch") - col.itemR(curve, "use_radius") - col.itemR(curve, "use_time_offset", text="Offset Children") - class DATA_PT_active_spline(DataButtonsPanelActive): - bl_label = "Active Spline" + bl_label = "Active Spline" - def draw(self, context): - layout = self.layout - - ob = context.object - curve = context.curve - act_spline = curve.active_spline - is_surf = (ob.type == 'SURFACE') - is_poly = (act_spline.type == 'POLY') - - split = layout.split() - - if is_poly: - # These settings are below but its easier to have - # poly's set aside since they use so few settings - col = split.column() - col.itemL(text="Cyclic:") - col.itemR(act_spline, "smooth") - col = split.column() - col.itemR(act_spline, "cyclic_u", text="U") - - else: - col = split.column() - col.itemL(text="Cyclic:") - if act_spline.type == 'NURBS': - col.itemL(text="Bezier:") - col.itemL(text="Endpoint:") - col.itemL(text="Order:") - - col.itemL(text="Resolution:") - - col = split.column() - col.itemR(act_spline, "cyclic_u", text="U") - - if act_spline.type == 'NURBS': - sub = col.column() - # sub.active = (not act_spline.cyclic_u) - sub.itemR(act_spline, "bezier_u", text="U") - sub.itemR(act_spline, "endpoint_u", text="U") - - sub = col.column() - sub.itemR(act_spline, "order_u", text="U") - col.itemR(act_spline, "resolution_u", text="U") - - if is_surf: - col = split.column() - col.itemR(act_spline, "cyclic_v", text="V") - - # its a surface, assume its a nurb. - sub = col.column() - sub.active = (not act_spline.cyclic_v) - sub.itemR(act_spline, "bezier_v", text="V") - sub.itemR(act_spline, "endpoint_v", text="V") - sub = col.column() - sub.itemR(act_spline, "order_v", text="V") - sub.itemR(act_spline, "resolution_v", text="V") + def draw(self, context): + layout = self.layout - - if not is_surf: - split = layout.split() - col = split.column() - col.active = (curve.dimensions=='3D') - - col.itemL(text="Interpolation:") - col.itemR(act_spline, "tilt_interpolation", text="Tilt") - col.itemR(act_spline, "radius_interpolation", text="Radius") - - split = layout.split() - col = split.column() - col.itemR(act_spline, "smooth") + ob = context.object + curve = context.curve + act_spline = curve.active_spline + is_surf = (ob.type == 'SURFACE') + is_poly = (act_spline.type == 'POLY') + + split = layout.split() + + if is_poly: + # These settings are below but its easier to have + # poly's set aside since they use so few settings + col = split.column() + col.itemL(text="Cyclic:") + col.itemR(act_spline, "smooth") + col = split.column() + col.itemR(act_spline, "cyclic_u", text="U") + + else: + col = split.column() + col.itemL(text="Cyclic:") + if act_spline.type == 'NURBS': + col.itemL(text="Bezier:") + col.itemL(text="Endpoint:") + col.itemL(text="Order:") + + col.itemL(text="Resolution:") + + col = split.column() + col.itemR(act_spline, "cyclic_u", text="U") + + if act_spline.type == 'NURBS': + sub = col.column() + # sub.active = (not act_spline.cyclic_u) + sub.itemR(act_spline, "bezier_u", text="U") + sub.itemR(act_spline, "endpoint_u", text="U") + + sub = col.column() + sub.itemR(act_spline, "order_u", text="U") + col.itemR(act_spline, "resolution_u", text="U") + + if is_surf: + col = split.column() + col.itemR(act_spline, "cyclic_v", text="V") + + # its a surface, assume its a nurb. + sub = col.column() + sub.active = (not act_spline.cyclic_v) + sub.itemR(act_spline, "bezier_v", text="V") + sub.itemR(act_spline, "endpoint_v", text="V") + sub = col.column() + sub.itemR(act_spline, "order_v", text="V") + sub.itemR(act_spline, "resolution_v", text="V") + + + if not is_surf: + split = layout.split() + col = split.column() + col.active = (curve.dimensions=='3D') + + col.itemL(text="Interpolation:") + col.itemR(act_spline, "tilt_interpolation", text="Tilt") + col.itemR(act_spline, "radius_interpolation", text="Radius") + + split = layout.split() + col = split.column() + col.itemR(act_spline, "smooth") bpy.types.register(DATA_PT_context_curve) bpy.types.register(DATA_PT_shape_curve) diff --git a/release/scripts/ui/buttons_data_empty.py b/release/scripts/ui/buttons_data_empty.py index 652f470a605..5fe864ee7a2 100644 --- a/release/scripts/ui/buttons_data_empty.py +++ b/release/scripts/ui/buttons_data_empty.py @@ -2,22 +2,22 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - def poll(self, context): - return (context.object and context.object.type == 'EMPTY') - + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return (context.object and context.object.type == 'EMPTY') + class DATA_PT_empty(DataButtonsPanel): - bl_label = "Empty" + bl_label = "Empty" - def draw(self, context): - layout = self.layout - - ob = context.object + def draw(self, context): + layout = self.layout + + ob = context.object + + layout.itemR(ob, "empty_draw_type", text="Display") + layout.itemR(ob, "empty_draw_size", text="Size") - layout.itemR(ob, "empty_draw_type", text="Display") - layout.itemR(ob, "empty_draw_size", text="Size") - bpy.types.register(DATA_PT_empty) diff --git a/release/scripts/ui/buttons_data_lamp.py b/release/scripts/ui/buttons_data_lamp.py index 0d384701029..c7c25bfd090 100644 --- a/release/scripts/ui/buttons_data_lamp.py +++ b/release/scripts/ui/buttons_data_lamp.py @@ -2,306 +2,306 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - def poll(self, context): - return context.lamp - + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return context.lamp + class DATA_PT_preview(DataButtonsPanel): - bl_label = "Preview" + bl_label = "Preview" + + def draw(self, context): + self.layout.template_preview(context.lamp) - def draw(self, context): - self.layout.template_preview(context.lamp) - class DATA_PT_context_lamp(DataButtonsPanel): - bl_label = "" - bl_show_header = False - - def draw(self, context): - layout = self.layout - - ob = context.object - lamp = context.lamp - space = context.space_data + bl_label = "" + bl_show_header = False - split = layout.split(percentage=0.65) + def draw(self, context): + layout = self.layout - if ob: - split.template_ID(ob, "data") - split.itemS() - elif lamp: - split.template_ID(space, "pin_id") - split.itemS() + ob = context.object + lamp = context.lamp + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif lamp: + split.template_ID(space, "pin_id") + split.itemS() class DATA_PT_lamp(DataButtonsPanel): - bl_label = "Lamp" + bl_label = "Lamp" - def draw(self, context): - layout = self.layout - - lamp = context.lamp - - layout.itemR(lamp, "type", expand=True) - - split = layout.split() - - col = split.column() - sub = col.column() - sub.itemR(lamp, "color", text="") - sub.itemR(lamp, "energy") + def draw(self, context): + layout = self.layout - if lamp.type in ('POINT', 'SPOT'): - sub.itemL(text="Falloff:") - sub.itemR(lamp, "falloff_type", text="") - sub.itemR(lamp, "distance") + lamp = context.lamp - if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED': - col.itemL(text="Attenuation Factors:") - sub = col.column(align=True) - sub.itemR(lamp, "linear_attenuation", slider=True, text="Linear") - sub.itemR(lamp, "quadratic_attenuation", slider=True, text="Quadratic") - - col.itemR(lamp, "sphere") - - if lamp.type == 'AREA': - col.itemR(lamp, "distance") - col.itemR(lamp, "gamma") - - col = split.column() - col.itemR(lamp, "negative") - col.itemR(lamp, "layer", text="This Layer Only") - col.itemR(lamp, "specular") - col.itemR(lamp, "diffuse") + layout.itemR(lamp, "type", expand=True) + + split = layout.split() + + col = split.column() + sub = col.column() + sub.itemR(lamp, "color", text="") + sub.itemR(lamp, "energy") + + if lamp.type in ('POINT', 'SPOT'): + sub.itemL(text="Falloff:") + sub.itemR(lamp, "falloff_type", text="") + sub.itemR(lamp, "distance") + + if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED': + col.itemL(text="Attenuation Factors:") + sub = col.column(align=True) + sub.itemR(lamp, "linear_attenuation", slider=True, text="Linear") + sub.itemR(lamp, "quadratic_attenuation", slider=True, text="Quadratic") + + col.itemR(lamp, "sphere") + + if lamp.type == 'AREA': + col.itemR(lamp, "distance") + col.itemR(lamp, "gamma") + + col = split.column() + col.itemR(lamp, "negative") + col.itemR(lamp, "layer", text="This Layer Only") + col.itemR(lamp, "specular") + col.itemR(lamp, "diffuse") class DATA_PT_sunsky(DataButtonsPanel): - bl_label = "Sky & Atmosphere" - - def poll(self, context): - lamp = context.lamp - return (lamp and lamp.type == 'SUN') + bl_label = "Sky & Atmosphere" - def draw(self, context): - layout = self.layout - - lamp = context.lamp.sky + def poll(self, context): + lamp = context.lamp + return (lamp and lamp.type == 'SUN') - layout.itemR(lamp, "sky") + def draw(self, context): + layout = self.layout + + lamp = context.lamp.sky + + layout.itemR(lamp, "sky") + + row = layout.row() + row.active = lamp.sky or lamp.atmosphere + row.itemR(lamp, "atmosphere_turbidity", text="Turbidity") + + split = layout.split() + + col = split.column() + col.active = lamp.sky + col.itemL(text="Blending:") + sub = col.column() + sub.itemR(lamp, "sky_blend_type", text="") + sub.itemR(lamp, "sky_blend", text="Factor") + + col.itemL(text="Color Space:") + sub = col.column() + sub.row().itemR(lamp, "sky_color_space", expand=True) + sub.itemR(lamp, "sky_exposure", text="Exposure") + + col = split.column() + col.active = lamp.sky + col.itemL(text="Horizon:") + sub = col.column() + sub.itemR(lamp, "horizon_brightness", text="Brightness") + sub.itemR(lamp, "spread", text="Spread") + + col.itemL(text="Sun:") + sub = col.column() + sub.itemR(lamp, "sun_brightness", text="Brightness") + sub.itemR(lamp, "sun_size", text="Size") + sub.itemR(lamp, "backscattered_light", slider=True,text="Back Light") + + layout.itemS() + + layout.itemR(lamp, "atmosphere") + + split = layout.split() + + col = split.column() + col.active = lamp.atmosphere + col.itemL(text="Intensity:") + col.itemR(lamp, "sun_intensity", text="Sun") + col.itemR(lamp, "atmosphere_distance_factor", text="Distance") + + col = split.column() + col.active = lamp.atmosphere + col.itemL(text="Scattering:") + sub = col.column(align=True) + sub.itemR(lamp, "atmosphere_inscattering", slider=True, text="Inscattering") + sub.itemR(lamp, "atmosphere_extinction", slider=True ,text="Extinction") - row = layout.row() - row.active = lamp.sky or lamp.atmosphere - row.itemR(lamp, "atmosphere_turbidity", text="Turbidity") - - split = layout.split() - - col = split.column() - col.active = lamp.sky - col.itemL(text="Blending:") - sub = col.column() - sub.itemR(lamp, "sky_blend_type", text="") - sub.itemR(lamp, "sky_blend", text="Factor") - - col.itemL(text="Color Space:") - sub = col.column() - sub.row().itemR(lamp, "sky_color_space", expand=True) - sub.itemR(lamp, "sky_exposure", text="Exposure") - - col = split.column() - col.active = lamp.sky - col.itemL(text="Horizon:") - sub = col.column() - sub.itemR(lamp, "horizon_brightness", text="Brightness") - sub.itemR(lamp, "spread", text="Spread") - - col.itemL(text="Sun:") - sub = col.column() - sub.itemR(lamp, "sun_brightness", text="Brightness") - sub.itemR(lamp, "sun_size", text="Size") - sub.itemR(lamp, "backscattered_light", slider=True,text="Back Light") - - layout.itemS() - - layout.itemR(lamp, "atmosphere") - - split = layout.split() - - col = split.column() - col.active = lamp.atmosphere - col.itemL(text="Intensity:") - col.itemR(lamp, "sun_intensity", text="Sun") - col.itemR(lamp, "atmosphere_distance_factor", text="Distance") - - col = split.column() - col.active = lamp.atmosphere - col.itemL(text="Scattering:") - sub = col.column(align=True) - sub.itemR(lamp, "atmosphere_inscattering", slider=True, text="Inscattering") - sub.itemR(lamp, "atmosphere_extinction", slider=True ,text="Extinction") - class DATA_PT_shadow(DataButtonsPanel): - bl_label = "Shadow" - - def poll(self, context): - lamp = context.lamp - return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA')) + bl_label = "Shadow" - def draw(self, context): - layout = self.layout - - lamp = context.lamp + def poll(self, context): + lamp = context.lamp + return (lamp and lamp.type in ('POINT','SUN', 'SPOT', 'AREA')) - layout.itemR(lamp, "shadow_method", expand=True) - - if lamp.shadow_method != 'NOSHADOW': - split = layout.split() - - col = split.column() - col.itemR(lamp, "shadow_color", text="") - - col = split.column() - col.itemR(lamp, "shadow_layer", text="This Layer Only") - col.itemR(lamp, "only_shadow") - - if lamp.shadow_method == 'RAY_SHADOW': - col = layout.column() - col.itemL(text="Sampling:") - col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True) - - if lamp.type in ('POINT', 'SUN', 'SPOT'): - split = layout.split() - - col = split.column() - col.itemR(lamp, "shadow_soft_size", text="Soft Size") - - col.itemR(lamp, "shadow_ray_samples", text="Samples") - if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC': - col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold") - col = split.column() - - elif lamp.type == 'AREA': - split = layout.split() - - col = split.column() - sub = split.column(align=True) - if lamp.shape == 'SQUARE': - col.itemR(lamp, "shadow_ray_samples_x", text="Samples") - elif lamp.shape == 'RECTANGLE': - col.itemR(lamp, "shadow_ray_samples_x", text="Samples X") - col.itemR(lamp, "shadow_ray_samples_y", text="Samples Y") - - if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC': - col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold") - - elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED': - sub.itemR(lamp, "umbra") - sub.itemR(lamp, "dither") - sub.itemR(lamp, "jitter") + def draw(self, context): + layout = self.layout - elif lamp.shadow_method == 'BUFFER_SHADOW': - col = layout.column() - col.itemL(text="Buffer Type:") - col.row().itemR(lamp, "shadow_buffer_type", expand=True) + lamp = context.lamp - if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY', 'DEEP'): - split = layout.split() - - col = split.column() - col.itemL(text="Filter Type:") - col.itemR(lamp, "shadow_filter_type", text="") - sub = col.column(align=True) - sub.itemR(lamp, "shadow_buffer_soft", text="Soft") - sub.itemR(lamp, "shadow_buffer_bias", text="Bias") - - col = split.column() - col.itemL(text="Sample Buffers:") - col.itemR(lamp, "shadow_sample_buffers", text="") - sub = col.column(align=True) - sub.itemR(lamp, "shadow_buffer_size", text="Size") - sub.itemR(lamp, "shadow_buffer_samples", text="Samples") - if lamp.shadow_buffer_type == 'DEEP': - col.itemR(lamp, "compression_threshold") - - elif lamp.shadow_buffer_type == 'IRREGULAR': - layout.itemR(lamp, "shadow_buffer_bias", text="Bias") - - row = layout.row() - row.itemR(lamp, "auto_clip_start", text="Autoclip Start") - sub = row.row() - sub.active = not lamp.auto_clip_start - sub.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start") + layout.itemR(lamp, "shadow_method", expand=True) - row = layout.row() - row.itemR(lamp, "auto_clip_end", text="Autoclip End") - sub = row.row() - sub.active = not lamp.auto_clip_end - sub.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End") + if lamp.shadow_method != 'NOSHADOW': + split = layout.split() + + col = split.column() + col.itemR(lamp, "shadow_color", text="") + + col = split.column() + col.itemR(lamp, "shadow_layer", text="This Layer Only") + col.itemR(lamp, "only_shadow") + + if lamp.shadow_method == 'RAY_SHADOW': + col = layout.column() + col.itemL(text="Sampling:") + col.row().itemR(lamp, "shadow_ray_sampling_method", expand=True) + + if lamp.type in ('POINT', 'SUN', 'SPOT'): + split = layout.split() + + col = split.column() + col.itemR(lamp, "shadow_soft_size", text="Soft Size") + + col.itemR(lamp, "shadow_ray_samples", text="Samples") + if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC': + col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold") + col = split.column() + + elif lamp.type == 'AREA': + split = layout.split() + + col = split.column() + sub = split.column(align=True) + if lamp.shape == 'SQUARE': + col.itemR(lamp, "shadow_ray_samples_x", text="Samples") + elif lamp.shape == 'RECTANGLE': + col.itemR(lamp, "shadow_ray_samples_x", text="Samples X") + col.itemR(lamp, "shadow_ray_samples_y", text="Samples Y") + + if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC': + col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold") + + elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED': + sub.itemR(lamp, "umbra") + sub.itemR(lamp, "dither") + sub.itemR(lamp, "jitter") + + elif lamp.shadow_method == 'BUFFER_SHADOW': + col = layout.column() + col.itemL(text="Buffer Type:") + col.row().itemR(lamp, "shadow_buffer_type", expand=True) + + if lamp.shadow_buffer_type in ('REGULAR', 'HALFWAY', 'DEEP'): + split = layout.split() + + col = split.column() + col.itemL(text="Filter Type:") + col.itemR(lamp, "shadow_filter_type", text="") + sub = col.column(align=True) + sub.itemR(lamp, "shadow_buffer_soft", text="Soft") + sub.itemR(lamp, "shadow_buffer_bias", text="Bias") + + col = split.column() + col.itemL(text="Sample Buffers:") + col.itemR(lamp, "shadow_sample_buffers", text="") + sub = col.column(align=True) + sub.itemR(lamp, "shadow_buffer_size", text="Size") + sub.itemR(lamp, "shadow_buffer_samples", text="Samples") + if lamp.shadow_buffer_type == 'DEEP': + col.itemR(lamp, "compression_threshold") + + elif lamp.shadow_buffer_type == 'IRREGULAR': + layout.itemR(lamp, "shadow_buffer_bias", text="Bias") + + row = layout.row() + row.itemR(lamp, "auto_clip_start", text="Autoclip Start") + sub = row.row() + sub.active = not lamp.auto_clip_start + sub.itemR(lamp, "shadow_buffer_clip_start", text="Clip Start") + + row = layout.row() + row.itemR(lamp, "auto_clip_end", text="Autoclip End") + sub = row.row() + sub.active = not lamp.auto_clip_end + sub.itemR(lamp, "shadow_buffer_clip_end", text=" Clip End") class DATA_PT_area(DataButtonsPanel): - bl_label = "Area Shape" - - def poll(self, context): - lamp = context.lamp - return (lamp and lamp.type == 'AREA') + bl_label = "Area Shape" - def draw(self, context): - layout = self.layout - - lamp = context.lamp + def poll(self, context): + lamp = context.lamp + return (lamp and lamp.type == 'AREA') - split = layout.split() - - col = split.column() - col.row().itemR(lamp, "shape", expand=True) - - sub = col.column(align=True) - if (lamp.shape == 'SQUARE'): - sub.itemR(lamp, "size") - elif (lamp.shape == 'RECTANGLE'): - sub.itemR(lamp, "size", text="Size X") - sub.itemR(lamp, "size_y", text="Size Y") + def draw(self, context): + layout = self.layout + + lamp = context.lamp + + split = layout.split() + + col = split.column() + col.row().itemR(lamp, "shape", expand=True) + + sub = col.column(align=True) + if (lamp.shape == 'SQUARE'): + sub.itemR(lamp, "size") + elif (lamp.shape == 'RECTANGLE'): + sub.itemR(lamp, "size", text="Size X") + sub.itemR(lamp, "size_y", text="Size Y") class DATA_PT_spot(DataButtonsPanel): - bl_label = "Spot Shape" - - def poll(self, context): - lamp = context.lamp - return (lamp and lamp.type == 'SPOT') + bl_label = "Spot Shape" - def draw(self, context): - layout = self.layout - - lamp = context.lamp + def poll(self, context): + lamp = context.lamp + return (lamp and lamp.type == 'SPOT') - split = layout.split() - - col = split.column() - sub = col.column() - sub.itemR(lamp, "spot_size", text="Size") - sub.itemR(lamp, "spot_blend", text="Blend", slider=True) - col.itemR(lamp, "square") - - col = split.column() - col.itemR(lamp, "halo") - sub = col.column(align=True) - sub.active = lamp.halo - sub.itemR(lamp, "halo_intensity", text="Intensity") - if lamp.shadow_method == 'BUFFER_SHADOW': - sub.itemR(lamp, "halo_step", text="Step") + def draw(self, context): + layout = self.layout + + lamp = context.lamp + + split = layout.split() + + col = split.column() + sub = col.column() + sub.itemR(lamp, "spot_size", text="Size") + sub.itemR(lamp, "spot_blend", text="Blend", slider=True) + col.itemR(lamp, "square") + + col = split.column() + col.itemR(lamp, "halo") + sub = col.column(align=True) + sub.active = lamp.halo + sub.itemR(lamp, "halo_intensity", text="Intensity") + if lamp.shadow_method == 'BUFFER_SHADOW': + sub.itemR(lamp, "halo_step", text="Step") class DATA_PT_falloff_curve(DataButtonsPanel): - bl_label = "Falloff Curve" - bl_default_closed = True - - def poll(self, context): - lamp = context.lamp + bl_label = "Falloff Curve" + bl_default_closed = True - return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') + def poll(self, context): + lamp = context.lamp - def draw(self, context): - lamp = context.lamp + return (lamp and lamp.type in ('POINT', 'SPOT') and lamp.falloff_type == 'CUSTOM_CURVE') - self.layout.template_curve_mapping(lamp, "falloff_curve") + def draw(self, context): + lamp = context.lamp + + self.layout.template_curve_mapping(lamp, "falloff_curve") bpy.types.register(DATA_PT_context_lamp) bpy.types.register(DATA_PT_preview) diff --git a/release/scripts/ui/buttons_data_lattice.py b/release/scripts/ui/buttons_data_lattice.py index 505ea6e42e9..fa3451ce5e6 100644 --- a/release/scripts/ui/buttons_data_lattice.py +++ b/release/scripts/ui/buttons_data_lattice.py @@ -2,56 +2,56 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - def poll(self, context): - return context.lattice - + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return context.lattice + class DATA_PT_context_lattice(DataButtonsPanel): - bl_label = "" - bl_show_header = False - - def draw(self, context): - layout = self.layout - - ob = context.object - lat = context.lattice - space = context.space_data + bl_label = "" + bl_show_header = False - split = layout.split(percentage=0.65) + def draw(self, context): + layout = self.layout - if ob: - split.template_ID(ob, "data") - split.itemS() - elif lat: - split.template_ID(space, "pin_id") - split.itemS() + ob = context.object + lat = context.lattice + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif lat: + split.template_ID(space, "pin_id") + split.itemS() class DATA_PT_lattice(DataButtonsPanel): - bl_label = "Lattice" + bl_label = "Lattice" - def draw(self, context): - layout = self.layout - - lat = context.lattice + def draw(self, context): + layout = self.layout - row = layout.row() - row.itemR(lat, "points_u") - row.itemR(lat, "interpolation_type_u", expand=True) - - row = layout.row() - row.itemR(lat, "points_v") - row.itemR(lat, "interpolation_type_v", expand=True) - - row = layout.row() - row.itemR(lat, "points_w") - row.itemR(lat, "interpolation_type_w", expand=True) - - row = layout.row() - row.itemO("lattice.make_regular") - row.itemR(lat, "outside") + lat = context.lattice + + row = layout.row() + row.itemR(lat, "points_u") + row.itemR(lat, "interpolation_type_u", expand=True) + + row = layout.row() + row.itemR(lat, "points_v") + row.itemR(lat, "interpolation_type_v", expand=True) + + row = layout.row() + row.itemR(lat, "points_w") + row.itemR(lat, "interpolation_type_w", expand=True) + + row = layout.row() + row.itemO("lattice.make_regular") + row.itemR(lat, "outside") bpy.types.register(DATA_PT_context_lattice) bpy.types.register(DATA_PT_lattice) diff --git a/release/scripts/ui/buttons_data_mesh.py b/release/scripts/ui/buttons_data_mesh.py index 2ed52206d7e..c9141a59bf4 100644 --- a/release/scripts/ui/buttons_data_mesh.py +++ b/release/scripts/ui/buttons_data_mesh.py @@ -2,236 +2,236 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - def poll(self, context): - return context.mesh + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return context.mesh class DATA_PT_context_mesh(DataButtonsPanel): - bl_label = "" - bl_show_header = False - - def draw(self, context): - layout = self.layout - - ob = context.object - mesh = context.mesh - space = context.space_data + bl_label = "" + bl_show_header = False - split = layout.split(percentage=0.65) + def draw(self, context): + layout = self.layout - if ob: - split.template_ID(ob, "data") - split.itemS() - elif mesh: - split.template_ID(space, "pin_id") - split.itemS() + ob = context.object + mesh = context.mesh + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif mesh: + split.template_ID(space, "pin_id") + split.itemS() class DATA_PT_normals(DataButtonsPanel): - bl_label = "Normals" + bl_label = "Normals" - def draw(self, context): - layout = self.layout - - mesh = context.mesh - - split = layout.split() - - col = split.column() - col.itemR(mesh, "autosmooth") - sub = col.column() - sub.active = mesh.autosmooth - sub.itemR(mesh, "autosmooth_angle", text="Angle") - - col = split.column() - col.itemR(mesh, "vertex_normal_flip") - col.itemR(mesh, "double_sided") + def draw(self, context): + layout = self.layout + + mesh = context.mesh + + split = layout.split() + + col = split.column() + col.itemR(mesh, "autosmooth") + sub = col.column() + sub.active = mesh.autosmooth + sub.itemR(mesh, "autosmooth_angle", text="Angle") + + col = split.column() + col.itemR(mesh, "vertex_normal_flip") + col.itemR(mesh, "double_sided") class DATA_PT_settings(DataButtonsPanel): - bl_label = "Settings" + bl_label = "Settings" - def draw(self, context): - layout = self.layout - - mesh = context.mesh - - split = layout.split() - - col = split.column() - col.itemR(mesh, "texture_mesh") + def draw(self, context): + layout = self.layout + + mesh = context.mesh + + split = layout.split() + + col = split.column() + col.itemR(mesh, "texture_mesh") class DATA_PT_vertex_groups(DataButtonsPanel): - bl_label = "Vertex Groups" - - def poll(self, context): - return (context.object and context.object.type in ('MESH', 'LATTICE')) + bl_label = "Vertex Groups" - def draw(self, context): - layout = self.layout - - ob = context.object - group = ob.active_vertex_group + def poll(self, context): + return (context.object and context.object.type in ('MESH', 'LATTICE')) - rows = 2 - if group: - rows= 5 + def draw(self, context): + layout = self.layout - row = layout.row() - row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index", rows=rows) + ob = context.object + group = ob.active_vertex_group - col = row.column(align=True) - col.itemO("object.vertex_group_add", icon='ICON_ZOOMIN', text="") - col.itemO("object.vertex_group_remove", icon='ICON_ZOOMOUT', text="") + rows = 2 + if group: + rows= 5 - col.itemO("object.vertex_group_copy", icon='ICON_COPY_ID', text="") - if ob.data.users > 1: - col.itemO("object.vertex_group_copy_to_linked", icon='ICON_LINK_AREA', text="") + row = layout.row() + row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index", rows=rows) - if group: - row = layout.row() - row.itemR(group, "name") + col = row.column(align=True) + col.itemO("object.vertex_group_add", icon='ICON_ZOOMIN', text="") + col.itemO("object.vertex_group_remove", icon='ICON_ZOOMOUT', text="") - if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0: - row = layout.row() - - sub = row.row(align=True) - sub.itemO("object.vertex_group_assign", text="Assign") - sub.itemO("object.vertex_group_remove_from", text="Remove") - - sub = row.row(align=True) - sub.itemO("object.vertex_group_select", text="Select") - sub.itemO("object.vertex_group_deselect", text="Deselect") + col.itemO("object.vertex_group_copy", icon='ICON_COPY_ID', text="") + if ob.data.users > 1: + col.itemO("object.vertex_group_copy_to_linked", icon='ICON_LINK_AREA', text="") - layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight") + if group: + row = layout.row() + row.itemR(group, "name") + + if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0: + row = layout.row() + + sub = row.row(align=True) + sub.itemO("object.vertex_group_assign", text="Assign") + sub.itemO("object.vertex_group_remove_from", text="Remove") + + sub = row.row(align=True) + sub.itemO("object.vertex_group_select", text="Select") + sub.itemO("object.vertex_group_deselect", text="Deselect") + + layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight") class DATA_PT_shape_keys(DataButtonsPanel): - bl_label = "Shape Keys" - - def poll(self, context): - return (context.object and context.object.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE')) + bl_label = "Shape Keys" - def draw(self, context): - layout = self.layout - - ob = context.object - key = ob.data.shape_keys - kb = ob.active_shape_key + def poll(self, context): + return (context.object and context.object.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE')) - enable_edit = ob.mode != 'EDIT' - enable_edit_value = False + def draw(self, context): + layout = self.layout - if ob.shape_key_lock == False: - if enable_edit or (ob.type == 'MESH' and ob.shape_key_edit_mode): - enable_edit_value = True + ob = context.object + key = ob.data.shape_keys + kb = ob.active_shape_key - row = layout.row() + enable_edit = ob.mode != 'EDIT' + enable_edit_value = False - rows = 2 - if kb: - rows= 5 - row.template_list(key, "keys", ob, "active_shape_key_index", rows=rows) + if ob.shape_key_lock == False: + if enable_edit or (ob.type == 'MESH' and ob.shape_key_edit_mode): + enable_edit_value = True - col = row.column() + row = layout.row() - subcol = col.column(align=True) - subcol.itemO("object.shape_key_add", icon='ICON_ZOOMIN', text="") - subcol.itemO("object.shape_key_remove", icon='ICON_ZOOMOUT', text="") + rows = 2 + if kb: + rows= 5 + row.template_list(key, "keys", ob, "active_shape_key_index", rows=rows) - if kb: - col.itemS() + col = row.column() - subcol = col.column(align=True) - subcol.item_enumO("object.shape_key_move", "type", 'UP', icon='ICON_TRIA_UP', text="") - subcol.item_enumO("object.shape_key_move", "type", 'DOWN', icon='ICON_TRIA_DOWN', text="") + subcol = col.column(align=True) + subcol.itemO("object.shape_key_add", icon='ICON_ZOOMIN', text="") + subcol.itemO("object.shape_key_remove", icon='ICON_ZOOMOUT', text="") - split = layout.split(percentage=0.4) - sub = split.row() - sub.enabled = enable_edit - sub.itemR(key, "relative") + if kb: + col.itemS() - sub = split.row() - sub.alignment = 'RIGHT' + subcol = col.column(align=True) + subcol.item_enumO("object.shape_key_move", "type", 'UP', icon='ICON_TRIA_UP', text="") + subcol.item_enumO("object.shape_key_move", "type", 'DOWN', icon='ICON_TRIA_DOWN', text="") - subrow = sub.row(align=True) - subrow.active= enable_edit_value - subrow.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="") - subrow.itemR(kb, "mute", icon='ICON_MUTE_IPO_OFF', text="") - subrow.itemO("object.shape_key_clear", icon='ICON_X', text="") + split = layout.split(percentage=0.4) + sub = split.row() + sub.enabled = enable_edit + sub.itemR(key, "relative") - sub.itemO("object.shape_key_mirror", icon='ICON_MOD_MIRROR', text="") + sub = split.row() + sub.alignment = 'RIGHT' - sub.itemR(ob, "shape_key_edit_mode", text="") + subrow = sub.row(align=True) + subrow.active= enable_edit_value + subrow.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="") + subrow.itemR(kb, "mute", icon='ICON_MUTE_IPO_OFF', text="") + subrow.itemO("object.shape_key_clear", icon='ICON_X', text="") - row = layout.row() - row.itemR(kb, "name") + sub.itemO("object.shape_key_mirror", icon='ICON_MOD_MIRROR', text="") - if key.relative: - if ob.active_shape_key_index != 0: - row = layout.row() - row.active = enable_edit_value - row.itemR(kb, "value") - - split = layout.split() - sub = split.column(align=True) - sub.active = enable_edit_value - sub.itemL(text="Range:") - sub.itemR(kb, "slider_min", text="Min") - sub.itemR(kb, "slider_max", text="Max") - - sub = split.column(align=True) - sub.active = enable_edit_value - sub.itemL(text="Blend:") - sub.item_pointerR(kb, "vertex_group", ob, "vertex_groups", text="") - sub.item_pointerR(kb, "relative_key", key, "keys", text="") - - else: - row = layout.row() - row.active = enable_edit_value - row.itemR(key, "slurph") + sub.itemR(ob, "shape_key_edit_mode", text="") + + row = layout.row() + row.itemR(kb, "name") + + if key.relative: + if ob.active_shape_key_index != 0: + row = layout.row() + row.active = enable_edit_value + row.itemR(kb, "value") + + split = layout.split() + sub = split.column(align=True) + sub.active = enable_edit_value + sub.itemL(text="Range:") + sub.itemR(kb, "slider_min", text="Min") + sub.itemR(kb, "slider_max", text="Max") + + sub = split.column(align=True) + sub.active = enable_edit_value + sub.itemL(text="Blend:") + sub.item_pointerR(kb, "vertex_group", ob, "vertex_groups", text="") + sub.item_pointerR(kb, "relative_key", key, "keys", text="") + + else: + row = layout.row() + row.active = enable_edit_value + row.itemR(key, "slurph") class DATA_PT_uv_texture(DataButtonsPanel): - bl_label = "UV Texture" - - def draw(self, context): - layout = self.layout - - me = context.mesh + bl_label = "UV Texture" - row = layout.row() - col = row.column() - - col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2) + def draw(self, context): + layout = self.layout - col = row.column(align=True) - col.itemO("mesh.uv_texture_add", icon='ICON_ZOOMIN', text="") - col.itemO("mesh.uv_texture_remove", icon='ICON_ZOOMOUT', text="") + me = context.mesh - lay = me.active_uv_texture - if lay: - layout.itemR(lay, "name") + row = layout.row() + col = row.column() + + col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2) + + col = row.column(align=True) + col.itemO("mesh.uv_texture_add", icon='ICON_ZOOMIN', text="") + col.itemO("mesh.uv_texture_remove", icon='ICON_ZOOMOUT', text="") + + lay = me.active_uv_texture + if lay: + layout.itemR(lay, "name") class DATA_PT_vertex_colors(DataButtonsPanel): - bl_label = "Vertex Colors" - - def draw(self, context): - layout = self.layout - - me = context.mesh + bl_label = "Vertex Colors" - row = layout.row() - col = row.column() + def draw(self, context): + layout = self.layout - col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2) + me = context.mesh - col = row.column(align=True) - col.itemO("mesh.vertex_color_add", icon='ICON_ZOOMIN', text="") - col.itemO("mesh.vertex_color_remove", icon='ICON_ZOOMOUT', text="") + row = layout.row() + col = row.column() - lay = me.active_vertex_color - if lay: - layout.itemR(lay, "name") + col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2) + + col = row.column(align=True) + col.itemO("mesh.vertex_color_add", icon='ICON_ZOOMIN', text="") + col.itemO("mesh.vertex_color_remove", icon='ICON_ZOOMOUT', text="") + + lay = me.active_vertex_color + if lay: + layout.itemR(lay, "name") bpy.types.register(DATA_PT_context_mesh) bpy.types.register(DATA_PT_normals) diff --git a/release/scripts/ui/buttons_data_metaball.py b/release/scripts/ui/buttons_data_metaball.py index ebb5efb40ca..8176041e1cc 100644 --- a/release/scripts/ui/buttons_data_metaball.py +++ b/release/scripts/ui/buttons_data_metaball.py @@ -1,106 +1,106 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - def poll(self, context): - return context.meta_ball + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return context.meta_ball class DATA_PT_context_metaball(DataButtonsPanel): - bl_label = "" - bl_show_header = False - - def draw(self, context): - layout = self.layout - - ob = context.object - mball = context.meta_ball - space = context.space_data + bl_label = "" + bl_show_header = False - split = layout.split(percentage=0.65) + def draw(self, context): + layout = self.layout - if ob: - split.template_ID(ob, "data") - split.itemS() - elif mball: - split.template_ID(space, "pin_id") - split.itemS() + ob = context.object + mball = context.meta_ball + space = context.space_data + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif mball: + split.template_ID(space, "pin_id") + split.itemS() class DATA_PT_metaball(DataButtonsPanel): - bl_label = "Metaball" + bl_label = "Metaball" - def draw(self, context): - layout = self.layout - - mball = context.meta_ball - - split = layout.split() - - col = split.column() - col.itemL(text="Resolution:") - sub = col.column(align=True) - sub.itemR(mball, "wire_size", text="View") - sub.itemR(mball, "render_size", text="Render") - - col = split.column() - col.itemL(text="Settings:") - col.itemR(mball, "threshold", text="Threshold") + def draw(self, context): + layout = self.layout - layout.itemL(text="Update:") - layout.itemR(mball, "flag", expand=True) + mball = context.meta_ball + + split = layout.split() + + col = split.column() + col.itemL(text="Resolution:") + sub = col.column(align=True) + sub.itemR(mball, "wire_size", text="View") + sub.itemR(mball, "render_size", text="Render") + + col = split.column() + col.itemL(text="Settings:") + col.itemR(mball, "threshold", text="Threshold") + + layout.itemL(text="Update:") + layout.itemR(mball, "flag", expand=True) class DATA_PT_metaball_element(DataButtonsPanel): - bl_label = "Active Element" - - def poll(self, context): - return (context.meta_ball and context.meta_ball.active_element) + bl_label = "Active Element" - def draw(self, context): - layout = self.layout - - metaelem = context.meta_ball.active_element - - split = layout.split(percentage=0.3) - split.itemL(text="Type:") - split.itemR(metaelem, "type", text="") - - split = layout.split() - - col = split.column() - col.itemL(text="Settings:") - col.itemR(metaelem, "stiffness", text="Stiffness") - col.itemR(metaelem, "negative", text="Negative") - col.itemR(metaelem, "hide", text="Hide") - - if metaelem.type == 'BALL': - col = split.column(align=True) - - elif metaelem.type == 'CUBE': - col = split.column(align=True) - col.itemL(text="Size:") - col.itemR(metaelem, "size_x", text="X") - col.itemR(metaelem, "size_y", text="Y") - col.itemR(metaelem, "size_z", text="Z") - - elif metaelem.type == 'TUBE': - col = split.column(align=True) - col.itemL(text="Size:") - col.itemR(metaelem, "size_x", text="X") - - elif metaelem.type == 'PLANE': - col = split.column(align=True) - col.itemL(text="Size:") - col.itemR(metaelem, "size_x", text="X") - col.itemR(metaelem, "size_y", text="Y") - - elif metaelem.type == 'ELLIPSOID': - col = split.column(align=True) - col.itemL(text="Size:") - col.itemR(metaelem, "size_x", text="X") - col.itemR(metaelem, "size_y", text="Y") - col.itemR(metaelem, "size_z", text="Z") + def poll(self, context): + return (context.meta_ball and context.meta_ball.active_element) + + def draw(self, context): + layout = self.layout + + metaelem = context.meta_ball.active_element + + split = layout.split(percentage=0.3) + split.itemL(text="Type:") + split.itemR(metaelem, "type", text="") + + split = layout.split() + + col = split.column() + col.itemL(text="Settings:") + col.itemR(metaelem, "stiffness", text="Stiffness") + col.itemR(metaelem, "negative", text="Negative") + col.itemR(metaelem, "hide", text="Hide") + + if metaelem.type == 'BALL': + col = split.column(align=True) + + elif metaelem.type == 'CUBE': + col = split.column(align=True) + col.itemL(text="Size:") + col.itemR(metaelem, "size_x", text="X") + col.itemR(metaelem, "size_y", text="Y") + col.itemR(metaelem, "size_z", text="Z") + + elif metaelem.type == 'TUBE': + col = split.column(align=True) + col.itemL(text="Size:") + col.itemR(metaelem, "size_x", text="X") + + elif metaelem.type == 'PLANE': + col = split.column(align=True) + col.itemL(text="Size:") + col.itemR(metaelem, "size_x", text="X") + col.itemR(metaelem, "size_y", text="Y") + + elif metaelem.type == 'ELLIPSOID': + col = split.column(align=True) + col.itemL(text="Size:") + col.itemR(metaelem, "size_x", text="X") + col.itemR(metaelem, "size_y", text="Y") + col.itemR(metaelem, "size_z", text="Z") bpy.types.register(DATA_PT_context_metaball) bpy.types.register(DATA_PT_metaball) diff --git a/release/scripts/ui/buttons_data_modifier.py b/release/scripts/ui/buttons_data_modifier.py index 7a49e84e906..a256d20a314 100644 --- a/release/scripts/ui/buttons_data_modifier.py +++ b/release/scripts/ui/buttons_data_modifier.py @@ -2,448 +2,448 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "modifier" - + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "modifier" + class DATA_PT_modifiers(DataButtonsPanel): - bl_label = "Modifiers" + bl_label = "Modifiers" - def draw(self, context): - layout = self.layout - - ob = context.object + def draw(self, context): + layout = self.layout - row = layout.row() - row.item_menu_enumO("object.modifier_add", "type") - row.itemL() + ob = context.object - for md in ob.modifiers: - box = layout.template_modifier(md) - if box: - # match enum type to our functions, avoids a lookup table. - 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. + row = layout.row() + row.item_menu_enumO("object.modifier_add", "type") + row.itemL() - def ARMATURE(self, layout, ob, md): - layout.itemR(md, "object") - - split = layout.split(percentage=0.5) - split.itemL(text="Vertex Group:") - sub = split.split(percentage=0.7) - sub.item_pointerR(md, "vertex_group", ob, "vertex_groups", text="") - subsub = sub.row() - subsub.active = md.vertex_group - subsub.itemR(md, "invert") - - layout.itemS() - - split = layout.split() + for md in ob.modifiers: + box = layout.template_modifier(md) + if box: + # match enum type to our functions, avoids a lookup table. + getattr(self, md.type)(box, ob, md) - col = split.column() - col.itemL(text="Bind To:") - col.itemR(md, "use_vertex_groups", text="Vertex Groups") - col.itemR(md, "use_bone_envelopes", text="Bone Envelopes") - - col = split.column() - col.itemL(text="Deformation:") - col.itemR(md, "quaternion") - col.itemR(md, "multi_modifier") - - def ARRAY(self, layout, ob, md): - layout.itemR(md, "fit_type") - if md.fit_type == 'FIXED_COUNT': - layout.itemR(md, "count") - elif md.fit_type == 'FIT_LENGTH': - layout.itemR(md, "length") - elif md.fit_type == 'FIT_CURVE': - layout.itemR(md, "curve") + # 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. - layout.itemS() - - split = layout.split() - - col = split.column() - col.itemR(md, "constant_offset") - sub = col.column() - sub.active = md.constant_offset - sub.itemR(md, "constant_offset_displacement", text="") + def ARMATURE(self, layout, ob, md): + layout.itemR(md, "object") - col.itemS() + split = layout.split(percentage=0.5) + split.itemL(text="Vertex Group:") + sub = split.split(percentage=0.7) + sub.item_pointerR(md, "vertex_group", ob, "vertex_groups", text="") + subsub = sub.row() + subsub.active = md.vertex_group + subsub.itemR(md, "invert") - col.itemR(md, "merge_adjacent_vertices", text="Merge") - sub = col.column() - sub.active = md.merge_adjacent_vertices - sub.itemR(md, "merge_end_vertices", text="First Last") - sub.itemR(md, "merge_distance", text="Distance") - - col = split.column() - col.itemR(md, "relative_offset") - sub = col.column() - sub.active = md.relative_offset - sub.itemR(md, "relative_offset_displacement", text="") + layout.itemS() - col.itemS() + split = layout.split() - col.itemR(md, "add_offset_object") - sub = col.column() - sub.active = md.add_offset_object - sub.itemR(md, "offset_object", text="") + col = split.column() + col.itemL(text="Bind To:") + col.itemR(md, "use_vertex_groups", text="Vertex Groups") + col.itemR(md, "use_bone_envelopes", text="Bone Envelopes") - layout.itemS() - - col = layout.column() - col.itemR(md, "start_cap") - col.itemR(md, "end_cap") - - def BEVEL(self, layout, ob, md): - row = layout.row() - row.itemR(md, "width") - row.itemR(md, "only_vertices") - - layout.itemL(text="Limit Method:") - layout.row().itemR(md, "limit_method", expand=True) - if md.limit_method == 'ANGLE': - layout.itemR(md, "angle") - elif md.limit_method == 'WEIGHT': - layout.row().itemR(md, "edge_weight_method", expand=True) - - def BOOLEAN(self, layout, ob, md): - layout.itemR(md, "operation") - layout.itemR(md, "object") - - def BUILD(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.itemR(md, "start") - col.itemR(md, "length") + col = split.column() + col.itemL(text="Deformation:") + col.itemR(md, "quaternion") + col.itemR(md, "multi_modifier") - col = split.column() - col.itemR(md, "randomize") - sub = col.column() - sub.active = md.randomize - sub.itemR(md, "seed") + def ARRAY(self, layout, ob, md): + layout.itemR(md, "fit_type") + if md.fit_type == 'FIXED_COUNT': + layout.itemR(md, "count") + elif md.fit_type == 'FIT_LENGTH': + layout.itemR(md, "length") + elif md.fit_type == 'FIT_CURVE': + layout.itemR(md, "curve") - def CAST(self, layout, ob, md): - layout.itemR(md, "cast_type") - layout.itemR(md, "object") - if md.object: - layout.itemR(md, "use_transform") - - flow = layout.column_flow() - flow.itemR(md, "x") - flow.itemR(md, "y") - flow.itemR(md, "z") - flow.itemR(md, "factor") - flow.itemR(md, "radius") - flow.itemR(md, "size") + layout.itemS() - layout.itemR(md, "from_radius") - - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - - def CLOTH(self, layout, ob, md): - layout.itemL(text="See Cloth panel.") - - def COLLISION(self, layout, ob, md): - layout.itemL(text="See Collision panel.") - - def CURVE(self, layout, ob, md): - layout.itemR(md, "object") - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - layout.itemR(md, "deform_axis") - - def DECIMATE(self, layout, ob, md): - layout.itemR(md, "ratio") - layout.itemR(md, "face_count") - - def DISPLACE(self, layout, ob, md): - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - layout.itemR(md, "texture") - layout.itemR(md, "midlevel") - layout.itemR(md, "strength") - layout.itemR(md, "direction") - layout.itemR(md, "texture_coordinates") - if md.texture_coordinates == 'OBJECT': - layout.itemR(md, "texture_coordinate_object", text="Object") - elif md.texture_coordinates == 'UV' and ob.type == 'MESH': - layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures") - - def EDGE_SPLIT(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.itemR(md, "use_edge_angle", text="Edge Angle") - sub = col.column() - sub.active = md.use_edge_angle - sub.itemR(md, "split_angle") - - col = split.column() - col.itemR(md, "use_sharp", text="Sharp Edges") - - def EXPLODE(self, layout, ob, md): - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - layout.itemR(md, "protect") + split = layout.split() - flow = layout.column_flow(2) - flow.itemR(md, "split_edges") - flow.itemR(md, "unborn") - flow.itemR(md, "alive") - flow.itemR(md, "dead") + col = split.column() + col.itemR(md, "constant_offset") + sub = col.column() + sub.active = md.constant_offset + sub.itemR(md, "constant_offset_displacement", text="") - layout.itemO("object.explode_refresh", text="Refresh"); - - def FLUID_SIMULATION(self, layout, ob, md): - layout.itemL(text="See Fluid panel.") - - def HOOK(self, layout, ob, md): - col = layout.column() - col.itemR(md, "object") - if md.object and md.object.type == 'ARMATURE': - layout.item_pointerR(md, "subtarget", md.object.data, "bones", text="Bone") - - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + col.itemS() - split = layout.split() - split.itemR(md, "falloff") - split.itemR(md, "force", slider=True) + col.itemR(md, "merge_adjacent_vertices", text="Merge") + sub = col.column() + sub.active = md.merge_adjacent_vertices + sub.itemR(md, "merge_end_vertices", text="First Last") + sub.itemR(md, "merge_distance", text="Distance") - layout.itemS() + col = split.column() + col.itemR(md, "relative_offset") + sub = col.column() + sub.active = md.relative_offset + sub.itemR(md, "relative_offset_displacement", text="") - row = layout.row() - row.itemO("object.hook_reset", text="Reset") - row.itemO("object.hook_recenter", text="Recenter") + col.itemS() - if ob.mode == 'EDIT': - row = layout.row() - row.itemO("object.hook_select", text="Select") - row.itemO("object.hook_assign", text="Assign") - - def LATTICE(self, layout, ob, md): - layout.itemR(md, "object") - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - - def MASK(self, layout, ob, md): - layout.itemR(md, "mode") - if md.mode == 'ARMATURE': - layout.itemR(md, "armature") - elif md.mode == 'VERTEX_GROUP': - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - layout.itemR(md, "inverse") - - def MESH_DEFORM(self, layout, ob, md): - layout.itemR(md, "object") - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - layout.itemR(md, "invert") + col.itemR(md, "add_offset_object") + sub = col.column() + sub.active = md.add_offset_object + sub.itemR(md, "offset_object", text="") - layout.itemS() - - if md.is_bound: - layout.itemO("object.meshdeform_bind", text="Unbind") - else: - layout.itemO("object.meshdeform_bind", text="Bind") - row = layout.row() - row.itemR(md, "precision") - row.itemR(md, "dynamic") - - def MIRROR(self, layout, ob, md): - layout.itemR(md, "merge_limit") - split = layout.split() - - col = split.column() - col.itemR(md, "x") - col.itemR(md, "y") - col.itemR(md, "z") - - col = split.column() - col.itemL(text="Textures:") - col.itemR(md, "mirror_u") - col.itemR(md, "mirror_v") - - col = split.column() - col.itemR(md, "clip", text="Do Clipping") - col.itemR(md, "mirror_vertex_groups", text="Vertex Group") - - layout.itemR(md, "mirror_object") - - def MULTIRES(self, layout, ob, md): - layout.itemR(md, "subdivision_type") - - row = layout.row() - row.itemO("object.multires_subdivide", text="Subdivide") - row.itemO("object.multires_higher_levels_delete", text="Delete Higher") + layout.itemS() - layout.itemR(md, "level") - - def PARTICLE_INSTANCE(self, layout, ob, md): - layout.itemR(md, "object") - layout.itemR(md, "particle_system_number") - - flow = layout.column_flow() - flow.itemR(md, "normal") - flow.itemR(md, "children") - flow.itemR(md, "size") - flow.itemR(md, "path") - if md.path: - flow.itemR(md, "keep_shape") - flow.itemR(md, "unborn") - flow.itemR(md, "alive") - flow.itemR(md, "dead") - flow.itemL(md, "") - if md.path: - flow.itemR(md, "axis", text="") - - if md.path: - row = layout.row() - row.itemR(md, "position", slider=True) - row.itemR(md, "random_position", text = "Random", slider=True) - - def PARTICLE_SYSTEM(self, layout, ob, md): - layout.itemL(text="See Particle panel.") - - def SHRINKWRAP(self, layout, ob, md): - layout.itemR(md, "target") - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - layout.itemR(md, "offset") - layout.itemR(md, "subsurf_levels") - layout.itemR(md, "mode") - if md.mode == 'PROJECT': - layout.itemR(md, "subsurf_levels") - layout.itemR(md, "auxiliary_target") - - row = layout.row() - row.itemR(md, "x") - row.itemR(md, "y") - row.itemR(md, "z") - - flow = layout.column_flow() - flow.itemR(md, "negative") - flow.itemR(md, "positive") - flow.itemR(md, "cull_front_faces") - flow.itemR(md, "cull_back_faces") - elif md.mode == 'NEAREST_SURFACEPOINT': - layout.itemR(md, "keep_above_surface") - - def SIMPLE_DEFORM(self, layout, ob, md): - layout.itemR(md, "mode") - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - layout.itemR(md, "origin") - layout.itemR(md, "relative") - layout.itemR(md, "factor") - layout.itemR(md, "limits") - if md.mode in ('TAPER', 'STRETCH'): - layout.itemR(md, "lock_x_axis") - layout.itemR(md, "lock_y_axis") - - def SMOKE(self, layout, ob, md): - layout.itemL(text="See Smoke panel.") - - def SMOOTH(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.itemR(md, "x") - col.itemR(md, "y") - col.itemR(md, "z") - - col = split.column() - col.itemR(md, "factor") - col.itemR(md, "repeat") - - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - - def SOFT_BODY(self, layout, ob, md): - layout.itemL(text="See Soft Body panel.") - - def SUBSURF(self, layout, ob, md): - layout.row().itemR(md, "subdivision_type", expand=True) - - flow = layout.column_flow() - flow.itemR(md, "levels", text="Preview") - flow.itemR(md, "render_levels", text="Render") - flow.itemR(md, "optimal_draw", text="Optimal Display") - flow.itemR(md, "subsurf_uv") + col = layout.column() + col.itemR(md, "start_cap") + col.itemR(md, "end_cap") - def SURFACE(self, layout, ob, md): - layout.itemL(text="See Fields panel.") - - def UV_PROJECT(self, layout, ob, md): - if ob.type == 'MESH': - layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures") - layout.itemR(md, "image") - layout.itemR(md, "override_image") + def BEVEL(self, layout, ob, md): + row = layout.row() + row.itemR(md, "width") + row.itemR(md, "only_vertices") - split = layout.split() + layout.itemL(text="Limit Method:") + layout.row().itemR(md, "limit_method", expand=True) + if md.limit_method == 'ANGLE': + layout.itemR(md, "angle") + elif md.limit_method == 'WEIGHT': + layout.row().itemR(md, "edge_weight_method", expand=True) - col = split.column() - col.itemL(text="Aspect Ratio:") + def BOOLEAN(self, layout, ob, md): + layout.itemR(md, "operation") + layout.itemR(md, "object") - sub = col.column(align=True) - sub.itemR(md, "horizontal_aspect_ratio", text="Horizontal") - sub.itemR(md, "vertical_aspect_ratio", text="Vertical") + def BUILD(self, layout, ob, md): + split = layout.split() - col = split.column() - col.itemL(text="Projectors:") + col = split.column() + col.itemR(md, "start") + col.itemR(md, "length") - sub = col.column(align=True) - sub.itemR(md, "num_projectors", text="Number") - for proj in md.projectors: - sub.itemR(proj, "object", text="") - - def WAVE(self, layout, ob, md): - split = layout.split() - - col = split.column() - col.itemL(text="Motion:") - col.itemR(md, "x") - col.itemR(md, "y") - col.itemR(md, "cyclic") - - col = split.column() - col.itemR(md, "normals") - sub = col.column() - sub.active = md.normals - sub.itemR(md, "x_normal", text="X") - sub.itemR(md, "y_normal", text="Y") - sub.itemR(md, "z_normal", text="Z") - - split = layout.split() + col = split.column() + col.itemR(md, "randomize") + sub = col.column() + sub.active = md.randomize + sub.itemR(md, "seed") - col = split.column() - col.itemL(text="Time:") - sub = col.column(align=True) - sub.itemR(md, "time_offset", text="Offset") - sub.itemR(md, "lifetime", text="Life") - col.itemR(md, "damping_time", text="Damping") - - col = split.column() - col.itemL(text="Position:") - sub = col.column(align=True) - sub.itemR(md, "start_position_x", text="X") - sub.itemR(md, "start_position_y", text="Y") - col.itemR(md, "falloff_radius", text="Falloff") - - layout.itemS() - - layout.itemR(md, "start_position_object") - layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") - layout.itemR(md, "texture") - layout.itemR(md, "texture_coordinates") - if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH': - layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures") - elif md.texture_coordinates == 'OBJECT': - layout.itemR(md, "texture_coordinates_object") - - layout.itemS() - - flow = layout.column_flow() - flow.itemR(md, "speed", slider=True) - flow.itemR(md, "height", slider=True) - flow.itemR(md, "width", slider=True) - flow.itemR(md, "narrowness", slider=True) + def CAST(self, layout, ob, md): + layout.itemR(md, "cast_type") + layout.itemR(md, "object") + if md.object: + layout.itemR(md, "use_transform") + + flow = layout.column_flow() + flow.itemR(md, "x") + flow.itemR(md, "y") + flow.itemR(md, "z") + flow.itemR(md, "factor") + flow.itemR(md, "radius") + flow.itemR(md, "size") + + layout.itemR(md, "from_radius") + + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + + def CLOTH(self, layout, ob, md): + layout.itemL(text="See Cloth panel.") + + def COLLISION(self, layout, ob, md): + layout.itemL(text="See Collision panel.") + + def CURVE(self, layout, ob, md): + layout.itemR(md, "object") + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + layout.itemR(md, "deform_axis") + + def DECIMATE(self, layout, ob, md): + layout.itemR(md, "ratio") + layout.itemR(md, "face_count") + + def DISPLACE(self, layout, ob, md): + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + layout.itemR(md, "texture") + layout.itemR(md, "midlevel") + layout.itemR(md, "strength") + layout.itemR(md, "direction") + layout.itemR(md, "texture_coordinates") + if md.texture_coordinates == 'OBJECT': + layout.itemR(md, "texture_coordinate_object", text="Object") + elif md.texture_coordinates == 'UV' and ob.type == 'MESH': + layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures") + + def EDGE_SPLIT(self, layout, ob, md): + split = layout.split() + + col = split.column() + col.itemR(md, "use_edge_angle", text="Edge Angle") + sub = col.column() + sub.active = md.use_edge_angle + sub.itemR(md, "split_angle") + + col = split.column() + col.itemR(md, "use_sharp", text="Sharp Edges") + + def EXPLODE(self, layout, ob, md): + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + layout.itemR(md, "protect") + + flow = layout.column_flow(2) + flow.itemR(md, "split_edges") + flow.itemR(md, "unborn") + flow.itemR(md, "alive") + flow.itemR(md, "dead") + + layout.itemO("object.explode_refresh", text="Refresh"); + + def FLUID_SIMULATION(self, layout, ob, md): + layout.itemL(text="See Fluid panel.") + + def HOOK(self, layout, ob, md): + col = layout.column() + col.itemR(md, "object") + if md.object and md.object.type == 'ARMATURE': + layout.item_pointerR(md, "subtarget", md.object.data, "bones", text="Bone") + + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + + split = layout.split() + split.itemR(md, "falloff") + split.itemR(md, "force", slider=True) + + layout.itemS() + + row = layout.row() + row.itemO("object.hook_reset", text="Reset") + row.itemO("object.hook_recenter", text="Recenter") + + if ob.mode == 'EDIT': + row = layout.row() + row.itemO("object.hook_select", text="Select") + row.itemO("object.hook_assign", text="Assign") + + def LATTICE(self, layout, ob, md): + layout.itemR(md, "object") + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + + def MASK(self, layout, ob, md): + layout.itemR(md, "mode") + if md.mode == 'ARMATURE': + layout.itemR(md, "armature") + elif md.mode == 'VERTEX_GROUP': + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + layout.itemR(md, "inverse") + + def MESH_DEFORM(self, layout, ob, md): + layout.itemR(md, "object") + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + layout.itemR(md, "invert") + + layout.itemS() + + if md.is_bound: + layout.itemO("object.meshdeform_bind", text="Unbind") + else: + layout.itemO("object.meshdeform_bind", text="Bind") + row = layout.row() + row.itemR(md, "precision") + row.itemR(md, "dynamic") + + def MIRROR(self, layout, ob, md): + layout.itemR(md, "merge_limit") + split = layout.split() + + col = split.column() + col.itemR(md, "x") + col.itemR(md, "y") + col.itemR(md, "z") + + col = split.column() + col.itemL(text="Textures:") + col.itemR(md, "mirror_u") + col.itemR(md, "mirror_v") + + col = split.column() + col.itemR(md, "clip", text="Do Clipping") + col.itemR(md, "mirror_vertex_groups", text="Vertex Group") + + layout.itemR(md, "mirror_object") + + def MULTIRES(self, layout, ob, md): + layout.itemR(md, "subdivision_type") + + row = layout.row() + row.itemO("object.multires_subdivide", text="Subdivide") + row.itemO("object.multires_higher_levels_delete", text="Delete Higher") + + layout.itemR(md, "level") + + def PARTICLE_INSTANCE(self, layout, ob, md): + layout.itemR(md, "object") + layout.itemR(md, "particle_system_number") + + flow = layout.column_flow() + flow.itemR(md, "normal") + flow.itemR(md, "children") + flow.itemR(md, "size") + flow.itemR(md, "path") + if md.path: + flow.itemR(md, "keep_shape") + flow.itemR(md, "unborn") + flow.itemR(md, "alive") + flow.itemR(md, "dead") + flow.itemL(md, "") + if md.path: + flow.itemR(md, "axis", text="") + + if md.path: + row = layout.row() + row.itemR(md, "position", slider=True) + row.itemR(md, "random_position", text = "Random", slider=True) + + def PARTICLE_SYSTEM(self, layout, ob, md): + layout.itemL(text="See Particle panel.") + + def SHRINKWRAP(self, layout, ob, md): + layout.itemR(md, "target") + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + layout.itemR(md, "offset") + layout.itemR(md, "subsurf_levels") + layout.itemR(md, "mode") + if md.mode == 'PROJECT': + layout.itemR(md, "subsurf_levels") + layout.itemR(md, "auxiliary_target") + + row = layout.row() + row.itemR(md, "x") + row.itemR(md, "y") + row.itemR(md, "z") + + flow = layout.column_flow() + flow.itemR(md, "negative") + flow.itemR(md, "positive") + flow.itemR(md, "cull_front_faces") + flow.itemR(md, "cull_back_faces") + elif md.mode == 'NEAREST_SURFACEPOINT': + layout.itemR(md, "keep_above_surface") + + def SIMPLE_DEFORM(self, layout, ob, md): + layout.itemR(md, "mode") + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + layout.itemR(md, "origin") + layout.itemR(md, "relative") + layout.itemR(md, "factor") + layout.itemR(md, "limits") + if md.mode in ('TAPER', 'STRETCH'): + layout.itemR(md, "lock_x_axis") + layout.itemR(md, "lock_y_axis") + + def SMOKE(self, layout, ob, md): + layout.itemL(text="See Smoke panel.") + + def SMOOTH(self, layout, ob, md): + split = layout.split() + + col = split.column() + col.itemR(md, "x") + col.itemR(md, "y") + col.itemR(md, "z") + + col = split.column() + col.itemR(md, "factor") + col.itemR(md, "repeat") + + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + + def SOFT_BODY(self, layout, ob, md): + layout.itemL(text="See Soft Body panel.") + + def SUBSURF(self, layout, ob, md): + layout.row().itemR(md, "subdivision_type", expand=True) + + flow = layout.column_flow() + flow.itemR(md, "levels", text="Preview") + flow.itemR(md, "render_levels", text="Render") + flow.itemR(md, "optimal_draw", text="Optimal Display") + flow.itemR(md, "subsurf_uv") + + def SURFACE(self, layout, ob, md): + layout.itemL(text="See Fields panel.") + + def UV_PROJECT(self, layout, ob, md): + if ob.type == 'MESH': + layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures") + layout.itemR(md, "image") + layout.itemR(md, "override_image") + + split = layout.split() + + col = split.column() + col.itemL(text="Aspect Ratio:") + + sub = col.column(align=True) + sub.itemR(md, "horizontal_aspect_ratio", text="Horizontal") + sub.itemR(md, "vertical_aspect_ratio", text="Vertical") + + col = split.column() + col.itemL(text="Projectors:") + + sub = col.column(align=True) + sub.itemR(md, "num_projectors", text="Number") + for proj in md.projectors: + sub.itemR(proj, "object", text="") + + def WAVE(self, layout, ob, md): + split = layout.split() + + col = split.column() + col.itemL(text="Motion:") + col.itemR(md, "x") + col.itemR(md, "y") + col.itemR(md, "cyclic") + + col = split.column() + col.itemR(md, "normals") + sub = col.column() + sub.active = md.normals + sub.itemR(md, "x_normal", text="X") + sub.itemR(md, "y_normal", text="Y") + sub.itemR(md, "z_normal", text="Z") + + split = layout.split() + + col = split.column() + col.itemL(text="Time:") + sub = col.column(align=True) + sub.itemR(md, "time_offset", text="Offset") + sub.itemR(md, "lifetime", text="Life") + col.itemR(md, "damping_time", text="Damping") + + col = split.column() + col.itemL(text="Position:") + sub = col.column(align=True) + sub.itemR(md, "start_position_x", text="X") + sub.itemR(md, "start_position_y", text="Y") + col.itemR(md, "falloff_radius", text="Falloff") + + layout.itemS() + + layout.itemR(md, "start_position_object") + layout.item_pointerR(md, "vertex_group", ob, "vertex_groups") + layout.itemR(md, "texture") + layout.itemR(md, "texture_coordinates") + if md.texture_coordinates == 'MAP_UV' and ob.type == 'MESH': + layout.item_pointerR(md, "uv_layer", ob.data, "uv_textures") + elif md.texture_coordinates == 'OBJECT': + layout.itemR(md, "texture_coordinates_object") + + layout.itemS() + + flow = layout.column_flow() + flow.itemR(md, "speed", slider=True) + flow.itemR(md, "height", slider=True) + flow.itemR(md, "width", slider=True) + flow.itemR(md, "narrowness", slider=True) bpy.types.register(DATA_PT_modifiers) diff --git a/release/scripts/ui/buttons_data_text.py b/release/scripts/ui/buttons_data_text.py index 49847863d7c..873da4ad17d 100644 --- a/release/scripts/ui/buttons_data_text.py +++ b/release/scripts/ui/buttons_data_text.py @@ -2,178 +2,178 @@ import bpy class DataButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "data" - - def poll(self, context): - return (context.object and context.object.type == 'TEXT' and context.curve) + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + + def poll(self, context): + return (context.object and context.object.type == 'TEXT' and context.curve) class DATA_PT_context_text(DataButtonsPanel): - bl_label = "" - bl_show_header = False + bl_label = "" + bl_show_header = False - def draw(self, context): - layout = self.layout - - ob = context.object - curve = context.curve - space = context.space_data + def draw(self, context): + layout = self.layout - split = layout.split(percentage=0.65) + ob = context.object + curve = context.curve + space = context.space_data - if ob: - split.template_ID(ob, "data") - split.itemS() - elif curve: - split.template_ID(space, "pin_id") - split.itemS() + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "data") + split.itemS() + elif curve: + split.template_ID(space, "pin_id") + split.itemS() class DATA_PT_shape_text(DataButtonsPanel): - bl_label = "Shape Text" + bl_label = "Shape Text" - def draw(self, context): - layout = self.layout - - ob = context.object - curve = context.curve - space = context.space_data - - split = layout.split() - - col = split.column() - col.itemL(text="Caps:") - row = col.row() - row .itemR(curve, "front") - row .itemR(curve, "back") - # col = split.column() - col.itemL(text="Textures:") - col.itemR(curve, "uv_orco") - col.itemR(curve, "auto_texspace") - - col = split.column() - col.itemL(text="Resolution:") - sub = col.column(align=True) - sub.itemR(curve, "resolution_u", text="Preview") - sub.itemR(curve, "render_resolution_u", text="Render") - - # resolution_v is not used for text - - sub = col.column(align=True) - col.itemL(text="Display:") - col.itemR(curve, "fast", text="Fast Editing") + def draw(self, context): + layout = self.layout + + ob = context.object + curve = context.curve + space = context.space_data + + split = layout.split() + + col = split.column() + col.itemL(text="Caps:") + row = col.row() + row .itemR(curve, "front") + row .itemR(curve, "back") + # col = split.column() + col.itemL(text="Textures:") + col.itemR(curve, "uv_orco") + col.itemR(curve, "auto_texspace") + + col = split.column() + col.itemL(text="Resolution:") + sub = col.column(align=True) + sub.itemR(curve, "resolution_u", text="Preview") + sub.itemR(curve, "render_resolution_u", text="Render") + + # resolution_v is not used for text + + sub = col.column(align=True) + col.itemL(text="Display:") + col.itemR(curve, "fast", text="Fast Editing") class DATA_PT_geometry_text(DataButtonsPanel): - bl_label = "Geometry" + bl_label = "Geometry" - def draw(self, context): - layout = self.layout - - curve = context.curve + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - col.itemL(text="Modification:") - col.itemR(curve, "width") - col.itemR(curve, "extrude") - col.itemL(text="Taper Object:") - col.itemR(curve, "taper_object", text="") - - col = split.column() - col.itemL(text="Bevel:") - col.itemR(curve, "bevel_depth", text="Depth") - col.itemR(curve, "bevel_resolution", text="Resolution") - col.itemL(text="Bevel Object:") - col.itemR(curve, "bevel_object", text="") + curve = context.curve + + split = layout.split() + + col = split.column() + col.itemL(text="Modification:") + col.itemR(curve, "width") + col.itemR(curve, "extrude") + col.itemL(text="Taper Object:") + col.itemR(curve, "taper_object", text="") + + col = split.column() + col.itemL(text="Bevel:") + col.itemR(curve, "bevel_depth", text="Depth") + col.itemR(curve, "bevel_resolution", text="Resolution") + col.itemL(text="Bevel Object:") + col.itemR(curve, "bevel_object", text="") class DATA_PT_font(DataButtonsPanel): - bl_label = "Font" + bl_label = "Font" - def draw(self, context): - layout = self.layout - - text = context.curve - char = context.curve.edit_format + def draw(self, context): + layout = self.layout - layout.itemR(text, "font") - - row = layout.row() - row.itemR(text, "text_size", text="Size") - row.itemR(text, "shear") - - split = layout.split() - - col = split.column() - col.itemL(text="Object Font:") - col.itemR(text, "family", text="") + text = context.curve + char = context.curve.edit_format - col = split.column() - col.itemL(text="Text on Curve:") - col.itemR(text, "text_on_curve", text="") - - split = layout.split() - - col = split.column() - col.itemL(text="Character:") - col.itemR(char, "bold") - col.itemR(char, "italic") - col.itemR(char, "underline") + layout.itemR(text, "font") + + row = layout.row() + row.itemR(text, "text_size", text="Size") + row.itemR(text, "shear") + + split = layout.split() + + col = split.column() + col.itemL(text="Object Font:") + col.itemR(text, "family", text="") + + col = split.column() + col.itemL(text="Text on Curve:") + col.itemR(text, "text_on_curve", text="") + + split = layout.split() + + col = split.column() + col.itemL(text="Character:") + col.itemR(char, "bold") + col.itemR(char, "italic") + col.itemR(char, "underline") # col.itemR(char, "style") # col.itemR(char, "wrap") - col = split.column(align=True) - col.itemL(text="Underline:") - col.itemR(text, "ul_position", text="Position") - col.itemR(text, "ul_height", text="Thickness") + col = split.column(align=True) + col.itemL(text="Underline:") + col.itemR(text, "ul_position", text="Position") + col.itemR(text, "ul_height", text="Thickness") class DATA_PT_paragraph(DataButtonsPanel): - bl_label = "Paragraph" + bl_label = "Paragraph" - def draw(self, context): - layout = self.layout - - text = context.curve + def draw(self, context): + layout = self.layout - layout.itemL(text="Align:") - layout.itemR(text, "spacemode", expand=True) + text = context.curve - split = layout.split() - - col = split.column(align=True) - col.itemL(text="Spacing:") - col.itemR(text, "spacing", text="Character") - col.itemR(text, "word_spacing", text="Word") - col.itemR(text, "line_dist", text="Line") + layout.itemL(text="Align:") + layout.itemR(text, "spacemode", expand=True) - col = split.column(align=True) - col.itemL(text="Offset:") - col.itemR(text, "offset_x", text="X") - col.itemR(text, "offset_y", text="Y") + split = layout.split() + + col = split.column(align=True) + col.itemL(text="Spacing:") + col.itemR(text, "spacing", text="Character") + col.itemR(text, "word_spacing", text="Word") + col.itemR(text, "line_dist", text="Line") + + col = split.column(align=True) + col.itemL(text="Offset:") + col.itemR(text, "offset_x", text="X") + col.itemR(text, "offset_y", text="Y") class DATA_PT_textboxes(DataButtonsPanel): - bl_label = "Text Boxes" + bl_label = "Text Boxes" - def draw(self, context): - layout = self.layout - - text = context.curve - - for box in text.textboxes: - split = layout.box().split() - - col = split.column(align=True) - col.itemL(text="Dimensions:") - col.itemR(box, "width", text="Width") - col.itemR(box, "height", text="Height") - - col = split.column(align=True) - col.itemL(text="Offset:") - col.itemR(box, "x", text="X") - col.itemR(box, "y", text="Y") + def draw(self, context): + layout = self.layout + + text = context.curve + + for box in text.textboxes: + split = layout.box().split() + + col = split.column(align=True) + col.itemL(text="Dimensions:") + col.itemR(box, "width", text="Width") + col.itemR(box, "height", text="Height") + + col = split.column(align=True) + col.itemL(text="Offset:") + col.itemR(box, "x", text="X") + col.itemR(box, "y", text="Y") bpy.types.register(DATA_PT_context_text) -bpy.types.register(DATA_PT_shape_text) +bpy.types.register(DATA_PT_shape_text) bpy.types.register(DATA_PT_geometry_text) bpy.types.register(DATA_PT_font) bpy.types.register(DATA_PT_paragraph) diff --git a/release/scripts/ui/buttons_game.py b/release/scripts/ui/buttons_game.py index 77581884515..af67512dd3e 100644 --- a/release/scripts/ui/buttons_game.py +++ b/release/scripts/ui/buttons_game.py @@ -1,317 +1,317 @@ import bpy - -class PhysicsButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "physics" - def poll(self, context): - ob = context.active_object - rd = context.scene.render_data - return ob and ob.game and (rd.engine == 'BLENDER_GAME') +class PhysicsButtonsPanel(bpy.types.Panel): + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "physics" + + def poll(self, context): + ob = context.active_object + rd = context.scene.render_data + return ob and ob.game and (rd.engine == 'BLENDER_GAME') class PHYSICS_PT_game_physics(PhysicsButtonsPanel): - bl_label = "Physics" + bl_label = "Physics" - def draw(self, context): - layout = self.layout - - ob = context.active_object - game = ob.game - soft = ob.game.soft_body + def draw(self, context): + layout = self.layout - layout.itemR(game, "physics_type") - layout.itemS() - - #if game.physics_type == 'DYNAMIC': - if game.physics_type in ('DYNAMIC', 'RIGID_BODY'): - split = layout.split() - - col = split.column() - col.itemR(game, "actor") - col.itemR(game, "ghost") - col.itemR(ob, "restrict_render", text="Invisible") # out of place but useful - - col = split.column() - col.itemR(game, "material_physics") - col.itemR(game, "rotate_from_normal") - col.itemR(game, "no_sleeping") - - layout.itemS() - - split = layout.split() - - col = split.column() - col.itemL(text="Attributes:") - col.itemR(game, "mass") - col.itemR(game, "radius") - col.itemR(game, "form_factor") - - col = split.column() - sub = col.column() - sub.active = (game.physics_type == 'RIGID_BODY') - sub.itemR(game, "anisotropic_friction") - subsub = sub.column() - subsub.active = game.anisotropic_friction - subsub.itemR(game, "friction_coefficients", text="", slider=True) - - split = layout.split() - - col = split.column() - col.itemL(text="Velocity:") - sub = col.column(align=True) - sub.itemR(game, "minimum_velocity", text="Minimum") - sub.itemR(game, "maximum_velocity", text="Maximum") - - col = split.column() - col.itemL(text="Damping:") - sub = col.column(align=True) - sub.itemR(game, "damping", text="Translation", slider=True) - sub.itemR(game, "rotation_damping", text="Rotation", slider=True) - - layout.itemS() - - split = layout.split() - - col = split.column() - col.itemL(text="Lock Translation:") - col.itemR(game, "lock_x_axis", text="X") - col.itemR(game, "lock_y_axis", text="Y") - col.itemR(game, "lock_z_axis", text="Z") - - col = split.column() - col.itemL(text="Lock Rotation:") - col.itemR(game, "lock_x_rot_axis", text="X") - col.itemR(game, "lock_y_rot_axis", text="Y") - col.itemR(game, "lock_z_rot_axis", text="Z") - - elif game.physics_type == 'SOFT_BODY': - col = layout.column() - col.itemR(game, "actor") - col.itemR(game, "ghost") - col.itemR(ob, "restrict_render", text="Invisible") - - layout.itemS() - - split = layout.split() - - col = split.column() - col.itemL(text="Attributes:") - col.itemR(game, "mass") - col.itemR(soft, "welding") - col.itemR(soft, "position_iterations") - col.itemR(soft, "linstiff", slider=True) - col.itemR(soft, "dynamic_friction", slider=True) - col.itemR(soft, "margin", slider=True) - col.itemR(soft, "bending_const", text="Bending Constraints") + ob = context.active_object + game = ob.game + soft = ob.game.soft_body + + layout.itemR(game, "physics_type") + layout.itemS() + + #if game.physics_type == 'DYNAMIC': + if game.physics_type in ('DYNAMIC', 'RIGID_BODY'): + split = layout.split() + + col = split.column() + col.itemR(game, "actor") + col.itemR(game, "ghost") + col.itemR(ob, "restrict_render", text="Invisible") # out of place but useful + + col = split.column() + col.itemR(game, "material_physics") + col.itemR(game, "rotate_from_normal") + col.itemR(game, "no_sleeping") + + layout.itemS() + + split = layout.split() + + col = split.column() + col.itemL(text="Attributes:") + col.itemR(game, "mass") + col.itemR(game, "radius") + col.itemR(game, "form_factor") + + col = split.column() + sub = col.column() + sub.active = (game.physics_type == 'RIGID_BODY') + sub.itemR(game, "anisotropic_friction") + subsub = sub.column() + subsub.active = game.anisotropic_friction + subsub.itemR(game, "friction_coefficients", text="", slider=True) + + split = layout.split() + + col = split.column() + col.itemL(text="Velocity:") + sub = col.column(align=True) + sub.itemR(game, "minimum_velocity", text="Minimum") + sub.itemR(game, "maximum_velocity", text="Maximum") + + col = split.column() + col.itemL(text="Damping:") + sub = col.column(align=True) + sub.itemR(game, "damping", text="Translation", slider=True) + sub.itemR(game, "rotation_damping", text="Rotation", slider=True) + + layout.itemS() + + split = layout.split() + + col = split.column() + col.itemL(text="Lock Translation:") + col.itemR(game, "lock_x_axis", text="X") + col.itemR(game, "lock_y_axis", text="Y") + col.itemR(game, "lock_z_axis", text="Z") + + col = split.column() + col.itemL(text="Lock Rotation:") + col.itemR(game, "lock_x_rot_axis", text="X") + col.itemR(game, "lock_y_rot_axis", text="Y") + col.itemR(game, "lock_z_rot_axis", text="Z") + + elif game.physics_type == 'SOFT_BODY': + col = layout.column() + col.itemR(game, "actor") + col.itemR(game, "ghost") + col.itemR(ob, "restrict_render", text="Invisible") + + layout.itemS() + + split = layout.split() + + col = split.column() + col.itemL(text="Attributes:") + col.itemR(game, "mass") + col.itemR(soft, "welding") + col.itemR(soft, "position_iterations") + col.itemR(soft, "linstiff", slider=True) + col.itemR(soft, "dynamic_friction", slider=True) + col.itemR(soft, "margin", slider=True) + col.itemR(soft, "bending_const", text="Bending Constraints") + + col = split.column() + col.itemR(soft, "shape_match") + sub = col.column() + sub.active = soft.shape_match + sub.itemR(soft, "threshold", slider=True) + + col.itemS() + + col.itemL(text="Cluster Collision:") + col.itemR(soft, "cluster_rigid_to_softbody") + col.itemR(soft, "cluster_soft_to_softbody") + sub = col.column() + sub.active = (soft.cluster_rigid_to_softbody or soft.cluster_soft_to_softbody) + sub.itemR(soft, "cluster_iterations", text="Iterations") + + elif game.physics_type == 'STATIC': + col = layout.column() + col.itemR(game, "actor") + col.itemR(game, "ghost") + col.itemR(ob, "restrict_render", text="Invisible") + + elif game.physics_type in ('SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'): + layout.itemR(ob, "restrict_render", text="Invisible") - col = split.column() - col.itemR(soft, "shape_match") - sub = col.column() - sub.active = soft.shape_match - sub.itemR(soft, "threshold", slider=True) - - col.itemS() - - col.itemL(text="Cluster Collision:") - col.itemR(soft, "cluster_rigid_to_softbody") - col.itemR(soft, "cluster_soft_to_softbody") - sub = col.column() - sub.active = (soft.cluster_rigid_to_softbody or soft.cluster_soft_to_softbody) - sub.itemR(soft, "cluster_iterations", text="Iterations") - - elif game.physics_type == 'STATIC': - col = layout.column() - col.itemR(game, "actor") - col.itemR(game, "ghost") - col.itemR(ob, "restrict_render", text="Invisible") - - elif game.physics_type in ('SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'): - layout.itemR(ob, "restrict_render", text="Invisible") - class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel): - bl_label = "Collision Bounds" + bl_label = "Collision Bounds" - def poll(self, context): - game = context.object.game - rd = context.scene.render_data - return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine == 'BLENDER_GAME') + def poll(self, context): + game = context.object.game + rd = context.scene.render_data + return (game.physics_type in ('DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC')) and (rd.engine == 'BLENDER_GAME') - def draw_header(self, context): - game = context.active_object.game + def draw_header(self, context): + game = context.active_object.game - self.layout.itemR(game, "use_collision_bounds", text="") - - def draw(self, context): - layout = self.layout - - game = context.active_object.game + self.layout.itemR(game, "use_collision_bounds", text="") - layout.active = game.use_collision_bounds - layout.itemR(game, "collision_bounds", text="Bounds") - - row = layout.row() - row.itemR(game, "collision_compound", text="Compound") - row.itemR(game, "collision_margin", text="Margin", slider=True) + def draw(self, context): + layout = self.layout + + game = context.active_object.game + + layout.active = game.use_collision_bounds + layout.itemR(game, "collision_bounds", text="Bounds") + + row = layout.row() + row.itemR(game, "collision_compound", text="Compound") + row.itemR(game, "collision_margin", text="Margin", slider=True) bpy.types.register(PHYSICS_PT_game_physics) bpy.types.register(PHYSICS_PT_game_collision_bounds) class RenderButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "render" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "render" - def poll(self, context): - rd = context.scene.render_data - return (rd.engine == 'BLENDER_GAME') + def poll(self, context): + rd = context.scene.render_data + return (rd.engine == 'BLENDER_GAME') class RENDER_PT_game(RenderButtonsPanel): - bl_label = "Game" + bl_label = "Game" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - row = layout.row() - row.itemO("view3d.game_start", text="Start") - row.itemL() + row = layout.row() + row.itemO("view3d.game_start", text="Start") + row.itemL() class RENDER_PT_game_player(RenderButtonsPanel): - bl_label = "Standalone Player" + bl_label = "Standalone Player" - def draw(self, context): - layout = self.layout - - gs = context.scene.game_data - - layout.itemR(gs, "fullscreen") + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - col.itemL(text="Resolution:") - sub = col.column(align=True) - sub.itemR(gs, "resolution_x", slider=False, text="X") - sub.itemR(gs, "resolution_y", slider=False, text="Y") + gs = context.scene.game_data - col = split.column() - col.itemL(text="Quality:") - sub = col.column(align=True) - sub.itemR(gs, "depth", text="Bit Depth", slider=False) - sub.itemR(gs, "frequency", text="FPS", slider=False) + layout.itemR(gs, "fullscreen") - # framing: - col = layout.column() - col.itemL(text="Framing:") - col.row().itemR(gs, "framing_type", expand=True) - if gs.framing_type == 'LETTERBOX': - col.itemR(gs, "framing_color", text="") + split = layout.split() + + col = split.column() + col.itemL(text="Resolution:") + sub = col.column(align=True) + sub.itemR(gs, "resolution_x", slider=False, text="X") + sub.itemR(gs, "resolution_y", slider=False, text="Y") + + col = split.column() + col.itemL(text="Quality:") + sub = col.column(align=True) + sub.itemR(gs, "depth", text="Bit Depth", slider=False) + sub.itemR(gs, "frequency", text="FPS", slider=False) + + # framing: + col = layout.column() + col.itemL(text="Framing:") + col.row().itemR(gs, "framing_type", expand=True) + if gs.framing_type == 'LETTERBOX': + col.itemR(gs, "framing_color", text="") class RENDER_PT_game_stereo(RenderButtonsPanel): - bl_label = "Stereo" + bl_label = "Stereo" - def draw(self, context): - layout = self.layout - - gs = context.scene.game_data - stereo_mode = gs.stereo + def draw(self, context): + layout = self.layout - # stereo options: - layout.itemR(gs, "stereo", expand=True) - - # stereo: - if stereo_mode == 'STEREO': - layout.itemR(gs, "stereo_mode") - layout.itemL(text="To do: Focal Length") - layout.itemL(text="To do: Eye Separation") + gs = context.scene.game_data + stereo_mode = gs.stereo - # dome: - elif stereo_mode == 'DOME': - layout.itemR(gs, "dome_mode", text="Dome Type") + # stereo options: + layout.itemR(gs, "stereo", expand=True) - dome_type = gs.dome_mode + # stereo: + if stereo_mode == 'STEREO': + layout.itemR(gs, "stereo_mode") + layout.itemL(text="To do: Focal Length") + layout.itemL(text="To do: Eye Separation") - split=layout.split() + # dome: + elif stereo_mode == 'DOME': + layout.itemR(gs, "dome_mode", text="Dome Type") - if dome_type == 'FISHEYE' or \ - dome_type == 'TRUNCATED_REAR' or \ - dome_type == 'TRUNCATED_FRONT': - - col=split.column() - col.itemR(gs, "dome_angle", slider=True) - col.itemR(gs, "dome_tilt") + dome_type = gs.dome_mode - col=split.column() - col.itemR(gs, "dome_tesselation", text="Tesselation") - col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True) + split=layout.split() - elif dome_type == 'PANORAM_SPH': - col=split.column() - col.itemR(gs, "dome_tesselation", text="Tesselation") - col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True) + if dome_type == 'FISHEYE' or \ + dome_type == 'TRUNCATED_REAR' or \ + dome_type == 'TRUNCATED_FRONT': - else: # cube map - col=split.column() - col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True) - - layout.itemR(gs, "dome_text") + col=split.column() + col.itemR(gs, "dome_angle", slider=True) + col.itemR(gs, "dome_tilt") + + col=split.column() + col.itemR(gs, "dome_tesselation", text="Tesselation") + col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True) + + elif dome_type == 'PANORAM_SPH': + col=split.column() + col.itemR(gs, "dome_tesselation", text="Tesselation") + col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True) + + else: # cube map + col=split.column() + col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True) + + layout.itemR(gs, "dome_text") class RENDER_PT_game_shading(RenderButtonsPanel): - bl_label = "Shading" + bl_label = "Shading" - def draw(self, context): - layout = self.layout - - gs = context.scene.game_data - layout.itemR(gs, "material_mode", expand=True) - - if gs.material_mode == 'GLSL': - split = layout.split() + def draw(self, context): + layout = self.layout - col = split.column() - col.itemR(gs, "glsl_lights", text="Lights") - col.itemR(gs, "glsl_shaders", text="Shaders") - col.itemR(gs, "glsl_shadows", text="Shadows") + gs = context.scene.game_data + layout.itemR(gs, "material_mode", expand=True) - col = split.column() - col.itemR(gs, "glsl_ramps", text="Ramps") - col.itemR(gs, "glsl_nodes", text="Nodes") - col.itemR(gs, "glsl_extra_textures", text="Extra Textures") + if gs.material_mode == 'GLSL': + split = layout.split() + + col = split.column() + col.itemR(gs, "glsl_lights", text="Lights") + col.itemR(gs, "glsl_shaders", text="Shaders") + col.itemR(gs, "glsl_shadows", text="Shadows") + + col = split.column() + col.itemR(gs, "glsl_ramps", text="Ramps") + col.itemR(gs, "glsl_nodes", text="Nodes") + col.itemR(gs, "glsl_extra_textures", text="Extra Textures") class RENDER_PT_game_performance(RenderButtonsPanel): - bl_label = "Performance" + bl_label = "Performance" - def draw(self, context): - layout = self.layout - - gs = context.scene.game_data + def draw(self, context): + layout = self.layout - split = layout.split() + gs = context.scene.game_data + + split = layout.split() + + col = split.column() + col.itemL(text="Show:") + col.itemR(gs, "show_debug_properties", text="Debug Properties") + col.itemR(gs, "show_framerate_profile", text="Framerate and Profile") + col.itemR(gs, "show_physics_visualization", text="Physics Visualization") + col.itemR(gs, "deprecation_warnings") + + col = split.column() + col.itemL(text="Render:") + col.itemR(gs, "all_frames") + col.itemR(gs, "display_lists") - col = split.column() - col.itemL(text="Show:") - col.itemR(gs, "show_debug_properties", text="Debug Properties") - col.itemR(gs, "show_framerate_profile", text="Framerate and Profile") - col.itemR(gs, "show_physics_visualization", text="Physics Visualization") - col.itemR(gs, "deprecation_warnings") - - col = split.column() - col.itemL(text="Render:") - col.itemR(gs, "all_frames") - col.itemR(gs, "display_lists") - class RENDER_PT_game_sound(RenderButtonsPanel): - bl_label = "Sound" + bl_label = "Sound" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - scene = context.scene - - layout.itemR(scene, "distance_model") - layout.itemR(scene, "speed_of_sound", text="Speed") - layout.itemR(scene, "doppler_factor") + scene = context.scene + + layout.itemR(scene, "distance_model") + layout.itemR(scene, "speed_of_sound", text="Speed") + layout.itemR(scene, "doppler_factor") bpy.types.register(RENDER_PT_game) bpy.types.register(RENDER_PT_game_player) @@ -321,96 +321,96 @@ bpy.types.register(RENDER_PT_game_performance) bpy.types.register(RENDER_PT_game_sound) class WorldButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "world" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "world" - def poll(self, context): - rd = context.scene.render_data - return (rd.engine == 'BLENDER_GAME') + def poll(self, context): + rd = context.scene.render_data + return (rd.engine == 'BLENDER_GAME') class WORLD_PT_game_context_world(WorldButtonsPanel): - bl_label = "" - bl_show_header = False + bl_label = "" + bl_show_header = False - def poll(self, context): - rd = context.scene.render_data - return (context.scene) and (rd.use_game_engine) + def poll(self, context): + rd = context.scene.render_data + return (context.scene) and (rd.use_game_engine) - def draw(self, context): - layout = self.layout - - scene = context.scene - world = context.world - space = context.space_data + def draw(self, context): + layout = self.layout - split = layout.split(percentage=0.65) + scene = context.scene + world = context.world + space = context.space_data - if scene: - split.template_ID(scene, "world", new="world.new") - elif world: - split.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): - bl_label = "World" + bl_label = "World" - def draw(self, context): - layout = self.layout - - world = context.world + def draw(self, context): + layout = self.layout - row = layout.row() - row.column().itemR(world, "horizon_color") - row.column().itemR(world, "ambient_color") + world = context.world - layout.itemR(world.mist, "enabled", text="Mist") + row = layout.row() + row.column().itemR(world, "horizon_color") + row.column().itemR(world, "ambient_color") - row = layout.column_flow() - row.active = world.mist.enabled - row.itemR(world.mist, "start") - row.itemR(world.mist, "depth") + layout.itemR(world.mist, "enabled", text="Mist") + + row = layout.column_flow() + row.active = world.mist.enabled + row.itemR(world.mist, "start") + row.itemR(world.mist, "depth") class WORLD_PT_game_physics(WorldButtonsPanel): - bl_label = "Physics" - - def draw(self, context): - layout = self.layout - - gs = context.scene.game_data - - layout.itemR(gs, "physics_engine") - if gs.physics_engine != 'NONE': - layout.itemR(gs, "physics_gravity", text="Gravity") - - split = layout.split() - - col = split.column() - col.itemL(text="Physics Steps:") - sub = col.column(align=True) - sub.itemR(gs, "physics_step_max", text="Max") - sub.itemR(gs, "physics_step_sub", text="Substeps") - col.itemR(gs, "fps", text="FPS") - - col = split.column() - col.itemL(text="Logic Steps:") - col.itemR(gs, "logic_step_max", text="Max") - - col = layout.column() - col.itemR(gs, "use_occlusion_culling", text="Occlusion Culling") - sub = col.column() - sub.active = gs.use_occlusion_culling - sub.itemR(gs, "occlusion_culling_resolution", text="Resolution") + bl_label = "Physics" - else: - split = layout.split() - - col = split.column() - col.itemL(text="Physics Steps:") - col.itemR(gs, "fps", text="FPS") - - col = split.column() - col.itemL(text="Logic Steps:") - col.itemR(gs, "logic_step_max", text="Max") + def draw(self, context): + layout = self.layout + + gs = context.scene.game_data + + layout.itemR(gs, "physics_engine") + if gs.physics_engine != 'NONE': + layout.itemR(gs, "physics_gravity", text="Gravity") + + split = layout.split() + + col = split.column() + col.itemL(text="Physics Steps:") + sub = col.column(align=True) + sub.itemR(gs, "physics_step_max", text="Max") + sub.itemR(gs, "physics_step_sub", text="Substeps") + col.itemR(gs, "fps", text="FPS") + + col = split.column() + col.itemL(text="Logic Steps:") + col.itemR(gs, "logic_step_max", text="Max") + + col = layout.column() + col.itemR(gs, "use_occlusion_culling", text="Occlusion Culling") + sub = col.column() + sub.active = gs.use_occlusion_culling + sub.itemR(gs, "occlusion_culling_resolution", text="Resolution") + + else: + split = layout.split() + + col = split.column() + col.itemL(text="Physics Steps:") + col.itemR(gs, "fps", text="FPS") + + col = split.column() + col.itemL(text="Logic Steps:") + col.itemR(gs, "logic_step_max", text="Max") bpy.types.register(WORLD_PT_game_context_world) bpy.types.register(WORLD_PT_game_world) diff --git a/release/scripts/ui/buttons_material.py b/release/scripts/ui/buttons_material.py index af95eec9a68..9131b5284f7 100644 --- a/release/scripts/ui/buttons_material.py +++ b/release/scripts/ui/buttons_material.py @@ -1,612 +1,612 @@ - + import bpy def active_node_mat(mat): - # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate - # which settings from node-materials are used - if mat: - mat_node = mat.active_node_material - if mat_node: - return mat_node - else: - return mat + # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate + # which settings from node-materials are used + if mat: + mat_node = mat.active_node_material + if mat_node: + return mat_node + else: + return mat - return None + return None class MaterialButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "material" - # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + 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_data.engine - return mat and (engine in self.COMPAT_ENGINES) + def poll(self, context): + mat = context.material + engine = context.scene.render_data.engine + return mat and (engine in self.COMPAT_ENGINES) class MATERIAL_PT_preview(MaterialButtonsPanel): - bl_label = "Preview" - COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + bl_label = "Preview" + COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + + def draw(self, context): + self.layout.template_preview(context.material) - def draw(self, context): - self.layout.template_preview(context.material) - class MATERIAL_PT_context_material(MaterialButtonsPanel): - bl_label = "" - bl_show_header = False - COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + bl_label = "" + bl_show_header = False + COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) - def poll(self, context): - # An exception, dont call the parent poll func because - # this manages materials for all engine types - - engine = context.scene.render_data.engine - return (context.material or context.object) and (engine in self.COMPAT_ENGINES) + def poll(self, context): + # An exception, dont call the parent poll func because + # this manages materials for all engine types - def draw(self, context): - layout = self.layout - - mat = context.material - ob = context.object - slot = context.material_slot - space = context.space_data + engine = context.scene.render_data.engine + return (context.material or context.object) and (engine in self.COMPAT_ENGINES) - if ob: - row = layout.row() + def draw(self, context): + layout = self.layout - row.template_list(ob, "materials", ob, "active_material_index", rows=2) + mat = context.material + ob = context.object + slot = context.material_slot + space = context.space_data - col = row.column(align=True) - col.itemO("object.material_slot_add", icon='ICON_ZOOMIN', text="") - col.itemO("object.material_slot_remove", icon='ICON_ZOOMOUT', text="") - col.itemO("object.material_slot_copy", icon='ICON_COPY_ID', text="") + if ob: + row = layout.row() - if ob.mode == 'EDIT': - row = layout.row(align=True) - row.itemO("object.material_slot_assign", text="Assign") - row.itemO("object.material_slot_select", text="Select") - row.itemO("object.material_slot_deselect", text="Deselect") + row.template_list(ob, "materials", ob, "active_material_index", rows=2) - split = layout.split(percentage=0.65) + col = row.column(align=True) + col.itemO("object.material_slot_add", icon='ICON_ZOOMIN', text="") + col.itemO("object.material_slot_remove", icon='ICON_ZOOMOUT', text="") + col.itemO("object.material_slot_copy", icon='ICON_COPY_ID', text="") + + if ob.mode == 'EDIT': + row = layout.row(align=True) + row.itemO("object.material_slot_assign", text="Assign") + row.itemO("object.material_slot_select", text="Select") + row.itemO("object.material_slot_deselect", text="Deselect") + + split = layout.split(percentage=0.65) + + if ob: + split.template_ID(ob, "active_material", new="material.new") + row = split.row() + if slot: + row.itemR(slot, "link", text="") + else: + row.itemL() + elif mat: + split.template_ID(space, "pin_id") + split.itemS() + + if mat: + layout.itemR(mat, "type", expand=True) - if ob: - split.template_ID(ob, "active_material", new="material.new") - row = split.row() - if slot: - row.itemR(slot, "link", text="") - else: - row.itemL() - elif mat: - split.template_ID(space, "pin_id") - split.itemS() - - if mat: - layout.itemR(mat, "type", expand=True) - class MATERIAL_PT_shading(MaterialButtonsPanel): - bl_label = "Shading" - COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + bl_label = "Shading" + COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) - def poll(self, context): - mat = active_node_mat(context.material) - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES) + def poll(self, context): + mat = active_node_mat(context.material) + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES) - def draw(self, context): - layout = self.layout - - mat = active_node_mat(context.material) + def draw(self, context): + layout = self.layout + + mat = active_node_mat(context.material) + + if mat.type in ('SURFACE', 'WIRE'): + split = layout.split() + + col = split.column() + sub = col.column() + sub.active = not mat.shadeless + sub.itemR(mat, "emit") + sub.itemR(mat, "ambient") + sub = col.column() + sub.itemR(mat, "translucency") + + col = split.column() + col.itemR(mat, "shadeless") + sub = col.column() + sub.active = not mat.shadeless + sub.itemR(mat, "tangent_shading") + sub.itemR(mat, "cubic") + + elif mat.type == 'HALO': + layout.itemR(mat, "alpha") - if mat.type in ('SURFACE', 'WIRE'): - split = layout.split() - - col = split.column() - sub = col.column() - sub.active = not mat.shadeless - sub.itemR(mat, "emit") - sub.itemR(mat, "ambient") - sub = col.column() - sub.itemR(mat, "translucency") - - col = split.column() - col.itemR(mat, "shadeless") - sub = col.column() - sub.active = not mat.shadeless - sub.itemR(mat, "tangent_shading") - sub.itemR(mat, "cubic") - - elif mat.type == 'HALO': - layout.itemR(mat, "alpha") - class MATERIAL_PT_strand(MaterialButtonsPanel): - bl_label = "Strand" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Strand" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def poll(self, context): + mat = context.material + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = context.material # dont use node material + tan = mat.strand + + split = layout.split() + + col = split.column(align=True) + col.itemL(text="Size:") + col.itemR(tan, "root_size", text="Root") + col.itemR(tan, "tip_size", text="Tip") + col.itemR(tan, "min_size", text="Minimum") + col.itemR(tan, "blender_units") + sub = col.column() + sub.active = (not mat.shadeless) + sub.itemR(tan, "tangent_shading") + col.itemR(tan, "shape") + + col = split.column() + col.itemL(text="Shading:") + col.itemR(tan, "width_fade") + ob = context.object + if ob and ob.type == 'MESH': col.item_pointerR(tan, "uv_layer", ob.data, "uv_textures", text="") + else: col.itemR(tan, "uv_layer", text="") + col.itemS() + sub = col.column() + sub.active = (not mat.shadeless) + sub.itemR(tan, "surface_diffuse") + sub = col.column() + sub.active = tan.surface_diffuse + sub.itemR(tan, "blend_distance", text="Distance") - def poll(self, context): - mat = context.material - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES) - - def draw(self, context): - layout = self.layout - - mat = context.material # dont use node material - tan = mat.strand - - split = layout.split() - - col = split.column(align=True) - col.itemL(text="Size:") - col.itemR(tan, "root_size", text="Root") - col.itemR(tan, "tip_size", text="Tip") - col.itemR(tan, "min_size", text="Minimum") - col.itemR(tan, "blender_units") - sub = col.column() - sub.active = (not mat.shadeless) - sub.itemR(tan, "tangent_shading") - col.itemR(tan, "shape") - - col = split.column() - col.itemL(text="Shading:") - col.itemR(tan, "width_fade") - ob = context.object - if ob and ob.type == 'MESH': col.item_pointerR(tan, "uv_layer", ob.data, "uv_textures", text="") - else: col.itemR(tan, "uv_layer", text="") - col.itemS() - sub = col.column() - sub.active = (not mat.shadeless) - sub.itemR(tan, "surface_diffuse") - sub = col.column() - sub.active = tan.surface_diffuse - sub.itemR(tan, "blend_distance", text="Distance") - class MATERIAL_PT_physics(MaterialButtonsPanel): - bl_label = "Physics" - COMPAT_ENGINES = set(['BLENDER_GAME']) - - def draw(self, context): - layout = self.layout - - phys = context.material.physics # dont use node material - - split = layout.split() - - col = split.column() - col.itemR(phys, "distance") - col.itemR(phys, "friction") - col.itemR(phys, "align_to_normal") - - col = split.column() - col.itemR(phys, "force", slider=True) - col.itemR(phys, "elasticity", slider=True) - col.itemR(phys, "damp", slider=True) - + bl_label = "Physics" + COMPAT_ENGINES = set(['BLENDER_GAME']) + + def draw(self, context): + layout = self.layout + + phys = context.material.physics # dont use node material + + split = layout.split() + + col = split.column() + col.itemR(phys, "distance") + col.itemR(phys, "friction") + col.itemR(phys, "align_to_normal") + + col = split.column() + col.itemR(phys, "force", slider=True) + col.itemR(phys, "elasticity", slider=True) + col.itemR(phys, "damp", slider=True) + class MATERIAL_PT_options(MaterialButtonsPanel): - bl_label = "Options" - COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + bl_label = "Options" + COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) - def poll(self, context): - mat = active_node_mat(context.material) - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES) + def poll(self, context): + mat = active_node_mat(context.material) + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in self.COMPAT_ENGINES) - def draw(self, context): - layout = self.layout - - mat = active_node_mat(context.material) - - split = layout.split() - - col = split.column() - col.itemR(mat, "traceable") - col.itemR(mat, "full_oversampling") - col.itemR(mat, "sky") - col.itemR(mat, "exclude_mist") - col.itemR(mat, "invert_z") - sub = col.row() - sub.itemR(mat, "z_offset") - sub.active = mat.transparency and mat.transparency_method == 'Z_TRANSPARENCY' - sub = col.column(align=True) - sub.itemL(text="Light Group:") - sub.itemR(mat, "light_group", text="") - row = sub.row() - row.active = mat.light_group - row.itemR(mat, "light_group_exclusive", text="Exclusive") + def draw(self, context): + layout = self.layout - col = split.column() - col.itemR(mat, "face_texture") - sub = col.column() - sub.active = mat.face_texture - sub.itemR(mat, "face_texture_alpha") - col.itemS() - col.itemR(mat, "vertex_color_paint") - col.itemR(mat, "vertex_color_light") - col.itemR(mat, "object_color") + mat = active_node_mat(context.material) + + split = layout.split() + + col = split.column() + col.itemR(mat, "traceable") + col.itemR(mat, "full_oversampling") + col.itemR(mat, "sky") + col.itemR(mat, "exclude_mist") + col.itemR(mat, "invert_z") + sub = col.row() + sub.itemR(mat, "z_offset") + sub.active = mat.transparency and mat.transparency_method == 'Z_TRANSPARENCY' + sub = col.column(align=True) + sub.itemL(text="Light Group:") + sub.itemR(mat, "light_group", text="") + row = sub.row() + row.active = mat.light_group + row.itemR(mat, "light_group_exclusive", text="Exclusive") + + col = split.column() + col.itemR(mat, "face_texture") + sub = col.column() + sub.active = mat.face_texture + sub.itemR(mat, "face_texture_alpha") + col.itemS() + col.itemR(mat, "vertex_color_paint") + col.itemR(mat, "vertex_color_light") + col.itemR(mat, "object_color") class MATERIAL_PT_shadow(MaterialButtonsPanel): - bl_label = "Shadow" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) - - def poll(self, context): - mat = active_node_mat(context.material) - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) + bl_label = "Shadow" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) - def draw(self, context): - layout = self.layout - - mat = active_node_mat(context.material) - - split = layout.split() - - col = split.column() - col.itemR(mat, "shadows", text="Receive") - col.itemR(mat, "receive_transparent_shadows", text="Receive Transparent") - col.itemR(mat, "only_shadow", text="Shadows Only") - col.itemR(mat, "cast_shadows_only", text="Cast Only") - col.itemR(mat, "shadow_casting_alpha", text="Casting Alpha") - - col = split.column() - col.itemR(mat, "cast_buffer_shadows") - sub = col.column() - sub.active = mat.cast_buffer_shadows - sub.itemR(mat, "shadow_buffer_bias", text="Buffer Bias") - col.itemR(mat, "ray_shadow_bias", text="Auto Ray Bias") - sub = col.column() - sub.active = (not mat.ray_shadow_bias) - sub.itemR(mat, "shadow_ray_bias", text="Ray Bias") + def poll(self, context): + mat = active_node_mat(context.material) + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = active_node_mat(context.material) + + split = layout.split() + + col = split.column() + col.itemR(mat, "shadows", text="Receive") + col.itemR(mat, "receive_transparent_shadows", text="Receive Transparent") + col.itemR(mat, "only_shadow", text="Shadows Only") + col.itemR(mat, "cast_shadows_only", text="Cast Only") + col.itemR(mat, "shadow_casting_alpha", text="Casting Alpha") + + col = split.column() + col.itemR(mat, "cast_buffer_shadows") + sub = col.column() + sub.active = mat.cast_buffer_shadows + sub.itemR(mat, "shadow_buffer_bias", text="Buffer Bias") + col.itemR(mat, "ray_shadow_bias", text="Auto Ray Bias") + sub = col.column() + sub.active = (not mat.ray_shadow_bias) + sub.itemR(mat, "shadow_ray_bias", text="Ray Bias") class MATERIAL_PT_diffuse(MaterialButtonsPanel): - bl_label = "Diffuse" - COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + bl_label = "Diffuse" + COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) - def poll(self, context): - mat = active_node_mat(context.material) - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) + def poll(self, context): + mat = active_node_mat(context.material) + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) - def draw(self, context): - layout = self.layout - - mat = active_node_mat(context.material) - - split = layout.split() - - col = split.column() - col.itemR(mat, "diffuse_color", text="") - sub = col.column() - sub.active = (not mat.shadeless) - sub.itemR(mat, "diffuse_intensity", text="Intensity") - - col = split.column() - col.active = (not mat.shadeless) - col.itemR(mat, "diffuse_shader", text="") - col.itemR(mat, "use_diffuse_ramp", text="Ramp") - - col = layout.column() - col.active = (not mat.shadeless) - if mat.diffuse_shader == 'OREN_NAYAR': - col.itemR(mat, "roughness") - elif mat.diffuse_shader == 'MINNAERT': - col.itemR(mat, "darkness") - elif mat.diffuse_shader == 'TOON': - row = col.row() - row.itemR(mat, "diffuse_toon_size", text="Size") - row.itemR(mat, "diffuse_toon_smooth", text="Smooth") - elif mat.diffuse_shader == 'FRESNEL': - row = col.row() - row.itemR(mat, "diffuse_fresnel", text="Fresnel") - row.itemR(mat, "diffuse_fresnel_factor", text="Factor") - - if mat.use_diffuse_ramp: - layout.itemS() - layout.template_color_ramp(mat, "diffuse_ramp", expand=True) - layout.itemS() - row = layout.row() - split = row.split(percentage=0.3) - split.itemL(text="Input:") - split.itemR(mat, "diffuse_ramp_input", text="") - split = row.split(percentage=0.3) - split.itemL(text="Blend:") - split.itemR(mat, "diffuse_ramp_blend", text="") - row = layout.row() - row.itemR(mat, "diffuse_ramp_factor", text="Factor") + def draw(self, context): + layout = self.layout + + mat = active_node_mat(context.material) + + split = layout.split() + + col = split.column() + col.itemR(mat, "diffuse_color", text="") + sub = col.column() + sub.active = (not mat.shadeless) + sub.itemR(mat, "diffuse_intensity", text="Intensity") + + col = split.column() + col.active = (not mat.shadeless) + col.itemR(mat, "diffuse_shader", text="") + col.itemR(mat, "use_diffuse_ramp", text="Ramp") + + col = layout.column() + col.active = (not mat.shadeless) + if mat.diffuse_shader == 'OREN_NAYAR': + col.itemR(mat, "roughness") + elif mat.diffuse_shader == 'MINNAERT': + col.itemR(mat, "darkness") + elif mat.diffuse_shader == 'TOON': + row = col.row() + row.itemR(mat, "diffuse_toon_size", text="Size") + row.itemR(mat, "diffuse_toon_smooth", text="Smooth") + elif mat.diffuse_shader == 'FRESNEL': + row = col.row() + row.itemR(mat, "diffuse_fresnel", text="Fresnel") + row.itemR(mat, "diffuse_fresnel_factor", text="Factor") + + if mat.use_diffuse_ramp: + layout.itemS() + layout.template_color_ramp(mat, "diffuse_ramp", expand=True) + layout.itemS() + row = layout.row() + split = row.split(percentage=0.3) + split.itemL(text="Input:") + split.itemR(mat, "diffuse_ramp_input", text="") + split = row.split(percentage=0.3) + split.itemL(text="Blend:") + split.itemR(mat, "diffuse_ramp_blend", text="") + row = layout.row() + row.itemR(mat, "diffuse_ramp_factor", text="Factor") class MATERIAL_PT_specular(MaterialButtonsPanel): - bl_label = "Specular" - COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) + bl_label = "Specular" + COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME']) - def poll(self, context): - mat = active_node_mat(context.material) - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) + def poll(self, context): + mat = active_node_mat(context.material) + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) - def draw(self, context): - layout = self.layout - - mat = active_node_mat(context.material) - - layout.active = (not mat.shadeless) - - split = layout.split() - - col = split.column() - col.itemR(mat, "specular_color", text="") - col.itemR(mat, "specular_intensity", text="Intensity") + def draw(self, context): + layout = self.layout - col = split.column() - col.itemR(mat, "specular_shader", text="") - col.itemR(mat, "use_specular_ramp", text="Ramp") + mat = active_node_mat(context.material) + + layout.active = (not mat.shadeless) + + split = layout.split() + + col = split.column() + col.itemR(mat, "specular_color", text="") + col.itemR(mat, "specular_intensity", text="Intensity") + + col = split.column() + col.itemR(mat, "specular_shader", text="") + col.itemR(mat, "use_specular_ramp", text="Ramp") + + col = layout.column() + if mat.specular_shader in ('COOKTORR', 'PHONG'): + col.itemR(mat, "specular_hardness", text="Hardness") + elif mat.specular_shader == 'BLINN': + row = col.row() + row.itemR(mat, "specular_hardness", text="Hardness") + row.itemR(mat, "specular_ior", text="IOR") + elif mat.specular_shader == 'WARDISO': + col.itemR(mat, "specular_slope", text="Slope") + elif mat.specular_shader == 'TOON': + row = col.row() + row.itemR(mat, "specular_toon_size", text="Size") + row.itemR(mat, "specular_toon_smooth", text="Smooth") + + if mat.use_specular_ramp: + layout.itemS() + layout.template_color_ramp(mat, "specular_ramp", expand=True) + layout.itemS() + row = layout.row() + split = row.split(percentage=0.3) + split.itemL(text="Input:") + split.itemR(mat, "specular_ramp_input", text="") + split = row.split(percentage=0.3) + split.itemL(text="Blend:") + split.itemR(mat, "specular_ramp_blend", text="") + row = layout.row() + row.itemR(mat, "specular_ramp_factor", text="Factor") - col = layout.column() - if mat.specular_shader in ('COOKTORR', 'PHONG'): - col.itemR(mat, "specular_hardness", text="Hardness") - elif mat.specular_shader == 'BLINN': - row = col.row() - row.itemR(mat, "specular_hardness", text="Hardness") - row.itemR(mat, "specular_ior", text="IOR") - elif mat.specular_shader == 'WARDISO': - col.itemR(mat, "specular_slope", text="Slope") - elif mat.specular_shader == 'TOON': - row = col.row() - row.itemR(mat, "specular_toon_size", text="Size") - row.itemR(mat, "specular_toon_smooth", text="Smooth") - - if mat.use_specular_ramp: - layout.itemS() - layout.template_color_ramp(mat, "specular_ramp", expand=True) - layout.itemS() - row = layout.row() - split = row.split(percentage=0.3) - split.itemL(text="Input:") - split.itemR(mat, "specular_ramp_input", text="") - split = row.split(percentage=0.3) - split.itemL(text="Blend:") - split.itemR(mat, "specular_ramp_blend", text="") - row = layout.row() - row.itemR(mat, "specular_ramp_factor", text="Factor") - class MATERIAL_PT_sss(MaterialButtonsPanel): - bl_label = "Subsurface Scattering" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - mat = active_node_mat(context.material) - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) + bl_label = "Subsurface Scattering" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw_header(self, context): - mat = active_node_mat(context.material) - sss = mat.subsurface_scattering - - self.layout.active = (not mat.shadeless) - self.layout.itemR(sss, "enabled", text="") - - def draw(self, context): - layout = self.layout - - mat = active_node_mat(context.material) - sss = mat.subsurface_scattering + def poll(self, context): + mat = active_node_mat(context.material) + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) - layout.active = sss.enabled - - split = layout.split() - split.active = (not mat.shadeless) - - col = split.column() - col.itemR(sss, "ior") - col.itemR(sss, "scale") - col.itemR(sss, "color", text="") - col.itemR(sss, "radius", text="RGB Radius") - - col = split.column() - sub = col.column(align=True) - sub.itemL(text="Blend:") - sub.itemR(sss, "color_factor", text="Color") - sub.itemR(sss, "texture_factor", text="Texture") - sub.itemL(text="Scattering Weight:") - sub.itemR(sss, "front") - sub.itemR(sss, "back") - col.itemS() - col.itemR(sss, "error_tolerance", text="Error") + def draw_header(self, context): + mat = active_node_mat(context.material) + sss = mat.subsurface_scattering + + self.layout.active = (not mat.shadeless) + self.layout.itemR(sss, "enabled", text="") + + def draw(self, context): + layout = self.layout + + mat = active_node_mat(context.material) + sss = mat.subsurface_scattering + + layout.active = sss.enabled + + split = layout.split() + split.active = (not mat.shadeless) + + col = split.column() + col.itemR(sss, "ior") + col.itemR(sss, "scale") + col.itemR(sss, "color", text="") + col.itemR(sss, "radius", text="RGB Radius") + + col = split.column() + sub = col.column(align=True) + sub.itemL(text="Blend:") + sub.itemR(sss, "color_factor", text="Color") + sub.itemR(sss, "texture_factor", text="Texture") + sub.itemL(text="Scattering Weight:") + sub.itemR(sss, "front") + sub.itemR(sss, "back") + col.itemS() + col.itemR(sss, "error_tolerance", text="Error") class MATERIAL_PT_mirror(MaterialButtonsPanel): - bl_label = "Mirror" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - mat = active_node_mat(context.material) - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) - - def draw_header(self, context): - raym = active_node_mat(context.material).raytrace_mirror + bl_label = "Mirror" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) - self.layout.itemR(raym, "enabled", text="") - - def draw(self, context): - layout = self.layout - - mat = active_node_mat(context.material) - raym = mat.raytrace_mirror - - layout.active = raym.enabled - - split = layout.split() - - col = split.column() - col.itemR(raym, "reflect_factor") - col.itemR(mat, "mirror_color", text="") + def poll(self, context): + mat = active_node_mat(context.material) + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) - col = split.column() - col.itemR(raym, "fresnel") - sub = col.column() - sub.active = raym.fresnel > 0 - sub.itemR(raym, "fresnel_factor", text="Blend") - - split = layout.split() - - col = split.column() - col.itemS() - col.itemR(raym, "distance", text="Max Dist") - col.itemR(raym, "depth") - col.itemS() - sub = col.split(percentage=0.4) - sub.itemL(text="Fade To:") - sub.itemR(raym, "fade_to", text="") - - col = split.column() - col.itemL(text="Gloss:") - col.itemR(raym, "gloss_factor", text="Amount") - sub = col.column() - sub.active = raym.gloss_factor < 1.0 - sub.itemR(raym, "gloss_threshold", text="Threshold") - sub.itemR(raym, "gloss_samples", text="Samples") - sub.itemR(raym, "gloss_anisotropic", text="Anisotropic") + def draw_header(self, context): + raym = active_node_mat(context.material).raytrace_mirror + + self.layout.itemR(raym, "enabled", text="") + + def draw(self, context): + layout = self.layout + + mat = active_node_mat(context.material) + raym = mat.raytrace_mirror + + layout.active = raym.enabled + + split = layout.split() + + col = split.column() + col.itemR(raym, "reflect_factor") + col.itemR(mat, "mirror_color", text="") + + col = split.column() + col.itemR(raym, "fresnel") + sub = col.column() + sub.active = raym.fresnel > 0 + sub.itemR(raym, "fresnel_factor", text="Blend") + + split = layout.split() + + col = split.column() + col.itemS() + col.itemR(raym, "distance", text="Max Dist") + col.itemR(raym, "depth") + col.itemS() + sub = col.split(percentage=0.4) + sub.itemL(text="Fade To:") + sub.itemR(raym, "fade_to", text="") + + col = split.column() + col.itemL(text="Gloss:") + col.itemR(raym, "gloss_factor", text="Amount") + sub = col.column() + sub.active = raym.gloss_factor < 1.0 + sub.itemR(raym, "gloss_threshold", text="Threshold") + sub.itemR(raym, "gloss_samples", text="Samples") + sub.itemR(raym, "gloss_anisotropic", text="Anisotropic") class MATERIAL_PT_transp(MaterialButtonsPanel): - bl_label= "Transparency" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - mat = active_node_mat(context.material) - engine = context.scene.render_data.engine - return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) + bl_label= "Transparency" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw_header(self, context): - mat = active_node_mat(context.material) + def poll(self, context): + mat = active_node_mat(context.material) + engine = context.scene.render_data.engine + return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in self.COMPAT_ENGINES) - self.layout.itemR(mat, "transparency", text="") + def draw_header(self, context): + mat = active_node_mat(context.material) - def draw(self, context): - layout = self.layout - - mat = active_node_mat(context.material) - rayt = mat.raytrace_transparency - - row = layout.row() - row.active = mat.transparency and (not mat.shadeless) - row.itemR(mat, "transparency_method", expand=True) - - split = layout.split() - - col = split.column() - col.itemR(mat, "alpha") - row = col.row() - row.active = mat.transparency and (not mat.shadeless) - row.itemR(mat, "specular_alpha", text="Specular") + self.layout.itemR(mat, "transparency", text="") - col = split.column() - col.active = (not mat.shadeless) - col.itemR(rayt, "fresnel") - sub = col.column() - sub.active = rayt.fresnel > 0 - sub.itemR(rayt, "fresnel_factor", text="Blend") + def draw(self, context): + layout = self.layout - if mat.transparency_method == 'RAYTRACE': - layout.itemS() - split = layout.split() - split.active = mat.transparency + mat = active_node_mat(context.material) + rayt = mat.raytrace_transparency - col = split.column() - col.itemR(rayt, "ior") - col.itemR(rayt, "filter") - col.itemR(rayt, "falloff") - col.itemR(rayt, "limit") - col.itemR(rayt, "depth") - - col = split.column() - col.itemL(text="Gloss:") - col.itemR(rayt, "gloss_factor", text="Amount") - sub = col.column() - sub.active = rayt.gloss_factor < 1.0 - sub.itemR(rayt, "gloss_threshold", text="Threshold") - sub.itemR(rayt, "gloss_samples", text="Samples") + row = layout.row() + row.active = mat.transparency and (not mat.shadeless) + row.itemR(mat, "transparency_method", expand=True) + + split = layout.split() + + col = split.column() + col.itemR(mat, "alpha") + row = col.row() + row.active = mat.transparency and (not mat.shadeless) + row.itemR(mat, "specular_alpha", text="Specular") + + col = split.column() + col.active = (not mat.shadeless) + col.itemR(rayt, "fresnel") + sub = col.column() + sub.active = rayt.fresnel > 0 + sub.itemR(rayt, "fresnel_factor", text="Blend") + + if mat.transparency_method == 'RAYTRACE': + layout.itemS() + split = layout.split() + split.active = mat.transparency + + col = split.column() + col.itemR(rayt, "ior") + col.itemR(rayt, "filter") + col.itemR(rayt, "falloff") + col.itemR(rayt, "limit") + col.itemR(rayt, "depth") + + col = split.column() + col.itemL(text="Gloss:") + col.itemR(rayt, "gloss_factor", text="Amount") + sub = col.column() + sub.active = rayt.gloss_factor < 1.0 + sub.itemR(rayt, "gloss_threshold", text="Threshold") + sub.itemR(rayt, "gloss_samples", text="Samples") class MATERIAL_PT_halo(MaterialButtonsPanel): - bl_label= "Halo" - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - mat = context.material - engine = context.scene.render_data.engine - return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES) - - def draw(self, context): - layout = self.layout - - mat = context.material # dont use node material - halo = mat.halo + bl_label= "Halo" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - split = layout.split() - - col = split.column() - col.itemR(mat, "diffuse_color", text="") - col.itemR(halo, "size") - col.itemR(halo, "hardness") - col.itemR(halo, "add") - col.itemL(text="Options:") - col.itemR(halo, "texture") - col.itemR(halo, "vertex_normal") - col.itemR(halo, "xalpha") - col.itemR(halo, "shaded") - col.itemR(halo, "soft") + def poll(self, context): + mat = context.material + engine = context.scene.render_data.engine + return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES) + + def draw(self, context): + layout = self.layout + + mat = context.material # dont use node material + halo = mat.halo + + split = layout.split() + + col = split.column() + col.itemR(mat, "diffuse_color", text="") + col.itemR(halo, "size") + col.itemR(halo, "hardness") + col.itemR(halo, "add") + col.itemL(text="Options:") + col.itemR(halo, "texture") + col.itemR(halo, "vertex_normal") + col.itemR(halo, "xalpha") + col.itemR(halo, "shaded") + col.itemR(halo, "soft") + + col = split.column() + col.itemR(halo, "ring") + sub = col.column() + sub.active = halo.ring + sub.itemR(halo, "rings") + sub.itemR(mat, "mirror_color", text="") + col.itemS() + col.itemR(halo, "lines") + sub = col.column() + sub.active = halo.lines + sub.itemR(halo, "line_number", text="Lines") + sub.itemR(mat, "specular_color", text="") + col.itemS() + col.itemR(halo, "star") + sub = col.column() + sub.active = halo.star + sub.itemR(halo, "star_tips") - col = split.column() - col.itemR(halo, "ring") - sub = col.column() - sub.active = halo.ring - sub.itemR(halo, "rings") - sub.itemR(mat, "mirror_color", text="") - col.itemS() - col.itemR(halo, "lines") - sub = col.column() - sub.active = halo.lines - sub.itemR(halo, "line_number", text="Lines") - sub.itemR(mat, "specular_color", text="") - col.itemS() - col.itemR(halo, "star") - sub = col.column() - sub.active = halo.star - sub.itemR(halo, "star_tips") - class MATERIAL_PT_flare(MaterialButtonsPanel): - bl_label= "Flare" - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - mat = context.material - engine = context.scene.render_data.engine - return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES) - - def draw_header(self, context): - halo = context.material.halo + bl_label= "Flare" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - self.layout.itemR(halo, "flare_mode", text="") - - def draw(self, context): - layout = self.layout - - mat = context.material # dont use node material - halo = mat.halo + def poll(self, context): + mat = context.material + engine = context.scene.render_data.engine + return mat and (mat.type == 'HALO') and (engine in self.COMPAT_ENGINES) + + def draw_header(self, context): + halo = context.material.halo + + self.layout.itemR(halo, "flare_mode", text="") + + def draw(self, context): + layout = self.layout + + mat = context.material # dont use node material + halo = mat.halo + + layout.active = halo.flare_mode + + split = layout.split() + + col = split.column() + col.itemR(halo, "flare_size", text="Size") + col.itemR(halo, "flare_boost", text="Boost") + col.itemR(halo, "flare_seed", text="Seed") + col = split.column() + col.itemR(halo, "flares_sub", text="Subflares") + col.itemR(halo, "flare_subsize", text="Subsize") - layout.active = halo.flare_mode - - split = layout.split() - - col = split.column() - col.itemR(halo, "flare_size", text="Size") - col.itemR(halo, "flare_boost", text="Boost") - col.itemR(halo, "flare_seed", text="Seed") - col = split.column() - col.itemR(halo, "flares_sub", text="Subflares") - col.itemR(halo, "flare_subsize", text="Subsize") - bpy.types.register(MATERIAL_PT_context_material) bpy.types.register(MATERIAL_PT_preview) bpy.types.register(MATERIAL_PT_diffuse) @@ -624,122 +624,122 @@ bpy.types.register(MATERIAL_PT_shadow) # Volumetrics class VolumeButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "material" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "material" - def poll(self, context): - mat = context.material - engine = context.scene.render_data.engine - return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES) + def poll(self, context): + mat = context.material + engine = context.scene.render_data.engine + return mat and (mat.type == 'VOLUME') and (engine in self.COMPAT_ENGINES) class MATERIAL_PT_volume_density(VolumeButtonsPanel): - bl_label = "Density" - bl_default_closed = False - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Density" + bl_default_closed = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - vol = context.material.volume # dont use node material - - split = layout.split() - row = split.row() - row.itemR(vol, "density") - row.itemR(vol, "density_scale") + vol = context.material.volume # dont use node material + + split = layout.split() + row = split.row() + row.itemR(vol, "density") + row.itemR(vol, "density_scale") class MATERIAL_PT_volume_shading(VolumeButtonsPanel): - bl_label = "Shading" - bl_default_closed = False - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Shading" + bl_default_closed = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - vol = context.material.volume # dont use node material - - split = layout.split() - - col = split.column() - col.itemR(vol, "scattering") - col.itemR(vol, "asymmetry") - col.itemR(vol, "transmission_color") - - col = split.column() - sub = col.column(align=True) - sub.itemR(vol, "emission") - sub.itemR(vol, "emission_color", text="") - sub = col.column(align=True) - sub.itemR(vol, "reflection") - sub.itemR(vol, "reflection_color", text="") + vol = context.material.volume # dont use node material + + split = layout.split() + + col = split.column() + col.itemR(vol, "scattering") + col.itemR(vol, "asymmetry") + col.itemR(vol, "transmission_color") + + col = split.column() + sub = col.column(align=True) + sub.itemR(vol, "emission") + sub.itemR(vol, "emission_color", text="") + sub = col.column(align=True) + sub.itemR(vol, "reflection") + sub.itemR(vol, "reflection_color", text="") class MATERIAL_PT_volume_lighting(VolumeButtonsPanel): - bl_label = "Lighting" - bl_default_closed = False - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Lighting" + bl_default_closed = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout - - vol = context.material.volume # dont use node material - - split = layout.split() - - col = split.column() - col.itemR(vol, "lighting_mode", text="") - - col = split.column() - - if vol.lighting_mode == 'SHADED': - col.itemR(vol, "external_shadows") - col.itemR(vol, "light_cache") - sub = col.column() - sub.active = vol.light_cache - sub.itemR(vol, "cache_resolution") - elif vol.lighting_mode in ('MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'): - sub = col.column() - sub.enabled = True - sub.active = False - sub.itemR(vol, "light_cache") - col.itemR(vol, "cache_resolution") - - sub = col.column(align=True) - sub.itemR(vol, "ms_diffusion") - sub.itemR(vol, "ms_spread") - sub.itemR(vol, "ms_intensity") + def draw(self, context): + layout = self.layout + + vol = context.material.volume # dont use node material + + split = layout.split() + + col = split.column() + col.itemR(vol, "lighting_mode", text="") + + col = split.column() + + if vol.lighting_mode == 'SHADED': + col.itemR(vol, "external_shadows") + col.itemR(vol, "light_cache") + sub = col.column() + sub.active = vol.light_cache + sub.itemR(vol, "cache_resolution") + elif vol.lighting_mode in ('MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'): + sub = col.column() + sub.enabled = True + sub.active = False + sub.itemR(vol, "light_cache") + col.itemR(vol, "cache_resolution") + + sub = col.column(align=True) + sub.itemR(vol, "ms_diffusion") + sub.itemR(vol, "ms_spread") + sub.itemR(vol, "ms_intensity") class MATERIAL_PT_volume_transp(VolumeButtonsPanel): - bl_label= "Transparency" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label= "Transparency" + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def draw(self, context): + layout = self.layout + + mat = context.material # dont use node material + + layout.itemR(mat, "transparency_method", expand=True) - def draw(self, context): - layout = self.layout - - mat = context.material # dont use node material - - layout.itemR(mat, "transparency_method", expand=True) - class MATERIAL_PT_volume_integration(VolumeButtonsPanel): - bl_label = "Integration" - bl_default_closed = False - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Integration" + bl_default_closed = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - vol = context.material.volume # dont use node material - - split = layout.split() - - col = split.column() - col.itemL(text="Step Calculation:") - col.itemR(vol, "step_calculation", text="") - col = col.column(align=True) - col.itemR(vol, "step_size") - - col = split.column() - col.itemL() - col.itemR(vol, "depth_cutoff") + vol = context.material.volume # dont use node material + + split = layout.split() + + col = split.column() + col.itemL(text="Step Calculation:") + col.itemR(vol, "step_calculation", text="") + col = col.column(align=True) + col.itemR(vol, "step_size") + + col = split.column() + col.itemL() + col.itemR(vol, "depth_cutoff") bpy.types.register(MATERIAL_PT_volume_density) bpy.types.register(MATERIAL_PT_volume_shading) diff --git a/release/scripts/ui/buttons_object.py b/release/scripts/ui/buttons_object.py index 213fbf17dd6..a5705277a6e 100644 --- a/release/scripts/ui/buttons_object.py +++ b/release/scripts/ui/buttons_object.py @@ -2,219 +2,219 @@ import bpy class ObjectButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "object" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "object" class OBJECT_PT_context_object(ObjectButtonsPanel): - bl_label = "" - bl_show_header = False + bl_label = "" + bl_show_header = False - def draw(self, context): - layout = self.layout - - ob = context.object - - row = layout.row() - row.itemL(text="", icon='ICON_OBJECT_DATA') - row.itemR(ob, "name", text="") + def draw(self, context): + layout = self.layout + + ob = context.object + + row = layout.row() + row.itemL(text="", icon='ICON_OBJECT_DATA') + row.itemR(ob, "name", text="") class OBJECT_PT_transform(ObjectButtonsPanel): - bl_label = "Transform" + bl_label = "Transform" + + def draw(self, context): + layout = self.layout + + ob = context.object + + row = layout.row() + + row.column().itemR(ob, "location") + if ob.rotation_mode == 'QUATERNION': + row.column().itemR(ob, "rotation_quaternion", text="Rotation") + elif ob.rotation_mode == 'AXIS_ANGLE': + #row.column().itemL(text="Rotation") + #row.column().itemR(pchan, "rotation_angle", text="Angle") + #row.column().itemR(pchan, "rotation_axis", text="Axis") + row.column().itemR(ob, "rotation_axis_angle", text="Rotation") + else: + row.column().itemR(ob, "rotation_euler", text="Rotation") + + row.column().itemR(ob, "scale") + + layout.itemR(ob, "rotation_mode") - def draw(self, context): - layout = self.layout - - ob = context.object - - row = layout.row() - - row.column().itemR(ob, "location") - if ob.rotation_mode == 'QUATERNION': - row.column().itemR(ob, "rotation_quaternion", text="Rotation") - elif ob.rotation_mode == 'AXIS_ANGLE': - #row.column().itemL(text="Rotation") - #row.column().itemR(pchan, "rotation_angle", text="Angle") - #row.column().itemR(pchan, "rotation_axis", text="Axis") - row.column().itemR(ob, "rotation_axis_angle", text="Rotation") - else: - row.column().itemR(ob, "rotation_euler", text="Rotation") - - row.column().itemR(ob, "scale") - - layout.itemR(ob, "rotation_mode") - class OBJECT_PT_transform_locks(ObjectButtonsPanel): - bl_label = "Transform Locks" - bl_default_closed = True - - def draw(self, context): - layout = self.layout - - ob = context.object - - row = layout.row() - - col = row.column() - col.itemR(ob, "lock_location") - - col = row.column() - if ob.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'): - col.itemR(ob, "lock_rotations_4d", text="Lock Rotation") - if ob.lock_rotations_4d: - col.itemR(ob, "lock_rotation_w", text="W") - col.itemR(ob, "lock_rotation", text="") - else: - col.itemR(ob, "lock_rotation", text="Rotation") - - row.column().itemR(ob, "lock_scale") + bl_label = "Transform Locks" + bl_default_closed = True + + def draw(self, context): + layout = self.layout + + ob = context.object + + row = layout.row() + + col = row.column() + col.itemR(ob, "lock_location") + + col = row.column() + if ob.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'): + col.itemR(ob, "lock_rotations_4d", text="Lock Rotation") + if ob.lock_rotations_4d: + col.itemR(ob, "lock_rotation_w", text="W") + col.itemR(ob, "lock_rotation", text="") + else: + col.itemR(ob, "lock_rotation", text="Rotation") + + row.column().itemR(ob, "lock_scale") class OBJECT_PT_relations(ObjectButtonsPanel): - bl_label = "Relations" + bl_label = "Relations" - def draw(self, context): - layout = self.layout - - ob = context.object + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - col.itemR(ob, "layers") - col.itemS() - col.itemR(ob, "pass_index") + ob = context.object - col = split.column() - col.itemL(text="Parent:") - col.itemR(ob, "parent", text="") + split = layout.split() - sub = col.column() - split = sub.split(percentage=0.3) - split.itemL(text="Type:") - split.itemR(ob, "parent_type", text="") - parent = ob.parent - if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE': - sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="") - sub.active = parent != None + col = split.column() + col.itemR(ob, "layers") + col.itemS() + col.itemR(ob, "pass_index") + + col = split.column() + col.itemL(text="Parent:") + col.itemR(ob, "parent", text="") + + sub = col.column() + split = sub.split(percentage=0.3) + split.itemL(text="Type:") + split.itemR(ob, "parent_type", text="") + parent = ob.parent + if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE': + sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="") + sub.active = parent != None class OBJECT_PT_groups(ObjectButtonsPanel): - bl_label = "Groups" + bl_label = "Groups" - def draw(self, context): - layout = self.layout - - ob = context.object + def draw(self, context): + layout = self.layout - split = layout.split() - split.item_menu_enumO("object.group_add", "group", text="Add to Group") - split.itemL() + ob = context.object - for group in bpy.data.groups: - if ob.name in group.objects: - col = layout.column(align=True) + split = layout.split() + split.item_menu_enumO("object.group_add", "group", text="Add to Group") + split.itemL() - col.set_context_pointer("group", group) + for group in bpy.data.groups: + if ob.name in group.objects: + col = layout.column(align=True) - row = col.box().row() - row.itemR(group, "name", text="") - row.itemO("object.group_remove", text="", icon='VICON_X') + col.set_context_pointer("group", group) - split = col.box().split() - split.column().itemR(group, "layer", text="Dupli") - split.column().itemR(group, "dupli_offset", text="") + row = col.box().row() + row.itemR(group, "name", text="") + row.itemO("object.group_remove", text="", icon='VICON_X') + + split = col.box().split() + split.column().itemR(group, "layer", text="Dupli") + split.column().itemR(group, "dupli_offset", text="") class OBJECT_PT_display(ObjectButtonsPanel): - bl_label = "Display" + bl_label = "Display" - def draw(self, context): - layout = self.layout - - ob = context.object - - split = layout.split() - col = split.column() - col.itemR(ob, "max_draw_type", text="Type") - col = split.column() - row = col.row() - row.itemR(ob, "draw_bounds", text="Bounds") - sub = row.row() - sub.active = ob.draw_bounds - sub.itemR(ob, "draw_bounds_type", text="") + def draw(self, context): + layout = self.layout - flow = layout.column_flow() - flow.itemR(ob, "draw_name", text="Name") - flow.itemR(ob, "draw_axis", text="Axis") - flow.itemR(ob, "draw_wire", text="Wire") - flow.itemR(ob, "draw_texture_space", text="Texture Space") - flow.itemR(ob, "x_ray", text="X-Ray") - flow.itemR(ob, "draw_transparent", text="Transparency") + ob = context.object + + split = layout.split() + col = split.column() + col.itemR(ob, "max_draw_type", text="Type") + col = split.column() + row = col.row() + row.itemR(ob, "draw_bounds", text="Bounds") + sub = row.row() + sub.active = ob.draw_bounds + sub.itemR(ob, "draw_bounds_type", text="") + + flow = layout.column_flow() + flow.itemR(ob, "draw_name", text="Name") + flow.itemR(ob, "draw_axis", text="Axis") + flow.itemR(ob, "draw_wire", text="Wire") + flow.itemR(ob, "draw_texture_space", text="Texture Space") + flow.itemR(ob, "x_ray", text="X-Ray") + flow.itemR(ob, "draw_transparent", text="Transparency") class OBJECT_PT_duplication(ObjectButtonsPanel): - bl_label = "Duplication" + bl_label = "Duplication" - def draw(self, context): - layout = self.layout - - ob = context.object + def draw(self, context): + layout = self.layout - layout.itemR(ob, "dupli_type", expand=True) + ob = context.object - if ob.dupli_type == 'FRAMES': - split = layout.split() - - col = split.column(align=True) - col.itemR(ob, "dupli_frames_start", text="Start") - col.itemR(ob, "dupli_frames_end", text="End") - - col = split.column(align=True) - col.itemR(ob, "dupli_frames_on", text="On") - col.itemR(ob, "dupli_frames_off", text="Off") - - layout.itemR(ob, "dupli_frames_no_speed", text="No Speed") + layout.itemR(ob, "dupli_type", expand=True) - elif ob.dupli_type == 'VERTS': - layout.itemR(ob, "dupli_verts_rotation", text="Rotation") + if ob.dupli_type == 'FRAMES': + split = layout.split() - elif ob.dupli_type == 'FACES': - row = layout.row() - row.itemR(ob, "dupli_faces_scale", text="Scale") - row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale") + col = split.column(align=True) + col.itemR(ob, "dupli_frames_start", text="Start") + col.itemR(ob, "dupli_frames_end", text="End") - elif ob.dupli_type == 'GROUP': - layout.itemR(ob, "dupli_group", text="Group") + col = split.column(align=True) + col.itemR(ob, "dupli_frames_on", text="On") + col.itemR(ob, "dupli_frames_off", text="Off") + + layout.itemR(ob, "dupli_frames_no_speed", text="No Speed") + + elif ob.dupli_type == 'VERTS': + layout.itemR(ob, "dupli_verts_rotation", text="Rotation") + + elif ob.dupli_type == 'FACES': + row = layout.row() + row.itemR(ob, "dupli_faces_scale", text="Scale") + row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale") + + elif ob.dupli_type == 'GROUP': + layout.itemR(ob, "dupli_group", text="Group") class OBJECT_PT_animation(ObjectButtonsPanel): - bl_label = "Animation" + bl_label = "Animation" - def draw(self, context): - layout = self.layout - - ob = context.object - - split = layout.split() - - col = split.column() - col.itemL(text="Time Offset:") - col.itemR(ob, "time_offset_edit", text="Edit") - row = col.row() - row.itemR(ob, "time_offset_particle", text="Particle") - row.active = len(ob.particle_systems) != 0 - row = col.row() - row.itemR(ob, "time_offset_parent", text="Parent") - row.active = ob.parent != None - row = col.row() - row.itemR(ob, "slow_parent") - row.active = ob.parent != None - col.itemR(ob, "time_offset", text="Offset") + def draw(self, context): + layout = self.layout - col = split.column() - col.itemL(text="Track:") - col.itemR(ob, "track", text="") - col.itemR(ob, "track_axis", text="Axis") - col.itemR(ob, "up_axis", text="Up Axis") - row = col.row() - row.itemR(ob, "track_override_parent", text="Override Parent") - row.active = ob.parent != None + ob = context.object + + split = layout.split() + + col = split.column() + col.itemL(text="Time Offset:") + col.itemR(ob, "time_offset_edit", text="Edit") + row = col.row() + row.itemR(ob, "time_offset_particle", text="Particle") + row.active = len(ob.particle_systems) != 0 + row = col.row() + row.itemR(ob, "time_offset_parent", text="Parent") + row.active = ob.parent != None + row = col.row() + row.itemR(ob, "slow_parent") + row.active = ob.parent != None + col.itemR(ob, "time_offset", text="Offset") + + col = split.column() + col.itemL(text="Track:") + col.itemR(ob, "track", text="") + col.itemR(ob, "track_axis", text="Axis") + col.itemR(ob, "up_axis", text="Up Axis") + row = col.row() + row.itemR(ob, "track_override_parent", text="Override Parent") + row.active = ob.parent != None bpy.types.register(OBJECT_PT_context_object) bpy.types.register(OBJECT_PT_transform) diff --git a/release/scripts/ui/buttons_object_constraint.py b/release/scripts/ui/buttons_object_constraint.py index 40fc4f7343d..de3db7cbe40 100644 --- a/release/scripts/ui/buttons_object_constraint.py +++ b/release/scripts/ui/buttons_object_constraint.py @@ -2,750 +2,750 @@ import bpy class ConstraintButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "constraint" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "constraint" - def draw_constraint(self, context, con): - layout = self.layout - - box = layout.template_constraint(con) + def draw_constraint(self, context, con): + layout = self.layout - if box: - # match enum type to our functions, avoids a lookup table. - getattr(self, con.type)(context, box, con) - - # show/key buttons here are most likely obsolete now, with - # keyframing functionality being part of every button - if con.type not in ('RIGID_BODY_JOINT', 'NULL'): - box.itemR(con, "influence") - - def space_template(self, layout, con, target=True, owner=True): - if target or owner: - row = layout.row() + box = layout.template_constraint(con) - row.itemL(text="Convert:") + if box: + # match enum type to our functions, avoids a lookup table. + getattr(self, con.type)(context, box, con) - if target: - row.itemR(con, "target_space", text="") + # show/key buttons here are most likely obsolete now, with + # keyframing functionality being part of every button + if con.type not in ('RIGID_BODY_JOINT', 'NULL'): + box.itemR(con, "influence") - if target and owner: - row.itemL(icon='ICON_ARROW_LEFTRIGHT') + def space_template(self, layout, con, target=True, owner=True): + if target or owner: + row = layout.row() - if owner: - row.itemR(con, "owner_space", text="") - - def target_template(self, layout, con, subtargets=True): - layout.itemR(con, "target") # XXX limiting settings for only 'curves' or some type of object - - if con.target and subtargets: - if con.target.type == 'ARMATURE': - layout.item_pointerR(con, "subtarget", con.target.data, "bones", text="Bone") - - if con.type == 'COPY_LOCATION': - row = layout.row() - row.itemL(text="Head/Tail:") - row.itemR(con, "head_tail", text="") - elif con.target.type in ('MESH', 'LATTICE'): - layout.item_pointerR(con, "subtarget", con.target, "vertex_groups", text="Vertex Group") + row.itemL(text="Convert:") - def ik_template(self, layout, con): - # only used for iTaSC - layout.itemR(con, "pole_target") - - if con.pole_target and con.pole_target.type == 'ARMATURE': - layout.item_pointerR(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone") - - if con.pole_target: - row = layout.row() - row.itemL() - row.itemR(con, "pole_angle") - - split = layout.split(percentage=0.33) - col = split.column() - col.itemR(con, "tail") - col.itemR(con, "stretch") + if target: + row.itemR(con, "target_space", text="") - col = split.column() - col.itemR(con, "chain_length") - col.itemR(con, "targetless") + if target and owner: + row.itemL(icon='ICON_ARROW_LEFTRIGHT') - def CHILD_OF(self, context, layout, con): - self.target_template(layout, con) + if owner: + row.itemR(con, "owner_space", text="") - split = layout.split() - - col = split.column() - col.itemL(text="Location:") - col.itemR(con, "locationx", text="X") - col.itemR(con, "locationy", text="Y") - col.itemR(con, "locationz", text="Z") - - col = split.column() - col.itemL(text="Rotation:") - col.itemR(con, "rotationx", text="X") - col.itemR(con, "rotationy", text="Y") - col.itemR(con, "rotationz", text="Z") - - col = split.column() - col.itemL(text="Scale:") - col.itemR(con, "sizex", text="X") - col.itemR(con, "sizey", text="Y") - col.itemR(con, "sizez", text="Z") - - row = layout.row() - row.itemO("constraint.childof_set_inverse") - row.itemO("constraint.childof_clear_inverse") - - def TRACK_TO(self, context, layout, con): - self.target_template(layout, con) - - row = layout.row() - row.itemL(text="To:") - row.itemR(con, "track", expand=True) - - row = layout.row() - #row.itemR(con, "up", text="Up", expand=True) # XXX: up and expand don't play nice together - row.itemR(con, "up", text="Up") - row.itemR(con, "target_z") - - self.space_template(layout, con) - - def IK(self, context, layout, con): - if context.object.pose.ik_solver == "ITASC": - layout.itemR(con, "ik_type") - getattr(self, "IK_"+con.ik_type)(context, layout, con) - else: - # Legacy IK constraint - self.target_template(layout, con) - layout.itemR(con, "pole_target") - - if con.pole_target and con.pole_target.type == 'ARMATURE': - layout.item_pointerR(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone") - - if con.pole_target: - row = layout.row() - row.itemL() - row.itemR(con, "pole_angle") - - split = layout.split() - col = split.column() - col.itemR(con, "tail") - col.itemR(con, "stretch") + def target_template(self, layout, con, subtargets=True): + layout.itemR(con, "target") # XXX limiting settings for only 'curves' or some type of object - col = split.column() - col.itemR(con, "iterations") - col.itemR(con, "chain_length") - - split = layout.split() - col = split.column() - col.itemL() - col.itemR(con, "targetless") - col.itemR(con, "rotation") + if con.target and subtargets: + if con.target.type == 'ARMATURE': + layout.item_pointerR(con, "subtarget", con.target.data, "bones", text="Bone") - col = split.column() - col.itemL(text="Weight:") - col.itemR(con, "weight", text="Position", slider=True) - sub = col.column() - sub.active = con.rotation - sub.itemR(con, "orient_weight", text="Rotation", slider=True) + if con.type == 'COPY_LOCATION': + row = layout.row() + row.itemL(text="Head/Tail:") + row.itemR(con, "head_tail", text="") + elif con.target.type in ('MESH', 'LATTICE'): + layout.item_pointerR(con, "subtarget", con.target, "vertex_groups", text="Vertex Group") - def IK_COPY_POSE(self, context, layout, con): - self.target_template(layout, con) - self.ik_template(layout, con) - - row = layout.row() - row.itemL(text="Axis Ref:") - row.itemR(con, "axis_reference", expand=True) - split = layout.split(percentage=0.33) - split.row().itemR(con, "position") - row = split.row() - row.itemR(con, "weight", text="Weight", slider=True) - row.active = con.position - split = layout.split(percentage=0.33) - row = split.row() - row.itemL(text="Lock:") - row = split.row() - row.itemR(con, "pos_lock_x", text="X") - row.itemR(con, "pos_lock_y", text="Y") - row.itemR(con, "pos_lock_z", text="Z") - split.active = con.position - - split = layout.split(percentage=0.33) - split.row().itemR(con, "rotation") - row = split.row() - row.itemR(con, "orient_weight", text="Weight", slider=True) - row.active = con.rotation - split = layout.split(percentage=0.33) - row = split.row() - row.itemL(text="Lock:") - row = split.row() - row.itemR(con, "rot_lock_x", text="X") - row.itemR(con, "rot_lock_y", text="Y") - row.itemR(con, "rot_lock_z", text="Z") - split.active = con.rotation - - def IK_DISTANCE(self, context, layout, con): - self.target_template(layout, con) - self.ik_template(layout, con) + def ik_template(self, layout, con): + # only used for iTaSC + layout.itemR(con, "pole_target") - layout.itemR(con, "limit_mode") - row = layout.row() - row.itemR(con, "weight", text="Weight", slider=True) - row.itemR(con, "distance", text="Distance", slider=True) + if con.pole_target and con.pole_target.type == 'ARMATURE': + layout.item_pointerR(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone") - def FOLLOW_PATH(self, context, layout, con): - self.target_template(layout, con) - - split = layout.split() - - col = split.column() - col.itemR(con, "use_curve_follow") - col.itemR(con, "use_curve_radius") - - col = split.column() - col.itemR(con, "use_fixed_position") - if con.use_fixed_position: - col.itemR(con, "offset_factor", text="Offset") - else: - col.itemR(con, "offset") - - row = layout.row() - row.itemL(text="Forward:") - row.itemR(con, "forward", expand=True) - - row = layout.row() - row.itemR(con, "up", text="Up") - row.itemL() - - def LIMIT_ROTATION(self, context, layout, con): - - split = layout.split() - - col = split.column() - col.itemR(con, "use_limit_x") - sub = col.column() - sub.active = con.use_limit_x - sub.itemR(con, "minimum_x", text="Min") - sub.itemR(con, "maximum_x", text="Max") - - col = split.column() - col.itemR(con, "use_limit_y") - sub = col.column() - sub.active = con.use_limit_y - sub.itemR(con, "minimum_y", text="Min") - sub.itemR(con, "maximum_y", text="Max") - - col = split.column() - col.itemR(con, "use_limit_z") - sub = col.column() - sub.active = con.use_limit_z - sub.itemR(con, "minimum_z", text="Min") - sub.itemR(con, "maximum_z", text="Max") - - row = layout.row() - row.itemR(con, "limit_transform") - row.itemL() - - row = layout.row() - row.itemL(text="Convert:") - row.itemR(con, "owner_space", text="") - - def LIMIT_LOCATION(self, context, layout, con): - split = layout.split() - - col = split.column() - col.itemR(con, "use_minimum_x") - sub = col.column() - sub.active = con.use_minimum_x - sub.itemR(con, "minimum_x", text="") - col.itemR(con, "use_maximum_x") - sub = col.column() - sub.active = con.use_maximum_x - sub.itemR(con, "maximum_x", text="") - - col = split.column() - col.itemR(con, "use_minimum_y") - sub = col.column() - sub.active = con.use_minimum_y - sub.itemR(con, "minimum_y", text="") - col.itemR(con, "use_maximum_y") - sub = col.column() - sub.active = con.use_maximum_y - sub.itemR(con, "maximum_y", text="") - - col = split.column() - col.itemR(con, "use_minimum_z") - sub = col.column() - sub.active = con.use_minimum_z - sub.itemR(con, "minimum_z", text="") - col.itemR(con, "use_maximum_z") - sub = col.column() - sub.active = con.use_maximum_z - sub.itemR(con, "maximum_z", text="") - - row = layout.row() - row.itemR(con, "limit_transform") - row.itemL() - - row = layout.row() - row.itemL(text="Convert:") - row.itemR(con, "owner_space", text="") - - def LIMIT_SCALE(self, context, layout, con): - split = layout.split() + if con.pole_target: + row = layout.row() + row.itemL() + row.itemR(con, "pole_angle") - col = split.column() - col.itemR(con, "use_minimum_x") - sub = col.column() - sub.active = con.use_minimum_x - sub.itemR(con, "minimum_x", text="") - col.itemR(con, "use_maximum_x") - sub = col.column() - sub.active = con.use_maximum_x - sub.itemR(con, "maximum_x", text="") - - col = split.column() - col.itemR(con, "use_minimum_y") - sub = col.column() - sub.active = con.use_minimum_y - sub.itemR(con, "minimum_y", text="") - col.itemR(con, "use_maximum_y") - sub = col.column() - sub.active = con.use_maximum_y - sub.itemR(con, "maximum_y", text="") - - col = split.column() - col.itemR(con, "use_minimum_z") - sub = col.column() - sub.active = con.use_minimum_z - sub.itemR(con, "minimum_z", text="") - col.itemR(con, "use_maximum_z") - sub = col.column() - sub.active = con.use_maximum_z - sub.itemR(con, "maximum_z", text="") - - row = layout.row() - row.itemR(con, "limit_transform") - row.itemL() - - row = layout.row() - row.itemL(text="Convert:") - row.itemR(con, "owner_space", text="") - - def COPY_ROTATION(self, context, layout, con): - self.target_template(layout, con) - - split = layout.split() - - col = split.column() - col.itemR(con, "rotate_like_x", text="X") - sub = col.column() - sub.active = con.rotate_like_x - sub.itemR(con, "invert_x", text="Invert") - - col = split.column() - col.itemR(con, "rotate_like_y", text="Y") - sub = col.column() - sub.active = con.rotate_like_y - sub.itemR(con, "invert_y", text="Invert") - - col = split.column() - col.itemR(con, "rotate_like_z", text="Z") - sub = col.column() - sub.active = con.rotate_like_z - sub.itemR(con, "invert_z", text="Invert") + split = layout.split(percentage=0.33) + col = split.column() + col.itemR(con, "tail") + col.itemR(con, "stretch") - layout.itemR(con, "offset") - - self.space_template(layout, con) - - def COPY_LOCATION(self, context, layout, con): - self.target_template(layout, con) - - split = layout.split() - - col = split.column() - col.itemR(con, "locate_like_x", text="X") - sub = col.column() - sub.active = con.locate_like_x - sub.itemR(con, "invert_x", text="Invert") - - col = split.column() - col.itemR(con, "locate_like_y", text="Y") - sub = col.column() - sub.active = con.locate_like_y - sub.itemR(con, "invert_y", text="Invert") - - col = split.column() - col.itemR(con, "locate_like_z", text="Z") - sub = col.column() - sub.active = con.locate_like_z - sub.itemR(con, "invert_z", text="Invert") + col = split.column() + col.itemR(con, "chain_length") + col.itemR(con, "targetless") - layout.itemR(con, "offset") - - self.space_template(layout, con) - - def COPY_SCALE(self, context, layout, con): - self.target_template(layout, con) - - row = layout.row(align=True) - row.itemR(con, "size_like_x", text="X") - row.itemR(con, "size_like_y", text="Y") - row.itemR(con, "size_like_z", text="Z") + def CHILD_OF(self, context, layout, con): + self.target_template(layout, con) - layout.itemR(con, "offset") - - self.space_template(layout, con) - - #def SCRIPT(self, context, layout, con): - - def ACTION(self, context, layout, con): - self.target_template(layout, con) - - layout.itemR(con, "action") - layout.itemR(con, "transform_channel") + split = layout.split() - split = layout.split() - - col = split.column(align=True) - col.itemR(con, "start_frame", text="Start") - col.itemR(con, "end_frame", text="End") - - col = split.column(align=True) - col.itemR(con, "minimum", text="Min") - col.itemR(con, "maximum", text="Max") - - row = layout.row() - row.itemL(text="Convert:") - row.itemR(con, "owner_space", text="") - - def LOCKED_TRACK(self, context, layout, con): - self.target_template(layout, con) - - row = layout.row() - row.itemL(text="To:") - row.itemR(con, "track", expand=True) - - row = layout.row() - row.itemL(text="Lock:") - row.itemR(con, "locked", expand=True) - - def LIMIT_DISTANCE(self, context, layout, con): - self.target_template(layout, con) - - col = layout.column(align=True); - col.itemR(con, "distance") - col.itemO("constraint.limitdistance_reset") - - row = layout.row() - row.itemL(text="Clamp Region:") - row.itemR(con, "limit_mode", text="") - - def STRETCH_TO(self, context, layout, con): - self.target_template(layout, con) - - row = layout.row() - row.itemR(con, "original_length", text="Rest Length") - row.itemO("constraint.stretchto_reset", text="Reset") - - col = layout.column() - col.itemR(con, "bulge", text="Volume Variation") - - row = layout.row() - row.itemL(text="Volume:") - row.itemR(con, "volume", expand=True) - row.itemL(text="Plane:") - row.itemR(con, "keep_axis", expand=True) - - def FLOOR(self, context, layout, con): - self.target_template(layout, con) - - row = layout.row() - row.itemR(con, "sticky") - row.itemR(con, "use_rotation") - - layout.itemR(con, "offset") - - row = layout.row() - row.itemL(text="Min/Max:") - row.itemR(con, "floor_location", expand=True) - - def RIGID_BODY_JOINT(self, context, layout, con): - self.target_template(layout, con) - - layout.itemR(con, "pivot_type") - layout.itemR(con, "child") - - row = layout.row() - row.itemR(con, "disable_linked_collision", text="No Collision") - row.itemR(con, "draw_pivot", text="Display Pivot") - - split = layout.split() - - col = split.column(align=True) - col.itemL(text="Pivot:") - col.itemR(con, "pivot_x", text="X") - col.itemR(con, "pivot_y", text="Y") - col.itemR(con, "pivot_z", text="Z") - - col = split.column(align=True) - col.itemL(text="Axis:") - col.itemR(con, "axis_x", text="X") - col.itemR(con, "axis_y", text="Y") - col.itemR(con, "axis_z", text="Z") - - #Missing: Limit arrays (not wrapped in RNA yet) - - def CLAMP_TO(self, context, layout, con): - self.target_template(layout, con) - - row = layout.row() - row.itemL(text="Main Axis:") - row.itemR(con, "main_axis", expand=True) - - row = layout.row() - row.itemR(con, "cyclic") - - def TRANSFORM(self, context, layout, con): - self.target_template(layout, con) - - layout.itemR(con, "extrapolate_motion", text="Extrapolate") - - split = layout.split() - - col = split.column() - col.itemL(text="Source:") - col.row().itemR(con, "map_from", expand=True) - - sub = col.row(align=True) - sub.itemL(text="X:") - sub.itemR(con, "from_min_x", text="") - sub.itemR(con, "from_max_x", text="") - - sub = col.row(align=True) - sub.itemL(text="Y:") - sub.itemR(con, "from_min_y", text="") - sub.itemR(con, "from_max_y", text="") - - sub = col.row(align=True) - sub.itemL(text="Z:") - sub.itemR(con, "from_min_z", text="") - sub.itemR(con, "from_max_z", text="") - - split = layout.split() - - col = split.column() - col.itemL(text="Destination:") - col.row().itemR(con, "map_to", expand=True) + col = split.column() + col.itemL(text="Location:") + col.itemR(con, "locationx", text="X") + col.itemR(con, "locationy", text="Y") + col.itemR(con, "locationz", text="Z") + + col = split.column() + col.itemL(text="Rotation:") + col.itemR(con, "rotationx", text="X") + col.itemR(con, "rotationy", text="Y") + col.itemR(con, "rotationz", text="Z") + + col = split.column() + col.itemL(text="Scale:") + col.itemR(con, "sizex", text="X") + col.itemR(con, "sizey", text="Y") + col.itemR(con, "sizez", text="Z") + + row = layout.row() + row.itemO("constraint.childof_set_inverse") + row.itemO("constraint.childof_clear_inverse") + + def TRACK_TO(self, context, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemL(text="To:") + row.itemR(con, "track", expand=True) + + row = layout.row() + #row.itemR(con, "up", text="Up", expand=True) # XXX: up and expand don't play nice together + row.itemR(con, "up", text="Up") + row.itemR(con, "target_z") + + self.space_template(layout, con) + + def IK(self, context, layout, con): + if context.object.pose.ik_solver == "ITASC": + layout.itemR(con, "ik_type") + getattr(self, "IK_"+con.ik_type)(context, layout, con) + else: + # Legacy IK constraint + self.target_template(layout, con) + layout.itemR(con, "pole_target") + + if con.pole_target and con.pole_target.type == 'ARMATURE': + layout.item_pointerR(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone") + + if con.pole_target: + row = layout.row() + row.itemL() + row.itemR(con, "pole_angle") + + split = layout.split() + col = split.column() + col.itemR(con, "tail") + col.itemR(con, "stretch") + + col = split.column() + col.itemR(con, "iterations") + col.itemR(con, "chain_length") + + split = layout.split() + col = split.column() + col.itemL() + col.itemR(con, "targetless") + col.itemR(con, "rotation") + + col = split.column() + col.itemL(text="Weight:") + col.itemR(con, "weight", text="Position", slider=True) + sub = col.column() + sub.active = con.rotation + sub.itemR(con, "orient_weight", text="Rotation", slider=True) + + def IK_COPY_POSE(self, context, layout, con): + self.target_template(layout, con) + self.ik_template(layout, con) + + row = layout.row() + row.itemL(text="Axis Ref:") + row.itemR(con, "axis_reference", expand=True) + split = layout.split(percentage=0.33) + split.row().itemR(con, "position") + row = split.row() + row.itemR(con, "weight", text="Weight", slider=True) + row.active = con.position + split = layout.split(percentage=0.33) + row = split.row() + row.itemL(text="Lock:") + row = split.row() + row.itemR(con, "pos_lock_x", text="X") + row.itemR(con, "pos_lock_y", text="Y") + row.itemR(con, "pos_lock_z", text="Z") + split.active = con.position + + split = layout.split(percentage=0.33) + split.row().itemR(con, "rotation") + row = split.row() + row.itemR(con, "orient_weight", text="Weight", slider=True) + row.active = con.rotation + split = layout.split(percentage=0.33) + row = split.row() + row.itemL(text="Lock:") + row = split.row() + row.itemR(con, "rot_lock_x", text="X") + row.itemR(con, "rot_lock_y", text="Y") + row.itemR(con, "rot_lock_z", text="Z") + split.active = con.rotation + + def IK_DISTANCE(self, context, layout, con): + self.target_template(layout, con) + self.ik_template(layout, con) + + layout.itemR(con, "limit_mode") + row = layout.row() + row.itemR(con, "weight", text="Weight", slider=True) + row.itemR(con, "distance", text="Distance", slider=True) + + def FOLLOW_PATH(self, context, layout, con): + self.target_template(layout, con) + + split = layout.split() + + col = split.column() + col.itemR(con, "use_curve_follow") + col.itemR(con, "use_curve_radius") + + col = split.column() + col.itemR(con, "use_fixed_position") + if con.use_fixed_position: + col.itemR(con, "offset_factor", text="Offset") + else: + col.itemR(con, "offset") + + row = layout.row() + row.itemL(text="Forward:") + row.itemR(con, "forward", expand=True) + + row = layout.row() + row.itemR(con, "up", text="Up") + row.itemL() + + def LIMIT_ROTATION(self, context, layout, con): + + split = layout.split() + + col = split.column() + col.itemR(con, "use_limit_x") + sub = col.column() + sub.active = con.use_limit_x + sub.itemR(con, "minimum_x", text="Min") + sub.itemR(con, "maximum_x", text="Max") + + col = split.column() + col.itemR(con, "use_limit_y") + sub = col.column() + sub.active = con.use_limit_y + sub.itemR(con, "minimum_y", text="Min") + sub.itemR(con, "maximum_y", text="Max") + + col = split.column() + col.itemR(con, "use_limit_z") + sub = col.column() + sub.active = con.use_limit_z + sub.itemR(con, "minimum_z", text="Min") + sub.itemR(con, "maximum_z", text="Max") + + row = layout.row() + row.itemR(con, "limit_transform") + row.itemL() + + row = layout.row() + row.itemL(text="Convert:") + row.itemR(con, "owner_space", text="") + + def LIMIT_LOCATION(self, context, layout, con): + split = layout.split() + + col = split.column() + col.itemR(con, "use_minimum_x") + sub = col.column() + sub.active = con.use_minimum_x + sub.itemR(con, "minimum_x", text="") + col.itemR(con, "use_maximum_x") + sub = col.column() + sub.active = con.use_maximum_x + sub.itemR(con, "maximum_x", text="") + + col = split.column() + col.itemR(con, "use_minimum_y") + sub = col.column() + sub.active = con.use_minimum_y + sub.itemR(con, "minimum_y", text="") + col.itemR(con, "use_maximum_y") + sub = col.column() + sub.active = con.use_maximum_y + sub.itemR(con, "maximum_y", text="") + + col = split.column() + col.itemR(con, "use_minimum_z") + sub = col.column() + sub.active = con.use_minimum_z + sub.itemR(con, "minimum_z", text="") + col.itemR(con, "use_maximum_z") + sub = col.column() + sub.active = con.use_maximum_z + sub.itemR(con, "maximum_z", text="") + + row = layout.row() + row.itemR(con, "limit_transform") + row.itemL() + + row = layout.row() + row.itemL(text="Convert:") + row.itemR(con, "owner_space", text="") + + def LIMIT_SCALE(self, context, layout, con): + split = layout.split() + + col = split.column() + col.itemR(con, "use_minimum_x") + sub = col.column() + sub.active = con.use_minimum_x + sub.itemR(con, "minimum_x", text="") + col.itemR(con, "use_maximum_x") + sub = col.column() + sub.active = con.use_maximum_x + sub.itemR(con, "maximum_x", text="") + + col = split.column() + col.itemR(con, "use_minimum_y") + sub = col.column() + sub.active = con.use_minimum_y + sub.itemR(con, "minimum_y", text="") + col.itemR(con, "use_maximum_y") + sub = col.column() + sub.active = con.use_maximum_y + sub.itemR(con, "maximum_y", text="") + + col = split.column() + col.itemR(con, "use_minimum_z") + sub = col.column() + sub.active = con.use_minimum_z + sub.itemR(con, "minimum_z", text="") + col.itemR(con, "use_maximum_z") + sub = col.column() + sub.active = con.use_maximum_z + sub.itemR(con, "maximum_z", text="") + + row = layout.row() + row.itemR(con, "limit_transform") + row.itemL() + + row = layout.row() + row.itemL(text="Convert:") + row.itemR(con, "owner_space", text="") + + def COPY_ROTATION(self, context, layout, con): + self.target_template(layout, con) + + split = layout.split() + + col = split.column() + col.itemR(con, "rotate_like_x", text="X") + sub = col.column() + sub.active = con.rotate_like_x + sub.itemR(con, "invert_x", text="Invert") + + col = split.column() + col.itemR(con, "rotate_like_y", text="Y") + sub = col.column() + sub.active = con.rotate_like_y + sub.itemR(con, "invert_y", text="Invert") + + col = split.column() + col.itemR(con, "rotate_like_z", text="Z") + sub = col.column() + sub.active = con.rotate_like_z + sub.itemR(con, "invert_z", text="Invert") + + layout.itemR(con, "offset") + + self.space_template(layout, con) + + def COPY_LOCATION(self, context, layout, con): + self.target_template(layout, con) + + split = layout.split() + + col = split.column() + col.itemR(con, "locate_like_x", text="X") + sub = col.column() + sub.active = con.locate_like_x + sub.itemR(con, "invert_x", text="Invert") + + col = split.column() + col.itemR(con, "locate_like_y", text="Y") + sub = col.column() + sub.active = con.locate_like_y + sub.itemR(con, "invert_y", text="Invert") + + col = split.column() + col.itemR(con, "locate_like_z", text="Z") + sub = col.column() + sub.active = con.locate_like_z + sub.itemR(con, "invert_z", text="Invert") + + layout.itemR(con, "offset") + + self.space_template(layout, con) + + def COPY_SCALE(self, context, layout, con): + self.target_template(layout, con) + + row = layout.row(align=True) + row.itemR(con, "size_like_x", text="X") + row.itemR(con, "size_like_y", text="Y") + row.itemR(con, "size_like_z", text="Z") + + layout.itemR(con, "offset") + + self.space_template(layout, con) + + #def SCRIPT(self, context, layout, con): + + def ACTION(self, context, layout, con): + self.target_template(layout, con) + + layout.itemR(con, "action") + layout.itemR(con, "transform_channel") + + split = layout.split() + + col = split.column(align=True) + col.itemR(con, "start_frame", text="Start") + col.itemR(con, "end_frame", text="End") + + col = split.column(align=True) + col.itemR(con, "minimum", text="Min") + col.itemR(con, "maximum", text="Max") + + row = layout.row() + row.itemL(text="Convert:") + row.itemR(con, "owner_space", text="") + + def LOCKED_TRACK(self, context, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemL(text="To:") + row.itemR(con, "track", expand=True) + + row = layout.row() + row.itemL(text="Lock:") + row.itemR(con, "locked", expand=True) + + def LIMIT_DISTANCE(self, context, layout, con): + self.target_template(layout, con) + + col = layout.column(align=True); + col.itemR(con, "distance") + col.itemO("constraint.limitdistance_reset") + + row = layout.row() + row.itemL(text="Clamp Region:") + row.itemR(con, "limit_mode", text="") + + def STRETCH_TO(self, context, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemR(con, "original_length", text="Rest Length") + row.itemO("constraint.stretchto_reset", text="Reset") + + col = layout.column() + col.itemR(con, "bulge", text="Volume Variation") + + row = layout.row() + row.itemL(text="Volume:") + row.itemR(con, "volume", expand=True) + row.itemL(text="Plane:") + row.itemR(con, "keep_axis", expand=True) + + def FLOOR(self, context, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemR(con, "sticky") + row.itemR(con, "use_rotation") + + layout.itemR(con, "offset") + + row = layout.row() + row.itemL(text="Min/Max:") + row.itemR(con, "floor_location", expand=True) + + def RIGID_BODY_JOINT(self, context, layout, con): + self.target_template(layout, con) + + layout.itemR(con, "pivot_type") + layout.itemR(con, "child") + + row = layout.row() + row.itemR(con, "disable_linked_collision", text="No Collision") + row.itemR(con, "draw_pivot", text="Display Pivot") + + split = layout.split() + + col = split.column(align=True) + col.itemL(text="Pivot:") + col.itemR(con, "pivot_x", text="X") + col.itemR(con, "pivot_y", text="Y") + col.itemR(con, "pivot_z", text="Z") + + col = split.column(align=True) + col.itemL(text="Axis:") + col.itemR(con, "axis_x", text="X") + col.itemR(con, "axis_y", text="Y") + col.itemR(con, "axis_z", text="Z") + + #Missing: Limit arrays (not wrapped in RNA yet) + + def CLAMP_TO(self, context, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemL(text="Main Axis:") + row.itemR(con, "main_axis", expand=True) + + row = layout.row() + row.itemR(con, "cyclic") + + def TRANSFORM(self, context, layout, con): + self.target_template(layout, con) + + layout.itemR(con, "extrapolate_motion", text="Extrapolate") + + split = layout.split() + + col = split.column() + col.itemL(text="Source:") + col.row().itemR(con, "map_from", expand=True) + + sub = col.row(align=True) + sub.itemL(text="X:") + sub.itemR(con, "from_min_x", text="") + sub.itemR(con, "from_max_x", text="") + + sub = col.row(align=True) + sub.itemL(text="Y:") + sub.itemR(con, "from_min_y", text="") + sub.itemR(con, "from_max_y", text="") + + sub = col.row(align=True) + sub.itemL(text="Z:") + sub.itemR(con, "from_min_z", text="") + sub.itemR(con, "from_max_z", text="") + + split = layout.split() + + col = split.column() + col.itemL(text="Destination:") + col.row().itemR(con, "map_to", expand=True) + + sub = col.row(align=True) + sub.itemR(con, "map_to_x_from", text="") + sub.itemR(con, "to_min_x", text="") + sub.itemR(con, "to_max_x", text="") + + sub = col.row(align=True) + sub.itemR(con, "map_to_y_from", text="") + sub.itemR(con, "to_min_y", text="") + sub.itemR(con, "to_max_y", text="") + + sub = col.row(align=True) + sub.itemR(con, "map_to_z_from", text="") + sub.itemR(con, "to_min_z", text="") + sub.itemR(con, "to_max_z", text="") + + self.space_template(layout, con) + + def SHRINKWRAP (self, context, layout, con): + self.target_template(layout, con) + + layout.itemR(con, "distance") + layout.itemR(con, "shrinkwrap_type") + + if con.shrinkwrap_type == 'PROJECT': + row = layout.row(align=True) + row.itemR(con, "axis_x") + row.itemR(con, "axis_y") + row.itemR(con, "axis_z") + + def DAMPED_TRACK(self, context, layout, con): + self.target_template(layout, con) + + row = layout.row() + row.itemL(text="To:") + row.itemR(con, "track", expand=True) - sub = col.row(align=True) - sub.itemR(con, "map_to_x_from", text="") - sub.itemR(con, "to_min_x", text="") - sub.itemR(con, "to_max_x", text="") - - sub = col.row(align=True) - sub.itemR(con, "map_to_y_from", text="") - sub.itemR(con, "to_min_y", text="") - sub.itemR(con, "to_max_y", text="") - - sub = col.row(align=True) - sub.itemR(con, "map_to_z_from", text="") - sub.itemR(con, "to_min_z", text="") - sub.itemR(con, "to_max_z", text="") - - self.space_template(layout, con) - - def SHRINKWRAP (self, context, layout, con): - self.target_template(layout, con) - - layout.itemR(con, "distance") - layout.itemR(con, "shrinkwrap_type") - - if con.shrinkwrap_type == 'PROJECT': - row = layout.row(align=True) - row.itemR(con, "axis_x") - row.itemR(con, "axis_y") - row.itemR(con, "axis_z") - - def DAMPED_TRACK(self, context, layout, con): - self.target_template(layout, con) - - row = layout.row() - row.itemL(text="To:") - row.itemR(con, "track", expand=True) - class OBJECT_PT_constraints(ConstraintButtonsPanel): - bl_label = "Constraints" - bl_context = "constraint" + bl_label = "Constraints" + bl_context = "constraint" - def poll(self, context): - return (context.object) - - def draw(self, context): - layout = self.layout - ob = context.object + def poll(self, context): + return (context.object) - row = layout.row() - row.item_menu_enumO("object.constraint_add", "type") - row.itemL(); + def draw(self, context): + layout = self.layout + ob = context.object - for con in ob.constraints: - self.draw_constraint(context, con) + row = layout.row() + row.item_menu_enumO("object.constraint_add", "type") + row.itemL(); + + for con in ob.constraints: + self.draw_constraint(context, con) class BONE_PT_inverse_kinematics(ConstraintButtonsPanel): - bl_label = "Inverse Kinematics" - bl_default_closed = True - bl_context = "bone_constraint" - - def poll(self, context): - ob = context.object - bone = context.bone + bl_label = "Inverse Kinematics" + bl_default_closed = True + bl_context = "bone_constraint" - if ob and bone: - pchan = ob.pose.pose_channels[bone.name] - return pchan.has_ik - - return False + def poll(self, context): + ob = context.object + bone = context.bone - def draw(self, context): - layout = self.layout - - ob = context.object - bone = context.bone - pchan = ob.pose.pose_channels[bone.name] + if ob and bone: + pchan = ob.pose.pose_channels[bone.name] + return pchan.has_ik - row = layout.row() - row.itemR(ob.pose, "ik_solver") + return False - split = layout.split(percentage=0.25) - split.itemR(pchan, "ik_dof_x", text="X") - row = split.row() - row.itemR(pchan, "ik_stiffness_x", text="Stiffness", slider=True) - row.active = pchan.ik_dof_x + def draw(self, context): + layout = self.layout - split = layout.split(percentage=0.25) - row = split.row() - row.itemR(pchan, "ik_limit_x", text="Limit") - row.active = pchan.ik_dof_x - row = split.row(align=True) - row.itemR(pchan, "ik_min_x", text="") - row.itemR(pchan, "ik_max_x", text="") - row.active = pchan.ik_dof_x and pchan.ik_limit_x + ob = context.object + bone = context.bone + pchan = ob.pose.pose_channels[bone.name] - split = layout.split(percentage=0.25) - split.itemR(pchan, "ik_dof_y", text="Y") - row = split.row() - row.itemR(pchan, "ik_stiffness_y", text="Stiffness", slider=True) - row.active = pchan.ik_dof_y + row = layout.row() + row.itemR(ob.pose, "ik_solver") - split = layout.split(percentage=0.25) - row = split.row() - row.itemR(pchan, "ik_limit_y", text="Limit") - row.active = pchan.ik_dof_y - row = split.row(align=True) - row.itemR(pchan, "ik_min_y", text="") - row.itemR(pchan, "ik_max_y", text="") - row.active = pchan.ik_dof_y and pchan.ik_limit_y + split = layout.split(percentage=0.25) + split.itemR(pchan, "ik_dof_x", text="X") + row = split.row() + row.itemR(pchan, "ik_stiffness_x", text="Stiffness", slider=True) + row.active = pchan.ik_dof_x - split = layout.split(percentage=0.25) - split.itemR(pchan, "ik_dof_z", text="Z") - row = split.row() - row.itemR(pchan, "ik_stiffness_z", text="Stiffness", slider=True) - row.active = pchan.ik_dof_z + split = layout.split(percentage=0.25) + row = split.row() + row.itemR(pchan, "ik_limit_x", text="Limit") + row.active = pchan.ik_dof_x + row = split.row(align=True) + row.itemR(pchan, "ik_min_x", text="") + row.itemR(pchan, "ik_max_x", text="") + row.active = pchan.ik_dof_x and pchan.ik_limit_x - split = layout.split(percentage=0.25) - row = split.row() - row.itemR(pchan, "ik_limit_z", text="Limit") - row.active = pchan.ik_dof_z - row = split.row(align=True) - row.itemR(pchan, "ik_min_z", text="") - row.itemR(pchan, "ik_max_z", text="") - row.active = pchan.ik_dof_z and pchan.ik_limit_z - split = layout.split() - split.itemR(pchan, "ik_stretch", text="Stretch", slider=True) - split.itemL() + split = layout.split(percentage=0.25) + split.itemR(pchan, "ik_dof_y", text="Y") + row = split.row() + row.itemR(pchan, "ik_stiffness_y", text="Stiffness", slider=True) + row.active = pchan.ik_dof_y - if ob.pose.ik_solver == "ITASC": - row = layout.row() - row.itemR(pchan, "ik_rot_control", text="Control Rotation") - row.itemR(pchan, "ik_rot_weight", text="Weight", slider=True) - # not supported yet - #row = layout.row() - #row.itemR(pchan, "ik_lin_control", text="Joint Size") - #row.itemR(pchan, "ik_lin_weight", text="Weight", slider=True) + split = layout.split(percentage=0.25) + row = split.row() + row.itemR(pchan, "ik_limit_y", text="Limit") + row.active = pchan.ik_dof_y + row = split.row(align=True) + row.itemR(pchan, "ik_min_y", text="") + row.itemR(pchan, "ik_max_y", text="") + row.active = pchan.ik_dof_y and pchan.ik_limit_y + + split = layout.split(percentage=0.25) + split.itemR(pchan, "ik_dof_z", text="Z") + row = split.row() + row.itemR(pchan, "ik_stiffness_z", text="Stiffness", slider=True) + row.active = pchan.ik_dof_z + + split = layout.split(percentage=0.25) + row = split.row() + row.itemR(pchan, "ik_limit_z", text="Limit") + row.active = pchan.ik_dof_z + row = split.row(align=True) + row.itemR(pchan, "ik_min_z", text="") + row.itemR(pchan, "ik_max_z", text="") + row.active = pchan.ik_dof_z and pchan.ik_limit_z + split = layout.split() + split.itemR(pchan, "ik_stretch", text="Stretch", slider=True) + split.itemL() + + if ob.pose.ik_solver == "ITASC": + row = layout.row() + row.itemR(pchan, "ik_rot_control", text="Control Rotation") + row.itemR(pchan, "ik_rot_weight", text="Weight", slider=True) + # not supported yet + #row = layout.row() + #row.itemR(pchan, "ik_lin_control", text="Joint Size") + #row.itemR(pchan, "ik_lin_weight", text="Weight", slider=True) class BONE_PT_iksolver_itasc(ConstraintButtonsPanel): - bl_label = "iTaSC parameters" - bl_default_closed = True - bl_context = "bone_constraint" - - def poll(self, context): - ob = context.object - bone = context.bone + bl_label = "iTaSC parameters" + bl_default_closed = True + bl_context = "bone_constraint" - if ob and bone: - pchan = ob.pose.pose_channels[bone.name] - return pchan.has_ik and ob.pose.ik_solver == "ITASC" and ob.pose.ik_param - - return False + def poll(self, context): + ob = context.object + bone = context.bone - def draw(self, context): - layout = self.layout + if ob and bone: + pchan = ob.pose.pose_channels[bone.name] + return pchan.has_ik and ob.pose.ik_solver == "ITASC" and ob.pose.ik_param - ob = context.object - itasc = ob.pose.ik_param + return False - layout.itemR(itasc, "mode", expand=True) - simulation = itasc.mode == "SIMULATION" - if simulation: - layout.itemL(text="Reiteration:") - layout.itemR(itasc, "reiteration", expand=True) - - flow = layout.column_flow() - flow.itemR(itasc, "precision", text="Prec") - flow.itemR(itasc, "num_iter", text="Iter") - flow.active = not simulation or itasc.reiteration != "NEVER" + def draw(self, context): + layout = self.layout - if simulation: - layout.itemR(itasc, "auto_step") - row = layout.row() - if itasc.auto_step: - row.itemR(itasc, "min_step", text="Min") - row.itemR(itasc, "max_step", text="Max") - else: - row.itemR(itasc, "num_step") - - layout.itemR(itasc, "solver") - if simulation: - layout.itemR(itasc, "feedback") - layout.itemR(itasc, "max_velocity") - if itasc.solver == "DLS": - row = layout.row() - row.itemR(itasc, "dampmax", text="Damp", slider=True) - row.itemR(itasc, "dampeps", text="Eps", slider=True) + ob = context.object + itasc = ob.pose.ik_param + + layout.itemR(itasc, "mode", expand=True) + simulation = itasc.mode == "SIMULATION" + if simulation: + layout.itemL(text="Reiteration:") + layout.itemR(itasc, "reiteration", expand=True) + + flow = layout.column_flow() + flow.itemR(itasc, "precision", text="Prec") + flow.itemR(itasc, "num_iter", text="Iter") + flow.active = not simulation or itasc.reiteration != "NEVER" + + if simulation: + layout.itemR(itasc, "auto_step") + row = layout.row() + if itasc.auto_step: + row.itemR(itasc, "min_step", text="Min") + row.itemR(itasc, "max_step", text="Max") + else: + row.itemR(itasc, "num_step") + + layout.itemR(itasc, "solver") + if simulation: + layout.itemR(itasc, "feedback") + layout.itemR(itasc, "max_velocity") + if itasc.solver == "DLS": + row = layout.row() + row.itemR(itasc, "dampmax", text="Damp", slider=True) + row.itemR(itasc, "dampeps", text="Eps", slider=True) class BONE_PT_constraints(ConstraintButtonsPanel): - bl_label = "Constraints" - bl_context = "bone_constraint" + bl_label = "Constraints" + bl_context = "bone_constraint" - def poll(self, context): - ob = context.object - return (ob and ob.type == 'ARMATURE' and context.bone) - - def draw(self, context): - layout = self.layout - - ob = context.object - pchan = ob.pose.pose_channels[context.bone.name] + def poll(self, context): + ob = context.object + return (ob and ob.type == 'ARMATURE' and context.bone) - row = layout.row() - row.item_menu_enumO("pose.constraint_add", "type") - row.itemL(); + def draw(self, context): + layout = self.layout - for con in pchan.constraints: - self.draw_constraint(context, con) + ob = context.object + pchan = ob.pose.pose_channels[context.bone.name] + + row = layout.row() + row.item_menu_enumO("pose.constraint_add", "type") + row.itemL(); + + for con in pchan.constraints: + self.draw_constraint(context, con) bpy.types.register(OBJECT_PT_constraints) bpy.types.register(BONE_PT_iksolver_itasc) diff --git a/release/scripts/ui/buttons_particle.py b/release/scripts/ui/buttons_particle.py index ad9a82c6824..7633787b69b 100644 --- a/release/scripts/ui/buttons_particle.py +++ b/release/scripts/ui/buttons_particle.py @@ -7,938 +7,938 @@ from buttons_physics_common import basic_force_field_settings_ui from buttons_physics_common import basic_force_field_falloff_ui def particle_panel_enabled(context, psys): - return psys.point_cache.baked==False and psys.edited==False and (not context.particle_system_editable) - + return psys.point_cache.baked==False and psys.edited==False and (not context.particle_system_editable) + def particle_panel_poll(context): - psys = context.particle_system - if psys==None: return False - if psys.settings==None: return False - return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') + psys = context.particle_system + if psys==None: return False + if psys.settings==None: return False + return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') class ParticleButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "particle" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "particle" - def poll(self, context): - return particle_panel_poll(context) + def poll(self, context): + return particle_panel_poll(context) class PARTICLE_PT_particles(ParticleButtonsPanel): - bl_label = "" - bl_show_header = False + bl_label = "" + bl_show_header = False - def poll(self, context): - return (context.particle_system or context.object) + def poll(self, context): + return (context.particle_system or context.object) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - ob = context.object - psys = context.particle_system + ob = context.object + psys = context.particle_system - if ob: - row = layout.row() + if ob: + row = layout.row() - row.template_list(ob, "particle_systems", ob, "active_particle_system_index", rows=2) + row.template_list(ob, "particle_systems", ob, "active_particle_system_index", rows=2) - col = row.column(align=True) - col.itemO("object.particle_system_add", icon='ICON_ZOOMIN', text="") - col.itemO("object.particle_system_remove", icon='ICON_ZOOMOUT', text="") + col = row.column(align=True) + col.itemO("object.particle_system_add", icon='ICON_ZOOMIN', text="") + col.itemO("object.particle_system_remove", icon='ICON_ZOOMOUT', text="") - if psys and not psys.settings: - split = layout.split(percentage=0.32) + if psys and not psys.settings: + split = layout.split(percentage=0.32) + + col = split.column() + col.itemL(text="Name:") + col.itemL(text="Settings:") + + col = split.column() + col.itemR(psys, "name", text="") + col.template_ID(psys, "settings", new="particle.new") + elif psys: + part = psys.settings + + split = layout.split(percentage=0.32) + col = split.column() + col.itemL(text="Name:") + if part.type in ('EMITTER', 'REACTOR', 'HAIR'): + col.itemL(text="Settings:") + col.itemL(text="Type:") + + col = split.column() + col.itemR(psys, "name", text="") + if part.type in ('EMITTER', 'REACTOR', 'HAIR'): + col.template_ID(psys, "settings", new="particle.new") + + #row = layout.row() + #row.itemL(text="Viewport") + #row.itemL(text="Render") + + if part: + if part.type not in ('EMITTER', 'REACTOR', 'HAIR'): + layout.itemL(text="No settings for fluid particles") + return + + row=col.row() + row.enabled = particle_panel_enabled(context, psys) + row.itemR(part, "type", text="") + row.itemR(psys, "seed") + + split = layout.split(percentage=0.65) + if part.type=='HAIR': + if psys.edited==True: + split.itemO("particle.edited_clear", text="Free Edit") + else: + split.itemL(text="") + row = split.row() + row.enabled = particle_panel_enabled(context, psys) + row.itemR(part, "hair_step") + if psys.edited==True: + if psys.global_hair: + layout.itemO("particle.connect_hair") + layout.itemL(text="Hair is disconnected.") + else: + layout.itemO("particle.disconnect_hair") + layout.itemL(text="") + elif part.type=='REACTOR': + split.enabled = particle_panel_enabled(context, psys) + split.itemR(psys, "reactor_target_object") + split.itemR(psys, "reactor_target_particle_system", text="Particle System") - col = split.column() - col.itemL(text="Name:") - col.itemL(text="Settings:") - - col = split.column() - col.itemR(psys, "name", text="") - col.template_ID(psys, "settings", new="particle.new") - elif psys: - part = psys.settings - - split = layout.split(percentage=0.32) - col = split.column() - col.itemL(text="Name:") - if part.type in ('EMITTER', 'REACTOR', 'HAIR'): - col.itemL(text="Settings:") - col.itemL(text="Type:") - - col = split.column() - col.itemR(psys, "name", text="") - if part.type in ('EMITTER', 'REACTOR', 'HAIR'): - col.template_ID(psys, "settings", new="particle.new") - - #row = layout.row() - #row.itemL(text="Viewport") - #row.itemL(text="Render") - - if part: - if part.type not in ('EMITTER', 'REACTOR', 'HAIR'): - layout.itemL(text="No settings for fluid particles") - return - - row=col.row() - row.enabled = particle_panel_enabled(context, psys) - row.itemR(part, "type", text="") - row.itemR(psys, "seed") - - split = layout.split(percentage=0.65) - if part.type=='HAIR': - if psys.edited==True: - split.itemO("particle.edited_clear", text="Free Edit") - else: - split.itemL(text="") - row = split.row() - row.enabled = particle_panel_enabled(context, psys) - row.itemR(part, "hair_step") - if psys.edited==True: - if psys.global_hair: - layout.itemO("particle.connect_hair") - layout.itemL(text="Hair is disconnected.") - else: - layout.itemO("particle.disconnect_hair") - layout.itemL(text="") - elif part.type=='REACTOR': - split.enabled = particle_panel_enabled(context, psys) - split.itemR(psys, "reactor_target_object") - split.itemR(psys, "reactor_target_particle_system", text="Particle System") - class PARTICLE_PT_emission(ParticleButtonsPanel): - bl_label = "Emission" - - def poll(self, context): - if particle_panel_poll(context): - return not context.particle_system.point_cache.external - else: - return False - - def draw(self, context): - layout = self.layout + bl_label = "Emission" - psys = context.particle_system - part = psys.settings - - layout.enabled = particle_panel_enabled(context, psys) and not psys.multiple_caches - - row = layout.row() - row.active = part.distribution != 'GRID' - row.itemR(part, "amount") - - if part.type != 'HAIR': - split = layout.split() - - col = split.column(align=True) - col.itemR(part, "start") - col.itemR(part, "end") + def poll(self, context): + if particle_panel_poll(context): + return not context.particle_system.point_cache.external + else: + return False - col = split.column(align=True) - col.itemR(part, "lifetime") - col.itemR(part, "random_lifetime", slider=True) - - layout.row().itemL(text="Emit From:") - - row = layout.row() - row.itemR(part, "emit_from", expand=True) - row = layout.row() - row.itemR(part, "trand") - if part.distribution!='GRID': - row.itemR(part, "even_distribution") - - if part.emit_from=='FACE' or part.emit_from=='VOLUME': - row = layout.row() - row.itemR(part, "distribution", expand=True) - - row = layout.row() + def draw(self, context): + layout = self.layout - if part.distribution=='JIT': - row.itemR(part, "userjit", text="Particles/Face") - row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True) - elif part.distribution=='GRID': - row.itemR(part, "grid_resolution") + psys = context.particle_system + part = psys.settings + + layout.enabled = particle_panel_enabled(context, psys) and not psys.multiple_caches + + row = layout.row() + row.active = part.distribution != 'GRID' + row.itemR(part, "amount") + + if part.type != 'HAIR': + split = layout.split() + + col = split.column(align=True) + col.itemR(part, "start") + col.itemR(part, "end") + + col = split.column(align=True) + col.itemR(part, "lifetime") + col.itemR(part, "random_lifetime", slider=True) + + layout.row().itemL(text="Emit From:") + + row = layout.row() + row.itemR(part, "emit_from", expand=True) + row = layout.row() + row.itemR(part, "trand") + if part.distribution!='GRID': + row.itemR(part, "even_distribution") + + if part.emit_from=='FACE' or part.emit_from=='VOLUME': + row = layout.row() + row.itemR(part, "distribution", expand=True) + + row = layout.row() + + if part.distribution=='JIT': + row.itemR(part, "userjit", text="Particles/Face") + row.itemR(part, "jitter_factor", text="Jittering Amount", slider=True) + elif part.distribution=='GRID': + row.itemR(part, "grid_resolution") class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel): - bl_label = "Hair dynamics" - bl_default_closed = True - - def poll(self, context): - psys = context.particle_system - if psys==None: return False - if psys.settings==None: return False - return psys.settings.type == 'HAIR' - - def draw_header(self, context): - #cloth = context.cloth.collision_settings - - #self.layout.active = cloth_panel_enabled(context.cloth) - #self.layout.itemR(cloth, "enable_collision", text="") - psys = context.particle_system - self.layout.itemR(psys, "hair_dynamics", text="") - - def draw(self, context): - layout = self.layout + bl_label = "Hair dynamics" + bl_default_closed = True - psys = context.particle_system - part = psys.settings - cloth = psys.cloth.settings - - layout.enabled = psys.hair_dynamics - - split = layout.split() - - col = split.column() - col.itemL(text="Material:") - sub = col.column(align=True) - sub.itemR(cloth, "pin_stiffness", text="Stiffness") - sub.itemR(cloth, "mass") - sub.itemR(cloth, "bending_stiffness", text="Bending") - sub.itemR(cloth, "internal_friction", slider="True") - - col = split.column() + def poll(self, context): + psys = context.particle_system + if psys==None: return False + if psys.settings==None: return False + return psys.settings.type == 'HAIR' + + def draw_header(self, context): + #cloth = context.cloth.collision_settings + + #self.layout.active = cloth_panel_enabled(context.cloth) + #self.layout.itemR(cloth, "enable_collision", text="") + psys = context.particle_system + self.layout.itemR(psys, "hair_dynamics", text="") + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + cloth = psys.cloth.settings + + layout.enabled = psys.hair_dynamics + + split = layout.split() + + col = split.column() + col.itemL(text="Material:") + sub = col.column(align=True) + sub.itemR(cloth, "pin_stiffness", text="Stiffness") + sub.itemR(cloth, "mass") + sub.itemR(cloth, "bending_stiffness", text="Bending") + sub.itemR(cloth, "internal_friction", slider="True") + + col = split.column() + + col.itemL(text="Damping:") + sub = col.column(align=True) + sub.itemR(cloth, "spring_damping", text="Spring") + sub.itemR(cloth, "air_damping", text="Air") + + col.itemL(text="Quality:") + col.itemR(cloth, "quality", text="Steps",slider=True) - col.itemL(text="Damping:") - sub = col.column(align=True) - sub.itemR(cloth, "spring_damping", text="Spring") - sub.itemR(cloth, "air_damping", text="Air") - - col.itemL(text="Quality:") - col.itemR(cloth, "quality", text="Steps",slider=True) - class PARTICLE_PT_cache(ParticleButtonsPanel): - bl_label = "Cache" - bl_default_closed = True - - def poll(self, context): - psys = context.particle_system - if psys==None: return False - if psys.settings==None: return False - 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) + bl_label = "Cache" + bl_default_closed = True - def draw(self, context): - layout = self.layout + def poll(self, context): + psys = context.particle_system + if psys==None: return False + if psys.settings==None: return False + 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) - psys = context.particle_system - - point_cache_ui(self, psys.point_cache, particle_panel_enabled(context, psys), not psys.hair_dynamics, 0) + def draw(self, context): + layout = self.layout + + psys = context.particle_system + + point_cache_ui(self, psys.point_cache, particle_panel_enabled(context, psys), not psys.hair_dynamics, 0) class PARTICLE_PT_velocity(ParticleButtonsPanel): - bl_label = "Velocity" - - def poll(self, context): - if particle_panel_poll(context): - psys = context.particle_system - return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external - else: - return False + bl_label = "Velocity" - def draw(self, context): - layout = self.layout + def poll(self, context): + if particle_panel_poll(context): + psys = context.particle_system + return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external + else: + return False + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + layout.enabled = particle_panel_enabled(context, psys) + + split = layout.split() + + sub = split.column() + sub.itemL(text="Emitter Geometry:") + sub.itemR(part, "normal_factor") + subsub = sub.column(align=True) + subsub.itemR(part, "tangent_factor") + subsub.itemR(part, "tangent_phase", slider=True) + + sub = split.column() + sub.itemL(text="Emitter Object") + sub.itemR(part, "object_aligned_factor", text="") + + layout.row().itemL(text="Other:") + split = layout.split() + sub = split.column() + if part.emit_from=='PARTICLE': + sub.itemR(part, "particle_factor") + else: + sub.itemR(part, "object_factor", slider=True) + sub = split.column() + sub.itemR(part, "random_factor") + + #if part.type=='REACTOR': + # sub.itemR(part, "reactor_factor") + # sub.itemR(part, "reaction_shape", slider=True) - psys = context.particle_system - part = psys.settings - - layout.enabled = particle_panel_enabled(context, psys) - - split = layout.split() - - sub = split.column() - sub.itemL(text="Emitter Geometry:") - sub.itemR(part, "normal_factor") - subsub = sub.column(align=True) - subsub.itemR(part, "tangent_factor") - subsub.itemR(part, "tangent_phase", slider=True) - - sub = split.column() - sub.itemL(text="Emitter Object") - sub.itemR(part, "object_aligned_factor", text="") - - layout.row().itemL(text="Other:") - split = layout.split() - sub = split.column() - if part.emit_from=='PARTICLE': - sub.itemR(part, "particle_factor") - else: - sub.itemR(part, "object_factor", slider=True) - sub = split.column() - sub.itemR(part, "random_factor") - - #if part.type=='REACTOR': - # sub.itemR(part, "reactor_factor") - # sub.itemR(part, "reaction_shape", slider=True) - class PARTICLE_PT_rotation(ParticleButtonsPanel): - bl_label = "Rotation" - - def poll(self, context): - if particle_panel_poll(context): - psys = context.particle_system - return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external - else: - return False + bl_label = "Rotation" - def draw(self, context): - layout = self.layout + def poll(self, context): + if particle_panel_poll(context): + psys = context.particle_system + return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.external + else: + return False - psys = context.particle_system - part = psys.settings - - layout.enabled = particle_panel_enabled(context, psys) - - split = layout.split() - split.itemL(text="Initial Rotation:") - split.itemR(part, "rotation_dynamic") - split = layout.split() - - sub = split.column(align=True) - sub.itemR(part, "rotation_mode", text="") - sub.itemR(part, "random_rotation_factor", slider=True, text="Random") - - sub = split.column(align=True) - sub.itemR(part, "phase_factor", slider=True) - sub.itemR(part, "random_phase_factor", text="Random", slider=True) + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + layout.enabled = particle_panel_enabled(context, psys) + + split = layout.split() + split.itemL(text="Initial Rotation:") + split.itemR(part, "rotation_dynamic") + split = layout.split() + + sub = split.column(align=True) + sub.itemR(part, "rotation_mode", text="") + sub.itemR(part, "random_rotation_factor", slider=True, text="Random") + + sub = split.column(align=True) + sub.itemR(part, "phase_factor", slider=True) + sub.itemR(part, "random_phase_factor", text="Random", slider=True) + + layout.row().itemL(text="Angular Velocity:") + layout.row().itemR(part, "angular_velocity_mode", expand=True) + split = layout.split() + + sub = split.column() + + sub.itemR(part, "angular_velocity_factor", text="") - layout.row().itemL(text="Angular Velocity:") - layout.row().itemR(part, "angular_velocity_mode", expand=True) - split = layout.split() - - sub = split.column() - - sub.itemR(part, "angular_velocity_factor", text="") - class PARTICLE_PT_physics(ParticleButtonsPanel): - bl_label = "Physics" - - def poll(self, context): - if particle_panel_poll(context): - return not context.particle_system.point_cache.external - else: - return False + bl_label = "Physics" - def draw(self, context): - layout = self.layout + def poll(self, context): + if particle_panel_poll(context): + return not context.particle_system.point_cache.external + else: + return False - psys = context.particle_system - part = psys.settings - - layout.enabled = particle_panel_enabled(context, psys) + def draw(self, context): + layout = self.layout - row = layout.row() - row.itemR(part, "physics_type", expand=True) - if part.physics_type != 'NO': - row = layout.row() - col = row.column(align=True) - col.itemR(part, "particle_size") - col.itemR(part, "random_size", slider=True) - col = row.column(align=True) - col.itemR(part, "mass") - col.itemR(part, "sizemass", text="Multiply mass with size") - - if part.physics_type == 'NEWTON': - split = layout.split() - sub = split.column() - - sub.itemL(text="Forces:") - sub.itemR(part, "brownian_factor") - sub.itemR(part, "drag_factor", slider=True) - sub.itemR(part, "damp_factor", slider=True) - sub = split.column() - sub.itemR(part, "size_deflect") - sub.itemR(part, "die_on_collision") - sub.itemR(part, "integrator") - sub.itemR(part, "time_tweak") - - elif part.physics_type == 'KEYED': - split = layout.split() - sub = split.column() - - row = layout.row() - col = row.column() - col.active = not psys.keyed_timing - col.itemR(part, "keyed_loops", text="Loops") - row.itemR(psys, "keyed_timing", text="Use Timing") - - layout.itemL(text="Keys:") - elif part.physics_type=='BOIDS': - boids = part.boids - + psys = context.particle_system + part = psys.settings - row = layout.row() - row.itemR(boids, "allow_flight") - row.itemR(boids, "allow_land") - row.itemR(boids, "allow_climb") - - split = layout.split() - - sub = split.column() - col = sub.column(align=True) - col.active = boids.allow_flight - col.itemR(boids, "air_max_speed") - col.itemR(boids, "air_min_speed", slider="True") - col.itemR(boids, "air_max_acc", slider="True") - col.itemR(boids, "air_max_ave", slider="True") - col.itemR(boids, "air_personal_space") - row = col.row() - row.active = (boids.allow_land or boids.allow_climb) and boids.allow_flight - row.itemR(boids, "landing_smoothness") - - sub = split.column() - col = sub.column(align=True) - col.active = boids.allow_land or boids.allow_climb - col.itemR(boids, "land_max_speed") - col.itemR(boids, "land_jump_speed") - col.itemR(boids, "land_max_acc", slider="True") - col.itemR(boids, "land_max_ave", slider="True") - col.itemR(boids, "land_personal_space") - col.itemR(boids, "land_stick_force") - - row = layout.row() - - col = row.column(align=True) - col.itemL(text="Battle:") - col.itemR(boids, "health") - col.itemR(boids, "strength") - col.itemR(boids, "aggression") - col.itemR(boids, "accuracy") - col.itemR(boids, "range") - - col = row.column() - col.itemL(text="Misc:") - col.itemR(boids, "banking", slider=True) - col.itemR(boids, "height", slider=True) - - if part.physics_type=='KEYED' or part.physics_type=='BOIDS': - if part.physics_type=='BOIDS': - layout.itemL(text="Relations:") - - row = layout.row() - row.template_list(psys, "targets", psys, "active_particle_target_index") - - col = row.column() - subrow = col.row() - subcol = subrow.column(align=True) - subcol.itemO("particle.new_target", icon='ICON_ZOOMIN', text="") - subcol.itemO("particle.remove_target", icon='ICON_ZOOMOUT', text="") - subrow = col.row() - subcol = subrow.column(align=True) - subcol.itemO("particle.target_move_up", icon='VICON_MOVE_UP', text="") - subcol.itemO("particle.target_move_down", icon='VICON_MOVE_DOWN', text="") - - key = psys.active_particle_target - if key: - row = layout.row() - if part.physics_type=='KEYED': - col = row.column() - #doesn't work yet - #col.red_alert = key.valid - col.itemR(key, "object", text="") - col.itemR(key, "system", text="System") - col = row.column(); - col.active = psys.keyed_timing - col.itemR(key, "time") - col.itemR(key, "duration") - else: - subrow = row.row() - #doesn't work yet - #subrow.red_alert = key.valid - subrow.itemR(key, "object", text="") - subrow.itemR(key, "system", text="System") - - layout.itemR(key, "mode", expand=True) + layout.enabled = particle_panel_enabled(context, psys) + + row = layout.row() + row.itemR(part, "physics_type", expand=True) + if part.physics_type != 'NO': + row = layout.row() + col = row.column(align=True) + col.itemR(part, "particle_size") + col.itemR(part, "random_size", slider=True) + col = row.column(align=True) + col.itemR(part, "mass") + col.itemR(part, "sizemass", text="Multiply mass with size") + + if part.physics_type == 'NEWTON': + split = layout.split() + sub = split.column() + + sub.itemL(text="Forces:") + sub.itemR(part, "brownian_factor") + sub.itemR(part, "drag_factor", slider=True) + sub.itemR(part, "damp_factor", slider=True) + sub = split.column() + sub.itemR(part, "size_deflect") + sub.itemR(part, "die_on_collision") + sub.itemR(part, "integrator") + sub.itemR(part, "time_tweak") + + elif part.physics_type == 'KEYED': + split = layout.split() + sub = split.column() + + row = layout.row() + col = row.column() + col.active = not psys.keyed_timing + col.itemR(part, "keyed_loops", text="Loops") + row.itemR(psys, "keyed_timing", text="Use Timing") + + layout.itemL(text="Keys:") + elif part.physics_type=='BOIDS': + boids = part.boids + + + row = layout.row() + row.itemR(boids, "allow_flight") + row.itemR(boids, "allow_land") + row.itemR(boids, "allow_climb") + + split = layout.split() + + sub = split.column() + col = sub.column(align=True) + col.active = boids.allow_flight + col.itemR(boids, "air_max_speed") + col.itemR(boids, "air_min_speed", slider="True") + col.itemR(boids, "air_max_acc", slider="True") + col.itemR(boids, "air_max_ave", slider="True") + col.itemR(boids, "air_personal_space") + row = col.row() + row.active = (boids.allow_land or boids.allow_climb) and boids.allow_flight + row.itemR(boids, "landing_smoothness") + + sub = split.column() + col = sub.column(align=True) + col.active = boids.allow_land or boids.allow_climb + col.itemR(boids, "land_max_speed") + col.itemR(boids, "land_jump_speed") + col.itemR(boids, "land_max_acc", slider="True") + col.itemR(boids, "land_max_ave", slider="True") + col.itemR(boids, "land_personal_space") + col.itemR(boids, "land_stick_force") + + row = layout.row() + + col = row.column(align=True) + col.itemL(text="Battle:") + col.itemR(boids, "health") + col.itemR(boids, "strength") + col.itemR(boids, "aggression") + col.itemR(boids, "accuracy") + col.itemR(boids, "range") + + col = row.column() + col.itemL(text="Misc:") + col.itemR(boids, "banking", slider=True) + col.itemR(boids, "height", slider=True) + + if part.physics_type=='KEYED' or part.physics_type=='BOIDS': + if part.physics_type=='BOIDS': + layout.itemL(text="Relations:") + + row = layout.row() + row.template_list(psys, "targets", psys, "active_particle_target_index") + + col = row.column() + subrow = col.row() + subcol = subrow.column(align=True) + subcol.itemO("particle.new_target", icon='ICON_ZOOMIN', text="") + subcol.itemO("particle.remove_target", icon='ICON_ZOOMOUT', text="") + subrow = col.row() + subcol = subrow.column(align=True) + subcol.itemO("particle.target_move_up", icon='VICON_MOVE_UP', text="") + subcol.itemO("particle.target_move_down", icon='VICON_MOVE_DOWN', text="") + + key = psys.active_particle_target + if key: + row = layout.row() + if part.physics_type=='KEYED': + col = row.column() + #doesn't work yet + #col.red_alert = key.valid + col.itemR(key, "object", text="") + col.itemR(key, "system", text="System") + col = row.column(); + col.active = psys.keyed_timing + col.itemR(key, "time") + col.itemR(key, "duration") + else: + subrow = row.row() + #doesn't work yet + #subrow.red_alert = key.valid + subrow.itemR(key, "object", text="") + subrow.itemR(key, "system", text="System") + + layout.itemR(key, "mode", expand=True) class PARTICLE_PT_boidbrain(ParticleButtonsPanel): - bl_label = "Boid Brain" + bl_label = "Boid Brain" - def poll(self, context): - psys = context.particle_system - if psys==None: return False - if psys.settings==None: return False - if psys.point_cache.external: return False - return psys.settings.physics_type=='BOIDS' - - def draw(self, context): - layout = self.layout + def poll(self, context): + psys = context.particle_system + if psys==None: return False + if psys.settings==None: return False + if psys.point_cache.external: return False + return psys.settings.physics_type=='BOIDS' - boids = context.particle_system.settings.boids - - layout.enabled = particle_panel_enabled(context, context.particle_system) - - # Currently boids can only use the first state so these are commented out for now. - #row = layout.row() - #row.template_list(boids, "states", boids, "active_boid_state_index", compact="True") - #col = row.row() - #subrow = col.row(align=True) - #subrow.itemO("boid.state_add", icon='ICON_ZOOMIN', text="") - #subrow.itemO("boid.state_del", icon='ICON_ZOOMOUT', text="") - #subrow = row.row(align=True) - #subrow.itemO("boid.state_move_up", icon='VICON_MOVE_UP', text="") - #subrow.itemO("boid.state_move_down", icon='VICON_MOVE_DOWN', text="") - - state = boids.active_boid_state - - #layout.itemR(state, "name", text="State name") - - row = layout.row() - row.itemR(state, "ruleset_type") - if state.ruleset_type=='FUZZY': - row.itemR(state, "rule_fuzziness", slider=True) - else: - row.itemL(text="") - - row = layout.row() - row.template_list(state, "rules", state, "active_boid_rule_index") - - col = row.column() - subrow = col.row() - subcol = subrow.column(align=True) - subcol.item_menu_enumO("boid.rule_add", "type", icon='ICON_ZOOMIN', text="") - subcol.itemO("boid.rule_del", icon='ICON_ZOOMOUT', text="") - subrow = col.row() - subcol = subrow.column(align=True) - subcol.itemO("boid.rule_move_up", icon='VICON_MOVE_UP', text="") - subcol.itemO("boid.rule_move_down", icon='VICON_MOVE_DOWN', text="") - - rule = state.active_boid_rule - - if rule: - row = layout.row() - row.itemR(rule, "name", text="") - #somebody make nice icons for boids here please! -jahka - row.itemR(rule, "in_air", icon='VICON_MOVE_UP', text="") - row.itemR(rule, "on_land", icon='VICON_MOVE_DOWN', text="") - - row = layout.row() + def draw(self, context): + layout = self.layout - if rule.type == 'GOAL': - row.itemR(rule, "object") - row = layout.row() - row.itemR(rule, "predict") - elif rule.type == 'AVOID': - row.itemR(rule, "object") - row = layout.row() - row.itemR(rule, "predict") - row.itemR(rule, "fear_factor") - elif rule.type == 'FOLLOW_PATH': - row.itemL(text="Not yet functional.") - elif rule.type == 'AVOID_COLLISION': - row.itemR(rule, "boids") - row.itemR(rule, "deflectors") - row.itemR(rule, "look_ahead") - elif rule.type == 'FOLLOW_LEADER': - row.itemR(rule, "object", text="") - row.itemR(rule, "distance") - row = layout.row() - row.itemR(rule, "line") - subrow = row.row() - subrow.active = rule.line - subrow.itemR(rule, "queue_size") - elif rule.type == 'AVERAGE_SPEED': - row.itemR(rule, "speed", slider=True) - row.itemR(rule, "wander", slider=True) - row.itemR(rule, "level", slider=True) - elif rule.type == 'FIGHT': - row.itemR(rule, "distance") - row.itemR(rule, "flee_distance") + boids = context.particle_system.settings.boids + + layout.enabled = particle_panel_enabled(context, context.particle_system) + + # Currently boids can only use the first state so these are commented out for now. + #row = layout.row() + #row.template_list(boids, "states", boids, "active_boid_state_index", compact="True") + #col = row.row() + #subrow = col.row(align=True) + #subrow.itemO("boid.state_add", icon='ICON_ZOOMIN', text="") + #subrow.itemO("boid.state_del", icon='ICON_ZOOMOUT', text="") + #subrow = row.row(align=True) + #subrow.itemO("boid.state_move_up", icon='VICON_MOVE_UP', text="") + #subrow.itemO("boid.state_move_down", icon='VICON_MOVE_DOWN', text="") + + state = boids.active_boid_state + + #layout.itemR(state, "name", text="State name") + + row = layout.row() + row.itemR(state, "ruleset_type") + if state.ruleset_type=='FUZZY': + row.itemR(state, "rule_fuzziness", slider=True) + else: + row.itemL(text="") + + row = layout.row() + row.template_list(state, "rules", state, "active_boid_rule_index") + + col = row.column() + subrow = col.row() + subcol = subrow.column(align=True) + subcol.item_menu_enumO("boid.rule_add", "type", icon='ICON_ZOOMIN', text="") + subcol.itemO("boid.rule_del", icon='ICON_ZOOMOUT', text="") + subrow = col.row() + subcol = subrow.column(align=True) + subcol.itemO("boid.rule_move_up", icon='VICON_MOVE_UP', text="") + subcol.itemO("boid.rule_move_down", icon='VICON_MOVE_DOWN', text="") + + rule = state.active_boid_rule + + if rule: + row = layout.row() + row.itemR(rule, "name", text="") + #somebody make nice icons for boids here please! -jahka + row.itemR(rule, "in_air", icon='VICON_MOVE_UP', text="") + row.itemR(rule, "on_land", icon='VICON_MOVE_DOWN', text="") + + row = layout.row() + + if rule.type == 'GOAL': + row.itemR(rule, "object") + row = layout.row() + row.itemR(rule, "predict") + elif rule.type == 'AVOID': + row.itemR(rule, "object") + row = layout.row() + row.itemR(rule, "predict") + row.itemR(rule, "fear_factor") + elif rule.type == 'FOLLOW_PATH': + row.itemL(text="Not yet functional.") + elif rule.type == 'AVOID_COLLISION': + row.itemR(rule, "boids") + row.itemR(rule, "deflectors") + row.itemR(rule, "look_ahead") + elif rule.type == 'FOLLOW_LEADER': + row.itemR(rule, "object", text="") + row.itemR(rule, "distance") + row = layout.row() + row.itemR(rule, "line") + subrow = row.row() + subrow.active = rule.line + subrow.itemR(rule, "queue_size") + elif rule.type == 'AVERAGE_SPEED': + row.itemR(rule, "speed", slider=True) + row.itemR(rule, "wander", slider=True) + row.itemR(rule, "level", slider=True) + elif rule.type == 'FIGHT': + row.itemR(rule, "distance") + row.itemR(rule, "flee_distance") class PARTICLE_PT_render(ParticleButtonsPanel): - bl_label = "Render" - - def poll(self, context): - psys = context.particle_system - if psys==None: return False - if psys.settings==None: return False - return True; - - def draw(self, context): - layout = self.layout + bl_label = "Render" - psys = context.particle_system - part = psys.settings + def poll(self, context): + psys = context.particle_system + if psys==None: return False + if psys.settings==None: return False + return True; - row = layout.row() - row.itemR(part, "material") - row.itemR(psys, "parent"); - - split = layout.split() - - sub = split.column() - sub.itemR(part, "emitter"); - sub.itemR(part, "parent"); - sub = split.column() - sub.itemR(part, "unborn"); - sub.itemR(part, "died"); - - row = layout.row() - row.itemR(part, "ren_as", expand=True) - - split = layout.split() - - sub = split.column() - - if part.ren_as == 'LINE': - sub.itemR(part, "line_length_tail") - sub.itemR(part, "line_length_head") - sub = split.column() - sub.itemR(part, "velocity_length") - elif part.ren_as == 'PATH': - - if (part.type!='HAIR' and part.physics_type!='KEYED' and psys.point_cache.baked==False): - box = layout.box() - box.itemL(text="Baked or keyed particles needed for correct rendering.") - return - - sub.itemR(part, "render_strand") - colsub = sub.column() - colsub.active = part.render_strand == False - colsub.itemR(part, "render_adaptive") - colsub = sub.column() - colsub.active = part.render_adaptive or part.render_strand == True - colsub.itemR(part, "adaptive_angle") - colsub = sub.column() - colsub.active = part.render_adaptive == True and part.render_strand == False - colsub.itemR(part, "adaptive_pix") - sub.itemR(part, "hair_bspline") - sub.itemR(part, "render_step", text="Steps") - sub = split.column() + def draw(self, context): + layout = self.layout - sub.itemL(text="Timing:") - sub.itemR(part, "abs_path_time") - sub.itemR(part, "path_start", text="Start", slider= not part.abs_path_time) - sub.itemR(part, "path_end", text="End", slider= not part.abs_path_time) - sub.itemR(part, "random_length", text="Random", slider=True) - - row = layout.row() - col = row.column() - - if part.type=='HAIR' and part.render_strand==True and part.child_type=='FACES': - layout.itemR(part, "enable_simplify") - if part.enable_simplify==True: - row = layout.row() - row.itemR(part, "simplify_refsize") - row.itemR(part, "simplify_rate") - row.itemR(part, "simplify_transition") - row = layout.row() - row.itemR(part, "viewport") - subrow = row.row() - subrow.active = part.viewport==True - subrow.itemR(part, "simplify_viewport") + psys = context.particle_system + part = psys.settings - elif part.ren_as == 'OBJECT': - sub.itemR(part, "dupli_object") - sub.itemR(part, "use_global_dupli") - elif part.ren_as == 'GROUP': - sub.itemR(part, "dupli_group") - split = layout.split() - sub = split.column() - sub.itemR(part, "whole_group") - colsub = sub.column() - colsub.active = part.whole_group == False - colsub.itemR(part, "use_group_count") - - sub = split.column() - colsub = sub.column() - colsub.active = part.whole_group == False - colsub.itemR(part, "use_global_dupli") - colsub.itemR(part, "rand_group") - - if part.use_group_count and not part.whole_group: - row = layout.row() - row.template_list(part, "dupliweights", part, "active_dupliweight_index") - - col = row.column() - subrow = col.row() - subcol = subrow.column(align=True) - subcol.itemO("particle.dupliob_copy", icon='ICON_ZOOMIN', text="") - subcol.itemO("particle.dupliob_remove", icon='ICON_ZOOMOUT', text="") - subcol.itemO("particle.dupliob_move_up", icon='VICON_MOVE_UP', text="") - subcol.itemO("particle.dupliob_move_down", icon='VICON_MOVE_DOWN', text="") - - weight = part.active_dupliweight - if weight: - row = layout.row() - row.itemR(weight, "count") + row = layout.row() + row.itemR(part, "material") + row.itemR(psys, "parent"); + + split = layout.split() + + sub = split.column() + sub.itemR(part, "emitter"); + sub.itemR(part, "parent"); + sub = split.column() + sub.itemR(part, "unborn"); + sub.itemR(part, "died"); + + row = layout.row() + row.itemR(part, "ren_as", expand=True) + + split = layout.split() + + sub = split.column() + + if part.ren_as == 'LINE': + sub.itemR(part, "line_length_tail") + sub.itemR(part, "line_length_head") + sub = split.column() + sub.itemR(part, "velocity_length") + elif part.ren_as == 'PATH': + + if (part.type!='HAIR' and part.physics_type!='KEYED' and psys.point_cache.baked==False): + box = layout.box() + box.itemL(text="Baked or keyed particles needed for correct rendering.") + return + + sub.itemR(part, "render_strand") + colsub = sub.column() + colsub.active = part.render_strand == False + colsub.itemR(part, "render_adaptive") + colsub = sub.column() + colsub.active = part.render_adaptive or part.render_strand == True + colsub.itemR(part, "adaptive_angle") + colsub = sub.column() + colsub.active = part.render_adaptive == True and part.render_strand == False + colsub.itemR(part, "adaptive_pix") + sub.itemR(part, "hair_bspline") + sub.itemR(part, "render_step", text="Steps") + sub = split.column() + + sub.itemL(text="Timing:") + sub.itemR(part, "abs_path_time") + sub.itemR(part, "path_start", text="Start", slider= not part.abs_path_time) + sub.itemR(part, "path_end", text="End", slider= not part.abs_path_time) + sub.itemR(part, "random_length", text="Random", slider=True) + + row = layout.row() + col = row.column() + + if part.type=='HAIR' and part.render_strand==True and part.child_type=='FACES': + layout.itemR(part, "enable_simplify") + if part.enable_simplify==True: + row = layout.row() + row.itemR(part, "simplify_refsize") + row.itemR(part, "simplify_rate") + row.itemR(part, "simplify_transition") + row = layout.row() + row.itemR(part, "viewport") + subrow = row.row() + subrow.active = part.viewport==True + subrow.itemR(part, "simplify_viewport") + + elif part.ren_as == 'OBJECT': + sub.itemR(part, "dupli_object") + sub.itemR(part, "use_global_dupli") + elif part.ren_as == 'GROUP': + sub.itemR(part, "dupli_group") + split = layout.split() + sub = split.column() + sub.itemR(part, "whole_group") + colsub = sub.column() + colsub.active = part.whole_group == False + colsub.itemR(part, "use_group_count") + + sub = split.column() + colsub = sub.column() + colsub.active = part.whole_group == False + colsub.itemR(part, "use_global_dupli") + colsub.itemR(part, "rand_group") + + if part.use_group_count and not part.whole_group: + row = layout.row() + row.template_list(part, "dupliweights", part, "active_dupliweight_index") + + col = row.column() + subrow = col.row() + subcol = subrow.column(align=True) + subcol.itemO("particle.dupliob_copy", icon='ICON_ZOOMIN', text="") + subcol.itemO("particle.dupliob_remove", icon='ICON_ZOOMOUT', text="") + subcol.itemO("particle.dupliob_move_up", icon='VICON_MOVE_UP', text="") + subcol.itemO("particle.dupliob_move_down", icon='VICON_MOVE_DOWN', text="") + + weight = part.active_dupliweight + if weight: + row = layout.row() + row.itemR(weight, "count") + + elif part.ren_as == 'BILLBOARD': + sub.itemL(text="Align:") + + row = layout.row() + row.itemR(part, "billboard_align", expand=True) + row.itemR(part, "billboard_lock", text="Lock") + row = layout.row() + row.itemR(part, "billboard_object") + + row = layout.row() + col = row.column(align=True) + col.itemL(text="Tilt:") + col.itemR(part, "billboard_tilt", text="Angle", slider=True) + col.itemR(part, "billboard_random_tilt", slider=True) + col = row.column() + col.itemR(part, "billboard_offset") + + row = layout.row() + row.itemR(psys, "billboard_normal_uv") + row = layout.row() + row.itemR(psys, "billboard_time_index_uv") + + row = layout.row() + row.itemL(text="Split uv's:") + row.itemR(part, "billboard_uv_split", text="Number of splits") + row = layout.row() + row.itemR(psys, "billboard_split_uv") + row = layout.row() + row.itemL(text="Animate:") + row.itemR(part, "billboard_animation", expand=True) + row.itemL(text="Offset:") + row.itemR(part, "billboard_split_offset", expand=True) + if part.ren_as == 'HALO' or part.ren_as == 'LINE' or part.ren_as=='BILLBOARD': + row = layout.row() + col = row.column() + col.itemR(part, "trail_count") + if part.trail_count > 1: + col.itemR(part, "abs_path_time", text="Length in frames") + col = row.column() + col.itemR(part, "path_end", text="Length", slider=not part.abs_path_time) + col.itemR(part, "random_length", text="Random", slider=True) + else: + col = row.column() + col.itemL(text="") - elif part.ren_as == 'BILLBOARD': - sub.itemL(text="Align:") - - row = layout.row() - row.itemR(part, "billboard_align", expand=True) - row.itemR(part, "billboard_lock", text="Lock") - row = layout.row() - row.itemR(part, "billboard_object") - - row = layout.row() - col = row.column(align=True) - col.itemL(text="Tilt:") - col.itemR(part, "billboard_tilt", text="Angle", slider=True) - col.itemR(part, "billboard_random_tilt", slider=True) - col = row.column() - col.itemR(part, "billboard_offset") - - row = layout.row() - row.itemR(psys, "billboard_normal_uv") - row = layout.row() - row.itemR(psys, "billboard_time_index_uv") - - row = layout.row() - row.itemL(text="Split uv's:") - row.itemR(part, "billboard_uv_split", text="Number of splits") - row = layout.row() - row.itemR(psys, "billboard_split_uv") - row = layout.row() - row.itemL(text="Animate:") - row.itemR(part, "billboard_animation", expand=True) - row.itemL(text="Offset:") - row.itemR(part, "billboard_split_offset", expand=True) - if part.ren_as == 'HALO' or part.ren_as == 'LINE' or part.ren_as=='BILLBOARD': - row = layout.row() - col = row.column() - col.itemR(part, "trail_count") - if part.trail_count > 1: - col.itemR(part, "abs_path_time", text="Length in frames") - col = row.column() - col.itemR(part, "path_end", text="Length", slider=not part.abs_path_time) - col.itemR(part, "random_length", text="Random", slider=True) - else: - col = row.column() - col.itemL(text="") - class PARTICLE_PT_draw(ParticleButtonsPanel): - bl_label = "Display" - bl_default_closed = True - - def poll(self, context): - psys = context.particle_system - if psys==None: return False - if psys.settings==None: return False - return True; - - def draw(self, context): - layout = self.layout + bl_label = "Display" + bl_default_closed = True - psys = context.particle_system - part = psys.settings - - row = layout.row() - row.itemR(part, "draw_as", expand=True) - - if part.draw_as=='NONE' or (part.ren_as=='NONE' and part.draw_as=='RENDER'): - return - - path = (part.ren_as=='PATH' and part.draw_as=='RENDER') or part.draw_as=='PATH' - - if path and part.type!='HAIR' and part.physics_type!='KEYED' and psys.point_cache.baked==False: - box = layout.box() - box.itemL(text="Baked or keyed particles needed for correct drawing.") - return - - row = layout.row() - row.itemR(part, "display", slider=True) - if part.draw_as!='RENDER' or part.ren_as=='HALO': - row.itemR(part, "draw_size") - else: - row.itemL(text="") - - row = layout.row() - col = row.column() - col.itemR(part, "show_size") - col.itemR(part, "velocity") - col.itemR(part, "num") - if part.physics_type == 'BOIDS': - col.itemR(part, "draw_health") - - col = row.column() - col.itemR(part, "material_color", text="Use material color") - - if (path): - col.itemR(part, "draw_step") - else: - subcol = col.column() - subcol.active = part.material_color==False - #subcol.itemL(text="color") - #subcol.itemL(text="Override material color") + def poll(self, context): + psys = context.particle_system + if psys==None: return False + if psys.settings==None: return False + return True; + + def draw(self, context): + layout = self.layout + + psys = context.particle_system + part = psys.settings + + row = layout.row() + row.itemR(part, "draw_as", expand=True) + + if part.draw_as=='NONE' or (part.ren_as=='NONE' and part.draw_as=='RENDER'): + return + + path = (part.ren_as=='PATH' and part.draw_as=='RENDER') or part.draw_as=='PATH' + + if path and part.type!='HAIR' and part.physics_type!='KEYED' and psys.point_cache.baked==False: + box = layout.box() + box.itemL(text="Baked or keyed particles needed for correct drawing.") + return + + row = layout.row() + row.itemR(part, "display", slider=True) + if part.draw_as!='RENDER' or part.ren_as=='HALO': + row.itemR(part, "draw_size") + else: + row.itemL(text="") + + row = layout.row() + col = row.column() + col.itemR(part, "show_size") + col.itemR(part, "velocity") + col.itemR(part, "num") + if part.physics_type == 'BOIDS': + col.itemR(part, "draw_health") + + col = row.column() + col.itemR(part, "material_color", text="Use material color") + + if (path): + col.itemR(part, "draw_step") + else: + subcol = col.column() + subcol.active = part.material_color==False + #subcol.itemL(text="color") + #subcol.itemL(text="Override material color") class PARTICLE_PT_children(ParticleButtonsPanel): - bl_label = "Children" - bl_default_closed = True + bl_label = "Children" + bl_default_closed = True - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - psys = context.particle_system - part = psys.settings - - layout.row().itemR(part, "child_type", expand=True) - - if part.child_type=='NONE': - return - - row = layout.row() - - col = row.column(align=True) - col.itemR(part, "child_nbr", text="Display") - col.itemR(part, "rendered_child_nbr", text="Render") - - col = row.column(align=True) - - if part.child_type=='FACES': - col.itemR(part, "virtual_parents", slider=True) - else: - col.itemR(part, "child_radius", text="Radius") - col.itemR(part, "child_roundness", text="Roundness", slider=True) - - col = row.column(align=True) - col.itemR(part, "child_size", text="Size") - col.itemR(part, "child_random_size", text="Random") - - layout.row().itemL(text="Effects:") - - row = layout.row() - - col = row.column(align=True) - col.itemR(part, "clump_factor", slider=True) - col.itemR(part, "clumppow", slider=True) - - col = row.column(align=True) - col.itemR(part, "rough_endpoint") - col.itemR(part, "rough_end_shape") + psys = context.particle_system + part = psys.settings - row = layout.row() - - col = row.column(align=True) - col.itemR(part, "rough1") - col.itemR(part, "rough1_size") + layout.row().itemR(part, "child_type", expand=True) - col = row.column(align=True) - col.itemR(part, "rough2") - col.itemR(part, "rough2_size") - col.itemR(part, "rough2_thres", slider=True) - - row = layout.row() - col = row.column(align=True) - col.itemR(part, "child_length", slider=True) - col.itemR(part, "child_length_thres", slider=True) - - col = row.column(align=True) - col.itemL(text="Space reserved for") - col.itemL(text="hair parting controls") - - layout.row().itemL(text="Kink:") - layout.row().itemR(part, "kink", expand=True) - - split = layout.split() - - sub = split.column() - sub.itemR(part, "kink_amplitude") - sub.itemR(part, "kink_frequency") - sub = split.column() - sub.itemR(part, "kink_shape", slider=True) + if part.child_type=='NONE': + return + + row = layout.row() + + col = row.column(align=True) + col.itemR(part, "child_nbr", text="Display") + col.itemR(part, "rendered_child_nbr", text="Render") + + col = row.column(align=True) + + if part.child_type=='FACES': + col.itemR(part, "virtual_parents", slider=True) + else: + col.itemR(part, "child_radius", text="Radius") + col.itemR(part, "child_roundness", text="Roundness", slider=True) + + col = row.column(align=True) + col.itemR(part, "child_size", text="Size") + col.itemR(part, "child_random_size", text="Random") + + layout.row().itemL(text="Effects:") + + row = layout.row() + + col = row.column(align=True) + col.itemR(part, "clump_factor", slider=True) + col.itemR(part, "clumppow", slider=True) + + col = row.column(align=True) + col.itemR(part, "rough_endpoint") + col.itemR(part, "rough_end_shape") + + row = layout.row() + + col = row.column(align=True) + col.itemR(part, "rough1") + col.itemR(part, "rough1_size") + + col = row.column(align=True) + col.itemR(part, "rough2") + col.itemR(part, "rough2_size") + col.itemR(part, "rough2_thres", slider=True) + + row = layout.row() + col = row.column(align=True) + col.itemR(part, "child_length", slider=True) + col.itemR(part, "child_length_thres", slider=True) + + col = row.column(align=True) + col.itemL(text="Space reserved for") + col.itemL(text="hair parting controls") + + layout.row().itemL(text="Kink:") + layout.row().itemR(part, "kink", expand=True) + + split = layout.split() + + sub = split.column() + sub.itemR(part, "kink_amplitude") + sub.itemR(part, "kink_frequency") + sub = split.column() + sub.itemR(part, "kink_shape", slider=True) class PARTICLE_PT_field_weights(ParticleButtonsPanel): - bl_label = "Field Weights" - bl_default_closed = True - - def draw(self, context): - part = context.particle_system.settings - effector_weights_ui(self, part.effector_weights) - - if part.type == 'HAIR': - self.layout.itemR(part.effector_weights, "do_growing_hair") - + bl_label = "Field Weights" + bl_default_closed = True + + def draw(self, context): + part = context.particle_system.settings + effector_weights_ui(self, part.effector_weights) + + if part.type == 'HAIR': + self.layout.itemR(part.effector_weights, "do_growing_hair") + class PARTICLE_PT_force_fields(ParticleButtonsPanel): - bl_label = "Force Field Settings" - bl_default_closed = True - - def draw(self, context): - layout = self.layout + bl_label = "Force Field Settings" + bl_default_closed = True + + def draw(self, context): + layout = self.layout + + part = context.particle_system.settings + + layout.itemR(part, "self_effect") + + split = layout.split(percentage=0.2) + split.itemL(text="Type 1:") + split.itemR(part.force_field_1, "type",text="") + basic_force_field_settings_ui(self, part.force_field_1) + basic_force_field_falloff_ui(self, part.force_field_1) + + if part.force_field_1.type != 'NONE': + layout.itemL(text="") + + split = layout.split(percentage=0.2) + split.itemL(text="Type 2:") + split.itemR(part.force_field_2, "type",text="") + basic_force_field_settings_ui(self, part.force_field_2) + basic_force_field_falloff_ui(self, part.force_field_2) - part = context.particle_system.settings - - layout.itemR(part, "self_effect") - - split = layout.split(percentage=0.2) - split.itemL(text="Type 1:") - split.itemR(part.force_field_1, "type",text="") - basic_force_field_settings_ui(self, part.force_field_1) - basic_force_field_falloff_ui(self, part.force_field_1) - - if part.force_field_1.type != 'NONE': - layout.itemL(text="") - - split = layout.split(percentage=0.2) - split.itemL(text="Type 2:") - split.itemR(part.force_field_2, "type",text="") - basic_force_field_settings_ui(self, part.force_field_2) - basic_force_field_falloff_ui(self, part.force_field_2) - class PARTICLE_PT_vertexgroups(ParticleButtonsPanel): - bl_label = "Vertexgroups" - bl_default_closed = True + bl_label = "Vertexgroups" + bl_default_closed = True - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - psys = context.particle_system - part = psys.settings - - layout.itemL(text="Nothing here yet.") + psys = context.particle_system + part = psys.settings - #row = layout.row() - #row.itemL(text="Vertex Group") - #row.itemL(text="Negate") + layout.itemL(text="Nothing here yet.") - - #row = layout.row() - #row.itemR(psys, "vertex_group_density") - #row.itemR(psys, "vertex_group_density_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_velocity") - #row.itemR(psys, "vertex_group_velocity_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_length") - #row.itemR(psys, "vertex_group_length_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_clump") - #row.itemR(psys, "vertex_group_clump_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_kink") - #row.itemR(psys, "vertex_group_kink_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_roughness1") - #row.itemR(psys, "vertex_group_roughness1_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_roughness2") - #row.itemR(psys, "vertex_group_roughness2_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_roughness_end") - #row.itemR(psys, "vertex_group_roughness_end_negate", text="") + #row = layout.row() + #row.itemL(text="Vertex Group") + #row.itemL(text="Negate") + + + #row = layout.row() + #row.itemR(psys, "vertex_group_density") + #row.itemR(psys, "vertex_group_density_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_velocity") + #row.itemR(psys, "vertex_group_velocity_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_length") + #row.itemR(psys, "vertex_group_length_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_clump") + #row.itemR(psys, "vertex_group_clump_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_kink") + #row.itemR(psys, "vertex_group_kink_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_roughness1") + #row.itemR(psys, "vertex_group_roughness1_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_roughness2") + #row.itemR(psys, "vertex_group_roughness2_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_roughness_end") + #row.itemR(psys, "vertex_group_roughness_end_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_size") + #row.itemR(psys, "vertex_group_size_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_tangent") + #row.itemR(psys, "vertex_group_tangent_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_rotation") + #row.itemR(psys, "vertex_group_rotation_negate", text="") + + #row = layout.row() + #row.itemR(psys, "vertex_group_field") + #row.itemR(psys, "vertex_group_field_negate", text="") - #row = layout.row() - #row.itemR(psys, "vertex_group_size") - #row.itemR(psys, "vertex_group_size_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_tangent") - #row.itemR(psys, "vertex_group_tangent_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_rotation") - #row.itemR(psys, "vertex_group_rotation_negate", text="") - - #row = layout.row() - #row.itemR(psys, "vertex_group_field") - #row.itemR(psys, "vertex_group_field_negate", text="") - bpy.types.register(PARTICLE_PT_particles) bpy.types.register(PARTICLE_PT_hair_dynamics) bpy.types.register(PARTICLE_PT_cache) diff --git a/release/scripts/ui/buttons_physics_cloth.py b/release/scripts/ui/buttons_physics_cloth.py index 3a40713adb8..208f2ed75e3 100644 --- a/release/scripts/ui/buttons_physics_cloth.py +++ b/release/scripts/ui/buttons_physics_cloth.py @@ -5,181 +5,181 @@ from buttons_physics_common import point_cache_ui from buttons_physics_common import effector_weights_ui def cloth_panel_enabled(md): - return md.point_cache.baked==False + return md.point_cache.baked==False class PhysicButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "physics" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "physics" + + def poll(self, context): + ob = context.object + rd = context.scene.render_data + return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - def poll(self, context): - ob = context.object - rd = context.scene.render_data - return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - class PHYSICS_PT_cloth(PhysicButtonsPanel): - bl_label = "Cloth" + bl_label = "Cloth" - def draw(self, context): - layout = self.layout - - md = context.cloth - ob = context.object + def draw(self, context): + layout = self.layout - split = layout.split() - split.operator_context = 'EXEC_DEFAULT' + md = context.cloth + ob = context.object - if md: - # remove modifier + settings - split.set_context_pointer("modifier", md) - split.itemO("object.modifier_remove", text="Remove") + split = layout.split() + split.operator_context = 'EXEC_DEFAULT' - row = split.row(align=True) - row.itemR(md, "render", text="") - row.itemR(md, "realtime", text="") - else: - # add modifier - split.item_enumO("object.modifier_add", "type", 'CLOTH', text="Add") - split.itemL() + if md: + # remove modifier + settings + split.set_context_pointer("modifier", md) + split.itemO("object.modifier_remove", text="Remove") - if md: - cloth = md.settings - - layout.active = cloth_panel_enabled(md) + row = split.row(align=True) + row.itemR(md, "render", text="") + row.itemR(md, "realtime", text="") + else: + # add modifier + split.item_enumO("object.modifier_add", "type", 'CLOTH', text="Add") + split.itemL() - split = layout.split() - - col = split.column() - - col.itemL(text="Quality:") - col.itemR(cloth, "quality", text="Steps",slider=True) - - col.itemL(text="Material:") - sub = col.column(align=True) - sub.itemR(cloth, "mass") - sub.itemR(cloth, "structural_stiffness", text="Structural") - sub.itemR(cloth, "bending_stiffness", text="Bending") - - col = split.column() - - col.itemL(text="Presets:") - col.itemL(text="TODO!") + if md: + cloth = md.settings - col.itemL(text="Damping:") - sub = col.column(align=True) - sub.itemR(cloth, "spring_damping", text="Spring") - sub.itemR(cloth, "air_damping", text="Air") + layout.active = cloth_panel_enabled(md) - col.itemR(cloth, "pin_cloth", text="Pin") - sub = col.column(align=True) - sub.active = cloth.pin_cloth - sub.itemR(cloth, "pin_stiffness", text="Stiffness") - sub.item_pointerR(cloth, "mass_vertex_group", ob, "vertex_groups", text="") - - # Disabled for now - """ - if cloth.mass_vertex_group: - layout.itemL(text="Goal:") - - col = layout.column_flow() - col.itemR(cloth, "goal_default", text="Default") - col.itemR(cloth, "goal_spring", text="Stiffness") - col.itemR(cloth, "goal_friction", text="Friction") - """ + split = layout.split() + + col = split.column() + + col.itemL(text="Quality:") + col.itemR(cloth, "quality", text="Steps",slider=True) + + col.itemL(text="Material:") + sub = col.column(align=True) + sub.itemR(cloth, "mass") + sub.itemR(cloth, "structural_stiffness", text="Structural") + sub.itemR(cloth, "bending_stiffness", text="Bending") + + col = split.column() + + col.itemL(text="Presets:") + col.itemL(text="TODO!") + + col.itemL(text="Damping:") + sub = col.column(align=True) + sub.itemR(cloth, "spring_damping", text="Spring") + sub.itemR(cloth, "air_damping", text="Air") + + col.itemR(cloth, "pin_cloth", text="Pin") + sub = col.column(align=True) + sub.active = cloth.pin_cloth + sub.itemR(cloth, "pin_stiffness", text="Stiffness") + sub.item_pointerR(cloth, "mass_vertex_group", ob, "vertex_groups", text="") + + # Disabled for now + """ + if cloth.mass_vertex_group: + layout.itemL(text="Goal:") + + col = layout.column_flow() + col.itemR(cloth, "goal_default", text="Default") + col.itemR(cloth, "goal_spring", text="Stiffness") + col.itemR(cloth, "goal_friction", text="Friction") + """ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel): - bl_label = "Cloth Cache" - bl_default_closed = True + bl_label = "Cloth Cache" + bl_default_closed = True - def poll(self, context): - return context.cloth + def poll(self, context): + return context.cloth + + def draw(self, context): + md = context.cloth + point_cache_ui(self, md.point_cache, cloth_panel_enabled(md), 0, 0) - def draw(self, context): - md = context.cloth - point_cache_ui(self, md.point_cache, cloth_panel_enabled(md), 0, 0) - class PHYSICS_PT_cloth_collision(PhysicButtonsPanel): - bl_label = "Cloth Collision" - bl_default_closed = True + bl_label = "Cloth Collision" + bl_default_closed = True - def poll(self, context): - return context.cloth - - def draw_header(self, context): - cloth = context.cloth.collision_settings - - self.layout.active = cloth_panel_enabled(context.cloth) - self.layout.itemR(cloth, "enable_collision", text="") + def poll(self, context): + return context.cloth - def draw(self, context): - layout = self.layout - - cloth = context.cloth.collision_settings - md = context.cloth - - layout.active = cloth.enable_collision and cloth_panel_enabled(md) - - split = layout.split() - - col = split.column() - col.itemR(cloth, "collision_quality", slider=True, text="Quality") - col.itemR(cloth, "min_distance", slider=True, text="Distance") - col.itemR(cloth, "friction") - - col = split.column() - col.itemR(cloth, "enable_self_collision", text="Self Collision") - sub = col.column() - sub.active = cloth.enable_self_collision - sub.itemR(cloth, "self_collision_quality", slider=True, text="Quality") - sub.itemR(cloth, "self_min_distance", slider=True, text="Distance") + def draw_header(self, context): + cloth = context.cloth.collision_settings + + self.layout.active = cloth_panel_enabled(context.cloth) + self.layout.itemR(cloth, "enable_collision", text="") + + def draw(self, context): + layout = self.layout + + cloth = context.cloth.collision_settings + md = context.cloth + + layout.active = cloth.enable_collision and cloth_panel_enabled(md) + + split = layout.split() + + col = split.column() + col.itemR(cloth, "collision_quality", slider=True, text="Quality") + col.itemR(cloth, "min_distance", slider=True, text="Distance") + col.itemR(cloth, "friction") + + col = split.column() + col.itemR(cloth, "enable_self_collision", text="Self Collision") + sub = col.column() + sub.active = cloth.enable_self_collision + sub.itemR(cloth, "self_collision_quality", slider=True, text="Quality") + sub.itemR(cloth, "self_min_distance", slider=True, text="Distance") class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel): - bl_label = "Cloth Stiffness Scaling" - bl_default_closed = True + bl_label = "Cloth Stiffness Scaling" + bl_default_closed = True - def poll(self, context): - return context.cloth - - def draw_header(self, context): - cloth = context.cloth.settings - - self.layout.active = cloth_panel_enabled(context.cloth) - self.layout.itemR(cloth, "stiffness_scaling", text="") + def poll(self, context): + return context.cloth - def draw(self, context): - layout = self.layout - - md = context.cloth - ob = context.object - cloth = context.cloth.settings - - layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md) - - split = layout.split() - - col = split.column() - col.itemL(text="Structural Stiffness:") - sub = col.column(align=True) - sub.itemR(cloth, "structural_stiffness_max", text="Max") - sub.item_pointerR(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="") - - col = split.column() - col.itemL(text="Bending Stiffness:") - sub = col.column(align=True) - sub.itemR(cloth, "bending_stiffness_max", text="Max") - sub.item_pointerR(cloth, "bending_vertex_group", ob, "vertex_groups", text="") + def draw_header(self, context): + cloth = context.cloth.settings + + self.layout.active = cloth_panel_enabled(context.cloth) + self.layout.itemR(cloth, "stiffness_scaling", text="") + + def draw(self, context): + layout = self.layout + + md = context.cloth + ob = context.object + cloth = context.cloth.settings + + layout.active = cloth.stiffness_scaling and cloth_panel_enabled(md) + + split = layout.split() + + col = split.column() + col.itemL(text="Structural Stiffness:") + sub = col.column(align=True) + sub.itemR(cloth, "structural_stiffness_max", text="Max") + sub.item_pointerR(cloth, "structural_stiffness_vertex_group", ob, "vertex_groups", text="") + + col = split.column() + col.itemL(text="Bending Stiffness:") + sub = col.column(align=True) + sub.itemR(cloth, "bending_stiffness_max", text="Max") + sub.item_pointerR(cloth, "bending_vertex_group", ob, "vertex_groups", text="") class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel): - bl_label = "Cloth Field Weights" - bl_default_closed = True - - def poll(self, context): - return (context.cloth) - - def draw(self, context): - cloth = context.cloth.settings - effector_weights_ui(self, cloth.effector_weights) - + bl_label = "Cloth Field Weights" + bl_default_closed = True + + def poll(self, context): + return (context.cloth) + + def draw(self, context): + cloth = context.cloth.settings + effector_weights_ui(self, cloth.effector_weights) + bpy.types.register(PHYSICS_PT_cloth) bpy.types.register(PHYSICS_PT_cloth_cache) bpy.types.register(PHYSICS_PT_cloth_collision) diff --git a/release/scripts/ui/buttons_physics_common.py b/release/scripts/ui/buttons_physics_common.py index 411d6e62ad0..bc2b9662d1e 100644 --- a/release/scripts/ui/buttons_physics_common.py +++ b/release/scripts/ui/buttons_physics_common.py @@ -1,159 +1,159 @@ import bpy def point_cache_ui(self, cache, enabled, particles, smoke): - layout = self.layout - layout.set_context_pointer("PointCache", cache) - - row = layout.row() - row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2 ) - col = row.column(align=True) - col.itemO("ptcache.add_new", icon='ICON_ZOOMIN', text="") - col.itemO("ptcache.remove", icon='ICON_ZOOMOUT', text="") - - row = layout.row() - row.itemL(text="File Name:") - if particles: - row.itemR(cache, "external") - - if cache.external: - split = layout.split(percentage=0.80) - split.itemR(cache, "name", text="") - split.itemR(cache, "index", text="") - - layout.itemL(text="File Path:") - layout.itemR(cache, "filepath", text="") - - layout.itemL(text=cache.info) - else: - layout.itemR(cache, "name", text="") - - if not particles: - row = layout.row() - row.enabled = enabled - row.itemR(cache, "start_frame") - row.itemR(cache, "end_frame") - - row = layout.row() - - if cache.baked == True: - row.itemO("ptcache.free_bake", text="Free Bake") - else: - row.item_booleanO("ptcache.bake", "bake", True, text="Bake") - - sub = row.row() - sub.enabled = (cache.frames_skipped or cache.outdated) and enabled - sub.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame") - - row = layout.row() - row.enabled = enabled - row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake") - if not smoke: - row.itemR(cache, "step"); - - if not smoke: - row = layout.row() - sub = row.row() - sub.enabled = enabled - sub.itemR(cache, "quick_cache") - row.itemR(cache, "disk_cache") - - layout.itemL(text=cache.info) - - layout.itemS() - - row = layout.row() - row.item_booleanO("ptcache.bake_all", "bake", True, text="Bake All Dynamics") - row.itemO("ptcache.free_bake_all", text="Free All Bakes") - layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame") - -def effector_weights_ui(self, weights): - layout = self.layout - - layout.itemR(weights, "group") - - split = layout.split() - split.itemR(weights, "gravity", slider=True) - split.itemR(weights, "all", slider=True) - - layout.itemS() - - flow = layout.column_flow() - flow.itemR(weights, "force", slider=True) - flow.itemR(weights, "vortex", slider=True) - flow.itemR(weights, "magnetic", slider=True) - flow.itemR(weights, "wind", slider=True) - flow.itemR(weights, "curveguide", slider=True) - flow.itemR(weights, "texture", slider=True) - flow.itemR(weights, "harmonic", slider=True) - flow.itemR(weights, "charge", slider=True) - flow.itemR(weights, "lennardjones", slider=True) - flow.itemR(weights, "turbulence", slider=True) - flow.itemR(weights, "drag", slider=True) - flow.itemR(weights, "boid", slider=True) - -def basic_force_field_settings_ui(self, field): - layout = self.layout - split = layout.split() - - if not field or field.type == 'NONE': - return - - col = split.column() - - if field.type == 'DRAG': - col.itemR(field, "linear_drag", text="Linear") - else: - col.itemR(field, "strength") - - if field.type == 'TURBULENCE': - col.itemR(field, "size") - col.itemR(field, "flow") - elif field.type == 'HARMONIC': - col.itemR(field, "harmonic_damping", text="Damping") - elif field.type == 'VORTEX' and field.shape != 'POINT': - col.itemR(field, "inflow") - elif field.type == 'DRAG': - col.itemR(field, "quadratic_drag", text="Quadratic") - else: - col.itemR(field, "flow") - - col = split.column() - col.itemR(field, "noise") - col.itemR(field, "seed") - if field.type == 'TURBULENCE': - col.itemR(field, "global_coordinates", text="Global") - - split = layout.split() - - col = split.column() - col.itemL(text="Effect point:") - col.itemR(field, "do_location") - col.itemR(field, "do_rotation") - - sub = split.column() - sub.itemL(text="Collision:") - sub.itemR(field, "do_absorption") - - -def basic_force_field_falloff_ui(self, field): - layout = self.layout - split = layout.split(percentage=0.35) - - if not field or field.type == 'NONE': - return - - col = split.column() - col.itemR(field, "z_direction", text="") - col.itemR(field, "use_min_distance", text="Use Minimum") - col.itemR(field, "use_max_distance", text="Use Maximum") + layout = self.layout + layout.set_context_pointer("PointCache", cache) - col = split.column() - col.itemR(field, "falloff_power", text="Power") - - sub = col.column() - sub.active = field.use_min_distance - sub.itemR(field, "minimum_distance", text="Distance") - - sub = col.column() - sub.active = field.use_max_distance - sub.itemR(field, "maximum_distance", text="Distance") + row = layout.row() + row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2 ) + col = row.column(align=True) + col.itemO("ptcache.add_new", icon='ICON_ZOOMIN', text="") + col.itemO("ptcache.remove", icon='ICON_ZOOMOUT', text="") + + row = layout.row() + row.itemL(text="File Name:") + if particles: + row.itemR(cache, "external") + + if cache.external: + split = layout.split(percentage=0.80) + split.itemR(cache, "name", text="") + split.itemR(cache, "index", text="") + + layout.itemL(text="File Path:") + layout.itemR(cache, "filepath", text="") + + layout.itemL(text=cache.info) + else: + layout.itemR(cache, "name", text="") + + if not particles: + row = layout.row() + row.enabled = enabled + row.itemR(cache, "start_frame") + row.itemR(cache, "end_frame") + + row = layout.row() + + if cache.baked == True: + row.itemO("ptcache.free_bake", text="Free Bake") + else: + row.item_booleanO("ptcache.bake", "bake", True, text="Bake") + + sub = row.row() + sub.enabled = (cache.frames_skipped or cache.outdated) and enabled + sub.itemO("ptcache.bake", "bake", False, text="Calculate to Current Frame") + + row = layout.row() + row.enabled = enabled + row.itemO("ptcache.bake_from_cache", text="Current Cache to Bake") + if not smoke: + row.itemR(cache, "step"); + + if not smoke: + row = layout.row() + sub = row.row() + sub.enabled = enabled + sub.itemR(cache, "quick_cache") + row.itemR(cache, "disk_cache") + + layout.itemL(text=cache.info) + + layout.itemS() + + row = layout.row() + row.item_booleanO("ptcache.bake_all", "bake", True, text="Bake All Dynamics") + row.itemO("ptcache.free_bake_all", text="Free All Bakes") + layout.itemO("ptcache.bake_all", "bake", False, text="Update All Dynamics to current frame") + +def effector_weights_ui(self, weights): + layout = self.layout + + layout.itemR(weights, "group") + + split = layout.split() + split.itemR(weights, "gravity", slider=True) + split.itemR(weights, "all", slider=True) + + layout.itemS() + + flow = layout.column_flow() + flow.itemR(weights, "force", slider=True) + flow.itemR(weights, "vortex", slider=True) + flow.itemR(weights, "magnetic", slider=True) + flow.itemR(weights, "wind", slider=True) + flow.itemR(weights, "curveguide", slider=True) + flow.itemR(weights, "texture", slider=True) + flow.itemR(weights, "harmonic", slider=True) + flow.itemR(weights, "charge", slider=True) + flow.itemR(weights, "lennardjones", slider=True) + flow.itemR(weights, "turbulence", slider=True) + flow.itemR(weights, "drag", slider=True) + flow.itemR(weights, "boid", slider=True) + +def basic_force_field_settings_ui(self, field): + layout = self.layout + split = layout.split() + + if not field or field.type == 'NONE': + return + + col = split.column() + + if field.type == 'DRAG': + col.itemR(field, "linear_drag", text="Linear") + else: + col.itemR(field, "strength") + + if field.type == 'TURBULENCE': + col.itemR(field, "size") + col.itemR(field, "flow") + elif field.type == 'HARMONIC': + col.itemR(field, "harmonic_damping", text="Damping") + elif field.type == 'VORTEX' and field.shape != 'POINT': + col.itemR(field, "inflow") + elif field.type == 'DRAG': + col.itemR(field, "quadratic_drag", text="Quadratic") + else: + col.itemR(field, "flow") + + col = split.column() + col.itemR(field, "noise") + col.itemR(field, "seed") + if field.type == 'TURBULENCE': + col.itemR(field, "global_coordinates", text="Global") + + split = layout.split() + + col = split.column() + col.itemL(text="Effect point:") + col.itemR(field, "do_location") + col.itemR(field, "do_rotation") + + sub = split.column() + sub.itemL(text="Collision:") + sub.itemR(field, "do_absorption") + + +def basic_force_field_falloff_ui(self, field): + layout = self.layout + split = layout.split(percentage=0.35) + + if not field or field.type == 'NONE': + return + + col = split.column() + col.itemR(field, "z_direction", text="") + col.itemR(field, "use_min_distance", text="Use Minimum") + col.itemR(field, "use_max_distance", text="Use Maximum") + + col = split.column() + col.itemR(field, "falloff_power", text="Power") + + sub = col.column() + sub.active = field.use_min_distance + sub.itemR(field, "minimum_distance", text="Distance") + + sub = col.column() + sub.active = field.use_max_distance + sub.itemR(field, "maximum_distance", text="Distance") diff --git a/release/scripts/ui/buttons_physics_field.py b/release/scripts/ui/buttons_physics_field.py index 6d8864560c7..1f0518620d9 100644 --- a/release/scripts/ui/buttons_physics_field.py +++ b/release/scripts/ui/buttons_physics_field.py @@ -5,198 +5,198 @@ from buttons_physics_common import basic_force_field_settings_ui from buttons_physics_common import basic_force_field_falloff_ui class PhysicButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "physics" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "physics" + + def poll(self, context): + rd = context.scene.render_data + return (context.object) and (not rd.use_game_engine) - def poll(self, context): - rd = context.scene.render_data - return (context.object) and (not rd.use_game_engine) - class PHYSICS_PT_field(PhysicButtonsPanel): - bl_label = "Force Fields" + bl_label = "Force Fields" - def draw(self, context): - layout = self.layout - - ob = context.object - field = ob.field - - split = layout.split(percentage=0.2) - split.itemL(text="Type:") - split.itemR(field, "type",text="") - - if field.type not in ('NONE', 'GUIDE', 'TEXTURE'): - split = layout.split(percentage=0.2) - #split = layout.row() - split.itemL(text="Shape:") - split.itemR(field, "shape", text="") - - split = layout.split() - - if field.type == 'NONE': - return # nothing to draw - elif field.type == 'GUIDE': - col = split.column() - col.itemR(field, "guide_minimum") - col.itemR(field, "guide_free") - col.itemR(field, "falloff_power") - col.itemR(field, "guide_path_add") - - col = split.column() - col.itemL(text="Clumping:") - col.itemR(field, "guide_clump_amount") - col.itemR(field, "guide_clump_shape") - - row = layout.row() - row.itemR(field, "use_max_distance") - sub = row.row() - sub.active = field.use_max_distance - sub.itemR(field, "maximum_distance") - - layout.itemS() + def draw(self, context): + layout = self.layout - layout.itemR(field, "guide_kink_type") - if (field.guide_kink_type != "NONE"): - layout.itemR(field, "guide_kink_axis") - - flow = layout.column_flow() - flow.itemR(field, "guide_kink_frequency") - flow.itemR(field, "guide_kink_shape") - flow.itemR(field, "guide_kink_amplitude") + ob = context.object + field = ob.field - elif field.type == 'TEXTURE': - col = split.column() - col.itemR(field, "strength") - col.itemR(field, "texture", text="") - col.itemR(field, "texture_mode", text="") - col.itemR(field, "texture_nabla") - - col = split.column() - col.itemR(field, "use_coordinates") - col.itemR(field, "root_coordinates") - col.itemR(field, "force_2d") + split = layout.split(percentage=0.2) + split.itemL(text="Type:") + split.itemR(field, "type",text="") - else : - basic_force_field_settings_ui(self, field) - - if field.type not in ('NONE', 'GUIDE'): - - layout.itemL(text="Falloff:") - layout.itemR(field, "falloff_type", expand=True) + if field.type not in ('NONE', 'GUIDE', 'TEXTURE'): + split = layout.split(percentage=0.2) + #split = layout.row() + split.itemL(text="Shape:") + split.itemR(field, "shape", text="") - basic_force_field_falloff_ui(self, field) - - if field.falloff_type == 'CONE': - layout.itemS() - - split = layout.split(percentage=0.35) - - col = split.column() - col.itemL(text="Angular:") - col.itemR(field, "use_radial_min", text="Use Minimum") - col.itemR(field, "use_radial_max", text="Use Maximum") - - col = split.column() - col.itemR(field, "radial_falloff", text="Power") - - sub = col.column() - sub.active = field.use_radial_min - sub.itemR(field, "radial_minimum", text="Angle") - - sub = col.column() - sub.active = field.use_radial_max - sub.itemR(field, "radial_maximum", text="Angle") - - elif field.falloff_type == 'TUBE': - layout.itemS() - - split = layout.split(percentage=0.35) - - col = split.column() - col.itemL(text="Radial:") - col.itemR(field, "use_radial_min", text="Use Minimum") - col.itemR(field, "use_radial_max", text="Use Maximum") - - col = split.column() - col.itemR(field, "radial_falloff", text="Power") - - sub = col.column() - sub.active = field.use_radial_min - sub.itemR(field, "radial_minimum", text="Distance") - - sub = col.column() - sub.active = field.use_radial_max - sub.itemR(field, "radial_maximum", text="Distance") + split = layout.split() + + if field.type == 'NONE': + return # nothing to draw + elif field.type == 'GUIDE': + col = split.column() + col.itemR(field, "guide_minimum") + col.itemR(field, "guide_free") + col.itemR(field, "falloff_power") + col.itemR(field, "guide_path_add") + + col = split.column() + col.itemL(text="Clumping:") + col.itemR(field, "guide_clump_amount") + col.itemR(field, "guide_clump_shape") + + row = layout.row() + row.itemR(field, "use_max_distance") + sub = row.row() + sub.active = field.use_max_distance + sub.itemR(field, "maximum_distance") + + layout.itemS() + + layout.itemR(field, "guide_kink_type") + if (field.guide_kink_type != "NONE"): + layout.itemR(field, "guide_kink_axis") + + flow = layout.column_flow() + flow.itemR(field, "guide_kink_frequency") + flow.itemR(field, "guide_kink_shape") + flow.itemR(field, "guide_kink_amplitude") + + elif field.type == 'TEXTURE': + col = split.column() + col.itemR(field, "strength") + col.itemR(field, "texture", text="") + col.itemR(field, "texture_mode", text="") + col.itemR(field, "texture_nabla") + + col = split.column() + col.itemR(field, "use_coordinates") + col.itemR(field, "root_coordinates") + col.itemR(field, "force_2d") + + else : + basic_force_field_settings_ui(self, field) + + if field.type not in ('NONE', 'GUIDE'): + + layout.itemL(text="Falloff:") + layout.itemR(field, "falloff_type", expand=True) + + basic_force_field_falloff_ui(self, field) + + if field.falloff_type == 'CONE': + layout.itemS() + + split = layout.split(percentage=0.35) + + col = split.column() + col.itemL(text="Angular:") + col.itemR(field, "use_radial_min", text="Use Minimum") + col.itemR(field, "use_radial_max", text="Use Maximum") + + col = split.column() + col.itemR(field, "radial_falloff", text="Power") + + sub = col.column() + sub.active = field.use_radial_min + sub.itemR(field, "radial_minimum", text="Angle") + + sub = col.column() + sub.active = field.use_radial_max + sub.itemR(field, "radial_maximum", text="Angle") + + elif field.falloff_type == 'TUBE': + layout.itemS() + + split = layout.split(percentage=0.35) + + col = split.column() + col.itemL(text="Radial:") + col.itemR(field, "use_radial_min", text="Use Minimum") + col.itemR(field, "use_radial_max", text="Use Maximum") + + col = split.column() + col.itemR(field, "radial_falloff", text="Power") + + sub = col.column() + sub.active = field.use_radial_min + sub.itemR(field, "radial_minimum", text="Distance") + + sub = col.column() + sub.active = field.use_radial_max + sub.itemR(field, "radial_maximum", text="Distance") class PHYSICS_PT_collision(PhysicButtonsPanel): - bl_label = "Collision" - #bl_default_closed = True - - def poll(self, context): - ob = context.object - rd = context.scene.render_data - return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - - def draw(self, context): - layout = self.layout - - md = context.collision + bl_label = "Collision" + #bl_default_closed = True - split = layout.split() - split.operator_context = 'EXEC_DEFAULT' + def poll(self, context): + ob = context.object + rd = context.scene.render_data + return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - if md: - # remove modifier + settings - split.set_context_pointer("modifier", md) - split.itemO("object.modifier_remove", text="Remove") - col = split.column() - - #row = split.row(align=True) - #row.itemR(md, "render", text="") - #row.itemR(md, "realtime", text="") - - coll = md.settings - - else: - # add modifier - split.item_enumO("object.modifier_add", "type", 'COLLISION', text="Add") - split.itemL() - - coll = None - - if coll: - settings = context.object.collision + def draw(self, context): + layout = self.layout + + md = context.collision + + split = layout.split() + split.operator_context = 'EXEC_DEFAULT' + + if md: + # remove modifier + settings + split.set_context_pointer("modifier", md) + split.itemO("object.modifier_remove", text="Remove") + col = split.column() + + #row = split.row(align=True) + #row.itemR(md, "render", text="") + #row.itemR(md, "realtime", text="") + + coll = md.settings + + else: + # add modifier + split.item_enumO("object.modifier_add", "type", 'COLLISION', text="Add") + split.itemL() + + coll = None + + if coll: + settings = context.object.collision + + layout.active = settings.enabled + + split = layout.split() + + col = split.column() + col.itemL(text="Particle:") + col.itemR(settings, "permeability", slider=True) + col.itemL(text="Particle Damping:") + sub = col.column(align=True) + sub.itemR(settings, "damping_factor", text="Factor", slider=True) + sub.itemR(settings, "random_damping", text="Random", slider=True) + + col.itemL(text="Soft Body and Cloth:") + sub = col.column(align=True) + sub.itemR(settings, "outer_thickness", text="Outer", slider=True) + sub.itemR(settings, "inner_thickness", text="Inner", slider=True) + + layout.itemL(text="Force Fields:") + layout.itemR(settings, "absorption", text="Absorption") + + col = split.column() + col.itemL(text="") + col.itemR(settings, "kill_particles") + col.itemL(text="Particle Friction:") + sub = col.column(align=True) + sub.itemR(settings, "friction_factor", text="Factor", slider=True) + sub.itemR(settings, "random_friction", text="Random", slider=True) + col.itemL(text="Soft Body Damping:") + col.itemR(settings, "damping", text="Factor", slider=True) - layout.active = settings.enabled - - split = layout.split() - - col = split.column() - col.itemL(text="Particle:") - col.itemR(settings, "permeability", slider=True) - col.itemL(text="Particle Damping:") - sub = col.column(align=True) - sub.itemR(settings, "damping_factor", text="Factor", slider=True) - sub.itemR(settings, "random_damping", text="Random", slider=True) - - col.itemL(text="Soft Body and Cloth:") - sub = col.column(align=True) - sub.itemR(settings, "outer_thickness", text="Outer", slider=True) - sub.itemR(settings, "inner_thickness", text="Inner", slider=True) - - layout.itemL(text="Force Fields:") - layout.itemR(settings, "absorption", text="Absorption") - - col = split.column() - col.itemL(text="") - col.itemR(settings, "kill_particles") - col.itemL(text="Particle Friction:") - sub = col.column(align=True) - sub.itemR(settings, "friction_factor", text="Factor", slider=True) - sub.itemR(settings, "random_friction", text="Random", slider=True) - col.itemL(text="Soft Body Damping:") - col.itemR(settings, "damping", text="Factor", slider=True) - bpy.types.register(PHYSICS_PT_field) bpy.types.register(PHYSICS_PT_collision) diff --git a/release/scripts/ui/buttons_physics_fluid.py b/release/scripts/ui/buttons_physics_fluid.py index 047c2e17db9..cdef3f88185 100644 --- a/release/scripts/ui/buttons_physics_fluid.py +++ b/release/scripts/ui/buttons_physics_fluid.py @@ -2,254 +2,254 @@ import bpy class PhysicButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "physics" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "physics" + + def poll(self, context): + ob = context.object + rd = context.scene.render_data + return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - def poll(self, context): - ob = context.object - rd = context.scene.render_data - return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - class PHYSICS_PT_fluid(PhysicButtonsPanel): - bl_label = "Fluid" + bl_label = "Fluid" - def draw(self, context): - layout = self.layout - - md = context.fluid - ob = context.object + def draw(self, context): + layout = self.layout - split = layout.split() - split.operator_context = 'EXEC_DEFAULT' + md = context.fluid + ob = context.object - if md: - # remove modifier + settings - split.set_context_pointer("modifier", md) - split.itemO("object.modifier_remove", text="Remove") + split = layout.split() + split.operator_context = 'EXEC_DEFAULT' - row = split.row(align=True) - row.itemR(md, "render", text="") - row.itemR(md, "realtime", text="") - - fluid = md.settings - - else: - # add modifier - split.item_enumO("object.modifier_add", "type", 'FLUID_SIMULATION', text="Add") - split.itemL() - - fluid = None - - - if fluid: - layout.itemR(fluid, "type") + if md: + # remove modifier + settings + split.set_context_pointer("modifier", md) + split.itemO("object.modifier_remove", text="Remove") - if fluid.type == 'DOMAIN': - layout.itemO("fluid.bake", text="Bake Fluid Simulation", icon='ICON_MOD_FLUIDSIM') - split = layout.split() - - col = split.column() - col.itemL(text="Resolution:") - col.itemR(fluid, "resolution", text="Final") - col.itemL(text="Render Display:") - col.itemR(fluid, "render_display_mode", text="") - col.itemL(text="Time:") - sub = col.column(align=True) - sub.itemR(fluid, "start_time", text="Start") - sub.itemR(fluid, "end_time", text="End") - - col = split.column() - col.itemL(text="Required Memory: " + fluid.memory_estimate) - col.itemR(fluid, "preview_resolution", text="Preview") - col.itemL(text="Viewport Display:") - col.itemR(fluid, "viewport_display_mode", text="") - col.itemL() - col.itemR(fluid, "generate_speed_vectors") - col.itemR(fluid, "reverse_frames") - - layout.itemR(fluid, "path", text="") - - elif fluid.type == 'FLUID': - split = layout.split() - - col = split.column() - col.itemL(text="Volume Initialization:") - col.itemR(fluid, "volume_initialization", text="") - col.itemR(fluid, "export_animated_mesh") - - col = split.column() - col.itemL(text="Initial Velocity:") - col.itemR(fluid, "initial_velocity", text="") - - elif fluid.type == 'OBSTACLE': - split = layout.split() - - col = split.column() - col.itemL(text="Volume Initialization:") - col.itemR(fluid, "volume_initialization", text="") - col.itemR(fluid, "export_animated_mesh") - - col = split.column() - col.itemL(text="Slip Type:") - col.itemR(fluid, "slip_type", text="") - if fluid.slip_type == 'PARTIALSLIP': - col.itemR(fluid, "partial_slip_factor", slider=True, text="Amount") - - col.itemL(text="Impact:") - col.itemR(fluid, "impact_factor", text="Factor") - - elif fluid.type == 'INFLOW': - split = layout.split() - - col = split.column() - col.itemL(text="Volume Initialization:") - col.itemR(fluid, "volume_initialization", text="") - col.itemR(fluid, "export_animated_mesh") - col.itemR(fluid, "local_coordinates") - - col = split.column() - col.itemL(text="Inflow Velocity:") - col.itemR(fluid, "inflow_velocity", text="") - - elif fluid.type == 'OUTFLOW': - split = layout.split() - - col = split.column() - col.itemL(text="Volume Initialization:") - col.itemR(fluid, "volume_initialization", text="") - col.itemR(fluid, "export_animated_mesh") - - split.column() - - elif fluid.type == 'PARTICLE': - split = layout.split(percentage=0.5) - - col = split.column() - col.itemL(text="Influence:") - col.itemR(fluid, "particle_influence", text="Size") - col.itemR(fluid, "alpha_influence", text="Alpha") - - col = split.column() - col.itemL(text="Type:") - col.itemR(fluid, "drops") - col.itemR(fluid, "floats") - col = split.column() - col.itemL() - col.itemR(fluid, "tracer") - - layout.itemR(fluid, "path", text="") - - elif fluid.type == 'CONTROL': - split = layout.split() - - col = split.column() - col.itemL(text="") - col.itemR(fluid, "quality", slider=True) - col.itemR(fluid, "reverse_frames") - - col = split.column() - col.itemL(text="Time:") - sub = col.column(align=True) - sub.itemR(fluid, "start_time", text="Start") - sub.itemR(fluid, "end_time", text="End") - - split = layout.split() - - col = split.column() - col.itemL(text="Attraction Force:") - sub = col.column(align=True) - sub.itemR(fluid, "attraction_strength", text="Strength") - sub.itemR(fluid, "attraction_radius", text="Radius") - - col = split.column() - col.itemL(text="Velocity Force:") - sub = col.column(align=True) - sub.itemR(fluid, "velocity_strength", text="Strength") - sub.itemR(fluid, "velocity_radius", text="Radius") + row = split.row(align=True) + row.itemR(md, "render", text="") + row.itemR(md, "realtime", text="") + + fluid = md.settings + + else: + # add modifier + split.item_enumO("object.modifier_add", "type", 'FLUID_SIMULATION', text="Add") + split.itemL() + + fluid = None + + + if fluid: + layout.itemR(fluid, "type") + + if fluid.type == 'DOMAIN': + layout.itemO("fluid.bake", text="Bake Fluid Simulation", icon='ICON_MOD_FLUIDSIM') + split = layout.split() + + col = split.column() + col.itemL(text="Resolution:") + col.itemR(fluid, "resolution", text="Final") + col.itemL(text="Render Display:") + col.itemR(fluid, "render_display_mode", text="") + col.itemL(text="Time:") + sub = col.column(align=True) + sub.itemR(fluid, "start_time", text="Start") + sub.itemR(fluid, "end_time", text="End") + + col = split.column() + col.itemL(text="Required Memory: " + fluid.memory_estimate) + col.itemR(fluid, "preview_resolution", text="Preview") + col.itemL(text="Viewport Display:") + col.itemR(fluid, "viewport_display_mode", text="") + col.itemL() + col.itemR(fluid, "generate_speed_vectors") + col.itemR(fluid, "reverse_frames") + + layout.itemR(fluid, "path", text="") + + elif fluid.type == 'FLUID': + split = layout.split() + + col = split.column() + col.itemL(text="Volume Initialization:") + col.itemR(fluid, "volume_initialization", text="") + col.itemR(fluid, "export_animated_mesh") + + col = split.column() + col.itemL(text="Initial Velocity:") + col.itemR(fluid, "initial_velocity", text="") + + elif fluid.type == 'OBSTACLE': + split = layout.split() + + col = split.column() + col.itemL(text="Volume Initialization:") + col.itemR(fluid, "volume_initialization", text="") + col.itemR(fluid, "export_animated_mesh") + + col = split.column() + col.itemL(text="Slip Type:") + col.itemR(fluid, "slip_type", text="") + if fluid.slip_type == 'PARTIALSLIP': + col.itemR(fluid, "partial_slip_factor", slider=True, text="Amount") + + col.itemL(text="Impact:") + col.itemR(fluid, "impact_factor", text="Factor") + + elif fluid.type == 'INFLOW': + split = layout.split() + + col = split.column() + col.itemL(text="Volume Initialization:") + col.itemR(fluid, "volume_initialization", text="") + col.itemR(fluid, "export_animated_mesh") + col.itemR(fluid, "local_coordinates") + + col = split.column() + col.itemL(text="Inflow Velocity:") + col.itemR(fluid, "inflow_velocity", text="") + + elif fluid.type == 'OUTFLOW': + split = layout.split() + + col = split.column() + col.itemL(text="Volume Initialization:") + col.itemR(fluid, "volume_initialization", text="") + col.itemR(fluid, "export_animated_mesh") + + split.column() + + elif fluid.type == 'PARTICLE': + split = layout.split(percentage=0.5) + + col = split.column() + col.itemL(text="Influence:") + col.itemR(fluid, "particle_influence", text="Size") + col.itemR(fluid, "alpha_influence", text="Alpha") + + col = split.column() + col.itemL(text="Type:") + col.itemR(fluid, "drops") + col.itemR(fluid, "floats") + col = split.column() + col.itemL() + col.itemR(fluid, "tracer") + + layout.itemR(fluid, "path", text="") + + elif fluid.type == 'CONTROL': + split = layout.split() + + col = split.column() + col.itemL(text="") + col.itemR(fluid, "quality", slider=True) + col.itemR(fluid, "reverse_frames") + + col = split.column() + col.itemL(text="Time:") + sub = col.column(align=True) + sub.itemR(fluid, "start_time", text="Start") + sub.itemR(fluid, "end_time", text="End") + + split = layout.split() + + col = split.column() + col.itemL(text="Attraction Force:") + sub = col.column(align=True) + sub.itemR(fluid, "attraction_strength", text="Strength") + sub.itemR(fluid, "attraction_radius", text="Radius") + + col = split.column() + col.itemL(text="Velocity Force:") + sub = col.column(align=True) + sub.itemR(fluid, "velocity_strength", text="Strength") + sub.itemR(fluid, "velocity_radius", text="Radius") class PHYSICS_PT_domain_gravity(PhysicButtonsPanel): - bl_label = "Domain World" - bl_default_closed = True - - def poll(self, context): - md = context.fluid - return md and (md.settings.type == 'DOMAIN') + bl_label = "Domain World" + bl_default_closed = True + + def poll(self, context): + md = context.fluid + return md and (md.settings.type == 'DOMAIN') + + def draw(self, context): + layout = self.layout + + fluid = context.fluid.settings + + split = layout.split() + + col = split.column() + col.itemL(text="Gravity:") + col.itemR(fluid, "gravity", text="") + col.itemL(text="Real World Size:") + col.itemR(fluid, "real_world_size", text="Metres") + + col = split.column() + col.itemL(text="Viscosity Presets:") + sub = col.column(align=True) + sub.itemR(fluid, "viscosity_preset", text="") + + if fluid.viscosity_preset == 'MANUAL': + sub.itemR(fluid, "viscosity_base", text="Base") + sub.itemR(fluid, "viscosity_exponent", text="Exponent", slider=True) + else: + sub.itemL() + sub.itemL() + + col.itemL(text="Optimization:") + sub = col.column(align=True) + sub.itemR(fluid, "grid_levels", slider=True) + sub.itemR(fluid, "compressibility", slider=True) - def draw(self, context): - layout = self.layout - - fluid = context.fluid.settings - - split = layout.split() - - col = split.column() - col.itemL(text="Gravity:") - col.itemR(fluid, "gravity", text="") - col.itemL(text="Real World Size:") - col.itemR(fluid, "real_world_size", text="Metres") - - col = split.column() - col.itemL(text="Viscosity Presets:") - sub = col.column(align=True) - sub.itemR(fluid, "viscosity_preset", text="") - - if fluid.viscosity_preset == 'MANUAL': - sub.itemR(fluid, "viscosity_base", text="Base") - sub.itemR(fluid, "viscosity_exponent", text="Exponent", slider=True) - else: - sub.itemL() - sub.itemL() - - col.itemL(text="Optimization:") - sub = col.column(align=True) - sub.itemR(fluid, "grid_levels", slider=True) - sub.itemR(fluid, "compressibility", slider=True) - class PHYSICS_PT_domain_boundary(PhysicButtonsPanel): - bl_label = "Domain Boundary" - bl_default_closed = True - - def poll(self, context): - md = context.fluid - return md and (md.settings.type == 'DOMAIN') + bl_label = "Domain Boundary" + bl_default_closed = True - def draw(self, context): - layout = self.layout - - fluid = context.fluid.settings - - split = layout.split() - - col = split.column() - col.itemL(text="Slip Type:") - sub = col.column(align=True) - sub.itemR(fluid, "slip_type", text="") - if fluid.slip_type == 'PARTIALSLIP': - sub.itemR(fluid, "partial_slip_factor", slider=True, text="Amount") + def poll(self, context): + md = context.fluid + return md and (md.settings.type == 'DOMAIN') + + def draw(self, context): + layout = self.layout + + fluid = context.fluid.settings + + split = layout.split() + + col = split.column() + col.itemL(text="Slip Type:") + sub = col.column(align=True) + sub.itemR(fluid, "slip_type", text="") + if fluid.slip_type == 'PARTIALSLIP': + sub.itemR(fluid, "partial_slip_factor", slider=True, text="Amount") + + col = split.column() + col.itemL(text="Surface:") + sub = col.column(align=True) + sub.itemR(fluid, "surface_smoothing", text="Smoothing") + sub.itemR(fluid, "surface_subdivisions", text="Subdivisions") - col = split.column() - col.itemL(text="Surface:") - sub = col.column(align=True) - sub.itemR(fluid, "surface_smoothing", text="Smoothing") - sub.itemR(fluid, "surface_subdivisions", text="Subdivisions") - class PHYSICS_PT_domain_particles(PhysicButtonsPanel): - bl_label = "Domain Particles" - bl_default_closed = True - - def poll(self, context): - md = context.fluid - return md and (md.settings.type == 'DOMAIN') - - def draw(self, context): - layout = self.layout - - fluid = context.fluid.settings - - col = layout.column(align=True) - col.itemR(fluid, "tracer_particles") - col.itemR(fluid, "generate_particles") + bl_label = "Domain Particles" + bl_default_closed = True + + def poll(self, context): + md = context.fluid + return md and (md.settings.type == 'DOMAIN') + + def draw(self, context): + layout = self.layout + + fluid = context.fluid.settings + + col = layout.column(align=True) + col.itemR(fluid, "tracer_particles") + col.itemR(fluid, "generate_particles") bpy.types.register(PHYSICS_PT_fluid) bpy.types.register(PHYSICS_PT_domain_gravity) diff --git a/release/scripts/ui/buttons_physics_smoke.py b/release/scripts/ui/buttons_physics_smoke.py index dd728fcc876..eaf32ccb0f3 100644 --- a/release/scripts/ui/buttons_physics_smoke.py +++ b/release/scripts/ui/buttons_physics_smoke.py @@ -5,186 +5,186 @@ from buttons_physics_common import point_cache_ui from buttons_physics_common import effector_weights_ui class PhysicButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "physics" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "physics" + + def poll(self, context): + ob = context.object + rd = context.scene.render_data + return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - def poll(self, context): - ob = context.object - rd = context.scene.render_data - return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - class PHYSICS_PT_smoke(PhysicButtonsPanel): - bl_label = "Smoke" + bl_label = "Smoke" - def draw(self, context): - layout = self.layout - - md = context.smoke - ob = context.object + def draw(self, context): + layout = self.layout - split = layout.split() - split.operator_context = 'EXEC_DEFAULT' + md = context.smoke + ob = context.object - if md: - # remove modifier + settings - split.set_context_pointer("modifier", md) - split.itemO("object.modifier_remove", text="Remove") + split = layout.split() + split.operator_context = 'EXEC_DEFAULT' - row = split.row(align=True) - row.itemR(md, "render", text="") - row.itemR(md, "realtime", text="") - - else: - # add modifier - split.item_enumO("object.modifier_add", "type", 'SMOKE', text="Add") - split.itemL() + if md: + # remove modifier + settings + split.set_context_pointer("modifier", md) + split.itemO("object.modifier_remove", text="Remove") - if md: - layout.itemR(md, "smoke_type", expand=True) - - if md.smoke_type == 'TYPE_DOMAIN': - - domain = md.domain_settings - - split = layout.split() - - col = split.column() - col.itemL(text="Resolution:") - col.itemR(domain, "maxres", text="Divisions") - - col = split.column() - col.itemL(text="Behavior:") - col.itemR(domain, "alpha") - col.itemR(domain, "beta") - col.itemR(domain, "dissolve_smoke", text="Dissolve") - sub = col.column() - sub.active = domain.dissolve_smoke - sub.itemR(domain, "dissolve_speed", text="Time") - sub.itemR(domain, "dissolve_smoke_log", text="Slow") - - elif md.smoke_type == 'TYPE_FLOW': - - flow = md.flow_settings - - split = layout.split() - - col = split.column() - col.itemR(flow, "outflow") - col.itemL(text="Particle System:") - col.item_pointerR(flow, "psys", ob, "particle_systems", text="") - - if md.flow_settings.outflow: - col = split.column() - else: - col = split.column() - col.itemL(text="Behavior:") - col.itemR(flow, "temperature") - col.itemR(flow, "density") - - #elif md.smoke_type == 'TYPE_COLL': - # layout.itemS() + row = split.row(align=True) + row.itemR(md, "render", text="") + row.itemR(md, "realtime", text="") + + else: + # add modifier + split.item_enumO("object.modifier_add", "type", 'SMOKE', text="Add") + split.itemL() + + if md: + layout.itemR(md, "smoke_type", expand=True) + + if md.smoke_type == 'TYPE_DOMAIN': + + domain = md.domain_settings + + split = layout.split() + + col = split.column() + col.itemL(text="Resolution:") + col.itemR(domain, "maxres", text="Divisions") + + col = split.column() + col.itemL(text="Behavior:") + col.itemR(domain, "alpha") + col.itemR(domain, "beta") + col.itemR(domain, "dissolve_smoke", text="Dissolve") + sub = col.column() + sub.active = domain.dissolve_smoke + sub.itemR(domain, "dissolve_speed", text="Time") + sub.itemR(domain, "dissolve_smoke_log", text="Slow") + + elif md.smoke_type == 'TYPE_FLOW': + + flow = md.flow_settings + + split = layout.split() + + col = split.column() + col.itemR(flow, "outflow") + col.itemL(text="Particle System:") + col.item_pointerR(flow, "psys", ob, "particle_systems", text="") + + if md.flow_settings.outflow: + col = split.column() + else: + col = split.column() + col.itemL(text="Behavior:") + col.itemR(flow, "temperature") + col.itemR(flow, "density") + + #elif md.smoke_type == 'TYPE_COLL': + # layout.itemS() class PHYSICS_PT_smoke_groups(PhysicButtonsPanel): - bl_label = "Smoke Groups" - bl_default_closed = True - - def poll(self, context): - md = context.smoke - return md and (md.smoke_type == 'TYPE_DOMAIN') + bl_label = "Smoke Groups" + bl_default_closed = True - def draw(self, context): - layout = self.layout - - group = context.smoke.domain_settings - - split = layout.split() - - col = split.column() - col.itemL(text="Flow Group:") - col.itemR(group, "fluid_group", text="") - - #col.itemL(text="Effector Group:") - #col.itemR(group, "eff_group", text="") - - col = split.column() - col.itemL(text="Collision Group:") - col.itemR(group, "coll_group", text="") + def poll(self, context): + md = context.smoke + return md and (md.smoke_type == 'TYPE_DOMAIN') + + def draw(self, context): + layout = self.layout + + group = context.smoke.domain_settings + + split = layout.split() + + col = split.column() + col.itemL(text="Flow Group:") + col.itemR(group, "fluid_group", text="") + + #col.itemL(text="Effector Group:") + #col.itemR(group, "eff_group", text="") + + col = split.column() + col.itemL(text="Collision Group:") + col.itemR(group, "coll_group", text="") class PHYSICS_PT_smoke_cache(PhysicButtonsPanel): - bl_label = "Smoke Cache" - bl_default_closed = True + bl_label = "Smoke Cache" + bl_default_closed = True - def poll(self, context): - md = context.smoke - return md and (md.smoke_type == 'TYPE_DOMAIN') + def poll(self, context): + md = context.smoke + return md and (md.smoke_type == 'TYPE_DOMAIN') - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout + + md = context.smoke.domain_settings + cache = md.point_cache_low + + point_cache_ui(self, cache, cache.baked==False, 0, 1) - md = context.smoke.domain_settings - cache = md.point_cache_low - - point_cache_ui(self, cache, cache.baked==False, 0, 1) - class PHYSICS_PT_smoke_highres(PhysicButtonsPanel): - bl_label = "Smoke High Resolution" - bl_default_closed = True - - def poll(self, context): - md = context.smoke - return md and (md.smoke_type == 'TYPE_DOMAIN') + bl_label = "Smoke High Resolution" + bl_default_closed = True - def draw_header(self, context): - high = context.smoke.domain_settings - - self.layout.itemR(high, "highres", text="") - - def draw(self, context): - layout = self.layout - - md = context.smoke.domain_settings + def poll(self, context): + md = context.smoke + return md and (md.smoke_type == 'TYPE_DOMAIN') + + def draw_header(self, context): + high = context.smoke.domain_settings + + self.layout.itemR(high, "highres", text="") + + def draw(self, context): + layout = self.layout + + md = context.smoke.domain_settings + + split = layout.split() + + col = split.column() + col.itemL(text="Resolution:") + col.itemR(md, "amplify", text="Divisions") + + col = split.column() + col.itemL(text="Noise Method:") + col.row().itemR(md, "noise_type", text="") + col.itemR(md, "strength") + col.itemR(md, "viewhighres") - split = layout.split() - - col = split.column() - col.itemL(text="Resolution:") - col.itemR(md, "amplify", text="Divisions") - - col = split.column() - col.itemL(text="Noise Method:") - col.row().itemR(md, "noise_type", text="") - col.itemR(md, "strength") - col.itemR(md, "viewhighres") - class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel): - bl_label = "Smoke High Resolution Cache" - bl_default_closed = True + bl_label = "Smoke High Resolution Cache" + bl_default_closed = True - def poll(self, context): - md = context.smoke - return md and (md.smoke_type == 'TYPE_DOMAIN') and md.domain_settings.highres + def poll(self, context): + md = context.smoke + return md and (md.smoke_type == 'TYPE_DOMAIN') and md.domain_settings.highres - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout + + md = context.smoke.domain_settings + cache = md.point_cache_high + + point_cache_ui(self, cache, cache.baked==False, 0, 1) - md = context.smoke.domain_settings - cache = md.point_cache_high - - point_cache_ui(self, cache, cache.baked==False, 0, 1) - class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel): - bl_label = "Smoke Field Weights" - bl_default_closed = True - - def poll(self, context): - smoke = context.smoke - return (smoke and smoke.smoke_type == 'TYPE_DOMAIN') - - def draw(self, context): - domain = context.smoke.domain_settings - effector_weights_ui(self, domain.effector_weights) - + bl_label = "Smoke Field Weights" + bl_default_closed = True + + def poll(self, context): + smoke = context.smoke + return (smoke and smoke.smoke_type == 'TYPE_DOMAIN') + + def draw(self, context): + domain = context.smoke.domain_settings + effector_weights_ui(self, domain.effector_weights) + bpy.types.register(PHYSICS_PT_smoke) bpy.types.register(PHYSICS_PT_smoke_field_weights) bpy.types.register(PHYSICS_PT_smoke_cache) diff --git a/release/scripts/ui/buttons_physics_softbody.py b/release/scripts/ui/buttons_physics_softbody.py index 41c061b85c1..a11c33b95b2 100644 --- a/release/scripts/ui/buttons_physics_softbody.py +++ b/release/scripts/ui/buttons_physics_softbody.py @@ -5,236 +5,236 @@ from buttons_physics_common import point_cache_ui from buttons_physics_common import effector_weights_ui def softbody_panel_enabled(md): - return md.point_cache.baked==False + return md.point_cache.baked==False class PhysicButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "physics" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "physics" + + def poll(self, context): + ob = context.object + rd = context.scene.render_data + return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - def poll(self, context): - ob = context.object - rd = context.scene.render_data - return (ob and ob.type == 'MESH') and (not rd.use_game_engine) - class PHYSICS_PT_softbody(PhysicButtonsPanel): - bl_label = "Soft Body" + bl_label = "Soft Body" - def draw(self, context): - layout = self.layout - - md = context.soft_body - ob = context.object + def draw(self, context): + layout = self.layout - split = layout.split() - split.operator_context = "EXEC_DEFAULT" + md = context.soft_body + ob = context.object - if md: - # remove modifier + settings - split.set_context_pointer("modifier", md) - split.itemO("object.modifier_remove", text="Remove") + split = layout.split() + split.operator_context = "EXEC_DEFAULT" - row = split.row(align=True) - row.itemR(md, "render", text="") - row.itemR(md, "realtime", text="") - else: - # add modifier - split.item_enumO("object.modifier_add", "type", 'SOFT_BODY', text="Add") - split.itemL("") - - if md: - softbody = md.settings + if md: + # remove modifier + settings + split.set_context_pointer("modifier", md) + split.itemO("object.modifier_remove", text="Remove") - # General - split = layout.split() - split.enabled = softbody_panel_enabled(md) - - col = split.column() - col.itemL(text="Object:") - col.itemR(softbody, "mass") - col.itemR(softbody, "friction") + row = split.row(align=True) + row.itemR(md, "render", text="") + row.itemR(md, "realtime", text="") + else: + # add modifier + split.item_enumO("object.modifier_add", "type", 'SOFT_BODY', text="Add") + split.itemL("") + + if md: + softbody = md.settings + + # General + split = layout.split() + split.enabled = softbody_panel_enabled(md) + + col = split.column() + col.itemL(text="Object:") + col.itemR(softbody, "mass") + col.itemR(softbody, "friction") + + col = split.column() + col.itemL(text="Simulation:") + col.itemR(softbody, "speed") - col = split.column() - col.itemL(text="Simulation:") - col.itemR(softbody, "speed") - class PHYSICS_PT_softbody_cache(PhysicButtonsPanel): - bl_label = "Soft Body Cache" - bl_default_closed = True + bl_label = "Soft Body Cache" + bl_default_closed = True - def poll(self, context): - return context.soft_body + def poll(self, context): + return context.soft_body + + def draw(self, context): + md = context.soft_body + point_cache_ui(self, md.point_cache, softbody_panel_enabled(md), 0, 0) - def draw(self, context): - md = context.soft_body - point_cache_ui(self, md.point_cache, softbody_panel_enabled(md), 0, 0) - class PHYSICS_PT_softbody_goal(PhysicButtonsPanel): - bl_label = "Soft Body Goal" - bl_default_closed = True - - def poll(self, context): - return context.soft_body - - def draw_header(self, context): - softbody = context.soft_body.settings - - self.layout.active = softbody_panel_enabled(context.soft_body) - self.layout.itemR(softbody, "use_goal", text="") - - def draw(self, context): - layout = self.layout - - md = context.soft_body - softbody = md.settings - ob = context.object - - layout.active = softbody.use_goal and softbody_panel_enabled(md) + bl_label = "Soft Body Goal" + bl_default_closed = True - split = layout.split() + def poll(self, context): + return context.soft_body - # Goal - split = layout.split() + def draw_header(self, context): + softbody = context.soft_body.settings - col = split.column() - col.itemL(text="Goal Strengths:") - col.itemR(softbody, "goal_default", text="Default") - sub = col.column(align=True) - sub.itemR(softbody, "goal_min", text="Minimum") - sub.itemR(softbody, "goal_max", text="Maximum") - - col = split.column() - col.itemL(text="Goal Settings:") - col.itemR(softbody, "goal_spring", text="Stiffness") - col.itemR(softbody, "goal_friction", text="Damping") - - layout.item_pointerR(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group") + self.layout.active = softbody_panel_enabled(context.soft_body) + self.layout.itemR(softbody, "use_goal", text="") + + def draw(self, context): + layout = self.layout + + md = context.soft_body + softbody = md.settings + ob = context.object + + layout.active = softbody.use_goal and softbody_panel_enabled(md) + + split = layout.split() + + # Goal + split = layout.split() + + col = split.column() + col.itemL(text="Goal Strengths:") + col.itemR(softbody, "goal_default", text="Default") + sub = col.column(align=True) + sub.itemR(softbody, "goal_min", text="Minimum") + sub.itemR(softbody, "goal_max", text="Maximum") + + col = split.column() + col.itemL(text="Goal Settings:") + col.itemR(softbody, "goal_spring", text="Stiffness") + col.itemR(softbody, "goal_friction", text="Damping") + + layout.item_pointerR(softbody, "goal_vertex_group", ob, "vertex_groups", text="Vertex Group") class PHYSICS_PT_softbody_edge(PhysicButtonsPanel): - bl_label = "Soft Body Edges" - bl_default_closed = True - - def poll(self, context): - return context.soft_body - - def draw_header(self, context): - softbody = context.soft_body.settings - - self.layout.active = softbody_panel_enabled(context.soft_body) - self.layout.itemR(softbody, "use_edges", text="") - - def draw(self, context): - layout = self.layout - - md = context.soft_body - softbody = md.settings - ob = context.object + bl_label = "Soft Body Edges" + bl_default_closed = True - layout.active = softbody.use_edges and softbody_panel_enabled(md) - - split = layout.split() - - col = split.column() - col.itemL(text="Springs:") - col.itemR(softbody, "pull") - col.itemR(softbody, "push") - col.itemR(softbody, "damp") - col.itemR(softbody, "plastic") - col.itemR(softbody, "bending") - col.itemR(softbody, "spring_length", text="Length") - - col = split.column() - col.itemR(softbody, "stiff_quads") - sub = col.column() - sub.active = softbody.stiff_quads - sub.itemR(softbody, "shear") - - col.itemR(softbody, "new_aero", text="Aero") - sub = col.column() - sub.enabled = softbody.new_aero - sub.itemR(softbody, "aero", text="Factor") + def poll(self, context): + return context.soft_body + + def draw_header(self, context): + softbody = context.soft_body.settings + + self.layout.active = softbody_panel_enabled(context.soft_body) + self.layout.itemR(softbody, "use_edges", text="") + + def draw(self, context): + layout = self.layout + + md = context.soft_body + softbody = md.settings + ob = context.object + + layout.active = softbody.use_edges and softbody_panel_enabled(md) + + split = layout.split() + + col = split.column() + col.itemL(text="Springs:") + col.itemR(softbody, "pull") + col.itemR(softbody, "push") + col.itemR(softbody, "damp") + col.itemR(softbody, "plastic") + col.itemR(softbody, "bending") + col.itemR(softbody, "spring_length", text="Length") + + col = split.column() + col.itemR(softbody, "stiff_quads") + sub = col.column() + sub.active = softbody.stiff_quads + sub.itemR(softbody, "shear") + + col.itemR(softbody, "new_aero", text="Aero") + sub = col.column() + sub.enabled = softbody.new_aero + sub.itemR(softbody, "aero", text="Factor") + + col.itemL(text="Collision:") + col.itemR(softbody, "edge_collision", text="Edge") + col.itemR(softbody, "face_collision", text="Face") - col.itemL(text="Collision:") - col.itemR(softbody, "edge_collision", text="Edge") - col.itemR(softbody, "face_collision", text="Face") - class PHYSICS_PT_softbody_collision(PhysicButtonsPanel): - bl_label = "Soft Body Collision" - bl_default_closed = True - - def poll(self, context): - return context.soft_body - - def draw_header(self, context): - softbody = context.soft_body.settings - - self.layout.active = softbody_panel_enabled(context.soft_body) - self.layout.itemR(softbody, "self_collision", text="") - - def draw(self, context): - layout = self.layout - - md = context.soft_body - softbody = md.settings - ob = context.object + bl_label = "Soft Body Collision" + bl_default_closed = True - layout.active = softbody.self_collision and softbody_panel_enabled(md) - - layout.itemL(text="Collision Type:") - layout.itemR(softbody, "collision_type", expand=True) - - col = layout.column(align=True) - col.itemL(text="Ball:") - col.itemR(softbody, "ball_size", text="Size") - col.itemR(softbody, "ball_stiff", text="Stiffness") - col.itemR(softbody, "ball_damp", text="Dampening") + def poll(self, context): + return context.soft_body + + def draw_header(self, context): + softbody = context.soft_body.settings + + self.layout.active = softbody_panel_enabled(context.soft_body) + self.layout.itemR(softbody, "self_collision", text="") + + def draw(self, context): + layout = self.layout + + md = context.soft_body + softbody = md.settings + ob = context.object + + layout.active = softbody.self_collision and softbody_panel_enabled(md) + + layout.itemL(text="Collision Type:") + layout.itemR(softbody, "collision_type", expand=True) + + col = layout.column(align=True) + col.itemL(text="Ball:") + col.itemR(softbody, "ball_size", text="Size") + col.itemR(softbody, "ball_stiff", text="Stiffness") + col.itemR(softbody, "ball_damp", text="Dampening") class PHYSICS_PT_softbody_solver(PhysicButtonsPanel): - bl_label = "Soft Body Solver" - bl_default_closed = True - - def poll(self, context): - return context.soft_body - - def draw(self, context): - layout = self.layout - - md = context.soft_body - softbody = md.settings - ob = context.object + bl_label = "Soft Body Solver" + bl_default_closed = True - layout.active = softbody_panel_enabled(md) + def poll(self, context): + return context.soft_body - # Solver - split = layout.split() - - col = split.column(align=True) - col.itemL(text="Step Size:") - col.itemR(softbody, "minstep") - col.itemR(softbody, "maxstep") - col.itemR(softbody, "auto_step", text="Auto-Step") - - col = split.column() - col.itemR(softbody, "error_limit") - col.itemL(text="Helpers:") - col.itemR(softbody, "choke") - col.itemR(softbody, "fuzzy") - - layout.itemL(text="Diagnostics:") - layout.itemR(softbody, "diagnose") + def draw(self, context): + layout = self.layout + + md = context.soft_body + softbody = md.settings + ob = context.object + + layout.active = softbody_panel_enabled(md) + + # Solver + split = layout.split() + + col = split.column(align=True) + col.itemL(text="Step Size:") + col.itemR(softbody, "minstep") + col.itemR(softbody, "maxstep") + col.itemR(softbody, "auto_step", text="Auto-Step") + + col = split.column() + col.itemR(softbody, "error_limit") + col.itemL(text="Helpers:") + col.itemR(softbody, "choke") + col.itemR(softbody, "fuzzy") + + layout.itemL(text="Diagnostics:") + layout.itemR(softbody, "diagnose") class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel): - bl_label = "Soft Body Field Weights" - bl_default_closed = True - - def poll(self, context): - return (context.soft_body) - - def draw(self, context): - md = context.soft_body - softbody = md.settings - effector_weights_ui(self, softbody.effector_weights) - + bl_label = "Soft Body Field Weights" + bl_default_closed = True + + def poll(self, context): + return (context.soft_body) + + def draw(self, context): + md = context.soft_body + softbody = md.settings + effector_weights_ui(self, softbody.effector_weights) + bpy.types.register(PHYSICS_PT_softbody) bpy.types.register(PHYSICS_PT_softbody_cache) bpy.types.register(PHYSICS_PT_softbody_goal) diff --git a/release/scripts/ui/buttons_render.py b/release/scripts/ui/buttons_render.py index f20546a5c4d..2e437b671e5 100644 --- a/release/scripts/ui/buttons_render.py +++ b/release/scripts/ui/buttons_render.py @@ -2,445 +2,445 @@ import bpy class RenderButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - 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_data - return (context.scene and rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES) + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + 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_data + return (context.scene and rd.use_game_engine==False) and (rd.engine in self.COMPAT_ENGINES) class RENDER_PT_render(RenderButtonsPanel): - bl_label = "Render" - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data + bl_label = "Render" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - row = layout.row() - row.itemO("screen.render", text="Image", icon='ICON_RENDER_STILL') - row.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION') + def draw(self, context): + layout = self.layout - layout.itemR(rd, "display_mode", text="Display") + rd = context.scene.render_data + + row = layout.row() + row.itemO("screen.render", text="Image", icon='ICON_RENDER_STILL') + row.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION') + + layout.itemR(rd, "display_mode", text="Display") class RENDER_PT_layers(RenderButtonsPanel): - bl_label = "Layers" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def draw(self, context): - layout = self.layout - - scene = context.scene - rd = scene.render_data + bl_label = "Layers" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) - row = layout.row() - row.template_list(rd, "layers", rd, "active_layer_index", rows=2) + def draw(self, context): + layout = self.layout - col = row.column(align=True) - col.itemO("scene.render_layer_add", icon='ICON_ZOOMIN', text="") - col.itemO("scene.render_layer_remove", icon='ICON_ZOOMOUT', text="") + scene = context.scene + rd = scene.render_data - rl = rd.layers[rd.active_layer_index] - - if rl: - layout.itemR(rl, "name") + row = layout.row() + row.template_list(rd, "layers", rd, "active_layer_index", rows=2) - split = layout.split() - - col = split.column() - col.itemR(scene, "visible_layers", text="Scene") - col = split.column() - col.itemR(rl, "visible_layers", text="Layer") + col = row.column(align=True) + col.itemO("scene.render_layer_add", icon='ICON_ZOOMIN', text="") + col.itemO("scene.render_layer_remove", icon='ICON_ZOOMOUT', text="") - layout.itemR(rl, "light_override", text="Light") - layout.itemR(rl, "material_override", text="Material") - - layout.itemS() - layout.itemL(text="Include:") - - split = layout.split() + rl = rd.layers[rd.active_layer_index] - col = split.column() - col.itemR(rl, "zmask") - row = col.row() - row.itemR(rl, "zmask_negate", text="Negate") - row.active = rl.zmask - col.itemR(rl, "all_z") + if rl: + layout.itemR(rl, "name") - col = split.column() - col.itemR(rl, "solid") - col.itemR(rl, "halo") - col.itemR(rl, "ztransp") + split = layout.split() - col = split.column() - col.itemR(rl, "sky") - col.itemR(rl, "edge") - col.itemR(rl, "strand") + col = split.column() + col.itemR(scene, "visible_layers", text="Scene") + col = split.column() + col.itemR(rl, "visible_layers", text="Layer") - if rl.zmask: - split = layout.split() - split.itemL(text="Zmask Layers:") - split.column().itemR(rl, "zmask_layers", text="") - - layout.itemS() - - split = layout.split() - - col = split.column() - col.itemL(text="Passes:") - col.itemR(rl, "pass_combined") - col.itemR(rl, "pass_z") - col.itemR(rl, "pass_vector") - col.itemR(rl, "pass_normal") - col.itemR(rl, "pass_uv") - col.itemR(rl, "pass_mist") - col.itemR(rl, "pass_object_index") + layout.itemR(rl, "light_override", text="Light") + layout.itemR(rl, "material_override", text="Material") - col = split.column() - col.itemL() - col.itemR(rl, "pass_color") - col.itemR(rl, "pass_diffuse") - row = col.row() - row.itemR(rl, "pass_specular") - row.itemR(rl, "pass_specular_exclude", text="", icon='ICON_X') - row = col.row() - row.itemR(rl, "pass_shadow") - row.itemR(rl, "pass_shadow_exclude", text="", icon='ICON_X') - row = col.row() - row.itemR(rl, "pass_ao") - row.itemR(rl, "pass_ao_exclude", text="", icon='ICON_X') - row = col.row() - row.itemR(rl, "pass_reflection") - row.itemR(rl, "pass_reflection_exclude", text="", icon='ICON_X') - row = col.row() - row.itemR(rl, "pass_refraction") - row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X') + layout.itemS() + layout.itemL(text="Include:") + + split = layout.split() + + col = split.column() + col.itemR(rl, "zmask") + row = col.row() + row.itemR(rl, "zmask_negate", text="Negate") + row.active = rl.zmask + col.itemR(rl, "all_z") + + col = split.column() + col.itemR(rl, "solid") + col.itemR(rl, "halo") + col.itemR(rl, "ztransp") + + col = split.column() + col.itemR(rl, "sky") + col.itemR(rl, "edge") + col.itemR(rl, "strand") + + if rl.zmask: + split = layout.split() + split.itemL(text="Zmask Layers:") + split.column().itemR(rl, "zmask_layers", text="") + + layout.itemS() + + split = layout.split() + + col = split.column() + col.itemL(text="Passes:") + col.itemR(rl, "pass_combined") + col.itemR(rl, "pass_z") + col.itemR(rl, "pass_vector") + col.itemR(rl, "pass_normal") + col.itemR(rl, "pass_uv") + col.itemR(rl, "pass_mist") + col.itemR(rl, "pass_object_index") + + col = split.column() + col.itemL() + col.itemR(rl, "pass_color") + col.itemR(rl, "pass_diffuse") + row = col.row() + row.itemR(rl, "pass_specular") + row.itemR(rl, "pass_specular_exclude", text="", icon='ICON_X') + row = col.row() + row.itemR(rl, "pass_shadow") + row.itemR(rl, "pass_shadow_exclude", text="", icon='ICON_X') + row = col.row() + row.itemR(rl, "pass_ao") + row.itemR(rl, "pass_ao_exclude", text="", icon='ICON_X') + row = col.row() + row.itemR(rl, "pass_reflection") + row.itemR(rl, "pass_reflection_exclude", text="", icon='ICON_X') + row = col.row() + row.itemR(rl, "pass_refraction") + row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X') class RENDER_PT_shading(RenderButtonsPanel): - bl_label = "Shading" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Shading" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data - - split = layout.split() - - col = split.column() - col.itemR(rd, "render_textures", text="Textures") - col.itemR(rd, "render_shadows", text="Shadows") - col.itemR(rd, "render_sss", text="Subsurface Scattering") - col.itemR(rd, "render_envmaps", text="Environment Map") - - col = split.column() - col.itemR(rd, "render_raytracing", text="Ray Tracing") - col.itemR(rd, "color_management") - col.itemR(rd, "alpha_mode", text="Alpha") + def draw(self, context): + layout = self.layout + + rd = context.scene.render_data + + split = layout.split() + + col = split.column() + col.itemR(rd, "render_textures", text="Textures") + col.itemR(rd, "render_shadows", text="Shadows") + col.itemR(rd, "render_sss", text="Subsurface Scattering") + col.itemR(rd, "render_envmaps", text="Environment Map") + + col = split.column() + col.itemR(rd, "render_raytracing", text="Ray Tracing") + col.itemR(rd, "color_management") + col.itemR(rd, "alpha_mode", text="Alpha") class RENDER_PT_performance(RenderButtonsPanel): - bl_label = "Performance" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Performance" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column(align=True) - col.itemL(text="Threads:") - col.row().itemR(rd, "threads_mode", expand=True) - sub = col.column() - sub.enabled = rd.threads_mode == 'THREADS_FIXED' - sub.itemR(rd, "threads") - col.itemL(text="Tiles:") - col.itemR(rd, "parts_x", text="X") - col.itemR(rd, "parts_y", text="Y") + rd = context.scene.render_data - col = split.column() - col.itemL(text="Memory:") - sub = col.column() - sub.itemR(rd, "save_buffers") - sub.enabled = not rd.full_sample - sub = col.column() - sub.active = rd.use_compositing - sub.itemR(rd, "free_image_textures") - sub = col.column() - sub.active = rd.render_raytracing - sub.itemL(text="Acceleration structure:") - sub.itemR(rd, "raytrace_structure", text="") - if rd.raytrace_structure == "OCTREE": - sub.itemR(rd, "octree_resolution", text="Resolution") - else: - sub.itemR(rd, "use_instances", text="Instances") - sub.itemR(rd, "use_local_coords", text="Local Coordinates") + split = layout.split() + + col = split.column(align=True) + col.itemL(text="Threads:") + col.row().itemR(rd, "threads_mode", expand=True) + sub = col.column() + sub.enabled = rd.threads_mode == 'THREADS_FIXED' + sub.itemR(rd, "threads") + col.itemL(text="Tiles:") + col.itemR(rd, "parts_x", text="X") + col.itemR(rd, "parts_y", text="Y") + + col = split.column() + col.itemL(text="Memory:") + sub = col.column() + sub.itemR(rd, "save_buffers") + sub.enabled = not rd.full_sample + sub = col.column() + sub.active = rd.use_compositing + sub.itemR(rd, "free_image_textures") + sub = col.column() + sub.active = rd.render_raytracing + sub.itemL(text="Acceleration structure:") + sub.itemR(rd, "raytrace_structure", text="") + if rd.raytrace_structure == "OCTREE": + sub.itemR(rd, "octree_resolution", text="Resolution") + else: + sub.itemR(rd, "use_instances", text="Instances") + sub.itemR(rd, "use_local_coords", text="Local Coordinates") class RENDER_PT_post_processing(RenderButtonsPanel): - bl_label = "Post Processing" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Post Processing" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data + def draw(self, context): + layout = self.layout - split = layout.split() + rd = context.scene.render_data + + split = layout.split() + + col = split.column() + col.itemR(rd, "use_compositing") + col.itemR(rd, "use_sequencer") + + col = split.column() + col.itemR(rd, "dither_intensity", text="Dither", slider=True) + + layout.itemS() + + split = layout.split() + + col = split.column() + col.itemR(rd, "fields", text="Fields") + sub = col.column() + sub.active = rd.fields + sub.row().itemR(rd, "field_order", expand=True) + sub.itemR(rd, "fields_still", text="Still") + + col = split.column() + col.itemR(rd, "edge") + sub = col.column() + sub.active = rd.edge + sub.itemR(rd, "edge_threshold", text="Threshold", slider=True) + sub.itemR(rd, "edge_color", text="") - col = split.column() - col.itemR(rd, "use_compositing") - col.itemR(rd, "use_sequencer") - - col = split.column() - col.itemR(rd, "dither_intensity", text="Dither", slider=True) - - layout.itemS() - - split = layout.split() - - col = split.column() - col.itemR(rd, "fields", text="Fields") - sub = col.column() - sub.active = rd.fields - sub.row().itemR(rd, "field_order", expand=True) - sub.itemR(rd, "fields_still", text="Still") - - col = split.column() - col.itemR(rd, "edge") - sub = col.column() - sub.active = rd.edge - sub.itemR(rd, "edge_threshold", text="Threshold", slider=True) - sub.itemR(rd, "edge_color", text="") - class RENDER_PT_output(RenderButtonsPanel): - bl_label = "Output" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Output" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data - - layout.itemR(rd, "output_path", text="") + def draw(self, context): + layout = self.layout - split = layout.split() - col = split.column() - col.itemR(rd, "file_format", text="") - col.row().itemR(rd, "color_mode", text="Color", expand=True) + rd = context.scene.render_data - col = split.column() - col.itemR(rd, "file_extensions") - col.itemR(rd, "use_overwrite") - col.itemR(rd, "use_placeholder") + layout.itemR(rd, "output_path", text="") - if rd.file_format in ('AVIJPEG', 'JPEG'): - split = layout.split() - split.itemR(rd, "quality", slider=True) - - elif rd.file_format == 'OPENEXR': - split = layout.split() - - col = split.column() - col.itemL(text="Codec:") - col.itemR(rd, "exr_codec", text="") + split = layout.split() + col = split.column() + col.itemR(rd, "file_format", text="") + col.row().itemR(rd, "color_mode", text="Color", expand=True) - subsplit = split.split() - col = subsplit.column() - col.itemR(rd, "exr_half") - col.itemR(rd, "exr_zbuf") - col = subsplit.column() - col.itemR(rd, "exr_preview") - - elif rd.file_format == 'JPEG2000': - split = layout.split() - col = split.column() - col.itemL(text="Depth:") - col.row().itemR(rd, "jpeg2k_depth", expand=True) + col = split.column() + col.itemR(rd, "file_extensions") + col.itemR(rd, "use_overwrite") + col.itemR(rd, "use_placeholder") - col = split.column() - col.itemR(rd, "jpeg2k_preset", text="") - col.itemR(rd, "jpeg2k_ycc") - - elif rd.file_format in ('CINEON', 'DPX'): - split = layout.split() - col = split.column() - col.itemR(rd, "cineon_log", text="Convert to Log") + if rd.file_format in ('AVIJPEG', 'JPEG'): + split = layout.split() + split.itemR(rd, "quality", slider=True) - col = split.column(align=True) - col.active = rd.cineon_log - col.itemR(rd, "cineon_black", text="Black") - col.itemR(rd, "cineon_white", text="White") - col.itemR(rd, "cineon_gamma", text="Gamma") - - elif rd.file_format == 'TIFF': - split = layout.split() - split.itemR(rd, "tiff_bit") + elif rd.file_format == 'OPENEXR': + split = layout.split() + + col = split.column() + col.itemL(text="Codec:") + col.itemR(rd, "exr_codec", text="") + + subsplit = split.split() + col = subsplit.column() + col.itemR(rd, "exr_half") + col.itemR(rd, "exr_zbuf") + col = subsplit.column() + col.itemR(rd, "exr_preview") + + elif rd.file_format == 'JPEG2000': + split = layout.split() + col = split.column() + col.itemL(text="Depth:") + col.row().itemR(rd, "jpeg2k_depth", expand=True) + + col = split.column() + col.itemR(rd, "jpeg2k_preset", text="") + col.itemR(rd, "jpeg2k_ycc") + + elif rd.file_format in ('CINEON', 'DPX'): + split = layout.split() + col = split.column() + col.itemR(rd, "cineon_log", text="Convert to Log") + + col = split.column(align=True) + col.active = rd.cineon_log + col.itemR(rd, "cineon_black", text="Black") + col.itemR(rd, "cineon_white", text="White") + col.itemR(rd, "cineon_gamma", text="Gamma") + + elif rd.file_format == 'TIFF': + split = layout.split() + split.itemR(rd, "tiff_bit") class RENDER_PT_encoding(RenderButtonsPanel): - bl_label = "Encoding" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def poll(self, context): - rd = context.scene.render_data - return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA') + bl_label = "Encoding" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data + def poll(self, context): + rd = context.scene.render_data + return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA') - split = layout.split() - - split.itemR(rd, "ffmpeg_format") - if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'): - split.itemR(rd, "ffmpeg_codec") - else: - split.itemL() + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - col.itemR(rd, "ffmpeg_video_bitrate") - col.itemL(text="Rate:") - col.itemR(rd, "ffmpeg_minrate", text="Minimum") - col.itemR(rd, "ffmpeg_maxrate", text="Maximum") - col.itemR(rd, "ffmpeg_buffersize", text="Buffer") - - col = split.column() - col.itemR(rd, "ffmpeg_gopsize") - col.itemR(rd, "ffmpeg_autosplit") - col.itemL(text="Mux:") - col.itemR(rd, "ffmpeg_muxrate", text="Rate") - col.itemR(rd, "ffmpeg_packetsize", text="Packet Size") - - row = layout.row() - row.itemL(text="Audio:") - row = layout.row() - row.itemR(rd, "ffmpeg_audio_codec") - - split = layout.split() + rd = context.scene.render_data - col = split.column() - col.itemR(rd, "ffmpeg_audio_bitrate") - col.itemR(rd, "ffmpeg_audio_mixrate") - col = split.column() - col.itemR(rd, "ffmpeg_multiplex_audio") - col.itemR(rd, "ffmpeg_audio_volume") + split = layout.split() + + split.itemR(rd, "ffmpeg_format") + if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'): + split.itemR(rd, "ffmpeg_codec") + else: + split.itemL() + + split = layout.split() + + col = split.column() + col.itemR(rd, "ffmpeg_video_bitrate") + col.itemL(text="Rate:") + col.itemR(rd, "ffmpeg_minrate", text="Minimum") + col.itemR(rd, "ffmpeg_maxrate", text="Maximum") + col.itemR(rd, "ffmpeg_buffersize", text="Buffer") + + col = split.column() + col.itemR(rd, "ffmpeg_gopsize") + col.itemR(rd, "ffmpeg_autosplit") + col.itemL(text="Mux:") + col.itemR(rd, "ffmpeg_muxrate", text="Rate") + col.itemR(rd, "ffmpeg_packetsize", text="Packet Size") + + row = layout.row() + row.itemL(text="Audio:") + row = layout.row() + row.itemR(rd, "ffmpeg_audio_codec") + + split = layout.split() + + col = split.column() + col.itemR(rd, "ffmpeg_audio_bitrate") + col.itemR(rd, "ffmpeg_audio_mixrate") + col = split.column() + col.itemR(rd, "ffmpeg_multiplex_audio") + col.itemR(rd, "ffmpeg_audio_volume") class RENDER_PT_antialiasing(RenderButtonsPanel): - bl_label = "Anti-Aliasing" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Anti-Aliasing" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw_header(self, context): - rd = context.scene.render_data + def draw_header(self, context): + rd = context.scene.render_data - self.layout.itemR(rd, "antialiasing", text="") + self.layout.itemR(rd, "antialiasing", text="") - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data + def draw(self, context): + layout = self.layout - layout.active = rd.antialiasing + rd = context.scene.render_data - split = layout.split() - - col = split.column() - col.row().itemR(rd, "antialiasing_samples", expand=True) - col.itemR(rd, "full_sample") + layout.active = rd.antialiasing + + split = layout.split() + + col = split.column() + col.row().itemR(rd, "antialiasing_samples", expand=True) + col.itemR(rd, "full_sample") + + col = split.column() + col.itemR(rd, "pixel_filter", text="") + col.itemR(rd, "filter_size", text="Size", slider=True) - col = split.column() - col.itemR(rd, "pixel_filter", text="") - col.itemR(rd, "filter_size", text="Size", slider=True) - class RENDER_PT_dimensions(RenderButtonsPanel): - bl_label = "Dimensions" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Dimensions" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout - - scene = context.scene - rd = scene.render_data - - split = layout.split() - - col = split.column() - sub = col.column(align=True) - sub.itemL(text="Resolution:") - sub.itemR(rd, "resolution_x", text="X") - sub.itemR(rd, "resolution_y", text="Y") - sub.itemR(rd, "resolution_percentage", text="") - - sub.itemL(text="Aspect Ratio:") - sub.itemR(rd, "pixel_aspect_x", text="X") - sub.itemR(rd, "pixel_aspect_y", text="Y") + def draw(self, context): + layout = self.layout - row = col.row() - row.itemR(rd, "use_border", text="Border") - rowsub = row.row() - rowsub.active = rd.use_border - rowsub.itemR(rd, "crop_to_border", text="Crop") - - col = split.column(align=True) - col.itemL(text="Frame Range:") - col.itemR(scene, "start_frame", text="Start") - col.itemR(scene, "end_frame", text="End") - col.itemR(scene, "frame_step", text="Step") - - col.itemL(text="Frame Rate:") - col.itemR(rd, "fps") - col.itemR(rd, "fps_base",text="/") + scene = context.scene + rd = scene.render_data + + split = layout.split() + + col = split.column() + sub = col.column(align=True) + sub.itemL(text="Resolution:") + sub.itemR(rd, "resolution_x", text="X") + sub.itemR(rd, "resolution_y", text="Y") + sub.itemR(rd, "resolution_percentage", text="") + + sub.itemL(text="Aspect Ratio:") + sub.itemR(rd, "pixel_aspect_x", text="X") + sub.itemR(rd, "pixel_aspect_y", text="Y") + + row = col.row() + row.itemR(rd, "use_border", text="Border") + rowsub = row.row() + rowsub.active = rd.use_border + rowsub.itemR(rd, "crop_to_border", text="Crop") + + col = split.column(align=True) + col.itemL(text="Frame Range:") + col.itemR(scene, "start_frame", text="Start") + col.itemR(scene, "end_frame", text="End") + col.itemR(scene, "frame_step", text="Step") + + col.itemL(text="Frame Rate:") + col.itemR(rd, "fps") + col.itemR(rd, "fps_base",text="/") class RENDER_PT_stamp(RenderButtonsPanel): - bl_label = "Stamp" - bl_default_closed = True - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Stamp" + bl_default_closed = True + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw_header(self, context): - rd = context.scene.render_data + def draw_header(self, context): + rd = context.scene.render_data - self.layout.itemR(rd, "render_stamp", text="") + self.layout.itemR(rd, "render_stamp", text="") - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data + def draw(self, context): + layout = self.layout - layout.active = rd.render_stamp + rd = context.scene.render_data - split = layout.split() - - col = split.column() - col.itemR(rd, "stamp_time", text="Time") - col.itemR(rd, "stamp_date", text="Date") - col.itemR(rd, "stamp_render_time", text="RenderTime") - col.itemR(rd, "stamp_frame", text="Frame") - col.itemR(rd, "stamp_scene", text="Scene") - col.itemR(rd, "stamp_camera", text="Camera") - col.itemR(rd, "stamp_filename", text="Filename") - col.itemR(rd, "stamp_marker", text="Marker") - col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip") + layout.active = rd.render_stamp - col = split.column() - col.active = rd.render_stamp - col.itemR(rd, "stamp_foreground", slider=True) - col.itemR(rd, "stamp_background", slider=True) - col.itemR(rd, "stamp_font_size", text="Font Size") + split = layout.split() - row = layout.split(percentage=0.2) - row.itemR(rd, "stamp_note", text="Note") - sub = row.row() - sub.active = rd.stamp_note - sub.itemR(rd, "stamp_note_text", text="") + col = split.column() + col.itemR(rd, "stamp_time", text="Time") + col.itemR(rd, "stamp_date", text="Date") + col.itemR(rd, "stamp_render_time", text="RenderTime") + col.itemR(rd, "stamp_frame", text="Frame") + col.itemR(rd, "stamp_scene", text="Scene") + col.itemR(rd, "stamp_camera", text="Camera") + col.itemR(rd, "stamp_filename", text="Filename") + col.itemR(rd, "stamp_marker", text="Marker") + col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip") + + col = split.column() + col.active = rd.render_stamp + col.itemR(rd, "stamp_foreground", slider=True) + col.itemR(rd, "stamp_background", slider=True) + col.itemR(rd, "stamp_font_size", text="Font Size") + + row = layout.split(percentage=0.2) + row.itemR(rd, "stamp_note", text="Note") + sub = row.row() + sub.active = rd.stamp_note + sub.itemR(rd, "stamp_note_text", text="") bpy.types.register(RENDER_PT_render) bpy.types.register(RENDER_PT_layers) diff --git a/release/scripts/ui/buttons_scene.py b/release/scripts/ui/buttons_scene.py index 800644ef4ab..9a2d7af4495 100644 --- a/release/scripts/ui/buttons_scene.py +++ b/release/scripts/ui/buttons_scene.py @@ -2,135 +2,135 @@ import bpy class SceneButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "scene" - - def poll(self, context): - return context.scene + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "scene" + + def poll(self, context): + return context.scene class SCENE_PT_scene(SceneButtonsPanel): - bl_label = "Scene" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Scene" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout - - scene = context.scene + def draw(self, context): + layout = self.layout - layout.itemR(scene, "camera") - layout.itemR(scene, "set", text="Background") + scene = context.scene + + layout.itemR(scene, "camera") + layout.itemR(scene, "set", text="Background") class SCENE_PT_unit(SceneButtonsPanel): - bl_label = "Units" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Units" + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def draw(self, context): + layout = self.layout + + unit = context.scene.unit_settings + + col = layout.column() + col.row().itemR(unit, "system", expand=True) + + row = layout.row() + row.active = (unit.system != 'NONE') + row.itemR(unit, "scale_length", text="Scale") + row.itemR(unit, "use_separate") - def draw(self, context): - layout = self.layout - - unit = context.scene.unit_settings - - col = layout.column() - col.row().itemR(unit, "system", expand=True) - - row = layout.row() - row.active = (unit.system != 'NONE') - row.itemR(unit, "scale_length", text="Scale") - row.itemR(unit, "use_separate") - class SCENE_PT_keying_sets(SceneButtonsPanel): - bl_label = "Keying Sets" - - def draw(self, context): - layout = self.layout - - scene = context.scene - - row = layout.row() - - col = row.column() - col.template_list(scene, "keying_sets", scene, "active_keying_set_index", rows=2) - - col = row.column(align=True) - col.itemO("anim.keying_set_add", icon='ICON_ZOOMIN', text="") - col.itemO("anim.keying_set_remove", icon='ICON_ZOOMOUT', text="") - - ks = scene.active_keying_set - if ks: - row = layout.row() - - col = row.column() - col.itemR(ks, "name") - col.itemR(ks, "absolute") - - col = row.column() - col.itemL(text="Keyframing Settings:") - col.itemR(ks, "insertkey_needed", text="Needed") - col.itemR(ks, "insertkey_visual", text="Visual") - + bl_label = "Keying Sets" + + def draw(self, context): + layout = self.layout + + scene = context.scene + + row = layout.row() + + col = row.column() + col.template_list(scene, "keying_sets", scene, "active_keying_set_index", rows=2) + + col = row.column(align=True) + col.itemO("anim.keying_set_add", icon='ICON_ZOOMIN', text="") + col.itemO("anim.keying_set_remove", icon='ICON_ZOOMOUT', text="") + + ks = scene.active_keying_set + if ks: + row = layout.row() + + col = row.column() + col.itemR(ks, "name") + col.itemR(ks, "absolute") + + col = row.column() + col.itemL(text="Keyframing Settings:") + col.itemR(ks, "insertkey_needed", text="Needed") + col.itemR(ks, "insertkey_visual", text="Visual") + class SCENE_PT_keying_set_paths(SceneButtonsPanel): - bl_label = "Active Keying Set" - - def poll(self, context): - return (context.scene != None) and (context.scene.active_keying_set != None) - - def draw(self, context): - layout = self.layout - - scene = context.scene - ks = scene.active_keying_set - - row = layout.row() - row.itemL(text="Paths:") - - row = layout.row() - - col = row.column() - col.template_list(ks, "paths", ks, "active_path_index", rows=2) - - col = row.column(align=True) - col.itemO("anim.keying_set_path_add", icon='ICON_ZOOMIN', text="") - col.itemO("anim.keying_set_path_remove", icon='ICON_ZOOMOUT', text="") - - ksp = ks.active_path - if ksp: - col = layout.column() - col.itemL(text="Target:") - col.template_any_ID(ksp, "id", "id_type") - col.template_path_builder(ksp, "rna_path", ksp.id) - - - row = layout.row() - - col = row.column() - col.itemL(text="Array Target:") - col.itemR(ksp, "entire_array") - if ksp.entire_array == False: - col.itemR(ksp, "array_index") - - col = row.column() - col.itemL(text="F-Curve Grouping:") - col.itemR(ksp, "grouping") - if ksp.grouping == 'NAMED': - col.itemR(ksp, "group") + bl_label = "Active Keying Set" + + def poll(self, context): + return (context.scene != None) and (context.scene.active_keying_set != None) + + def draw(self, context): + layout = self.layout + + scene = context.scene + ks = scene.active_keying_set + + row = layout.row() + row.itemL(text="Paths:") + + row = layout.row() + + col = row.column() + col.template_list(ks, "paths", ks, "active_path_index", rows=2) + + col = row.column(align=True) + col.itemO("anim.keying_set_path_add", icon='ICON_ZOOMIN', text="") + col.itemO("anim.keying_set_path_remove", icon='ICON_ZOOMOUT', text="") + + ksp = ks.active_path + if ksp: + col = layout.column() + col.itemL(text="Target:") + col.template_any_ID(ksp, "id", "id_type") + col.template_path_builder(ksp, "rna_path", ksp.id) + + + row = layout.row() + + col = row.column() + col.itemL(text="Array Target:") + col.itemR(ksp, "entire_array") + if ksp.entire_array == False: + col.itemR(ksp, "array_index") + + col = row.column() + col.itemL(text="F-Curve Grouping:") + col.itemR(ksp, "grouping") + if ksp.grouping == 'NAMED': + col.itemR(ksp, "group") class SCENE_PT_physics(SceneButtonsPanel): - bl_label = "Gravity" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Gravity" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw_header(self, context): - self.layout.itemR(context.scene, "use_gravity", text="") + def draw_header(self, context): + self.layout.itemR(context.scene, "use_gravity", text="") - def draw(self, context): - layout = self.layout - - scene = context.scene + def draw(self, context): + layout = self.layout - layout.active = scene.use_gravity + scene = context.scene - layout.itemR(scene, "gravity", text="") + layout.active = scene.use_gravity -bpy.types.register(SCENE_PT_scene) + layout.itemR(scene, "gravity", text="") + +bpy.types.register(SCENE_PT_scene) bpy.types.register(SCENE_PT_unit) bpy.types.register(SCENE_PT_keying_sets) bpy.types.register(SCENE_PT_keying_set_paths) diff --git a/release/scripts/ui/buttons_texture.py b/release/scripts/ui/buttons_texture.py index 3426a879cca..29f11789ba6 100644 --- a/release/scripts/ui/buttons_texture.py +++ b/release/scripts/ui/buttons_texture.py @@ -1,766 +1,766 @@ import bpy def active_node_mat(mat): - if mat: - mat_node = mat.active_node_material - if mat_node: - return mat_node - else: - return mat + if mat: + mat_node = mat.active_node_material + if mat_node: + return mat_node + else: + return mat + + return None - return None - def context_tex_datablock(context): - - idblock = active_node_mat(context.material) - if idblock: return idblock - - idblock = context.lamp - if idblock: return idblock - - idblock = context.world - if idblock: return idblock - - idblock = context.brush - return idblock + + idblock = active_node_mat(context.material) + if idblock: return idblock + + idblock = context.lamp + if idblock: return idblock + + idblock = context.world + if idblock: return idblock + + idblock = context.brush + return idblock class TextureButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - bl_context = "texture" - - def poll(self, context): - tex = context.texture - return (tex and (tex.type != 'NONE' or tex.use_nodes)) - + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "texture" + + def poll(self, context): + tex = context.texture + return (tex and (tex.type != 'NONE' or tex.use_nodes)) + class TEXTURE_PT_preview(TextureButtonsPanel): - bl_label = "Preview" + bl_label = "Preview" + + def draw(self, context): + layout = self.layout + + tex = context.texture + slot = context.texture_slot + + idblock = context_tex_datablock(context) + + if idblock: + layout.template_preview(tex, parent=idblock, slot=slot) + else: + layout.template_preview(tex, slot=slot) - def draw(self, context): - layout = self.layout - - tex = context.texture - slot = context.texture_slot - - idblock = context_tex_datablock(context) - - if idblock: - layout.template_preview(tex, parent=idblock, slot=slot) - else: - layout.template_preview(tex, slot=slot) - class TEXTURE_PT_context_texture(TextureButtonsPanel): - bl_label = "" - bl_show_header = False + bl_label = "" + bl_show_header = False - def poll(self, context): - return (context.material or context.world or context.lamp or context.brush or context.texture) + def poll(self, context): + return (context.material or context.world or context.lamp or context.brush or context.texture) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - tex = context.texture + tex = context.texture - idblock = context_tex_datablock(context) - - space = context.space_data + idblock = context_tex_datablock(context) - if idblock: - row = layout.row() - - row.template_list(idblock, "textures", idblock, "active_texture_index", rows=2) - - col = row.column(align=True) - col.item_enumO("texture.slot_move", "type", 'UP', text="", icon='ICON_TRIA_UP') - col.item_enumO("texture.slot_move", "type", 'DOWN', text="", icon='ICON_TRIA_DOWN') - - - split = layout.split(percentage=0.65) + space = context.space_data - if idblock: - split.template_ID(idblock, "active_texture", new="texture.new") - elif tex: - split.template_ID(space, "pin_id") + if idblock: + row = layout.row() - if (not space.pin_id) and ( - context.sculpt_object or - context.vertex_paint_object or - context.weight_paint_object or - context.texture_paint_object - ): - split.itemR(space, "brush_texture", text="Brush", toggle=True) + row.template_list(idblock, "textures", idblock, "active_texture_index", rows=2) - if tex: - layout.itemR(tex, "use_nodes") - - split = layout.split(percentage=0.2) + col = row.column(align=True) + col.item_enumO("texture.slot_move", "type", 'UP', text="", icon='ICON_TRIA_UP') + col.item_enumO("texture.slot_move", "type", 'DOWN', text="", icon='ICON_TRIA_DOWN') - if tex.use_nodes: - slot = context.texture_slot - if slot: - split.itemL(text="Output:") - split.itemR(slot, "output_node", text="") + split = layout.split(percentage=0.65) + + if idblock: + split.template_ID(idblock, "active_texture", new="texture.new") + elif tex: + split.template_ID(space, "pin_id") + + if (not space.pin_id) and ( + context.sculpt_object or + context.vertex_paint_object or + context.weight_paint_object or + context.texture_paint_object + ): + split.itemR(space, "brush_texture", text="Brush", toggle=True) + + if tex: + layout.itemR(tex, "use_nodes") + + split = layout.split(percentage=0.2) + + if tex.use_nodes: + slot = context.texture_slot + + if slot: + split.itemL(text="Output:") + split.itemR(slot, "output_node", text="") + + else: + split.itemL(text="Type:") + split.itemR(tex, "type", text="") - else: - split.itemL(text="Type:") - split.itemR(tex, "type", text="") - class TEXTURE_PT_colors(TextureButtonsPanel): - bl_label = "Colors" - bl_default_closed = True + bl_label = "Colors" + bl_default_closed = True - def draw(self, context): - layout = self.layout - - tex = context.texture + def draw(self, context): + layout = self.layout - layout.itemR(tex, "use_color_ramp", text="Ramp") - if tex.use_color_ramp: - layout.template_color_ramp(tex, "color_ramp", expand=True) + tex = context.texture - split = layout.split() + layout.itemR(tex, "use_color_ramp", text="Ramp") + if tex.use_color_ramp: + layout.template_color_ramp(tex, "color_ramp", expand=True) - col = split.column() - col.itemL(text="RGB Multiply:") - sub = col.column(align=True) - sub.itemR(tex, "factor_red", text="R") - sub.itemR(tex, "factor_green", text="G") - sub.itemR(tex, "factor_blue", text="B") + split = layout.split() + + col = split.column() + col.itemL(text="RGB Multiply:") + sub = col.column(align=True) + sub.itemR(tex, "factor_red", text="R") + sub.itemR(tex, "factor_green", text="G") + sub.itemR(tex, "factor_blue", text="B") + + col = split.column() + col.itemL(text="Adjust:") + col.itemR(tex, "brightness") + col.itemR(tex, "contrast") - col = split.column() - col.itemL(text="Adjust:") - col.itemR(tex, "brightness") - col.itemR(tex, "contrast") - # Texture Slot Panels # - + class TextureSlotPanel(TextureButtonsPanel): - def poll(self, context): - return ( - context.texture_slot and - TextureButtonsPanel.poll(self, context) - ) - + def poll(self, context): + return ( + context.texture_slot and + TextureButtonsPanel.poll(self, context) + ) + class TEXTURE_PT_mapping(TextureSlotPanel): - bl_label = "Mapping" - - def draw(self, context): - layout = self.layout - - idblock = context_tex_datablock(context) - - tex = context.texture_slot - textype = context.texture + bl_label = "Mapping" - if type(idblock) != bpy.types.Brush: - split = layout.split(percentage=0.3) - col = split.column() - col.itemL(text="Coordinates:") - col = split.column() - col.itemR(tex, "texture_coordinates", text="") + def draw(self, context): + layout = self.layout - if tex.texture_coordinates == 'ORCO': - """ - ob = context.object - if ob and ob.type == 'MESH': - split = layout.split(percentage=0.3) - split.itemL(text="Mesh:") - split.itemR(ob.data, "texco_mesh", text="") - """ - elif tex.texture_coordinates == 'UV': - split = layout.split(percentage=0.3) - split.itemL(text="Layer:") - ob = context.object - if ob and ob.type == 'MESH': split.item_pointerR(tex, "uv_layer", ob.data, "uv_textures", text="") - else: split.itemR(tex, "uv_layer", text="") - elif tex.texture_coordinates == 'OBJECT': - split = layout.split(percentage=0.3) - split.itemL(text="Object:") - split.itemR(tex, "object", text="") - - if type(idblock) == bpy.types.Brush: - layout.itemR(tex, "map_mode", expand=True) - - row = layout.row() - row.active = tex.map_mode in ('FIXED', 'TILED') - row.itemR(tex, "angle") + idblock = context_tex_datablock(context) - row = layout.row() - row.active = tex.map_mode in ('TILED', '3D') - row.column().itemR(tex, "size") - else: - if type(idblock) == bpy.types.Material: - split = layout.split(percentage=0.3) - split.itemL(text="Projection:") - split.itemR(tex, "mapping", text="") + tex = context.texture_slot + textype = context.texture + + if type(idblock) != bpy.types.Brush: + split = layout.split(percentage=0.3) + col = split.column() + col.itemL(text="Coordinates:") + col = split.column() + col.itemR(tex, "texture_coordinates", text="") + + if tex.texture_coordinates == 'ORCO': + """ + ob = context.object + if ob and ob.type == 'MESH': + split = layout.split(percentage=0.3) + split.itemL(text="Mesh:") + split.itemR(ob.data, "texco_mesh", text="") + """ + elif tex.texture_coordinates == 'UV': + split = layout.split(percentage=0.3) + split.itemL(text="Layer:") + ob = context.object + if ob and ob.type == 'MESH': split.item_pointerR(tex, "uv_layer", ob.data, "uv_textures", text="") + else: split.itemR(tex, "uv_layer", text="") + elif tex.texture_coordinates == 'OBJECT': + split = layout.split(percentage=0.3) + split.itemL(text="Object:") + split.itemR(tex, "object", text="") + + if type(idblock) == bpy.types.Brush: + layout.itemR(tex, "map_mode", expand=True) + + row = layout.row() + row.active = tex.map_mode in ('FIXED', 'TILED') + row.itemR(tex, "angle") + + row = layout.row() + row.active = tex.map_mode in ('TILED', '3D') + row.column().itemR(tex, "size") + else: + if type(idblock) == bpy.types.Material: + split = layout.split(percentage=0.3) + split.itemL(text="Projection:") + split.itemR(tex, "mapping", text="") + + split = layout.split() + + col = split.column() + if tex.texture_coordinates in ('ORCO', 'UV'): + col.itemR(tex, "from_dupli") + elif tex.texture_coordinates == 'OBJECT': + col.itemR(tex, "from_original") + else: + col.itemL() + + col = split.column() + row = col.row() + row.itemR(tex, "x_mapping", text="") + row.itemR(tex, "y_mapping", text="") + row.itemR(tex, "z_mapping", text="") + + # any non brush + row = layout.row() + row.column().itemR(tex, "offset") + row.column().itemR(tex, "size") - split = layout.split() - - col = split.column() - if tex.texture_coordinates in ('ORCO', 'UV'): - col.itemR(tex, "from_dupli") - elif tex.texture_coordinates == 'OBJECT': - col.itemR(tex, "from_original") - else: - col.itemL() - - col = split.column() - row = col.row() - row.itemR(tex, "x_mapping", text="") - row.itemR(tex, "y_mapping", text="") - row.itemR(tex, "z_mapping", text="") - - # any non brush - row = layout.row() - row.column().itemR(tex, "offset") - row.column().itemR(tex, "size") - class TEXTURE_PT_influence(TextureSlotPanel): - bl_label = "Influence" - def poll(self, context): - return context.texture_slot - - - def draw(self, context): - - layout = self.layout - - idblock = context_tex_datablock(context) - - textype = context.texture - tex = context.texture_slot + bl_label = "Influence" + def poll(self, context): + return context.texture_slot - def factor_but(layout, active, toggle, factor, name): - row = layout.row(align=True) - row.itemR(tex, toggle, text="") - sub = row.row() - sub.active = active - sub.itemR(tex, factor, text=name, slider=True) - - if type(idblock) == bpy.types.Material: - if idblock.type in ('SURFACE', 'HALO', 'WIRE'): - split = layout.split() - - col = split.column() - col.itemL(text="Diffuse:") - factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity") - factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color") - factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha") - factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency") - col.itemL(text="Specular:") - factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity") - factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color") - factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness") + def draw(self, context): - col = split.column() - col.itemL(text="Shading:") - factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient") - factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit") - factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror") - factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror") + layout = self.layout - col.itemL(text="Geometry:") - factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal") - factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp") - factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace") + idblock = context_tex_datablock(context) - #sub = col.column() - #sub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror - #sub.itemR(tex, "default_value", text="Amount", slider=True) - elif idblock.type == 'VOLUME': - split = layout.split() - - col = split.column() - factor_but(col, tex.map_density, "map_density", "density_factor", "Density") - factor_but(col, tex.map_emission, "map_emission", "emission_factor", "Emission") - factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering") - factor_but(col, tex.map_reflection, "map_reflection", "reflection_factor", "Reflection") - - col = split.column() - col.itemL(text=" ") - factor_but(col, tex.map_alpha, "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") + textype = context.texture + tex = context.texture_slot - elif type(idblock) == bpy.types.Lamp: - row = layout.row() - factor_but(row, tex.map_color, "map_color", "color_factor", "Color") - factor_but(row, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow") - - elif type(idblock) == bpy.types.World: - split = layout.split() - - col = split.column() - factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend") - factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon") + def factor_but(layout, active, toggle, factor, name): + row = layout.row(align=True) + row.itemR(tex, toggle, text="") + sub = row.row() + sub.active = active + sub.itemR(tex, factor, text=name, slider=True) - 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") + if type(idblock) == bpy.types.Material: + if idblock.type in ('SURFACE', 'HALO', 'WIRE'): + split = layout.split() - layout.itemS() - - split = layout.split() + col = split.column() + col.itemL(text="Diffuse:") + factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity") + factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color") + factor_but(col, tex.map_alpha, "map_alpha", "alpha_factor", "Alpha") + factor_but(col, tex.map_translucency, "map_translucency", "translucency_factor", "Translucency") - col = split.column() - col.itemR(tex, "blend_type", text="Blend") - col.itemR(tex, "rgb_to_intensity") - sub = col.column() - sub.active = tex.rgb_to_intensity - sub.itemR(tex, "color", text="") + col.itemL(text="Specular:") + factor_but(col, tex.map_specular, "map_specular", "specular_factor", "Intensity") + factor_but(col, tex.map_colorspec, "map_colorspec", "colorspec_factor", "Color") + factor_but(col, tex.map_hardness, "map_hardness", "hardness_factor", "Hardness") - col = split.column() - col.itemR(tex, "negate", text="Negative") - col.itemR(tex, "stencil") - - if type(idblock) in (bpy.types.Material, bpy.types.World): - col.itemR(tex, "default_value", text="DVar", slider=True) + col = split.column() + col.itemL(text="Shading:") + factor_but(col, tex.map_ambient, "map_ambient", "ambient_factor", "Ambient") + factor_but(col, tex.map_emit, "map_emit", "emit_factor", "Emit") + factor_but(col, tex.map_mirror, "map_mirror", "mirror_factor", "Mirror") + factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror") + + col.itemL(text="Geometry:") + factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal") + factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp") + factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace") + + #sub = col.column() + #sub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror + #sub.itemR(tex, "default_value", text="Amount", slider=True) + elif idblock.type == 'VOLUME': + split = layout.split() + + col = split.column() + factor_but(col, tex.map_density, "map_density", "density_factor", "Density") + factor_but(col, tex.map_emission, "map_emission", "emission_factor", "Emission") + factor_but(col, tex.map_scattering, "map_scattering", "scattering_factor", "Scattering") + factor_but(col, tex.map_reflection, "map_reflection", "reflection_factor", "Reflection") + + col = split.column() + col.itemL(text=" ") + factor_but(col, tex.map_alpha, "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") + + elif type(idblock) == bpy.types.Lamp: + row = layout.row() + factor_but(row, tex.map_color, "map_color", "color_factor", "Color") + factor_but(row, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow") + + elif type(idblock) == bpy.types.World: + split = layout.split() + + col = split.column() + factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend") + factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon") + + 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") + + layout.itemS() + + split = layout.split() + + col = split.column() + col.itemR(tex, "blend_type", text="Blend") + col.itemR(tex, "rgb_to_intensity") + sub = col.column() + sub.active = tex.rgb_to_intensity + sub.itemR(tex, "color", text="") + + col = split.column() + col.itemR(tex, "negate", text="Negative") + col.itemR(tex, "stencil") + + if type(idblock) in (bpy.types.Material, bpy.types.World): + col.itemR(tex, "default_value", text="DVar", slider=True) # Texture Type Panels # class TextureTypePanel(TextureButtonsPanel): - def poll(self, context): - tex = context.texture - return (tex and tex.type == self.tex_type and not tex.use_nodes) + def poll(self, context): + tex = context.texture + return (tex and tex.type == self.tex_type and not tex.use_nodes) class TEXTURE_PT_clouds(TextureTypePanel): - bl_label = "Clouds" - tex_type = 'CLOUDS' + bl_label = "Clouds" + tex_type = 'CLOUDS' - def draw(self, context): - layout = self.layout - - tex = context.texture - - layout.itemR(tex, "stype", expand=True) - layout.itemL(text="Noise:") - layout.itemR(tex, "noise_type", text="Type", expand=True) - layout.itemR(tex, "noise_basis", text="Basis") - - flow = layout.column_flow() - flow.itemR(tex, "noise_size", text="Size") - flow.itemR(tex, "noise_depth", text="Depth") - flow.itemR(tex, "nabla", text="Nabla") + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemR(tex, "stype", expand=True) + layout.itemL(text="Noise:") + layout.itemR(tex, "noise_type", text="Type", expand=True) + layout.itemR(tex, "noise_basis", text="Basis") + + flow = layout.column_flow() + flow.itemR(tex, "noise_size", text="Size") + flow.itemR(tex, "noise_depth", text="Depth") + flow.itemR(tex, "nabla", text="Nabla") class TEXTURE_PT_wood(TextureTypePanel): - bl_label = "Wood" - tex_type = 'WOOD' + bl_label = "Wood" + tex_type = 'WOOD' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemR(tex, "noisebasis2", expand=True) + layout.itemR(tex, "stype", expand=True) + + col = layout.column() + col.active = tex.stype in ('RINGNOISE', 'BANDNOISE') + col.itemL(text="Noise:") + col.row().itemR(tex, "noise_type", text="Type", expand=True) + col.itemR(tex, "noise_basis", text="Basis") + + flow = layout.column_flow() + flow.active = tex.stype in ('RINGNOISE', 'BANDNOISE') + flow.itemR(tex, "noise_size", text="Size") + flow.itemR(tex, "turbulence") + flow.itemR(tex, "nabla") - def draw(self, context): - layout = self.layout - - tex = context.texture - - layout.itemR(tex, "noisebasis2", expand=True) - layout.itemR(tex, "stype", expand=True) - - col = layout.column() - col.active = tex.stype in ('RINGNOISE', 'BANDNOISE') - col.itemL(text="Noise:") - col.row().itemR(tex, "noise_type", text="Type", expand=True) - col.itemR(tex, "noise_basis", text="Basis") - - flow = layout.column_flow() - flow.active = tex.stype in ('RINGNOISE', 'BANDNOISE') - flow.itemR(tex, "noise_size", text="Size") - flow.itemR(tex, "turbulence") - flow.itemR(tex, "nabla") - class TEXTURE_PT_marble(TextureTypePanel): - bl_label = "Marble" - tex_type = 'MARBLE' - - def draw(self, context): - layout = self.layout - - tex = context.texture - - layout.itemR(tex, "stype", expand=True) - layout.itemR(tex, "noisebasis2", expand=True) - layout.itemL(text="Noise:") - layout.itemR(tex, "noise_type", text="Type", expand=True) - layout.itemR(tex, "noise_basis", text="Basis") - - flow = layout.column_flow() - flow.itemR(tex, "noise_size", text="Size") - flow.itemR(tex, "noise_depth", text="Depth") - flow.itemR(tex, "turbulence") - flow.itemR(tex, "nabla") + bl_label = "Marble" + tex_type = 'MARBLE' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemR(tex, "stype", expand=True) + layout.itemR(tex, "noisebasis2", expand=True) + layout.itemL(text="Noise:") + layout.itemR(tex, "noise_type", text="Type", expand=True) + layout.itemR(tex, "noise_basis", text="Basis") + + flow = layout.column_flow() + flow.itemR(tex, "noise_size", text="Size") + flow.itemR(tex, "noise_depth", text="Depth") + flow.itemR(tex, "turbulence") + flow.itemR(tex, "nabla") class TEXTURE_PT_magic(TextureTypePanel): - bl_label = "Magic" - tex_type = 'MAGIC' - - def draw(self, context): - layout = self.layout - - tex = context.texture - - row = layout.row() - row.itemR(tex, "noise_depth", text="Depth") - row.itemR(tex, "turbulence") + bl_label = "Magic" + tex_type = 'MAGIC' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + row = layout.row() + row.itemR(tex, "noise_depth", text="Depth") + row.itemR(tex, "turbulence") class TEXTURE_PT_blend(TextureTypePanel): - bl_label = "Blend" - tex_type = 'BLEND' - - def draw(self, context): - layout = self.layout - - tex = context.texture + bl_label = "Blend" + tex_type = 'BLEND' - layout.itemR(tex, "progression") - sub = layout.row() + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemR(tex, "progression") + sub = layout.row() + + sub.active = (tex.progression in ('LINEAR', 'QUADRATIC', 'EASING', 'RADIAL')) + sub.itemR(tex, "flip_axis", expand=True) - sub.active = (tex.progression in ('LINEAR', 'QUADRATIC', 'EASING', 'RADIAL')) - sub.itemR(tex, "flip_axis", expand=True) - class TEXTURE_PT_stucci(TextureTypePanel): - bl_label = "Stucci" - tex_type = 'STUCCI' - - def draw(self, context): - layout = self.layout - - tex = context.texture - - layout.itemR(tex, "stype", expand=True) - layout.itemL(text="Noise:") - layout.itemR(tex, "noise_type", text="Type", expand=True) - layout.itemR(tex, "noise_basis", text="Basis") - - row = layout.row() - row.itemR(tex, "noise_size", text="Size") - row.itemR(tex, "turbulence") - + bl_label = "Stucci" + tex_type = 'STUCCI' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemR(tex, "stype", expand=True) + layout.itemL(text="Noise:") + layout.itemR(tex, "noise_type", text="Type", expand=True) + layout.itemR(tex, "noise_basis", text="Basis") + + row = layout.row() + row.itemR(tex, "noise_size", text="Size") + row.itemR(tex, "turbulence") + class TEXTURE_PT_image(TextureTypePanel): - bl_label = "Image" - tex_type = 'IMAGE' - - def draw(self, context): - layout = self.layout + bl_label = "Image" + tex_type = 'IMAGE' - tex = context.texture + def draw(self, context): + layout = self.layout - layout.template_image(tex, "image", tex.image_user) + tex = context.texture + + layout.template_image(tex, "image", tex.image_user) class TEXTURE_PT_image_sampling(TextureTypePanel): - bl_label = "Image Sampling" - bl_default_closed = True - tex_type = 'IMAGE' - - def draw(self, context): - layout = self.layout - - tex = context.texture - slot = context.texture_slot - - split = layout.split() + bl_label = "Image Sampling" + bl_default_closed = True + tex_type = 'IMAGE' - col = split.column() - col.itemL(text="Alpha:") - col.itemR(tex, "use_alpha", text="Use") - col.itemR(tex, "calculate_alpha", text="Calculate") - col.itemR(tex, "invert_alpha", text="Invert") + def draw(self, context): + layout = self.layout - col.itemL(text="Flip:") - col.itemR(tex, "flip_axis", text="X/Y Axis") + tex = context.texture + slot = context.texture_slot - col = split.column() - col.itemR(tex, "normal_map") - row = col.row() - row.active = tex.normal_map - row.itemR(tex, "normal_space", text="") - - col.itemL(text="Filter:") - col.itemR(tex, "filter", text="") - col.itemR(tex, "mipmap") - - row = col.row() - row.active = tex.mipmap - row.itemR(tex, "mipmap_gauss", text="Gauss") - - col.itemR(tex, "interpolation") - if tex.mipmap and tex.filter != 'DEFAULT': - if tex.filter == 'FELINE': - col.itemR(tex, "filter_probes", text="Probes") - else: - col.itemR(tex, "filter_eccentricity", text="Eccentricity") + split = layout.split() + + col = split.column() + col.itemL(text="Alpha:") + col.itemR(tex, "use_alpha", text="Use") + col.itemR(tex, "calculate_alpha", text="Calculate") + col.itemR(tex, "invert_alpha", text="Invert") + + col.itemL(text="Flip:") + col.itemR(tex, "flip_axis", text="X/Y Axis") + + col = split.column() + col.itemR(tex, "normal_map") + row = col.row() + row.active = tex.normal_map + row.itemR(tex, "normal_space", text="") + + col.itemL(text="Filter:") + col.itemR(tex, "filter", text="") + col.itemR(tex, "mipmap") + + row = col.row() + row.active = tex.mipmap + row.itemR(tex, "mipmap_gauss", text="Gauss") + + col.itemR(tex, "interpolation") + if tex.mipmap and tex.filter != 'DEFAULT': + if tex.filter == 'FELINE': + col.itemR(tex, "filter_probes", text="Probes") + else: + col.itemR(tex, "filter_eccentricity", text="Eccentricity") class TEXTURE_PT_image_mapping(TextureTypePanel): - bl_label = "Image Mapping" - bl_default_closed = True - tex_type = 'IMAGE' - - def draw(self, context): - layout = self.layout - - tex = context.texture - - layout.itemR(tex, "extension") - - split = layout.split() - - if tex.extension == 'REPEAT': - col = split.column(align=True) - col.itemL(text="Repeat:") - col.itemR(tex, "repeat_x", text="X") - col.itemR(tex, "repeat_y", text="Y") - - col = split.column(align=True) - col.itemL(text="Mirror:") - col.itemR(tex, "mirror_x", text="X") - col.itemR(tex, "mirror_y", text="Y") - layout.itemS() + bl_label = "Image Mapping" + bl_default_closed = True + tex_type = 'IMAGE' - elif tex.extension == 'CHECKER': - col = split.column(align=True) - row = col.row() - row.itemR(tex, "checker_even", text="Even") - row.itemR(tex, "checker_odd", text="Odd") + def draw(self, context): + layout = self.layout - split.itemR(tex, "checker_distance", text="Distance") - layout.itemS() + tex = context.texture + + layout.itemR(tex, "extension") + + split = layout.split() + + if tex.extension == 'REPEAT': + col = split.column(align=True) + col.itemL(text="Repeat:") + col.itemR(tex, "repeat_x", text="X") + col.itemR(tex, "repeat_y", text="Y") + + col = split.column(align=True) + col.itemL(text="Mirror:") + col.itemR(tex, "mirror_x", text="X") + col.itemR(tex, "mirror_y", text="Y") + layout.itemS() + + elif tex.extension == 'CHECKER': + col = split.column(align=True) + row = col.row() + row.itemR(tex, "checker_even", text="Even") + row.itemR(tex, "checker_odd", text="Odd") + + split.itemR(tex, "checker_distance", text="Distance") + layout.itemS() + + split = layout.split() + + col = split.column(align=True) + #col.itemR(tex, "crop_rectangle") + col.itemL(text="Crop Minimum:") + col.itemR(tex, "crop_min_x", text="X") + col.itemR(tex, "crop_min_y", text="Y") + + col = split.column(align=True) + col.itemL(text="Crop Maximum:") + col.itemR(tex, "crop_max_x", text="X") + col.itemR(tex, "crop_max_y", text="Y") - split = layout.split() - - col = split.column(align=True) - #col.itemR(tex, "crop_rectangle") - col.itemL(text="Crop Minimum:") - col.itemR(tex, "crop_min_x", text="X") - col.itemR(tex, "crop_min_y", text="Y") - - col = split.column(align=True) - col.itemL(text="Crop Maximum:") - col.itemR(tex, "crop_max_x", text="X") - col.itemR(tex, "crop_max_y", text="Y") - class TEXTURE_PT_plugin(TextureTypePanel): - bl_label = "Plugin" - tex_type = 'PLUGIN' - - def draw(self, context): - layout = self.layout - - tex = context.texture - - layout.itemL(text="Nothing yet") - + bl_label = "Plugin" + tex_type = 'PLUGIN' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemL(text="Nothing yet") + class TEXTURE_PT_envmap(TextureTypePanel): - bl_label = "Environment Map" - tex_type = 'ENVIRONMENT_MAP' - - def draw(self, context): - layout = self.layout - - tex = context.texture - - layout.itemL(text="Nothing yet") - + bl_label = "Environment Map" + tex_type = 'ENVIRONMENT_MAP' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemL(text="Nothing yet") + class TEXTURE_PT_musgrave(TextureTypePanel): - bl_label = "Musgrave" - tex_type = 'MUSGRAVE' - - def draw(self, context): - layout = self.layout - - tex = context.texture - - layout.itemR(tex, "musgrave_type") - - split = layout.split() - - col = split.column() - col.itemR(tex, "highest_dimension", text="Dimension") - col.itemR(tex, "lacunarity") - col.itemR(tex, "octaves") - - col = split.column() - if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')): - col.itemR(tex, "offset") - if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')): - col.itemR(tex, "gain") - col.itemR(tex, "noise_intensity", text="Intensity") - - layout.itemL(text="Noise:") - - layout.itemR(tex, "noise_basis", text="Basis") - - row = layout.row() - row.itemR(tex, "noise_size", text="Size") - row.itemR(tex, "nabla") + bl_label = "Musgrave" + tex_type = 'MUSGRAVE' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemR(tex, "musgrave_type") + + split = layout.split() + + col = split.column() + col.itemR(tex, "highest_dimension", text="Dimension") + col.itemR(tex, "lacunarity") + col.itemR(tex, "octaves") + + col = split.column() + if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')): + col.itemR(tex, "offset") + if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')): + col.itemR(tex, "gain") + col.itemR(tex, "noise_intensity", text="Intensity") + + layout.itemL(text="Noise:") + + layout.itemR(tex, "noise_basis", text="Basis") + + row = layout.row() + row.itemR(tex, "noise_size", text="Size") + row.itemR(tex, "nabla") class TEXTURE_PT_voronoi(TextureTypePanel): - bl_label = "Voronoi" - tex_type = 'VORONOI' + bl_label = "Voronoi" + tex_type = 'VORONOI' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + split = layout.split() + + col = split.column() + col.itemL(text="Distance Metric:") + col.itemR(tex, "distance_metric", text="") + sub = col.column() + sub.active = tex.distance_metric == 'MINKOVSKY' + sub.itemR(tex, "minkovsky_exponent", text="Exponent") + col.itemL(text="Coloring:") + col.itemR(tex, "coloring", text="") + col.itemR(tex, "noise_intensity", text="Intensity") + + col = split.column(align=True) + col.itemL(text="Feature Weights:") + col.itemR(tex, "weight_1", text="1", slider=True) + col.itemR(tex, "weight_2", text="2", slider=True) + col.itemR(tex, "weight_3", text="3", slider=True) + col.itemR(tex, "weight_4", text="4", slider=True) + + layout.itemL(text="Noise:") + + row = layout.row() + row.itemR(tex, "noise_size", text="Size") + row.itemR(tex, "nabla") - def draw(self, context): - layout = self.layout - - tex = context.texture - - split = layout.split() - - col = split.column() - col.itemL(text="Distance Metric:") - col.itemR(tex, "distance_metric", text="") - sub = col.column() - sub.active = tex.distance_metric == 'MINKOVSKY' - sub.itemR(tex, "minkovsky_exponent", text="Exponent") - col.itemL(text="Coloring:") - col.itemR(tex, "coloring", text="") - col.itemR(tex, "noise_intensity", text="Intensity") - - col = split.column(align=True) - col.itemL(text="Feature Weights:") - col.itemR(tex, "weight_1", text="1", slider=True) - col.itemR(tex, "weight_2", text="2", slider=True) - col.itemR(tex, "weight_3", text="3", slider=True) - col.itemR(tex, "weight_4", text="4", slider=True) - - layout.itemL(text="Noise:") - - row = layout.row() - row.itemR(tex, "noise_size", text="Size") - row.itemR(tex, "nabla") - class TEXTURE_PT_distortednoise(TextureTypePanel): - bl_label = "Distorted Noise" - tex_type = 'DISTORTED_NOISE' - - def draw(self, context): - layout = self.layout - - tex = context.texture + bl_label = "Distorted Noise" + tex_type = 'DISTORTED_NOISE' + + def draw(self, context): + layout = self.layout + + tex = context.texture + + layout.itemR(tex, "noise_distortion") + layout.itemR(tex, "noise_basis", text="Basis") + + flow = layout.column_flow() + flow.itemR(tex, "distortion", text="Distortion") + flow.itemR(tex, "noise_size", text="Size") + flow.itemR(tex, "nabla") - layout.itemR(tex, "noise_distortion") - layout.itemR(tex, "noise_basis", text="Basis") - - flow = layout.column_flow() - flow.itemR(tex, "distortion", text="Distortion") - flow.itemR(tex, "noise_size", text="Size") - flow.itemR(tex, "nabla") - class TEXTURE_PT_voxeldata(TextureButtonsPanel): - bl_label = "Voxel Data" + bl_label = "Voxel Data" - def poll(self, context): - tex = context.texture - return (tex and tex.type == 'VOXEL_DATA') + def poll(self, context): + tex = context.texture + return (tex and tex.type == 'VOXEL_DATA') - def draw(self, context): - layout = self.layout - - tex = context.texture - vd = tex.voxeldata + def draw(self, context): + layout = self.layout + + tex = context.texture + vd = tex.voxeldata + + layout.itemR(vd, "file_format") + if vd.file_format in ['BLENDER_VOXEL', 'RAW_8BIT']: + layout.itemR(vd, "source_path") + if vd.file_format == 'RAW_8BIT': + layout.itemR(vd, "resolution") + elif vd.file_format == 'SMOKE': + layout.itemR(vd, "domain_object") + + layout.itemR(vd, "still") + row = layout.row() + row.active = vd.still + row.itemR(vd, "still_frame_number") + + layout.itemR(vd, "interpolation") + layout.itemR(vd, "extension") + layout.itemR(vd, "intensity") - layout.itemR(vd, "file_format") - if vd.file_format in ['BLENDER_VOXEL', 'RAW_8BIT']: - layout.itemR(vd, "source_path") - if vd.file_format == 'RAW_8BIT': - layout.itemR(vd, "resolution") - elif vd.file_format == 'SMOKE': - layout.itemR(vd, "domain_object") - - layout.itemR(vd, "still") - row = layout.row() - row.active = vd.still - row.itemR(vd, "still_frame_number") - - layout.itemR(vd, "interpolation") - layout.itemR(vd, "extension") - layout.itemR(vd, "intensity") - class TEXTURE_PT_pointdensity(TextureButtonsPanel): - bl_label = "Point Density" + bl_label = "Point Density" - def poll(self, context): - tex = context.texture - return (tex and tex.type == 'POINT_DENSITY') + def poll(self, context): + tex = context.texture + return (tex and tex.type == 'POINT_DENSITY') - def draw(self, context): - layout = self.layout - - tex = context.texture - pd = tex.pointdensity - - layout.itemR(pd, "point_source", expand=True) + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - if pd.point_source == 'PARTICLE_SYSTEM': - col.itemL(text="Object:") - col.itemR(pd, "object", text="") - - sub = col.column() - sub.enabled = pd.object - if pd.object: - sub.itemL(text="System:") - sub.item_pointerR(pd, "particle_system", pd.object, "particle_systems", text="") - sub.itemL(text="Cache:") - sub.itemR(pd, "particle_cache", text="") - else: - col.itemL(text="Object:") - col.itemR(pd, "object", text="") - col.itemL(text="Cache:") - col.itemR(pd, "vertices_cache", text="") - - col.itemS() - - col.itemL(text="Color Source:") - col.itemR(pd, "color_source", text="") - if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_VELOCITY'): - col.itemR(pd, "speed_scale") - if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'): - layout.template_color_ramp(pd, "color_ramp", expand=True) + tex = context.texture + pd = tex.pointdensity - col = split.column() - col.itemL() - col.itemR(pd, "radius") - col.itemL(text="Falloff:") - col.itemR(pd, "falloff", text="") - if pd.falloff == 'SOFT': - col.itemR(pd, "falloff_softness") + layout.itemR(pd, "point_source", expand=True) + + split = layout.split() + + col = split.column() + if pd.point_source == 'PARTICLE_SYSTEM': + col.itemL(text="Object:") + col.itemR(pd, "object", text="") + + sub = col.column() + sub.enabled = pd.object + if pd.object: + sub.itemL(text="System:") + sub.item_pointerR(pd, "particle_system", pd.object, "particle_systems", text="") + sub.itemL(text="Cache:") + sub.itemR(pd, "particle_cache", text="") + else: + col.itemL(text="Object:") + col.itemR(pd, "object", text="") + col.itemL(text="Cache:") + col.itemR(pd, "vertices_cache", text="") + + col.itemS() + + col.itemL(text="Color Source:") + col.itemR(pd, "color_source", text="") + if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_VELOCITY'): + col.itemR(pd, "speed_scale") + if pd.color_source in ('PARTICLE_SPEED', 'PARTICLE_AGE'): + layout.template_color_ramp(pd, "color_ramp", expand=True) + + col = split.column() + col.itemL() + col.itemR(pd, "radius") + col.itemL(text="Falloff:") + col.itemR(pd, "falloff", text="") + if pd.falloff == 'SOFT': + col.itemR(pd, "falloff_softness") class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel): - bl_label = "Turbulence" - - def poll(self, context): - tex = context.texture - return (tex and tex.type == 'POINT_DENSITY') - - def draw_header(self, context): - layout = self.layout - - tex = context.texture - pd = tex.pointdensity - - layout.itemR(pd, "turbulence", text="") - - def draw(self, context): - layout = self.layout - - tex = context.texture - pd = tex.pointdensity - layout.active = pd.turbulence + bl_label = "Turbulence" - split = layout.split() - - col = split.column() - col.itemL(text="Influence:") - col.itemR(pd, "turbulence_influence", text="") - col.itemL(text="Noise Basis:") - col.itemR(pd, "noise_basis", text="") - - col = split.column() - col.itemL() - col.itemR(pd, "turbulence_size") - col.itemR(pd, "turbulence_depth") - col.itemR(pd, "turbulence_strength") + def poll(self, context): + tex = context.texture + return (tex and tex.type == 'POINT_DENSITY') + + def draw_header(self, context): + layout = self.layout + + tex = context.texture + pd = tex.pointdensity + + layout.itemR(pd, "turbulence", text="") + + def draw(self, context): + layout = self.layout + + tex = context.texture + pd = tex.pointdensity + layout.active = pd.turbulence + + split = layout.split() + + col = split.column() + col.itemL(text="Influence:") + col.itemR(pd, "turbulence_influence", text="") + col.itemL(text="Noise Basis:") + col.itemR(pd, "noise_basis", text="") + + col = split.column() + col.itemL() + col.itemR(pd, "turbulence_size") + col.itemR(pd, "turbulence_depth") + col.itemR(pd, "turbulence_strength") bpy.types.register(TEXTURE_PT_context_texture) bpy.types.register(TEXTURE_PT_preview) diff --git a/release/scripts/ui/buttons_world.py b/release/scripts/ui/buttons_world.py index cfe2410595c..7078a48b72e 100644 --- a/release/scripts/ui/buttons_world.py +++ b/release/scripts/ui/buttons_world.py @@ -2,181 +2,181 @@ import bpy class WorldButtonsPanel(bpy.types.Panel): - bl_space_type = 'PROPERTIES' - bl_region_type = 'WINDOW' - 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_data - return (context.world) and (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES) + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + 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_data + return (context.world) and (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES) class WORLD_PT_preview(WorldButtonsPanel): - bl_label = "Preview" - COMPAT_ENGINES = set(['BLENDER_RENDER']) - - def draw(self, context): - self.layout.template_preview(context.world) - + bl_label = "Preview" + COMPAT_ENGINES = set(['BLENDER_RENDER']) + + def draw(self, context): + self.layout.template_preview(context.world) + class WORLD_PT_context_world(WorldButtonsPanel): - bl_label = "" - bl_show_header = False - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "" + bl_show_header = False + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def poll(self, context): - rd = context.scene.render_data - return (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES) + def poll(self, context): + rd = context.scene.render_data + return (not rd.use_game_engine) and (rd.engine in self.COMPAT_ENGINES) - def draw(self, context): - layout = self.layout - - scene = context.scene - world = context.world - space = context.space_data + def draw(self, context): + layout = self.layout - split = layout.split(percentage=0.65) + scene = context.scene + world = context.world + space = context.space_data - if scene: - split.template_ID(scene, "world", new="world.new") - elif world: - split.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_world(WorldButtonsPanel): - bl_label = "World" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "World" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - world = context.world + world = context.world + + row = layout.row() + row.itemR(world, "paper_sky") + row.itemR(world, "blend_sky") + row.itemR(world, "real_sky") + + row = layout.row() + row.column().itemR(world, "horizon_color") + col = row.column() + col.itemR(world, "zenith_color") + col.active = world.blend_sky + row.column().itemR(world, "ambient_color") - row = layout.row() - row.itemR(world, "paper_sky") - row.itemR(world, "blend_sky") - row.itemR(world, "real_sky") - - row = layout.row() - row.column().itemR(world, "horizon_color") - col = row.column() - col.itemR(world, "zenith_color") - col.active = world.blend_sky - row.column().itemR(world, "ambient_color") - class WORLD_PT_mist(WorldButtonsPanel): - bl_label = "Mist" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Mist" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw_header(self, context): - world = context.world + def draw_header(self, context): + world = context.world - self.layout.itemR(world.mist, "enabled", text="") + self.layout.itemR(world.mist, "enabled", text="") - def draw(self, context): - layout = self.layout - - world = context.world + def draw(self, context): + layout = self.layout - layout.active = world.mist.enabled + world = context.world - flow = layout.column_flow() - flow.itemR(world.mist, "intensity", slider=True) - flow.itemR(world.mist, "start") - flow.itemR(world.mist, "depth") - flow.itemR(world.mist, "height") + layout.active = world.mist.enabled + + flow = layout.column_flow() + flow.itemR(world.mist, "intensity", slider=True) + flow.itemR(world.mist, "start") + flow.itemR(world.mist, "depth") + flow.itemR(world.mist, "height") + + layout.itemR(world.mist, "falloff") - layout.itemR(world.mist, "falloff") - class WORLD_PT_stars(WorldButtonsPanel): - bl_label = "Stars" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Stars" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw_header(self, context): - world = context.world + def draw_header(self, context): + world = context.world - self.layout.itemR(world.stars, "enabled", text="") + self.layout.itemR(world.stars, "enabled", text="") - def draw(self, context): - layout = self.layout - - world = context.world + def draw(self, context): + layout = self.layout - layout.active = world.stars.enabled + world = context.world + + layout.active = world.stars.enabled + + flow = layout.column_flow() + flow.itemR(world.stars, "size") + flow.itemR(world.stars, "color_randomization", text="Colors") + flow.itemR(world.stars, "min_distance", text="Min. Dist") + flow.itemR(world.stars, "average_separation", text="Separation") - flow = layout.column_flow() - flow.itemR(world.stars, "size") - flow.itemR(world.stars, "color_randomization", text="Colors") - flow.itemR(world.stars, "min_distance", text="Min. Dist") - flow.itemR(world.stars, "average_separation", text="Separation") - class WORLD_PT_ambient_occlusion(WorldButtonsPanel): - bl_label = "Ambient Occlusion" - COMPAT_ENGINES = set(['BLENDER_RENDER']) + bl_label = "Ambient Occlusion" + COMPAT_ENGINES = set(['BLENDER_RENDER']) - def draw_header(self, context): - world = context.world + def draw_header(self, context): + world = context.world - self.layout.itemR(world.ambient_occlusion, "enabled", text="") + self.layout.itemR(world.ambient_occlusion, "enabled", text="") - def draw(self, context): - layout = self.layout - - ao = context.world.ambient_occlusion - - layout.active = ao.enabled - - layout.itemR(ao, "gather_method", expand=True) + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - col.itemL(text="Attenuation:") - if ao.gather_method == 'RAYTRACE': - col.itemR(ao, "distance") - col.itemR(ao, "falloff") - sub = col.row() - sub.active = ao.falloff - sub.itemR(ao, "falloff_strength", text="Strength") - - if ao.gather_method == 'RAYTRACE': - col = split.column() - - col.itemL(text="Sampling:") - col.itemR(ao, "sample_method", text="") + ao = context.world.ambient_occlusion - sub = col.column() - sub.itemR(ao, "samples") + layout.active = ao.enabled - if ao.sample_method == 'ADAPTIVE_QMC': - sub.itemR(ao, "threshold") - sub.itemR(ao, "adapt_to_speed", slider=True) - elif ao.sample_method == 'CONSTANT_JITTERED': - sub.itemR(ao, "bias") - - if ao.gather_method == 'APPROXIMATE': - col = split.column() - - col.itemL(text="Sampling:") - col.itemR(ao, "passes") - col.itemR(ao, "error_tolerance", text="Error") - col.itemR(ao, "pixel_cache") - col.itemR(ao, "correction") - - col = layout.column() - col.itemL(text="Influence:") - - col.row().itemR(ao, "blend_mode", expand=True) - - split = layout.split() - - col = split.column() - col.itemR(ao, "energy") - - col = split.column() - sub = col.split(percentage=0.3) - sub.itemL(text="Color:") - sub.itemR(ao, "color", text="") + layout.itemR(ao, "gather_method", expand=True) -bpy.types.register(WORLD_PT_context_world) + split = layout.split() + + col = split.column() + col.itemL(text="Attenuation:") + if ao.gather_method == 'RAYTRACE': + col.itemR(ao, "distance") + col.itemR(ao, "falloff") + sub = col.row() + sub.active = ao.falloff + sub.itemR(ao, "falloff_strength", text="Strength") + + if ao.gather_method == 'RAYTRACE': + col = split.column() + + col.itemL(text="Sampling:") + col.itemR(ao, "sample_method", text="") + + sub = col.column() + sub.itemR(ao, "samples") + + if ao.sample_method == 'ADAPTIVE_QMC': + sub.itemR(ao, "threshold") + sub.itemR(ao, "adapt_to_speed", slider=True) + elif ao.sample_method == 'CONSTANT_JITTERED': + sub.itemR(ao, "bias") + + if ao.gather_method == 'APPROXIMATE': + col = split.column() + + col.itemL(text="Sampling:") + col.itemR(ao, "passes") + col.itemR(ao, "error_tolerance", text="Error") + col.itemR(ao, "pixel_cache") + col.itemR(ao, "correction") + + col = layout.column() + col.itemL(text="Influence:") + + col.row().itemR(ao, "blend_mode", expand=True) + + split = layout.split() + + col = split.column() + col.itemR(ao, "energy") + + col = split.column() + sub = col.split(percentage=0.3) + sub.itemL(text="Color:") + sub.itemR(ao, "color", text="") + +bpy.types.register(WORLD_PT_context_world) bpy.types.register(WORLD_PT_preview) bpy.types.register(WORLD_PT_world) bpy.types.register(WORLD_PT_ambient_occlusion) diff --git a/release/scripts/ui/space_buttons.py b/release/scripts/ui/space_buttons.py index fdbae7164b3..42cdac9ce24 100644 --- a/release/scripts/ui/space_buttons.py +++ b/release/scripts/ui/space_buttons.py @@ -2,34 +2,34 @@ import bpy class Buttons_HT_header(bpy.types.Header): - bl_space_type = 'PROPERTIES' + bl_space_type = 'PROPERTIES' - def draw(self, context): - layout = self.layout - - so = context.space_data - scene = context.scene + def draw(self, context): + layout = self.layout - row= layout.row(align=True) - row.template_header() + so = context.space_data + scene = context.scene - if context.area.show_menus: - sub = row.row(align=True) - sub.itemM("Buttons_MT_view", text="View") - - row = layout.row() - row.itemR(so, "buttons_context", expand=True, text="") - row.itemR(scene, "current_frame") + row= layout.row(align=True) + row.template_header() + + if context.area.show_menus: + sub = row.row(align=True) + sub.itemM("Buttons_MT_view", text="View") + + row = layout.row() + row.itemR(so, "buttons_context", expand=True, text="") + row.itemR(scene, "current_frame") class Buttons_MT_view(bpy.types.Menu): - bl_label = "View" + bl_label = "View" - def draw(self, context): - layout = self.layout - so = context.space_data + def draw(self, context): + layout = self.layout + so = context.space_data - col = layout.column() - col.itemR(so, "panel_alignment", expand=True) + col = layout.column() + col.itemR(so, "panel_alignment", expand=True) bpy.types.register(Buttons_HT_header) bpy.types.register(Buttons_MT_view) diff --git a/release/scripts/ui/space_filebrowser.py b/release/scripts/ui/space_filebrowser.py index 28253a2a2b0..b73d5b6486e 100644 --- a/release/scripts/ui/space_filebrowser.py +++ b/release/scripts/ui/space_filebrowser.py @@ -2,47 +2,47 @@ import bpy class FILEBROWSER_HT_header(bpy.types.Header): - bl_space_type = 'FILE_BROWSER' + bl_space_type = 'FILE_BROWSER' - def draw(self, context): - layout = self.layout - - st = context.space_data - params = st.params - - layout.template_header(menus=False) - - row = layout.row() - row.itemS() - - row = layout.row(align=True) - row.itemO("file.previous", text="", icon='ICON_BACK') - row.itemO("file.next", text="", icon='ICON_FORWARD') - row.itemO("file.parent", text="", icon='ICON_FILE_PARENT') - row.itemO("file.refresh", text="", icon='ICON_FILE_REFRESH') - - row = layout.row() - row.itemS() - - row = layout.row(align=True) - row.itemO("file.directory_new", text="", icon='ICON_NEWFOLDER') - - layout.itemR(params, "display", expand=True, text="") - layout.itemR(params, "sort", expand=True, text="") - - layout.itemR(params, "hide_dot", text="Hide Invisible") - layout.itemR(params, "do_filter", text="", icon='ICON_FILTER') - - row = layout.row(align=True) - row.active = params.do_filter + def draw(self, context): + layout = self.layout - row.itemR(params, "filter_folder", text=""); - row.itemR(params, "filter_blender", text=""); - row.itemR(params, "filter_image", text=""); - row.itemR(params, "filter_movie", text=""); - row.itemR(params, "filter_script", text=""); - row.itemR(params, "filter_font", text=""); - row.itemR(params, "filter_sound", text=""); - row.itemR(params, "filter_text", text=""); + st = context.space_data + params = st.params + + layout.template_header(menus=False) + + row = layout.row() + row.itemS() + + row = layout.row(align=True) + row.itemO("file.previous", text="", icon='ICON_BACK') + row.itemO("file.next", text="", icon='ICON_FORWARD') + row.itemO("file.parent", text="", icon='ICON_FILE_PARENT') + row.itemO("file.refresh", text="", icon='ICON_FILE_REFRESH') + + row = layout.row() + row.itemS() + + row = layout.row(align=True) + row.itemO("file.directory_new", text="", icon='ICON_NEWFOLDER') + + layout.itemR(params, "display", expand=True, text="") + layout.itemR(params, "sort", expand=True, text="") + + layout.itemR(params, "hide_dot", text="Hide Invisible") + layout.itemR(params, "do_filter", text="", icon='ICON_FILTER') + + row = layout.row(align=True) + row.active = params.do_filter + + row.itemR(params, "filter_folder", text=""); + row.itemR(params, "filter_blender", text=""); + row.itemR(params, "filter_image", text=""); + row.itemR(params, "filter_movie", text=""); + row.itemR(params, "filter_script", text=""); + row.itemR(params, "filter_font", text=""); + row.itemR(params, "filter_sound", text=""); + row.itemR(params, "filter_text", text=""); bpy.types.register(FILEBROWSER_HT_header) diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index a69c225535f..4466a5d236f 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -2,480 +2,480 @@ import bpy class IMAGE_MT_view(bpy.types.Menu): - bl_label = "View" + bl_label = "View" - def draw(self, context): - layout = self.layout - - sima = context.space_data - uv = sima.uv_editor - settings = context.tool_settings + def draw(self, context): + layout = self.layout - show_uvedit = sima.show_uvedit + sima = context.space_data + uv = sima.uv_editor + settings = context.tool_settings - layout.itemO("image.properties", icon='ICON_MENU_PANEL') + show_uvedit = sima.show_uvedit - layout.itemS() + layout.itemO("image.properties", icon='ICON_MENU_PANEL') - layout.itemR(sima, "update_automatically") - if show_uvedit: - layout.itemR(settings, "uv_local_view") # Numpad / + layout.itemS() - layout.itemS() + layout.itemR(sima, "update_automatically") + if show_uvedit: + layout.itemR(settings, "uv_local_view") # Numpad / - layout.itemO("image.view_zoom_in") - layout.itemO("image.view_zoom_out") + layout.itemS() - layout.itemS() + layout.itemO("image.view_zoom_in") + layout.itemO("image.view_zoom_out") - ratios = [[1, 8], [1, 4], [1, 2], [1, 1], [2, 1], [4, 1], [8, 1]]; + layout.itemS() - for a, b in ratios: - text = "Zoom %d:%d" % (a, b) - layout.item_floatO("image.view_zoom_ratio", "ratio", a/b, text=text) + ratios = [[1, 8], [1, 4], [1, 2], [1, 1], [2, 1], [4, 1], [8, 1]]; - layout.itemS() + for a, b in ratios: + text = "Zoom %d:%d" % (a, b) + layout.item_floatO("image.view_zoom_ratio", "ratio", a/b, text=text) - if show_uvedit: - layout.itemO("image.view_selected") + layout.itemS() - layout.itemO("image.view_all") - layout.itemO("screen.screen_full_area") + if show_uvedit: + layout.itemO("image.view_selected") + + layout.itemO("image.view_all") + layout.itemO("screen.screen_full_area") class IMAGE_MT_select(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("uv.select_border") - layout.item_booleanO("uv.select_border", "pinned", True) + layout.itemO("uv.select_border") + layout.item_booleanO("uv.select_border", "pinned", True) - layout.itemS() - - layout.itemO("uv.select_all_toggle") - layout.itemO("uv.select_inverse") - layout.itemO("uv.unlink_selection") - - layout.itemS() + layout.itemS() - layout.itemO("uv.select_pinned") - layout.itemO("uv.select_linked") + layout.itemO("uv.select_all_toggle") + layout.itemO("uv.select_inverse") + layout.itemO("uv.unlink_selection") + + layout.itemS() + + layout.itemO("uv.select_pinned") + layout.itemO("uv.select_linked") class IMAGE_MT_image(bpy.types.Menu): - bl_label = "Image" + bl_label = "Image" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - sima = context.space_data - ima = sima.image + sima = context.space_data + ima = sima.image - layout.itemO("image.new") - layout.itemO("image.open") + layout.itemO("image.new") + layout.itemO("image.open") - show_render = sima.show_render + show_render = sima.show_render - if ima: - if not show_render: - layout.itemO("image.replace") - layout.itemO("image.reload") + if ima: + if not show_render: + layout.itemO("image.replace") + layout.itemO("image.reload") - layout.itemO("image.save") - layout.itemO("image.save_as") + layout.itemO("image.save") + layout.itemO("image.save_as") - if ima.source == 'SEQUENCE': - layout.itemO("image.save_sequence") + if ima.source == 'SEQUENCE': + layout.itemO("image.save_sequence") - if not show_render: - layout.itemS() + if not show_render: + layout.itemS() - if ima.packed_file: - layout.itemO("image.unpack") - else: - layout.itemO("image.pack") + if ima.packed_file: + layout.itemO("image.unpack") + else: + layout.itemO("image.pack") - # only for dirty && specific image types, perhaps - # this could be done in operator poll too - if ima.dirty: - if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER': - layout.item_booleanO("image.pack", "as_png", True, text="Pack As PNG") + # only for dirty && specific image types, perhaps + # this could be done in operator poll too + if ima.dirty: + if ima.source in ('FILE', 'GENERATED') and ima.type != 'MULTILAYER': + layout.item_booleanO("image.pack", "as_png", True, text="Pack As PNG") - layout.itemS() + layout.itemS() - layout.itemR(sima, "image_painting") + layout.itemR(sima, "image_painting") class IMAGE_MT_uvs_showhide(bpy.types.Menu): - bl_label = "Show/Hide Faces" + bl_label = "Show/Hide Faces" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("uv.reveal") - layout.itemO("uv.hide") - layout.item_booleanO("uv.hide", "unselected", True) + layout.itemO("uv.reveal") + layout.itemO("uv.hide") + layout.item_booleanO("uv.hide", "unselected", True) class IMAGE_MT_uvs_transform(bpy.types.Menu): - bl_label = "Transform" + bl_label = "Transform" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("tfm.translate") - layout.itemO("tfm.rotate") - layout.itemO("tfm.resize") + layout.itemO("tfm.translate") + layout.itemO("tfm.rotate") + layout.itemO("tfm.resize") class IMAGE_MT_uvs_mirror(bpy.types.Menu): - bl_label = "Mirror" + bl_label = "Mirror" - def draw(self, context): - layout = self.layout - layout.operator_context = "EXEC_REGION_WIN" + def draw(self, context): + layout = self.layout + layout.operator_context = "EXEC_REGION_WIN" - props= layout.itemO("tfm.mirror", text="X Axis", properties=True) - props.constraint_axis[0]= True + props= layout.itemO("tfm.mirror", text="X Axis", properties=True) + props.constraint_axis[0]= True - props= layout.itemO("tfm.mirror", text="Y Axis", properties=True) - props.constraint_axis[1]= True + props= layout.itemO("tfm.mirror", text="Y Axis", properties=True) + props.constraint_axis[1]= True class IMAGE_MT_uvs_weldalign(bpy.types.Menu): - bl_label = "Weld/Align" + bl_label = "Weld/Align" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("uv.weld") # W, 1 - layout.items_enumO("uv.align", "axis") # W, 2/3/4 + layout.itemO("uv.weld") # W, 1 + layout.items_enumO("uv.align", "axis") # W, 2/3/4 class IMAGE_MT_uvs(bpy.types.Menu): - bl_label = "UVs" + bl_label = "UVs" - def draw(self, context): - layout = self.layout - - sima = context.space_data - uv = sima.uv_editor - settings = context.tool_settings + def draw(self, context): + layout = self.layout - layout.itemR(uv, "snap_to_pixels") - layout.itemR(uv, "constrain_to_image_bounds") + sima = context.space_data + uv = sima.uv_editor + settings = context.tool_settings - layout.itemS() + layout.itemR(uv, "snap_to_pixels") + layout.itemR(uv, "constrain_to_image_bounds") - layout.itemR(uv, "live_unwrap") - layout.itemO("uv.unwrap") - layout.item_booleanO("uv.pin", "clear", True, text="Unpin") - layout.itemO("uv.pin") + layout.itemS() - layout.itemS() + layout.itemR(uv, "live_unwrap") + layout.itemO("uv.unwrap") + layout.item_booleanO("uv.pin", "clear", True, text="Unpin") + layout.itemO("uv.pin") - layout.itemO("uv.pack_islands") - layout.itemO("uv.average_islands_scale") - layout.itemO("uv.minimize_stretch") - layout.itemO("uv.stitch") + layout.itemS() - layout.itemS() + layout.itemO("uv.pack_islands") + layout.itemO("uv.average_islands_scale") + layout.itemO("uv.minimize_stretch") + layout.itemO("uv.stitch") - layout.itemM("IMAGE_MT_uvs_transform") - layout.itemM("IMAGE_MT_uvs_mirror") - layout.itemM("IMAGE_MT_uvs_weldalign") + layout.itemS() - layout.itemS() + layout.itemM("IMAGE_MT_uvs_transform") + layout.itemM("IMAGE_MT_uvs_mirror") + layout.itemM("IMAGE_MT_uvs_weldalign") - layout.itemR(settings, "proportional_editing") - layout.item_menu_enumR(settings, "proportional_editing_falloff") + layout.itemS() - layout.itemS() + layout.itemR(settings, "proportional_editing") + layout.item_menu_enumR(settings, "proportional_editing_falloff") - layout.itemM("IMAGE_MT_uvs_showhide") + layout.itemS() + + layout.itemM("IMAGE_MT_uvs_showhide") class IMAGE_HT_header(bpy.types.Header): - bl_space_type = 'IMAGE_EDITOR' + bl_space_type = 'IMAGE_EDITOR' - def draw(self, context): - layout = self.layout - - sima = context.space_data - ima = sima.image - iuser = sima.image_user - settings = context.tool_settings + def draw(self, context): + layout = self.layout - show_render = sima.show_render - show_paint = sima.show_paint - show_uvedit = sima.show_uvedit + sima = context.space_data + ima = sima.image + iuser = sima.image_user + settings = context.tool_settings - row = layout.row(align=True) - row.template_header() + show_render = sima.show_render + show_paint = sima.show_paint + show_uvedit = sima.show_uvedit - # menus - if context.area.show_menus: - sub = row.row(align=True) - sub.itemM("IMAGE_MT_view") + row = layout.row(align=True) + row.template_header() - if show_uvedit: - sub.itemM("IMAGE_MT_select") + # menus + if context.area.show_menus: + sub = row.row(align=True) + sub.itemM("IMAGE_MT_view") - if ima and ima.dirty: - sub.itemM("IMAGE_MT_image", text="Image*") - else: - sub.itemM("IMAGE_MT_image", text="Image") + if show_uvedit: + sub.itemM("IMAGE_MT_select") - if show_uvedit: - sub.itemM("IMAGE_MT_uvs") + if ima and ima.dirty: + sub.itemM("IMAGE_MT_image", text="Image*") + else: + sub.itemM("IMAGE_MT_image", text="Image") - layout.template_ID(sima, "image", new="image.new") + if show_uvedit: + sub.itemM("IMAGE_MT_uvs") - # uv editing - if show_uvedit: - uvedit = sima.uv_editor + layout.template_ID(sima, "image", new="image.new") - layout.itemR(uvedit, "pivot", text="", icon_only=True) - layout.itemR(settings, "uv_sync_selection", text="") + # uv editing + if show_uvedit: + uvedit = sima.uv_editor - if settings.uv_sync_selection: - layout.itemR(settings, "mesh_selection_mode", text="", expand=True) - else: - layout.itemR(settings, "uv_selection_mode", text="", expand=True) - layout.itemR(uvedit, "sticky_selection_mode", text="", icon_only=True) - pass + layout.itemR(uvedit, "pivot", text="", icon_only=True) + layout.itemR(settings, "uv_sync_selection", text="") - row = layout.row(align=True) - row.itemR(settings, "snap", text="") - if settings.snap: - row.itemR(settings, "snap_mode", text="") + if settings.uv_sync_selection: + layout.itemR(settings, "mesh_selection_mode", text="", expand=True) + else: + layout.itemR(settings, "uv_selection_mode", text="", expand=True) + layout.itemR(uvedit, "sticky_selection_mode", text="", icon_only=True) + pass - """ - mesh = context.edit_object.data - row.item_pointerR(mesh, "active_uv_layer", mesh, "uv_textures") - """ + row = layout.row(align=True) + row.itemR(settings, "snap", text="") + if settings.snap: + row.itemR(settings, "snap_mode", text="") - if ima: - # layers - layout.template_image_layers(ima, iuser) + """ + mesh = context.edit_object.data + row.item_pointerR(mesh, "active_uv_layer", mesh, "uv_textures") + """ - # painting - layout.itemR(sima, "image_painting", text="") + if ima: + # layers + layout.template_image_layers(ima, iuser) - # draw options - row = layout.row(align=True) - row.itemR(sima, "draw_channels", text="", expand=True) + # painting + layout.itemR(sima, "image_painting", text="") - row = layout.row(align=True) - if ima.type == 'COMPOSITE': - row.itemO("image.record_composite", icon='ICON_REC') - if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'): - row.itemO("image.play_composite", icon='ICON_PLAY') - - if show_uvedit or sima.image_painting: - layout.itemR(sima, "update_automatically", text="") + # draw options + row = layout.row(align=True) + row.itemR(sima, "draw_channels", text="", expand=True) + + row = layout.row(align=True) + if ima.type == 'COMPOSITE': + row.itemO("image.record_composite", icon='ICON_REC') + if ima.type == 'COMPOSITE' and ima.source in ('MOVIE', 'SEQUENCE'): + row.itemO("image.play_composite", icon='ICON_PLAY') + + if show_uvedit or sima.image_painting: + layout.itemR(sima, "update_automatically", text="") class IMAGE_PT_image_properties(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_label = "Image" + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_label = "Image" - def poll(self, context): - sima = context.space_data - return (sima.image) + def poll(self, context): + sima = context.space_data + return (sima.image) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - sima = context.space_data - ima = sima.image - iuser = sima.image_user + sima = context.space_data + ima = sima.image + iuser = sima.image_user - layout.template_image(sima, "image", iuser, compact=True) + layout.template_image(sima, "image", iuser, compact=True) class IMAGE_PT_game_properties(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_label = "Game Properties" + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_label = "Game Properties" - def poll(self, context): - rd = context.scene.render_data - sima = context.space_data - return (sima and sima.image) and (rd.engine == 'BLENDER_GAME') + def poll(self, context): + rd = context.scene.render_data + sima = context.space_data + return (sima and sima.image) and (rd.engine == 'BLENDER_GAME') - def draw(self, context): - layout = self.layout - - sima = context.space_data - ima = sima.image + def draw(self, context): + layout = self.layout - split = layout.split() + sima = context.space_data + ima = sima.image - col = split.column() - - sub = col.column(align=True) - sub.itemR(ima, "animated") + split = layout.split() + + col = split.column() + + sub = col.column(align=True) + sub.itemR(ima, "animated") + + subsub = sub.column() + subsub.active = ima.animated + subsub.itemR(ima, "animation_start", text="Start") + subsub.itemR(ima, "animation_end", text="End") + subsub.itemR(ima, "animation_speed", text="Speed") + + col.itemR(ima, "tiles") + sub = col.column(align=True) + sub.active = ima.tiles or ima.animated + sub.itemR(ima, "tiles_x", text="X") + sub.itemR(ima, "tiles_y", text="Y") + + col = split.column() + col.itemL(text="Clamp:") + col.itemR(ima, "clamp_x", text="X") + col.itemR(ima, "clamp_y", text="Y") + col.itemS() + col.itemR(ima, "mapping", expand=True) - subsub = sub.column() - subsub.active = ima.animated - subsub.itemR(ima, "animation_start", text="Start") - subsub.itemR(ima, "animation_end", text="End") - subsub.itemR(ima, "animation_speed", text="Speed") - - col.itemR(ima, "tiles") - sub = col.column(align=True) - sub.active = ima.tiles or ima.animated - sub.itemR(ima, "tiles_x", text="X") - sub.itemR(ima, "tiles_y", text="Y") - - col = split.column() - col.itemL(text="Clamp:") - col.itemR(ima, "clamp_x", text="X") - col.itemR(ima, "clamp_y", text="Y") - col.itemS() - col.itemR(ima, "mapping", expand=True) - class IMAGE_PT_view_properties(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_label = "Display" + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_label = "Display" - def poll(self, context): - sima = context.space_data - return (sima and (sima.image or sima.show_uvedit)) + def poll(self, context): + sima = context.space_data + return (sima and (sima.image or sima.show_uvedit)) - def draw(self, context): - layout = self.layout - - sima = context.space_data - ima = sima.image - show_uvedit = sima.show_uvedit - uvedit = sima.uv_editor + def draw(self, context): + layout = self.layout - split = layout.split() + sima = context.space_data + ima = sima.image + show_uvedit = sima.show_uvedit + uvedit = sima.uv_editor - col = split.column() - if ima: - col.itemR(ima, "display_aspect", text="Aspect Ratio") + split = layout.split() - col = split.column() - col.itemL(text="Coordinates:") - col.itemR(sima, "draw_repeated", text="Repeat") - if show_uvedit: - col.itemR(uvedit, "normalized_coordinates", text="Normalized") - elif show_uvedit: - col.itemL(text="Coordinates:") - col.itemR(uvedit, "normalized_coordinates", text="Normalized") + col = split.column() + if ima: + col.itemR(ima, "display_aspect", text="Aspect Ratio") - if show_uvedit: - - col = layout.column() - col.itemL(text="UVs:") - row = col.row() - row.itemR(uvedit, "edge_draw_type", expand=True) - - split = layout.split() + col = split.column() + col.itemL(text="Coordinates:") + col.itemR(sima, "draw_repeated", text="Repeat") + if show_uvedit: + col.itemR(uvedit, "normalized_coordinates", text="Normalized") + elif show_uvedit: + col.itemL(text="Coordinates:") + col.itemR(uvedit, "normalized_coordinates", text="Normalized") - col = split.column() - col.itemR(uvedit, "draw_stretch", text="Stretch") - sub = col.column() - sub.active = uvedit.draw_stretch - sub.row().itemR(uvedit, "draw_stretch_type", expand=True) - - col = split.column() - col.itemR(uvedit, "draw_smooth_edges", text="Smooth") - col.itemR(uvedit, "draw_modified_edges", text="Modified") - #col.itemR(uvedit, "draw_edges") - #col.itemR(uvedit, "draw_faces") + if show_uvedit: + + col = layout.column() + col.itemL(text="UVs:") + row = col.row() + row.itemR(uvedit, "edge_draw_type", expand=True) + + split = layout.split() + + col = split.column() + col.itemR(uvedit, "draw_stretch", text="Stretch") + sub = col.column() + sub.active = uvedit.draw_stretch + sub.row().itemR(uvedit, "draw_stretch_type", expand=True) + + col = split.column() + col.itemR(uvedit, "draw_smooth_edges", text="Smooth") + col.itemR(uvedit, "draw_modified_edges", text="Modified") + #col.itemR(uvedit, "draw_edges") + #col.itemR(uvedit, "draw_faces") class IMAGE_PT_paint(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_label = "Paint" + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_label = "Paint" - def poll(self, context): - sima = context.space_data - return sima.show_paint + def poll(self, context): + sima = context.space_data + return sima.show_paint - def draw(self, context): - layout = self.layout - - settings = context.tool_settings.image_paint - brush = settings.brush + def draw(self, context): + layout = self.layout - col = layout.split().column() - row = col.row() - row.template_list(settings, "brushes", settings, "active_brush_index", rows=2) - - col.template_ID(settings, "brush", new="brush.add") + settings = context.tool_settings.image_paint + brush = settings.brush - row = layout.row(align=True) - row.item_enumR(settings, "tool", 'DRAW') - row.item_enumR(settings, "tool", 'SOFTEN') - row.item_enumR(settings, "tool", 'CLONE') - row.item_enumR(settings, "tool", 'SMEAR') - - if brush: - col = layout.column() - col.itemR(brush, "color", text="") + col = layout.split().column() + row = col.row() + row.template_list(settings, "brushes", settings, "active_brush_index", rows=2) - row = col.row(align=True) - row.itemR(brush, "size", slider=True) - row.itemR(brush, "use_size_pressure", toggle=True, text="") - - row = col.row(align=True) - row.itemR(brush, "strength", slider=True) - row.itemR(brush, "use_strength_pressure", toggle=True, text="") + col.template_ID(settings, "brush", new="brush.add") - row = col.row(align=True) - row.itemR(brush, "jitter", slider=True) - row.itemR(brush, "use_jitter_pressure", toggle=True, text="") + row = layout.row(align=True) + row.item_enumR(settings, "tool", 'DRAW') + row.item_enumR(settings, "tool", 'SOFTEN') + row.item_enumR(settings, "tool", 'CLONE') + row.item_enumR(settings, "tool", 'SMEAR') - col.itemR(brush, "blend", text="Blend") + if brush: + col = layout.column() + col.itemR(brush, "color", text="") + + row = col.row(align=True) + row.itemR(brush, "size", slider=True) + row.itemR(brush, "use_size_pressure", toggle=True, text="") + + row = col.row(align=True) + row.itemR(brush, "strength", slider=True) + row.itemR(brush, "use_strength_pressure", toggle=True, text="") + + row = col.row(align=True) + row.itemR(brush, "jitter", slider=True) + row.itemR(brush, "use_jitter_pressure", toggle=True, text="") + + col.itemR(brush, "blend", text="Blend") class IMAGE_PT_paint_stroke(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_label = "Paint Stroke" - bl_default_closed = True + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_label = "Paint Stroke" + bl_default_closed = True - def poll(self, context): - sima = context.space_data - settings = context.tool_settings.image_paint - return sima.show_paint and settings.brush + def poll(self, context): + sima = context.space_data + settings = context.tool_settings.image_paint + return sima.show_paint and settings.brush - def draw(self, context): - layout = self.layout - - settings = context.tool_settings.image_paint - brush = settings.brush + def draw(self, context): + layout = self.layout - layout.itemR(brush, "use_airbrush") - col = layout.column() - col.active = brush.use_airbrush - col.itemR(brush, "rate", slider=True) + settings = context.tool_settings.image_paint + brush = settings.brush - layout.itemR(brush, "use_space") - row = layout.row(align=True) - row.active = brush.use_space - row.itemR(brush, "spacing", text="Distance", slider=True) - row.itemR(brush, "use_spacing_pressure", toggle=True, text="") + layout.itemR(brush, "use_airbrush") + col = layout.column() + col.active = brush.use_airbrush + col.itemR(brush, "rate", slider=True) + + layout.itemR(brush, "use_space") + row = layout.row(align=True) + row.active = brush.use_space + row.itemR(brush, "spacing", text="Distance", slider=True) + row.itemR(brush, "use_spacing_pressure", toggle=True, text="") class IMAGE_PT_paint_curve(bpy.types.Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_label = "Paint Curve" - bl_default_closed = True + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_label = "Paint Curve" + bl_default_closed = True - def poll(self, context): - sima = context.space_data - settings = context.tool_settings.image_paint - return sima.show_paint and settings.brush + def poll(self, context): + sima = context.space_data + settings = context.tool_settings.image_paint + return sima.show_paint and settings.brush - def draw(self, context): - layout = self.layout - - settings = context.tool_settings.image_paint - brush = settings.brush + def draw(self, context): + layout = self.layout - layout.template_curve_mapping(brush, "curve") - layout.item_menu_enumO("brush.curve_preset", property="shape") + settings = context.tool_settings.image_paint + brush = settings.brush + + layout.template_curve_mapping(brush, "curve") + layout.item_menu_enumO("brush.curve_preset", property="shape") bpy.types.register(IMAGE_MT_view) bpy.types.register(IMAGE_MT_select) diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index bf7d30c461d..b127d6288dc 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -5,234 +5,234 @@ import dynamic_menu # reload(dynamic_menu) class INFO_HT_header(bpy.types.Header): - bl_space_type = 'INFO' + bl_space_type = 'INFO' - def draw(self, context): - layout = self.layout - - st = context.space_data - scene = context.scene - rd = scene.render_data + def draw(self, context): + layout = self.layout - row = layout.row(align=True) - row.template_header() + st = context.space_data + scene = context.scene + rd = scene.render_data - if context.area.show_menus: - sub = row.row(align=True) - sub.itemM("INFO_MT_file") - sub.itemM("INFO_MT_add") - if rd.use_game_engine: - sub.itemM("INFO_MT_game") - else: - sub.itemM("INFO_MT_render") - sub.itemM("INFO_MT_help") + row = layout.row(align=True) + row.template_header() - layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete") - layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete") + if context.area.show_menus: + sub = row.row(align=True) + sub.itemM("INFO_MT_file") + sub.itemM("INFO_MT_add") + if rd.use_game_engine: + sub.itemM("INFO_MT_game") + else: + sub.itemM("INFO_MT_render") + sub.itemM("INFO_MT_help") - if rd.multiple_engines: - layout.itemR(rd, "engine", text="") + layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete") + layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete") - layout.itemS() + if rd.multiple_engines: + layout.itemR(rd, "engine", text="") - layout.template_operator_search() - layout.template_running_jobs() + layout.itemS() - layout.itemL(text=scene.statistics()) - - layout.itemO("wm.window_fullscreen_toggle", icon='ICON_ARROW_LEFTRIGHT', text="") + layout.template_operator_search() + layout.template_running_jobs() + + layout.itemL(text=scene.statistics()) + + layout.itemO("wm.window_fullscreen_toggle", icon='ICON_ARROW_LEFTRIGHT', text="") class INFO_MT_file(bpy.types.Menu): - bl_label = "File" + bl_label = "File" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.operator_context = "EXEC_AREA" - layout.itemO("wm.read_homefile", text="New", icon='ICON_NEW') - layout.operator_context = "INVOKE_AREA" - layout.itemO("wm.open_mainfile", text="Open...", icon='ICON_FILE_FOLDER') - layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent") - layout.itemO("wm.recover_last_session") - layout.itemO("wm.recover_auto_save", text="Recover Auto Save...") + layout.operator_context = "EXEC_AREA" + layout.itemO("wm.read_homefile", text="New", icon='ICON_NEW') + layout.operator_context = "INVOKE_AREA" + layout.itemO("wm.open_mainfile", text="Open...", icon='ICON_FILE_FOLDER') + layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent") + layout.itemO("wm.recover_last_session") + layout.itemO("wm.recover_auto_save", text="Recover Auto Save...") - layout.itemS() + layout.itemS() - layout.operator_context = "EXEC_AREA" - layout.itemO("wm.save_mainfile", text="Save", icon='ICON_FILE_TICK') - layout.operator_context = "INVOKE_AREA" - layout.itemO("wm.save_as_mainfile", text="Save As...") - layout.itemO("screen.userpref_show", text="User Preferences...", icon='ICON_PREFERENCES') + layout.operator_context = "EXEC_AREA" + layout.itemO("wm.save_mainfile", text="Save", icon='ICON_FILE_TICK') + layout.operator_context = "INVOKE_AREA" + layout.itemO("wm.save_as_mainfile", text="Save As...") + layout.itemO("screen.userpref_show", text="User Preferences...", icon='ICON_PREFERENCES') - layout.itemS() - layout.operator_context = "INVOKE_AREA" - layout.itemO("wm.link_append", text="Link") - layout.item_booleanO("wm.link_append", "link", False, text="Append") - layout.itemS() + layout.itemS() + layout.operator_context = "INVOKE_AREA" + layout.itemO("wm.link_append", text="Link") + layout.item_booleanO("wm.link_append", "link", False, text="Append") + layout.itemS() - layout.itemM("INFO_MT_file_import") - layout.itemM("INFO_MT_file_export") + layout.itemM("INFO_MT_file_import") + layout.itemM("INFO_MT_file_export") - layout.itemS() + layout.itemS() - layout.itemM("INFO_MT_file_external_data") + layout.itemM("INFO_MT_file_external_data") - layout.itemS() + layout.itemS() - layout.operator_context = "EXEC_AREA" - layout.itemO("wm.exit_blender", text="Quit", icon='ICON_QUIT') + layout.operator_context = "EXEC_AREA" + layout.itemO("wm.exit_blender", text="Quit", icon='ICON_QUIT') # test for expanding menus ''' class INFO_MT_file_more(INFO_MT_file): - bl_label = "File" + bl_label = "File" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("wm.read_homefile", text="TESTING ") + layout.itemO("wm.read_homefile", text="TESTING ") dynamic_menu.setup(INFO_MT_file_more) ''' class INFO_MT_file_import(dynamic_menu.DynMenu): - bl_idname = "INFO_MT_file_import" - bl_label = "Import" + bl_idname = "INFO_MT_file_import" + bl_label = "Import" - def draw(self, context): - self.layout.itemO("WM_OT_collada_import", text="COLLADA (.dae)...") + def draw(self, context): + self.layout.itemO("WM_OT_collada_import", text="COLLADA (.dae)...") class INFO_MT_file_export(dynamic_menu.DynMenu): - bl_idname = "INFO_MT_file_export" - bl_label = "Export" + bl_idname = "INFO_MT_file_export" + bl_label = "Export" - def draw(self, context): - self.layout.itemO("WM_OT_collada_export", text="COLLADA (.dae)...") + def draw(self, context): + self.layout.itemO("WM_OT_collada_export", text="COLLADA (.dae)...") class INFO_MT_file_external_data(bpy.types.Menu): - bl_label = "External Data" + bl_label = "External Data" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("file.pack_all", text="Pack into .blend file") - layout.itemO("file.unpack_all", text="Unpack into Files...") + layout.itemO("file.pack_all", text="Pack into .blend file") + layout.itemO("file.unpack_all", text="Unpack into Files...") - layout.itemS() + layout.itemS() - layout.itemO("file.make_paths_relative") - layout.itemO("file.make_paths_absolute") - layout.itemO("file.report_missing_files") - layout.itemO("file.find_missing_files") + layout.itemO("file.make_paths_relative") + layout.itemO("file.make_paths_absolute") + layout.itemO("file.report_missing_files") + layout.itemO("file.find_missing_files") class INFO_MT_mesh_add(dynamic_menu.DynMenu): - bl_idname = "INFO_MT_mesh_add" - bl_label = "Mesh" - def draw(self, context): - layout = self.layout - layout.operator_context = 'INVOKE_REGION_WIN' - layout.itemO("mesh.primitive_plane_add", icon='ICON_MESH_PLANE', text="Plane") - layout.itemO("mesh.primitive_cube_add", icon='ICON_MESH_CUBE', text="Cube") - layout.itemO("mesh.primitive_circle_add", icon='ICON_MESH_CIRCLE', text="Circle") - layout.itemO("mesh.primitive_uv_sphere_add", icon='ICON_MESH_UVSPHERE', text="UV Sphere") - layout.itemO("mesh.primitive_ico_sphere_add", icon='ICON_MESH_ICOSPHERE', text="Icosphere") - layout.itemO("mesh.primitive_tube_add", icon='ICON_MESH_TUBE', text="Tube") - layout.itemO("mesh.primitive_cone_add", icon='ICON_MESH_CONE', text="Cone") - layout.itemS() - layout.itemO("mesh.primitive_grid_add", icon='ICON_MESH_GRID', text="Grid") - layout.itemO("mesh.primitive_monkey_add", icon='ICON_MESH_MONKEY', text="Monkey") + bl_idname = "INFO_MT_mesh_add" + bl_label = "Mesh" + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' + layout.itemO("mesh.primitive_plane_add", icon='ICON_MESH_PLANE', text="Plane") + layout.itemO("mesh.primitive_cube_add", icon='ICON_MESH_CUBE', text="Cube") + layout.itemO("mesh.primitive_circle_add", icon='ICON_MESH_CIRCLE', text="Circle") + layout.itemO("mesh.primitive_uv_sphere_add", icon='ICON_MESH_UVSPHERE', text="UV Sphere") + layout.itemO("mesh.primitive_ico_sphere_add", icon='ICON_MESH_ICOSPHERE', text="Icosphere") + layout.itemO("mesh.primitive_tube_add", icon='ICON_MESH_TUBE', text="Tube") + layout.itemO("mesh.primitive_cone_add", icon='ICON_MESH_CONE', text="Cone") + layout.itemS() + layout.itemO("mesh.primitive_grid_add", icon='ICON_MESH_GRID', text="Grid") + layout.itemO("mesh.primitive_monkey_add", icon='ICON_MESH_MONKEY', text="Monkey") class INFO_MT_add(bpy.types.Menu): - bl_label = "Add" + bl_label = "Add" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.operator_context = "EXEC_SCREEN" + layout.operator_context = "EXEC_SCREEN" - # layout.item_menu_enumO("object.mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH') - layout.itemM("INFO_MT_mesh_add", icon='ICON_OUTLINER_OB_MESH') - - layout.item_menu_enumO("object.curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE') - layout.item_menu_enumO("object.surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE') - layout.item_menu_enumO("object.metaball_add", "type", 'META', text="Metaball", icon='ICON_OUTLINER_OB_META') - layout.itemO("object.text_add", text="Text", icon='ICON_OUTLINER_OB_FONT') + # layout.item_menu_enumO("object.mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH') + layout.itemM("INFO_MT_mesh_add", icon='ICON_OUTLINER_OB_MESH') - layout.itemS() + layout.item_menu_enumO("object.curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE') + layout.item_menu_enumO("object.surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE') + layout.item_menu_enumO("object.metaball_add", "type", 'META', text="Metaball", icon='ICON_OUTLINER_OB_META') + layout.itemO("object.text_add", text="Text", icon='ICON_OUTLINER_OB_FONT') - layout.itemO("object.armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE') - layout.item_enumO("object.add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE') - layout.item_enumO("object.add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY') + layout.itemS() - layout.itemS() + layout.itemO("object.armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE') + layout.item_enumO("object.add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE') + layout.item_enumO("object.add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY') - layout.item_enumO("object.add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA') - layout.item_menu_enumO("object.lamp_add", "type", 'LAMP', text="Lamp", icon='ICON_OUTLINER_OB_LAMP') - - layout.itemS() - - layout.item_menu_enumO("object.effector_add", "type", 'EMPTY', text="Force Field", icon='ICON_OUTLINER_OB_EMPTY') + layout.itemS() - layout.itemS() - - layout.item_menu_enumO("object.group_instance_add", "type", text="Group Instance", icon='ICON_OUTLINER_OB_EMPTY') + layout.item_enumO("object.add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA') + layout.item_menu_enumO("object.lamp_add", "type", 'LAMP', text="Lamp", icon='ICON_OUTLINER_OB_LAMP') + + layout.itemS() + + layout.item_menu_enumO("object.effector_add", "type", 'EMPTY', text="Force Field", icon='ICON_OUTLINER_OB_EMPTY') + + layout.itemS() + + layout.item_menu_enumO("object.group_instance_add", "type", text="Group Instance", icon='ICON_OUTLINER_OB_EMPTY') class INFO_MT_game(bpy.types.Menu): - bl_label = "Game" + bl_label = "Game" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - gs = context.scene.game_data + gs = context.scene.game_data - layout.itemO("view3d.game_start") + layout.itemO("view3d.game_start") - layout.itemS() + layout.itemS() - layout.itemR(gs, "show_debug_properties") - layout.itemR(gs, "show_framerate_profile") - layout.itemR(gs, "show_physics_visualization") - layout.itemR(gs, "deprecation_warnings") + layout.itemR(gs, "show_debug_properties") + layout.itemR(gs, "show_framerate_profile") + layout.itemR(gs, "show_physics_visualization") + layout.itemR(gs, "deprecation_warnings") class INFO_MT_render(bpy.types.Menu): - bl_label = "Render" + bl_label = "Render" - def draw(self, context): - layout = self.layout - - rd = context.scene.render_data + def draw(self, context): + layout = self.layout - layout.itemO("screen.render", text="Render Image", icon='ICON_RENDER_STILL') - layout.item_booleanO("screen.render", "animation", True, text="Render Animation", icon='ICON_RENDER_ANIMATION') + rd = context.scene.render_data - layout.itemS() + layout.itemO("screen.render", text="Render Image", icon='ICON_RENDER_STILL') + layout.item_booleanO("screen.render", "animation", True, text="Render Animation", icon='ICON_RENDER_ANIMATION') - layout.itemO("screen.opengl_render", text="OpenGL Render Image") - layout.item_booleanO("screen.opengl_render", "animation", True, text="OpenGL Render Animation") + layout.itemS() - layout.itemS() + layout.itemO("screen.opengl_render", text="OpenGL Render Image") + layout.item_booleanO("screen.opengl_render", "animation", True, text="OpenGL Render Animation") - layout.itemO("screen.render_view_show") + layout.itemS() + + layout.itemO("screen.render_view_show") class INFO_MT_help(bpy.types.Menu): - bl_label = "Help" + bl_label = "Help" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("help.manual", icon='ICON_HELP') - layout.itemO("help.release_logs", icon='ICON_URL') + layout.itemO("help.manual", icon='ICON_HELP') + layout.itemO("help.release_logs", icon='ICON_URL') - layout.itemS() + layout.itemS() - layout.itemO("help.blender_website", icon='ICON_URL') - layout.itemO("help.blender_eshop", icon='ICON_URL') - layout.itemO("help.developer_community", icon='ICON_URL') - layout.itemO("help.user_community", icon='ICON_URL') - layout.itemS() - layout.itemO("help.report_bug", icon='ICON_URL') - layout.itemS() - layout.itemO("help.operator_cheat_sheet") + layout.itemO("help.blender_website", icon='ICON_URL') + layout.itemO("help.blender_eshop", icon='ICON_URL') + layout.itemO("help.developer_community", icon='ICON_URL') + layout.itemO("help.user_community", icon='ICON_URL') + layout.itemS() + layout.itemO("help.report_bug", icon='ICON_URL') + layout.itemS() + layout.itemO("help.operator_cheat_sheet") bpy.types.register(INFO_HT_header) bpy.types.register(INFO_MT_file) @@ -248,77 +248,77 @@ bpy.types.register(INFO_MT_help) # Help operators class HelpOperator(bpy.types.Operator): - def execute(self, context): - import webbrowser - webbrowser.open(self._url) - return ('FINISHED',) + def execute(self, context): + import webbrowser + webbrowser.open(self._url) + return ('FINISHED',) class HELP_OT_manual(HelpOperator): - '''The Blender Wiki manual''' - bl_idname = "help.manual" - bl_label = "Manual" - _url = 'http://wiki.blender.org/index.php/Manual' + '''The Blender Wiki manual''' + bl_idname = "help.manual" + bl_label = "Manual" + _url = 'http://wiki.blender.org/index.php/Manual' class HELP_OT_release_logs(HelpOperator): - '''Information about the changes in this version of Blender''' - bl_idname = "help.release_logs" - bl_label = "Release Logs" - _url = 'http://www.blender.org/development/release-logs/' + '''Information about the changes in this version of Blender''' + bl_idname = "help.release_logs" + bl_label = "Release Logs" + _url = 'http://www.blender.org/development/release-logs/' class HELP_OT_blender_website(HelpOperator): - '''The official Blender website''' - bl_idname = "help.blender_website" - bl_label = "Blender Website" - _url = 'http://www.blender.org/' + '''The official Blender website''' + bl_idname = "help.blender_website" + bl_label = "Blender Website" + _url = 'http://www.blender.org/' class HELP_OT_blender_eshop(HelpOperator): - '''Buy official Blender resources and merchandise online''' - bl_idname = "help.blender_eshop" - bl_label = "Blender e-Shop" - _url = 'http://www.blender3d.org/e-shop' + '''Buy official Blender resources and merchandise online''' + bl_idname = "help.blender_eshop" + bl_label = "Blender e-Shop" + _url = 'http://www.blender3d.org/e-shop' class HELP_OT_developer_community(HelpOperator): - '''Get involved with Blender development''' - bl_idname = "help.developer_community" - bl_label = "Developer Community" - _url = 'http://www.blender.org/community/get-involved/' + '''Get involved with Blender development''' + bl_idname = "help.developer_community" + bl_label = "Developer Community" + _url = 'http://www.blender.org/community/get-involved/' class HELP_OT_user_community(HelpOperator): - '''Get involved with other Blender users''' - bl_idname = "help.user_community" - bl_label = "User Community" - _url = 'http://www.blender.org/community/user-community/' - + '''Get involved with other Blender users''' + bl_idname = "help.user_community" + bl_label = "User Community" + _url = 'http://www.blender.org/community/user-community/' + class HELP_OT_report_bug(HelpOperator): - '''Report a bug in the Blender bug tracker''' - bl_idname = "help.report_bug" - bl_label = "Report a Bug" - _url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse' + '''Report a bug in the Blender bug tracker''' + bl_idname = "help.report_bug" + bl_label = "Report a Bug" + _url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse' class HELP_OT_operator_cheat_sheet(bpy.types.Operator): - bl_idname = "help.operator_cheat_sheet" - bl_label = "Operator Cheat Sheet (new textblock)" - def execute(self, context): - op_strings = [] - tot = 0 - for op_module_name in dir(bpy.ops): - op_module = getattr(bpy.ops, op_module_name) - for op_submodule_name in dir(op_module): - op = getattr(op_module, op_submodule_name) - text = repr(op) - if text.startswith('bpy.ops.'): - op_strings.append(text) - tot += 1 - - op_strings.append('') - - bpy.ops.text.new() # XXX - assumes new text is always at the end! - textblock = bpy.data.texts[-1] - textblock.write('# %d Operators\n\n' % tot) - textblock.write('\n'.join(op_strings)) - textblock.name = "OperatorList.txt" - print("See OperatorList.txt textblock") - return ('FINISHED',) + bl_idname = "help.operator_cheat_sheet" + bl_label = "Operator Cheat Sheet (new textblock)" + def execute(self, context): + op_strings = [] + tot = 0 + for op_module_name in dir(bpy.ops): + op_module = getattr(bpy.ops, op_module_name) + for op_submodule_name in dir(op_module): + op = getattr(op_module, op_submodule_name) + text = repr(op) + if text.startswith('bpy.ops.'): + op_strings.append(text) + tot += 1 + + op_strings.append('') + + bpy.ops.text.new() # XXX - assumes new text is always at the end! + textblock = bpy.data.texts[-1] + textblock.write('# %d Operators\n\n' % tot) + textblock.write('\n'.join(op_strings)) + textblock.name = "OperatorList.txt" + print("See OperatorList.txt textblock") + return ('FINISHED',) bpy.ops.add(HELP_OT_manual) bpy.ops.add(HELP_OT_release_logs) diff --git a/release/scripts/ui/space_logic.py b/release/scripts/ui/space_logic.py index 7c6ce62bb6b..cd2f2262ef6 100644 --- a/release/scripts/ui/space_logic.py +++ b/release/scripts/ui/space_logic.py @@ -1,29 +1,29 @@ import bpy class LOGIC_PT_properties(bpy.types.Panel): - bl_space_type = 'LOGIC_EDITOR' - bl_region_type = 'UI' - bl_label = "Properties" + bl_space_type = 'LOGIC_EDITOR' + bl_region_type = 'UI' + bl_label = "Properties" - def poll(self, context): - ob = context.active_object - return ob and ob.game + def poll(self, context): + ob = context.active_object + return ob and ob.game + + def draw(self, context): + layout = self.layout + + ob = context.active_object + game = ob.game + + layout.itemO("object.game_property_new", text="Add Game Property") + + for i, prop in enumerate(game.properties): + + row = layout.row(align=True) + row.itemR(prop, "name", text="") + row.itemR(prop, "type", text="") + row.itemR(prop, "value", text="", toggle=True) # we dont care about the type. rna will display correctly + row.itemR(prop, "debug", text="", toggle=True, icon='ICON_INFO') + row.item_intO("object.game_property_remove", "index", i, text="", icon='ICON_X') - def draw(self, context): - layout = self.layout - - ob = context.active_object - game = ob.game - - layout.itemO("object.game_property_new", text="Add Game Property") - - for i, prop in enumerate(game.properties): - - row = layout.row(align=True) - row.itemR(prop, "name", text="") - row.itemR(prop, "type", text="") - row.itemR(prop, "value", text="", toggle=True) # we dont care about the type. rna will display correctly - row.itemR(prop, "debug", text="", toggle=True, icon='ICON_INFO') - row.item_intO("object.game_property_remove", "index", i, text="", icon='ICON_X') - bpy.types.register(LOGIC_PT_properties) diff --git a/release/scripts/ui/space_node.py b/release/scripts/ui/space_node.py index f9d1b59e3ec..2a8d4de2c4b 100644 --- a/release/scripts/ui/space_node.py +++ b/release/scripts/ui/space_node.py @@ -2,112 +2,112 @@ import bpy class NODE_HT_header(bpy.types.Header): - bl_space_type = 'NODE_EDITOR' + bl_space_type = 'NODE_EDITOR' - def draw(self, context): - layout = self.layout - - snode = context.space_data + def draw(self, context): + layout = self.layout - row = layout.row(align=True) - row.template_header() + snode = context.space_data - if context.area.show_menus: - sub = row.row(align=True) - sub.itemM("NODE_MT_view") - sub.itemM("NODE_MT_select") - sub.itemM("NODE_MT_add") - sub.itemM("NODE_MT_node") + row = layout.row(align=True) + row.template_header() - row = layout.row() - row.itemR(snode, "tree_type", text="", expand=True) + if context.area.show_menus: + sub = row.row(align=True) + sub.itemM("NODE_MT_view") + sub.itemM("NODE_MT_select") + sub.itemM("NODE_MT_add") + sub.itemM("NODE_MT_node") - if snode.tree_type == 'MATERIAL': - ob = snode.id_from - id = snode.id - if ob: - layout.template_ID(ob, "active_material", new="material.new") - if id: - layout.itemR(id, "use_nodes") + row = layout.row() + row.itemR(snode, "tree_type", text="", expand=True) - elif snode.tree_type == 'TEXTURE': - row.itemR(snode, "texture_type", text="", expand=True) + if snode.tree_type == 'MATERIAL': + ob = snode.id_from + id = snode.id + if ob: + layout.template_ID(ob, "active_material", new="material.new") + if id: + layout.itemR(id, "use_nodes") - id = snode.id - id_from = snode.id_from - if id_from: - layout.template_ID(id_from, "active_texture", new="texture.new") - if id: - layout.itemR(id, "use_nodes") + elif snode.tree_type == 'TEXTURE': + row.itemR(snode, "texture_type", text="", expand=True) - elif snode.tree_type == 'COMPOSITING': - id = snode.id + id = snode.id + id_from = snode.id_from + if id_from: + layout.template_ID(id_from, "active_texture", new="texture.new") + if id: + layout.itemR(id, "use_nodes") - layout.itemR(id, "use_nodes") - layout.itemR(id.render_data, "free_unused_nodes", text="Free Unused") - layout.itemR(snode, "backdrop") + elif snode.tree_type == 'COMPOSITING': + id = snode.id + + layout.itemR(id, "use_nodes") + layout.itemR(id.render_data, "free_unused_nodes", text="Free Unused") + layout.itemR(snode, "backdrop") class NODE_MT_view(bpy.types.Menu): - bl_label = "View" + bl_label = "View" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - # layout.itemO("grease_pencil..") - # layout.itemS() + # layout.itemO("grease_pencil..") + # layout.itemS() - layout.itemO("view2d.zoom_in") - layout.itemO("view2d.zoom_out") + layout.itemO("view2d.zoom_in") + layout.itemO("view2d.zoom_out") - layout.itemS() + layout.itemS() - layout.itemO("node.view_all") - layout.itemO("screen.screen_full_area") + layout.itemO("node.view_all") + layout.itemO("screen.screen_full_area") class NODE_MT_select(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("node.select_border") + layout.itemO("node.select_border") - layout.itemS() - layout.itemO("node.select_all") - layout.itemO("node.select_linked_from") - layout.itemO("node.select_linked_to") + layout.itemS() + layout.itemO("node.select_all") + layout.itemO("node.select_linked_from") + layout.itemO("node.select_linked_to") class NODE_MT_node(bpy.types.Menu): - bl_label = "Node" + bl_label = "Node" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("tfm.translate") - layout.itemO("tfm.resize") - layout.itemO("tfm.rotate") + layout.itemO("tfm.translate") + layout.itemO("tfm.resize") + layout.itemO("tfm.rotate") - layout.itemS() + layout.itemS() - layout.itemO("node.duplicate") - layout.itemO("node.delete") + layout.itemO("node.duplicate") + layout.itemO("node.delete") - # XXX - # layout.itemS() - # layout.itemO("node.make_link") - layout.itemS() - layout.itemO("node.group_edit") - layout.itemO("node.group_ungroup") - layout.itemO("node.group_make") + # XXX + # layout.itemS() + # layout.itemO("node.make_link") + layout.itemS() + layout.itemO("node.group_edit") + layout.itemO("node.group_ungroup") + layout.itemO("node.group_make") - layout.itemS() + layout.itemS() - layout.itemO("node.visibility_toggle") + layout.itemO("node.visibility_toggle") - # XXX - # layout.itemO("node.rename") - # layout.itemS() - # layout.itemO("node.show_cyclic_dependencies") + # XXX + # layout.itemO("node.rename") + # layout.itemS() + # layout.itemO("node.show_cyclic_dependencies") bpy.types.register(NODE_HT_header) bpy.types.register(NODE_MT_view) diff --git a/release/scripts/ui/space_outliner.py b/release/scripts/ui/space_outliner.py index b3cb04e9286..384e49a1276 100644 --- a/release/scripts/ui/space_outliner.py +++ b/release/scripts/ui/space_outliner.py @@ -2,76 +2,76 @@ import bpy class OUTLINER_HT_header(bpy.types.Header): - bl_space_type = 'OUTLINER' + bl_space_type = 'OUTLINER' - def draw(self, context): - layout = self.layout - - space = context.space_data - scene = context.scene - ks = context.scene.active_keying_set + def draw(self, context): + layout = self.layout - row = layout.row(align=True) - row.template_header() + space = context.space_data + scene = context.scene + ks = context.scene.active_keying_set - if context.area.show_menus: - sub = row.row(align=True) - sub.itemM("OUTLINER_MT_view") - if space.display_mode == 'DATABLOCKS': - sub.itemM("OUTLINER_MT_edit_datablocks") + row = layout.row(align=True) + row.template_header() - layout.itemR(space, "display_mode", text="") - - layout.itemS() - - if space.display_mode == 'DATABLOCKS': - row = layout.row(align=True) - row.itemO("outliner.keyingset_add_selected", icon='ICON_ZOOMIN', text="") - row.itemO("outliner.keyingset_remove_selected", icon='ICON_ZOOMOUT', text="") - - if ks: - row = layout.row(align=False) - row.item_pointerR(scene, "active_keying_set", scene, "keying_sets", text="") - - row = layout.row(align=True) - row.itemO("anim.insert_keyframe", text="", icon='ICON_KEY_HLT') - row.itemO("anim.delete_keyframe", text="", icon='ICON_KEY_DEHLT') - else: - row = layout.row(align=False) - row.itemL(text="No Keying Set active") + if context.area.show_menus: + sub = row.row(align=True) + sub.itemM("OUTLINER_MT_view") + if space.display_mode == 'DATABLOCKS': + sub.itemM("OUTLINER_MT_edit_datablocks") + + layout.itemR(space, "display_mode", text="") + + layout.itemS() + + if space.display_mode == 'DATABLOCKS': + row = layout.row(align=True) + row.itemO("outliner.keyingset_add_selected", icon='ICON_ZOOMIN', text="") + row.itemO("outliner.keyingset_remove_selected", icon='ICON_ZOOMOUT', text="") + + if ks: + row = layout.row(align=False) + row.item_pointerR(scene, "active_keying_set", scene, "keying_sets", text="") + + row = layout.row(align=True) + row.itemO("anim.insert_keyframe", text="", icon='ICON_KEY_HLT') + row.itemO("anim.delete_keyframe", text="", icon='ICON_KEY_DEHLT') + else: + row = layout.row(align=False) + row.itemL(text="No Keying Set active") class OUTLINER_MT_view(bpy.types.Menu): - bl_label = "View" + bl_label = "View" - def draw(self, context): - layout = self.layout - - space = context.space_data + def draw(self, context): + layout = self.layout - col = layout.column() - if space.display_mode not in ('DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'): - col.itemR(space, "show_restriction_columns") - col.itemS() - col.itemO("outliner.show_active") + space = context.space_data + + col = layout.column() + if space.display_mode not in ('DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'): + col.itemR(space, "show_restriction_columns") + col.itemS() + col.itemO("outliner.show_active") + + col.itemO("outliner.show_one_level") + col.itemO("outliner.show_hierarchy") - col.itemO("outliner.show_one_level") - col.itemO("outliner.show_hierarchy") - class OUTLINER_MT_edit_datablocks(bpy.types.Menu): - bl_label = "Edit" - - def draw(self, context): - layout = self.layout - - col = layout.column() + bl_label = "Edit" - col.itemO("outliner.keyingset_add_selected") - col.itemO("outliner.keyingset_remove_selected") - - col.itemS() - - col.itemO("outliner.drivers_add_selected") - col.itemO("outliner.drivers_delete_selected") + def draw(self, context): + layout = self.layout + + col = layout.column() + + col.itemO("outliner.keyingset_add_selected") + col.itemO("outliner.keyingset_remove_selected") + + col.itemS() + + col.itemO("outliner.drivers_add_selected") + col.itemO("outliner.drivers_delete_selected") bpy.types.register(OUTLINER_HT_header) bpy.types.register(OUTLINER_MT_view) diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index 5d5f4ed662f..75bd9edc8d0 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -2,582 +2,582 @@ import bpy def act_strip(context): - try: return context.scene.sequence_editor.active_strip - except: return None + try: return context.scene.sequence_editor.active_strip + except: return None # Header class SEQUENCER_HT_header(bpy.types.Header): - bl_space_type = 'SEQUENCE_EDITOR' + bl_space_type = 'SEQUENCE_EDITOR' - def draw(self, context): - layout = self.layout - - st = context.space_data + def draw(self, context): + layout = self.layout - row = layout.row(align=True) - row.template_header() - - if context.area.show_menus: - sub = row.row(align=True) - sub.itemM("SEQUENCER_MT_view") - - row.itemS() - - if st.display_mode == 'SEQUENCER': - sub.itemM("SEQUENCER_MT_select") - sub.itemM("SEQUENCER_MT_marker") - sub.itemM("SEQUENCER_MT_add") - sub.itemM("SEQUENCER_MT_strip") + st = context.space_data - layout.itemR(st, "display_mode", text="") + row = layout.row(align=True) + row.template_header() - if st.display_mode == 'SEQUENCER': - layout.itemS() - layout.itemO("sequencer.reload") - else: - layout.itemR(st, "display_channel", text="Channel") + if context.area.show_menus: + sub = row.row(align=True) + sub.itemM("SEQUENCER_MT_view") + + row.itemS() + + if st.display_mode == 'SEQUENCER': + sub.itemM("SEQUENCER_MT_select") + sub.itemM("SEQUENCER_MT_marker") + sub.itemM("SEQUENCER_MT_add") + sub.itemM("SEQUENCER_MT_strip") + + layout.itemR(st, "display_mode", text="") + + if st.display_mode == 'SEQUENCER': + layout.itemS() + layout.itemO("sequencer.reload") + else: + layout.itemR(st, "display_channel", text="Channel") class SEQUENCER_MT_view(bpy.types.Menu): - bl_label = "View" - - def draw(self, context): - layout = self.layout - - st = context.space_data - - layout.column() - - """ - uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP); - short yco= 0, menuwidth=120; + bl_label = "View" - if (sseq->mainb == SEQ_DRAW_SEQUENCE) { - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Play Back Animation " - "in all Sequence Areas|Alt A", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - } - else { - uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, - "Grease Pencil...", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); - uiDefMenuSep(block); + def draw(self, context): + layout = self.layout - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Play Back Animation " - "in this window|Alt A", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - } - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Play Back Animation in all " - "3D Views and Sequence Areas|Alt Shift A", - 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + st = context.space_data - """ - layout.itemS() - layout.itemO("sequencer.view_all") - layout.itemO("sequencer.view_selected") - layout.itemS() - layout.itemO("screen.screen_full_area", text="Toggle Full Screen") - """ - + layout.column() - /* Lock Time */ - uiDefIconTextBut(block, BUTM, 1, (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, - "Lock Time to Other Windows|", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); + """ + uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP); + short yco= 0, menuwidth=120; - /* Draw time or frames.*/ - uiDefMenuSep(block); - """ - - layout.itemR(st, "draw_frames") - if st.display_mode == 'IMAGE': - layout.itemR(st, "draw_safe_margin") - if st.display_mode == 'WAVEFORM': - layout.itemR(st, "seperate_color_preview") - - """ - if(!sa->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,0, ""); - else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + if (sseq->mainb == SEQ_DRAW_SEQUENCE) { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Play Back Animation " + "in all Sequence Areas|Alt A", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + } + else { + uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, + "Grease Pencil...", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); + uiDefMenuSep(block); - """ + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Play Back Animation " + "in this window|Alt A", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + } + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Play Back Animation in all " + "3D Views and Sequence Areas|Alt Shift A", + 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + + """ + layout.itemS() + layout.itemO("sequencer.view_all") + layout.itemO("sequencer.view_selected") + layout.itemS() + layout.itemO("screen.screen_full_area", text="Toggle Full Screen") + """ + + + /* Lock Time */ + uiDefIconTextBut(block, BUTM, 1, (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, + "Lock Time to Other Windows|", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); + + /* Draw time or frames.*/ + uiDefMenuSep(block); + """ + + layout.itemR(st, "draw_frames") + if st.display_mode == 'IMAGE': + layout.itemR(st, "draw_safe_margin") + if st.display_mode == 'WAVEFORM': + layout.itemR(st, "seperate_color_preview") + + """ + if(!sa->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,0, ""); + else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); + + """ class SEQUENCER_MT_select(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout - - st = context.space_data - - layout.column() - layout.item_enumO("sequencer.select_active_side", "side", 'LEFT', text="Strips to the Left") - layout.item_enumO("sequencer.select_active_side", "side", 'RIGHT', text="Strips to the Right") - layout.itemS() - layout.item_enumO("sequencer.select_handles", "side", 'BOTH', text="Surrounding Handles") - layout.item_enumO("sequencer.select_handles", "side", 'LEFT', text="Left Handle") - layout.item_enumO("sequencer.select_handles", "side", 'RIGHT', text="Right Handle") - layout.itemS() - layout.itemO("sequencer.select_linked") - layout.itemO("sequencer.select_all_toggle") - layout.itemO("sequencer.select_inverse") + def draw(self, context): + layout = self.layout + + st = context.space_data + + layout.column() + layout.item_enumO("sequencer.select_active_side", "side", 'LEFT', text="Strips to the Left") + layout.item_enumO("sequencer.select_active_side", "side", 'RIGHT', text="Strips to the Right") + layout.itemS() + layout.item_enumO("sequencer.select_handles", "side", 'BOTH', text="Surrounding Handles") + layout.item_enumO("sequencer.select_handles", "side", 'LEFT', text="Left Handle") + layout.item_enumO("sequencer.select_handles", "side", 'RIGHT', text="Right Handle") + layout.itemS() + layout.itemO("sequencer.select_linked") + layout.itemO("sequencer.select_all_toggle") + layout.itemO("sequencer.select_inverse") class SEQUENCER_MT_marker(bpy.types.Menu): - bl_label = "Marker (TODO)" + bl_label = "Marker (TODO)" - def draw(self, context): - layout = self.layout - - st = context.space_data - - layout.column() - layout.itemO("marker.add", text="Add Marker") - layout.itemO("marker.duplicate", text="Duplicate Marker") - layout.itemO("marker.move", text="Grab/Move Marker") - layout.itemO("marker.delete", text="Delete Marker") - layout.itemS() - layout.itemL(text="ToDo: Name Marker") - - #layout.itemO("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS) + def draw(self, context): + layout = self.layout + + st = context.space_data + + layout.column() + layout.itemO("marker.add", text="Add Marker") + layout.itemO("marker.duplicate", text="Duplicate Marker") + layout.itemO("marker.move", text="Grab/Move Marker") + layout.itemO("marker.delete", text="Delete Marker") + layout.itemS() + layout.itemL(text="ToDo: Name Marker") + + #layout.itemO("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS) class SEQUENCER_MT_add(bpy.types.Menu): - bl_label = "Add" + bl_label = "Add" - def draw(self, context): - layout = self.layout - layout.operator_context = 'INVOKE_REGION_WIN' - - st = context.space_data - - layout.column() - layout.itemO("sequencer.scene_strip_add", text="Scene") - layout.itemO("sequencer.movie_strip_add", text="Movie") - layout.itemO("sequencer.image_strip_add", text="Image") - layout.itemO("sequencer.sound_strip_add", text="Sound") - - layout.itemM("SEQUENCER_MT_add_effect") + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' + + st = context.space_data + + layout.column() + layout.itemO("sequencer.scene_strip_add", text="Scene") + layout.itemO("sequencer.movie_strip_add", text="Movie") + layout.itemO("sequencer.image_strip_add", text="Image") + layout.itemO("sequencer.sound_strip_add", text="Sound") + + layout.itemM("SEQUENCER_MT_add_effect") class SEQUENCER_MT_add_effect(bpy.types.Menu): - bl_label = "Effect Strip..." + bl_label = "Effect Strip..." - def draw(self, context): - layout = self.layout - layout.operator_context = 'INVOKE_REGION_WIN' - st = context.space_data - - layout.column() - layout.item_enumO("sequencer.effect_strip_add", 'type', 'ADD') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'SUBTRACT') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'ALPHA_OVER') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'ALPHA_UNDER') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'GAMMA_CROSS') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'MULTIPLY') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'OVER_DROP') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'PLUGIN') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'WIPE') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'GLOW') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'TRANSFORM') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'COLOR') - layout.item_enumO("sequencer.effect_strip_add", 'type', 'SPEED') + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' + st = context.space_data + + layout.column() + layout.item_enumO("sequencer.effect_strip_add", 'type', 'ADD') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'SUBTRACT') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'ALPHA_OVER') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'ALPHA_UNDER') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'GAMMA_CROSS') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'MULTIPLY') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'OVER_DROP') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'PLUGIN') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'WIPE') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'GLOW') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'TRANSFORM') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'COLOR') + layout.item_enumO("sequencer.effect_strip_add", 'type', 'SPEED') class SEQUENCER_MT_strip(bpy.types.Menu): - bl_label = "Strip" + bl_label = "Strip" - def draw(self, context): - layout = self.layout - - st = context.space_data - - layout.operator_context = 'INVOKE_REGION_WIN' - - layout.column() - layout.item_enumO("tfm.transform", "mode", 'TRANSLATION', text="Grab/Move") - layout.item_enumO("tfm.transform", "mode", 'TIME_EXTEND', text="Grab/Extend from frame") - # uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator - layout.itemS() - - layout.item_enumO("sequencer.cut", "type", 'HARD', text="Cut (hard) at frame") - layout.item_enumO("sequencer.cut", "type", 'SOFT', text="Cut (soft) at frame") - layout.itemO("sequencer.images_separate") - layout.itemS() - - layout.itemO("sequencer.duplicate") - layout.itemO("sequencer.delete") - - strip = act_strip(context) - - if strip: - stype = strip.type - - if stype=='EFFECT': - layout.itemS() - layout.itemO("sequencer.effect_change") - layout.itemO("sequencer.effect_reassign_inputs") - elif stype=='IMAGE': - layout.itemS() - layout.itemO("sequencer.image_change") - elif stype=='SCENE': - layout.itemS() - layout.itemO("sequencer.scene_change", text="Change Scene") - elif stype=='MOVIE': - layout.itemS() - layout.itemO("sequencer.movie_change") - - layout.itemS() - - layout.itemO("sequencer.meta_make") - layout.itemO("sequencer.meta_separate") - - #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) { - # uiItemS(layout); - # uiItemO(layout, NULL, 0, "sequencer.meta_toggle"); - #} - - layout.itemS() - layout.itemO("sequencer.reload") - layout.itemS() - layout.itemO("sequencer.lock") - layout.itemO("sequencer.unlock") - layout.itemO("sequencer.mute") - layout.itemO("sequencer.unmute") - - layout.item_booleanO("sequencer.mute", "unselected", 1, text="Mute Deselected Strips") + def draw(self, context): + layout = self.layout - layout.itemO("sequencer.snap") - - layout.itemO("sequencer.swap_right") - layout.itemO("sequencer.swap_left") + st = context.space_data + + layout.operator_context = 'INVOKE_REGION_WIN' + + layout.column() + layout.item_enumO("tfm.transform", "mode", 'TRANSLATION', text="Grab/Move") + layout.item_enumO("tfm.transform", "mode", 'TIME_EXTEND', text="Grab/Extend from frame") + # uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator + layout.itemS() + + layout.item_enumO("sequencer.cut", "type", 'HARD', text="Cut (hard) at frame") + layout.item_enumO("sequencer.cut", "type", 'SOFT', text="Cut (soft) at frame") + layout.itemO("sequencer.images_separate") + layout.itemS() + + layout.itemO("sequencer.duplicate") + layout.itemO("sequencer.delete") + + strip = act_strip(context) + + if strip: + stype = strip.type + + if stype=='EFFECT': + layout.itemS() + layout.itemO("sequencer.effect_change") + layout.itemO("sequencer.effect_reassign_inputs") + elif stype=='IMAGE': + layout.itemS() + layout.itemO("sequencer.image_change") + elif stype=='SCENE': + layout.itemS() + layout.itemO("sequencer.scene_change", text="Change Scene") + elif stype=='MOVIE': + layout.itemS() + layout.itemO("sequencer.movie_change") + + layout.itemS() + + layout.itemO("sequencer.meta_make") + layout.itemO("sequencer.meta_separate") + + #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) { + # uiItemS(layout); + # uiItemO(layout, NULL, 0, "sequencer.meta_toggle"); + #} + + layout.itemS() + layout.itemO("sequencer.reload") + layout.itemS() + layout.itemO("sequencer.lock") + layout.itemO("sequencer.unlock") + layout.itemO("sequencer.mute") + layout.itemO("sequencer.unmute") + + layout.item_booleanO("sequencer.mute", "unselected", 1, text="Mute Deselected Strips") + + layout.itemO("sequencer.snap") + + layout.itemO("sequencer.swap_right") + layout.itemO("sequencer.swap_left") # Panels class SequencerButtonsPanel(bpy.types.Panel): - bl_space_type = 'SEQUENCE_EDITOR' - bl_region_type = 'UI' + bl_space_type = 'SEQUENCE_EDITOR' + bl_region_type = 'UI' + + def poll(self, context): + return context.space_data.display_mode == 'SEQUENCER' and act_strip(context) != None - def poll(self, context): - return context.space_data.display_mode == 'SEQUENCER' and act_strip(context) != None - class SequencerButtonsPanel_Output(bpy.types.Panel): - bl_space_type = 'SEQUENCE_EDITOR' - bl_region_type = 'UI' + bl_space_type = 'SEQUENCE_EDITOR' + bl_region_type = 'UI' - def poll(self, context): - return context.space_data.display_mode != 'SEQUENCER' + def poll(self, context): + return context.space_data.display_mode != 'SEQUENCER' class SEQUENCER_PT_edit(SequencerButtonsPanel): - bl_label = "Edit Strip" + bl_label = "Edit Strip" + + def draw(self, context): + layout = self.layout + + strip = act_strip(context) + + split = layout.split(percentage=0.3) + split.itemL(text="Name:") + split.itemR(strip, "name", text="") + + split = layout.split(percentage=0.3) + split.itemL(text="Type:") + split.itemR(strip, "type", text="") + + split = layout.split(percentage=0.3) + split.itemL(text="Blend:") + split.itemR(strip, "blend_mode", text="") + + row = layout.row() + if strip.mute == True: + row.itemR(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_ON', text="") + elif strip.mute == False: + row.itemR(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_OFF', text="") + + sub = row.row() + sub.active = (not strip.mute) + + sub.itemR(strip, "blend_opacity", text="Opacity", slider=True) + + row = layout.row() + row.itemR(strip, "lock") + row.itemR(strip, "frame_locked", text="Frame Lock") + + col = layout.column() + col.enabled = not strip.lock + col.itemR(strip, "channel") + col.itemR(strip, "start_frame") + col.itemR(strip, "length") + + col = layout.column(align=True) + col.itemL(text="Offset:") + col.itemR(strip, "start_offset", text="Start") + col.itemR(strip, "end_offset", text="End") + + col = layout.column(align=True) + col.itemL(text="Still:") + col.itemR(strip, "start_still", text="Start") + col.itemR(strip, "end_still", text="End") - def draw(self, context): - layout = self.layout - - strip = act_strip(context) - - split = layout.split(percentage=0.3) - split.itemL(text="Name:") - split.itemR(strip, "name", text="") - - split = layout.split(percentage=0.3) - split.itemL(text="Type:") - split.itemR(strip, "type", text="") - - split = layout.split(percentage=0.3) - split.itemL(text="Blend:") - split.itemR(strip, "blend_mode", text="") - - row = layout.row() - if strip.mute == True: - row.itemR(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_ON', text="") - elif strip.mute == False: - row.itemR(strip, "mute", toggle=True, icon='ICON_RESTRICT_VIEW_OFF', text="") - - sub = row.row() - sub.active = (not strip.mute) - - sub.itemR(strip, "blend_opacity", text="Opacity", slider=True) - - row = layout.row() - row.itemR(strip, "lock") - row.itemR(strip, "frame_locked", text="Frame Lock") - - col = layout.column() - col.enabled = not strip.lock - col.itemR(strip, "channel") - col.itemR(strip, "start_frame") - col.itemR(strip, "length") - - col = layout.column(align=True) - col.itemL(text="Offset:") - col.itemR(strip, "start_offset", text="Start") - col.itemR(strip, "end_offset", text="End") - - col = layout.column(align=True) - col.itemL(text="Still:") - col.itemR(strip, "start_still", text="Start") - col.itemR(strip, "end_still", text="End") - class SEQUENCER_PT_effect(SequencerButtonsPanel): - bl_label = "Effect Strip" + bl_label = "Effect Strip" - def poll(self, context): - if context.space_data.display_mode != 'SEQUENCER': - return False - - strip = act_strip(context) - if not strip: - return False - - return strip.type in ('COLOR', 'WIPE', 'GLOW', 'SPEED', 'TRANSFORM') + def poll(self, context): + if context.space_data.display_mode != 'SEQUENCER': + return False - def draw(self, context): - layout = self.layout - - strip = act_strip(context) - - if strip.type == 'COLOR': - layout.itemR(strip, "color") - - elif strip.type == 'WIPE': - - col = layout.column() - col.itemR(strip, "transition_type") - col.itemL(text="Direction:") - col.row().itemR(strip, "direction", expand=True) - - col = layout.column() - col.itemR(strip, "blur_width", slider=True) - if strip.transition_type in ('SINGLE', 'DOUBLE'): - col.itemR(strip, "angle") - - elif strip.type == 'GLOW': - flow = layout.column_flow() - flow.itemR(strip, "threshold", slider=True) - flow.itemR(strip, "clamp", slider=True) - flow.itemR(strip, "boost_factor") - flow.itemR(strip, "blur_distance") - - row = layout.row() - row.itemR(strip, "quality", slider=True) - row.itemR(strip, "only_boost") - - elif strip.type == 'SPEED': - layout.itemR(strip, "global_speed") - - flow = layout.column_flow() - flow.itemR(strip, "curve_velocity") - flow.itemR(strip, "curve_compress_y") - flow.itemR(strip, "frame_blending") - - elif strip.type == 'TRANSFORM': - - col = layout.column() - col.itemR(strip, "interpolation") - col.itemR(strip, "translation_unit") - - col = layout.column(align=True) - col.itemL(text="Position X:") - col.itemR(strip, "translate_start_x", text="Start") - col.itemR(strip, "translate_end_x", text="End") - - col = layout.column(align=True) - col.itemL(text="Position Y:") - col.itemR(strip, "translate_start_y", text="Start") - col.itemR(strip, "translate_end_y", text="End") - - layout.itemS() - - col = layout.column(align=True) - col.itemL(text="Scale X:") - col.itemR(strip, "scale_start_x", text="Start") - col.itemR(strip, "scale_end_x", text="End") - - col = layout.column(align=True) - col.itemL(text="Scale Y:") - col.itemR(strip, "scale_start_y", text="Start") - col.itemR(strip, "scale_end_y", text="End") - - layout.itemS() - - col = layout.column(align=True) - col.itemL(text="Rotation:") - col.itemR(strip, "rotation_start", text="Start") - col.itemR(strip, "rotation_end", text="End") + strip = act_strip(context) + if not strip: + return False + + return strip.type in ('COLOR', 'WIPE', 'GLOW', 'SPEED', 'TRANSFORM') + + def draw(self, context): + layout = self.layout + + strip = act_strip(context) + + if strip.type == 'COLOR': + layout.itemR(strip, "color") + + elif strip.type == 'WIPE': + + col = layout.column() + col.itemR(strip, "transition_type") + col.itemL(text="Direction:") + col.row().itemR(strip, "direction", expand=True) + + col = layout.column() + col.itemR(strip, "blur_width", slider=True) + if strip.transition_type in ('SINGLE', 'DOUBLE'): + col.itemR(strip, "angle") + + elif strip.type == 'GLOW': + flow = layout.column_flow() + flow.itemR(strip, "threshold", slider=True) + flow.itemR(strip, "clamp", slider=True) + flow.itemR(strip, "boost_factor") + flow.itemR(strip, "blur_distance") + + row = layout.row() + row.itemR(strip, "quality", slider=True) + row.itemR(strip, "only_boost") + + elif strip.type == 'SPEED': + layout.itemR(strip, "global_speed") + + flow = layout.column_flow() + flow.itemR(strip, "curve_velocity") + flow.itemR(strip, "curve_compress_y") + flow.itemR(strip, "frame_blending") + + elif strip.type == 'TRANSFORM': + + col = layout.column() + col.itemR(strip, "interpolation") + col.itemR(strip, "translation_unit") + + col = layout.column(align=True) + col.itemL(text="Position X:") + col.itemR(strip, "translate_start_x", text="Start") + col.itemR(strip, "translate_end_x", text="End") + + col = layout.column(align=True) + col.itemL(text="Position Y:") + col.itemR(strip, "translate_start_y", text="Start") + col.itemR(strip, "translate_end_y", text="End") + + layout.itemS() + + col = layout.column(align=True) + col.itemL(text="Scale X:") + col.itemR(strip, "scale_start_x", text="Start") + col.itemR(strip, "scale_end_x", text="End") + + col = layout.column(align=True) + col.itemL(text="Scale Y:") + col.itemR(strip, "scale_start_y", text="Start") + col.itemR(strip, "scale_end_y", text="End") + + layout.itemS() + + col = layout.column(align=True) + col.itemL(text="Rotation:") + col.itemR(strip, "rotation_start", text="Start") + col.itemR(strip, "rotation_end", text="End") class SEQUENCER_PT_input(SequencerButtonsPanel): - bl_label = "Strip Input" - - def poll(self, context): - if context.space_data.display_mode != 'SEQUENCER': - return False - - strip = act_strip(context) - if not strip: - return False - - return strip.type in ('MOVIE', 'IMAGE') - - def draw(self, context): - layout = self.layout - - strip = act_strip(context) - - split = layout.split(percentage=0.2) - col = split.column() - col.itemL(text="Path:") - col = split.column() - col.itemR(strip, "directory", text="") - - # Current element for the filename + bl_label = "Strip Input" - elem = strip.getStripElem(context.scene.current_frame) - if elem: - split = layout.split(percentage=0.2) - col = split.column() - col.itemL(text="File:") - col = split.column() - col.itemR(elem, "filename", text="") # strip.elements[0] could be a fallback - - layout.itemR(strip, "use_translation", text="Image Offset:") - if strip.transform: - col = layout.column(align=True) - col.active = strip.use_translation - col.itemR(strip.transform, "offset_x", text="X") - col.itemR(strip.transform, "offset_y", text="Y") - - layout.itemR(strip, "use_crop", text="Image Crop:") - if strip.crop: - col = layout.column(align=True) - col.active = strip.use_crop - col.itemR(strip.crop, "top") - col.itemR(strip.crop, "left") - col.itemR(strip.crop, "bottom") - col.itemR(strip.crop, "right") - - col = layout.column(align=True) - col.itemL(text="Trim Duration:") - col.itemR(strip, "animation_start_offset", text="Start") - col.itemR(strip, "animation_end_offset", text="End") + def poll(self, context): + if context.space_data.display_mode != 'SEQUENCER': + return False + + strip = act_strip(context) + if not strip: + return False + + return strip.type in ('MOVIE', 'IMAGE') + + def draw(self, context): + layout = self.layout + + strip = act_strip(context) + + split = layout.split(percentage=0.2) + col = split.column() + col.itemL(text="Path:") + col = split.column() + col.itemR(strip, "directory", text="") + + # Current element for the filename + + elem = strip.getStripElem(context.scene.current_frame) + if elem: + split = layout.split(percentage=0.2) + col = split.column() + col.itemL(text="File:") + col = split.column() + col.itemR(elem, "filename", text="") # strip.elements[0] could be a fallback + + layout.itemR(strip, "use_translation", text="Image Offset:") + if strip.transform: + col = layout.column(align=True) + col.active = strip.use_translation + col.itemR(strip.transform, "offset_x", text="X") + col.itemR(strip.transform, "offset_y", text="Y") + + layout.itemR(strip, "use_crop", text="Image Crop:") + if strip.crop: + col = layout.column(align=True) + col.active = strip.use_crop + col.itemR(strip.crop, "top") + col.itemR(strip.crop, "left") + col.itemR(strip.crop, "bottom") + col.itemR(strip.crop, "right") + + col = layout.column(align=True) + col.itemL(text="Trim Duration:") + col.itemR(strip, "animation_start_offset", text="Start") + col.itemR(strip, "animation_end_offset", text="End") class SEQUENCER_PT_sound(SequencerButtonsPanel): - bl_label = "Sound" - - def poll(self, context): - if context.space_data.display_mode != 'SEQUENCER': - return False - - strip = act_strip(context) - if not strip: - return False - - return strip.type in ('SOUND', ) - - def draw(self, context): - layout = self.layout - - strip = act_strip(context) - - layout.template_ID(strip, "sound", new="sound.open") - - layout.itemS() - layout.itemR(strip.sound, "filename", text="") - - row = layout.row() - if strip.sound.packed_file: - row.itemO("sound.unpack", icon='ICON_PACKAGE', text="Unpack") - else: - row.itemO("sound.pack", icon='ICON_UGLYPACKAGE', text="Pack") - - row.itemR(strip.sound, "caching") + bl_label = "Sound" + + def poll(self, context): + if context.space_data.display_mode != 'SEQUENCER': + return False + + strip = act_strip(context) + if not strip: + return False + + return strip.type in ('SOUND', ) + + def draw(self, context): + layout = self.layout + + strip = act_strip(context) + + layout.template_ID(strip, "sound", new="sound.open") + + layout.itemS() + layout.itemR(strip.sound, "filename", text="") + + row = layout.row() + if strip.sound.packed_file: + row.itemO("sound.unpack", icon='ICON_PACKAGE', text="Unpack") + else: + row.itemO("sound.pack", icon='ICON_UGLYPACKAGE', text="Pack") + + row.itemR(strip.sound, "caching") class SEQUENCER_PT_filter(SequencerButtonsPanel): - bl_label = "Filter" - - def poll(self, context): - if context.space_data.display_mode != 'SEQUENCER': - return False - - strip = act_strip(context) - if not strip: - return False - - return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META') - - def draw(self, context): - layout = self.layout - - strip = act_strip(context) + bl_label = "Filter" - col = layout.column() - col.itemL(text="Video:") - col.itemR(strip, "strobe") - col.itemR(strip, "de_interlace") - - col = layout.column() - col.itemL(text="Colors:") - col.itemR(strip, "multiply_colors", text="Multiply") - col.itemR(strip, "premultiply") - col.itemR(strip, "convert_float") + def poll(self, context): + if context.space_data.display_mode != 'SEQUENCER': + return False - col = layout.column() - col.itemL(text="Flip:") - col.itemR(strip, "flip_x", text="X") - col.itemR(strip, "flip_y", text="Y") - col.itemR(strip, "reverse_frames", text="Backwards") - - layout.itemR(strip, "use_color_balance") - if strip.color_balance: # TODO - need to add this somehow - row = layout.row() - row.active = strip.use_color_balance - col = row.column() - col.itemR(strip.color_balance, "lift") - col.itemR(strip.color_balance, "inverse_lift", text="Inverse") - col = row.column() - col.itemR(strip.color_balance, "gamma") - col.itemR(strip.color_balance, "inverse_gamma", text="Inverse") - col = row.column() - col.itemR(strip.color_balance, "gain") - col.itemR(strip.color_balance, "inverse_gain", text="Inverse") + strip = act_strip(context) + if not strip: + return False + + return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META') + + def draw(self, context): + layout = self.layout + + strip = act_strip(context) + + col = layout.column() + col.itemL(text="Video:") + col.itemR(strip, "strobe") + col.itemR(strip, "de_interlace") + + col = layout.column() + col.itemL(text="Colors:") + col.itemR(strip, "multiply_colors", text="Multiply") + col.itemR(strip, "premultiply") + col.itemR(strip, "convert_float") + + col = layout.column() + col.itemL(text="Flip:") + col.itemR(strip, "flip_x", text="X") + col.itemR(strip, "flip_y", text="Y") + col.itemR(strip, "reverse_frames", text="Backwards") + + layout.itemR(strip, "use_color_balance") + if strip.color_balance: # TODO - need to add this somehow + row = layout.row() + row.active = strip.use_color_balance + col = row.column() + col.itemR(strip.color_balance, "lift") + col.itemR(strip.color_balance, "inverse_lift", text="Inverse") + col = row.column() + col.itemR(strip.color_balance, "gamma") + col.itemR(strip.color_balance, "inverse_gamma", text="Inverse") + col = row.column() + col.itemR(strip.color_balance, "gain") + col.itemR(strip.color_balance, "inverse_gain", text="Inverse") class SEQUENCER_PT_proxy(SequencerButtonsPanel): - bl_label = "Proxy" - - def poll(self, context): - if context.space_data.display_mode != 'SEQUENCER': - return False - - strip = act_strip(context) - if not strip: - return False - - return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META') - - def draw_header(self, context): - strip = act_strip(context) - - self.layout.itemR(strip, "use_proxy", text="") + bl_label = "Proxy" - def draw(self, context): - layout = self.layout - - strip = act_strip(context) - - flow = layout.column_flow() - flow.itemR(strip, "proxy_custom_directory") - if strip.proxy: # TODO - need to add this somehow - flow.itemR(strip.proxy, "directory") - flow.itemR(strip.proxy, "file") + def poll(self, context): + if context.space_data.display_mode != 'SEQUENCER': + return False + + strip = act_strip(context) + if not strip: + return False + + return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META') + + def draw_header(self, context): + strip = act_strip(context) + + self.layout.itemR(strip, "use_proxy", text="") + + def draw(self, context): + layout = self.layout + + strip = act_strip(context) + + flow = layout.column_flow() + flow.itemR(strip, "proxy_custom_directory") + if strip.proxy: # TODO - need to add this somehow + flow.itemR(strip.proxy, "directory") + flow.itemR(strip.proxy, "file") class SEQUENCER_PT_view(SequencerButtonsPanel_Output): - bl_label = "View Settings" + bl_label = "View Settings" - def draw(self, context): - layout = self.layout - - st = context.space_data + def draw(self, context): + layout = self.layout - col = layout.column() - col.itemR(st, "draw_overexposed") # text="Zebra" - col.itemR(st, "draw_safe_margin") + st = context.space_data + + col = layout.column() + col.itemR(st, "draw_overexposed") # text="Zebra" + col.itemR(st, "draw_safe_margin") bpy.types.register(SEQUENCER_HT_header) # header/menu classes bpy.types.register(SEQUENCER_MT_view) diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py index 97052c68043..75bfd21bf88 100644 --- a/release/scripts/ui/space_text.py +++ b/release/scripts/ui/space_text.py @@ -2,265 +2,265 @@ import bpy class TEXT_HT_header(bpy.types.Header): - bl_space_type = 'TEXT_EDITOR' + bl_space_type = 'TEXT_EDITOR' - def draw(self, context): - layout = self.layout - - st = context.space_data - text = st.text + def draw(self, context): + layout = self.layout - row = layout.row(align=True) - row.template_header() + st = context.space_data + text = st.text - if context.area.show_menus: - sub = row.row(align=True) - sub.itemM("TEXT_MT_text") - if text: - sub.itemM("TEXT_MT_edit") - sub.itemM("TEXT_MT_format") + row = layout.row(align=True) + row.template_header() - if text and text.modified: - row = layout.row() - # row.color(redalert) - row.itemO("text.resolve_conflict", text="", icon='ICON_HELP') + if context.area.show_menus: + sub = row.row(align=True) + sub.itemM("TEXT_MT_text") + if text: + sub.itemM("TEXT_MT_edit") + sub.itemM("TEXT_MT_format") - layout.template_ID(st, "text", new="text.new", unlink="text.unlink") + if text and text.modified: + row = layout.row() + # row.color(redalert) + row.itemO("text.resolve_conflict", text="", icon='ICON_HELP') - row = layout.row(align=True) - row.itemR(st, "line_numbers", text="") - row.itemR(st, "word_wrap", text="") - row.itemR(st, "syntax_highlight", text="") + layout.template_ID(st, "text", new="text.new", unlink="text.unlink") - if text: - row = layout.row() - if text.filename != "": - if text.dirty: - row.itemL(text="File: *%s (unsaved)" % text.filename) - else: - row.itemL(text="File: %s" % text.filename ) - else: - if text.library: - row.itemL(text="Text: External") - else: - row.itemL(text="Text: Internal") - - row = layout.row() - row.itemO("text.run_script") + row = layout.row(align=True) + row.itemR(st, "line_numbers", text="") + row.itemR(st, "word_wrap", text="") + row.itemR(st, "syntax_highlight", text="") + + if text: + row = layout.row() + if text.filename != "": + if text.dirty: + row.itemL(text="File: *%s (unsaved)" % text.filename) + else: + row.itemL(text="File: %s" % text.filename ) + else: + if text.library: + row.itemL(text="Text: External") + else: + row.itemL(text="Text: Internal") + + row = layout.row() + row.itemO("text.run_script") class TEXT_PT_properties(bpy.types.Panel): - bl_space_type = 'TEXT_EDITOR' - bl_region_type = 'UI' - bl_label = "Properties" + bl_space_type = 'TEXT_EDITOR' + bl_region_type = 'UI' + bl_label = "Properties" - def draw(self, context): - layout = self.layout - - st = context.space_data + def draw(self, context): + layout = self.layout - flow = layout.column_flow() - flow.itemR(st, "line_numbers") - flow.itemR(st, "word_wrap") - flow.itemR(st, "syntax_highlight") - flow.itemR(st, "live_edit") + st = context.space_data - flow = layout.column_flow() - flow.itemR(st, "font_size") - flow.itemR(st, "tab_width") + flow = layout.column_flow() + flow.itemR(st, "line_numbers") + flow.itemR(st, "word_wrap") + flow.itemR(st, "syntax_highlight") + flow.itemR(st, "live_edit") + + flow = layout.column_flow() + flow.itemR(st, "font_size") + flow.itemR(st, "tab_width") class TEXT_PT_find(bpy.types.Panel): - bl_space_type = 'TEXT_EDITOR' - bl_region_type = 'UI' - bl_label = "Find" + bl_space_type = 'TEXT_EDITOR' + bl_region_type = 'UI' + bl_label = "Find" - def draw(self, context): - layout = self.layout - - st = context.space_data + def draw(self, context): + layout = self.layout - # find - col = layout.column(align=True) - row = col.row() - row.itemR(st, "find_text", text="") - row.itemO("text.find_set_selected", text="", icon='ICON_TEXT') - col.itemO("text.find") + st = context.space_data - # replace - col = layout.column(align=True) - row = col.row() - row.itemR(st, "replace_text", text="") - row.itemO("text.replace_set_selected", text="", icon='ICON_TEXT') - col.itemO("text.replace") + # find + col = layout.column(align=True) + row = col.row() + row.itemR(st, "find_text", text="") + row.itemO("text.find_set_selected", text="", icon='ICON_TEXT') + col.itemO("text.find") - # mark - layout.itemO("text.mark_all") + # replace + col = layout.column(align=True) + row = col.row() + row.itemR(st, "replace_text", text="") + row.itemO("text.replace_set_selected", text="", icon='ICON_TEXT') + col.itemO("text.replace") - # settings - row = layout.row() - row.itemR(st, "find_wrap", text="Wrap") - row.itemR(st, "find_all", text="All") + # mark + layout.itemO("text.mark_all") + + # settings + row = layout.row() + row.itemR(st, "find_wrap", text="Wrap") + row.itemR(st, "find_all", text="All") class TEXT_MT_text(bpy.types.Menu): - bl_label = "Text" + bl_label = "Text" - def draw(self, context): - layout = self.layout - - st = context.space_data - text = st.text + def draw(self, context): + layout = self.layout - layout.column() - layout.itemO("text.new") - layout.itemO("text.open") + st = context.space_data + text = st.text - if text: - layout.itemO("text.reload") + layout.column() + layout.itemO("text.new") + layout.itemO("text.open") - layout.column() - layout.itemO("text.save") - layout.itemO("text.save_as") + if text: + layout.itemO("text.reload") - if text.filename != "": - layout.itemO("text.make_internal") + layout.column() + layout.itemO("text.save") + layout.itemO("text.save_as") - layout.column() - layout.itemO("text.run_script") + if text.filename != "": + layout.itemO("text.make_internal") - #ifndef DISABLE_PYTHON - # XXX if(BPY_is_pyconstraint(text)) - # XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints"); - #endif + layout.column() + layout.itemO("text.run_script") - layout.itemS() + #ifndef DISABLE_PYTHON + # XXX if(BPY_is_pyconstraint(text)) + # XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints"); + #endif + + layout.itemS() + + layout.itemO("text.properties", icon='ICON_MENU_PANEL') + + + + #ifndef DISABLE_PYTHON + # XXX layout.column() + # XXX uiDefIconTextBlockBut(block, text_template_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Script Templates", 0, yco-=20, 120, 19, ""); + # XXX uiDefIconTextBlockBut(block, text_plugin_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Text Plugins", 0, yco-=20, 120, 19, ""); + #endif + + layout.itemM("TEXT_MT_templates") - layout.itemO("text.properties", icon='ICON_MENU_PANEL') - - - - #ifndef DISABLE_PYTHON - # XXX layout.column() - # XXX uiDefIconTextBlockBut(block, text_template_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Script Templates", 0, yco-=20, 120, 19, ""); - # XXX uiDefIconTextBlockBut(block, text_plugin_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Text Plugins", 0, yco-=20, 120, 19, ""); - #endif - - layout.itemM("TEXT_MT_templates") - class TEXT_MT_templates(bpy.types.Menu): - ''' - Creates the menu items by scanning scripts/templates - ''' - bl_label = "Script Templates" - - def draw(self, context): - import os - - def path_to_name(f): - f_base = os.path.splitext(f)[0] - f_base = f_base.replace("_", " ") - return ' '.join([w[0].upper() + w[1:] for w in f_base.split()]) - - layout = self.layout - template_dir = os.path.join(os.path.dirname(__file__), os.path.pardir, "templates") - - for f in sorted(os.listdir(template_dir)): - - if f.startswith("."): - continue - - path = os.path.join(template_dir, f) - layout.item_stringO("text.open", "path", path, text=path_to_name(f)) + ''' + Creates the menu items by scanning scripts/templates + ''' + bl_label = "Script Templates" + + def draw(self, context): + import os + + def path_to_name(f): + f_base = os.path.splitext(f)[0] + f_base = f_base.replace("_", " ") + return ' '.join([w[0].upper() + w[1:] for w in f_base.split()]) + + layout = self.layout + template_dir = os.path.join(os.path.dirname(__file__), os.path.pardir, "templates") + + for f in sorted(os.listdir(template_dir)): + + if f.startswith("."): + continue + + path = os.path.join(template_dir, f) + layout.item_stringO("text.open", "path", path, text=path_to_name(f)) class TEXT_MT_edit_view(bpy.types.Menu): - bl_label = "View" + bl_label = "View" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.item_enumO("text.move", "type", 'FILE_TOP', text="Top of File") - layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File") + layout.item_enumO("text.move", "type", 'FILE_TOP', text="Top of File") + layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File") class TEXT_MT_edit_select(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("text.select_all") - layout.itemO("text.select_line") + layout.itemO("text.select_all") + layout.itemO("text.select_line") class TEXT_MT_edit_markers(bpy.types.Menu): - bl_label = "Markers" + bl_label = "Markers" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("text.markers_clear") - layout.itemO("text.next_marker") - layout.itemO("text.previous_marker") + layout.itemO("text.markers_clear") + layout.itemO("text.next_marker") + layout.itemO("text.previous_marker") class TEXT_MT_format(bpy.types.Menu): - bl_label = "Format" + bl_label = "Format" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("text.indent") - layout.itemO("text.unindent") + layout.itemO("text.indent") + layout.itemO("text.unindent") - layout.itemS() + layout.itemS() - layout.itemO("text.comment") - layout.itemO("text.uncomment") + layout.itemO("text.comment") + layout.itemO("text.uncomment") - layout.itemS() + layout.itemS() - layout.item_menu_enumO("text.convert_whitespace", "type") + layout.item_menu_enumO("text.convert_whitespace", "type") class TEXT_MT_edit_to3d(bpy.types.Menu): - bl_label = "Text To 3D Object" + bl_label = "Text To 3D Object" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.item_booleanO("text.to_3d_object", "split_lines", False, text="One Object"); - layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line"); + layout.item_booleanO("text.to_3d_object", "split_lines", False, text="One Object"); + layout.item_booleanO("text.to_3d_object", "split_lines", True, text="One Object Per Line"); class TEXT_MT_edit(bpy.types.Menu): - bl_label = "Edit" + bl_label = "Edit" - def poll(self, context): - return (context.space_data.text) + def poll(self, context): + return (context.space_data.text) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("ed.undo") - layout.itemO("ed.redo") + layout.itemO("ed.undo") + layout.itemO("ed.redo") - layout.itemS() + layout.itemS() - layout.itemO("text.cut") - layout.itemO("text.copy") - layout.itemO("text.paste") + layout.itemO("text.cut") + layout.itemO("text.copy") + layout.itemO("text.paste") - layout.itemS() + layout.itemS() - layout.itemM("TEXT_MT_edit_view") - layout.itemM("TEXT_MT_edit_select") - layout.itemM("TEXT_MT_edit_markers") + layout.itemM("TEXT_MT_edit_view") + layout.itemM("TEXT_MT_edit_select") + layout.itemM("TEXT_MT_edit_markers") - layout.itemS() + layout.itemS() - layout.itemO("text.jump") - layout.itemO("text.properties", text="Find...") + layout.itemO("text.jump") + layout.itemO("text.properties", text="Find...") - layout.itemS() + layout.itemS() - layout.itemM("TEXT_MT_edit_to3d") + layout.itemM("TEXT_MT_edit_to3d") bpy.types.register(TEXT_HT_header) bpy.types.register(TEXT_PT_properties) diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py index 1e385be06dd..1322d774ebe 100644 --- a/release/scripts/ui/space_time.py +++ b/release/scripts/ui/space_time.py @@ -2,143 +2,143 @@ import bpy class TIME_HT_header(bpy.types.Header): - bl_space_type = 'TIMELINE' + bl_space_type = 'TIMELINE' - def draw(self, context): - layout = self.layout - - st = context.space_data - scene = context.scene - tools = context.tool_settings - screen = context.screen + def draw(self, context): + layout = self.layout - row = layout.row(align=True) - row.template_header() + st = context.space_data + scene = context.scene + tools = context.tool_settings + screen = context.screen - if context.area.show_menus: - sub = row.row(align=True) - sub.itemM("TIME_MT_view") - sub.itemM("TIME_MT_frame") - sub.itemM("TIME_MT_playback") + row = layout.row(align=True) + row.template_header() - layout.itemR(scene, "use_preview_range", text="PR") - - row = layout.row(align=True) - if not scene.use_preview_range: - row.itemR(scene, "start_frame", text="Start") - row.itemR(scene, "end_frame", text="End") - else: - row.itemR(scene, "preview_range_start_frame", text="Start") - row.itemR(scene, "preview_range_end_frame", text="End") - - layout.itemR(scene, "current_frame", text="") - - layout.itemS() + if context.area.show_menus: + sub = row.row(align=True) + sub.itemM("TIME_MT_view") + sub.itemM("TIME_MT_frame") + sub.itemM("TIME_MT_playback") - row = layout.row(align=True) - row.item_booleanO("screen.frame_jump", "end", False, text="", icon='ICON_REW') - row.item_booleanO("screen.keyframe_jump", "next", False, text="", icon='ICON_PREV_KEYFRAME') - if not screen.animation_playing: - row.item_booleanO("screen.animation_play", "reverse", True, text="", icon='ICON_PLAY_REVERSE') - row.itemO("screen.animation_play", text="", icon='ICON_PLAY') - else: - sub = row.row() - sub.scale_x = 2.0 - sub.itemO("screen.animation_play", text="", icon='ICON_PAUSE') - row.item_booleanO("screen.keyframe_jump", "next", True, text="", icon='ICON_NEXT_KEYFRAME') - row.item_booleanO("screen.frame_jump", "end", True, text="", icon='ICON_FF') - - row = layout.row(align=True) - row.itemR(tools, "enable_auto_key", text="", toggle=True, icon='ICON_REC') - if screen.animation_playing and tools.enable_auto_key: - subsub = row.row() - subsub.itemR(tools, "record_with_nla", toggle=True) - - layout.itemR(scene, "sync_audio", text="", toggle=True, icon='ICON_SPEAKER') - - layout.itemS() - - row = layout.row(align=True) - row.item_pointerR(scene, "active_keying_set", scene, "keying_sets", text="") - row.itemO("anim.insert_keyframe", text="", icon='ICON_KEY_HLT') - row.itemO("anim.delete_keyframe", text="", icon='ICON_KEY_DEHLT') + layout.itemR(scene, "use_preview_range", text="PR") + + row = layout.row(align=True) + if not scene.use_preview_range: + row.itemR(scene, "start_frame", text="Start") + row.itemR(scene, "end_frame", text="End") + else: + row.itemR(scene, "preview_range_start_frame", text="Start") + row.itemR(scene, "preview_range_end_frame", text="End") + + layout.itemR(scene, "current_frame", text="") + + layout.itemS() + + row = layout.row(align=True) + row.item_booleanO("screen.frame_jump", "end", False, text="", icon='ICON_REW') + row.item_booleanO("screen.keyframe_jump", "next", False, text="", icon='ICON_PREV_KEYFRAME') + if not screen.animation_playing: + row.item_booleanO("screen.animation_play", "reverse", True, text="", icon='ICON_PLAY_REVERSE') + row.itemO("screen.animation_play", text="", icon='ICON_PLAY') + else: + sub = row.row() + sub.scale_x = 2.0 + sub.itemO("screen.animation_play", text="", icon='ICON_PAUSE') + row.item_booleanO("screen.keyframe_jump", "next", True, text="", icon='ICON_NEXT_KEYFRAME') + row.item_booleanO("screen.frame_jump", "end", True, text="", icon='ICON_FF') + + row = layout.row(align=True) + row.itemR(tools, "enable_auto_key", text="", toggle=True, icon='ICON_REC') + if screen.animation_playing and tools.enable_auto_key: + subsub = row.row() + subsub.itemR(tools, "record_with_nla", toggle=True) + + layout.itemR(scene, "sync_audio", text="", toggle=True, icon='ICON_SPEAKER') + + layout.itemS() + + row = layout.row(align=True) + row.item_pointerR(scene, "active_keying_set", scene, "keying_sets", text="") + row.itemO("anim.insert_keyframe", text="", icon='ICON_KEY_HLT') + row.itemO("anim.delete_keyframe", text="", icon='ICON_KEY_DEHLT') class TIME_MT_view(bpy.types.Menu): - bl_label = "View" + bl_label = "View" - def draw(self, context): - layout = self.layout - - st = context.space_data - - layout.itemO("anim.time_toggle") - - layout.itemS() - - layout.itemR(st, "only_selected") + def draw(self, context): + layout = self.layout + + st = context.space_data + + layout.itemO("anim.time_toggle") + + layout.itemS() + + layout.itemR(st, "only_selected") class TIME_MT_frame(bpy.types.Menu): - bl_label = "Frame" + bl_label = "Frame" - def draw(self, context): - layout = self.layout - tools = context.tool_settings - - layout.itemO("marker.add", text="Add Marker") - layout.itemO("marker.duplicate", text="Duplicate Marker") - layout.itemO("marker.move", text="Grab/Move Marker") - layout.itemO("marker.delete", text="Delete Marker") - layout.itemL(text="ToDo: Name Marker") - - layout.itemS() - - layout.itemO("time.start_frame_set") - layout.itemO("time.end_frame_set") - - layout.itemS() - - sub = layout.row() - #sub.active = tools.enable_auto_key - sub.itemM("TIME_MT_autokey") + def draw(self, context): + layout = self.layout + tools = context.tool_settings + + layout.itemO("marker.add", text="Add Marker") + layout.itemO("marker.duplicate", text="Duplicate Marker") + layout.itemO("marker.move", text="Grab/Move Marker") + layout.itemO("marker.delete", text="Delete Marker") + layout.itemL(text="ToDo: Name Marker") + + layout.itemS() + + layout.itemO("time.start_frame_set") + layout.itemO("time.end_frame_set") + + layout.itemS() + + sub = layout.row() + #sub.active = tools.enable_auto_key + sub.itemM("TIME_MT_autokey") class TIME_MT_playback(bpy.types.Menu): - bl_label = "Playback" + bl_label = "Playback" - def draw(self, context): - layout = self.layout - - st = context.space_data - scene = context.scene - - layout.itemR(st, "play_top_left") - layout.itemR(st, "play_all_3d") - layout.itemR(st, "play_anim") - layout.itemR(st, "play_buttons") - layout.itemR(st, "play_image") - layout.itemR(st, "play_sequencer") - layout.itemR(st, "play_nodes") - - layout.itemS() - - layout.itemR(st, "continue_physics") - - layout.itemS() - - layout.itemR(scene, "sync_audio", icon='ICON_SPEAKER') - layout.itemR(scene, "mute_audio") - layout.itemR(scene, "scrub_audio") + def draw(self, context): + layout = self.layout + + st = context.space_data + scene = context.scene + + layout.itemR(st, "play_top_left") + layout.itemR(st, "play_all_3d") + layout.itemR(st, "play_anim") + layout.itemR(st, "play_buttons") + layout.itemR(st, "play_image") + layout.itemR(st, "play_sequencer") + layout.itemR(st, "play_nodes") + + layout.itemS() + + layout.itemR(st, "continue_physics") + + layout.itemS() + + layout.itemR(scene, "sync_audio", icon='ICON_SPEAKER') + layout.itemR(scene, "mute_audio") + layout.itemR(scene, "scrub_audio") class TIME_MT_autokey(bpy.types.Menu): - bl_label = "Auto-Keyframing Mode" + bl_label = "Auto-Keyframing Mode" - def draw(self, context): - layout = self.layout - tools = context.tool_settings - - layout.active = tools.enable_auto_key - - layout.item_enumR(tools, "autokey_mode", 'ADD_REPLACE_KEYS') - layout.item_enumR(tools, "autokey_mode", 'REPLACE_KEYS') + def draw(self, context): + layout = self.layout + tools = context.tool_settings + + layout.active = tools.enable_auto_key + + layout.item_enumR(tools, "autokey_mode", 'ADD_REPLACE_KEYS') + layout.item_enumR(tools, "autokey_mode", 'REPLACE_KEYS') bpy.types.register(TIME_HT_header) bpy.types.register(TIME_MT_view) diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index ef85a608d17..2c129e50463 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -1,556 +1,556 @@ - + import bpy class USERPREF_HT_header(bpy.types.Header): - bl_space_type = 'USER_PREFERENCES' + bl_space_type = 'USER_PREFERENCES' - def draw(self, context): - layout = self.layout - layout.template_header(menus=False) - - userpref = context.user_preferences - - layout.operator_context = "EXEC_AREA" - layout.itemO("wm.save_homefile", text="Save As Default") + def draw(self, context): + layout = self.layout + layout.template_header(menus=False) + + userpref = context.user_preferences + + layout.operator_context = "EXEC_AREA" + layout.itemO("wm.save_homefile", text="Save As Default") + + if userpref.active_section == 'INPUT': + layout.operator_context = "INVOKE_DEFAULT" + layout.itemO("wm.keyconfig_export", "Export Key Configuration...") - if userpref.active_section == 'INPUT': - layout.operator_context = "INVOKE_DEFAULT" - layout.itemO("wm.keyconfig_export", "Export Key Configuration...") - class USERPREF_MT_view(bpy.types.Menu): - bl_label = "View" + bl_label = "View" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout class USERPREF_PT_tabs(bpy.types.Panel): - bl_label = "" - bl_space_type = 'USER_PREFERENCES' - bl_region_type = 'WINDOW' - bl_show_header = False + bl_label = "" + bl_space_type = 'USER_PREFERENCES' + bl_region_type = 'WINDOW' + bl_show_header = False - def draw(self, context): - layout = self.layout - - userpref = context.user_preferences + def draw(self, context): + layout = self.layout - layout.itemR(userpref, "active_section", expand=True) + userpref = context.user_preferences + + layout.itemR(userpref, "active_section", expand=True) class USERPREF_PT_interface(bpy.types.Panel): - bl_space_type = 'USER_PREFERENCES' - bl_label = "Interface" - bl_region_type = 'WINDOW' - bl_show_header = False + bl_space_type = 'USER_PREFERENCES' + bl_label = "Interface" + bl_region_type = 'WINDOW' + bl_show_header = False - def poll(self, context): - userpref = context.user_preferences - return (userpref.active_section == 'INTERFACE') + def poll(self, context): + userpref = context.user_preferences + return (userpref.active_section == 'INTERFACE') - def draw(self, context): - layout = self.layout - - userpref = context.user_preferences - view = userpref.view + def draw(self, context): + layout = self.layout - split = layout.split() - - col = split.column() - sub = col.split(percentage=0.85) - - sub1 = sub.column() - sub1.itemL(text="Display:") - sub1.itemR(view, "tooltips") - sub1.itemR(view, "display_object_info", text="Object Info") - sub1.itemR(view, "use_large_cursors") - sub1.itemR(view, "show_view_name", text="View Name") - sub1.itemR(view, "show_playback_fps", text="Playback FPS") - sub1.itemR(view, "global_scene") - sub1.itemR(view, "pin_floating_panels") - sub1.itemR(view, "object_center_size") - sub1.itemS() - sub1.itemS() - sub1.itemS() - sub1.itemR(view, "show_mini_axis", text="Display Mini Axis") - sub2 = sub1.column() - sub2.enabled = view.show_mini_axis - sub2.itemR(view, "mini_axis_size", text="Size") - sub2.itemR(view, "mini_axis_brightness", text="Brightness") - - col = split.column() - sub = col.split(percentage=0.85) - - sub1 = sub.column() - sub1.itemL(text="View Manipulation:") - sub1.itemR(view, "auto_depth") - sub1.itemR(view, "global_pivot") - sub1.itemR(view, "zoom_to_mouse") - sub1.itemR(view, "rotate_around_selection") - sub1.itemS() - - - sub1.itemR(view, "auto_perspective") - sub1.itemR(view, "smooth_view") - sub1.itemR(view, "rotation_angle") + userpref = context.user_preferences + view = userpref.view + + split = layout.split() + + col = split.column() + sub = col.split(percentage=0.85) + + sub1 = sub.column() + sub1.itemL(text="Display:") + sub1.itemR(view, "tooltips") + sub1.itemR(view, "display_object_info", text="Object Info") + sub1.itemR(view, "use_large_cursors") + sub1.itemR(view, "show_view_name", text="View Name") + sub1.itemR(view, "show_playback_fps", text="Playback FPS") + sub1.itemR(view, "global_scene") + sub1.itemR(view, "pin_floating_panels") + sub1.itemR(view, "object_center_size") + sub1.itemS() + sub1.itemS() + sub1.itemS() + sub1.itemR(view, "show_mini_axis", text="Display Mini Axis") + sub2 = sub1.column() + sub2.enabled = view.show_mini_axis + sub2.itemR(view, "mini_axis_size", text="Size") + sub2.itemR(view, "mini_axis_brightness", text="Brightness") + + col = split.column() + sub = col.split(percentage=0.85) + + sub1 = sub.column() + sub1.itemL(text="View Manipulation:") + sub1.itemR(view, "auto_depth") + sub1.itemR(view, "global_pivot") + sub1.itemR(view, "zoom_to_mouse") + sub1.itemR(view, "rotate_around_selection") + sub1.itemS() + + + sub1.itemR(view, "auto_perspective") + sub1.itemR(view, "smooth_view") + sub1.itemR(view, "rotation_angle") + + col = split.column() + sub = col.split(percentage=0.85) + sub1 = sub.column() - col = split.column() - sub = col.split(percentage=0.85) - sub1 = sub.column() - #Toolbox doesn't exist yet # sub1.itemL(text="Toolbox:") # sub1.itemR(view, "use_column_layout") # sub1.itemL(text="Open Toolbox Delay:") # sub1.itemR(view, "open_left_mouse_delay", text="Hold LMB") # sub1.itemR(view, "open_right_mouse_delay", text="Hold RMB") - - #manipulator - sub1.itemR(view, "use_manipulator") - sub2 = sub1.column() - sub2.enabled = view.use_manipulator - sub2.itemR(view, "manipulator_size", text="Size") - sub2.itemR(view, "manipulator_handle_size", text="Handle Size") - sub2.itemR(view, "manipulator_hotspot", text="Hotspot") - - sub1.itemS() - sub1.itemS() - sub1.itemS() - - sub1.itemL(text="Menus:") - sub1.itemR(view, "open_mouse_over") - sub1.itemL(text="Menu Open Delay:") - sub1.itemR(view, "open_toplevel_delay", text="Top Level") - sub1.itemR(view, "open_sublevel_delay", text="Sub Level") + + #manipulator + sub1.itemR(view, "use_manipulator") + sub2 = sub1.column() + sub2.enabled = view.use_manipulator + sub2.itemR(view, "manipulator_size", text="Size") + sub2.itemR(view, "manipulator_handle_size", text="Handle Size") + sub2.itemR(view, "manipulator_hotspot", text="Hotspot") + + sub1.itemS() + sub1.itemS() + sub1.itemS() + + sub1.itemL(text="Menus:") + sub1.itemR(view, "open_mouse_over") + sub1.itemL(text="Menu Open Delay:") + sub1.itemR(view, "open_toplevel_delay", text="Top Level") + sub1.itemR(view, "open_sublevel_delay", text="Sub Level") class USERPREF_PT_edit(bpy.types.Panel): - bl_space_type = 'USER_PREFERENCES' - bl_label = "Edit" - bl_region_type = 'WINDOW' - bl_show_header = False + bl_space_type = 'USER_PREFERENCES' + bl_label = "Edit" + bl_region_type = 'WINDOW' + bl_show_header = False - def poll(self, context): - userpref = context.user_preferences - return (userpref.active_section == 'EDITING') + def poll(self, context): + userpref = context.user_preferences + return (userpref.active_section == 'EDITING') - def draw(self, context): - layout = self.layout - - userpref = context.user_preferences - edit = userpref.edit - - split = layout.split() - - col = split.column() - sub = col.split(percentage=0.85) - - sub1 = sub.column() - sub1.itemL(text="Link Materials To:") - sub1.row().itemR(edit, "material_link", expand=True) - sub1.itemS() - sub1.itemS() - sub1.itemS() - sub1.itemL(text="New Objects:") - sub1.itemR(edit, "enter_edit_mode") - sub1.itemL(text="Align To:") - sub1.row().itemR(edit, "object_align", expand=True) - sub1.itemS() - sub1.itemS() - sub1.itemS() - - sub1.itemL(text="Undo:") - sub1.itemR(edit, "global_undo") - sub1.itemR(edit, "undo_steps", text="Steps") - sub1.itemR(edit, "undo_memory_limit", text="Memory Limit") - - col = split.column() - sub = col.split(percentage=0.85) - - sub1 = sub.column() - sub1.itemL(text="Snap:") - sub1.itemR(edit, "snap_translate", text="Translate") - sub1.itemR(edit, "snap_rotate", text="Rotate") - sub1.itemR(edit, "snap_scale", text="Scale") - sub1.itemS() - sub1.itemS() - sub1.itemS() - sub1.itemL(text="Grease Pencil:") - sub1.itemR(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance") - sub1.itemR(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance") - # sub1.itemR(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke") - sub1.itemR(edit, "grease_pencil_eraser_radius", text="Eraser Radius") - sub1.itemR(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke") - - col = split.column() - sub = col.split(percentage=0.85) - - sub1 = sub.column() - sub1.itemL(text="Keyframing:") - sub1.itemR(edit, "use_visual_keying") - sub1.itemR(edit, "keyframe_insert_needed", text="Only Insert Needed") - sub1.itemS() - sub1.itemL(text="New F-Curve Defaults:") - sub1.itemR(edit, "new_interpolation_type", text="Interpolation") - sub1.itemS() - sub1.itemR(edit, "auto_keying_enable", text="Auto Keyframing:") - sub2 = sub1.column() - sub2.active = edit.auto_keying_enable - sub2.itemR(edit, "auto_keyframe_insert_keyingset", text="Only Insert for Keying Set") - sub2.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available") - - sub1.itemS() - sub1.itemS() - sub1.itemS() - - sub1.itemL(text="Transform:") - sub1.itemR(edit, "drag_immediately") - - sub1.itemS() - sub1.itemS() - sub1.itemS() + def draw(self, context): + layout = self.layout + + userpref = context.user_preferences + edit = userpref.edit + + split = layout.split() + + col = split.column() + sub = col.split(percentage=0.85) + + sub1 = sub.column() + sub1.itemL(text="Link Materials To:") + sub1.row().itemR(edit, "material_link", expand=True) + sub1.itemS() + sub1.itemS() + sub1.itemS() + sub1.itemL(text="New Objects:") + sub1.itemR(edit, "enter_edit_mode") + sub1.itemL(text="Align To:") + sub1.row().itemR(edit, "object_align", expand=True) + sub1.itemS() + sub1.itemS() + sub1.itemS() + + sub1.itemL(text="Undo:") + sub1.itemR(edit, "global_undo") + sub1.itemR(edit, "undo_steps", text="Steps") + sub1.itemR(edit, "undo_memory_limit", text="Memory Limit") + + col = split.column() + sub = col.split(percentage=0.85) + + sub1 = sub.column() + sub1.itemL(text="Snap:") + sub1.itemR(edit, "snap_translate", text="Translate") + sub1.itemR(edit, "snap_rotate", text="Rotate") + sub1.itemR(edit, "snap_scale", text="Scale") + sub1.itemS() + sub1.itemS() + sub1.itemS() + sub1.itemL(text="Grease Pencil:") + sub1.itemR(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance") + sub1.itemR(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance") + # sub1.itemR(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke") + sub1.itemR(edit, "grease_pencil_eraser_radius", text="Eraser Radius") + sub1.itemR(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke") + + col = split.column() + sub = col.split(percentage=0.85) + + sub1 = sub.column() + sub1.itemL(text="Keyframing:") + sub1.itemR(edit, "use_visual_keying") + sub1.itemR(edit, "keyframe_insert_needed", text="Only Insert Needed") + sub1.itemS() + sub1.itemL(text="New F-Curve Defaults:") + sub1.itemR(edit, "new_interpolation_type", text="Interpolation") + sub1.itemS() + sub1.itemR(edit, "auto_keying_enable", text="Auto Keyframing:") + sub2 = sub1.column() + sub2.active = edit.auto_keying_enable + sub2.itemR(edit, "auto_keyframe_insert_keyingset", text="Only Insert for Keying Set") + sub2.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available") + + sub1.itemS() + sub1.itemS() + sub1.itemS() + + sub1.itemL(text="Transform:") + sub1.itemR(edit, "drag_immediately") + + sub1.itemS() + sub1.itemS() + sub1.itemS() + + col = split.column() + sub = col.split(percentage=0.85) + + sub1 = sub.column() + sub1.itemL(text="Duplicate Data:") + sub1.itemR(edit, "duplicate_mesh", text="Mesh") + sub1.itemR(edit, "duplicate_surface", text="Surface") + sub1.itemR(edit, "duplicate_curve", text="Curve") + sub1.itemR(edit, "duplicate_text", text="Text") + sub1.itemR(edit, "duplicate_metaball", text="Metaball") + sub1.itemR(edit, "duplicate_armature", text="Armature") + sub1.itemR(edit, "duplicate_lamp", text="Lamp") + sub1.itemR(edit, "duplicate_material", text="Material") + sub1.itemR(edit, "duplicate_texture", text="Texture") + sub1.itemR(edit, "duplicate_ipo", text="F-Curve") + sub1.itemR(edit, "duplicate_action", text="Action") + sub1.itemR(edit, "duplicate_particle", text="Particle") - col = split.column() - sub = col.split(percentage=0.85) - - sub1 = sub.column() - sub1.itemL(text="Duplicate Data:") - sub1.itemR(edit, "duplicate_mesh", text="Mesh") - sub1.itemR(edit, "duplicate_surface", text="Surface") - sub1.itemR(edit, "duplicate_curve", text="Curve") - sub1.itemR(edit, "duplicate_text", text="Text") - sub1.itemR(edit, "duplicate_metaball", text="Metaball") - sub1.itemR(edit, "duplicate_armature", text="Armature") - sub1.itemR(edit, "duplicate_lamp", text="Lamp") - sub1.itemR(edit, "duplicate_material", text="Material") - sub1.itemR(edit, "duplicate_texture", text="Texture") - sub1.itemR(edit, "duplicate_ipo", text="F-Curve") - sub1.itemR(edit, "duplicate_action", text="Action") - sub1.itemR(edit, "duplicate_particle", text="Particle") - class USERPREF_PT_system(bpy.types.Panel): - bl_space_type = 'USER_PREFERENCES' - bl_label = "System" - bl_region_type = 'WINDOW' - bl_show_header = False + bl_space_type = 'USER_PREFERENCES' + bl_label = "System" + bl_region_type = 'WINDOW' + bl_show_header = False - def poll(self, context): - userpref = context.user_preferences - return (userpref.active_section == 'SYSTEM') + def poll(self, context): + userpref = context.user_preferences + return (userpref.active_section == 'SYSTEM') - def draw(self, context): - layout = self.layout - - userpref = context.user_preferences - system = userpref.system - - split = layout.split() - - col = split.column() - sub = col.split(percentage=0.9) - - sub1 = sub.column() - sub1.itemL(text="General:") - sub1.itemR(system, "dpi") - sub1.itemR(system, "frame_server_port") - sub1.itemR(system, "scrollback", text="Console Scrollback") - sub1.itemR(system, "emulate_numpad") - sub1.itemR(system, "auto_run_python_scripts") - - sub1.itemS() - sub1.itemS() - sub1.itemS() - - sub1.itemL(text="Sound:") - sub1.row().itemR(system, "audio_device", expand=True) - sub2 = sub1.column() - sub2.active = system.audio_device != 'NONE' - sub2.itemR(system, "enable_all_codecs") - sub2.itemR(system, "game_sound") - sub2.itemR(system, "audio_channels", text="Channels") - sub2.itemR(system, "audio_mixing_buffer", text="Mixing Buffer") - sub2.itemR(system, "audio_sample_rate", text="Sample Rate") - sub2.itemR(system, "audio_sample_format", text="Sample Format") - - col = split.column() - sub = col.split(percentage=0.9) - - sub1 = sub .column() - sub1.itemL(text="Weight Colors:") - sub1.itemR(system, "use_weight_color_range", text="Use Custom Range") - sub2 = sub1.column() - sub2.active = system.use_weight_color_range - sub2.template_color_ramp(system, "weight_color_range", expand=True) - - sub1.itemS() - sub1.itemS() - sub1.itemS() - - sub1.itemR(system, "language") - sub1.itemL(text="Translate:") - sub1.itemR(system, "translate_tooltips", text="Tooltips") - sub1.itemR(system, "translate_buttons", text="Labels") - sub1.itemR(system, "translate_toolbox", text="Toolbox") - - sub1.itemS() - - sub1.itemR(system, "use_textured_fonts") - - col = split.column() - sub = col.split(percentage=0.9) - - sub1 = sub.column() + def draw(self, context): + layout = self.layout + + userpref = context.user_preferences + system = userpref.system + + split = layout.split() + + col = split.column() + sub = col.split(percentage=0.9) + + sub1 = sub.column() + sub1.itemL(text="General:") + sub1.itemR(system, "dpi") + sub1.itemR(system, "frame_server_port") + sub1.itemR(system, "scrollback", text="Console Scrollback") + sub1.itemR(system, "emulate_numpad") + sub1.itemR(system, "auto_run_python_scripts") + + sub1.itemS() + sub1.itemS() + sub1.itemS() + + sub1.itemL(text="Sound:") + sub1.row().itemR(system, "audio_device", expand=True) + sub2 = sub1.column() + sub2.active = system.audio_device != 'NONE' + sub2.itemR(system, "enable_all_codecs") + sub2.itemR(system, "game_sound") + sub2.itemR(system, "audio_channels", text="Channels") + sub2.itemR(system, "audio_mixing_buffer", text="Mixing Buffer") + sub2.itemR(system, "audio_sample_rate", text="Sample Rate") + sub2.itemR(system, "audio_sample_format", text="Sample Format") + + col = split.column() + sub = col.split(percentage=0.9) + + sub1 = sub .column() + sub1.itemL(text="Weight Colors:") + sub1.itemR(system, "use_weight_color_range", text="Use Custom Range") + sub2 = sub1.column() + sub2.active = system.use_weight_color_range + sub2.template_color_ramp(system, "weight_color_range", expand=True) + + sub1.itemS() + sub1.itemS() + sub1.itemS() + + sub1.itemR(system, "language") + sub1.itemL(text="Translate:") + sub1.itemR(system, "translate_tooltips", text="Tooltips") + sub1.itemR(system, "translate_buttons", text="Labels") + sub1.itemR(system, "translate_toolbox", text="Toolbox") + + sub1.itemS() + + sub1.itemR(system, "use_textured_fonts") + + col = split.column() + sub = col.split(percentage=0.9) + + sub1 = sub.column() + + sub1.itemL(text="OpenGL:") + sub1.itemR(system, "clip_alpha", slider=True) + sub1.itemR(system, "use_mipmaps") + sub1.itemR(system, "use_vbos") + sub1.itemL(text="Window Draw Method:") + sub1.row().itemR(system, "window_draw_method", expand=True) + sub1.itemL(text="Textures:") + sub1.itemR(system, "gl_texture_limit", text="Limit Size") + sub1.itemR(system, "texture_time_out", text="Time Out") + sub1.itemR(system, "texture_collection_rate", text="Collection Rate") + + sub1.itemS() + sub1.itemS() + sub1.itemS() + + sub1.itemL(text="Sequencer:") + sub1.itemR(system, "prefetch_frames") + sub1.itemR(system, "memory_cache_limit") - sub1.itemL(text="OpenGL:") - sub1.itemR(system, "clip_alpha", slider=True) - sub1.itemR(system, "use_mipmaps") - sub1.itemR(system, "use_vbos") - sub1.itemL(text="Window Draw Method:") - sub1.row().itemR(system, "window_draw_method", expand=True) - sub1.itemL(text="Textures:") - sub1.itemR(system, "gl_texture_limit", text="Limit Size") - sub1.itemR(system, "texture_time_out", text="Time Out") - sub1.itemR(system, "texture_collection_rate", text="Collection Rate") - - sub1.itemS() - sub1.itemS() - sub1.itemS() - - sub1.itemL(text="Sequencer:") - sub1.itemR(system, "prefetch_frames") - sub1.itemR(system, "memory_cache_limit") - class USERPREF_PT_file(bpy.types.Panel): - bl_space_type = 'USER_PREFERENCES' - bl_label = "Files" - bl_region_type = 'WINDOW' - bl_show_header = False + bl_space_type = 'USER_PREFERENCES' + bl_label = "Files" + bl_region_type = 'WINDOW' + bl_show_header = False - def poll(self, context): - userpref = context.user_preferences - return (userpref.active_section == 'FILES') + def poll(self, context): + userpref = context.user_preferences + return (userpref.active_section == 'FILES') - def draw(self, context): - layout = self.layout - - userpref = context.user_preferences - paths = userpref.filepaths - - split = layout.split(percentage=0.6) - - col = split.column() - col.itemL(text="File Paths:") - sub = col.split(percentage=0.3) - - sub.itemL(text="Fonts:") - sub.itemR(paths, "fonts_directory", text="") - sub = col.split(percentage=0.3) - sub.itemL(text="Textures:") - sub.itemR(paths, "textures_directory", text="") - sub = col.split(percentage=0.3) - sub.itemL(text="Texture Plugins:") - sub.itemR(paths, "texture_plugin_directory", text="") - sub = col.split(percentage=0.3) - sub.itemL(text="Sequence Plugins:") - sub.itemR(paths, "sequence_plugin_directory", text="") - sub = col.split(percentage=0.3) - sub.itemL(text="Render Output:") - sub.itemR(paths, "render_output_directory", text="") - sub = col.split(percentage=0.3) - sub.itemL(text="Scripts:") - sub.itemR(paths, "python_scripts_directory", text="") - sub = col.split(percentage=0.3) - sub.itemL(text="Sounds:") - sub.itemR(paths, "sounds_directory", text="") - sub = col.split(percentage=0.3) - sub.itemL(text="Temp:") - sub.itemR(paths, "temporary_directory", text="") - - col = split.column() - sub = col.split(percentage=0.2) - sub1 = sub.column() - sub2 = sub.column() - sub2.itemL(text="Save & Load:") - sub2.itemR(paths, "use_relative_paths") - sub2.itemR(paths, "compress_file") - sub2.itemR(paths, "load_ui") - sub2.itemR(paths, "filter_file_extensions") - sub2.itemR(paths, "hide_dot_files_datablocks") - sub2.itemS() - sub2.itemS() - sub2.itemL(text="Auto Save:") - sub2.itemR(paths, "save_version") - sub2.itemR(paths, "recent_files") - sub2.itemR(paths, "save_preview_images") - sub2.itemR(paths, "auto_save_temporary_files") - sub3 = sub2.column() - sub3.enabled = paths.auto_save_temporary_files - sub3.itemR(paths, "auto_save_time", text="Timer (mins)") + def draw(self, context): + layout = self.layout + + userpref = context.user_preferences + paths = userpref.filepaths + + split = layout.split(percentage=0.6) + + col = split.column() + col.itemL(text="File Paths:") + sub = col.split(percentage=0.3) + + sub.itemL(text="Fonts:") + sub.itemR(paths, "fonts_directory", text="") + sub = col.split(percentage=0.3) + sub.itemL(text="Textures:") + sub.itemR(paths, "textures_directory", text="") + sub = col.split(percentage=0.3) + sub.itemL(text="Texture Plugins:") + sub.itemR(paths, "texture_plugin_directory", text="") + sub = col.split(percentage=0.3) + sub.itemL(text="Sequence Plugins:") + sub.itemR(paths, "sequence_plugin_directory", text="") + sub = col.split(percentage=0.3) + sub.itemL(text="Render Output:") + sub.itemR(paths, "render_output_directory", text="") + sub = col.split(percentage=0.3) + sub.itemL(text="Scripts:") + sub.itemR(paths, "python_scripts_directory", text="") + sub = col.split(percentage=0.3) + sub.itemL(text="Sounds:") + sub.itemR(paths, "sounds_directory", text="") + sub = col.split(percentage=0.3) + sub.itemL(text="Temp:") + sub.itemR(paths, "temporary_directory", text="") + + col = split.column() + sub = col.split(percentage=0.2) + sub1 = sub.column() + sub2 = sub.column() + sub2.itemL(text="Save & Load:") + sub2.itemR(paths, "use_relative_paths") + sub2.itemR(paths, "compress_file") + sub2.itemR(paths, "load_ui") + sub2.itemR(paths, "filter_file_extensions") + sub2.itemR(paths, "hide_dot_files_datablocks") + sub2.itemS() + sub2.itemS() + sub2.itemL(text="Auto Save:") + sub2.itemR(paths, "save_version") + sub2.itemR(paths, "recent_files") + sub2.itemR(paths, "save_preview_images") + sub2.itemR(paths, "auto_save_temporary_files") + sub3 = sub2.column() + sub3.enabled = paths.auto_save_temporary_files + sub3.itemR(paths, "auto_save_time", text="Timer (mins)") class USERPREF_PT_input(bpy.types.Panel): - bl_space_type = 'USER_PREFERENCES' - bl_label = "Input" - bl_region_type = 'WINDOW' - bl_show_header = False + bl_space_type = 'USER_PREFERENCES' + bl_label = "Input" + bl_region_type = 'WINDOW' + bl_show_header = False - def poll(self, context): - userpref = context.user_preferences - return (userpref.active_section == 'INPUT') + def poll(self, context): + userpref = context.user_preferences + return (userpref.active_section == 'INPUT') - def draw(self, context): - layout = self.layout - - userpref = context.user_preferences - wm = context.manager - #input = userpref.input - input = userpref - inputs = userpref.inputs + def draw(self, context): + layout = self.layout - split = layout.split(percentage=0.25) + userpref = context.user_preferences + wm = context.manager + #input = userpref.input + input = userpref + inputs = userpref.inputs - # General settings - row = split.row() - col = row.column() + split = layout.split(percentage=0.25) - sub = col.column() - sub.itemL(text="Configuration:") - sub.item_pointerR(wm, "active_keyconfig", wm, "keyconfigs", text="") + # General settings + row = split.row() + col = row.column() - col.itemS() + sub = col.column() + sub.itemL(text="Configuration:") + sub.item_pointerR(wm, "active_keyconfig", wm, "keyconfigs", text="") - sub = col.column() - sub.itemL(text="Mouse:") - sub1 = sub.column() - sub1.enabled = (inputs.select_mouse == 'RIGHT') - sub1.itemR(inputs, "emulate_3_button_mouse") - sub.itemR(inputs, "continuous_mouse") + col.itemS() - sub.itemL(text="Select With:") - sub.row().itemR(inputs, "select_mouse", expand=True) - sub.itemL(text="Middle Mouse:") - sub.row().itemR(inputs, "middle_mouse", expand=True) - - sub.itemS() - sub.itemS() - sub.itemS() - - sub.itemL(text="Orbit Style:") - sub.row().itemR(inputs, "view_rotation", expand=True) - - sub.itemL(text="Zoom Style:") - sub.row().itemR(inputs, "viewport_zoom_style", expand=True) - - #sub.itemR(inputs, "use_middle_mouse_paste") + sub = col.column() + sub.itemL(text="Mouse:") + sub1 = sub.column() + sub1.enabled = (inputs.select_mouse == 'RIGHT') + sub1.itemR(inputs, "emulate_3_button_mouse") + sub.itemR(inputs, "continuous_mouse") - #col.itemS() + sub.itemL(text="Select With:") + sub.row().itemR(inputs, "select_mouse", expand=True) + sub.itemL(text="Middle Mouse:") + sub.row().itemR(inputs, "middle_mouse", expand=True) - #sub = col.column() - #sub.itemL(text="Mouse Wheel:") - #sub.itemR(view, "wheel_invert_zoom", text="Invert Zoom") - #sub.itemR(view, "wheel_scroll_lines", text="Scroll Lines") + sub.itemS() + sub.itemS() + sub.itemS() - col.itemS() + sub.itemL(text="Orbit Style:") + sub.row().itemR(inputs, "view_rotation", expand=True) - sub = col.column() - sub.itemL(text="NDOF Device:") - sub.itemR(inputs, "ndof_pan_speed", text="Pan Speed") - sub.itemR(inputs, "ndof_rotate_speed", text="Orbit Speed") + sub.itemL(text="Zoom Style:") + sub.row().itemR(inputs, "viewport_zoom_style", expand=True) - row.itemS() + #sub.itemR(inputs, "use_middle_mouse_paste") - # Keymap Settings - col = split.column() + #col.itemS() - kc = wm.active_keyconfig - defkc = wm.default_keyconfig - km = wm.active_keymap + #sub = col.column() + #sub.itemL(text="Mouse Wheel:") + #sub.itemR(view, "wheel_invert_zoom", text="Invert Zoom") + #sub.itemR(view, "wheel_scroll_lines", text="Scroll Lines") - subsplit = col.split() - subsplit.item_pointerR(wm, "active_keymap", defkc, "keymaps", text="Map:") - if km.user_defined: - row = subsplit.row() - row.itemO("WM_OT_keymap_restore", text="Restore") - row.item_booleanO("WM_OT_keymap_restore", "all", True, text="Restore All") - else: - row = subsplit.row() - row.itemO("WM_OT_keymap_edit", text="Edit") - row.itemL() + col.itemS() - col.itemS() - - for kmi in km.items: - subcol = col.column() - subcol.set_context_pointer("keyitem", kmi) + sub = col.column() + sub.itemL(text="NDOF Device:") + sub.itemR(inputs, "ndof_pan_speed", text="Pan Speed") + sub.itemR(inputs, "ndof_rotate_speed", text="Orbit Speed") - row = subcol.row() + row.itemS() - if kmi.expanded: - row.itemR(kmi, "expanded", text="", icon="ICON_TRIA_RIGHT") - else: - row.itemR(kmi, "expanded", text="", icon="ICON_TRIA_RIGHT") + # Keymap Settings + col = split.column() - itemrow = row.row() - itemrow.enabled = km.user_defined - itemrow.itemR(kmi, "active", text="", icon="ICON_CHECKBOX_DEHLT") + kc = wm.active_keyconfig + defkc = wm.default_keyconfig + km = wm.active_keymap - itemcol = itemrow.column() - itemcol.active = kmi.active - row = itemcol.row() - row.itemR(kmi, "idname", text="") + subsplit = col.split() + subsplit.item_pointerR(wm, "active_keymap", defkc, "keymaps", text="Map:") + if km.user_defined: + row = subsplit.row() + row.itemO("WM_OT_keymap_restore", text="Restore") + row.item_booleanO("WM_OT_keymap_restore", "all", True, text="Restore All") + else: + row = subsplit.row() + row.itemO("WM_OT_keymap_edit", text="Edit") + row.itemL() - sub = row.row() - sub.scale_x = 0.6 - sub.itemR(kmi, "map_type", text="") + col.itemS() - sub = row.row(align=True) - if kmi.map_type == 'KEYBOARD': - sub.itemR(kmi, "type", text="", full_event=True) - elif kmi.map_type == 'MOUSE': - sub.itemR(kmi, "type", text="", full_event=True) - elif kmi.map_type == 'TWEAK': - sub.scale_x = 0.5 - sub.itemR(kmi, "type", text="") - sub.itemR(kmi, "value", text="") - elif kmi.map_type == 'TIMER': - sub.itemR(kmi, "type", text="") - else: - sub.itemL() + for kmi in km.items: + subcol = col.column() + subcol.set_context_pointer("keyitem", kmi) - if kmi.expanded: - if kmi.map_type not in ('TEXTINPUT', 'TIMER'): - sub = itemcol.row(align=True) + row = subcol.row() - if kmi.map_type == 'KEYBOARD': - sub.itemR(kmi, "type", text="", event=True) - sub.itemR(kmi, "value", text="") - elif kmi.map_type == 'MOUSE': - sub.itemR(kmi, "type", text="") - sub.itemR(kmi, "value", text="") - else: - sub.itemL() - sub.itemL() + if kmi.expanded: + row.itemR(kmi, "expanded", text="", icon="ICON_TRIA_RIGHT") + else: + row.itemR(kmi, "expanded", text="", icon="ICON_TRIA_RIGHT") - subrow = sub.row() - subrow.scale_x = 0.75 - subrow.itemR(kmi, "shift") - subrow.itemR(kmi, "ctrl") - subrow.itemR(kmi, "alt") - subrow.itemR(kmi, "oskey", text="Cmd") - sub.itemR(kmi, "key_modifier", text="", event=True) + itemrow = row.row() + itemrow.enabled = km.user_defined + itemrow.itemR(kmi, "active", text="", icon="ICON_CHECKBOX_DEHLT") - flow = itemcol.column_flow(columns=2) - props = kmi.properties + itemcol = itemrow.column() + itemcol.active = kmi.active + row = itemcol.row() + row.itemR(kmi, "idname", text="") - if props != None: - for pname in dir(props): - if not props.is_property_hidden(pname): - flow.itemR(props, pname) + sub = row.row() + sub.scale_x = 0.6 + sub.itemR(kmi, "map_type", text="") - itemcol.itemS() + sub = row.row(align=True) + if kmi.map_type == 'KEYBOARD': + sub.itemR(kmi, "type", text="", full_event=True) + elif kmi.map_type == 'MOUSE': + sub.itemR(kmi, "type", text="", full_event=True) + elif kmi.map_type == 'TWEAK': + sub.scale_x = 0.5 + sub.itemR(kmi, "type", text="") + sub.itemR(kmi, "value", text="") + elif kmi.map_type == 'TIMER': + sub.itemR(kmi, "type", text="") + else: + sub.itemL() - itemrow.itemO("wm.keyitem_remove", text="", icon="ICON_ZOOMOUT") + if kmi.expanded: + if kmi.map_type not in ('TEXTINPUT', 'TIMER'): + sub = itemcol.row(align=True) - itemrow = col.row() - itemrow.itemL() - itemrow.itemO("wm.keyitem_add", text="", icon="ICON_ZOOMIN") - itemrow.enabled = km.user_defined + if kmi.map_type == 'KEYBOARD': + sub.itemR(kmi, "type", text="", event=True) + sub.itemR(kmi, "value", text="") + elif kmi.map_type == 'MOUSE': + sub.itemR(kmi, "type", text="") + sub.itemR(kmi, "value", text="") + else: + sub.itemL() + sub.itemL() + + subrow = sub.row() + subrow.scale_x = 0.75 + subrow.itemR(kmi, "shift") + subrow.itemR(kmi, "ctrl") + subrow.itemR(kmi, "alt") + subrow.itemR(kmi, "oskey", text="Cmd") + sub.itemR(kmi, "key_modifier", text="", event=True) + + flow = itemcol.column_flow(columns=2) + props = kmi.properties + + if props != None: + for pname in dir(props): + if not props.is_property_hidden(pname): + flow.itemR(props, pname) + + itemcol.itemS() + + itemrow.itemO("wm.keyitem_remove", text="", icon="ICON_ZOOMOUT") + + itemrow = col.row() + itemrow.itemL() + itemrow.itemO("wm.keyitem_add", text="", icon="ICON_ZOOMIN") + itemrow.enabled = km.user_defined bpy.types.register(USERPREF_HT_header) bpy.types.register(USERPREF_MT_view) @@ -565,145 +565,145 @@ from bpy.props import * class WM_OT_keyconfig_export(bpy.types.Operator): - "Export key configuration to a python script." - bl_idname = "wm.keyconfig_export" - bl_label = "Export Key Configuration..." - - path = bpy.props.StringProperty(name="File Path", description="File path to write file to.") + "Export key configuration to a python script." + bl_idname = "wm.keyconfig_export" + bl_label = "Export Key Configuration..." - def _string_value(self, value): - result = "" - if isinstance(value, str): - if value != "": - result = "\'%s\'" % value - elif isinstance(value, bool): - if value: - result = "True" - else: - result = "False" - elif isinstance(value, float): - result = "%.10f" % value - elif isinstance(value, int): - result = "%d" % value - elif getattr(value, '__len__', False): - if len(value): - result = "[" - for i in range(0, len(value)): - result += self._string_value(value[i]) - if i != len(value)-1: - result += ", " - result += "]" - else: - print("Export key configuration: can't write ", value) + path = bpy.props.StringProperty(name="File Path", description="File path to write file to.") - return result + def _string_value(self, value): + result = "" + if isinstance(value, str): + if value != "": + result = "\'%s\'" % value + elif isinstance(value, bool): + if value: + result = "True" + else: + result = "False" + elif isinstance(value, float): + result = "%.10f" % value + elif isinstance(value, int): + result = "%d" % value + elif getattr(value, '__len__', False): + if len(value): + result = "[" + for i in range(0, len(value)): + result += self._string_value(value[i]) + if i != len(value)-1: + result += ", " + result += "]" + else: + print("Export key configuration: can't write ", value) - def execute(self, context): - if not self.path: - raise Exception("File path not set.") + return result - f = open(self.path, "w") - if not f: - raise Exception("Could not open file.") + def execute(self, context): + if not self.path: + raise Exception("File path not set.") - wm = context.manager - kc = wm.active_keyconfig + f = open(self.path, "w") + if not f: + raise Exception("Could not open file.") - f.write('# Configuration %s\n' % kc.name) + wm = context.manager + kc = wm.active_keyconfig - f.write("wm = bpy.data.windowmanagers[0]\n"); - f.write("kc = wm.add_keyconfig(\'%s\')\n\n" % kc.name) + f.write('# Configuration %s\n' % kc.name) - for km in kc.keymaps: - f.write("# Map %s\n" % km.name) - f.write("km = kc.add_keymap(\'%s\', space_type=\'%s\', region_type=\'%s\')\n\n" % (km.name, km.space_type, km.region_type)) - for kmi in km.items: - f.write("kmi = km.add_item(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)) - if kmi.shift: - f.write(", shift=True") - if kmi.ctrl: - f.write(", ctrl=True") - if kmi.alt: - f.write(", alt=True") - if kmi.oskey: - f.write(", oskey=True") - if kmi.key_modifier and kmi.key_modifier != 'NONE': - f.write(", key_modifier=\'%s\'" % kmi.key_modifier) - f.write(")\n") + f.write("wm = bpy.data.windowmanagers[0]\n"); + f.write("kc = wm.add_keyconfig(\'%s\')\n\n" % kc.name) - props = kmi.properties + for km in kc.keymaps: + f.write("# Map %s\n" % km.name) + f.write("km = kc.add_keymap(\'%s\', space_type=\'%s\', region_type=\'%s\')\n\n" % (km.name, km.space_type, km.region_type)) + for kmi in km.items: + f.write("kmi = km.add_item(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)) + if kmi.shift: + f.write(", shift=True") + if kmi.ctrl: + f.write(", ctrl=True") + if kmi.alt: + f.write(", alt=True") + if kmi.oskey: + f.write(", oskey=True") + if kmi.key_modifier and kmi.key_modifier != 'NONE': + f.write(", key_modifier=\'%s\'" % kmi.key_modifier) + f.write(")\n") - if props != None: - for pname in dir(props): - if props.is_property_set(pname) and not props.is_property_hidden(pname): - value = eval("props.%s" % pname) - value = self._string_value(value) - if value != "": - f.write("kmi.properties.%s = %s\n" % (pname, value)) + props = kmi.properties - f.write("\n") + if props != None: + for pname in dir(props): + if props.is_property_set(pname) and not props.is_property_hidden(pname): + value = eval("props.%s" % pname) + value = self._string_value(value) + if value != "": + f.write("kmi.properties.%s = %s\n" % (pname, value)) - f.close() + f.write("\n") - return ('FINISHED',) + f.close() - def invoke(self, context, event): - wm = context.manager - wm.add_fileselect(self.__operator__) - return ('RUNNING_MODAL',) + return ('FINISHED',) + + def invoke(self, context, event): + wm = context.manager + wm.add_fileselect(self.__operator__) + return ('RUNNING_MODAL',) class WM_OT_keymap_edit(bpy.types.Operator): - "Edit key map." - bl_idname = "wm.keymap_edit" - bl_label = "Edit Key Map" + "Edit key map." + bl_idname = "wm.keymap_edit" + bl_label = "Edit Key Map" - def execute(self, context): - wm = context.manager - km = wm.active_keymap - km.copy_to_user() - return ('FINISHED',) + def execute(self, context): + wm = context.manager + km = wm.active_keymap + km.copy_to_user() + return ('FINISHED',) class WM_OT_keymap_restore(bpy.types.Operator): - "Restore key map" - bl_idname = "wm.keymap_restore" - bl_label = "Restore Key Map" - - all = BoolProperty(attr="all", name="All Keymaps", description="Restore all keymaps to default.") + "Restore key map" + bl_idname = "wm.keymap_restore" + bl_label = "Restore Key Map" - def execute(self, context): - wm = context.manager + all = BoolProperty(attr="all", name="All Keymaps", description="Restore all keymaps to default.") - if self.all: - for km in wm.default_keyconfig.keymaps: - km.restore_to_default() - else: - km = wm.active_keymap - km.restore_to_default() + def execute(self, context): + wm = context.manager + + if self.all: + for km in wm.default_keyconfig.keymaps: + km.restore_to_default() + else: + km = wm.active_keymap + km.restore_to_default() + + return ('FINISHED',) - return ('FINISHED',) - class WM_OT_keyitem_add(bpy.types.Operator): - "Add key map item." - bl_idname = "wm.keyitem_add" - bl_label = "Add Key Map Item" + "Add key map item." + bl_idname = "wm.keyitem_add" + bl_label = "Add Key Map Item" + + def execute(self, context): + wm = context.manager + km = wm.active_keymap + kmi = km.add_item("", "A", "PRESS") + return ('FINISHED',) - def execute(self, context): - wm = context.manager - km = wm.active_keymap - kmi = km.add_item("", "A", "PRESS") - return ('FINISHED',) - class WM_OT_keyitem_remove(bpy.types.Operator): - "Remove key map item." - bl_idname = "wm.keyitem_remove" - bl_label = "Remove Key Map Item" + "Remove key map item." + bl_idname = "wm.keyitem_remove" + bl_label = "Remove Key Map Item" - def execute(self, context): - wm = context.manager - kmi = context.keyitem - km = wm.active_keymap - km.remove_item(kmi) - return ('FINISHED',) + def execute(self, context): + wm = context.manager + kmi = context.keyitem + km = wm.active_keymap + km.remove_item(kmi) + return ('FINISHED',) bpy.ops.add(WM_OT_keyconfig_export) bpy.ops.add(WM_OT_keymap_edit) diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index d0f60c98a1c..5eefc1b5950 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -6,1272 +6,1272 @@ import dynamic_menu # ********** Header ********** class VIEW3D_HT_header(bpy.types.Header): - bl_space_type = 'VIEW_3D' + bl_space_type = 'VIEW_3D' - def draw(self, context): - layout = self.layout - - view = context.space_data - mode_string = context.mode - edit_object = context.edit_object - object = context.active_object - - row = layout.row(align=True) - row.template_header() + def draw(self, context): + layout = self.layout - # Menus - if context.area.show_menus: - sub = row.row(align=True) + view = context.space_data + mode_string = context.mode + edit_object = context.edit_object + object = context.active_object - sub.itemM("VIEW3D_MT_view") - - # Select Menu - if mode_string not in ('EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'): - sub.itemM("VIEW3D_MT_select_%s" % mode_string.lower()) - - if edit_object: - sub.itemM("VIEW3D_MT_edit_%s" % edit_object.type.lower()) - elif object: - ob_mode_string = object.mode - - if mode_string not in ['PAINT_WEIGHT', 'PAINT_TEXTURE']: - sub.itemM("VIEW3D_MT_%s" % mode_string.lower()) - else: - sub.itemM("VIEW3D_MT_object") + row = layout.row(align=True) + row.template_header() - layout.template_header_3D() + # Menus + if context.area.show_menus: + sub = row.row(align=True) + + sub.itemM("VIEW3D_MT_view") + + # Select Menu + if mode_string not in ('EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'): + sub.itemM("VIEW3D_MT_select_%s" % mode_string.lower()) + + if edit_object: + sub.itemM("VIEW3D_MT_edit_%s" % edit_object.type.lower()) + elif object: + ob_mode_string = object.mode + + if mode_string not in ['PAINT_WEIGHT', 'PAINT_TEXTURE']: + sub.itemM("VIEW3D_MT_%s" % mode_string.lower()) + else: + sub.itemM("VIEW3D_MT_object") + + layout.template_header_3D() # ********** Menu ********** # ********** Utilities ********** class VIEW3D_MT_showhide(bpy.types.Menu): - bl_label = "Show/Hide" - _operator_name = "" + bl_label = "Show/Hide" + _operator_name = "" - def draw(self, context): - layout = self.layout - - layout.itemO("%s.reveal" % self._operator_name, text="Show Hidden") - layout.itemO("%s.hide" % self._operator_name, text="Hide Selected") - layout.item_booleanO("%s.hide" % self._operator_name, "unselected", True, text="Hide Unselected") + def draw(self, context): + layout = self.layout + + layout.itemO("%s.reveal" % self._operator_name, text="Show Hidden") + layout.itemO("%s.hide" % self._operator_name, text="Hide Selected") + layout.item_booleanO("%s.hide" % self._operator_name, "unselected", True, text="Hide Unselected") class VIEW3D_MT_snap(bpy.types.Menu): - bl_label = "Snap" + bl_label = "Snap" - def draw(self, context): - layout = self.layout - - layout.itemO("view3d.snap_selected_to_grid", text="Selection to Grid") - layout.itemO("view3d.snap_selected_to_cursor", text="Selection to Cursor") - layout.itemO("view3d.snap_selected_to_center", text="Selection to Center") - - layout.itemS() - - layout.itemO("view3d.snap_cursor_to_selected", text="Cursor to Selected") - layout.itemO("view3d.snap_cursor_to_grid", text="Cursor to Grid") - layout.itemO("view3d.snap_cursor_to_active", text="Cursor to Active") + def draw(self, context): + layout = self.layout + + layout.itemO("view3d.snap_selected_to_grid", text="Selection to Grid") + layout.itemO("view3d.snap_selected_to_cursor", text="Selection to Cursor") + layout.itemO("view3d.snap_selected_to_center", text="Selection to Center") + + layout.itemS() + + layout.itemO("view3d.snap_cursor_to_selected", text="Cursor to Selected") + layout.itemO("view3d.snap_cursor_to_grid", text="Cursor to Grid") + layout.itemO("view3d.snap_cursor_to_active", text="Cursor to Active") # ********** View menus ********** class VIEW3D_MT_view(bpy.types.Menu): - bl_label = "View" + bl_label = "View" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.properties", icon='ICON_MENU_PANEL') - layout.itemO("view3d.toolbar", icon='ICON_MENU_PANEL') - - layout.itemS() - - layout.item_enumO("view3d.viewnumpad", "type", 'CAMERA') - layout.item_enumO("view3d.viewnumpad", "type", 'TOP') - layout.item_enumO("view3d.viewnumpad", "type", 'FRONT') - layout.item_enumO("view3d.viewnumpad", "type", 'RIGHT') - - layout.itemM("VIEW3D_MT_view_cameras", text="Cameras") - - layout.itemS() - - layout.itemO("view3d.view_persportho") - - layout.itemS() - - layout.itemM("VIEW3D_MT_view_navigation") - layout.itemM("VIEW3D_MT_view_align") - - layout.itemS() + layout.itemO("view3d.properties", icon='ICON_MENU_PANEL') + layout.itemO("view3d.toolbar", icon='ICON_MENU_PANEL') - layout.operator_context = "INVOKE_REGION_WIN" - - layout.itemO("view3d.clip_border", text="Clipping Border...") - layout.itemO("view3d.zoom_border", text="Zoom Border...") - - layout.itemS() + layout.itemS() - layout.item_intO("view3d.layers", "nr", 0, text="Show All Layers") + layout.item_enumO("view3d.viewnumpad", "type", 'CAMERA') + layout.item_enumO("view3d.viewnumpad", "type", 'TOP') + layout.item_enumO("view3d.viewnumpad", "type", 'FRONT') + layout.item_enumO("view3d.viewnumpad", "type", 'RIGHT') - layout.itemS() - - layout.itemO("view3d.localview", text="View Global/Local") - layout.itemO("view3d.view_center") - layout.itemO("view3d.view_all") - - layout.itemS() - - layout.itemO("screen.region_foursplit", text="Toggle Quad View") - layout.itemO("screen.screen_full_area", text="Toggle Full Screen") - - layout.itemS() - - layout.itemO("screen.animation_play", text="Playback Animation", icon='ICON_PLAY') + layout.itemM("VIEW3D_MT_view_cameras", text="Cameras") + + layout.itemS() + + layout.itemO("view3d.view_persportho") + + layout.itemS() + + layout.itemM("VIEW3D_MT_view_navigation") + layout.itemM("VIEW3D_MT_view_align") + + layout.itemS() + + layout.operator_context = "INVOKE_REGION_WIN" + + layout.itemO("view3d.clip_border", text="Clipping Border...") + layout.itemO("view3d.zoom_border", text="Zoom Border...") + + layout.itemS() + + layout.item_intO("view3d.layers", "nr", 0, text="Show All Layers") + + layout.itemS() + + layout.itemO("view3d.localview", text="View Global/Local") + layout.itemO("view3d.view_center") + layout.itemO("view3d.view_all") + + layout.itemS() + + layout.itemO("screen.region_foursplit", text="Toggle Quad View") + layout.itemO("screen.screen_full_area", text="Toggle Full Screen") + + layout.itemS() + + layout.itemO("screen.animation_play", text="Playback Animation", icon='ICON_PLAY') class VIEW3D_MT_view_navigation(bpy.types.Menu): - bl_label = "Navigation" + bl_label = "Navigation" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.items_enumO("view3d.view_orbit", "type") - - layout.itemS() - - layout.items_enumO("view3d.view_pan", "type") - - layout.itemS() - - layout.item_floatO("view3d.zoom", "delta", 1.0, text="Zoom In") - layout.item_floatO("view3d.zoom", "delta", -1.0, text="Zoom Out") - - layout.itemS() - - layout.itemO("view3d.fly") + layout.items_enumO("view3d.view_orbit", "type") + + layout.itemS() + + layout.items_enumO("view3d.view_pan", "type") + + layout.itemS() + + layout.item_floatO("view3d.zoom", "delta", 1.0, text="Zoom In") + layout.item_floatO("view3d.zoom", "delta", -1.0, text="Zoom Out") + + layout.itemS() + + layout.itemO("view3d.fly") class VIEW3D_MT_view_align(bpy.types.Menu): - bl_label = "Align View" + bl_label = "Align View" + + def draw(self, context): + layout = self.layout + + layout.item_booleanO("view3d.view_all", "center", True, text="Center Cursor and View All") + layout.itemO("view3d.camera_to_view", text="Align Active Camera to View") + layout.itemO("view3d.view_center") - def draw(self, context): - layout = self.layout - - layout.item_booleanO("view3d.view_all", "center", True, text="Center Cursor and View All") - layout.itemO("view3d.camera_to_view", text="Align Active Camera to View") - layout.itemO("view3d.view_center") - class VIEW3D_MT_view_cameras(bpy.types.Menu): - bl_label = "Cameras" + bl_label = "Cameras" - def draw(self, context): - layout = self.layout - - layout.itemO("view3d.object_as_camera") - layout.item_enumO("view3d.viewnumpad", "type", 'CAMERA', text="Active Camera") + def draw(self, context): + layout = self.layout + + layout.itemO("view3d.object_as_camera") + layout.item_enumO("view3d.viewnumpad", "type", 'CAMERA', text="Active Camera") # ********** Select menus, suffix from context.mode ********** class VIEW3D_MT_select_object(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border") + layout.itemO("view3d.select_border") - layout.itemS() + layout.itemS() - layout.itemO("object.select_all_toggle", text="Select/Deselect All") - layout.itemO("object.select_inverse", text="Inverse") - layout.itemO("object.select_random", text="Random") - layout.itemO("object.select_mirror", text="Mirror") - layout.itemO("object.select_by_layer", text="Select All by Layer") - layout.item_menu_enumO("object.select_by_type", "type", "", text="Select All by Type...") - layout.item_menu_enumO("object.select_grouped", "type", text="Select Grouped...") - layout.itemO("object.select_pattern", text="Select Pattern...") + layout.itemO("object.select_all_toggle", text="Select/Deselect All") + layout.itemO("object.select_inverse", text="Inverse") + layout.itemO("object.select_random", text="Random") + layout.itemO("object.select_mirror", text="Mirror") + layout.itemO("object.select_by_layer", text="Select All by Layer") + layout.item_menu_enumO("object.select_by_type", "type", "", text="Select All by Type...") + layout.item_menu_enumO("object.select_grouped", "type", text="Select Grouped...") + layout.itemO("object.select_pattern", text="Select Pattern...") class VIEW3D_MT_select_pose(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border", text="Border Select...") + layout.itemO("view3d.select_border", text="Border Select...") - layout.itemS() - - layout.itemO("pose.select_all_toggle", text="Select/Deselect All") - layout.itemO("pose.select_inverse", text="Inverse") - layout.itemO("pose.select_constraint_target", text="Constraint Target") - layout.itemO("pose.select_linked", text="Linked") - - layout.itemS() - - layout.item_enumO("pose.select_hierarchy", "direction", 'PARENT') - layout.item_enumO("pose.select_hierarchy", "direction", 'CHILD') - - layout.itemS() - - props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Parent") - props.extend = True - props.direction = 'PARENT' + layout.itemS() - props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Child") - props.extend = True - props.direction = 'CHILD' + layout.itemO("pose.select_all_toggle", text="Select/Deselect All") + layout.itemO("pose.select_inverse", text="Inverse") + layout.itemO("pose.select_constraint_target", text="Constraint Target") + layout.itemO("pose.select_linked", text="Linked") + + layout.itemS() + + layout.item_enumO("pose.select_hierarchy", "direction", 'PARENT') + layout.item_enumO("pose.select_hierarchy", "direction", 'CHILD') + + layout.itemS() + + props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Parent") + props.extend = True + props.direction = 'PARENT' + + props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Child") + props.extend = True + props.direction = 'CHILD' class VIEW3D_MT_select_particle(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border") + layout.itemO("view3d.select_border") - layout.itemS() - - layout.itemO("particle.select_all_toggle", text="Select/Deselect All") - layout.itemO("particle.select_linked") - - layout.itemS() - - layout.itemO("particle.select_more") - layout.itemO("particle.select_less") + layout.itemS() + + layout.itemO("particle.select_all_toggle", text="Select/Deselect All") + layout.itemO("particle.select_linked") + + layout.itemS() + + layout.itemO("particle.select_more") + layout.itemO("particle.select_less") class VIEW3D_MT_select_edit_mesh(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border", text="Border Select...") + layout.itemO("view3d.select_border", text="Border Select...") - layout.itemS() + layout.itemS() - layout.itemO("mesh.select_all_toggle", text="Select/Deselect All") - layout.itemO("mesh.select_inverse", text="Inverse") + layout.itemO("mesh.select_all_toggle", text="Select/Deselect All") + layout.itemO("mesh.select_inverse", text="Inverse") - layout.itemS() + layout.itemS() - layout.itemO("mesh.select_random", text="Random...") - layout.itemO("mesh.edges_select_sharp", text="Sharp Edges") - layout.itemO("mesh.faces_select_linked_flat", text="Linked Flat Faces") + layout.itemO("mesh.select_random", text="Random...") + layout.itemO("mesh.edges_select_sharp", text="Sharp Edges") + layout.itemO("mesh.faces_select_linked_flat", text="Linked Flat Faces") - layout.itemS() + layout.itemS() - layout.item_enumO("mesh.select_by_number_vertices", "type", 'TRIANGLES', text="Triangles") - layout.item_enumO("mesh.select_by_number_vertices", "type", 'QUADS', text="Quads") - layout.item_enumO("mesh.select_by_number_vertices", "type", 'OTHER', text="Loose Verts/Edges") - layout.itemO("mesh.select_similar", text="Similar...") + layout.item_enumO("mesh.select_by_number_vertices", "type", 'TRIANGLES', text="Triangles") + layout.item_enumO("mesh.select_by_number_vertices", "type", 'QUADS', text="Quads") + layout.item_enumO("mesh.select_by_number_vertices", "type", 'OTHER', text="Loose Verts/Edges") + layout.itemO("mesh.select_similar", text="Similar...") - layout.itemS() + layout.itemS() - layout.itemO("mesh.select_less", text="Less") - layout.itemO("mesh.select_more", text="More") + layout.itemO("mesh.select_less", text="Less") + layout.itemO("mesh.select_more", text="More") - layout.itemS() - - layout.itemO("mesh.select_mirror", text="Mirror") + layout.itemS() - layout.itemO("mesh.select_linked", text="Linked") - layout.itemO("mesh.select_vertex_path", text="Vertex Path") - layout.itemO("mesh.loop_multi_select", text="Edge Loop") - layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring") + layout.itemO("mesh.select_mirror", text="Mirror") - layout.itemS() + layout.itemO("mesh.select_linked", text="Linked") + layout.itemO("mesh.select_vertex_path", text="Vertex Path") + layout.itemO("mesh.loop_multi_select", text="Edge Loop") + layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring") - layout.itemO("mesh.loop_to_region") - layout.itemO("mesh.region_to_loop") + layout.itemS() + + layout.itemO("mesh.loop_to_region") + layout.itemO("mesh.region_to_loop") class VIEW3D_MT_select_edit_curve(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border", text="Border Select...") - layout.itemO("view3d.select_circle", text="Circle Select...") + layout.itemO("view3d.select_border", text="Border Select...") + layout.itemO("view3d.select_circle", text="Circle Select...") - layout.itemS() - - layout.itemO("curve.select_all_toggle", text="Select/Deselect All") - layout.itemO("curve.select_inverse") - layout.itemO("curve.select_random") - layout.itemO("curve.select_every_nth") + layout.itemS() - layout.itemS() - - layout.itemO("curve.de_select_first") - layout.itemO("curve.de_select_last") - layout.itemO("curve.select_next") - layout.itemO("curve.select_previous") + layout.itemO("curve.select_all_toggle", text="Select/Deselect All") + layout.itemO("curve.select_inverse") + layout.itemO("curve.select_random") + layout.itemO("curve.select_every_nth") - layout.itemS() - - layout.itemO("curve.select_more") - layout.itemO("curve.select_less") + layout.itemS() + + layout.itemO("curve.de_select_first") + layout.itemO("curve.de_select_last") + layout.itemO("curve.select_next") + layout.itemO("curve.select_previous") + + layout.itemS() + + layout.itemO("curve.select_more") + layout.itemO("curve.select_less") class VIEW3D_MT_select_edit_surface(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border", text="Border Select...") - layout.itemO("view3d.select_circle", text="Circle Select...") + layout.itemO("view3d.select_border", text="Border Select...") + layout.itemO("view3d.select_circle", text="Circle Select...") - layout.itemS() - - layout.itemO("curve.select_all_toggle", text="Select/Deselect All") - layout.itemO("curve.select_inverse") - layout.itemO("curve.select_random") - layout.itemO("curve.select_every_nth") + layout.itemS() - layout.itemS() - - layout.itemO("curve.select_row") + layout.itemO("curve.select_all_toggle", text="Select/Deselect All") + layout.itemO("curve.select_inverse") + layout.itemO("curve.select_random") + layout.itemO("curve.select_every_nth") - layout.itemS() - - layout.itemO("curve.select_more") - layout.itemO("curve.select_less") + layout.itemS() + + layout.itemO("curve.select_row") + + layout.itemS() + + layout.itemO("curve.select_more") + layout.itemO("curve.select_less") class VIEW3D_MT_select_edit_metaball(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border") - - layout.itemS() - - layout.itemO("mball.select_deselect_all_metaelems") - layout.itemO("mball.select_inverse_metaelems") - - layout.itemS() - - layout.itemO("mball.select_random_metaelems") + layout.itemO("view3d.select_border") + + layout.itemS() + + layout.itemO("mball.select_deselect_all_metaelems") + layout.itemO("mball.select_inverse_metaelems") + + layout.itemS() + + layout.itemO("mball.select_random_metaelems") class VIEW3D_MT_select_edit_lattice(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border") + layout.itemO("view3d.select_border") - layout.itemS() - - layout.itemO("lattice.select_all_toggle", text="Select/Deselect All") + layout.itemS() + + layout.itemO("lattice.select_all_toggle", text="Select/Deselect All") class VIEW3D_MT_select_edit_armature(bpy.types.Menu): - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("view3d.select_border", text="Border Select...") + layout.itemO("view3d.select_border", text="Border Select...") - layout.itemS() - - layout.itemO("armature.select_all_toggle", text="Select/Deselect All") - layout.itemO("armature.select_inverse", text="Inverse") + layout.itemS() - layout.itemS() - - layout.item_enumO("armature.select_hierarchy", "direction", 'PARENT', text="Parent") - layout.item_enumO("armature.select_hierarchy", "direction", 'CHILD', text="Child") - - layout.itemS() - - props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Parent") - props.extend = True - props.direction = 'PARENT' + layout.itemO("armature.select_all_toggle", text="Select/Deselect All") + layout.itemO("armature.select_inverse", text="Inverse") - props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Child") - props.extend = True - props.direction = 'CHILD' + layout.itemS() + + layout.item_enumO("armature.select_hierarchy", "direction", 'PARENT', text="Parent") + layout.item_enumO("armature.select_hierarchy", "direction", 'CHILD', text="Child") + + layout.itemS() + + props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Parent") + props.extend = True + props.direction = 'PARENT' + + props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Child") + props.extend = True + props.direction = 'CHILD' class VIEW3D_MT_select_face(bpy.types.Menu):# XXX no matching enum - bl_label = "Select" + bl_label = "Select" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.view3d_select_faceselmenu() + layout.view3d_select_faceselmenu() # ********** Object menu ********** class VIEW3D_MT_object(bpy.types.Menu): - bl_context = "objectmode" - bl_label = "Object" + bl_context = "objectmode" + bl_label = "Object" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout + + layout.itemM("VIEW3D_MT_object_clear") + layout.itemM("VIEW3D_MT_object_apply") + layout.itemM("VIEW3D_MT_snap") + + layout.itemS() + + layout.itemO("anim.insert_keyframe_menu", text="Insert Keyframe...") + layout.itemO("anim.delete_keyframe_v3d", text="Delete Keyframe...") + + layout.itemS() + + layout.itemO("object.duplicate_move") + layout.item_booleanO("object.duplicate", "linked", True, text="Duplicate Linked") + layout.itemO("object.delete", text="Delete...") + layout.itemO("object.proxy_make", text="Make Proxy...") + layout.item_menu_enumO("object.make_local", "type", text="Make Local...") + layout.itemM("VIEW3D_MT_make_single_user") + + layout.itemS() + + layout.itemM("VIEW3D_MT_object_parent") + layout.itemM("VIEW3D_MT_object_track") + layout.itemM("VIEW3D_MT_object_group") + layout.itemM("VIEW3D_MT_object_constraints") + + layout.itemS() + + layout.itemO("object.join") + + layout.itemS() + + layout.itemO("object.move_to_layer", text="Move to Layer...") + layout.itemM("VIEW3D_MT_object_showhide") + + layout.item_menu_enumO("object.convert", "target") - layout.itemM("VIEW3D_MT_object_clear") - layout.itemM("VIEW3D_MT_object_apply") - layout.itemM("VIEW3D_MT_snap") - - layout.itemS() - - layout.itemO("anim.insert_keyframe_menu", text="Insert Keyframe...") - layout.itemO("anim.delete_keyframe_v3d", text="Delete Keyframe...") - - layout.itemS() - - layout.itemO("object.duplicate_move") - layout.item_booleanO("object.duplicate", "linked", True, text="Duplicate Linked") - layout.itemO("object.delete", text="Delete...") - layout.itemO("object.proxy_make", text="Make Proxy...") - layout.item_menu_enumO("object.make_local", "type", text="Make Local...") - layout.itemM("VIEW3D_MT_make_single_user") - - layout.itemS() - - layout.itemM("VIEW3D_MT_object_parent") - layout.itemM("VIEW3D_MT_object_track") - layout.itemM("VIEW3D_MT_object_group") - layout.itemM("VIEW3D_MT_object_constraints") - - layout.itemS() - - layout.itemO("object.join") - - layout.itemS() - - layout.itemO("object.move_to_layer", text="Move to Layer...") - layout.itemM("VIEW3D_MT_object_showhide") - - layout.item_menu_enumO("object.convert", "target") - class VIEW3D_MT_object_clear(bpy.types.Menu): - bl_label = "Clear" + bl_label = "Clear" + + def draw(self, context): + layout = self.layout + + layout.itemO("object.location_clear", text="Location") + layout.itemO("object.rotation_clear", text="Rotation") + layout.itemO("object.scale_clear", text="Scale") + layout.itemO("object.origin_clear", text="Origin") - def draw(self, context): - layout = self.layout - - layout.itemO("object.location_clear", text="Location") - layout.itemO("object.rotation_clear", text="Rotation") - layout.itemO("object.scale_clear", text="Scale") - layout.itemO("object.origin_clear", text="Origin") - class VIEW3D_MT_object_apply(bpy.types.Menu): - bl_label = "Apply" + bl_label = "Apply" + + def draw(self, context): + layout = self.layout + + layout.itemO("object.location_apply", text="Location") + layout.itemO("object.rotation_apply", text="Rotation") + layout.itemO("object.scale_apply", text="Scale") + layout.itemS() + layout.itemO("object.visual_transform_apply", text="Visual Transform") + layout.itemO("object.duplicates_make_real") - def draw(self, context): - layout = self.layout - - layout.itemO("object.location_apply", text="Location") - layout.itemO("object.rotation_apply", text="Rotation") - layout.itemO("object.scale_apply", text="Scale") - layout.itemS() - layout.itemO("object.visual_transform_apply", text="Visual Transform") - layout.itemO("object.duplicates_make_real") - class VIEW3D_MT_object_parent(bpy.types.Menu): - bl_label = "Parent" + bl_label = "Parent" + + def draw(self, context): + layout = self.layout + + layout.itemO("object.parent_set", text="Set") + layout.itemO("object.parent_clear", text="Clear") - def draw(self, context): - layout = self.layout - - layout.itemO("object.parent_set", text="Set") - layout.itemO("object.parent_clear", text="Clear") - class VIEW3D_MT_object_track(bpy.types.Menu): - bl_label = "Track" + bl_label = "Track" + + def draw(self, context): + layout = self.layout + + layout.itemO("object.track_set", text="Set") + layout.itemO("object.track_clear", text="Clear") - def draw(self, context): - layout = self.layout - - layout.itemO("object.track_set", text="Set") - layout.itemO("object.track_clear", text="Clear") - class VIEW3D_MT_object_group(bpy.types.Menu): - bl_label = "Group" + bl_label = "Group" + + def draw(self, context): + layout = self.layout + + layout.itemO("group.group_create") + layout.itemO("group.objects_remove") + + layout.itemS() + + layout.itemO("group.objects_add_active") + layout.itemO("group.objects_remove_active") - def draw(self, context): - layout = self.layout - - layout.itemO("group.group_create") - layout.itemO("group.objects_remove") - - layout.itemS() - - layout.itemO("group.objects_add_active") - layout.itemO("group.objects_remove_active") - class VIEW3D_MT_object_constraints(bpy.types.Menu): - bl_label = "Constraints" + bl_label = "Constraints" + + def draw(self, context): + layout = self.layout + + layout.itemO("object.constraint_add_with_targets") + layout.itemO("object.constraints_clear") - def draw(self, context): - layout = self.layout - - layout.itemO("object.constraint_add_with_targets") - layout.itemO("object.constraints_clear") - class VIEW3D_MT_object_showhide(bpy.types.Menu): - bl_label = "Show/Hide" + bl_label = "Show/Hide" - def draw(self, context): - layout = self.layout - - layout.itemO("object.restrictview_clear", text="Show Hidden") - layout.itemO("object.restrictview_set", text="Hide Selected") - layout.item_booleanO("object.restrictview_set", "unselected", True, text="Hide Unselected") + def draw(self, context): + layout = self.layout + + layout.itemO("object.restrictview_clear", text="Show Hidden") + layout.itemO("object.restrictview_set", text="Hide Selected") + layout.item_booleanO("object.restrictview_set", "unselected", True, text="Hide Unselected") class VIEW3D_MT_make_single_user(bpy.types.Menu): - bl_label = "Make Single User" + bl_label = "Make Single User" - def draw(self, context): - layout = self.layout - - props = layout.itemO("object.make_single_user", properties=True, text="Object") - props.object = True - - props = layout.itemO("object.make_single_user", properties=True, text="Object & ObData") - props.object = props.obdata = True - - props = layout.itemO("object.make_single_user", properties=True, text="Object & ObData & Materials+Tex") - props.object = props.obdata = props.material = props.texture = True - - props = layout.itemO("object.make_single_user", properties=True, text="Materials+Tex") - props.material = props.texture = True - - props = layout.itemO("object.make_single_user", properties=True, text="Animation") - props.animation = True + def draw(self, context): + layout = self.layout + + props = layout.itemO("object.make_single_user", properties=True, text="Object") + props.object = True + + props = layout.itemO("object.make_single_user", properties=True, text="Object & ObData") + props.object = props.obdata = True + + props = layout.itemO("object.make_single_user", properties=True, text="Object & ObData & Materials+Tex") + props.object = props.obdata = props.material = props.texture = True + + props = layout.itemO("object.make_single_user", properties=True, text="Materials+Tex") + props.material = props.texture = True + + props = layout.itemO("object.make_single_user", properties=True, text="Animation") + props.animation = True + +# ********** Vertex paint menu ********** -# ********** Vertex paint menu ********** - class VIEW3D_MT_paint_vertex(bpy.types.Menu): - bl_label = "Paint" + bl_label = "Paint" - def draw(self, context): - layout = self.layout - - sculpt = context.tool_settings.sculpt + def draw(self, context): + layout = self.layout - layout.itemO("paint.vertex_color_set") - props = layout.itemO("paint.vertex_color_set", text="Set Selected Vertex Colors", properties=True) - props.selected = True + sculpt = context.tool_settings.sculpt + + layout.itemO("paint.vertex_color_set") + props = layout.itemO("paint.vertex_color_set", text="Set Selected Vertex Colors", properties=True) + props.selected = True + +# ********** Sculpt menu ********** -# ********** Sculpt menu ********** - class VIEW3D_MT_sculpt(bpy.types.Menu): - bl_label = "Sculpt" + bl_label = "Sculpt" - def draw(self, context): - layout = self.layout - - sculpt = context.tool_settings.sculpt - brush = context.tool_settings.sculpt.brush - - layout.itemR(sculpt, "symmetry_x") - layout.itemR(sculpt, "symmetry_y") - layout.itemR(sculpt, "symmetry_z") - layout.itemS() - layout.itemR(sculpt, "lock_x") - layout.itemR(sculpt, "lock_y") - layout.itemR(sculpt, "lock_z") - layout.itemS() - layout.item_menu_enumO("brush.curve_preset", property="shape") - layout.itemS() - - if brush.sculpt_tool != 'GRAB': - layout.itemR(brush, "use_airbrush") - - if brush.sculpt_tool != 'LAYER': - layout.itemR(brush, "use_anchor") - - if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'): - layout.itemR(brush, "flip_direction") + def draw(self, context): + layout = self.layout - if brush.sculpt_tool == 'LAYER': - layout.itemR(brush, "use_persistent") - layout.itemO("sculpt.set_persistent_base") + sculpt = context.tool_settings.sculpt + brush = context.tool_settings.sculpt.brush + + layout.itemR(sculpt, "symmetry_x") + layout.itemR(sculpt, "symmetry_y") + layout.itemR(sculpt, "symmetry_z") + layout.itemS() + layout.itemR(sculpt, "lock_x") + layout.itemR(sculpt, "lock_y") + layout.itemR(sculpt, "lock_z") + layout.itemS() + layout.item_menu_enumO("brush.curve_preset", property="shape") + layout.itemS() + + if brush.sculpt_tool != 'GRAB': + layout.itemR(brush, "use_airbrush") + + if brush.sculpt_tool != 'LAYER': + layout.itemR(brush, "use_anchor") + + if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'): + layout.itemR(brush, "flip_direction") + + if brush.sculpt_tool == 'LAYER': + layout.itemR(brush, "use_persistent") + layout.itemO("sculpt.set_persistent_base") + +# ********** Particle menu ********** -# ********** Particle menu ********** - class VIEW3D_MT_particle(bpy.types.Menu): - bl_label = "Particle" + bl_label = "Particle" - def draw(self, context): - layout = self.layout - - particle_edit = context.tool_settings.particle_edit - - layout.itemO("particle.mirror") - - layout.itemS() - - layout.itemO("particle.remove_doubles") - layout.itemO("particle.delete") - - if particle_edit.selection_mode == 'POINT': - layout.itemO("particle.subdivide") - - layout.itemO("particle.rekey") - - layout.itemS() - - layout.itemM("VIEW3D_MT_particle_showhide") + def draw(self, context): + layout = self.layout + + particle_edit = context.tool_settings.particle_edit + + layout.itemO("particle.mirror") + + layout.itemS() + + layout.itemO("particle.remove_doubles") + layout.itemO("particle.delete") + + if particle_edit.selection_mode == 'POINT': + layout.itemO("particle.subdivide") + + layout.itemO("particle.rekey") + + layout.itemS() + + layout.itemM("VIEW3D_MT_particle_showhide") class VIEW3D_MT_particle_showhide(VIEW3D_MT_showhide): - _operator_name = "particle" + _operator_name = "particle" # ********** Pose Menu ********** class VIEW3D_MT_pose(bpy.types.Menu): - bl_label = "Pose" + bl_label = "Pose" - def draw(self, context): - layout = self.layout - - arm = context.active_object.data - - if arm.drawtype in ('BBONE', 'ENVELOPE'): - layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance") - - layout.itemM("VIEW3D_MT_pose_transform") - - layout.itemS() - - layout.itemO("anim.insert_keyframe_menu", text="Insert Keyframe...") - layout.itemO("anim.delete_keyframe_v3d", text="Delete Keyframe...") - - layout.itemS() - - layout.itemO("pose.apply") - - layout.itemS() - - layout.itemO("pose.copy") - layout.itemO("pose.paste") - layout.item_booleanO("pose.paste", "flipped", True, text="Paste X-Flipped Pose") - - layout.itemS() - - layout.itemM("VIEW3D_MT_pose_pose") - layout.itemM("VIEW3D_MT_pose_motion") - layout.itemM("VIEW3D_MT_pose_group") - - layout.itemS() - - layout.itemM("VIEW3D_MT_pose_ik") - layout.itemM("VIEW3D_MT_pose_constraints") - - layout.itemS() - - layout.operator_context = "EXEC_AREA" - layout.item_enumO("pose.autoside_names", "axis", 'XAXIS', text="AutoName Left/Right") - layout.item_enumO("pose.autoside_names", "axis", 'YAXIS', text="AutoName Front/Back") - layout.item_enumO("pose.autoside_names", "axis", 'ZAXIS', text="AutoName Top/Bottom") - - layout.itemO("pose.flip_names") - - layout.itemS() - - layout.operator_context = "INVOKE_AREA" - layout.itemO("pose.armature_layers", text="Change Armature Layers...") - layout.itemO("pose.bone_layers", text="Change Bone Layers...") - - layout.itemS() - - layout.itemM("VIEW3D_MT_pose_showhide") - layout.item_menu_enumO("pose.flags_set", 'mode', text="Bone Settings") + def draw(self, context): + layout = self.layout + + arm = context.active_object.data + + if arm.drawtype in ('BBONE', 'ENVELOPE'): + layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance") + + layout.itemM("VIEW3D_MT_pose_transform") + + layout.itemS() + + layout.itemO("anim.insert_keyframe_menu", text="Insert Keyframe...") + layout.itemO("anim.delete_keyframe_v3d", text="Delete Keyframe...") + + layout.itemS() + + layout.itemO("pose.apply") + + layout.itemS() + + layout.itemO("pose.copy") + layout.itemO("pose.paste") + layout.item_booleanO("pose.paste", "flipped", True, text="Paste X-Flipped Pose") + + layout.itemS() + + layout.itemM("VIEW3D_MT_pose_pose") + layout.itemM("VIEW3D_MT_pose_motion") + layout.itemM("VIEW3D_MT_pose_group") + + layout.itemS() + + layout.itemM("VIEW3D_MT_pose_ik") + layout.itemM("VIEW3D_MT_pose_constraints") + + layout.itemS() + + layout.operator_context = "EXEC_AREA" + layout.item_enumO("pose.autoside_names", "axis", 'XAXIS', text="AutoName Left/Right") + layout.item_enumO("pose.autoside_names", "axis", 'YAXIS', text="AutoName Front/Back") + layout.item_enumO("pose.autoside_names", "axis", 'ZAXIS', text="AutoName Top/Bottom") + + layout.itemO("pose.flip_names") + + layout.itemS() + + layout.operator_context = "INVOKE_AREA" + layout.itemO("pose.armature_layers", text="Change Armature Layers...") + layout.itemO("pose.bone_layers", text="Change Bone Layers...") + + layout.itemS() + + layout.itemM("VIEW3D_MT_pose_showhide") + layout.item_menu_enumO("pose.flags_set", 'mode', text="Bone Settings") class VIEW3D_MT_pose_transform(bpy.types.Menu): - bl_label = "Clear Transform" + bl_label = "Clear Transform" + + def draw(self, context): + layout = self.layout + + layout.itemL(text="User Transform") + + layout.itemO("pose.loc_clear", text="Location") + layout.itemO("pose.rot_clear", text="Rotation") + layout.itemO("pose.scale_clear", text="Scale") + + layout.itemL(text="Origin") - def draw(self, context): - layout = self.layout - - layout.itemL(text="User Transform") - - layout.itemO("pose.loc_clear", text="Location") - layout.itemO("pose.rot_clear", text="Rotation") - layout.itemO("pose.scale_clear", text="Scale") - - layout.itemL(text="Origin") - class VIEW3D_MT_pose_pose(bpy.types.Menu): - bl_label = "Pose Library" + bl_label = "Pose Library" - def draw(self, context): - layout = self.layout - - layout.itemO("poselib.browse_interactive", text="Browse Poses...") - - layout.itemS() - - layout.itemO("poselib.pose_add", text="Add Pose...") - layout.itemO("poselib.pose_rename", text="Rename Pose...") - layout.itemO("poselib.pose_remove", text="Remove Pose...") + def draw(self, context): + layout = self.layout + + layout.itemO("poselib.browse_interactive", text="Browse Poses...") + + layout.itemS() + + layout.itemO("poselib.pose_add", text="Add Pose...") + layout.itemO("poselib.pose_rename", text="Rename Pose...") + layout.itemO("poselib.pose_remove", text="Remove Pose...") class VIEW3D_MT_pose_motion(bpy.types.Menu): - bl_label = "Motion Paths" + bl_label = "Motion Paths" + + def draw(self, context): + layout = self.layout + + layout.itemO("pose.paths_calculate", text="Calculate") + layout.itemO("pose.paths_clear", text="Clear") - def draw(self, context): - layout = self.layout - - layout.itemO("pose.paths_calculate", text="Calculate") - layout.itemO("pose.paths_clear", text="Clear") - class VIEW3D_MT_pose_group(bpy.types.Menu): - bl_label = "Bone Groups" + bl_label = "Bone Groups" + + def draw(self, context): + layout = self.layout + layout.itemO("pose.group_add") + layout.itemO("pose.group_remove") + + layout.itemS() + + layout.itemO("pose.group_assign") + layout.itemO("pose.group_unassign") + - def draw(self, context): - layout = self.layout - layout.itemO("pose.group_add") - layout.itemO("pose.group_remove") - - layout.itemS() - - layout.itemO("pose.group_assign") - layout.itemO("pose.group_unassign") - - class VIEW3D_MT_pose_ik(bpy.types.Menu): - bl_label = "Inverse Kinematics" + bl_label = "Inverse Kinematics" + + def draw(self, context): + layout = self.layout + + layout.itemO("pose.ik_add") + layout.itemO("pose.ik_clear") - def draw(self, context): - layout = self.layout - - layout.itemO("pose.ik_add") - layout.itemO("pose.ik_clear") - class VIEW3D_MT_pose_constraints(bpy.types.Menu): - bl_label = "Constraints" + bl_label = "Constraints" + + def draw(self, context): + layout = self.layout + + layout.itemO("pose.constraint_add_with_targets", text="Add (With Targets)...") + layout.itemO("pose.constraints_clear") - def draw(self, context): - layout = self.layout - - layout.itemO("pose.constraint_add_with_targets", text="Add (With Targets)...") - layout.itemO("pose.constraints_clear") - class VIEW3D_MT_pose_showhide(VIEW3D_MT_showhide): - _operator_name = "pose" + _operator_name = "pose" # ********** Edit Menus, suffix from ob.type ********** # Edit MESH class VIEW3D_MT_edit_mesh(bpy.types.Menu): - bl_label = "Mesh" + bl_label = "Mesh" - def draw(self, context): - layout = self.layout - - settings = context.tool_settings + def draw(self, context): + layout = self.layout - layout.itemO("ed.undo") - layout.itemO("ed.redo") - - layout.itemS() - - layout.itemM("VIEW3D_MT_snap") - - layout.itemS() - - layout.itemO("uv.mapping_menu", text="UV Unwrap...") - - layout.itemS() - - layout.itemO("mesh.extrude_move") - layout.itemO("mesh.duplicate_move") - layout.itemO("mesh.delete", text="Delete...") - - layout.itemS() - - layout.itemM("VIEW3D_MT_edit_mesh_vertices") - layout.itemM("VIEW3D_MT_edit_mesh_edges") - layout.itemM("VIEW3D_MT_edit_mesh_faces") - layout.itemM("VIEW3D_MT_edit_mesh_normals") - - layout.itemS() - - layout.itemR(settings, "automerge_editing") - layout.item_menu_enumR(settings, "proportional_editing") - layout.item_menu_enumR(settings, "proportional_editing_falloff") - - layout.itemS() - - layout.itemM("VIEW3D_MT_edit_mesh_showhide") + settings = context.tool_settings + + layout.itemO("ed.undo") + layout.itemO("ed.redo") + + layout.itemS() + + layout.itemM("VIEW3D_MT_snap") + + layout.itemS() + + layout.itemO("uv.mapping_menu", text="UV Unwrap...") + + layout.itemS() + + layout.itemO("mesh.extrude_move") + layout.itemO("mesh.duplicate_move") + layout.itemO("mesh.delete", text="Delete...") + + layout.itemS() + + layout.itemM("VIEW3D_MT_edit_mesh_vertices") + layout.itemM("VIEW3D_MT_edit_mesh_edges") + layout.itemM("VIEW3D_MT_edit_mesh_faces") + layout.itemM("VIEW3D_MT_edit_mesh_normals") + + layout.itemS() + + layout.itemR(settings, "automerge_editing") + layout.item_menu_enumR(settings, "proportional_editing") + layout.item_menu_enumR(settings, "proportional_editing_falloff") + + layout.itemS() + + layout.itemM("VIEW3D_MT_edit_mesh_showhide") # Only used by the menu class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu): - bl_label = "Specials" + bl_label = "Specials" - def draw(self, context): - layout = self.layout - - layout.operator_context = 'INVOKE_REGION_WIN' - - layout.itemO("mesh.subdivide", text="Subdivide") - layout.item_floatO("mesh.subdivide", "smoothness", 1.0, text="Subdivide Smooth") - layout.itemO("mesh.merge", text="Merge...") - layout.itemO("mesh.remove_doubles") - layout.itemO("mesh.hide", text="Hide") - layout.itemO("mesh.reveal", text="Reveal") - layout.itemO("mesh.select_inverse") - layout.itemO("mesh.flip_normals") - layout.itemO("mesh.vertices_smooth", text="Smooth") - # layout.itemO("mesh.bevel", text="Bevel") - layout.itemO("mesh.faces_shade_smooth") - layout.itemO("mesh.faces_shade_flat") - layout.itemO("mesh.blend_from_shape") - layout.itemO("mesh.shape_propagate_to_all") - layout.itemO("mesh.select_vertex_path") + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_REGION_WIN' + + layout.itemO("mesh.subdivide", text="Subdivide") + layout.item_floatO("mesh.subdivide", "smoothness", 1.0, text="Subdivide Smooth") + layout.itemO("mesh.merge", text="Merge...") + layout.itemO("mesh.remove_doubles") + layout.itemO("mesh.hide", text="Hide") + layout.itemO("mesh.reveal", text="Reveal") + layout.itemO("mesh.select_inverse") + layout.itemO("mesh.flip_normals") + layout.itemO("mesh.vertices_smooth", text="Smooth") + # layout.itemO("mesh.bevel", text="Bevel") + layout.itemO("mesh.faces_shade_smooth") + layout.itemO("mesh.faces_shade_flat") + layout.itemO("mesh.blend_from_shape") + layout.itemO("mesh.shape_propagate_to_all") + layout.itemO("mesh.select_vertex_path") class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu): - bl_label = "Vertices" + bl_label = "Vertices" - def draw(self, context): - layout = self.layout - layout.operator_context = 'INVOKE_REGION_WIN' - - layout.itemO("mesh.merge") - layout.itemO("mesh.rip") - layout.itemO("mesh.split") - layout.itemO("mesh.separate") + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' - layout.itemS() - - layout.itemO("mesh.vertices_smooth") - layout.itemO("mesh.remove_doubles") - - layout.itemO("mesh.select_vertex_path") - - layout.itemO("mesh.blend_from_shape") - - layout.itemO("object.vertex_group_blend") - layout.itemO("mesh.shape_propagate_to_all") + layout.itemO("mesh.merge") + layout.itemO("mesh.rip") + layout.itemO("mesh.split") + layout.itemO("mesh.separate") + + layout.itemS() + + layout.itemO("mesh.vertices_smooth") + layout.itemO("mesh.remove_doubles") + + layout.itemO("mesh.select_vertex_path") + + layout.itemO("mesh.blend_from_shape") + + layout.itemO("object.vertex_group_blend") + layout.itemO("mesh.shape_propagate_to_all") class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu): - bl_label = "Edges" + bl_label = "Edges" - def draw(self, context): - layout = self.layout - layout.operator_context = 'INVOKE_REGION_WIN' - - layout.itemO("mesh.edge_face_add") - layout.itemO("mesh.subdivide") + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' - layout.itemS() - - layout.itemO("mesh.mark_seam") - layout.item_booleanO("mesh.mark_seam", "clear", True, text="Clear Seam") - - layout.itemS() - - layout.itemO("mesh.mark_sharp") - layout.item_booleanO("mesh.mark_sharp", "clear", True, text="Clear Sharp") - - layout.itemS() - - layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW") - layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW") + layout.itemO("mesh.edge_face_add") + layout.itemO("mesh.subdivide") - layout.itemS() - - layout.itemO("TFM_OT_edge_slide", text="Edge Slide") - layout.itemO("mesh.loop_multi_select", text="Edge Loop") + layout.itemS() - # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1); - # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0); - - layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring") - - layout.itemO("mesh.loop_to_region") - layout.itemO("mesh.region_to_loop") + layout.itemO("mesh.mark_seam") + layout.item_booleanO("mesh.mark_seam", "clear", True, text="Clear Seam") + + layout.itemS() + + layout.itemO("mesh.mark_sharp") + layout.item_booleanO("mesh.mark_sharp", "clear", True, text="Clear Sharp") + + layout.itemS() + + layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW") + layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW") + + layout.itemS() + + layout.itemO("TFM_OT_edge_slide", text="Edge Slide") + layout.itemO("mesh.loop_multi_select", text="Edge Loop") + + # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1); + # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0); + + layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring") + + layout.itemO("mesh.loop_to_region") + layout.itemO("mesh.region_to_loop") class VIEW3D_MT_edit_mesh_faces(dynamic_menu.DynMenu): - bl_label = "Faces" - bl_idname = "VIEW3D_MT_edit_mesh_faces" + bl_label = "Faces" + bl_idname = "VIEW3D_MT_edit_mesh_faces" - def draw(self, context): - layout = self.layout - layout.operator_context = 'INVOKE_REGION_WIN' - - layout.itemO("mesh.flip_normals") - # layout.itemO("mesh.bevel") - # layout.itemO("mesh.bevel") - layout.itemO("mesh.edge_face_add") - layout.itemO("mesh.fill") - layout.itemO("mesh.beauty_fill") + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' - layout.itemS() - - layout.itemO("mesh.quads_convert_to_tris") - layout.itemO("mesh.tris_convert_to_quads") - layout.itemO("mesh.edge_flip") - - layout.itemS() - - layout.itemO("mesh.faces_shade_smooth") - layout.itemO("mesh.faces_shade_flat") - - layout.itemS() + layout.itemO("mesh.flip_normals") + # layout.itemO("mesh.bevel") + # layout.itemO("mesh.bevel") + layout.itemO("mesh.edge_face_add") + layout.itemO("mesh.fill") + layout.itemO("mesh.beauty_fill") - # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1); - # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0); - - layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW") - - layout.itemS() - - layout.item_menu_enumO("mesh.uvs_rotate", "direction") - layout.item_menu_enumO("mesh.uvs_mirror", "axis") - layout.item_menu_enumO("mesh.colors_rotate", "direction") - layout.item_menu_enumO("mesh.colors_mirror", "axis") + layout.itemS() + + layout.itemO("mesh.quads_convert_to_tris") + layout.itemO("mesh.tris_convert_to_quads") + layout.itemO("mesh.edge_flip") + + layout.itemS() + + layout.itemO("mesh.faces_shade_smooth") + layout.itemO("mesh.faces_shade_flat") + + layout.itemS() + + # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1); + # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0); + + layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW") + + layout.itemS() + + layout.item_menu_enumO("mesh.uvs_rotate", "direction") + layout.item_menu_enumO("mesh.uvs_mirror", "axis") + layout.item_menu_enumO("mesh.colors_rotate", "direction") + layout.item_menu_enumO("mesh.colors_mirror", "axis") class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu): - bl_label = "Normals" + bl_label = "Normals" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - layout.itemO("mesh.normals_make_consistent", text="Recalculate Outside") - layout.item_booleanO("mesh.normals_make_consistent", "inside", True, text="Recalculate Inside") + layout.itemO("mesh.normals_make_consistent", text="Recalculate Outside") + layout.item_booleanO("mesh.normals_make_consistent", "inside", True, text="Recalculate Inside") + + layout.itemS() + + layout.itemO("mesh.flip_normals") - layout.itemS() - - layout.itemO("mesh.flip_normals") - class VIEW3D_MT_edit_mesh_showhide(VIEW3D_MT_showhide): - _operator_name = "mesh" + _operator_name = "mesh" # Edit Curve # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface def draw_curve(self, context): - layout = self.layout - - settings = context.tool_settings - - layout.itemM("VIEW3D_MT_snap") - - layout.itemS() - - layout.itemO("curve.extrude") - layout.itemO("curve.duplicate") - layout.itemO("curve.separate") - layout.itemO("curve.make_segment") - layout.itemO("curve.cyclic_toggle") - layout.itemO("curve.delete", text="Delete...") - - layout.itemS() - - layout.itemM("VIEW3D_MT_edit_curve_ctrlpoints") - layout.itemM("VIEW3D_MT_edit_curve_segments") - - layout.itemS() - - layout.itemR(settings, "proportional_editing") - layout.item_menu_enumR(settings, "proportional_editing_falloff") - - layout.itemS() - - layout.itemM("VIEW3D_MT_edit_curve_showhide") + layout = self.layout + + settings = context.tool_settings + + layout.itemM("VIEW3D_MT_snap") + + layout.itemS() + + layout.itemO("curve.extrude") + layout.itemO("curve.duplicate") + layout.itemO("curve.separate") + layout.itemO("curve.make_segment") + layout.itemO("curve.cyclic_toggle") + layout.itemO("curve.delete", text="Delete...") + + layout.itemS() + + layout.itemM("VIEW3D_MT_edit_curve_ctrlpoints") + layout.itemM("VIEW3D_MT_edit_curve_segments") + + layout.itemS() + + layout.itemR(settings, "proportional_editing") + layout.item_menu_enumR(settings, "proportional_editing_falloff") + + layout.itemS() + + layout.itemM("VIEW3D_MT_edit_curve_showhide") class VIEW3D_MT_edit_curve(bpy.types.Menu): - bl_label = "Curve" + bl_label = "Curve" + + draw = draw_curve - draw = draw_curve - class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu): - bl_label = "Control Points" + bl_label = "Control Points" + + def draw(self, context): + layout = self.layout + + edit_object = context.edit_object + + if edit_object.type == 'CURVE': + layout.item_enumO("tfm.transform", "mode", 'TILT') + layout.itemO("curve.tilt_clear") + layout.itemO("curve.separate") + + layout.itemS() + + layout.item_menu_enumO("curve.handle_type_set", "type") - def draw(self, context): - layout = self.layout - - edit_object = context.edit_object - - if edit_object.type == 'CURVE': - layout.item_enumO("tfm.transform", "mode", 'TILT') - layout.itemO("curve.tilt_clear") - layout.itemO("curve.separate") - - layout.itemS() - - layout.item_menu_enumO("curve.handle_type_set", "type") - class VIEW3D_MT_edit_curve_segments(bpy.types.Menu): - bl_label = "Segments" + bl_label = "Segments" - def draw(self, context): - layout = self.layout - - layout.itemO("curve.subdivide") - layout.itemO("curve.switch_direction") + def draw(self, context): + layout = self.layout + + layout.itemO("curve.subdivide") + layout.itemO("curve.switch_direction") class VIEW3D_MT_edit_curve_showhide(VIEW3D_MT_showhide): - _operator_name = "curve" + _operator_name = "curve" # Edit SURFACE class VIEW3D_MT_edit_surface(bpy.types.Menu): - bl_label = "Surface" + bl_label = "Surface" - draw = draw_curve + draw = draw_curve # Edit TEXT class VIEW3D_MT_edit_text(bpy.types.Menu): - bl_label = "Text" + bl_label = "Text" - def draw(self, context): - layout = self.layout - - layout.itemO("font.file_paste") - - layout.itemS() - - layout.itemm("view3d_mt_edit_text_chars") + def draw(self, context): + layout = self.layout + + layout.itemO("font.file_paste") + + layout.itemS() + + layout.itemm("view3d_mt_edit_text_chars") class VIEW3D_MT_edit_text_chars(bpy.types.Menu): - bl_label = "Special Characters" + bl_label = "Special Characters" - def draw(self, context): - layout = self.layout - - layout.item_stringO("font.text_insert", "text", b'\xC2\xA9'.decode(), text="Copyright|Alt C") - layout.item_stringO("font.text_insert", "text", b'\xC2\xAE'.decode(), text="Registered Trademark|Alt R") - - layout.itemS() - - layout.item_stringO("font.text_insert", "text", b'\xC2\xB0'.decode(), text="Degree Sign|Alt G") - layout.item_stringO("font.text_insert", "text", b'\xC3\x97'.decode(), text="Multiplication Sign|Alt x") - layout.item_stringO("font.text_insert", "text", b'\xC2\x8A'.decode(), text="Circle|Alt .") - layout.item_stringO("font.text_insert", "text", b'\xC2\xB9'.decode(), text="Superscript 1|Alt 1") - layout.item_stringO("font.text_insert", "text", b'\xC2\xB2'.decode(), text="Superscript 2|Alt 2") - layout.item_stringO("font.text_insert", "text", b'\xC2\xB3'.decode(), text="Superscript 3|Alt 3") - layout.item_stringO("font.text_insert", "text", b'\xC2\xBB'.decode(), text="Double >>|Alt >") - layout.item_stringO("font.text_insert", "text", b'\xC2\xAB'.decode(), text="Double <<|Alt <") - layout.item_stringO("font.text_insert", "text", b'\xE2\x80\xB0'.decode(), text="Promillage|Alt %") - - layout.itemS() - - layout.item_stringO("font.text_insert", "text", b'\xC2\xA4'.decode(), text="Dutch Florin|Alt F") - layout.item_stringO("font.text_insert", "text", b'\xC2\xA3'.decode(), text="British Pound|Alt L") - layout.item_stringO("font.text_insert", "text", b'\xC2\xA5'.decode(), text="Japanese Yen|Alt Y") - - layout.itemS() - - layout.item_stringO("font.text_insert", "text", b'\xC3\x9F'.decode(), text="German S|Alt S") - layout.item_stringO("font.text_insert", "text", b'\xC2\xBF'.decode(), text="Spanish Question Mark|Alt ?") - layout.item_stringO("font.text_insert", "text", b'\xC2\xA1'.decode(), text="Spanish Exclamation Mark|Alt !") + def draw(self, context): + layout = self.layout + + layout.item_stringO("font.text_insert", "text", b'\xC2\xA9'.decode(), text="Copyright|Alt C") + layout.item_stringO("font.text_insert", "text", b'\xC2\xAE'.decode(), text="Registered Trademark|Alt R") + + layout.itemS() + + layout.item_stringO("font.text_insert", "text", b'\xC2\xB0'.decode(), text="Degree Sign|Alt G") + layout.item_stringO("font.text_insert", "text", b'\xC3\x97'.decode(), text="Multiplication Sign|Alt x") + layout.item_stringO("font.text_insert", "text", b'\xC2\x8A'.decode(), text="Circle|Alt .") + layout.item_stringO("font.text_insert", "text", b'\xC2\xB9'.decode(), text="Superscript 1|Alt 1") + layout.item_stringO("font.text_insert", "text", b'\xC2\xB2'.decode(), text="Superscript 2|Alt 2") + layout.item_stringO("font.text_insert", "text", b'\xC2\xB3'.decode(), text="Superscript 3|Alt 3") + layout.item_stringO("font.text_insert", "text", b'\xC2\xBB'.decode(), text="Double >>|Alt >") + layout.item_stringO("font.text_insert", "text", b'\xC2\xAB'.decode(), text="Double <<|Alt <") + layout.item_stringO("font.text_insert", "text", b'\xE2\x80\xB0'.decode(), text="Promillage|Alt %") + + layout.itemS() + + layout.item_stringO("font.text_insert", "text", b'\xC2\xA4'.decode(), text="Dutch Florin|Alt F") + layout.item_stringO("font.text_insert", "text", b'\xC2\xA3'.decode(), text="British Pound|Alt L") + layout.item_stringO("font.text_insert", "text", b'\xC2\xA5'.decode(), text="Japanese Yen|Alt Y") + + layout.itemS() + + layout.item_stringO("font.text_insert", "text", b'\xC3\x9F'.decode(), text="German S|Alt S") + layout.item_stringO("font.text_insert", "text", b'\xC2\xBF'.decode(), text="Spanish Question Mark|Alt ?") + layout.item_stringO("font.text_insert", "text", b'\xC2\xA1'.decode(), text="Spanish Exclamation Mark|Alt !") # Edit META class VIEW3D_MT_edit_meta(bpy.types.Menu): - bl_label = "Metaball" + bl_label = "Metaball" - def draw(self, context): - layout = self.layout - - settings = context.tool_settings + def draw(self, context): + layout = self.layout - layout.itemO("ed.undo") - layout.itemO("ed.redo") - - layout.itemS() - - layout.itemM("VIEW3D_MT_snap") - - layout.itemS() - - layout.itemO("mball.delete_metaelems", text="Delete...") - layout.itemO("mball.duplicate_metaelems") - - layout.itemS() - - layout.itemR(settings, "proportional_editing") - layout.item_menu_enumR(settings, "proportional_editing_falloff") - - layout.itemS() - - layout.itemM("VIEW3D_MT_edit_meta_showhide") + settings = context.tool_settings + + layout.itemO("ed.undo") + layout.itemO("ed.redo") + + layout.itemS() + + layout.itemM("VIEW3D_MT_snap") + + layout.itemS() + + layout.itemO("mball.delete_metaelems", text="Delete...") + layout.itemO("mball.duplicate_metaelems") + + layout.itemS() + + layout.itemR(settings, "proportional_editing") + layout.item_menu_enumR(settings, "proportional_editing_falloff") + + layout.itemS() + + layout.itemM("VIEW3D_MT_edit_meta_showhide") class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu): - bl_label = "Show/Hide" + bl_label = "Show/Hide" - def draw(self, context): - layout = self.layout - - layout.itemO("mball.reveal_metaelems", text="Show Hidden") - layout.itemO("mball.hide_metaelems", text="Hide Selected") - layout.item_booleanO("mball.hide_metaelems", "unselected", True, text="Hide Unselected") + def draw(self, context): + layout = self.layout + + layout.itemO("mball.reveal_metaelems", text="Show Hidden") + layout.itemO("mball.hide_metaelems", text="Hide Selected") + layout.item_booleanO("mball.hide_metaelems", "unselected", True, text="Hide Unselected") # Edit LATTICE class VIEW3D_MT_edit_lattice(bpy.types.Menu): - bl_label = "Lattice" + bl_label = "Lattice" - def draw(self, context): - layout = self.layout - - settings = context.tool_settings + def draw(self, context): + layout = self.layout - layout.itemM("VIEW3D_MT_snap") - - layout.itemS() - - layout.itemO("lattice.make_regular") - - layout.itemS() - - layout.itemR(settings, "proportional_editing") - layout.item_menu_enumR(settings, "proportional_editing_falloff") + settings = context.tool_settings + + layout.itemM("VIEW3D_MT_snap") + + layout.itemS() + + layout.itemO("lattice.make_regular") + + layout.itemS() + + layout.itemR(settings, "proportional_editing") + layout.item_menu_enumR(settings, "proportional_editing_falloff") # Edit ARMATURE class VIEW3D_MT_edit_armature(bpy.types.Menu): - bl_label = "Armature" + bl_label = "Armature" - def draw(self, context): - layout = self.layout - - edit_object = context.edit_object - arm = edit_object.data - - layout.itemM("VIEW3D_MT_snap") - layout.itemM("VIEW3D_MT_edit_armature_roll") - - if arm.drawtype == 'ENVELOPE': - layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance") - else: - layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale B-Bone Width") - - layout.itemS() - - layout.itemO("armature.extrude_move") + def draw(self, context): + layout = self.layout -# EXTRUDE FORKED DOESN'T WORK YET + edit_object = context.edit_object + arm = edit_object.data + + layout.itemM("VIEW3D_MT_snap") + layout.itemM("VIEW3D_MT_edit_armature_roll") + + if arm.drawtype == 'ENVELOPE': + layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance") + else: + layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale B-Bone Width") + + layout.itemS() + + layout.itemO("armature.extrude_move") + +# EXTRUDE FORKED DOESN'T WORK YET # if arm.x_axis_mirror: # layout.item_booleanO("armature.extrude_move", "forked", True, text="Extrude Forked") - - layout.itemO("armature.duplicate_move") - layout.itemO("armature.merge") - layout.itemO("armature.fill") - layout.itemO("armature.delete") - layout.itemO("armature.separate") - layout.itemS() + layout.itemO("armature.duplicate_move") + layout.itemO("armature.merge") + layout.itemO("armature.fill") + layout.itemO("armature.delete") + layout.itemO("armature.separate") - layout.itemO("armature.subdivide_multi", text="Subdivide") - - layout.itemS() - - layout.operator_context = "EXEC_AREA" - layout.item_enumO("armature.autoside_names", "type", 'XAXIS', text="AutoName Left/Right") - layout.item_enumO("armature.autoside_names", "type", 'YAXIS', text="AutoName Front/Back") - layout.item_enumO("armature.autoside_names", "type", 'ZAXIS', text="AutoName Top/Bottom") - layout.itemO("armature.flip_names") + layout.itemS() - layout.itemS() - - layout.operator_context = "INVOKE_DEFAULT" - layout.itemO("armature.armature_layers") - layout.itemO("armature.bone_layers") + layout.itemO("armature.subdivide_multi", text="Subdivide") - layout.itemS() + layout.itemS() - layout.itemM("VIEW3D_MT_edit_armature_parent") + layout.operator_context = "EXEC_AREA" + layout.item_enumO("armature.autoside_names", "type", 'XAXIS', text="AutoName Left/Right") + layout.item_enumO("armature.autoside_names", "type", 'YAXIS', text="AutoName Front/Back") + layout.item_enumO("armature.autoside_names", "type", 'ZAXIS', text="AutoName Top/Bottom") + layout.itemO("armature.flip_names") - layout.itemS() - - layout.item_menu_enumO("armature.flags_set", "mode", text="Bone Settings") + layout.itemS() + + layout.operator_context = "INVOKE_DEFAULT" + layout.itemO("armature.armature_layers") + layout.itemO("armature.bone_layers") + + layout.itemS() + + layout.itemM("VIEW3D_MT_edit_armature_parent") + + layout.itemS() + + layout.item_menu_enumO("armature.flags_set", "mode", text="Bone Settings") class VIEW3D_MT_edit_armature_parent(bpy.types.Menu): - bl_label = "Parent" + bl_label = "Parent" - def draw(self, context): - layout = self.layout - - layout.itemO("armature.parent_set", text="Make") - layout.itemO("armature.parent_clear", text="Clear") + def draw(self, context): + layout = self.layout + + layout.itemO("armature.parent_set", text="Make") + layout.itemO("armature.parent_clear", text="Clear") class VIEW3D_MT_edit_armature_roll(bpy.types.Menu): - bl_label = "Bone Roll" + bl_label = "Bone Roll" - def draw(self, context): - layout = self.layout - - layout.item_enumO("armature.calculate_roll", "type", 'GLOBALUP', text="Clear Roll (Z-Axis Up)") - layout.item_enumO("armature.calculate_roll", "type", 'CURSOR', text="Roll to Cursor") - - layout.itemS() - - layout.item_enumO("tfm.transform", "mode", 'BONE_ROLL', text="Set Roll") + def draw(self, context): + layout = self.layout + + layout.item_enumO("armature.calculate_roll", "type", 'GLOBALUP', text="Clear Roll (Z-Axis Up)") + layout.item_enumO("armature.calculate_roll", "type", 'CURSOR', text="Roll to Cursor") + + layout.itemS() + + layout.item_enumO("tfm.transform", "mode", 'BONE_ROLL', text="Set Roll") # ********** Panel ********** class VIEW3D_PT_3dview_properties(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_label = "View" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "View" - def poll(self, context): - view = context.space_data - return (view) + def poll(self, context): + view = context.space_data + return (view) + + def draw(self, context): + layout = self.layout + + view = context.space_data + scene = context.scene + + col = layout.column() + col.itemL(text="Camera:") + col.itemR(view, "camera", text="") + col.itemR(view, "lens") + + col = layout.column(align=True) + col.itemL(text="Clip:") + col.itemR(view, "clip_start", text="Start") + col.itemR(view, "clip_end", text="End") + + col = layout.column(align=True) + col.itemL(text="Grid:") + col.itemR(view, "grid_lines", text="Lines") + col.itemR(view, "grid_spacing", text="Spacing") + col.itemR(view, "grid_subdivisions", text="Subdivisions") + + layout.column().itemR(scene, "cursor_location", text="3D Cursor:") - def draw(self, context): - layout = self.layout - - view = context.space_data - scene = context.scene - - col = layout.column() - col.itemL(text="Camera:") - col.itemR(view, "camera", text="") - col.itemR(view, "lens") - - col = layout.column(align=True) - col.itemL(text="Clip:") - col.itemR(view, "clip_start", text="Start") - col.itemR(view, "clip_end", text="End") - - col = layout.column(align=True) - col.itemL(text="Grid:") - col.itemR(view, "grid_lines", text="Lines") - col.itemR(view, "grid_spacing", text="Spacing") - col.itemR(view, "grid_subdivisions", text="Subdivisions") - - layout.column().itemR(scene, "cursor_location", text="3D Cursor:") - class VIEW3D_PT_3dview_display(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_label = "Display" - bl_default_closed = True - - def poll(self, context): - view = context.space_data - return (view) + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "Display" + bl_default_closed = True - def draw(self, context): - layout = self.layout + def poll(self, context): + view = context.space_data + return (view) - view = context.space_data - gs = context.scene.game_data - ob = context.object - - col = layout.column() - col.itemR(view, "display_floor", text="Grid Floor") - col.itemR(view, "display_x_axis", text="X Axis") - col.itemR(view, "display_y_axis", text="Y Axis") - col.itemR(view, "display_z_axis", text="Z Axis") - col.itemR(view, "outline_selected") - col.itemR(view, "all_object_centers") - col.itemR(view, "relationship_lines") - if ob and ob.type =='MESH': - mesh = context.active_object.data - col.itemR(mesh, "all_edges") - - col = layout.column() - col.itemL(text="Shading:") - col.itemR(gs, "material_mode", text="") - col.itemR(view, "textured_solid") + def draw(self, context): + layout = self.layout -# XXX - the Quad View options don't work yet + view = context.space_data + gs = context.scene.game_data + ob = context.object + + col = layout.column() + col.itemR(view, "display_floor", text="Grid Floor") + col.itemR(view, "display_x_axis", text="X Axis") + col.itemR(view, "display_y_axis", text="Y Axis") + col.itemR(view, "display_z_axis", text="Z Axis") + col.itemR(view, "outline_selected") + col.itemR(view, "all_object_centers") + col.itemR(view, "relationship_lines") + if ob and ob.type =='MESH': + mesh = context.active_object.data + col.itemR(mesh, "all_edges") + + col = layout.column() + col.itemL(text="Shading:") + col.itemR(gs, "material_mode", text="") + col.itemR(view, "textured_solid") + +# XXX - the Quad View options don't work yet # layout.itemS() -# +# # layout.itemO("screen.region_foursplit", text="Toggle Quad View") # col = layout.column() # col.itemR(view, "lock_rotation") @@ -1279,203 +1279,203 @@ class VIEW3D_PT_3dview_display(bpy.types.Panel): # col.itemR(view, "box_clip") class VIEW3D_PT_3dview_meshdisplay(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_label = "Mesh Display" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "Mesh Display" - def poll(self, context): - editmesh = context.mode == 'EDIT_MESH' - return (editmesh) + def poll(self, context): + editmesh = context.mode == 'EDIT_MESH' + return (editmesh) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - mesh = context.active_object.data - - col = layout.column() - col.itemL(text="Overlays:") - col.itemR(mesh, "draw_edges", text="Edges") - col.itemR(mesh, "draw_faces", text="Faces") - col.itemR(mesh, "draw_creases", text="Creases") - col.itemR(mesh, "draw_bevel_weights", text="Bevel Weights") - col.itemR(mesh, "draw_seams", text="Seams") - col.itemR(mesh, "draw_sharp", text="Sharp") - - col.itemS() - col.itemL(text="Normals:") - col.itemR(mesh, "draw_normals", text="Face") - col.itemR(mesh, "draw_vertex_normals", text="Vertex") - col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size") - - col.itemS() - col.itemL(text="Numerics:") - col.itemR(mesh, "draw_edge_lenght") - col.itemR(mesh, "draw_edge_angle") - col.itemR(mesh, "draw_face_area") + mesh = context.active_object.data + + col = layout.column() + col.itemL(text="Overlays:") + col.itemR(mesh, "draw_edges", text="Edges") + col.itemR(mesh, "draw_faces", text="Faces") + col.itemR(mesh, "draw_creases", text="Creases") + col.itemR(mesh, "draw_bevel_weights", text="Bevel Weights") + col.itemR(mesh, "draw_seams", text="Seams") + col.itemR(mesh, "draw_sharp", text="Sharp") + + col.itemS() + col.itemL(text="Normals:") + col.itemR(mesh, "draw_normals", text="Face") + col.itemR(mesh, "draw_vertex_normals", text="Vertex") + col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size") + + col.itemS() + col.itemL(text="Numerics:") + col.itemR(mesh, "draw_edge_lenght") + col.itemR(mesh, "draw_edge_angle") + col.itemR(mesh, "draw_face_area") class VIEW3D_PT_3dview_curvedisplay(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_label = "Curve Display" + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "Curve Display" - def poll(self, context): - editmesh = context.mode == 'EDIT_CURVE' - return (editmesh) + def poll(self, context): + editmesh = context.mode == 'EDIT_CURVE' + return (editmesh) - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - curve = context.active_object.data - - col = layout.column() - col.itemL(text="Overlays:") - col.itemR(curve, "draw_handles", text="Handles") - col.itemR(curve, "draw_normals", text="Normals") - col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size") + curve = context.active_object.data + + col = layout.column() + col.itemL(text="Overlays:") + col.itemR(curve, "draw_handles", text="Handles") + col.itemR(curve, "draw_normals", text="Normals") + col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size") class VIEW3D_PT_background_image(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_label = "Background Image" - bl_default_closed = True + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "Background Image" + bl_default_closed = True - def poll(self, context): - view = context.space_data - bg = context.space_data.background_image - return (view) + def poll(self, context): + view = context.space_data + bg = context.space_data.background_image + return (view) - def draw_header(self, context): - layout = self.layout - view = context.space_data + def draw_header(self, context): + layout = self.layout + view = context.space_data - layout.itemR(view, "display_background_image", text="") + layout.itemR(view, "display_background_image", text="") - def draw(self, context): - layout = self.layout - - view = context.space_data - bg = view.background_image + def draw(self, context): + layout = self.layout - if bg: - layout.active = view.display_background_image + view = context.space_data + bg = view.background_image - col = layout.column() - col.itemR(bg, "image", text="") - #col.itemR(bg, "image_user") - col.itemR(bg, "size") - col.itemR(bg, "transparency", slider=True) - - - col = layout.column(align=True) - col.itemL(text="Offset:") - col.itemR(bg, "offset_x", text="X") - col.itemR(bg, "offset_y", text="Y") + if bg: + layout.active = view.display_background_image + + col = layout.column() + col.itemR(bg, "image", text="") + #col.itemR(bg, "image_user") + col.itemR(bg, "size") + col.itemR(bg, "transparency", slider=True) + + + col = layout.column(align=True) + col.itemL(text="Offset:") + col.itemR(bg, "offset_x", text="X") + col.itemR(bg, "offset_y", text="Y") class VIEW3D_PT_transform_orientations(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_label = "Transform Orientations" - bl_default_closed = True + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "Transform Orientations" + bl_default_closed = True - def poll(self, context): - view = context.space_data - return (view) + def poll(self, context): + view = context.space_data + return (view) - def draw(self, context): - layout = self.layout - - view = context.space_data + def draw(self, context): + layout = self.layout - col = layout.column() + view = context.space_data - col.itemR(view, "transform_orientation") - col.itemO("tfm.create_orientation", text="Create") - - orientation = view.current_orientation - - if orientation: - col.itemR(orientation, "name") - col.itemO("tfm.delete_orientation", text="Delete") + col = layout.column() + + col.itemR(view, "transform_orientation") + col.itemO("tfm.create_orientation", text="Create") + + orientation = view.current_orientation + + if orientation: + col.itemR(orientation, "name") + col.itemO("tfm.delete_orientation", text="Delete") class VIEW3D_PT_etch_a_ton(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_label = "Skeleton Sketching" - bl_default_closed = True + bl_space_type = 'VIEW_3D' + bl_region_type = 'UI' + bl_label = "Skeleton Sketching" + bl_default_closed = True - def poll(self, context): - scene = context.space_data - ob = context.active_object - return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT' + def poll(self, context): + scene = context.space_data + ob = context.active_object + return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT' - def draw_header(self, context): - layout = self.layout - toolsettings = context.scene.tool_settings + def draw_header(self, context): + layout = self.layout + toolsettings = context.scene.tool_settings - layout.itemR(toolsettings, "bone_sketching", text="") + layout.itemR(toolsettings, "bone_sketching", text="") - def draw(self, context): - layout = self.layout - toolsettings = context.scene.tool_settings + def draw(self, context): + layout = self.layout + toolsettings = context.scene.tool_settings - col = layout.column() + col = layout.column() - col.itemR(toolsettings, "etch_quick") - col.itemR(toolsettings, "etch_overdraw") + col.itemR(toolsettings, "etch_quick") + col.itemR(toolsettings, "etch_overdraw") - col.itemR(toolsettings, "etch_convert_mode") - - if toolsettings.etch_convert_mode == "LENGTH": - col.itemR(toolsettings, "etch_length_limit") - elif toolsettings.etch_convert_mode == "ADAPTIVE": - col.itemR(toolsettings, "etch_adaptive_limit") - elif toolsettings.etch_convert_mode == "FIXED": - col.itemR(toolsettings, "etch_subdivision_number") - elif toolsettings.etch_convert_mode == "RETARGET": - col.itemR(toolsettings, "etch_template") - col.itemR(toolsettings, "etch_roll_mode") - col.itemR(toolsettings, "etch_autoname") - col.itemR(toolsettings, "etch_number") - col.itemR(toolsettings, "etch_side") - + col.itemR(toolsettings, "etch_convert_mode") -# Operators + if toolsettings.etch_convert_mode == "LENGTH": + col.itemR(toolsettings, "etch_length_limit") + elif toolsettings.etch_convert_mode == "ADAPTIVE": + col.itemR(toolsettings, "etch_adaptive_limit") + elif toolsettings.etch_convert_mode == "FIXED": + col.itemR(toolsettings, "etch_subdivision_number") + elif toolsettings.etch_convert_mode == "RETARGET": + col.itemR(toolsettings, "etch_template") + col.itemR(toolsettings, "etch_roll_mode") + col.itemR(toolsettings, "etch_autoname") + col.itemR(toolsettings, "etch_number") + col.itemR(toolsettings, "etch_side") + + +# Operators from bpy.props import * class OBJECT_OT_select_pattern(bpy.types.Operator): - '''Select object matching a naming pattern.''' - bl_idname = "object.select_pattern" - bl_label = "Select Pattern" - bl_register = True - bl_undo = True - - pattern = StringProperty(name="Pattern", description="Name filter using '*' and '?' wildcard chars", maxlen= 32, default= "*") - case_sensitive = BoolProperty(name="Case Sensitive", description="Do a case sensitive compare", default= False) - extend = BoolProperty(name="Extend", description="Extend the existing selection", default= True) - - - def execute(self, context): - - import fnmatch - if self.case_sensitive: pattern_match = fnmatch.fnmatchcase - else: pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper()) + '''Select object matching a naming pattern.''' + bl_idname = "object.select_pattern" + bl_label = "Select Pattern" + bl_register = True + bl_undo = True - for ob in context.visible_objects: - if pattern_match(ob.name, self.pattern): - ob.selected = True - elif not self.extend: - ob.selected = False + pattern = StringProperty(name="Pattern", description="Name filter using '*' and '?' wildcard chars", maxlen= 32, default= "*") + case_sensitive = BoolProperty(name="Case Sensitive", description="Do a case sensitive compare", default= False) + extend = BoolProperty(name="Extend", description="Extend the existing selection", default= True) - return ('FINISHED',) - - # TODO - python cant do popups yet - ''' - def invoke(self, context, event): - wm = context.manager - wm.add_fileselect(self.__operator__) - return ('RUNNING_MODAL',) - ''' + + def execute(self, context): + + import fnmatch + if self.case_sensitive: pattern_match = fnmatch.fnmatchcase + else: pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper()) + + for ob in context.visible_objects: + if pattern_match(ob.name, self.pattern): + ob.selected = True + elif not self.extend: + ob.selected = False + + return ('FINISHED',) + + # TODO - python cant do popups yet + ''' + def invoke(self, context, event): + wm = context.manager + wm.add_fileselect(self.__operator__) + return ('RUNNING_MODAL',) + ''' bpy.types.register(VIEW3D_HT_header) # Header diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index df4cf6dcbaf..ed58b6d486a 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -2,685 +2,685 @@ import bpy class View3DPanel(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'TOOLS' + bl_space_type = 'VIEW_3D' + bl_region_type = 'TOOLS' # ********** default tools for objectmode **************** class VIEW3D_PT_tools_objectmode(View3DPanel): - bl_context = "objectmode" - bl_label = "Object Tools" + bl_context = "objectmode" + bl_label = "Object Tools" - def draw(self, context): - layout = self.layout - - col = layout.column(align=True) - col.itemL(text="Transform:") - col.itemO("tfm.translate") - col.itemO("tfm.rotate") - col.itemO("tfm.resize", text="Scale") - - col = layout.column(align=True) - col.itemL(text="Object:") - col.itemO("object.duplicate_move") - col.itemO("object.delete") - - active_object= context.active_object - if active_object and active_object.type == 'MESH': - - col = layout.column(align=True) - col.itemL(text="Shading:") - col.itemO("object.shade_smooth", text="Smooth") - col.itemO("object.shade_flat", text="Flat") - - col = layout.column(align=True) - col.itemL(text="Keyframes:") - col.itemO("anim.insert_keyframe_menu", text="Insert") - col.itemO("anim.delete_keyframe_v3d", text="Remove") - - col = layout.column(align=True) - col.itemL(text="Grease Pencil:") - col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") - col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") - col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") + def draw(self, context): + layout = self.layout + + col = layout.column(align=True) + col.itemL(text="Transform:") + col.itemO("tfm.translate") + col.itemO("tfm.rotate") + col.itemO("tfm.resize", text="Scale") + + col = layout.column(align=True) + col.itemL(text="Object:") + col.itemO("object.duplicate_move") + col.itemO("object.delete") + + active_object= context.active_object + if active_object and active_object.type == 'MESH': + + col = layout.column(align=True) + col.itemL(text="Shading:") + col.itemO("object.shade_smooth", text="Smooth") + col.itemO("object.shade_flat", text="Flat") + + col = layout.column(align=True) + col.itemL(text="Keyframes:") + col.itemO("anim.insert_keyframe_menu", text="Insert") + col.itemO("anim.delete_keyframe_v3d", text="Remove") + + col = layout.column(align=True) + col.itemL(text="Grease Pencil:") + col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") + col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") + col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") # ********** default tools for editmode_mesh **************** class VIEW3D_PT_tools_meshedit(View3DPanel): - bl_context = "mesh_edit" - bl_label = "Mesh Tools" + bl_context = "mesh_edit" + bl_label = "Mesh Tools" + + def draw(self, context): + layout = self.layout + + col = layout.column(align=True) + col.itemL(text="Transform:") + col.itemO("tfm.translate") + col.itemO("tfm.rotate") + col.itemO("tfm.resize", text="Scale") + + col = layout.column(align=True) + col.itemL(text="Mesh:") + col.itemO("mesh.duplicate_move") + col.itemO("mesh.delete") + + col = layout.column(align=True) + col.itemL(text="Modeling:") + col.itemO("mesh.extrude_move") + col.itemO("mesh.subdivide") + col.itemO("mesh.loopcut") + col.itemO("mesh.spin") + col.itemO("mesh.screw") + col.itemO("mesh.merge") + col.itemO("mesh.rip_move") + + col = layout.column(align=True) + col.itemL(text="Shading:") + col.itemO("mesh.faces_shade_smooth", text="Smooth") + col.itemO("mesh.faces_shade_flat", text="Flat") + + col = layout.column(align=True) + col.itemL(text="UV Mapping:") + col.itemO("uv.mapping_menu", text="Unwrap") + col.itemO("mesh.uvs_rotate") + col.itemO("mesh.uvs_mirror") + + col = layout.column(align=True) + col.itemL(text="Grease Pencil:") + col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") + col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") + col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") - def draw(self, context): - layout = self.layout - - col = layout.column(align=True) - col.itemL(text="Transform:") - col.itemO("tfm.translate") - col.itemO("tfm.rotate") - col.itemO("tfm.resize", text="Scale") - - col = layout.column(align=True) - col.itemL(text="Mesh:") - col.itemO("mesh.duplicate_move") - col.itemO("mesh.delete") - - col = layout.column(align=True) - col.itemL(text="Modeling:") - col.itemO("mesh.extrude_move") - col.itemO("mesh.subdivide") - col.itemO("mesh.loopcut") - col.itemO("mesh.spin") - col.itemO("mesh.screw") - col.itemO("mesh.merge") - col.itemO("mesh.rip_move") - - col = layout.column(align=True) - col.itemL(text="Shading:") - col.itemO("mesh.faces_shade_smooth", text="Smooth") - col.itemO("mesh.faces_shade_flat", text="Flat") - - col = layout.column(align=True) - col.itemL(text="UV Mapping:") - col.itemO("uv.mapping_menu", text="Unwrap") - col.itemO("mesh.uvs_rotate") - col.itemO("mesh.uvs_mirror") - - col = layout.column(align=True) - col.itemL(text="Grease Pencil:") - col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") - col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") - col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") - class VIEW3D_PT_tools_meshedit_options(View3DPanel): - bl_context = "mesh_edit" - bl_label = "Mesh Options" + bl_context = "mesh_edit" + bl_label = "Mesh Options" - def draw(self, context): - layout = self.layout - - mesh = context.active_object.data - - col = layout.column(align=True) - col.itemR(mesh, "use_mirror_x") + def draw(self, context): + layout = self.layout + + mesh = context.active_object.data + + col = layout.column(align=True) + col.itemR(mesh, "use_mirror_x") # ********** default tools for editmode_curve **************** class VIEW3D_PT_tools_curveedit(View3DPanel): - bl_context = "curve_edit" - bl_label = "Curve Tools" + bl_context = "curve_edit" + bl_label = "Curve Tools" - def draw(self, context): - layout = self.layout - - col = layout.column(align=True) - col.itemL(text="Transform:") - col.itemO("tfm.translate") - col.itemO("tfm.rotate") - col.itemO("tfm.resize", text="Scale") + def draw(self, context): + layout = self.layout - col = layout.column(align=True) - col.itemL(text="Curve:") - col.itemO("curve.duplicate") - col.itemO("curve.delete") - col.itemO("curve.cyclic_toggle") - col.itemO("curve.switch_direction") - col.itemO("curve.spline_type_set") - - col = layout.column(align=True) - col.itemL(text="Handles:") - col.item_enumO("curve.handle_type_set", "type", 'AUTOMATIC') - col.item_enumO("curve.handle_type_set", "type", 'VECTOR') - col.item_enumO("curve.handle_type_set", "type", 'ALIGN') - col.item_enumO("curve.handle_type_set", "type", 'FREE_ALIGN') - - col = layout.column(align=True) - col.itemL(text="Modeling:") - col.itemO("curve.extrude") - col.itemO("curve.subdivide") - - col = layout.column(align=True) - col.itemL(text="Grease Pencil:") - col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") - col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") - col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") + col = layout.column(align=True) + col.itemL(text="Transform:") + col.itemO("tfm.translate") + col.itemO("tfm.rotate") + col.itemO("tfm.resize", text="Scale") + + col = layout.column(align=True) + col.itemL(text="Curve:") + col.itemO("curve.duplicate") + col.itemO("curve.delete") + col.itemO("curve.cyclic_toggle") + col.itemO("curve.switch_direction") + col.itemO("curve.spline_type_set") + + col = layout.column(align=True) + col.itemL(text="Handles:") + col.item_enumO("curve.handle_type_set", "type", 'AUTOMATIC') + col.item_enumO("curve.handle_type_set", "type", 'VECTOR') + col.item_enumO("curve.handle_type_set", "type", 'ALIGN') + col.item_enumO("curve.handle_type_set", "type", 'FREE_ALIGN') + + col = layout.column(align=True) + col.itemL(text="Modeling:") + col.itemO("curve.extrude") + col.itemO("curve.subdivide") + + col = layout.column(align=True) + col.itemL(text="Grease Pencil:") + col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") + col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") + col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") # ********** default tools for editmode_surface **************** class VIEW3D_PT_tools_surfaceedit(View3DPanel): - bl_context = "surface_edit" - bl_label = "Surface Tools" + bl_context = "surface_edit" + bl_label = "Surface Tools" - def draw(self, context): - layout = self.layout - - col = layout.column(align=True) - col.itemL(text="Transform:") - col.itemO("tfm.translate") - col.itemO("tfm.rotate") - col.itemO("tfm.resize", text="Scale") - - col = layout.column(align=True) - col.itemL(text="Curve:") - col.itemO("curve.duplicate") - col.itemO("curve.delete") - col.itemO("curve.cyclic_toggle") - col.itemO("curve.switch_direction") - - col = layout.column(align=True) - col.itemL(text="Modeling:") - col.itemO("curve.extrude") - col.itemO("curve.subdivide") - - col = layout.column(align=True) - col.itemL(text="Grease Pencil:") - col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") - col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") - col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") + def draw(self, context): + layout = self.layout + + col = layout.column(align=True) + col.itemL(text="Transform:") + col.itemO("tfm.translate") + col.itemO("tfm.rotate") + col.itemO("tfm.resize", text="Scale") + + col = layout.column(align=True) + col.itemL(text="Curve:") + col.itemO("curve.duplicate") + col.itemO("curve.delete") + col.itemO("curve.cyclic_toggle") + col.itemO("curve.switch_direction") + + col = layout.column(align=True) + col.itemL(text="Modeling:") + col.itemO("curve.extrude") + col.itemO("curve.subdivide") + + col = layout.column(align=True) + col.itemL(text="Grease Pencil:") + col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") + col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") + col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") # ********** default tools for editmode_text **************** class VIEW3D_PT_tools_textedit(View3DPanel): - bl_context = "text_edit" - bl_label = "Text Tools" + bl_context = "text_edit" + bl_label = "Text Tools" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - col = layout.column(align=True) - col.itemL(text="Text Edit:") - col.itemO("font.text_copy", text="Copy") - col.itemO("font.text_cut", text="Cut") - col.itemO("font.text_paste", text="Paste") - - col = layout.column(align=True) - col.itemL(text="Style:") - col.itemO("font.case_set") - col.itemO("font.style_toggle") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") + col = layout.column(align=True) + col.itemL(text="Text Edit:") + col.itemO("font.text_copy", text="Copy") + col.itemO("font.text_cut", text="Cut") + col.itemO("font.text_paste", text="Paste") + + col = layout.column(align=True) + col.itemL(text="Style:") + col.itemO("font.case_set") + col.itemO("font.style_toggle") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") # ********** default tools for editmode_armature **************** class VIEW3D_PT_tools_armatureedit(View3DPanel): - bl_context = "armature_edit" - bl_label = "Armature Tools" + bl_context = "armature_edit" + bl_label = "Armature Tools" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - col = layout.column(align=True) - col.itemL(text="Transform:") - col.itemO("tfm.translate") - col.itemO("tfm.rotate") - col.itemO("tfm.resize", text="Scale") + col = layout.column(align=True) + col.itemL(text="Transform:") + col.itemO("tfm.translate") + col.itemO("tfm.rotate") + col.itemO("tfm.resize", text="Scale") + + col = layout.column(align=True) + col.itemL(text="Bones:") + col.itemO("armature.bone_primitive_add", text="Add") + col.itemO("armature.duplicate_move", text="Duplicate") + col.itemO("armature.delete", text="Delete") + + col = layout.column(align=True) + col.itemL(text="Modeling:") + col.itemO("armature.extrude_move") + + col = layout.column(align=True) + col.itemL(text="Grease Pencil:") + col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") + col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") + col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") - col = layout.column(align=True) - col.itemL(text="Bones:") - col.itemO("armature.bone_primitive_add", text="Add") - col.itemO("armature.duplicate_move", text="Duplicate") - col.itemO("armature.delete", text="Delete") - - col = layout.column(align=True) - col.itemL(text="Modeling:") - col.itemO("armature.extrude_move") - - col = layout.column(align=True) - col.itemL(text="Grease Pencil:") - col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") - col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") - col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") - class VIEW3D_PT_tools_armatureedit_options(View3DPanel): - bl_context = "armature_edit" - bl_label = "Armature Options" + bl_context = "armature_edit" + bl_label = "Armature Options" - def draw(self, context): - layout = self.layout - - arm = context.active_object.data + def draw(self, context): + layout = self.layout - col = layout.column(align=True) - col.itemR(arm, "x_axis_mirror") + arm = context.active_object.data + + col = layout.column(align=True) + col.itemR(arm, "x_axis_mirror") # ********** default tools for editmode_mball **************** class VIEW3D_PT_tools_mballedit(View3DPanel): - bl_context = "mball_edit" - bl_label = "Meta Tools" + bl_context = "mball_edit" + bl_label = "Meta Tools" - def draw(self, context): - layout = self.layout - - col = layout.column(align=True) - col.itemL(text="Transform:") - col.itemO("tfm.translate") - col.itemO("tfm.rotate") - col.itemO("tfm.resize", text="Scale") - - col = layout.column(align=True) - col.itemL(text="Grease Pencil:") - col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") - col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") - col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") + def draw(self, context): + layout = self.layout + + col = layout.column(align=True) + col.itemL(text="Transform:") + col.itemO("tfm.translate") + col.itemO("tfm.rotate") + col.itemO("tfm.resize", text="Scale") + + col = layout.column(align=True) + col.itemL(text="Grease Pencil:") + col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") + col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") + col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") # ********** default tools for editmode_lattice **************** class VIEW3D_PT_tools_latticeedit(View3DPanel): - bl_context = "lattice_edit" - bl_label = "Lattice Tools" + bl_context = "lattice_edit" + bl_label = "Lattice Tools" - def draw(self, context): - layout = self.layout - - col = layout.column(align=True) - col.itemL(text="Transform:") - col.itemO("tfm.translate") - col.itemO("tfm.rotate") - col.itemO("tfm.resize", text="Scale") - - col = layout.column(align=True) - col.itemL(text="Grease Pencil:") - col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") - col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") - col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") + def draw(self, context): + layout = self.layout + + col = layout.column(align=True) + col.itemL(text="Transform:") + col.itemO("tfm.translate") + col.itemO("tfm.rotate") + col.itemO("tfm.resize", text="Scale") + + col = layout.column(align=True) + col.itemL(text="Grease Pencil:") + col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") + col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") + col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") # ********** default tools for posemode **************** class VIEW3D_PT_tools_posemode(View3DPanel): - bl_context = "posemode" - bl_label = "Pose Tools" + bl_context = "posemode" + bl_label = "Pose Tools" + + def draw(self, context): + layout = self.layout + + col = layout.column(align=True) + col.itemL(text="Transform:") + col.itemO("tfm.translate") + col.itemO("tfm.rotate") + col.itemO("tfm.resize", text="Scale") + + col = layout.column(align=True) + col.itemL(text="Bones:") + col.itemO("pose.hide", text="Hide") + col.itemO("pose.reveal", text="Reveal") + + col = layout.column(align=True) + col.itemL(text="Keyframes:") + col.itemO("anim.insert_keyframe_menu", text="Insert") + col.itemO("anim.delete_keyframe_v3d", text="Remove") + + col = layout.column(align=True) + col.itemL(text="Pose:") + col.itemO("pose.copy", text="Copy") + col.itemO("pose.paste", text="Paste") + col.itemO("poselib.pose_add", text="Add To Library") + col.itemO("poselib.browse_interactive", text="Browse Library") + + col = layout.column(align=True) + col.itemL(text="In-Between:") + col.itemO("pose.relax", text="Relax") + col.itemO("pose.push", text="Push") + col.itemO("pose.breakdown", text="Breakdowner") + + col = layout.column(align=True) + col.itemL(text="Grease Pencil:") + col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") + col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") + col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") + + col = layout.column(align=True) + col.itemL(text="Repeat:") + col.itemO("screen.repeat_last") + col.itemO("screen.repeat_history", text="History...") + col.itemO("screen.redo_last", text="Tweak...") - def draw(self, context): - layout = self.layout - - col = layout.column(align=True) - col.itemL(text="Transform:") - col.itemO("tfm.translate") - col.itemO("tfm.rotate") - col.itemO("tfm.resize", text="Scale") - - col = layout.column(align=True) - col.itemL(text="Bones:") - col.itemO("pose.hide", text="Hide") - col.itemO("pose.reveal", text="Reveal") - - col = layout.column(align=True) - col.itemL(text="Keyframes:") - col.itemO("anim.insert_keyframe_menu", text="Insert") - col.itemO("anim.delete_keyframe_v3d", text="Remove") - - col = layout.column(align=True) - col.itemL(text="Pose:") - col.itemO("pose.copy", text="Copy") - col.itemO("pose.paste", text="Paste") - col.itemO("poselib.pose_add", text="Add To Library") - col.itemO("poselib.browse_interactive", text="Browse Library") - - col = layout.column(align=True) - col.itemL(text="In-Between:") - col.itemO("pose.relax", text="Relax") - col.itemO("pose.push", text="Push") - col.itemO("pose.breakdown", text="Breakdowner") - - col = layout.column(align=True) - col.itemL(text="Grease Pencil:") - col.item_enumO("gpencil.draw", "mode", 'DRAW', text="Draw Freehand") - col.item_enumO("gpencil.draw", "mode", 'DRAW_STRAIGHT', text="Straight Line") - col.item_enumO("gpencil.draw", "mode", 'ERASER', text="Eraser") - - col = layout.column(align=True) - col.itemL(text="Repeat:") - col.itemO("screen.repeat_last") - col.itemO("screen.repeat_history", text="History...") - col.itemO("screen.redo_last", text="Tweak...") - class VIEW3D_PT_tools_posemode_options(View3DPanel): - bl_context = "posemode" - bl_label = "Pose Options" + bl_context = "posemode" + bl_label = "Pose Options" - def draw(self, context): - layout = self.layout - - arm = context.active_object.data + def draw(self, context): + layout = self.layout - col = layout.column(align=True) - col.itemR(arm, "x_axis_mirror") - col.itemR(arm, "auto_ik") + arm = context.active_object.data + + col = layout.column(align=True) + col.itemR(arm, "x_axis_mirror") + col.itemR(arm, "auto_ik") # ********** default tools for paint modes **************** class PaintPanel(bpy.types.Panel): - bl_space_type = 'VIEW_3D' - bl_region_type = 'TOOLS' + bl_space_type = 'VIEW_3D' + bl_region_type = 'TOOLS' - def paint_settings(self, context): - ts = context.tool_settings + def paint_settings(self, context): + ts = context.tool_settings - if context.sculpt_object: - return ts.sculpt - elif context.vertex_paint_object: - return ts.vertex_paint - elif context.weight_paint_object: - return ts.weight_paint - elif context.texture_paint_object: - return ts.image_paint - elif context.particle_edit_object: - return ts.particle_edit + if context.sculpt_object: + return ts.sculpt + elif context.vertex_paint_object: + return ts.vertex_paint + elif context.weight_paint_object: + return ts.weight_paint + elif context.texture_paint_object: + return ts.image_paint + elif context.particle_edit_object: + return ts.particle_edit - return False + return False class VIEW3D_PT_tools_brush(PaintPanel): - bl_label = "Brush" + bl_label = "Brush" - def poll(self, context): - return self.paint_settings(context) + def poll(self, context): + return self.paint_settings(context) - def draw(self, context): - layout = self.layout - - settings = self.paint_settings(context) - brush = settings.brush + def draw(self, context): + layout = self.layout - if not context.particle_edit_object: - col = layout.split().column() - row = col.row() - row.template_list(settings, "brushes", settings, "active_brush_index", rows=2) - - col.template_ID(settings, "brush", new="brush.add") - - # Particle Mode # + settings = self.paint_settings(context) + brush = settings.brush - # XXX This needs a check if psys is editable. - if context.particle_edit_object: - # XXX Select Particle System - layout.column().itemR(settings, "tool", expand=True) - - if settings.tool != 'NONE': - col = layout.column() - col.itemR(brush, "size", slider=True) - col.itemR(brush, "strength", slider=True) - - if settings.tool == 'ADD': - col = layout.column() - col.itemR(settings, "add_interpolate") - sub = col.column(align=True) - sub.active = settings.add_interpolate - sub.itemR(brush, "steps", slider=True) - sub.itemR(settings, "add_keys", slider=True) - elif settings.tool == 'LENGTH': - layout.itemR(brush, "length_mode", expand=True) - elif settings.tool == 'PUFF': - layout.itemR(brush, "puff_mode", expand=True) + if not context.particle_edit_object: + col = layout.split().column() + row = col.row() + row.template_list(settings, "brushes", settings, "active_brush_index", rows=2) - # Sculpt Mode # + col.template_ID(settings, "brush", new="brush.add") - elif context.sculpt_object and brush: - col = layout.column() - col.itemS() - col.itemR(brush, "sculpt_tool", expand=True) - col.itemS() - - row = col.row(align=True) - row.itemR(brush, "size", slider=True) - row.itemR(brush, "use_size_pressure", toggle=True, text="") - - if brush.sculpt_tool != 'GRAB': - row = col.row(align=True) - row.itemR(brush, "strength", slider=True) - row.itemR(brush, "use_strength_pressure", text="") - - ''' # XXX - TODO - row = col.row(align=True) - row.itemR(brush, "jitter", slider=True) - row.itemR(brush, "use_jitter_pressure", toggle=True, text="") - ''' - col = layout.column() + # Particle Mode # - if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'): - col.row().itemR(brush, "direction", expand=True) + # XXX This needs a check if psys is editable. + if context.particle_edit_object: + # XXX Select Particle System + layout.column().itemR(settings, "tool", expand=True) - if brush.sculpt_tool == 'LAYER': - col.itemR(brush, "persistent") - col.itemO("sculpt.set_persistent_base") + if settings.tool != 'NONE': + col = layout.column() + col.itemR(brush, "size", slider=True) + col.itemR(brush, "strength", slider=True) - # Texture Paint Mode # - - elif context.texture_paint_object and brush: - col = layout.column(align=True) - col.item_enumR(settings, "tool", 'DRAW') - col.item_enumR(settings, "tool", 'SOFTEN') - col.item_enumR(settings, "tool", 'CLONE') - col.item_enumR(settings, "tool", 'SMEAR') - - col = layout.column() - col.itemR(brush, "color", text="") + if settings.tool == 'ADD': + col = layout.column() + col.itemR(settings, "add_interpolate") + sub = col.column(align=True) + sub.active = settings.add_interpolate + sub.itemR(brush, "steps", slider=True) + sub.itemR(settings, "add_keys", slider=True) + elif settings.tool == 'LENGTH': + layout.itemR(brush, "length_mode", expand=True) + elif settings.tool == 'PUFF': + layout.itemR(brush, "puff_mode", expand=True) - row = col.row(align=True) - row.itemR(brush, "size", slider=True) - row.itemR(brush, "use_size_pressure", toggle=True, text="") - - row = col.row(align=True) - row.itemR(brush, "strength", slider=True) - row.itemR(brush, "use_strength_pressure", toggle=True, text="") - - row = col.row(align=True) - row.itemR(brush, "jitter", slider=True) - row.itemR(brush, "use_jitter_pressure", toggle=True, text="") - - col.itemR(brush, "blend", text="Blend") - - # Weight Paint Mode # - - elif context.weight_paint_object and brush: - layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True) - layout.itemR(context.tool_settings, "auto_normalize", text="Auto Normalize") - - col = layout.column() - row = col.row(align=True) - row.itemR(brush, "size", slider=True) - row.itemR(brush, "use_size_pressure", toggle=True, text="") - - row = col.row(align=True) - row.itemR(brush, "strength", slider=True) - row.itemR(brush, "use_strength_pressure", toggle=True, text="") - - row = col.row(align=True) - row.itemR(brush, "jitter", slider=True) - row.itemR(brush, "use_jitter_pressure", toggle=True, text="") - - # Vertex Paint Mode # - - elif context.vertex_paint_object and brush: - col = layout.column() - col.itemR(brush, "color", text="") - - row = col.row(align=True) - row.itemR(brush, "size", slider=True) - row.itemR(brush, "use_size_pressure", toggle=True, text="") - - row = col.row(align=True) - row.itemR(brush, "strength", slider=True) - row.itemR(brush, "use_strength_pressure", toggle=True, text="") - - ''' # XXX - TODO - row = col.row(align=True) - row.itemR(brush, "jitter", slider=True) - row.itemR(brush, "use_jitter_pressure", toggle=True, text="") - ''' + # Sculpt Mode # + + elif context.sculpt_object and brush: + col = layout.column() + col.itemS() + col.itemR(brush, "sculpt_tool", expand=True) + col.itemS() + + row = col.row(align=True) + row.itemR(brush, "size", slider=True) + row.itemR(brush, "use_size_pressure", toggle=True, text="") + + if brush.sculpt_tool != 'GRAB': + row = col.row(align=True) + row.itemR(brush, "strength", slider=True) + row.itemR(brush, "use_strength_pressure", text="") + + ''' # XXX - TODO + row = col.row(align=True) + row.itemR(brush, "jitter", slider=True) + row.itemR(brush, "use_jitter_pressure", toggle=True, text="") + ''' + col = layout.column() + + if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'): + col.row().itemR(brush, "direction", expand=True) + + if brush.sculpt_tool == 'LAYER': + col.itemR(brush, "persistent") + col.itemO("sculpt.set_persistent_base") + + # Texture Paint Mode # + + elif context.texture_paint_object and brush: + col = layout.column(align=True) + col.item_enumR(settings, "tool", 'DRAW') + col.item_enumR(settings, "tool", 'SOFTEN') + col.item_enumR(settings, "tool", 'CLONE') + col.item_enumR(settings, "tool", 'SMEAR') + + col = layout.column() + col.itemR(brush, "color", text="") + + row = col.row(align=True) + row.itemR(brush, "size", slider=True) + row.itemR(brush, "use_size_pressure", toggle=True, text="") + + row = col.row(align=True) + row.itemR(brush, "strength", slider=True) + row.itemR(brush, "use_strength_pressure", toggle=True, text="") + + row = col.row(align=True) + row.itemR(brush, "jitter", slider=True) + row.itemR(brush, "use_jitter_pressure", toggle=True, text="") + + col.itemR(brush, "blend", text="Blend") + + # Weight Paint Mode # + + elif context.weight_paint_object and brush: + layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True) + layout.itemR(context.tool_settings, "auto_normalize", text="Auto Normalize") + + col = layout.column() + row = col.row(align=True) + row.itemR(brush, "size", slider=True) + row.itemR(brush, "use_size_pressure", toggle=True, text="") + + row = col.row(align=True) + row.itemR(brush, "strength", slider=True) + row.itemR(brush, "use_strength_pressure", toggle=True, text="") + + row = col.row(align=True) + row.itemR(brush, "jitter", slider=True) + row.itemR(brush, "use_jitter_pressure", toggle=True, text="") + + # Vertex Paint Mode # + + elif context.vertex_paint_object and brush: + col = layout.column() + col.itemR(brush, "color", text="") + + row = col.row(align=True) + row.itemR(brush, "size", slider=True) + row.itemR(brush, "use_size_pressure", toggle=True, text="") + + row = col.row(align=True) + row.itemR(brush, "strength", slider=True) + row.itemR(brush, "use_strength_pressure", toggle=True, text="") + + ''' # XXX - TODO + row = col.row(align=True) + row.itemR(brush, "jitter", slider=True) + row.itemR(brush, "use_jitter_pressure", toggle=True, text="") + ''' class VIEW3D_PT_tools_brush_stroke(PaintPanel): - bl_label = "Stroke" - bl_default_closed = True + bl_label = "Stroke" + bl_default_closed = True - def poll(self, context): - settings = self.paint_settings(context) - return (settings and settings.brush and (context.sculpt_object or - context.vertex_paint_object or - context.weight_paint_object or - context.texture_paint_object)) + def poll(self, context): + settings = self.paint_settings(context) + return (settings and settings.brush and (context.sculpt_object or + context.vertex_paint_object or + context.weight_paint_object or + context.texture_paint_object)) - def draw(self, context): - layout = self.layout - - settings = self.paint_settings(context) - brush = settings.brush - texture_paint = context.texture_paint_object + def draw(self, context): + layout = self.layout - if context.sculpt_object: - if brush.sculpt_tool != 'LAYER': - layout.itemR(brush, "use_anchor") - layout.itemR(brush, "use_rake") + settings = self.paint_settings(context) + brush = settings.brush + texture_paint = context.texture_paint_object - layout.itemR(brush, "use_airbrush") - col = layout.column() - col.active = brush.use_airbrush - col.itemR(brush, "rate", slider=True) + if context.sculpt_object: + if brush.sculpt_tool != 'LAYER': + layout.itemR(brush, "use_anchor") + layout.itemR(brush, "use_rake") - if not texture_paint: - layout.itemR(brush, "use_smooth_stroke") - col = layout.column() - col.active = brush.use_smooth_stroke - col.itemR(brush, "smooth_stroke_radius", text="Radius", slider=True) - col.itemR(brush, "smooth_stroke_factor", text="Factor", slider=True) + layout.itemR(brush, "use_airbrush") + col = layout.column() + col.active = brush.use_airbrush + col.itemR(brush, "rate", slider=True) - layout.itemR(brush, "use_space") - row = layout.row(align=True) - row.active = brush.use_space - row.itemR(brush, "spacing", text="Distance", slider=True) - if texture_paint: - row.itemR(brush, "use_spacing_pressure", toggle=True, text="") + if not texture_paint: + layout.itemR(brush, "use_smooth_stroke") + col = layout.column() + col.active = brush.use_smooth_stroke + col.itemR(brush, "smooth_stroke_radius", text="Radius", slider=True) + col.itemR(brush, "smooth_stroke_factor", text="Factor", slider=True) + + layout.itemR(brush, "use_space") + row = layout.row(align=True) + row.active = brush.use_space + row.itemR(brush, "spacing", text="Distance", slider=True) + if texture_paint: + row.itemR(brush, "use_spacing_pressure", toggle=True, text="") class VIEW3D_PT_tools_brush_curve(PaintPanel): - bl_label = "Curve" - bl_default_closed = True + bl_label = "Curve" + bl_default_closed = True - def poll(self, context): - settings = self.paint_settings(context) - return (settings and settings.brush and settings.brush.curve) + def poll(self, context): + settings = self.paint_settings(context) + return (settings and settings.brush and settings.brush.curve) - def draw(self, context): - layout = self.layout - - settings = self.paint_settings(context) - brush = settings.brush + def draw(self, context): + layout = self.layout + + settings = self.paint_settings(context) + brush = settings.brush + + layout.template_curve_mapping(brush, "curve") + layout.item_menu_enumO("brush.curve_preset", property="shape") - layout.template_curve_mapping(brush, "curve") - layout.item_menu_enumO("brush.curve_preset", property="shape") - class VIEW3D_PT_sculpt_options(PaintPanel): - bl_label = "Options" + bl_label = "Options" - def poll(self, context): - return context.sculpt_object + def poll(self, context): + return context.sculpt_object - def draw(self, context): - layout = self.layout - - sculpt = context.tool_settings.sculpt + def draw(self, context): + layout = self.layout - col = layout.column() - col.itemR(sculpt, "partial_redraw", text="Partial Refresh") - col.itemR(sculpt, "show_brush") + sculpt = context.tool_settings.sculpt - split = self.layout.split() - - col = split.column() - col.itemL(text="Symmetry:") - col.itemR(sculpt, "symmetry_x", text="X") - col.itemR(sculpt, "symmetry_y", text="Y") - col.itemR(sculpt, "symmetry_z", text="Z") - - col = split.column() - col.itemL(text="Lock:") - col.itemR(sculpt, "lock_x", text="X") - col.itemR(sculpt, "lock_y", text="Y") - col.itemR(sculpt, "lock_z", text="Z") + col = layout.column() + col.itemR(sculpt, "partial_redraw", text="Partial Refresh") + col.itemR(sculpt, "show_brush") + + split = self.layout.split() + + col = split.column() + col.itemL(text="Symmetry:") + col.itemR(sculpt, "symmetry_x", text="X") + col.itemR(sculpt, "symmetry_y", text="Y") + col.itemR(sculpt, "symmetry_z", text="Z") + + col = split.column() + col.itemL(text="Lock:") + col.itemR(sculpt, "lock_x", text="X") + col.itemR(sculpt, "lock_y", text="Y") + col.itemR(sculpt, "lock_z", text="Z") # ********** default tools for weightpaint **************** class VIEW3D_PT_tools_weightpaint(View3DPanel): - bl_context = "weightpaint" - bl_label = "Weight Tools" + bl_context = "weightpaint" + bl_label = "Weight Tools" - def draw(self, context): - layout = self.layout - - wpaint = context.tool_settings.weight_paint + def draw(self, context): + layout = self.layout - col = layout.column() - # col.itemL(text="Blend:") - col.itemO("object.vertex_group_normalize_all", text="Normalize All") - col.itemO("object.vertex_group_normalize", text="Normalize") - col.itemO("object.vertex_group_invert", text="Invert") - col.itemO("object.vertex_group_clean", text="Clean") + wpaint = context.tool_settings.weight_paint + + col = layout.column() + # col.itemL(text="Blend:") + col.itemO("object.vertex_group_normalize_all", text="Normalize All") + col.itemO("object.vertex_group_normalize", text="Normalize") + col.itemO("object.vertex_group_invert", text="Invert") + col.itemO("object.vertex_group_clean", text="Clean") class VIEW3D_PT_tools_weightpaint_options(View3DPanel): - bl_context = "weightpaint" - bl_label = "Options" + bl_context = "weightpaint" + bl_label = "Options" - def draw(self, context): - layout = self.layout - - wpaint = context.tool_settings.weight_paint + def draw(self, context): + layout = self.layout - col = layout.column() - col.itemL(text="Blend:") - col.itemR(wpaint, "mode", text="") - col.itemR(wpaint, "all_faces") - col.itemR(wpaint, "normals") - col.itemR(wpaint, "spray") - col.itemR(wpaint, "vertex_dist", text="Distance") - - - data = context.weight_paint_object.data - if type(data) == bpy.types.Mesh: - col.itemR(data, "use_mirror_x") + wpaint = context.tool_settings.weight_paint + + col = layout.column() + col.itemL(text="Blend:") + col.itemR(wpaint, "mode", text="") + col.itemR(wpaint, "all_faces") + col.itemR(wpaint, "normals") + col.itemR(wpaint, "spray") + col.itemR(wpaint, "vertex_dist", text="Distance") + + + data = context.weight_paint_object.data + if type(data) == bpy.types.Mesh: + col.itemR(data, "use_mirror_x") # Commented out because the Apply button isn't an operator yet, making these settings useless # col.itemL(text="Gamma:") @@ -694,21 +694,21 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel): # ********** default tools for vertexpaint **************** class VIEW3D_PT_tools_vertexpaint(View3DPanel): - bl_context = "vertexpaint" - bl_label = "Options" + bl_context = "vertexpaint" + bl_label = "Options" - def draw(self, context): - layout = self.layout - - vpaint = context.tool_settings.vertex_paint + def draw(self, context): + layout = self.layout - col = layout.column() - col.itemL(text="Blend:") - col.itemR(vpaint, "mode", text="") - col.itemR(vpaint, "all_faces") - col.itemR(vpaint, "normals") - col.itemR(vpaint, "spray") - col.itemR(vpaint, "vertex_dist", text="Distance") + vpaint = context.tool_settings.vertex_paint + + col = layout.column() + col.itemL(text="Blend:") + col.itemR(vpaint, "mode", text="") + col.itemR(vpaint, "all_faces") + col.itemR(vpaint, "normals") + col.itemR(vpaint, "spray") + col.itemR(vpaint, "vertex_dist", text="Distance") # Commented out because the Apply button isn't an operator yet, making these settings useless # col.itemL(text="Gamma:") # col.itemR(vpaint, "gamma", text="") @@ -719,118 +719,118 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel): # ********** default tools for texturepaint **************** class VIEW3D_PT_tools_projectpaint(View3DPanel): - bl_context = "texturepaint" - bl_label = "Project Paint" + bl_context = "texturepaint" + bl_label = "Project Paint" - def poll(self, context): - return context.tool_settings.image_paint.tool != 'SMEAR' + def poll(self, context): + return context.tool_settings.image_paint.tool != 'SMEAR' - def draw_header(self, context): - ipaint = context.tool_settings.image_paint - - self.layout.itemR(ipaint, "use_projection", text="") + def draw_header(self, context): + ipaint = context.tool_settings.image_paint - def draw(self, context): - layout = self.layout - - ipaint = context.tool_settings.image_paint - settings = context.tool_settings.image_paint - use_projection= ipaint.use_projection - - col = layout.column() - sub = col.column() - sub.active = use_projection - sub.itemR(ipaint, "use_occlude") - sub.itemR(ipaint, "use_backface_cull") - - split = layout.split() - - col = split.column() - col.active = (use_projection) - col.itemR(ipaint, "use_normal_falloff") - - col = split.column() - col.active = (ipaint.use_normal_falloff and use_projection) - col.itemR(ipaint, "normal_angle", text="") + self.layout.itemR(ipaint, "use_projection", text="") - split = layout.split(percentage=0.7) - - col = split.column(align=False) - col.active = (use_projection) - col.itemR(ipaint, "use_stencil_layer") - - col = split.column(align=False) - col.active = (use_projection and ipaint.use_stencil_layer) - col.itemR(ipaint, "invert_stencil", text="Inv") + def draw(self, context): + layout = self.layout + + ipaint = context.tool_settings.image_paint + settings = context.tool_settings.image_paint + use_projection= ipaint.use_projection + + col = layout.column() + sub = col.column() + sub.active = use_projection + sub.itemR(ipaint, "use_occlude") + sub.itemR(ipaint, "use_backface_cull") + + split = layout.split() + + col = split.column() + col.active = (use_projection) + col.itemR(ipaint, "use_normal_falloff") + + col = split.column() + col.active = (ipaint.use_normal_falloff and use_projection) + col.itemR(ipaint, "normal_angle", text="") + + split = layout.split(percentage=0.7) + + col = split.column(align=False) + col.active = (use_projection) + col.itemR(ipaint, "use_stencil_layer") + + col = split.column(align=False) + col.active = (use_projection and ipaint.use_stencil_layer) + col.itemR(ipaint, "invert_stencil", text="Inv") + + col = layout.column() + sub = col.column() + sub.active = (settings.tool == 'CLONE') + sub.itemR(ipaint, "use_clone_layer") + + sub = col.column() + sub.itemR(ipaint, "seam_bleed") - col = layout.column() - sub = col.column() - sub.active = (settings.tool == 'CLONE') - sub.itemR(ipaint, "use_clone_layer") - - sub = col.column() - sub.itemR(ipaint, "seam_bleed") - # ********** default tools for particle mode **************** class VIEW3D_PT_tools_particlemode(View3DPanel): - bl_context = "particlemode" - bl_label = "Options" + bl_context = "particlemode" + bl_label = "Options" - def draw(self, context): - layout = self.layout + def draw(self, context): + layout = self.layout - pe = context.tool_settings.particle_edit - ob = pe.object + pe = context.tool_settings.particle_edit + ob = pe.object - layout.itemR(pe, "type", text="") - - if pe.type == 'PARTICLES': - if ob.particle_systems: - if len(ob.particle_systems) > 1: - layout.template_list(ob, "particle_systems", ob, "active_particle_system_index", type='ICONS') - - ptcache = ob.particle_systems[ob.active_particle_system_index].point_cache - else: - for md in ob.modifiers: - if md.type==pe.type: - ptcache = md.point_cache - - if ptcache and len(ptcache.point_cache_list) > 1: - layout.template_list(ptcache, "point_cache_list", ptcache, "active_point_cache_index", type='ICONS') - - - if not pe.editable: - layout.itemL(text="Point cache must be baked") - layout.itemL(text="to enable editing!") - - col = layout.column(align=True) - if pe.hair: - col.active = pe.editable - col.itemR(pe, "emitter_deflect", text="Deflect emitter") - sub = col.row() - sub.active = pe.emitter_deflect - sub.itemR(pe, "emitter_distance", text="Distance") - - col = layout.column(align=True) - col.active = pe.editable - col.itemL(text="Keep:") - col.itemR(pe, "keep_lengths", text="Lenghts") - col.itemR(pe, "keep_root", text="Root") - if not pe.hair: - col.itemL(text="Correct:") - col.itemR(pe, "auto_velocity", text="Velocity") - - col = layout.column(align=True) - col.active = pe.editable - col.itemL(text="Draw:") - col.itemR(pe, "draw_step", text="Path Steps") - if pe.type == 'PARTICLES': - col.itemR(pe, "draw_particles", text="Particles") - col.itemR(pe, "fade_time") - sub = col.row() - sub.active = pe.fade_time - sub.itemR(pe, "fade_frames", slider=True) + layout.itemR(pe, "type", text="") + + if pe.type == 'PARTICLES': + if ob.particle_systems: + if len(ob.particle_systems) > 1: + layout.template_list(ob, "particle_systems", ob, "active_particle_system_index", type='ICONS') + + ptcache = ob.particle_systems[ob.active_particle_system_index].point_cache + else: + for md in ob.modifiers: + if md.type==pe.type: + ptcache = md.point_cache + + if ptcache and len(ptcache.point_cache_list) > 1: + layout.template_list(ptcache, "point_cache_list", ptcache, "active_point_cache_index", type='ICONS') + + + if not pe.editable: + layout.itemL(text="Point cache must be baked") + layout.itemL(text="to enable editing!") + + col = layout.column(align=True) + if pe.hair: + col.active = pe.editable + col.itemR(pe, "emitter_deflect", text="Deflect emitter") + sub = col.row() + sub.active = pe.emitter_deflect + sub.itemR(pe, "emitter_distance", text="Distance") + + col = layout.column(align=True) + col.active = pe.editable + col.itemL(text="Keep:") + col.itemR(pe, "keep_lengths", text="Lenghts") + col.itemR(pe, "keep_root", text="Root") + if not pe.hair: + col.itemL(text="Correct:") + col.itemR(pe, "auto_velocity", text="Velocity") + + col = layout.column(align=True) + col.active = pe.editable + col.itemL(text="Draw:") + col.itemR(pe, "draw_step", text="Path Steps") + if pe.type == 'PARTICLES': + col.itemR(pe, "draw_particles", text="Particles") + col.itemR(pe, "fade_time") + sub = col.row() + sub.active = pe.fade_time + sub.itemR(pe, "fade_frames", slider=True) bpy.types.register(VIEW3D_PT_tools_weightpaint) bpy.types.register(VIEW3D_PT_tools_objectmode) diff --git a/source/blender/python/epy_doc_gen.py b/source/blender/python/epy_doc_gen.py index 851eaa3b6f3..202a1df3502 100644 --- a/source/blender/python/epy_doc_gen.py +++ b/source/blender/python/epy_doc_gen.py @@ -21,17 +21,17 @@ script_help_msg = ''' Usage, run this script from blenders root path once you have compiled blender - ./blender.bin -P source/blender/python/epy_doc_gen.py + ./blender.bin -P source/blender/python/epy_doc_gen.py This will generate rna.py and bpyoperator.py in "./source/blender/python/doc/" Generate html docs by running... - epydoc source/blender/python/doc/*.py -v \\ - -o source/blender/python/doc/html \\ - --inheritance=included \\ - --no-sourcecode \\ - --graph=classtree \\ - --graph-font-size=8 + epydoc source/blender/python/doc/*.py -v \\ + -o source/blender/python/doc/html \\ + --inheritance=included \\ + --no-sourcecode \\ + --graph=classtree \\ + --graph-font-size=8 ''' @@ -47,689 +47,689 @@ INIT_SUBMODULES = {} # store initialized files INIT_SUBMODULES_IMPORTS = {} # dont import the same module twice def append_package(package_path, mod_name): - - init_path = os.path.join(os.path.dirname(package_path), "__init__.py") - - # avoid double ups - if mod_name: - imports = INIT_SUBMODULES_IMPORTS.setdefault(init_path, []) - if mod_name in imports: - return - imports.append(mod_name) - - try: - os.makedirs(os.path.dirname(init_path)) # make the dirs if they are not there - except: - pass - - # Open the new file for the first time, otherwise keep it open. - f = INIT_SUBMODULES.get(init_path) - if f == None: - f = INIT_SUBMODULES[init_path] = open(init_path, 'w') - - if mod_name: - f.write("import %s\n" % mod_name) - - return f + + init_path = os.path.join(os.path.dirname(package_path), "__init__.py") + + # avoid double ups + if mod_name: + imports = INIT_SUBMODULES_IMPORTS.setdefault(init_path, []) + if mod_name in imports: + return + imports.append(mod_name) + + try: + os.makedirs(os.path.dirname(init_path)) # make the dirs if they are not there + except: + pass + + # Open the new file for the first time, otherwise keep it open. + f = INIT_SUBMODULES.get(init_path) + if f == None: + f = INIT_SUBMODULES[init_path] = open(init_path, 'w') + + if mod_name: + f.write("import %s\n" % mod_name) + + return f def append_package_recursive(package_path, BASEPATH): - ''' - assume the last item of package_path will be a file (not a dir thats created) - ''' - - package_path = os.path.splitext(package_path)[0] # incase of .py - - try: - os.makedirs(os.path.join(BASEPATH, os.path.dirname(package_path))) # make the dirs if they are not there - except: - pass - - new_path = BASEPATH - - for mod_name in package_path.split(os.sep): - init_path = os.path.join(new_path, "__init__.py") - new_path = os.path.join(new_path, mod_name) - append_package(init_path, mod_name) + ''' + assume the last item of package_path will be a file (not a dir thats created) + ''' + + package_path = os.path.splitext(package_path)[0] # incase of .py + + try: + os.makedirs(os.path.join(BASEPATH, os.path.dirname(package_path))) # make the dirs if they are not there + except: + pass + + new_path = BASEPATH + + for mod_name in package_path.split(os.sep): + init_path = os.path.join(new_path, "__init__.py") + new_path = os.path.join(new_path, mod_name) + append_package(init_path, mod_name) def open_submodule(subpath, BASEPATH): - ''' - This is a utility function that lets us quickly add submodules - ''' - - # create all the package paths leading up to this module - append_package_recursive(subpath, BASEPATH) - - module_name = os.path.basename( os.path.splitext(subpath)[0] ) - mod_path = os.path.join(BASEPATH, subpath) - - # Open the new file for the first time, otherwise keep it open. - f = SUBMODULES.get(mod_path) - if f == None: - f = SUBMODULES[mod_path] = open(mod_path, 'w') + ''' + This is a utility function that lets us quickly add submodules + ''' - f = open(mod_path, 'w') - return f + # create all the package paths leading up to this module + append_package_recursive(subpath, BASEPATH) + + module_name = os.path.basename( os.path.splitext(subpath)[0] ) + mod_path = os.path.join(BASEPATH, subpath) + + # Open the new file for the first time, otherwise keep it open. + f = SUBMODULES.get(mod_path) + if f == None: + f = SUBMODULES[mod_path] = open(mod_path, 'w') + + f = open(mod_path, 'w') + return f def close_all(): - for files in (INIT_SUBMODULES.values(), SUBMODULES.values()): - for f in files: - if f.name.endswith('.py'): - f_name = f.name - f.close() - - f = open(f_name, 'a') - f.write("\ndel __package__\n") # annoying, no need do show this - - - f.close() + for files in (INIT_SUBMODULES.values(), SUBMODULES.values()): + for f in files: + if f.name.endswith('.py'): + f_name = f.name + f.close() + + f = open(f_name, 'a') + f.write("\ndel __package__\n") # annoying, no need do show this + + + f.close() def range_str(val): - if val < -10000000: return '-inf' - if val > 10000000: return 'inf' - if type(val)==float: - return '%g' % val - else: - return str(val) + if val < -10000000: return '-inf' + if val > 10000000: return 'inf' + if type(val)==float: + return '%g' % val + else: + return str(val) def get_array_str(length): - if length > 0: return ' array of %d items' % length - else: return '' + if length > 0: return ' array of %d items' % length + else: return '' def full_rna_struct_path(rna_struct): - ''' - Needed when referencing one struct from another - ''' - nested = rna_struct.nested - if nested: - return "%s.%s" % (full_rna_struct_path(nested), rna_struct.identifier) - else: - return rna_struct.identifier + ''' + Needed when referencing one struct from another + ''' + nested = rna_struct.nested + if nested: + return "%s.%s" % (full_rna_struct_path(nested), rna_struct.identifier) + else: + return rna_struct.identifier def rna_id_ignore(rna_id): - if rna_id == "rna_type": - return True - - if "_OT_" in rna_id: - return True - if "_MT_" in rna_id: - return True - if "_PT_" in rna_id: - return True - - return False + if rna_id == "rna_type": + return True + + if "_OT_" in rna_id: + return True + if "_MT_" in rna_id: + return True + if "_PT_" in rna_id: + return True + + return False def write_func(rna, ident, out, func_type): - # Keyword attributes - kw_args = [] # "foo = 1", "bar=0.5", "spam='ENUM'" - kw_arg_attrs = [] # "@type mode: int" - - rna_struct= rna.rna_type - - # Operators and functions work differently - if func_type=='OPERATOR': - rna_func_name = rna_struct.identifier.split("_OT_")[-1] - rna_func_desc = rna_struct.description.strip() - items = rna_struct.properties.items() - else: - rna_func_name = rna.identifier - rna_func_desc = rna.description.strip() - items = rna.parameters.items() - - - for rna_prop_identifier, rna_prop in items: - if rna_id_ignore(rna_prop_identifier): - continue - - # clear vars - val = val_error = val_str = rna_prop_type = None - - # ['rna_type', 'name', 'array_length', 'description', 'hard_max', 'hard_min', 'identifier', 'precision', 'readonly', 'soft_max', 'soft_min', 'step', 'subtype', 'type'] - #rna_prop= op_rna.rna_type.properties[attr] - rna_prop_type = rna_prop.type.lower() # enum, float, int, boolean - - - # only for rna functions, operators should not get pointers as args - if rna_prop_type=='pointer': - rna_prop_type_refine = "L{%s}" % rna_prop.fixed_type.identifier - else: - rna_prop_type_refine = rna_prop_type - - - try: length = rna_prop.array_length - except: length = 0 - - array_str = get_array_str(length) - - if rna_prop.use_return: - kw_type_str= "@rtype: %s%s" % (rna_prop_type_refine, array_str) - kw_param_str= "@return: %s" % (rna_prop.description.strip()) - else: - kw_type_str= "@type %s: %s%s" % (rna_prop_identifier, rna_prop_type_refine, array_str) - kw_param_str= "@param %s: %s" % (rna_prop_identifier, rna_prop.description.strip()) - - kw_param_set = False - - if func_type=='OPERATOR': - try: - val = getattr(rna, rna_prop_identifier) - val_error = False - except: - val = "''" - val_error = True - - - if val_error: - val_str = val - elif rna_prop_type=='float': - if length==0: - val_str= '%g' % val - if '.' not in val_str and '-' not in val_str: # value could be 1e-05 - val_str += '.0' - else: - # array - val_str = str(tuple(val)) - - kw_param_str += (' in (%s, %s)' % (range_str(rna_prop.hard_min), range_str(rna_prop.hard_max))) - kw_param_set= True - - elif rna_prop_type=='int': - if length==0: - val_str='%d' % val - else: - val_str = str(tuple(val)) - - # print(dir(rna_prop)) - kw_param_str += (' in (%s, %s)' % (range_str(rna_prop.hard_min), range_str(rna_prop.hard_max))) - # These strings dont have a max length??? - #kw_param_str += ' (maximum length of %s)' % (rna_prop.max_length) - kw_param_set= True - - elif rna_prop_type=='boolean': - if length==0: - if val: val_str='True' - else: val_str='False' - else: - val_str = str(tuple(val)) - - elif rna_prop_type=='enum': - # no array here? - val_str="'%s'" % val - # Too cramped - kw_param_str += (' in (%s)' % ', '.join(rna_prop.items.keys())) - - kw_param_set= True - - elif rna_prop_type=='string': - # no array here? - val_str='"%s"' % val - - # todo - collection - array - # print (rna_prop.type) - - kw_args.append('%s = %s' % (rna_prop_identifier, val_str)) - - # stora - else: - # currently functions dont have a default value - if not rna_prop.use_return: - kw_args.append('%s' % (rna_prop_identifier)) - else: - kw_param_set = True + # Keyword attributes + kw_args = [] # "foo = 1", "bar=0.5", "spam='ENUM'" + kw_arg_attrs = [] # "@type mode: int" + + rna_struct= rna.rna_type + + # Operators and functions work differently + if func_type=='OPERATOR': + rna_func_name = rna_struct.identifier.split("_OT_")[-1] + rna_func_desc = rna_struct.description.strip() + items = rna_struct.properties.items() + else: + rna_func_name = rna.identifier + rna_func_desc = rna.description.strip() + items = rna.parameters.items() + + + for rna_prop_identifier, rna_prop in items: + if rna_id_ignore(rna_prop_identifier): + continue + + # clear vars + val = val_error = val_str = rna_prop_type = None + + # ['rna_type', 'name', 'array_length', 'description', 'hard_max', 'hard_min', 'identifier', 'precision', 'readonly', 'soft_max', 'soft_min', 'step', 'subtype', 'type'] + #rna_prop= op_rna.rna_type.properties[attr] + rna_prop_type = rna_prop.type.lower() # enum, float, int, boolean + + + # only for rna functions, operators should not get pointers as args + if rna_prop_type=='pointer': + rna_prop_type_refine = "L{%s}" % rna_prop.fixed_type.identifier + else: + rna_prop_type_refine = rna_prop_type + + + try: length = rna_prop.array_length + except: length = 0 + + array_str = get_array_str(length) + + if rna_prop.use_return: + kw_type_str= "@rtype: %s%s" % (rna_prop_type_refine, array_str) + kw_param_str= "@return: %s" % (rna_prop.description.strip()) + else: + kw_type_str= "@type %s: %s%s" % (rna_prop_identifier, rna_prop_type_refine, array_str) + kw_param_str= "@param %s: %s" % (rna_prop_identifier, rna_prop.description.strip()) + + kw_param_set = False + + if func_type=='OPERATOR': + try: + val = getattr(rna, rna_prop_identifier) + val_error = False + except: + val = "''" + val_error = True + + + if val_error: + val_str = val + elif rna_prop_type=='float': + if length==0: + val_str= '%g' % val + if '.' not in val_str and '-' not in val_str: # value could be 1e-05 + val_str += '.0' + else: + # array + val_str = str(tuple(val)) + + kw_param_str += (' in (%s, %s)' % (range_str(rna_prop.hard_min), range_str(rna_prop.hard_max))) + kw_param_set= True + + elif rna_prop_type=='int': + if length==0: + val_str='%d' % val + else: + val_str = str(tuple(val)) + + # print(dir(rna_prop)) + kw_param_str += (' in (%s, %s)' % (range_str(rna_prop.hard_min), range_str(rna_prop.hard_max))) + # These strings dont have a max length??? + #kw_param_str += ' (maximum length of %s)' % (rna_prop.max_length) + kw_param_set= True + + elif rna_prop_type=='boolean': + if length==0: + if val: val_str='True' + else: val_str='False' + else: + val_str = str(tuple(val)) + + elif rna_prop_type=='enum': + # no array here? + val_str="'%s'" % val + # Too cramped + kw_param_str += (' in (%s)' % ', '.join(rna_prop.items.keys())) + + kw_param_set= True + + elif rna_prop_type=='string': + # no array here? + val_str='"%s"' % val + + # todo - collection - array + # print (rna_prop.type) + + kw_args.append('%s = %s' % (rna_prop_identifier, val_str)) + + # stora + else: + # currently functions dont have a default value + if not rna_prop.use_return: + kw_args.append('%s' % (rna_prop_identifier)) + else: + kw_param_set = True + + + # Same for operators and functions + kw_arg_attrs.append(kw_type_str) + if kw_param_set: + kw_arg_attrs.append(kw_param_str) + + + + out.write(ident+'def %s(%s):\n' % (rna_func_name, ', '.join(kw_args))) + out.write(ident+'\t"""\n') + out.write(ident+'\t%s\n' % rna_func_desc) + for desc in kw_arg_attrs: + out.write(ident+'\t%s\n' % desc) + + # out.write(ident+'\t@rtype: None\n') # implicit + out.write(ident+'\t"""\n') - - # Same for operators and functions - kw_arg_attrs.append(kw_type_str) - if kw_param_set: - kw_arg_attrs.append(kw_param_str) - - - - out.write(ident+'def %s(%s):\n' % (rna_func_name, ', '.join(kw_args))) - out.write(ident+'\t"""\n') - out.write(ident+'\t%s\n' % rna_func_desc) - for desc in kw_arg_attrs: - out.write(ident+'\t%s\n' % desc) - - # out.write(ident+'\t@rtype: None\n') # implicit - out.write(ident+'\t"""\n') - def rna2epy(BASEPATH): - - # Use for faster lookups - # use rna_struct.identifier as the key for each dict - rna_struct_dict = {} # store identifier:rna lookups - rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct) - rna_children_dict = {} # store all rna_structs nested from here - rna_references_dict = {} # store a list of rna path strings that reference this type - rna_functions_dict = {} # store all functions directly in this type (not inherited) - rna_words = set() - - # def write_func(rna_func, ident): - - - def write_struct(rna_struct, ident): - identifier = rna_struct.identifier - - rna_base = rna_struct.base - - if rna_base: - out.write(ident+ 'class %s(%s):\n' % (identifier, rna_base.identifier)) - rna_base_prop_keys = rna_base.properties.keys() # could be cached - rna_base_func_keys = [f.identifier for f in rna_base.functions] - else: - out.write(ident+ 'class %s:\n' % identifier) - rna_base_prop_keys = [] - rna_base_func_keys = [] - - out.write(ident+ '\t"""\n') - - title = 'The %s Object' % rna_struct.name - description = rna_struct.description.strip() - out.write(ident+ '\t%s\n' % title) - out.write(ident+ '\t%s\n' % ('=' * len(title))) - out.write(ident+ '\t\t%s\n' % description) - rna_words.update(description.split()) - - - # For convenience, give a list of all places were used. - rna_refs= rna_references_dict[identifier] - - if rna_refs: - out.write(ident+ '\t\t\n') - out.write(ident+ '\t\tReferences\n') - out.write(ident+ '\t\t==========\n') - - for rna_ref_string in rna_refs: - out.write(ident+ '\t\t\t- L{%s}\n' % rna_ref_string) - - out.write(ident+ '\t\t\n') - - else: - out.write(ident+ '\t\t\n') - out.write(ident+ '\t\t(no references to this struct found)\n') - out.write(ident+ '\t\t\n') - - for rna_prop_identifier, rna_prop in rna_struct.properties.items(): - - if rna_prop_identifier=='RNA': continue - if rna_id_ignore(rna_prop_identifier): continue - if rna_prop_identifier in rna_base_prop_keys: continue # does this prop exist in our parent class, if so skip - - rna_desc = rna_prop.description.strip() - - if rna_desc: rna_words.update(rna_desc.split()) - if not rna_desc: rna_desc = rna_prop.name - if not rna_desc: rna_desc = 'Note - No documentation for this property!' - - rna_prop_type = rna_prop.type.lower() - - if rna_prop_type=='collection': collection_str = 'Collection of ' - else: collection_str = '' - - try: rna_prop_ptr = rna_prop.fixed_type - except: rna_prop_ptr = None - - try: length = rna_prop.array_length - except: length = 0 - - array_str = get_array_str(length) - - if rna_prop.editable: readonly_str = '' - else: readonly_str = ' (readonly)' - - if rna_prop_ptr: # Use the pointer type - out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc)) - out.write(ident+ '\t@type %s: %sL{%s}%s%s\n' % (rna_prop_identifier, collection_str, rna_prop_ptr.identifier, array_str, readonly_str)) - else: - if rna_prop_type == 'enum': - if 0: - out.write(ident+ '\t@ivar %s: %s in (%s)\n' % (rna_prop_identifier, rna_desc, ', '.join(rna_prop.items.keys()))) - else: - out.write(ident+ '\t@ivar %s: %s in...\n' % (rna_prop_identifier, rna_desc)) - for e, e_rna_prop in rna_prop.items.items(): - #out.write(ident+ '\t\t- %s: %s\n' % (e, e_rna_prop.description)) # XXX - segfaults, FIXME - out.write(ident+ '\t\t- %s\n' % e) - - out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) - elif rna_prop_type == 'int' or rna_prop_type == 'float': - out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc)) - out.write(ident+ '\t@type %s: %s%s%s in [%s, %s]\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str, range_str(rna_prop.hard_min), range_str(rna_prop.hard_max) )) - elif rna_prop_type == 'string': - out.write(ident+ '\t@ivar %s: %s (maximum length of %s)\n' % (rna_prop_identifier, rna_desc, rna_prop.max_length)) - out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) - else: - out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc)) - out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) - - - out.write(ident+ '\t"""\n\n') - - - # Write functions - # for rna_func in rna_struct.functions: # Better ignore inherited (line below) - for rna_func in rna_functions_dict[identifier]: - if rna_func not in rna_base_func_keys: - write_func(rna_func, ident+'\t', out, 'FUNCTION') - - out.write('\n') - - # Now write children recursively - for child in rna_children_dict[identifier]: - write_struct(child, ident + '\t') - - - - # out = open(target_path, 'w') - out = open_submodule("types.py", BASEPATH) # bpy.types - def base_id(rna_struct): - try: return rna_struct.base.identifier - except: return '' # invalid id + # Use for faster lookups + # use rna_struct.identifier as the key for each dict + rna_struct_dict = {} # store identifier:rna lookups + rna_full_path_dict = {} # store the result of full_rna_struct_path(rna_struct) + rna_children_dict = {} # store all rna_structs nested from here + rna_references_dict = {} # store a list of rna path strings that reference this type + rna_functions_dict = {} # store all functions directly in this type (not inherited) + rna_words = set() + + # def write_func(rna_func, ident): + + + def write_struct(rna_struct, ident): + identifier = rna_struct.identifier + + rna_base = rna_struct.base + + if rna_base: + out.write(ident+ 'class %s(%s):\n' % (identifier, rna_base.identifier)) + rna_base_prop_keys = rna_base.properties.keys() # could be cached + rna_base_func_keys = [f.identifier for f in rna_base.functions] + else: + out.write(ident+ 'class %s:\n' % identifier) + rna_base_prop_keys = [] + rna_base_func_keys = [] + + out.write(ident+ '\t"""\n') + + title = 'The %s Object' % rna_struct.name + description = rna_struct.description.strip() + out.write(ident+ '\t%s\n' % title) + out.write(ident+ '\t%s\n' % ('=' * len(title))) + out.write(ident+ '\t\t%s\n' % description) + rna_words.update(description.split()) + + + # For convenience, give a list of all places were used. + rna_refs= rna_references_dict[identifier] + + if rna_refs: + out.write(ident+ '\t\t\n') + out.write(ident+ '\t\tReferences\n') + out.write(ident+ '\t\t==========\n') + + for rna_ref_string in rna_refs: + out.write(ident+ '\t\t\t- L{%s}\n' % rna_ref_string) + + out.write(ident+ '\t\t\n') + + else: + out.write(ident+ '\t\t\n') + out.write(ident+ '\t\t(no references to this struct found)\n') + out.write(ident+ '\t\t\n') + + for rna_prop_identifier, rna_prop in rna_struct.properties.items(): + + if rna_prop_identifier=='RNA': continue + if rna_id_ignore(rna_prop_identifier): continue + if rna_prop_identifier in rna_base_prop_keys: continue # does this prop exist in our parent class, if so skip + + rna_desc = rna_prop.description.strip() + + if rna_desc: rna_words.update(rna_desc.split()) + if not rna_desc: rna_desc = rna_prop.name + if not rna_desc: rna_desc = 'Note - No documentation for this property!' + + rna_prop_type = rna_prop.type.lower() + + if rna_prop_type=='collection': collection_str = 'Collection of ' + else: collection_str = '' + + try: rna_prop_ptr = rna_prop.fixed_type + except: rna_prop_ptr = None + + try: length = rna_prop.array_length + except: length = 0 + + array_str = get_array_str(length) + + if rna_prop.editable: readonly_str = '' + else: readonly_str = ' (readonly)' + + if rna_prop_ptr: # Use the pointer type + out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc)) + out.write(ident+ '\t@type %s: %sL{%s}%s%s\n' % (rna_prop_identifier, collection_str, rna_prop_ptr.identifier, array_str, readonly_str)) + else: + if rna_prop_type == 'enum': + if 0: + out.write(ident+ '\t@ivar %s: %s in (%s)\n' % (rna_prop_identifier, rna_desc, ', '.join(rna_prop.items.keys()))) + else: + out.write(ident+ '\t@ivar %s: %s in...\n' % (rna_prop_identifier, rna_desc)) + for e, e_rna_prop in rna_prop.items.items(): + #out.write(ident+ '\t\t- %s: %s\n' % (e, e_rna_prop.description)) # XXX - segfaults, FIXME + out.write(ident+ '\t\t- %s\n' % e) + + out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) + elif rna_prop_type == 'int' or rna_prop_type == 'float': + out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc)) + out.write(ident+ '\t@type %s: %s%s%s in [%s, %s]\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str, range_str(rna_prop.hard_min), range_str(rna_prop.hard_max) )) + elif rna_prop_type == 'string': + out.write(ident+ '\t@ivar %s: %s (maximum length of %s)\n' % (rna_prop_identifier, rna_desc, rna_prop.max_length)) + out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) + else: + out.write(ident+ '\t@ivar %s: %s\n' % (rna_prop_identifier, rna_desc)) + out.write(ident+ '\t@type %s: %s%s%s\n' % (rna_prop_identifier, rna_prop_type, array_str, readonly_str)) + + + out.write(ident+ '\t"""\n\n') + + + # Write functions + # for rna_func in rna_struct.functions: # Better ignore inherited (line below) + for rna_func in rna_functions_dict[identifier]: + if rna_func not in rna_base_func_keys: + write_func(rna_func, ident+'\t', out, 'FUNCTION') + + out.write('\n') + + # Now write children recursively + for child in rna_children_dict[identifier]: + write_struct(child, ident + '\t') + + + + # out = open(target_path, 'w') + out = open_submodule("types.py", BASEPATH) # bpy.types + + def base_id(rna_struct): + try: return rna_struct.base.identifier + except: return '' # invalid id + + #structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()] + ''' + structs = [] + for rna_struct in bpy.doc.structs.values(): + structs.append( (base_id(rna_struct), rna_struct.identifier, rna_struct) ) + ''' + structs = [] + for rna_type_name in dir(bpy.types): + rna_type = getattr(bpy.types, rna_type_name) + + try: rna_struct = rna_type.bl_rna + except: rna_struct = None + + if rna_struct: + #if not rna_type_name.startswith('__'): + + identifier = rna_struct.identifier + + if not rna_id_ignore(identifier): + structs.append( (base_id(rna_struct), identifier, rna_struct) ) + + # Simple lookup + rna_struct_dict[identifier] = rna_struct + + # Store full rna path 'GameObjectSettings' -> 'Object.GameObjectSettings' + rna_full_path_dict[identifier] = full_rna_struct_path(rna_struct) + + # Store a list of functions, remove inherited later + rna_functions_dict[identifier]= list(rna_struct.functions) + + + # fill in these later + rna_children_dict[identifier]= [] + rna_references_dict[identifier]= [] + + + else: + print("Ignoring", rna_type_name) + + + # Sucks but we need to copy this so we can check original parent functions + rna_functions_dict__copy = {} + for key, val in rna_functions_dict.items(): + rna_functions_dict__copy[key] = val[:] + + + structs.sort() # not needed but speeds up sort below, setting items without an inheritance first + + # Arrange so classes are always defined in the correct order + deps_ok = False + while deps_ok == False: + deps_ok = True + rna_done = set() + + for i, (rna_base, identifier, rna_struct) in enumerate(structs): + + rna_done.add(identifier) + + if rna_base and rna_base not in rna_done: + deps_ok = False + data = structs.pop(i) + ok = False + while i < len(structs): + if structs[i][1]==rna_base: + structs.insert(i+1, data) # insert after the item we depend on. + ok = True + break + i+=1 + + if not ok: + print('Dependancy "%s" could not be found for "%s"' % (identifier, rna_base)) + + break + + # Done ordering structs + + + # precalc vars to avoid a lot of looping + for (rna_base, identifier, rna_struct) in structs: + + if rna_base: + rna_base_prop_keys = rna_struct_dict[rna_base].properties.keys() # could cache + rna_base_func_keys = [f.identifier for f in rna_struct_dict[rna_base].functions] + else: + rna_base_prop_keys = [] + rna_base_func_keys= [] + + # rna_struct_path = full_rna_struct_path(rna_struct) + rna_struct_path = rna_full_path_dict[identifier] + + for rna_prop_identifier, rna_prop in rna_struct.properties.items(): + + if rna_prop_identifier=='RNA': continue + if rna_id_ignore(rna_prop_identifier): continue + if rna_prop_identifier in rna_base_prop_keys: continue + + try: rna_prop_ptr = rna_prop.fixed_type + except: rna_prop_ptr = None + + # Does this property point to me? + if rna_prop_ptr: + rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_prop_identifier) ) + + for rna_func in rna_struct.functions: + for rna_prop_identifier, rna_prop in rna_func.parameters.items(): + + if rna_prop_identifier=='RNA': continue + if rna_id_ignore(rna_prop_identifier): continue + if rna_prop_identifier in rna_base_func_keys: continue + + + try: rna_prop_ptr = rna_prop.fixed_type + except: rna_prop_ptr = None + + # Does this property point to me? + if rna_prop_ptr: + rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_func.identifier) ) + + + # Store nested children + nested = rna_struct.nested + if nested: + rna_children_dict[nested.identifier].append(rna_struct) + + + if rna_base: + rna_funcs = rna_functions_dict[identifier] + if rna_funcs: + # Remove inherited functions if we have any + rna_base_funcs = rna_functions_dict__copy[rna_base] + rna_funcs[:] = [f for f in rna_funcs if f not in rna_base_funcs] + + rna_functions_dict__copy.clear() + del rna_functions_dict__copy + + # Sort the refs, just reads nicer + for rna_refs in rna_references_dict.values(): + rna_refs.sort() + + for (rna_base, identifier, rna_struct) in structs: + if rna_struct.nested: + continue + + write_struct(rna_struct, '') + + + out.write('\n') + out.close() + + # # We could also just run.... + # os.system('epydoc source/blender/python/doc/rna.py -o ./source/blender/python/doc/html -v') + + target_path = os.path.join(BASEPATH, "dump.py") # XXX - used for other funcs + + # Write graphviz + out= open(target_path.replace('.py', '.dot'), 'w') + out.write('digraph "rna data api" {\n') + out.write('\tnode [style=filled, shape = "box"];\n') + out.write('\toverlap=false;\n') + out.write('\trankdir = LR;\n') + out.write('\tsplines=true;\n') + out.write('\tratio=auto;\n') + + + + out.write('\tsize="10,10"\n') + #out.write('\tpage="8.5,11"\n') + #out.write('\tcenter=""\n') + + def isop(rna_struct): + return '_OT_' in rna_struct.identifier + + + for (rna_base, identifier, rna_struct) in structs: + if isop(rna_struct): + continue + + base = rna_struct.base + + + out.write('\t"%s";\n' % identifier) + + for (rna_base, identifier, rna_struct) in structs: + + if isop(rna_struct): + continue + + base = rna_struct.base + + if base and not isop(base): + out.write('\t"%s" -> "%s" [label="(base)" weight=1.0];\n' % (base.identifier, identifier)) + + nested = rna_struct.nested + if nested and not isop(nested): + out.write('\t"%s" -> "%s" [label="(nested)" weight=1.0];\n' % (nested.identifier, identifier)) + + + + rna_refs= rna_references_dict[identifier] + + for rna_ref_string in rna_refs: + + if '_OT_' in rna_ref_string: + continue + + ref = rna_ref_string.split('.')[-2] + out.write('\t"%s" -> "%s" [label="%s" weight=0.01];\n' % (ref, identifier, rna_ref_string)) + + + out.write('}\n') + out.close() + + # # We could also just run.... + # os.system('dot source/blender/python/doc/rna.dot -Tsvg -o ./source/blender/python/doc/rna.svg') + + + out= open(target_path.replace('.py', '.words'), 'w') + rna_words = list(rna_words) + rna_words.sort() + for w in rna_words: + out.write('%s\n' % w) - #structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()] - ''' - structs = [] - for rna_struct in bpy.doc.structs.values(): - structs.append( (base_id(rna_struct), rna_struct.identifier, rna_struct) ) - ''' - structs = [] - for rna_type_name in dir(bpy.types): - rna_type = getattr(bpy.types, rna_type_name) - - try: rna_struct = rna_type.bl_rna - except: rna_struct = None - - if rna_struct: - #if not rna_type_name.startswith('__'): - - identifier = rna_struct.identifier - - if not rna_id_ignore(identifier): - structs.append( (base_id(rna_struct), identifier, rna_struct) ) - - # Simple lookup - rna_struct_dict[identifier] = rna_struct - - # Store full rna path 'GameObjectSettings' -> 'Object.GameObjectSettings' - rna_full_path_dict[identifier] = full_rna_struct_path(rna_struct) - - # Store a list of functions, remove inherited later - rna_functions_dict[identifier]= list(rna_struct.functions) - - - # fill in these later - rna_children_dict[identifier]= [] - rna_references_dict[identifier]= [] - - - else: - print("Ignoring", rna_type_name) - - - # Sucks but we need to copy this so we can check original parent functions - rna_functions_dict__copy = {} - for key, val in rna_functions_dict.items(): - rna_functions_dict__copy[key] = val[:] - - - structs.sort() # not needed but speeds up sort below, setting items without an inheritance first - - # Arrange so classes are always defined in the correct order - deps_ok = False - while deps_ok == False: - deps_ok = True - rna_done = set() - - for i, (rna_base, identifier, rna_struct) in enumerate(structs): - - rna_done.add(identifier) - - if rna_base and rna_base not in rna_done: - deps_ok = False - data = structs.pop(i) - ok = False - while i < len(structs): - if structs[i][1]==rna_base: - structs.insert(i+1, data) # insert after the item we depend on. - ok = True - break - i+=1 - - if not ok: - print('Dependancy "%s" could not be found for "%s"' % (identifier, rna_base)) - - break - - # Done ordering structs - - - # precalc vars to avoid a lot of looping - for (rna_base, identifier, rna_struct) in structs: - - if rna_base: - rna_base_prop_keys = rna_struct_dict[rna_base].properties.keys() # could cache - rna_base_func_keys = [f.identifier for f in rna_struct_dict[rna_base].functions] - else: - rna_base_prop_keys = [] - rna_base_func_keys= [] - - # rna_struct_path = full_rna_struct_path(rna_struct) - rna_struct_path = rna_full_path_dict[identifier] - - for rna_prop_identifier, rna_prop in rna_struct.properties.items(): - - if rna_prop_identifier=='RNA': continue - if rna_id_ignore(rna_prop_identifier): continue - if rna_prop_identifier in rna_base_prop_keys: continue - - try: rna_prop_ptr = rna_prop.fixed_type - except: rna_prop_ptr = None - - # Does this property point to me? - if rna_prop_ptr: - rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_prop_identifier) ) - - for rna_func in rna_struct.functions: - for rna_prop_identifier, rna_prop in rna_func.parameters.items(): - - if rna_prop_identifier=='RNA': continue - if rna_id_ignore(rna_prop_identifier): continue - if rna_prop_identifier in rna_base_func_keys: continue - - - try: rna_prop_ptr = rna_prop.fixed_type - except: rna_prop_ptr = None - - # Does this property point to me? - if rna_prop_ptr: - rna_references_dict[rna_prop_ptr.identifier].append( "%s.%s" % (rna_struct_path, rna_func.identifier) ) - - - # Store nested children - nested = rna_struct.nested - if nested: - rna_children_dict[nested.identifier].append(rna_struct) - - - if rna_base: - rna_funcs = rna_functions_dict[identifier] - if rna_funcs: - # Remove inherited functions if we have any - rna_base_funcs = rna_functions_dict__copy[rna_base] - rna_funcs[:] = [f for f in rna_funcs if f not in rna_base_funcs] - - rna_functions_dict__copy.clear() - del rna_functions_dict__copy - - # Sort the refs, just reads nicer - for rna_refs in rna_references_dict.values(): - rna_refs.sort() - - for (rna_base, identifier, rna_struct) in structs: - if rna_struct.nested: - continue - - write_struct(rna_struct, '') - - - out.write('\n') - out.close() - - # # We could also just run.... - # os.system('epydoc source/blender/python/doc/rna.py -o ./source/blender/python/doc/html -v') - - target_path = os.path.join(BASEPATH, "dump.py") # XXX - used for other funcs - - # Write graphviz - out= open(target_path.replace('.py', '.dot'), 'w') - out.write('digraph "rna data api" {\n') - out.write('\tnode [style=filled, shape = "box"];\n') - out.write('\toverlap=false;\n') - out.write('\trankdir = LR;\n') - out.write('\tsplines=true;\n') - out.write('\tratio=auto;\n') - - - - out.write('\tsize="10,10"\n') - #out.write('\tpage="8.5,11"\n') - #out.write('\tcenter=""\n') - - def isop(rna_struct): - return '_OT_' in rna_struct.identifier - - - for (rna_base, identifier, rna_struct) in structs: - if isop(rna_struct): - continue - - base = rna_struct.base - - - out.write('\t"%s";\n' % identifier) - - for (rna_base, identifier, rna_struct) in structs: - - if isop(rna_struct): - continue - - base = rna_struct.base - - if base and not isop(base): - out.write('\t"%s" -> "%s" [label="(base)" weight=1.0];\n' % (base.identifier, identifier)) - - nested = rna_struct.nested - if nested and not isop(nested): - out.write('\t"%s" -> "%s" [label="(nested)" weight=1.0];\n' % (nested.identifier, identifier)) - - - - rna_refs= rna_references_dict[identifier] - - for rna_ref_string in rna_refs: - - if '_OT_' in rna_ref_string: - continue - - ref = rna_ref_string.split('.')[-2] - out.write('\t"%s" -> "%s" [label="%s" weight=0.01];\n' % (ref, identifier, rna_ref_string)) - - - out.write('}\n') - out.close() - - # # We could also just run.... - # os.system('dot source/blender/python/doc/rna.dot -Tsvg -o ./source/blender/python/doc/rna.svg') - - - out= open(target_path.replace('.py', '.words'), 'w') - rna_words = list(rna_words) - rna_words.sort() - for w in rna_words: - out.write('%s\n' % w) - def op2epy(BASEPATH): - # out = open(target_path, 'w') - - op_mods = dir(bpy.ops) - op_mods.remove('add') - op_mods.remove('remove') - - for op_mod_name in sorted(op_mods): - if op_mod_name.startswith('__'): - continue - - # open the submodule - mod_path = os.path.join("ops", op_mod_name + ".py") - out = open_submodule(mod_path, BASEPATH) + # out = open(target_path, 'w') + + op_mods = dir(bpy.ops) + op_mods.remove('add') + op_mods.remove('remove') + + for op_mod_name in sorted(op_mods): + if op_mod_name.startswith('__'): + continue + + # open the submodule + mod_path = os.path.join("ops", op_mod_name + ".py") + out = open_submodule(mod_path, BASEPATH) - op_mod = getattr(bpy.ops, op_mod_name) - operators = dir(op_mod) - for op in sorted(operators): - # rna = getattr(bpy.types, op).bl_rna - rna = getattr(op_mod, op).get_rna() - write_func(rna, '', out, 'OPERATOR') - - out.write('\n') - out.close() + op_mod = getattr(bpy.ops, op_mod_name) + operators = dir(op_mod) + for op in sorted(operators): + # rna = getattr(bpy.types, op).bl_rna + rna = getattr(op_mod, op).get_rna() + write_func(rna, '', out, 'OPERATOR') + + out.write('\n') + out.close() def misc2epy(BASEPATH): - ''' - Hard coded modules, try to avoid adding stuff here - ''' - - f = append_package(os.path.join(BASEPATH, ""), ""); # add a slash on the end of the base path - f.write(''' + ''' + Hard coded modules, try to avoid adding stuff here + ''' + + f = append_package(os.path.join(BASEPATH, ""), ""); # add a slash on the end of the base path + f.write(''' """ @type data: L{bpy.types.Main} @var data: blender data is accessed from here """ ''') - f = open_submodule("props.py", BASEPATH) - f.write(''' + f = open_submodule("props.py", BASEPATH) + f.write(''' MAX_INT= 2**31 MAX_FLOAT= 1e+37 def BoolProperty(attr, name="", description="", default=False): - """ - return a new bool property - """ + """ + return a new bool property + """ def IntProperty(attr, name="", description="", min=-MAX_INT, max=MAX_INT, soft_min=-MAX_INT, soft_max=MAX_INT, default=0): - """ - return a new int property - """ + """ + return a new int property + """ def FloatProperty(attr, name="", description="", min=-MAX_FLOAT, max=MAX_FLOAT, soft_min=-MAX_FLOAT, soft_max=MAX_FLOAT, default=0.0): - """ - return a new float property - """ + """ + return a new float property + """ def StringProperty(attr, name="", description="", maxlen=0, default=""): - """ - return a new string property - """ + """ + return a new string property + """ def EnumProperty(attr, items, name="", description="", default=""): - """ - return a new enum property - """ + """ + return a new enum property + """ ''') if __name__ == '__main__': - if 'bpy' not in dir(): - print("\nError, this script must run from inside blender2.5") - print(script_help_msg) - else: - misc2epy('source/blender/python/doc/bpy') # first to write in info in some of the modules. - rna2epy('source/blender/python/doc/bpy') - op2epy('source/blender/python/doc/bpy') - - - close_all() - - import sys - sys.exit() + if 'bpy' not in dir(): + print("\nError, this script must run from inside blender2.5") + print(script_help_msg) + else: + misc2epy('source/blender/python/doc/bpy') # first to write in info in some of the modules. + rna2epy('source/blender/python/doc/bpy') + op2epy('source/blender/python/doc/bpy') + + + close_all() + + import sys + sys.exit() diff --git a/source/blender/python/rna_dump.py b/source/blender/python/rna_dump.py index 7dde4007f66..7c53a6cc235 100644 --- a/source/blender/python/rna_dump.py +++ b/source/blender/python/rna_dump.py @@ -19,114 +19,114 @@ # #**** END GPL LICENSE BLOCK #**** if 1: - # Print once every 1000 - GEN_PATH = True - PRINT_DATA = False - PRINT_DATA_INT = 1000 - VERBOSE = False - VERBOSE_TYPE = False - MAX_RECURSIVE = 8 + # Print once every 1000 + GEN_PATH = True + PRINT_DATA = False + PRINT_DATA_INT = 1000 + VERBOSE = False + VERBOSE_TYPE = False + MAX_RECURSIVE = 8 else: - # Print everything - GEN_PATH = True - PRINT_DATA = True - PRINT_DATA_INT = 0 - VERBOSE = False - VERBOSE_TYPE = False - MAX_RECURSIVE = 8 + # Print everything + GEN_PATH = True + PRINT_DATA = True + PRINT_DATA_INT = 0 + VERBOSE = False + VERBOSE_TYPE = False + MAX_RECURSIVE = 8 seek_count = [0] def seek(r, txt, recurs): - - seek_count[0] += 1 - - if PRINT_DATA_INT: - if not (seek_count[0] % PRINT_DATA_INT): - print(seek_count[0], txt) - - if PRINT_DATA: - print(txt) - - newtxt = '' - - if recurs > MAX_RECURSIVE: - #print ("Recursion is over max") - #print (txt) - return - - type_r = type(r) - - # print(type_r) - # print(dir(r)) - - # basic types - if type_r in (float, int, bool, type(None)): - if PRINT_DATA: - print(txt + ' -> ' + str(r)) - return - - if type_r == str: - if PRINT_DATA: - print(txt + ' -> "' + str(r) + '"') - return - - try: keys = r.keys() - except: keys = None - - if keys != None: - if PRINT_DATA: - print(txt + '.keys() - ' + str(r.keys())) - - try: __members__ = dir(r) - except: __members__ = [] - - for item in __members__: - if item.startswith('__'): - continue - - if GEN_PATH: newtxt = txt + '.' + item - - if item == 'rna_type' and VERBOSE_TYPE==False: # just avoid because it spits out loads of data - continue - - try: value = getattr(r, item) - except: value = None - - seek( value, newtxt, recurs + 1) - - - if keys: - for k in keys: - if GEN_PATH: newtxt = txt + '["' + k + '"]' - seek(r.__getitem__(k), newtxt, recurs+1) - - else: - try: length = len( r ) - except: length = 0 - - if VERBOSE==False and length >= 4: - for i in (0, length-1): - if i>0: - if PRINT_DATA: - print((' '*len(txt)) + ' ... skipping '+str(length-2)+' items ...') - - if GEN_PATH: newtxt = txt + '[' + str(i) + ']' - seek(r[i], newtxt, recurs+1) - else: - for i in range(length): - if GEN_PATH: newtxt = txt + '[' + str(i) + ']' - seek(r[i], newtxt, recurs+1) + + seek_count[0] += 1 + + if PRINT_DATA_INT: + if not (seek_count[0] % PRINT_DATA_INT): + print(seek_count[0], txt) + + if PRINT_DATA: + print(txt) + + newtxt = '' + + if recurs > MAX_RECURSIVE: + #print ("Recursion is over max") + #print (txt) + return + + type_r = type(r) + + # print(type_r) + # print(dir(r)) + + # basic types + if type_r in (float, int, bool, type(None)): + if PRINT_DATA: + print(txt + ' -> ' + str(r)) + return + + if type_r == str: + if PRINT_DATA: + print(txt + ' -> "' + str(r) + '"') + return + + try: keys = r.keys() + except: keys = None + + if keys != None: + if PRINT_DATA: + print(txt + '.keys() - ' + str(r.keys())) + + try: __members__ = dir(r) + except: __members__ = [] + + for item in __members__: + if item.startswith('__'): + continue + + if GEN_PATH: newtxt = txt + '.' + item + + if item == 'rna_type' and VERBOSE_TYPE==False: # just avoid because it spits out loads of data + continue + + try: value = getattr(r, item) + except: value = None + + seek( value, newtxt, recurs + 1) + + + if keys: + for k in keys: + if GEN_PATH: newtxt = txt + '["' + k + '"]' + seek(r.__getitem__(k), newtxt, recurs+1) + + else: + try: length = len( r ) + except: length = 0 + + if VERBOSE==False and length >= 4: + for i in (0, length-1): + if i>0: + if PRINT_DATA: + print((' '*len(txt)) + ' ... skipping '+str(length-2)+' items ...') + + if GEN_PATH: newtxt = txt + '[' + str(i) + ']' + seek(r[i], newtxt, recurs+1) + else: + for i in range(length): + if GEN_PATH: newtxt = txt + '[' + str(i) + ']' + seek(r[i], newtxt, recurs+1) seek(bpy.data, 'bpy.data', 0) # seek(bpy.types, 'bpy.types', 0) ''' for d in dir(bpy.types): - t = getattr(bpy.types, d) - try: r = t.bl_rna - except: r = None - if r: - seek(r, 'bpy.types.' + d + '.bl_rna', 0) + t = getattr(bpy.types, d) + try: r = t.bl_rna + except: r = None + if r: + seek(r, 'bpy.types.' + d + '.bl_rna', 0) ''' #print dir(bpy) diff --git a/source/blender/python/simple_enum_gen.py b/source/blender/python/simple_enum_gen.py index 59f048c2842..615d48b77d0 100644 --- a/source/blender/python/simple_enum_gen.py +++ b/source/blender/python/simple_enum_gen.py @@ -19,47 +19,47 @@ # #**** END GPL LICENSE BLOCK #**** defs = """ - SPACE_EMPTY, - SPACE_VIEW3D, - SPACE_IPO, - SPACE_OUTLINER, - SPACE_BUTS, - SPACE_FILE, - SPACE_IMAGE, - SPACE_INFO, - SPACE_SEQ, - SPACE_TEXT, - SPACE_IMASEL, - SPACE_SOUND, - SPACE_ACTION, - SPACE_NLA, - SPACE_SCRIPT, - SPACE_TIME, - SPACE_NODE, - SPACEICONMAX + SPACE_EMPTY, + SPACE_VIEW3D, + SPACE_IPO, + SPACE_OUTLINER, + SPACE_BUTS, + SPACE_FILE, + SPACE_IMAGE, + SPACE_INFO, + SPACE_SEQ, + SPACE_TEXT, + SPACE_IMASEL, + SPACE_SOUND, + SPACE_ACTION, + SPACE_NLA, + SPACE_SCRIPT, + SPACE_TIME, + SPACE_NODE, + SPACEICONMAX """ print '\tmod = PyModule_New("dummy");' print '\tPyModule_AddObject( submodule, "key", mod );' for d in defs.split('\n'): - - d = d.replace(',', ' ') - w = d.split() - - if not w: - continue - - try: w.remove("#define") - except: pass - - # print w - - val = w[0] - py_val = w[0] - - print '\tPyModule_AddObject( mod, "%s", PyLong_FromSize_t(%s) );' % (val, py_val) - + + d = d.replace(',', ' ') + w = d.split() + + if not w: + continue + + try: w.remove("#define") + except: pass + + # print w + + val = w[0] + py_val = w[0] + + print '\tPyModule_AddObject( mod, "%s", PyLong_FromSize_t(%s) );' % (val, py_val) +