Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 7 Nov 2016 14:46:27 +0000 (15:46 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 7 Nov 2016 14:46:27 +0000 (15:46 +0100)
Conflicts:
intern/cycles/blender/addon/properties.py

20 files changed:
1  2 
build_files/build_environment/install_deps.sh
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_sync.cpp
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenloader/intern/versioning_270.c
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.h
source/blender/depsgraph/intern/depsgraph_build.cc
source/blender/depsgraph/intern/depsgraph_tag.cc
source/blender/editors/object/object_add.c
source/blender/editors/object/object_relations.c
source/blender/makesdna/DNA_rigidbody_types.h
source/blender/makesrna/intern/rna_rigidbody.c
source/blender/makesrna/intern/rna_userdef.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 86a0e1cdaf690502a112dfd19ff1ebe777212947,27c9b9220420335c4a197dd54e50c420790668e3..3888cdef70e5cf755ba46ab295f899aa1dacc2e0
@@@ -1087,6 -1094,146 +1094,103 @@@ class CyclesCurveRenderSettings(bpy.typ
          del bpy.types.Scene.cycles_curves
  
  
 -class CyclesCurveSettings(bpy.types.PropertyGroup):
 -    @classmethod
 -    def register(cls):
 -        bpy.types.ParticleSettings.cycles = PointerProperty(
 -                name="Cycles Hair Settings",
 -                description="Cycles hair settings",
 -                type=cls,
 -                )
 -        cls.radius_scale = FloatProperty(
 -                name="Radius Scaling",
 -                description="Multiplier of width properties",
 -                min=0.0, max=1000.0,
 -                default=0.01,
 -                )
 -        cls.root_width = FloatProperty(
 -                name="Root Size",
 -                description="Strand's width at root",
 -                min=0.0, max=1000.0,
 -                default=1.0,
 -                )
 -        cls.tip_width = FloatProperty(
 -                name="Tip Multiplier",
 -                description="Strand's width at tip",
 -                min=0.0, max=1000.0,
 -                default=0.0,
 -                )
 -        cls.shape = FloatProperty(
 -                name="Strand Shape",
 -                description="Strand shape parameter",
 -                min=-1.0, max=1.0,
 -                default=0.0,
 -                )
 -        cls.use_closetip = BoolProperty(
 -                name="Close tip",
 -                description="Set tip radius to zero",
 -                default=True,
 -                )
 -
 -    @classmethod
 -    def unregister(cls):
 -        del bpy.types.ParticleSettings.cycles
 -
 -
+ class CyclesDeviceSettings(bpy.types.PropertyGroup):
+     @classmethod
+     def register(cls):
+         cls.id = StringProperty(name="ID")
+         cls.name = StringProperty(name="Name")
+         cls.use = BoolProperty(name="Use", default=True)
+         cls.type = EnumProperty(name="Type", items=enum_device_type, default='CUDA')
+ class CyclesPreferences(bpy.types.AddonPreferences):
+     bl_idname = __package__
+     def get_device_types(self, context):
+         import _cycles
+         has_cuda, has_opencl = _cycles.get_device_types()
+         list = [('NONE', "None", "Don't use compute device", 0)]
+         if has_cuda:
+             list.append(('CUDA', "CUDA", "Use CUDA for GPU acceleration", 1))
+         if has_opencl:
+             list.append(('OPENCL', "OpenCL", "Use OpenCL for GPU acceleration", 2))
+         return list
+     compute_device_type = EnumProperty(
+             name="Compute Device Type",
+             description="Device to use for computation (rendering with Cycles)",
+             items=get_device_types,
+             )
+     devices = bpy.props.CollectionProperty(type=CyclesDeviceSettings)
+     def get_devices(self):
+         import _cycles
+         # Layout of the device tuples: (Name, Type, Internal ID, Persistent ID)
+         device_list = _cycles.available_devices()
+         cuda_devices = []
+         opencl_devices = []
+         for device in device_list:
+             if not device[1] in {'CUDA', 'OPENCL'}:
+                 continue
+             entry = None
+             # Try to find existing Device entry
+             for dev in self.devices:
+                 if dev.id == device[2] and dev.type == device[1]:
+                     entry = dev
+                     break
+             # Create new entry if no existing one was found
+             if not entry:
+                 entry = self.devices.add()
+                 entry.id   = device[2]
+                 entry.name = device[0]
+                 entry.type = device[1]
+             # Sort entries into lists
+             if entry.type == 'CUDA':
+                 cuda_devices.append(entry)
+             elif entry.type == 'OPENCL':
+                 opencl_devices.append(entry)
+         return cuda_devices, opencl_devices
+     def has_active_device(self):
+         import _cycles
+         device_list = _cycles.available_devices()
+         for device in device_list:
+             if device[1] != self.compute_device_type:
+                 continue
+             if any(dev.use and dev.id == device[2] for dev in self.devices):
+                 return True
+         return False
+     def draw_impl(self, layout, context):
+         layout.label(text="Compute Device:")
+         layout.row().prop(self, "compute_device_type", expand=True)
+         cuda_devices, opencl_devices = self.get_devices()
+         row = layout.row()
+         if cuda_devices:
+             col = row.column(align=True)
+             col.label(text="CUDA devices:")
+             for device in cuda_devices:
+                 col.prop(device, "use", text=device.name, toggle=True)
+         if opencl_devices:
+             col = row.column(align=True)
+             col.label(text="OpenCL devices:")
+             for device in opencl_devices:
+                 col.prop(device, "use", text=device.name, toggle=True)
+     def draw(self, context):
+         self.draw_impl(self.layout, context)
  def register():
      bpy.utils.register_class(CyclesRenderSettings)
      bpy.utils.register_class(CyclesCameraSettings)
      bpy.utils.register_class(CyclesMeshSettings)
      bpy.utils.register_class(CyclesObjectSettings)
      bpy.utils.register_class(CyclesCurveRenderSettings)
 -    bpy.utils.register_class(CyclesCurveSettings)
+     bpy.utils.register_class(CyclesDeviceSettings)
+     bpy.utils.register_class(CyclesPreferences)
  
  
  def unregister():
      bpy.utils.unregister_class(CyclesObjectSettings)
      bpy.utils.unregister_class(CyclesVisibilitySettings)
      bpy.utils.unregister_class(CyclesCurveRenderSettings)
 -    bpy.utils.unregister_class(CyclesCurveSettings)
+     bpy.utils.unregister_class(CyclesDeviceSettings)
+     bpy.utils.unregister_class(CyclesPreferences)
Simple merge