[Bf-blender-cvs] [89f1778] alembic: Option for the haircut cache modifier to either use a scene object or an "internal" object from the group.
Lukas Tönne
noreply at git.blender.org
Fri May 22 17:53:32 CEST 2015
Commit: 89f17783285be016b36255368c618ed80ec42235
Author: Lukas Tönne
Date: Fri May 22 12:30:55 2015 +0200
Branches: alembic
https://developer.blender.org/rB89f17783285be016b36255368c618ed80ec42235
Option for the haircut cache modifier to either use a scene object or
an "internal" object from the group.
===================================================================
M release/scripts/startup/bl_ui/properties_object.py
M source/blender/blenkernel/intern/cache_library.c
M source/blender/makesdna/DNA_cache_library_types.h
M source/blender/makesrna/intern/rna_cache_library.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index 6241c86..f870f65 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -567,7 +567,9 @@ class OBJECT_PT_cache_library(ObjectButtonsPanel, Panel):
sub.enabled = False
sub.prop(md, "hair_system")
- layout.prop_search(md, "target", context.blend_data, "objects", icon='OBJECT_DATA')
+ row = layout.row()
+ row.prop_search(md, "target", context.blend_data, "objects", icon='OBJECT_DATA')
+ row.prop(md, "use_internal_target", text="Internal")
layout = layout.column()
layout.active = md.hair_system is not None
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index d934c9d..07b24a5 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -1793,20 +1793,29 @@ static void haircut_apply(HaircutCacheModifier *hmd, HaircutCacheData *data, Str
}
}
-static void haircut_process(HaircutCacheModifier *hmd, CacheProcessContext *UNUSED(ctx), CacheProcessData *data, int UNUSED(frame), int UNUSED(frame_prev), eCacheLibrary_EvalMode UNUSED(eval_mode))
+static void haircut_process(HaircutCacheModifier *hmd, CacheProcessContext *ctx, CacheProcessData *data, int UNUSED(frame), int UNUSED(frame_prev), eCacheLibrary_EvalMode UNUSED(eval_mode))
{
Object *ob = hmd->object;
DupliObject *dob;
Strands *strands;
- DupliObjectData *target_data;
+ DerivedMesh *target_dm;
float mat[4][4];
HaircutCacheData shrinkwrap;
if (!BKE_cache_modifier_find_strands(data->dupcache, ob, hmd->hair_system, NULL, &strands, NULL))
return;
- if (!BKE_cache_modifier_find_object(data->dupcache, hmd->target, &target_data))
- return;
+ if (hmd->flag & eHaircutCacheModifier_Flag_InternalTarget) {
+ DupliObjectData *target_data;
+ if (!BKE_cache_modifier_find_object(data->dupcache, hmd->target, &target_data))
+ return;
+ target_dm = target_data->dm;
+ }
+ else {
+ if (!hmd->target)
+ return;
+ target_dm = mesh_get_derived_final(ctx->scene, hmd->target, CD_MASK_BAREMESH);
+ }
for (dob = data->dupcache->duplilist.first; dob; dob = dob->next) {
if (dob->ob != ob)
@@ -1816,7 +1825,7 @@ static void haircut_process(HaircutCacheModifier *hmd, CacheProcessContext *UNUS
invert_m4_m4(mat, dob->mat);
memset(&shrinkwrap, 0, sizeof(shrinkwrap));
- haircut_data_get_bvhtree(&shrinkwrap, target_data->dm, true);
+ haircut_data_get_bvhtree(&shrinkwrap, target_dm, true);
haircut_data_get_instances(&shrinkwrap, hmd->target, mat, &data->dupcache->duplilist);
haircut_apply(hmd, &shrinkwrap, strands);
diff --git a/source/blender/makesdna/DNA_cache_library_types.h b/source/blender/makesdna/DNA_cache_library_types.h
index 48b30d9..a8400eb 100644
--- a/source/blender/makesdna/DNA_cache_library_types.h
+++ b/source/blender/makesdna/DNA_cache_library_types.h
@@ -274,9 +274,13 @@ typedef struct HaircutCacheModifier {
struct Object *object;
int hair_system;
- int pad;
+ int flag;
struct Object *target;
} HaircutCacheModifier;
+typedef enum eHaircutCacheModifier_Flag {
+ eHaircutCacheModifier_Flag_InternalTarget = (1 << 0),
+} eHaircutCacheModifier_Flag;
+
#endif
diff --git a/source/blender/makesrna/intern/rna_cache_library.c b/source/blender/makesrna/intern/rna_cache_library.c
index 5ed0d0f..39727cb 100644
--- a/source/blender/makesrna/intern/rna_cache_library.c
+++ b/source/blender/makesrna/intern/rna_cache_library.c
@@ -771,6 +771,11 @@ static void rna_def_cache_modifier_haircut(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Target", "Mesh object to wrap onto");
RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "use_internal_target", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eHaircutCacheModifier_Flag_InternalTarget);
+ RNA_def_property_ui_text(prop, "Use Internal Target", "Use a cached object from the group instead of an object in the scene");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
}
static void rna_def_cache_modifier(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list