[Bf-blender-cvs] [893633527dd] soc-2018-npr: Initial port to 2.8
Sebastian Parborg
noreply at git.blender.org
Mon Jul 16 03:28:44 CEST 2018
Commit: 893633527dd39488aa2104db6123bbd68e005cdd
Author: Sebastian Parborg
Date: Thu Jun 28 12:03:36 2018 +0200
Branches: soc-2018-npr
https://developer.blender.org/rB893633527dd39488aa2104db6123bbd68e005cdd
Initial port to 2.8
===================================================================
M intern/opensubdiv/opensubdiv_capi.h
M intern/opensubdiv/opensubdiv_evaluator_capi.cc
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/bmesh/intern/bmesh_polygon.c
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/CMakeLists.txt
M source/blender/modifiers/MOD_modifiertypes.h
A source/blender/modifiers/intern/MOD_mybmesh.c
M source/blender/modifiers/intern/MOD_util.c
===================================================================
diff --git a/intern/opensubdiv/opensubdiv_capi.h b/intern/opensubdiv/opensubdiv_capi.h
index 2c3fcee7dbb..b135b4be706 100644
--- a/intern/opensubdiv/opensubdiv_capi.h
+++ b/intern/opensubdiv/opensubdiv_capi.h
@@ -119,6 +119,16 @@ void openSubdiv_evaluateLimit(OpenSubdiv_EvaluatorDescr *evaluator_descr,
float dPdu[3],
float dPdv[3]);
+void openSubdiv_evaluateLimit2(OpenSubdiv_EvaluatorDescr *evaluator_descr,
+ int osd_face_index,
+ float face_u, float face_v,
+ float P[3],
+ float dPdu[3],
+ float dPdv[3],
+ float dPduu[3],
+ float dPduv[3],
+ float dPdvv[3]);
+
void openSubdiv_evaluateVarying(OpenSubdiv_EvaluatorDescr *evaluator_descr,
int osd_face_index,
float face_u, float face_v,
diff --git a/intern/opensubdiv/opensubdiv_evaluator_capi.cc b/intern/opensubdiv/opensubdiv_evaluator_capi.cc
index c4a128213dd..8baba0061ce 100644
--- a/intern/opensubdiv/opensubdiv_evaluator_capi.cc
+++ b/intern/opensubdiv/opensubdiv_evaluator_capi.cc
@@ -287,6 +287,69 @@ public:
}
}
+ void EvalPatchesWithDerivatives2(PatchCoord& patch_coord,
+ float P[3],
+ float dPdu[3],
+ float dPdv[3],
+ float dPduu[3],
+ float dPduv[3],
+ float dPdvv[3])
+ {
+ StackAllocatedBuffer<6, 1> vertex_data;
+ StackAllocatedBuffer<6, 1> derivatives;
+ StackAllocatedBuffer<6, 1> derivatives1;
+ StackAllocatedBuffer<6, 1> derivatives2;
+ BufferDescriptor vertex_desc(0, 3, 6),
+ du_desc(0, 3, 6),
+ dv_desc(3, 3, 6),
+ duu_desc(0, 3, 6),
+ duv_desc(3, 3, 6),
+ dvv_desc(0, 3, 6);
+ SinglePatchCoordBuffer patch_coord_buffer(patch_coord);
+ const EVALUATOR *eval_instance =
+ OpenSubdiv::Osd::GetEvaluator<EVALUATOR>(evaluator_cache_,
+ src_desc_,
+ vertex_desc,
+ du_desc,
+ dv_desc,
+ duu_desc,
+ duv_desc,
+ dvv_desc,
+ device_context_);
+ EVALUATOR::EvalPatches(src_data_, src_desc_,
+ &vertex_data, vertex_desc,
+ &derivatives, du_desc,
+ &derivatives, dv_desc,
+ &derivatives1, duu_desc,
+ &derivatives1, duv_desc,
+ &derivatives2, dvv_desc,
+ patch_coord_buffer.GetNumVertices(),
+ &patch_coord_buffer,
+ patch_table_, eval_instance, device_context_);
+ float *refined_verts = vertex_data.BindCpuBuffer();
+ memcpy(P, refined_verts, sizeof(float) * 3);
+ if (dPdu != NULL || dPdv != NULL || dPduu != NULL || dPduv != NULL || dPdvv != NULL) {
+ float *refined_drivatives = derivatives.BindCpuBuffer();
+ float *refined_drivatives1 = derivatives1.BindCpuBuffer();
+ float *refined_drivatives2 = derivatives2.BindCpuBuffer();
+ if (dPdu) {
+ memcpy(dPdu, refined_drivatives, sizeof(float) * 3);
+ }
+ if (dPdv) {
+ memcpy(dPdv, refined_drivatives + 3, sizeof(float) * 3);
+ }
+ if (dPduu) {
+ memcpy(dPduu, refined_drivatives1, sizeof(float) * 3);
+ }
+ if (dPduv) {
+ memcpy(dPduv, refined_drivatives1 + 3, sizeof(float) * 3);
+ }
+ if (dPdvv) {
+ memcpy(dPdvv, refined_drivatives2, sizeof(float) * 3);
+ }
+ }
+ }
+
void EvalPatchVarying(PatchCoord& patch_coord,
float varying[3]) {
StackAllocatedBuffer<3, 1> varying_data;
@@ -354,8 +417,8 @@ OpenSubdiv_EvaluatorDescr *openSubdiv_createEvaluatorDescr(
/* Apply uniform refinement to the mesh so that we can use the
* limit evaluation API features.
*/
- TopologyRefiner::UniformOptions options(subsurf_level);
- refiner->RefineUniform(options);
+ TopologyRefiner::AdaptiveOptions options(subsurf_level);
+ refiner->RefineAdaptive(options);
/* Generate stencil table to update the bi-cubic patches control
* vertices after they have been re-posed (both for vertex & varying
@@ -482,6 +545,34 @@ void openSubdiv_evaluateLimit(OpenSubdiv_EvaluatorDescr *evaluator_descr,
}
}
+void openSubdiv_evaluateLimit2(OpenSubdiv_EvaluatorDescr *evaluator_descr,
+ int osd_face_index,
+ float face_u, float face_v,
+ float P[3],
+ float dPdu[3],
+ float dPdv[3],
+ float dPduu[3],
+ float dPduv[3],
+ float dPdvv[3])
+{
+ assert((face_u >= 0.0f) && (face_u <= 1.0f) && (face_v >= 0.0f) && (face_v <= 1.0f));
+ const PatchTable::PatchHandle *handle =
+ evaluator_descr->patch_map->FindPatch(osd_face_index, face_u, face_v);
+ PatchCoord patch_coord(*handle, face_u, face_v);
+ if (dPdu != NULL || dPdv != NULL || dPduu != NULL || dPduv != NULL || dPdvv != NULL ) {
+ evaluator_descr->eval_output->EvalPatchesWithDerivatives2(patch_coord,
+ P,
+ dPdu,
+ dPdv,
+ dPduu,
+ dPduv,
+ dPdvv);
+ }
+ else {
+ evaluator_descr->eval_output->EvalPatchCoord(patch_coord, P);
+ }
+}
+
void openSubdiv_evaluateVarying(OpenSubdiv_EvaluatorDescr *evaluator_descr,
int osd_face_index,
float face_u, float face_v,
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 03ebea69d2b..c331f9ecd3e 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -624,6 +624,31 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row.operator("object.multires_external_save", text="Save External...")
row.label()
+ def MY_BMESH(self, layout, ob, md):
+ split = layout.split(percentage=0.25)
+
+ col = split.column()
+ col.label(text="§6.1:")
+ col.prop(md, "do_tri")
+ col.prop(md, "do_ff_bb_split")
+
+ col = split.column()
+ col.label(text="§6.2:")
+ col.prop(md, "do_cusp_dect")
+ col.prop(md, "do_insert")
+ col.prop(md, "do_cusp_insert")
+
+ col = split.column()
+ col.label(text="§6.3:")
+ col.prop(md, "do_rad_insert")
+ col.prop(md, "do_rad_flip")
+ col.prop(md, "do_opti")
+
+
+ col = layout.column()
+ col.label(text="Camera Object:")
+ col.prop(md, "camera_object", text="")
+
def OCEAN(self, layout, ob, md):
if not bpy.app.build_options.mod_oceansim:
layout.label("Built without OceanSim modifier")
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 7cbc6461667..60197f2e6df 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -946,7 +946,7 @@ void BM_face_triangulate(
int nf_i = 0;
int ne_i = 0;
- BLI_assert(BM_face_is_normal_valid(f));
+ //BLI_assert(BM_face_is_normal_valid(f));
/* ensure both are valid or NULL */
BLI_assert((r_faces_new == NULL) == (r_faces_new_tot == NULL));
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 8a8f4715ea3..603efb43569 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1104,6 +1104,9 @@ static void tselem_draw_icon(
case eModifierType_Wireframe:
ICON_DRAW(ICON_MOD_WIREFRAME);
break;
+ case eModifierType_MyBMesh:
+ ICON_DRAW(ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
+ break;
case eModifierType_LaplacianDeform:
ICON_DRAW(ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
break;
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index ecece648ce1..fad666d5189 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -90,6 +90,7 @@ typedef enum ModifierType {
eModifierType_CorrectiveSmooth = 51,
eModifierType_MeshSequenceCache = 52,
eModifierType_SurfaceDeform = 53,
+ eModifierType_MyBMesh = 54,
NUM_MODIFIER_TYPES
} ModifierType;
@@ -1494,6 +1495,13 @@ enum {
MOD_WIREFRAME_CREASE = (1 << 5),
};
+/* Modifier data stored in the blend file */
+typedef struct MyBMeshModifierData {
+ ModifierData modifier;
+ struct Object *camera_ob;
+ int flag; /* options stored here */
+ short pad[2];
+} MyBMeshModifierData;
typedef struct DataTransferModifierData {
ModifierData modifier;
@@ -1638,4 +1646,15 @@ enum {
#define MOD_MESHSEQ_READ_ALL \
(MOD_MESHSEQ_READ_VERT | MOD_MESHSEQ_READ_POLY | MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR)
+enum {
+ MOD_MYBMESH_TRIANG = (1 << 0),
+ MOD_MYBMESH_FF_SPLIT = (1 << 1),
+ MOD_MYBMESH_CUSP_D = (1 << 2),
+ MOD_MYBMESH_CUSP_I = (1 << 3),
+ MOD_MYBMESH_FB_SPLIT = (1 << 4),
+ MOD_MYBMESH_RAD_I = (1 << 5),
+ MOD_MYBMESH_RAD_FLIP = (1 << 6),
+ MOD_MYBMESH_OPTI = (1
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list