[Bf-blender-cvs] [77aa62e] alembic_basic_io: Move scale and axis cnversion properties into the CacheFile data-block.

Kévin Dietrich noreply at git.blender.org
Mon Jun 20 18:59:37 CEST 2016


Commit: 77aa62e6b0953e4c8fe985489553450309fe8511
Author: Kévin Dietrich
Date:   Mon Jun 20 17:55:31 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB77aa62e6b0953e4c8fe985489553450309fe8511

Move scale and axis cnversion properties into the CacheFile data-block.

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

M	source/blender/alembic/intern/abc_object.cc
M	source/blender/alembic/intern/alembic_capi.cc
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/makesdna/DNA_cachefile_types.h
M	source/blender/makesdna/DNA_constraint_types.h
M	source/blender/makesrna/intern/rna_cachefile.c
M	source/blender/makesrna/intern/rna_constraint.c

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

diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 410a3f0..5b9c093 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -403,7 +403,6 @@ void AbcObjectReader::readObjectMatrix(const float time)
 		bTransformCacheConstraint *data = static_cast<bTransformCacheConstraint *>(con->data);
 		data->cache_file = m_settings->cache_file;
 		BLI_strncpy(data->abc_object_path, m_iobject.getFullName().c_str(), FILE_MAX);
-		data->scale = m_settings->scale;
 	}
 }
 
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index 4a85e24..95492ab 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -509,6 +509,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
 	CacheFile *cache_file = static_cast<CacheFile *>(BKE_cachefile_add(data->bmain, BLI_path_basename(data->filename)));
 
 	cache_file->is_sequence = data->settings.is_sequence;
+	cache_file->scale = data->settings.scale;
 	BLI_strncpy(cache_file->filepath, data->filename, 1024);
 
 	data->settings.cache_file = cache_file;
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index a4a3fb5..5b57d36 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4359,7 +4359,7 @@ static void transformcache_evaluate(bConstraint *con, bConstraintOb *cob, ListBa
 	BKE_cachefile_filepath_get(data->cache_file, frame, filepath);
 
 	ABC_get_transform(cob->ob, filepath, data->abc_object_path,
-	                  cob->matrix, time, data->scale);
+	                  cob->matrix, time, data->cache_file->scale);
 
 	UNUSED_VARS(targets);
 }
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index a3cc35e..6fdd11d 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -3888,4 +3888,19 @@ void uiTemplateCacheFile(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
 
 	row = uiLayoutRow(layout, false);
 	uiItemR(row, &fileptr, "frame_scale", 0, "Frame Scale", ICON_NONE);
+
+	row = uiLayoutRow(layout, false);
+	uiItemL(row, IFACE_("Manual Transform:"), ICON_NONE);
+
+	row = uiLayoutRow(layout, false);
+	uiItemR(row, &fileptr, "scale", 0, "Scale", ICON_NONE);
+
+	/* TODO: unused for now, so no need to expose. */
+#if 0
+	row = uiLayoutRow(layout, false);
+	uiItemR(row, &fileptr, "forward_axis", 0, "Forward Axis", ICON_NONE);
+
+	row = uiLayoutRow(layout, false);
+	uiItemR(row, &fileptr, "up_axis", 0, "Up Axis", ICON_NONE);
+#endif
 }
diff --git a/source/blender/makesdna/DNA_cachefile_types.h b/source/blender/makesdna/DNA_cachefile_types.h
index 33bff80..2eeaf24 100644
--- a/source/blender/makesdna/DNA_cachefile_types.h
+++ b/source/blender/makesdna/DNA_cachefile_types.h
@@ -40,8 +40,13 @@ typedef struct CacheFile {
 	ID id;
 
 	char filepath[1024];  /* 1024 = FILE_MAX */
+
 	char is_sequence;
-	char pad[7];
+	char forward_axis;
+	char up_axis;
+	char pad;
+
+	float scale;
 
 	float frame_start;
 	float frame_scale;
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index eb00780..5d58218 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -462,12 +462,6 @@ typedef struct bObjectSolverConstraint {
 typedef struct bTransformCacheConstraint {
 	struct CacheFile *cache_file;
 	char abc_object_path[1024];  /* FILE_MAX */
-
-	char forward_axis;
-	char up_axis;
-	char pad[2];
-
-	float scale;
 } bTransformCacheConstraint;
 
 /* ------------------------------------------ */
diff --git a/source/blender/makesrna/intern/rna_cachefile.c b/source/blender/makesrna/intern/rna_cachefile.c
index 1c6da38..3a98e2e 100644
--- a/source/blender/makesrna/intern/rna_cachefile.c
+++ b/source/blender/makesrna/intern/rna_cachefile.c
@@ -26,8 +26,9 @@
 #include "DNA_cachefile_types.h"
 #include "DNA_scene_types.h"
 
-#include "RNA_define.h"
 #include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
 
 #include "rna_internal.h"
 
@@ -62,6 +63,26 @@ static void rna_def_cachefile(BlenderRNA *brna)
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Frame Scale", "Evaluation time in seconds");
 	RNA_def_property_update(prop, 0, NULL);
+
+	/* ----------------- Axis Conversion ----------------- */
+
+	prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "forward_axis");
+	RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
+	RNA_def_property_ui_text(prop, "Forward", "");
+	RNA_def_property_update(prop, 0, NULL);
+
+	prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "up_axis");
+	RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
+	RNA_def_property_ui_text(prop, "Up", "");
+	RNA_def_property_update(prop, 0, NULL);
+
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "scale");
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_ui_text(prop, "Scale", "");
+	RNA_def_property_update(prop, 0, NULL);
 }
 
 void RNA_def_cachefile(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index c617613..7c75491 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -2594,26 +2594,6 @@ static void rna_def_constraint_transform_cache(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "abc_object_path", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Object Path", "Path to the object in the Alembic archive");
 	RNA_def_property_update(prop, 0, "rna_Constraint_update");
-
-	/* Axis Conversion */
-
-	prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_sdna(prop, NULL, "forward_axis");
-	RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
-	RNA_def_property_ui_text(prop, "Forward", "");
-	RNA_def_property_update(prop, 0, "rna_Constraint_update");
-
-	prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_sdna(prop, NULL, "up_axis");
-	RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
-	RNA_def_property_ui_text(prop, "Up", "");
-	RNA_def_property_update(prop, 0, "rna_Constraint_update");
-
-	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "scale");
-	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Scale", "");
-	RNA_def_property_update(prop, 0, "rna_Constraint_update");
 }
 
 /* base struct for constraints */




More information about the Bf-blender-cvs mailing list