Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMai Lavelle <mai.lavelle@gmail.com>2016-09-18 19:04:12 +0300
committerMai Lavelle <mai.lavelle@gmail.com>2016-09-18 19:44:43 +0300
commit940f360479f2d160e63d91dd7c64d4a91471fa73 (patch)
treee685097d8799d629ea3bb5f1adb9334fc9595e4a /intern/cycles/blender/blender_util.h
parent799454821e490d8024468ba623b2e10e67736a55 (diff)
Cycles: Fix update of subdivision meshes when global dice rates change
When subdivision settings were moved from meshes to objects this was missed, should work fine now.
Diffstat (limited to 'intern/cycles/blender/blender_util.h')
-rw-r--r--intern/cycles/blender/blender_util.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index e79f2bbb27d..e606696fb7b 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -17,6 +17,8 @@
#ifndef __BLENDER_UTIL_H__
#define __BLENDER_UTIL_H__
+#include "mesh.h"
+
#include "util_map.h"
#include "util_path.h"
#include "util_set.h"
@@ -561,6 +563,29 @@ static inline BL::DomainFluidSettings object_fluid_domain_find(BL::Object b_ob)
return BL::DomainFluidSettings(PointerRNA_NULL);
}
+static inline Mesh::SubdivisionType object_subdivision_type(BL::Object& b_ob, bool preview, bool experimental)
+{
+ PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles");
+
+ if(cobj.data && b_ob.modifiers.length() > 0 && experimental) {
+ BL::Modifier mod = b_ob.modifiers[b_ob.modifiers.length()-1];
+ bool enabled = preview ? mod.show_viewport() : mod.show_render();
+
+ if(enabled && mod.type() == BL::Modifier::type_SUBSURF && RNA_boolean_get(&cobj, "use_adaptive_subdivision")) {
+ BL::SubsurfModifier subsurf(mod);
+
+ if(subsurf.subdivision_type() == BL::SubsurfModifier::subdivision_type_CATMULL_CLARK) {
+ return Mesh::SUBDIVISION_CATMULL_CLARK;
+ }
+ else {
+ return Mesh::SUBDIVISION_LINEAR;
+ }
+ }
+ }
+
+ return Mesh::SUBDIVISION_NONE;
+}
+
/* ID Map
*
* Utility class to keep in sync with blender data.