Python bpy.types() Examples
The following are 30
code examples of bpy.types().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bpy
, or try the search function
.
Example #1
Source File: properties_physics_dynamicpaint.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.DynamicPaintSurface) surf = item sticon = layout.enum_item_icon(surf, "surface_type", surf.surface_type) if self.layout_type in {'DEFAULT', 'COMPACT'}: row = layout.row(align=True) row.label(text="", icon_value=icon) row.prop(surf, "name", text="", emboss=False, icon_value=sticon) row = layout.row(align=True) if surf.use_color_preview: row.prop(surf, "show_preview", text="", emboss=False, icon='RESTRICT_VIEW_OFF' if surf.show_preview else 'RESTRICT_VIEW_ON') row.prop(surf, "is_active", text="") elif self.layout_type == 'GRID': layout.alignment = 'CENTER' row = layout.row(align=True) row.label(text="", icon_value=icon) row.label(text="", icon_value=sticon)
Example #2
Source File: ue_tools_v1-2-4.py From UE4-Tools with GNU General Public License v3.0 | 6 votes |
def Animation_UI_Properties(scn): #Show Rig Options bpy.types.Scene.UE_Show_Rig_Props= BoolProperty( name = "Show Rig Options", default=True, update = UE_Show_Rig_Props_Callback, description = "Show The options for the RIG") scn['UE_Show_Rig_Props'] = True #Show Rig Export Options bpy.types.Scene.UE_Show_Export_options= BoolProperty( name = "Show Export Options", default=False, update = UE_Show_Export_option_Callback, description = "Show Export Options for customize the fbx name,folder and scale") scn['UE_Show_Export_options'] = False #Rig Callbacks UE_ShowAdvanced_Rig_Prop_Callback
Example #3
Source File: ue_tools_v1-2-4.py From UE4-Tools with GNU General Public License v3.0 | 6 votes |
def SetObjScale(scn): bpy.types.Scene.UEObjScale = BoolProperty( name = "Scale Selected Objects",update = ObjScale_Callback, description = "True or False?") scn['UEObjScale'] = ObjScale return #------------------------------------------- #---------SCENE SETTINGS FUNCTIONS---------- #------------------------------------------- #------------------------------------------- #---------BATCH RENAME CALLBACKS----------- #------------------------------------------- #base name callback
Example #4
Source File: rootmotion_controller.py From Godot_Game_Tools with GNU General Public License v2.0 | 6 votes |
def add_root_curves(action: bpy.types.Action): rootmotion_name = bpy.context.scene.godot_game_tools.rootmotion_name if action.fcurves.find('pose.bones["{}"].location'.format(rootmotion_name)) is None: x_curve = action.fcurves.new(data_path='pose.bones["{}"].location'.format(rootmotion_name), index=0, action_group="RootMotion") x_hips = action.fcurves[0] x_offset = x_hips.keyframe_points[0].co[1] for frame_index, keyframe_point in enumerate(x_hips.keyframe_points): kf = x_curve.keyframe_points.insert(frame=keyframe_point.co[0], value=keyframe_point.co[1]-x_offset, options={'FAST'}, keyframe_type='KEYFRAME') kf.interpolation = 'LINEAR' y_curve = action.fcurves.new(data_path='pose.bones["{}"].location'.format(rootmotion_name), index=1, action_group="RootMotion") y_hips = action.fcurves[1] y_offset = y_hips.keyframe_points[0].co[1] for frame_index, keyframe_point in enumerate(y_hips.keyframe_points): kf = y_curve.keyframe_points.insert(frame=keyframe_point.co[0], value=keyframe_point.co[1]-y_offset, options={'FAST'}, keyframe_type='KEYFRAME') kf.interpolation = 'LINEAR' z_curve = action.fcurves.new(data_path='pose.bones["{}"].location'.format(rootmotion_name), index=2, action_group="RootMotion") z_hips = action.fcurves[2] z_offset = z_hips.keyframe_points[0].co[1] for frame_index, keyframe_point in enumerate(z_hips.keyframe_points): kf = z_curve.keyframe_points.insert(frame=keyframe_point.co[0], value=keyframe_point.co[1]-z_offset, options={'FAST'}, keyframe_type='KEYFRAME') kf.interpolation = 'LINEAR' # print('Added Root Motion Curves to action {}'.format(action.name))
Example #5
Source File: mixamo_controller.py From Godot_Game_Tools with GNU General Public License v2.0 | 6 votes |
def import_from_folder(self, path, context): extensions = ['fbx'] filenames = sorted(os.listdir(path)) valid_files = [] fileNamesList = [] for filename in filenames: for ext in extensions: if filename.lower().endswith('.{}'.format(ext)): valid_files.append(filename) break for name in valid_files: file_path = os.path.join(path, name) extension = (os.path.splitext(file_path)[1])[1:].lower() if ext == "fbx": if hasattr(bpy.types, bpy.ops.import_scene.fbx.idname()): actionName, actionExtension = os.path.splitext(name) if actionName == "T-Pose": # Local Variable fileNamesList.append(actionName) bpy.ops.import_scene.fbx(filepath = file_path)
Example #6
Source File: __init__.py From Blender-Metaverse-Addon with GNU General Public License v3.0 | 6 votes |
def register(): main_register() scene_define() module_register() custom_register() existing_shapekey_merger = operator_exists(ApplyModifierForObjectWithShapeKeysOperator.bl_idname) if existing_shapekey_merger == False: print ("Registering bundled ApplyModifierForObjectWithShapeKeysOperator") bpy.utils.register_class(ApplyModifierForObjectWithShapeKeysOperator) else: print ("Existing ApplyModifierForObjectWithShapeKeysOperator found") existing_shapekey_merger = True bpy.types.TOPBAR_MT_file_import.append(menu_func_import) bpy.types.TOPBAR_MT_file_export.append(menu_func_export) ui.register_operators()
Example #7
Source File: presets.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def execute(self, context): from os.path import basename, splitext filepath = self.filepath # change the menu title to the most recently chosen option preset_class = getattr(bpy.types, self.menu_idname) preset_class.bl_label = bpy.path.display_name(basename(filepath)) ext = splitext(filepath)[1].lower() # execute the preset using script.python_file_run if ext == ".py": bpy.ops.script.python_file_run(filepath=filepath) elif ext == ".xml": import rna_xml rna_xml.xml_file_run(context, filepath, preset_class.preset_xml_map) else: self.report({'ERROR'}, "unknown filetype: %r" % ext) return {'CANCELLED'} return {'FINISHED'}
Example #8
Source File: wm.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def operator_value_is_undo(value): if value in {None, Ellipsis}: return False # typical properties or objects id_data = getattr(value, "id_data", Ellipsis) if id_data is None: return False elif id_data is Ellipsis: # handle mathutils types id_data = getattr(getattr(value, "owner", None), "id_data", None) if id_data is None: return False # return True if its a non window ID type return (isinstance(id_data, bpy.types.ID) and (not isinstance(id_data, (bpy.types.WindowManager, bpy.types.Screen, bpy.types.Brush, ))))
Example #9
Source File: node.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def node_enum_items(self, context): enum_items = NODE_OT_add_search._enum_item_hack enum_items.clear() for index, item in enumerate(nodeitems_utils.node_items_iter(context)): if isinstance(item, nodeitems_utils.NodeItem): nodetype = getattr(bpy.types, item.nodetype, None) if nodetype: enum_items.append( (str(index), item.label, nodetype.bl_rna.description, index, )) return enum_items # Look up the item based on index
Example #10
Source File: properties_data_camera.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def draw_display_safe_settings(layout, safe_data, settings): show_safe_areas = settings.show_safe_areas show_safe_center = settings.show_safe_center split = layout.split() col = split.column() row = col.row(align=True) row.menu("SAFE_AREAS_MT_presets", text=bpy.types.SAFE_AREAS_MT_presets.bl_label) row.operator("safe_areas.preset_add", text="", icon='ZOOMIN') row.operator("safe_areas.preset_add", text="", icon='ZOOMOUT').remove_active = True col = split.column() col.prop(settings, "show_safe_center", text="Center-Cut Safe Areas") split = layout.split() col = split.column() col.active = show_safe_areas col.prop(safe_data, "title", slider=True) col.prop(safe_data, "action", slider=True) col = split.column() col.active = show_safe_areas and show_safe_center col.prop(safe_data, "title_center", slider=True) col.prop(safe_data, "action_center", slider=True)
Example #11
Source File: space_node.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def draw(self, context): layout = self.layout node = context.active_node # set "node" context pointer for the panel layout layout.context_pointer_set("node", node) if hasattr(node, "draw_buttons_ext"): node.draw_buttons_ext(context, layout) elif hasattr(node, "draw_buttons"): node.draw_buttons(context, layout) # XXX this could be filtered further to exclude socket types which don't have meaningful input values (e.g. cycles shader) value_inputs = [socket for socket in node.inputs if socket.enabled and not socket.is_linked] if value_inputs: layout.separator() layout.label("Inputs:") for socket in value_inputs: row = layout.row() socket.draw(context, row, node, iface_(socket.name, socket.bl_rna.translation_context)) # Node Backdrop options
Example #12
Source File: fd_scene.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def invoke(self, context, event): wm = context.window_manager for obj in bpy.context.scene.objects: if obj.type == 'CURVE' and obj.parent: obj.select = True bpy.context.scene.objects.active = obj bpy.ops.object.convert(target='MESH') bpy.ops.object.select_all(action='DESELECT') #these also need to be unwraped correctly if obj.type == 'MESH': if len(obj.data.vertices) > 1: self.objects.append(obj) self._timer = wm.event_timer_add(0.001, context.window) wm.modal_handler_add(self) if context.area.type == 'VIEW_3D': args = (self, context) self._handle = bpy.types.SpaceView3D.draw_handler_add(utils.draw_callback_px, args, 'WINDOW', 'POST_PIXEL') self.mouse_loc = [] self.mouse_text = "Preparing Object " + str(self.current_item + 1) + " of " + str(len(self.objects)) self.header_text = "Preparing Object " + str(self.current_item + 1) + " of " + str(len(self.objects)) return {'RUNNING_MODAL'}
Example #13
Source File: space_clip.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def draw(self, context): layout = self.layout sc = context.space_data clip = sc.clip row = layout.row(align=True) label = bpy.types.CLIP_MT_camera_presets.bl_label row.menu('CLIP_MT_camera_presets', text=label) row.operator("clip.camera_preset_add", text="", icon='ZOOMIN') row.operator("clip.camera_preset_add", text="", icon='ZOOMOUT').remove_active = True col = layout.column(align=True) col.label(text="Sensor:") col.prop(clip.tracking.camera, "sensor_width", text="Width") col.prop(clip.tracking.camera, "pixel_aspect") col = layout.column() col.label(text="Optical Center:") row = col.row() row.prop(clip.tracking.camera, "principal", text="") col.operator("clip.set_center_principal", text="Center")
Example #14
Source File: rna_info.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def get_location(self): op_class = getattr(bpy.types, self.identifier) op_func = getattr(op_class, "execute", None) if op_func is None: op_func = getattr(op_class, "invoke", None) if op_func is None: op_func = getattr(op_class, "poll", None) if op_func: op_code = op_func.__code__ source_path = op_code.co_filename # clear the prefix for p in script_paths: source_path = source_path.split(p)[-1] if source_path[0] in "/\\": source_path = source_path[1:] return source_path, op_code.co_firstlineno else: return None, None
Example #15
Source File: properties_data_mesh.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.ShapeKey)) obj = active_data # key = data key_block = item if self.layout_type in {'DEFAULT', 'COMPACT'}: split = layout.split(0.66, False) split.prop(key_block, "name", text="", emboss=False, icon_value=icon) row = split.row(align=True) if key_block.mute or (obj.mode == 'EDIT' and not (obj.use_shape_key_edit_mode and obj.type == 'MESH')): row.active = False if not item.id_data.use_relative: row.prop(key_block, "frame", text="", emboss=False) elif index > 0: row.prop(key_block, "value", text="", emboss=False) else: row.label(text="") row.prop(key_block, "mute", text="", emboss=False) elif self.layout_type == 'GRID': layout.alignment = 'CENTER' layout.label(text="", icon_value=icon)
Example #16
Source File: space_userpref.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def draw(self, context): layout = self.layout layout.operator( "wm.url_open", text="Add-ons Catalog", icon='URL', ).url = "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts" layout.separator() layout.operator( "wm.url_open", text="How to share your add-on", icon='URL', ).url = "http://wiki.blender.org/index.php/Dev:Py/Sharing" layout.operator( "wm.url_open", text="Add-on Guidelines", icon='URL', ).url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons" layout.operator( "wm.url_open", text="API Concepts", icon='URL', ).url = bpy.types.WM_OT_doc_view._prefix + "/info_quickstart.html" layout.operator("wm.url_open", text="Add-on Tutorial", icon='URL', ).url = "http://www.blender.org/api/blender_python_api_current/info_tutorial_addon.html"
Example #17
Source File: rna_info.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def get_py_functions(self): import types functions = [] for identifier, attr in self._get_py_visible_attrs(): # methods may be python wrappers to C functions attr_func = getattr(attr, "__func__", attr) if type(attr_func) in {types.FunctionType, types.MethodType}: functions.append((identifier, attr)) return functions
Example #18
Source File: properties_scene.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.KeyingSetPath) kspath = item icon = layout.enum_item_icon(kspath, "id_type", kspath.id_type) if self.layout_type in {'DEFAULT', 'COMPACT'}: # Do not make this one editable in uiList for now... layout.label(text=kspath.data_path, translate=False, icon_value=icon) elif self.layout_type == 'GRID': layout.alignment = 'CENTER' layout.label(text="", icon_value=icon)
Example #19
Source File: space_view3d_toolbar.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def poll(cls, context): settings = cls.paint_settings(context) return (settings is not None) and (not isinstance(settings, bpy.types.ParticleEdit))
Example #20
Source File: properties_physics_fluid.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def draw(self, context): layout = self.layout fluid = context.fluid.settings scene = context.scene split = layout.split() col = split.column() if scene.use_gravity: col.label(text="Use Scene Gravity", icon='SCENE_DATA') sub = col.column() sub.enabled = False sub.prop(fluid, "gravity", text="") else: col.label(text="Gravity:") col.prop(fluid, "gravity", text="") if scene.unit_settings.system != 'NONE': col.label(text="Use Scene Size Units", icon='SCENE_DATA') sub = col.column() sub.enabled = False sub.prop(fluid, "simulation_scale", text="Meters") else: col.label(text="Real World Size:") col.prop(fluid, "simulation_scale", text="Meters") col = split.column() col.label(text="Viscosity Presets:") sub = col.row(align=True) sub.menu("FLUID_MT_presets", text=bpy.types.FLUID_MT_presets.bl_label) sub.operator("fluid.preset_add", text="", icon='ZOOMIN') sub.operator("fluid.preset_add", text="", icon='ZOOMOUT').remove_active = True sub = col.column(align=True) sub.prop(fluid, "viscosity_base", text="Base") sub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True) col.label(text="Optimization:") col.prop(fluid, "grid_levels", slider=True) col.prop(fluid, "compressibility", slider=True)
Example #21
Source File: space_clip.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.MovieTrackingObject) tobj = item if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(tobj, "name", text="", emboss=False, icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA') elif self.layout_type == 'GRID': layout.alignment = 'CENTER' layout.label(text="", icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
Example #22
Source File: properties_render.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def draw_framerate(sub, rd): if RENDER_PT_dimensions._preset_class is None: RENDER_PT_dimensions._preset_class = bpy.types.RENDER_MT_framerate_presets args = rd.fps, rd.fps_base, RENDER_PT_dimensions._preset_class.bl_label fps_label_text, show_framerate = RENDER_PT_dimensions._draw_framerate_label(*args) sub.menu("RENDER_MT_framerate_presets", text=fps_label_text) if show_framerate: sub.prop(rd, "fps") sub.prop(rd, "fps_base", text="/")
Example #23
Source File: properties_data_mesh.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): # assert(isinstance(item, bpy.types.VertexGroup)) vgroup = item if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(vgroup, "name", text="", emboss=False, icon_value=icon) icon = 'LOCKED' if vgroup.lock_weight else 'UNLOCKED' layout.prop(vgroup, "lock_weight", text="", icon=icon, emboss=False) elif self.layout_type == 'GRID': layout.alignment = 'CENTER' layout.label(text="", icon_value=icon)
Example #24
Source File: presets.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def pre_cb(self, context): keyconfigs = bpy.context.window_manager.keyconfigs if self.remove_active: preset_menu_class = getattr(bpy.types, self.preset_menu) preset_menu_class.bl_label = keyconfigs.active.name
Example #25
Source File: console_python.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def banner(context): sc = context.space_data version_string = sys.version.strip().replace('\n', ' ') add_scrollback("PYTHON INTERACTIVE CONSOLE %s" % version_string, 'OUTPUT') add_scrollback("", 'OUTPUT') add_scrollback("Command History: Up/Down Arrow", 'OUTPUT') add_scrollback("Cursor: Left/Right Home/End", 'OUTPUT') add_scrollback("Remove: Backspace/Delete", 'OUTPUT') add_scrollback("Execute: Enter", 'OUTPUT') add_scrollback("Autocomplete: Ctrl-Space", 'OUTPUT') add_scrollback("Zoom: Ctrl +/-, Ctrl-Wheel", 'OUTPUT') add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, " "bpy.props, bpy.types, bpy.context, bpy.utils, " "bgl, blf, mathutils", 'OUTPUT') add_scrollback("Convenience Imports: from mathutils import *; " "from math import *", 'OUTPUT') add_scrollback("Convenience Variables: C = bpy.context, D = bpy.data", 'OUTPUT') add_scrollback("", 'OUTPUT') sc.prompt = PROMPT return {'FINISHED'} # workaround for readline crashing, see: T43491
Example #26
Source File: 3dm_snow_for_2_80.py From Blender-Add-ons-3DM-Snow with GNU General Public License v3.0 | 5 votes |
def register(): for cls in classes: bpy.utils.register_class(cls) #bpy.types.Scene.trees = bpy.props.PointerProperty(type=TreeSettings) # Unregister
Example #27
Source File: rna_info.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def get_py_c_functions(self): import types functions = [] for identifier, attr in self._get_py_visible_attrs(): # methods may be python wrappers to C functions attr_func = getattr(attr, "__func__", attr) if type(attr_func) in {types.BuiltinMethodType, types.BuiltinFunctionType}: functions.append((identifier, attr)) return functions
Example #28
Source File: rna_xml.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def build_property_typemap(skip_classes, skip_typemap): property_typemap = {} for attr in dir(bpy.types): cls = getattr(bpy.types, attr) if issubclass(cls, skip_classes): continue # # to support skip-save we cant get all props # properties = cls.bl_rna.properties.keys() properties = [] for prop_id, prop in cls.bl_rna.properties.items(): if not prop.is_skip_save: properties.append(prop_id) properties.remove("rna_type") property_typemap[attr] = properties if skip_typemap: for cls_name, properties_blacklist in skip_typemap.items(): properties = property_typemap.get(cls_name) if properties is not None: for prop_id in properties_blacklist: try: properties.remove(prop_id) except: print("skip_typemap unknown prop_id '%s.%s'" % (cls_name, prop_id)) else: print("skip_typemap unknown class '%s'" % cls_name) return property_typemap
Example #29
Source File: fd_scene.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def cancel(self, context): progress = context.window_manager.cabinetlib progress.current_item = 0 wm = context.window_manager wm.event_timer_remove(self._timer) bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW') return {'FINISHED'}
Example #30
Source File: fd_general.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def cancel_drop(self,context,event): if self.product: utils.delete_object_and_children(self.product.obj_bp) bpy.context.window.cursor_set('DEFAULT') # bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW') return {'FINISHED'}