[Bf-blender-cvs] [87ceff3d1b5] master: Preferences: New experimental settings for particle system and hair

Jacques Lucke noreply at git.blender.org
Tue Jun 23 11:34:07 CEST 2020


Commit: 87ceff3d1b5805658622a314a84620b52ab98c7d
Author: Jacques Lucke
Date:   Tue Jun 23 11:30:46 2020 +0200
Branches: master
https://developer.blender.org/rB87ceff3d1b5805658622a314a84620b52ab98c7d

Preferences: New experimental settings for particle system and hair

This replaces the cmake options `WITH_NEW_OBJECT_TYPES` and
`WITH_NEW_SIMULATION_TYPE` with two experimental userpref settings:

* `use_new_particle_system`: Enables the point cloud type and the simulation editor.
* `use_new_hair_type`: Only displays the add-operator in the add menu for now.

Note, in the current state you can't do anything productive with the new particle
system or the new hair type. Features will be added step by step in the upcoming
weeks and months.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8096

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

M	CMakeLists.txt
M	intern/cycles/blender/CMakeLists.txt
M	intern/cycles/blender/blender_curves.cpp
M	intern/cycles/blender/blender_geometry.cpp
M	intern/cycles/blender/blender_object.cpp
M	release/scripts/startup/bl_ui/space_userpref.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/object/CMakeLists.txt
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_ops.c
M	source/blender/editors/space_buttons/CMakeLists.txt
M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_node/CMakeLists.txt
M	source/blender/editors/space_node/space_node.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/makesrna.c
M	source/blender/makesrna/intern/rna_ID.c
M	source/blender/makesrna/intern/rna_action.c
M	source/blender/makesrna/intern/rna_main.c
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6864c206bea..60c6f638370 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -321,14 +321,6 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
 # Freestyle
 option(WITH_FREESTYLE     "Enable Freestyle (advanced edges rendering)" ON)
 
-# New object types
-option(WITH_NEW_OBJECT_TYPES "Enable new hair and pointcloud objects (use for development only, don't save in files)" OFF)
-mark_as_advanced(WITH_NEW_OBJECT_TYPES)
-
-# New simulation data block
-option(WITH_NEW_SIMULATION_TYPE "Enable simulation data block (use for development only, don't save in files)" OFF)
-mark_as_advanced(WITH_NEW_SIMULATION_TYPE)
-
 # Misc
 if(WIN32)
   option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt
index 496e8e9310b..4589f4573d9 100644
--- a/intern/cycles/blender/CMakeLists.txt
+++ b/intern/cycles/blender/CMakeLists.txt
@@ -92,10 +92,6 @@ if(WITH_MOD_FLUID)
   add_definitions(-DWITH_FLUID)
 endif()
 
-if(WITH_NEW_OBJECT_TYPES)
-  add_definitions(-DWITH_NEW_OBJECT_TYPES)
-endif()
-
 if(WITH_OPENVDB)
   add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
   list(APPEND INC_SYS
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index e1f84925987..7eb76c8bd8f 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -628,7 +628,6 @@ void BlenderSync::sync_particle_hair(
   }
 }
 
-#ifdef WITH_NEW_OBJECT_TYPES
 static float4 hair_point_as_float4(BL::HairPoint b_point)
 {
   float4 mP = float3_to_float4(get_float3(b_point.co()));
@@ -794,12 +793,10 @@ static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_st
     export_hair_motion_validate_attribute(hair, motion_step, num_motion_keys, have_motion);
   }
 }
