[Bf-blender-cvs] [2faef3473c0] blender2.8: Cycles: Use new internal hair shape properties.

Clément Foucault noreply at git.blender.org
Wed May 30 12:25:31 CEST 2018


Commit: 2faef3473c061e34a03668905c8d81672a72dd38
Author: Clément Foucault
Date:   Tue May 29 11:22:07 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB2faef3473c061e34a03668905c8d81672a72dd38

Cycles: Use new internal hair shape properties.

The do_version actually copy the existing custom properties to the internal
ones, because theses properties are straight port from cycles.

===================================================================

M	intern/cycles/blender/addon/properties.py
M	intern/cycles/blender/addon/ui.py
M	intern/cycles/blender/addon/version_update.py
M	intern/cycles/blender/blender_curves.cpp

===================================================================

diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index f3403602bea..aea43c5ccff 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1330,49 +1330,6 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
         del bpy.types.ViewLayer.cycles
 
 
-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):
@@ -1503,7 +1460,6 @@ def register():
     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)
     bpy.utils.register_class(CyclesRenderLayerSettings)
@@ -1519,7 +1475,6 @@ 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)
     bpy.utils.unregister_class(CyclesRenderLayerSettings)
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index f7749c16400..2900f47c7bd 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1410,37 +1410,6 @@ class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel):
         col.prop(cscene, "debug_bvh_type")
 
 
-class CYCLES_PARTICLE_PT_curve_settings(CyclesButtonsPanel, Panel):
-    bl_label = "Cycles Hair Settings"
-    bl_context = "particle"
-
-    @classmethod
-    def poll(cls, context):
-        scene = context.scene
-        ccscene = scene.cycles_curves
-        psys = context.particle_system
-        use_curves = ccscene.use_curves and psys
-        return CyclesButtonsPanel.poll(context) and use_curves and psys.settings.type == 'HAIR'
-
-    def draw(self, context):
-        layout = self.layout
-
-        psys = context.particle_settings
-        cpsys = psys.cycles
-
-        row = layout.row()
-        row.prop(cpsys, "shape", text="Shape")
-
-        layout.label(text="Thickness:")
-        row = layout.row()
-        row.prop(cpsys, "root_width", text="Root")
-        row.prop(cpsys, "tip_width", text="Tip")
-
-        row = layout.row()
-        row.prop(cpsys, "radius_scale", text="Scaling")
-        row.prop(cpsys, "use_closetip", text="Close tip")
-
-
 class CYCLES_SCENE_PT_simplify(CyclesButtonsPanel, Panel):
     bl_label = "Simplify"
     bl_context = "scene"
@@ -1596,7 +1565,6 @@ classes = (
     CYCLES_MATERIAL_PT_viewport,
     CYCLES_RENDER_PT_bake,
     CYCLES_RENDER_PT_debug,
-    CYCLES_PARTICLE_PT_curve_settings,
     CYCLES_SCENE_PT_simplify,
 )
 
diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py
index 2689fa63ca8..611ba5cae70 100644
--- a/intern/cycles/blender/addon/version_update.py
+++ b/intern/cycles/blender/addon/version_update.py
@@ -433,3 +433,14 @@ def do_versions(self):
        (bpy.data.version >= (2, 80, 0) and bpy.data.version <= (2, 80, 4)):
         # Switch to squared roughness convention
         square_roughness_nodes_insert()
+
+    if bpy.data.version <= (2, 80, 15):
+        # Copy cycles hair settings to internal settings
+        for part in bpy.data.particles:
+            cpart = part.get("cycles", None)
+            if cpart:
+                part.shape = cpart.get("shape", 0.0)
+                part.root_radius = cpart.get("root_width", 1.0)
+                part.tip_radius = cpart.get("tip_width", 0.0)
+                part.radius_scale = cpart.get("radius_scale", 0.01)
+                part.use_close_tip = cpart.get("use_closetip", True)
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index f2bb1b0158c..e9270ee5539 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -149,18 +149,16 @@ static bool ObtainCacheParticleData(Mesh *mesh,
 				if(b_part.kink() == BL::ParticleSettings::kink_SPIRAL)
 					ren_step += b_part.kink_extra_steps();
 
-				PointerRNA cpsys = RNA_pointer_get(&b_part.ptr, "cycles");
-
 				CData->psys_firstcurve.push_back_slow(curvenum);
 				CData->psys_curvenum.push_back_slow(totcurves);
 				CData->psys_shader.push_back_slow(shader);
 
-				float radius = get_float(cpsys, "radius_scale") * 0.5f;
+				float radius = b_part.radius_scale() * 0.5f;
 
-				CData->psys_rootradius.push_back_slow(radius * get_float(cpsys, "root_width"));
-				CData->psys_tipradius.push_back_slow(radius * get_float(cpsys, "tip_width"));
-				CData->psys_shape.push_back_slow(get_float(cpsys, "shape"));
-				CData->psys_closetip.push_back_slow(get_boolean(cpsys, "use_closetip"));
+				CData->psys_rootradius.push_back_slow(radius * b_part.root_radius());
+				CData->psys_tipradius.push_back_slow(radius * b_part.tip_radius());
+				CData->psys_shape.push_back_slow(b_part.shape());
+				CData->psys_closetip.push_back_slow(b_part.use_close_tip());
 
 				int pa_no = 0;
 				if(!(b_part.child_type() == 0) && totchild != 0)



More information about the Bf-blender-cvs mailing list