Commit: 6f5393d8fb30677720de0560e8a3ad13655c901a Author: Brecht Van Lommel Date: Wed Feb 26 18:37:07 2020 +0100 Branches: new-object-types https://developer.blender.org/rB6f5393d8fb30677720de0560e8a3ad13655c901a
Objects: add WITH_NEW_OBJECT_TYPES build options Hair and pointcloud objects are now hidden from the UI and API by default. =================================================================== M CMakeLists.txt M intern/cycles/blender/CMakeLists.txt M intern/cycles/blender/blender_curves.cpp M release/scripts/startup/bl_ui/properties_data_hair.py M release/scripts/startup/bl_ui/properties_data_pointcloud.py M release/scripts/startup/bl_ui/space_dopesheet.py M release/scripts/startup/bl_ui/space_outliner.py 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_ops.c M source/blender/editors/space_buttons/CMakeLists.txt M source/blender/editors/space_buttons/buttons_context.c 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_main.c M source/blender/makesrna/intern/rna_main_api.c M source/blender/makesrna/intern/rna_object.c =================================================================== diff --git a/CMakeLists.txt b/CMakeLists.txt index 0116446454e..fa1336fb789 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,6 +311,10 @@ 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) + # 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 d9a2ebf8571..904a4751274 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -91,6 +91,10 @@ if(WITH_MOD_FLUID) add_definitions(-DWITH_FLUID) endif() +if(WITH_NEW_OBJECT_TYPES) + add_definitions(-DWITH_NEW_OBJECT_TYPES) +endif() + blender_add_lib(bf_intern_cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # avoid link failure with clang 3.4 debug diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp index a9ba277e8b8..55633170c45 100644 --- a/intern/cycles/blender/blender_curves.cpp +++ b/intern/cycles/blender/blender_curves.cpp @@ -1154,6 +1154,7 @@ 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())); @@ -1319,10 +1320,12 @@ 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) { @@ -1331,6 +1334,7 @@ void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motio else { export_hair_curves(scene, hair, b_hair); } +#endif /* WITH_NEW_OBJECT_TYPES */ } void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, diff --git a/release/scripts/startup/bl_ui/properties_data_hair.py b/release/scripts/startup/bl_ui/properties_data_hair.py index e86c2566ac4..fe18a3edbce 100644 --- a/release/scripts/startup/bl_ui/properties_data_hair.py +++ b/release/scripts/startup/bl_ui/properties_data_hair.py @@ -63,7 +63,7 @@ class DATA_PT_hair(DataButtonsPanel, Panel): class DATA_PT_custom_props_hair(DataButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} _context_path = "object.data" - _property_type = bpy.types.Hair + _property_type = bpy.types.Hair if hasattr(bpy.types, "Hair") else None classes = ( diff --git a/release/scripts/startup/bl_ui/properties_data_pointcloud.py b/release/scripts/startup/bl_ui/properties_data_pointcloud.py index 658618e6e77..24a4585be90 100644 --- a/release/scripts/startup/bl_ui/properties_data_pointcloud.py +++ b/release/scripts/startup/bl_ui/properties_data_pointcloud.py @@ -63,7 +63,7 @@ class DATA_PT_pointcloud(DataButtonsPanel, Panel): class DATA_PT_custom_props_pointcloud(DataButtonsPanel, PropertyPanel, Panel): COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'} _context_path = "object.data" - _property_type = bpy.types.PointCloud + _property_type = bpy.types.PointCloud if hasattr(bpy.types, "PointCloud") else None classes = ( diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index efe9e38b3a7..7dd9c86711a 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -125,9 +125,9 @@ class DopesheetFilterPopoverBase: flow.prop(dopesheet, "show_lattices", text="Lattices") if bpy.data.metaballs: flow.prop(dopesheet, "show_metaballs", text="Metaballs") - if bpy.data.hairs: + if hasattr(bpy.data, "hairs") and bpy.data.hairs: flow.prop(dopesheet, "show_hairs", text="Hairs") - if bpy.data.pointclouds: + if hasattr(bpy.data, "pointclouds") and bpy.data.pointclouds: flow.prop(dopesheet, "show_pointclouds", text="Point Clouds") if bpy.data.volumes: flow.prop(dopesheet, "show_volumes", text="Volumes") diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index 1d7348d7925..cc773300d9e 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -397,8 +397,8 @@ class OUTLINER_PT_filter(Panel): if ( bpy.data.curves or bpy.data.metaballs or - bpy.data.hairs or - bpy.data.pointclouds or + (hasattr(bpy.data, "hairs") and bpy.data.hairs) or + (hasattr(bpy.data, "pointclouds") and bpy.data.pointclouds) or bpy.data.volumes or bpy.data.lightprobes or bpy.data.lattices or diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 7f0cad85576..5fd7ecc025d 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -376,7 +376,8 @@ class USERPREF_PT_edit_objects_duplicate_data(EditingPanel, CenterAlignMixIn, Pa col.prop(edit, "use_duplicate_curve", text="Curve") # col.prop(edit, "use_duplicate_fcurve", text="F-Curve") # Not implemented. col.prop(edit, "use_duplicate_grease_pencil", text="Grease Pencil") - col.prop(edit, "use_duplicate_hair", text="Hair") + if hasattr(edit, "use_duplicate_hair"): + col.prop(edit, "use_duplicate_hair", text="Hair") col = flow.column() col.prop(edit, "use_duplicate_light", text="Light") col.prop(edit, "use_duplicate_lightprobe", text="Light Probe") @@ -385,7 +386,8 @@ class USERPREF_PT_edit_objects_duplicate_data(EditingPanel, CenterAlignMixIn, Pa col.prop(edit, "use_duplicate_metaball", text="Metaball") col = flow.column() col.prop(edit, "use_duplicate_particle", text="Particle") - col.prop(edit, "use_duplicate_pointcloud", text="Point Cloud") + if hasattr(edit, "use_duplicate_pointcloud"): + col.prop(edit, "use_duplicate_pointcloud", text="Point Cloud") col.prop(edit, "use_duplicate_surface", text="Surface") col.prop(edit, "use_duplicate_text", text="Text") # col.prop(edit, "use_duplicate_texture", text="Texture") # Not implemented. diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 9e69163193a..37a1975bb68 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2132,8 +2132,10 @@ 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') - layout.operator("object.hair_add", text="Hair", icon='OUTLINER_OB_HAIR') - layout.operator("object.pointcloud_add", text="Point Cloud", icon='OUTLINER_OB_POINTCLOUD') + if hasattr(bpy.data, "hairs"): + layout.operator("object.hair_add", text="Hair", icon='OUTLINER_OB_HAIR') + if hasattr(bpy.data, "pointclouds"): + 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') @@ -5330,6 +5332,11 @@ class VIEW3D_PT_object_type_visibility(Panel): col.separator() continue + if attr == "hair" and not hasattr(bpy.data, "hairs"): + continue + elif attr == "pointcloud" and not hasattr(bpy.data, "pointclouds"): + continue + attr_v = "show_object_viewport_" f"{attr:s}" attr_s = "show_object_select_" f"{attr:s}" diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index c56b51ceaf6..a5b6fa55aa9 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -89,4 +89,8 @@ 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_ops.c b/source/blender/editors/object/object_ops.c index 384df4c1d7d..52273b887dd 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -109,8 +109,10 @@ 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_append(OBJECT_OT_pointcloud_add); +#endif WM_operatortype_append(OBJECT_OT_volume_add); WM_operatortype_append(OBJECT_OT_volume_import); WM_operatortype_append(OBJECT_OT_add); diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt index 25ff6bbd098..c3b7d65689f 100644 --- a/source/blender/editors/space_buttons/CMakeLists.txt +++ b/source/blender/editors/space_buttons/CMakeLists.txt @@ -54,4 +54,8 @@ if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) endif() +if(WITH_NEW_OBJECT_TYPES) + add_definitions(-DWITH_NEW_OBJECT_TYPES) +endif() + blender_add_lib(bf_editor_spac @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs