Python bpy.props() Examples
The following are 30
code examples of bpy.props().
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: light_profiles.py From leomoon-lightstudio with GNU General Public License v3.0 | 6 votes |
def execute(self, context): props = context.scene.LLStudio list = props.profile_list index = props.list_index if self.direction == 'DOWN': neighbor = index + 1 list.move(index,neighbor) elif self.direction == 'UP': neighbor = index - 1 list.move(neighbor, index) else: return{'CANCELLED'} self.move_index(context) return{'FINISHED'}
Example #2
Source File: render_clay.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def register(): bpy.types.Scene.Clay = BoolProperty( name='Clay Render', description='Use Clay Render', default=False) bpy.types.Scene.Clay_Pinned = BoolProperty( name='Clay Pinned', description='Clay Material Stores', default=False) bpy.types.Material.Mat_Clay = bpy.props.BoolProperty( name='Use as Clay', description='Use as Clay', default=False) bpy.utils.register_class(ClayPinned) bpy.utils.register_class(CheckClay) bpy.types.RENDER_PT_render.prepend(draw_clay_render) bpy.types.MATERIAL_PT_options.append(draw_clay_options) bpy.types.INFO_HT_header.append(draw_clay_warning)
Example #3
Source File: light_profiles.py From leomoon-lightstudio with GNU General Public License v3.0 | 6 votes |
def execute(self, context): props = context.scene.LLStudio index = props.list_index props.profile_list.remove(index) ''' Delete/Switch Hierarchy stuff ''' #delete objects from current profile obsToRemove = family(context.scene.objects[props.last_empty]) collectionsToRemove = set() for ob in obsToRemove: collectionsToRemove.update(ob.users_collection) ob.use_fake_user = False bpy.ops.object.delete({"selected_objects": obsToRemove}, use_global=True) for c in collectionsToRemove: if c.name.startswith('LLS_'): bpy.data.collections.remove(c) # update index if index > 0: index = index - 1 props.list_index = index return{'FINISHED'}
Example #4
Source File: muv_texlock_ops.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def execute(self, context): props = context.scene.muv_props.texlock obj = bpy.context.active_object bm = bmesh.from_edit_mesh(obj.data) if muv_common.check_version(2, 73, 0) >= 0: bm.verts.ensure_lookup_table() bm.edges.ensure_lookup_table() bm.faces.ensure_lookup_table() if not bm.loops.layers.uv: self.report( {'WARNING'}, "Object must have more than one UV map") return {'CANCELLED'} uv_layer = bm.loops.layers.uv.verify() props.verts_orig = [ {"vidx": v.index, "vco": v.co.copy(), "moved": False} for v in bm.verts if v.select] return {'FINISHED'}
Example #5
Source File: io_import_LRO_Lola_MGS_Mola_img.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def update_fpath(self, context): global start_up start_up=False ReadLabel(bpy.context.scene.fpath) if Message != "": start_up=True else: typ = bpy.types.Scene var = bpy.props typ.FromLat = var.FloatProperty(description="From Latitude", min=float(MINIMUM_LATITUDE), max=float(MAXIMUM_LATITUDE), precision=3, default=0.0) typ.ToLat = var.FloatProperty(description="To Latitude", min=float(MINIMUM_LATITUDE), max=float(MAXIMUM_LATITUDE), precision=3) typ.FromLong = var.FloatProperty(description="From Longitude", min=float(WESTERNMOST_LONGITUDE), max=float(EASTERNMOST_LONGITUDE), precision=3) typ.ToLong = var.FloatProperty(description="To Longitude", min=float(WESTERNMOST_LONGITUDE), max=float(EASTERNMOST_LONGITUDE), precision=3) typ.Scale = var.IntProperty(description="Scale", min=1, max=100, default=1) typ.Magnify = var.BoolProperty(description="Magnify", default=False) #Import the data and draw the planet
Example #6
Source File: nodes.py From Arnold-For-Blender with GNU General Public License v3.0 | 6 votes |
def ai_properties(self): props = { "filter": ('STRING', self.filter), "mipmap_bias": ('INT', self.mipmap_bias), "single_channel": ('BOOL', self.single_channel), "start_channel": ('BYTE', self.start_channel), "swrap": ('STRING', self.swrap), "twrap": ('STRING', self.twrap), "sscale": ('FLOAT', self.sscale), "tscale": ('FLOAT', self.tscale), "sflip": ('BOOL', self.sflip), "tflip": ('BOOL', self.tflip), "soffset": ('FLOAT', self.soffset), "toffset": ('FLOAT', self.toffset), "swap_st": ('BOOL', self.swap_st), "ignore_missing_textures": ('BOOL', self.swap_st), } if self.filename: props["filename"] = ('STRING', bpy.path.abspath(self.filename)) if self.uvset: props["uvset"] = ('STRING', self.uvset) return props
Example #7
Source File: io_import_LRO_Lola_MGS_Mola_img.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def initialize(): global MAXIMUM_LATITUDE, MINIMUM_LATITUDE global WESTERNMOST_LONGITUDE, EASTERNMOST_LONGITUDE global LINES, LINE_SAMPLES, SAMPLE_BITS, MAP_RESOLUTION global OFFSET, SCALING_FACTOR global SAMPLE_TYPE, UNIT, TARGET_NAME, RadiusUM, Message global start_up LINES = LINE_SAMPLES = SAMPLE_BITS = MAP_RESOLUTION = 0 MAXIMUM_LATITUDE = MINIMUM_LATITUDE = 0.0 WESTERNMOST_LONGITUDE = EASTERNMOST_LONGITUDE = 0.0 OFFSET = SCALING_FACTOR = 0.0 SAMPLE_TYPE = UNIT = TARGET_NAME = RadiusUM = Message = "" start_up=True bpy.types.Scene.fpath = bpy.props.StringProperty( name="Import File ", description="Select your img file", subtype="FILE_PATH", default="", update=update_fpath)
Example #8
Source File: render_cube_map.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def register(): bpy.utils.register_class(CubeMapInfo) bpy.utils.register_class(CubeMapSetup) bpy.types.Scene.cube_map = bpy.props.PointerProperty( name="cube_map", type=CubeMapInfo, options={'HIDDEN'}, ) bpy.utils.register_class(RENDER_PT_cube_map) bpy.app.handlers.render_init.append(cube_map_render_init) bpy.app.handlers.render_pre.append(cube_map_render_pre) bpy.app.handlers.render_post.append(cube_map_render_post) bpy.app.handlers.render_cancel.append(cube_map_render_cancel) bpy.app.handlers.render_complete.append(cube_map_render_complete)
Example #9
Source File: __init__.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def modal(self, context, event): if event.type == 'TIMER': if not self._thread.is_alive(): wm = context.window_manager props = wm.sketchfab terminate(props.filepath) if context.area: context.area.tag_redraw() # forward message from upload thread if not sf_state.report_type: sf_state.report_type = 'ERROR' self.report({sf_state.report_type}, sf_state.report_message) wm.event_timer_remove(self._timer) self._thread.join() sf_state.uploading = False return {'FINISHED'} return {'PASS_THROUGH'}
Example #10
Source File: oscurart_mesh_cache_tools.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def register(): from bpy.types import Scene from bpy.props import (BoolProperty, IntProperty, StringProperty, ) Scene.pc_pc2_rotx = BoolProperty(default=True, name="Rotx = 90") Scene.pc_pc2_world_space = BoolProperty(default=True, name="World Space") Scene.pc_pc2_modifiers = BoolProperty(default=True, name="Apply Modifiers") Scene.pc_pc2_subsurf = BoolProperty(default=True, name="Turn Off SubSurf") Scene.pc_pc2_start = IntProperty(default=0, name="Frame Start") Scene.pc_pc2_end = IntProperty(default=100, name="Frame End") Scene.pc_pc2_group = StringProperty() Scene.pc_pc2_folder = StringProperty(default="Set me Please!") Scene.pc_pc2_exclude = StringProperty(default="*") bpy.utils.register_module(__name__)
Example #11
Source File: __init__.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def save(self): scn = bpy.context.scene cats = set([cat.name for cat in self.cats]) libpath = bpy.context.scene.matlib.current_library.path cmd = """ print(30*"+") import bpy if not hasattr(bpy.context.scene, "matlib_categories"): class EmptyProps(bpy.types.PropertyGroup): pass bpy.utils.register_class(EmptyProps) bpy.types.Scene.matlib_categories = bpy.props.CollectionProperty(type=EmptyProps) cats = bpy.context.scene.matlib_categories for cat in cats: cats.remove(0) """ for cat in cats: cmd += """ cat = cats.add() cat.name = "%s" """ % cat.capitalize() cmd +=''' bpy.ops.wm.save_mainfile(filepath="%s", check_existing=False, compress=True)''' % winpath(libpath) return send_command(cmd, "save_categories.py")
Example #12
Source File: light_preview_list.py From leomoon-lightstudio with GNU General Public License v3.0 | 5 votes |
def register(): from bpy.types import WindowManager from bpy.props import EnumProperty WindowManager.lls_tex_previews = EnumProperty( items=enum_previews_from_directory_items, get=preview_enum_get, set=preview_enum_set, ) import bpy.utils.previews pcoll = bpy.utils.previews.new() pcoll.lls_tex_previews = () pcoll.initiated = False pcoll.dir_update_time = os.path.getmtime(directory) preview_collections["main"] = pcoll
Example #13
Source File: muv_texproj_ops.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def execute(self, context): props = context.scene.muv_props.texproj if props.running is True: MUV_TexProjRenderer.handle_remove(self, context) props.running = False if context.area: context.area.tag_redraw() return {'FINISHED'}
Example #14
Source File: light_profiles.py From leomoon-lightstudio with GNU General Public License v3.0 | 5 votes |
def execute(self, context): props = context.scene.LLStudio with open(self.filepath, 'r') as f: file = f.read() f.closed file = json.loads(file) parse_profile(context, props, file["profiles"], float(file["version"])) return{'FINISHED'}
Example #15
Source File: light_profiles.py From leomoon-lightstudio with GNU General Public License v3.0 | 5 votes |
def move_index(self, context): """ Move index of an item render queue while clamping it. """ props = context.scene.LLStudio index = props.list_index list_length = len(props.profile_list) - 1 # (index starts at 0) new_index = 0 if self.direction == 'UP': new_index = index - 1 elif self.direction == 'DOWN': new_index = index + 1 new_index = max(0, min(new_index, list_length)) props.list_index = new_index
Example #16
Source File: light_profiles.py From leomoon-lightstudio with GNU General Public License v3.0 | 5 votes |
def execute(self, context): props = context.scene.LLStudio list = props.profile_list index = props.list_index scene = context.scene lls_collection, profile_collection = llscol_profilecol(context) profile_copy = duplicate_collection(profile_collection, None) profile = [ob for ob in profile_copy.objects if ob.name.startswith('LLS_PROFILE')][0] handle = [ob for ob in profile.children if ob.name.startswith('LLS_HANDLE')][0] for l in [lm for lc in profile_copy.children if lc.name.startswith('LLS_Light') for lm in lc.objects if lm.name.startswith('LLS_LIGHT_MESH')]: l.constraints['Copy Location'].target = handle new_list_item = props.profile_list.add() new_list_item.empty_name = profile_copy.name_full new_list_item.name = props.profile_list[props.list_index].name + ' Copy' # place copied profile next to source profile lastItemId = len(props.profile_list)-1 while lastItemId > props.list_index+1: list.move(lastItemId-1, lastItemId) lastItemId -= 1 return{'FINISHED'}
Example #17
Source File: io_import_lipSync_Importer.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def clear_properties(): # can happen on reload if bpy.context.scene is None: return props = ["fpath", "skscale", "offset", "easeIn", "easeOut", "holdGap", "blinkSp", "blinkNm", "blinkMod"] for p in props: if p in bpy.types.Scene.bl_rna.properties: exec("del bpy.types.Scene."+p) if p in bpy.context.scene: del bpy.context.scene[p] # registering the script
Example #18
Source File: __init__.py From glTF-Blender-IO with Apache License 2.0 | 5 votes |
def save_settings(self, context): # find all export_ props all_props = self.properties export_props = {x: getattr(self, x) for x in dir(all_props) if (x.startswith("export_") or x == "use_selection") and all_props.get(x) is not None} context.scene[self.scene_key] = export_props
Example #19
Source File: operator.py From crack_it with GNU General Public License v3.0 | 5 votes |
def invoke(self, context, event): crackit = context.scene.crackit_ex # Integrate Props in __init__.py into props in the class self.fracture_div = crackit.fracture_div self.fracture_recursion = crackit.fracture_recursion self.pre_simplify = crackit.pre_simplify return self.execute(context) # Access by bpy.ops.mesh.crackit_ex_surface
Example #20
Source File: __init__.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def register(): bpy.utils.register_module(__name__) bpy.types.Scene.atom_cluster = bpy.props.PointerProperty(type= CLASS_atom_cluster_Properties) bpy.types.INFO_MT_mesh_add.append(DEF_menu_func)
Example #21
Source File: ui.py From Arnold-For-Blender with GNU General Public License v3.0 | 5 votes |
def draw(self, context): layout = self.layout camera = context.camera props = camera.arnold col = layout.column() col.prop(props, "camera_type") layout.prop(props, "exposure") col = layout.column() col.prop(props, "rolling_shutter") col.prop(props, "rolling_shutter_duration") col = layout.column() col.prop(props, "enable_dof") subcol = col.column() subcol.enabled = props.enable_dof subcol.prop(props, "aperture_size") subcol.prop(props, "aperture_blades") subcol.prop(props, "aperture_blade_curvature") subcol.prop(props, "aperture_rotation") subcol.prop(props, "aperture_aspect_ratio") col = layout.column() col.prop(props, "shutter_start") col.prop(props, "shutter_end") col.prop(props, "shutter_type") ## ## Object ##
Example #22
Source File: bTrace.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def register(): for c in classes: bpy.utils.register_class(c) bpy.types.WindowManager.curve_tracer = bpy.props.PointerProperty(type=TracerProperties) bpy.types.WindowManager.btrace_menu = bpy.props.PointerProperty(type=TracerPropertiesMenu, update=deselect_others)
Example #23
Source File: node_presets.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def draw(self, context): layout = self.layout dirpath = node_search_path(context) if dirpath == "": layout.label("Set search dir in the addon-prefs") return for filepath, group_name in node_template_cache(context): props = layout.operator(NODE_OT_template_add.bl_idname, text=group_name) props.filepath = filepath props.group_name = group_name
Example #24
Source File: muv_cpuv_ops.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def execute(self, context): props = context.scene.muv_props.cpuv_obj if self.uv_map == "": self.report({'INFO'}, "Copy UV coordinate per object") else: self.report( {'INFO'}, "Copy UV coordinate per object (UV map:" + self.uv_map + ")") bpy.ops.object.mode_set(mode='EDIT') obj = context.active_object bm = bmesh.from_edit_mesh(obj.data) if muv_common.check_version(2, 73, 0) >= 0: bm.faces.ensure_lookup_table() # get UV layer if self.uv_map == "": if not bm.loops.layers.uv: self.report( {'WARNING'}, "Object must have more than one UV map") return {'CANCELLED'} uv_layer = bm.loops.layers.uv.verify() else: uv_layer = bm.loops.layers.uv[self.uv_map] # get selected face props.src_uvs = [] props.src_pin_uvs = [] for face in bm.faces: uvs = [l[uv_layer].uv.copy() for l in face.loops] pin_uvs = [l[uv_layer].pin_uv for l in face.loops] props.src_uvs.append(uvs) props.src_pin_uvs.append(pin_uvs) self.report({'INFO'}, "%s's UV coordinates are copied" % (obj.name)) return {'FINISHED'}
Example #25
Source File: __init__.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def read(self, pull=True): #mandar a imprimir el listado catfile = winpath(os.path.join(matlib_path, "categories.txt")) cmd = """ import bpy, json class EmptyProps(bpy.types.PropertyGroup): pass bpy.utils.register_class(EmptyProps) bpy.types.Scene.matlib_categories = bpy.props.CollectionProperty(type=EmptyProps) cats = [] for cat in bpy.context.scene.matlib_categories: materials = [] for mat in bpy.data.materials: if "category" in mat.keys() and mat['category'] == cat.name: materials.append(mat.name) cats.append([cat.name, materials]) with open("%s", "w") as f: f.write(json.dumps(cats, sort_keys=True, indent=4)) """ % catfile if pull: send_command(cmd) #leer el fichero with open(catfile, "r") as f: cats = json.loads(f.read()) dd(cats) # #refrescar categorias # for cat in self.cats: # self.cats.remove(0) # # for cat in cats: # item = self.cats.add() # item.name = cat # return cats
Example #26
Source File: __init__.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def register(): bpy.types.Scene.UTVertDrop = bpy.props.BoolProperty( name="Vert", default=False, description="Vert Tools") bpy.types.Scene.UTEdgeDrop = bpy.props.BoolProperty( name="Edge", default=False, description="Edge Tools") bpy.types.Scene.UTFaceDrop = bpy.props.BoolProperty( name="Face", default=False, description="Face Tools") bpy.types.Scene.UTUtils1Drop = bpy.props.BoolProperty( name="Utils", default=False, description="Misc Utils") mesh_pen_tool.register() vfe_specials.register() bpy.utils.register_module(__name__) wm = bpy.context.window_manager # Add "Extras" menu to the "" menu bpy.types.VIEW3D_MT_edit_mesh_specials.prepend(menu_func) bpy.types.VIEW3D_MT_select_edit_mesh.prepend(menu_select) try: bpy.types.VIEW3D_MT_Select_Edit_Mesh.prepend(menu_select) except: pass
Example #27
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 #28
Source File: ui_previews_dynamic_enum.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def register(): from bpy.types import WindowManager from bpy.props import ( StringProperty, EnumProperty, ) WindowManager.my_previews_dir = StringProperty( name="Folder Path", subtype='DIR_PATH', default="" ) WindowManager.my_previews = EnumProperty( items=enum_previews_from_directory_items, ) # Note that preview collections returned by bpy.utils.previews # are regular Python objects - you can use them to store custom data. # # This is especially useful here, since: # - It avoids us regenerating the whole enum over and over. # - It can store enum_items' strings # (remember you have to keep those strings somewhere in py, # else they get freed and Blender references invalid memory!). import bpy.utils.previews pcoll = bpy.utils.previews.new() pcoll.my_previews_dir = "" pcoll.my_previews = () preview_collections["main"] = pcoll bpy.utils.register_class(PreviewsExamplePanel)
Example #29
Source File: __init__.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def execute(self, context): props = bpy.context.scene.fd_roombuilder wall = props.walls[props.wall_index] for index, obstacle in enumerate(wall.obstacles): if obstacle.bp_name == self.obstacle_bp_name: wall.obstacles.remove(index) obj_bp = context.scene.objects[self.obstacle_bp_name] utils.delete_object_and_children(obj_bp) return {'FINISHED'}
Example #30
Source File: __init__.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def execute(self, context): props = context.scene.fd_roombuilder mv = context.scene.mv for old_wall in props.walls: props.walls.remove(0) bpy.ops.fd_object.draw_floor_plane() obj_floor = context.active_object obj_floor.name = "Floor" obj_floor.mv.name_object = "Floor" obj_floor.fd_roombuilder.is_floor = True self.assign_floor_material(context,obj_floor) bpy.ops.fd_object.draw_floor_plane() ceiling = context.active_object ceiling.name = 'Ceiling' ceiling.mv.name_object = "Ceiling" ceiling.location.z = mv.default_wall_height ceiling.hide = True ceiling.fd_roombuilder.is_ceiling = True bpy.ops.fd_object.add_room_lamp() for obj in context.scene.objects: if obj.mv.type == 'BPWALL': wall = fd_types.Wall(obj) self.assign_wall_material(context, wall.get_wall_mesh()) wall = props.walls.add() wall.name = obj.mv.name_object wall.bp_name = obj.name if obj.fd_roombuilder.is_floor: floor = props.walls.add() floor.name = obj.mv.name_object floor.bp_name = obj.name if obj.fd_roombuilder.is_ceiling: ceiling = props.walls.add() ceiling.name = obj.mv.name_object ceiling.bp_name = obj.name return {'FINISHED'}