[Bf-blender-cvs] [e781c04a1b7] cycles_procedural_api: add a radius scale to control the radius of the curves

Kévin Dietrich noreply at git.blender.org
Sun Dec 6 06:26:31 CET 2020


Commit: e781c04a1b7b45928d50c06c5b35c0eefcdc6e9d
Author: Kévin Dietrich
Date:   Sun Dec 6 05:35:37 2020 +0100
Branches: cycles_procedural_api
https://developer.blender.org/rBe781c04a1b7b45928d50c06c5b35c0eefcdc6e9d

add a radius scale to control the radius of the curves

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

M	intern/cycles/blender/blender_object.cpp
M	intern/cycles/render/alembic.cpp
M	intern/cycles/render/alembic.h
M	source/blender/makesdna/DNA_modifier_defaults.h
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_meshsequencecache.c

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

diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 86321512b4d..56a261a1abc 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -534,6 +534,8 @@ void BlenderSync::sync_procedural(BL::Object &b_ob,
   abc_object->set_subd_dicing_rate(subd_dicing_rate);
   abc_object->set_subd_max_level(max_subdivisions);
 
+  abc_object->set_radius_scale(b_mesh_cache.radius_scale());
+
   if (abc_object->is_modified() || procedural->is_modified()) {
     procedural->tag_update(scene);
   }
diff --git a/intern/cycles/render/alembic.cpp b/intern/cycles/render/alembic.cpp
index b9289e6eb66..4009f7a49df 100644
--- a/intern/cycles/render/alembic.cpp
+++ b/intern/cycles/render/alembic.cpp
@@ -433,6 +433,8 @@ NODE_DEFINE(AlembicObject)
   SOCKET_INT(subd_max_level, "Max Subdivision Level", 1);
   SOCKET_FLOAT(subd_dicing_rate, "Subdivision Dicing Rate", 1.0f);
 
+  SOCKET_FLOAT(radius_scale, "Radius Scale", 1.0f);
+
   return type;
 }
 
@@ -813,7 +815,7 @@ void AlembicObject::load_all_data(const ICurvesSchema &schema,
           radius = (*radiuses)[offset + j];
         }
 
-        curve_radius.push_back_reserved(radius);
+        curve_radius.push_back_reserved(radius * radius_scale);
       }
 
       curve_first_key.push_back_reserved(offset);
@@ -1508,7 +1510,7 @@ void AlembicProcedural::read_curves(Scene *scene,
 
   ICurvesSchema schema = curves.getSchema();
 
-  if (!abc_object->has_data_loaded() || default_curves_radius_is_modified()) {
+  if (!abc_object->has_data_loaded() || default_curves_radius_is_modified() || abc_object->radius_scale_is_modified()) {
     abc_object->load_all_data(schema, progress, default_curves_radius);
   }
 
diff --git a/intern/cycles/render/alembic.h b/intern/cycles/render/alembic.h
index 5e6890a96b0..54436f0bdd7 100644
--- a/intern/cycles/render/alembic.h
+++ b/intern/cycles/render/alembic.h
@@ -338,6 +338,9 @@ class AlembicObject : public Node {
   /* Finest level of detail (in pixels) for the subdivision. */
   NODE_SOCKET_API(float, subd_dicing_rate)
 
+  /* Scale the radius of points and curves. */
+  NODE_SOCKET_API(float, radius_scale)
+
   AlembicObject();
   ~AlembicObject();
 
diff --git a/source/blender/makesdna/DNA_modifier_defaults.h b/source/blender/makesdna/DNA_modifier_defaults.h
index b5bcfa4d157..0a8d4ad4fc3 100644
--- a/source/blender/makesdna/DNA_modifier_defaults.h
+++ b/source/blender/makesdna/DNA_modifier_defaults.h
@@ -421,6 +421,7 @@
     .num_vertices = 0, \
     .velocity_delta = 0.0f, \
     .last_lookup_time = 0.0f, \
+    .radius_scale = 1.0f, \
   }
 
 #define _DNA_DEFAULT_MirrorModifierData \
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 232fca062fa..eec77c7d967 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -2125,7 +2125,8 @@ typedef struct MeshSeqCacheModifierData {
    * modifier was last executed. Used to access Alembic samples through the RNA. */
   float last_lookup_time;
 
-  int _pad1;
+  /* Factors the radius for curves and points. */
+  float radius_scale;
 } MeshSeqCacheModifierData;
 
 /* MeshSeqCacheModifierData.read_flag */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 2df42b87c07..67bfa02b535 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -6112,6 +6112,15 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna)
       "Multiplier used to control the magnitude of the velocity vectors for time effects");
   RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
+  prop = RNA_def_property(srna, "radius_scale", PROP_FLOAT, PROP_NONE);
+  RNA_def_property_float_sdna(prop, NULL, "radius_scale");
+  RNA_def_property_range(prop, 0.0f, FLT_MAX);
+  RNA_def_property_ui_text(
+      prop,
+      "Radius Scale",
+      "Multiplier used to control the radius for points and curves");
+  RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
   /* -------------------------- Velocity Vectors -------------------------- */
 
   prop = RNA_def_property(srna, "vertex_velocities", PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index 11d67b044bc..e72bae86f5a 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -242,6 +242,7 @@ static void panel_draw(const bContext *C, Panel *panel)
   }
 
   uiItemR(layout, ptr, "velocity_scale", 0, NULL, ICON_NONE);
+  uiItemR(layout, ptr, "radius_scale", 0, NULL, ICON_NONE);
 
   modifier_panel_end(layout, ptr);
 }



More information about the Bf-blender-cvs mailing list