-#endif /* WITH_NEW_OBJECT_TYPES */
 
 /* Hair object. */
 void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motion_step)
 {
-#ifdef WITH_NEW_OBJECT_TYPES
   /* Convert Blender hair to Cycles curves. */
   BL::Hair b_hair(b_ob.data());
   if (motion) {
@@ -808,12 +805,6 @@ void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motio
   else {
     export_hair_curves(scene, hair, b_hair);
   }
-#else
-  (void)hair;
-  (void)b_ob;
-  (void)motion;
-  (void)motion_step;
-#endif /* WITH_NEW_OBJECT_TYPES */
 }
 
 void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
@@ -832,15 +823,11 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
   hair->used_shaders = used_shaders;
 
   if (view_layer.use_hair) {
-#ifdef WITH_NEW_OBJECT_TYPES
     if (b_ob.type() == BL::Object::type_HAIR) {
       /* Hair object. */
       sync_hair(hair, b_ob, false);
-      assert(mesh == NULL);
     }
-    else
-#endif
-    {
+    else {
       /* Particle hair. */
       bool need_undeformed = hair->need_attribute(scene, ATTR_STD_GENERATED);
       BL::Mesh b_mesh = object_to_mesh(
@@ -872,16 +859,12 @@ void BlenderSync::sync_hair_motion(BL::Depsgraph b_depsgraph,
 
   /* Export deformed coordinates. */
   if (ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
-#ifdef WITH_NEW_OBJECT_TYPES
     if (b_ob.type() == BL::Object::type_HAIR) {
       /* Hair object. */
       sync_hair(hair, b_ob, true, motion_step);
-      assert(mesh == NULL);
       return;
     }
-    else
-#endif
-    {
+    else {
       /* Particle hair. */
       BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
       if (b_mesh) {
diff --git a/intern/cycles/blender/blender_geometry.cpp b/intern/cycles/blender/blender_geometry.cpp
index 7d63899cb99..f7e4623024d 100644
--- a/intern/cycles/blender/blender_geometry.cpp
+++ b/intern/cycles/blender/blender_geometry.cpp
@@ -40,13 +40,9 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
   BL::Material material_override = view_layer.material_override;
   Shader *default_shader = (b_ob.type() == BL::Object::type_VOLUME) ? scene->default_volume :
                                                                       scene->default_surface;
-#ifdef WITH_NEW_OBJECT_TYPES
   Geometry::Type geom_type = (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) ?
                                  Geometry::HAIR :
                                  Geometry::MESH;
-#else
-  Geometry::Type geom_type = (use_particle_hair) ? Geometry::HAIR : Geometry::MESH;
-#endif
 
   /* Find shader indices. */
   vector<Shader *> used_shaders;
@@ -125,11 +121,7 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
 
   geom->name = ustring(b_ob_data.name().c_str());
 
-#ifdef WITH_NEW_OBJECT_TYPES
   if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
-#else
-  if (use_particle_hair) {
-#endif
     Hair *hair = static_cast<Hair *>(geom);
     sync_hair(b_depsgraph, b_ob, hair, used_shaders);
   }
@@ -170,11 +162,7 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
     return;
   }
 
-#ifdef WITH_NEW_OBJECT_TYPES
   if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
-#else
-  if (use_particle_hair) {
-#endif
     Hair *hair = static_cast<Hair *>(geom);
     sync_hair_motion(b_depsgraph, b_ob, hair, motion_step);
   }
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index c28586d0f63..d3a37563ef4 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -69,11 +69,7 @@ bool BlenderSync::object_is_mesh(BL::Object &b_ob)
 
   BL::Object::type_enum type = b_ob.type();
 
-#ifdef WITH_NEW_OBJECT_TYPES
   if (type == BL::Object::type_VOLUME || type == BL::Object::type_HAIR) {
-#else
-  if (type == BL::Object::type_VOLUME) {
-#endif
     /* Will be exported attached to mesh. */
     return true;
   }
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 436d866886b..42ae00203f3 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -2139,6 +2139,8 @@ class USERPREF_PT_experimental_system(ExperimentalPanel, Panel):
         self._draw_items(
             context, (
                 ({"property": "use_undo_legacy"}, "T60695"),
+                ({"property": "use_new_particle_system"}, "T73324"),
+                ({"property": "use_new_hair_type"}, "T68981"),
             ),
         )
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index e248064c999..0daf9761246 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2171,9 +2171,9 @@ class VIEW3D_MT_add(Menu):
         layout.menu("VIEW3D_MT_surface_add", icon='OUTLINER_OB_SURFACE')
         layout.menu("VIEW3D_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META')
         layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
-        if hasattr(bpy.data, "hairs"):
+        if context.preferences.experimental.use_new_hair_type:
             layout.operator("object.hair_add", text="Hair", icon='OUTLINER_OB_HAIR')
-        if hasattr(bpy.data, "pointclouds"):
+        if context.preferences.experimental.use_new_particle_system:
             layout.operator("object.pointcloud_add", text="Point Cloud", icon='OUTLINER_OB_POINTCLOUD')
         layout.menu("VIEW3D_MT_volume_add", text="Volume", icon='OUTLINER_OB_VOLUME')
         layout.operator_menu_enum("object.gpencil_add", "type", text="Grease Pencil", icon='OUTLINER_OB_GREASEPENCIL')
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index fb273cf49a8..953ef8114f9 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -91,8 +91,4 @@ if(WITH_INTERNATIONAL)
   add_definitions(-DWITH_INTERNATIONAL)
 endif()
 
-if(WITH_NEW_OBJECT_TYPES)
-  add_definitions(-DWITH_NEW_OBJECT_TYPES)
-endif()
-
 blender_add_lib(bf_editor_object "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index b60ce459ba6..99e7186f07b 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1511,6 +1511,14 @@ void OBJECT_OT_speaker_add(wmOperatorType *ot)
 /** \name Add Hair Operator
  * \{ */
 
+static bool object_hair_add_poll(bContext *C)
+{
+  if (!U.experimental.use_new_hair_type) {
+    return false;
+  }
+  return ED_operator_objectmode(C);
+}
+
 static int object_hair_add_exec(bContext *C, wmOperator *op)
 {
   ushort local_view_bits;
@@ -1534,7 +1542,7 @@ void OBJECT_OT_hair_add(wmOperatorType *ot)
 
   /* api callbacks */
   ot->exec = object_hair_add_exec;
-  ot->poll = ED_operator_objectmode;
+  ot->poll = object_hair_add_poll;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1548,6 +1556,14 @@ void OBJECT_OT_hair_add(wmOperatorType *ot)
 /** \name Add Point Cloud Operator
  * \{ */
 
+static bool object_pointcloud_add_poll(bContext *C)
+{
+  if (!U.experimental.use_new_particle_system) {
+    return false;
+  }
+  return ED_operator_objectmode(C);
+}
+
 static int object_pointcloud_add_exec(bContext *C, wmOperator *op)
 {
   ushort local_view_bits;
@@ -1571,7 +1587,7 @@ void OBJECT_OT_pointcloud_add(wmOperatorType *ot)
 
   /* api callbacks */
   ot->exec = object_pointcloud_add_exec;
-  ot->poll = ED_operator_objectmode;
+  ot->poll = object_pointcloud_add_poll;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 29058175e25..e28bbb3fb1c 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -109,10 +109,8 @@ void ED_operatortypes_object(void)
   WM_operatortype_append(OBJECT_OT_light_add);
   WM_operatortype_append(OBJECT_OT_camera_add);
   WM_operatortype_append(OBJECT_OT_speaker_add);
-#ifdef WITH_NEW_OBJECT_TYPES
   WM_operatortype_append(OBJECT_OT_hair_add);
   WM_operatortype_app

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list