Guest User

Untitled

a guest
Nov 21st, 2017
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. class MySettings(PropertyGroup):
  2.  
  3. bpy.types.Scene.my_prop = bpy.props.BoolProperty(update=lambda self, context:
  4. common_update(self, context, 'my_bool_one'))
  5.  
  6. def common_update(self, context, origin):
  7.  
  8. obj = context.object
  9. scene = context.scene
  10.  
  11. for ob in scene.objects:
  12. if (scene.my_prop == True):
  13. if ob.name.startswith("Glide"):
  14. ob.hide = True
  15. else:
  16. ob.hide = False #This will not unhide it. Unhide does not work either!
  17. else:
  18. ob.hide = False
  19.  
  20. class PathSETTINGS(Panel):
  21. bl_idname = "OBJECT_PT_my_panel"
  22. bl_label = "My Panel"
  23. bl_space_type = "VIEW_3D"
  24. bl_region_type = "TOOLS"
  25. bl_category = "NewTest"
  26.  
  27.  
  28.  
  29. def draw(self, context):
  30. obj = context.object
  31. layout = self.layout
  32. scene = context.scene
  33. layout.label("First row")
  34. row = layout.row(align=True)
  35. row.alignment = 'EXPAND'
  36. row = layout.row()
  37. row = layout.row()
  38. # row.operator("object.lamp_add(type='HEMI'), text="Add Hemisphere")
  39. row = layout.row()
  40. row.prop(scene, "my_prop", text="Hide Object")
  41. row = layout.row()
  42. row = layout.row()
  43. row.prop(scene, "my_enum")
  44.  
  45. def register():
  46. bpy.types.Scene.my_prop
  47. bpy.utils.register_class(PathSETTINGS)
  48. bpy.utils.register_class(MySettings)
  49.  
  50. def unregister():
  51. del bpy.types.Scene.my_prop
  52. bpy.utils.unregister_class(PathSETTINGS)
  53. bpy.utils.uregister_class(PathSETTINGS)
Add Comment
Please, Sign In to add comment