add subsurf limits, in RNA, there were none, but subsurf would assert at 29.
Checked and subsurf level 11 gives over 3 million faces from a single triangle. So use this as a limit.
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
* float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */
|
||||
#define EPSILON (1.0e-35f)
|
||||
|
||||
/* With this limit a single triangle becomes over 3 million faces */
|
||||
#define CCGSUBSURF_LEVEL_MAX 11
|
||||
|
||||
/***/
|
||||
|
||||
typedef unsigned char byte;
|
||||
@@ -229,7 +232,7 @@ static CCGAllocatorIFC *_getStandardAllocatorIFC(void)
|
||||
int ccg_gridsize(int level)
|
||||
{
|
||||
BLI_assert(level > 0);
|
||||
BLI_assert(level <= 31);
|
||||
BLI_assert(level <= CCGSUBSURF_LEVEL_MAX + 1);
|
||||
|
||||
return (1 << (level - 1)) + 1;
|
||||
}
|
||||
@@ -245,7 +248,7 @@ int ccg_factor(int low_level, int high_level)
|
||||
static int ccg_edgesize(int level)
|
||||
{
|
||||
BLI_assert(level > 0);
|
||||
BLI_assert(level <= 30);
|
||||
BLI_assert(level <= CCGSUBSURF_LEVEL_MAX + 1);
|
||||
|
||||
return 1 + (1 << level);
|
||||
}
|
||||
@@ -254,7 +257,7 @@ static int ccg_spacing(int high_level, int low_level)
|
||||
{
|
||||
BLI_assert(high_level > 0 && low_level > 0);
|
||||
BLI_assert(high_level >= low_level);
|
||||
BLI_assert((high_level - low_level) <= 30);
|
||||
BLI_assert((high_level - low_level) <= CCGSUBSURF_LEVEL_MAX);
|
||||
|
||||
return 1 << (high_level - low_level);
|
||||
}
|
||||
@@ -262,7 +265,7 @@ static int ccg_spacing(int high_level, int low_level)
|
||||
static int ccg_edgebase(int level)
|
||||
{
|
||||
BLI_assert(level > 0);
|
||||
BLI_assert(level <= 30);
|
||||
BLI_assert(level <= CCGSUBSURF_LEVEL_MAX + 1);
|
||||
|
||||
return level + (1 << level) - 1;
|
||||
}
|
||||
|
||||
@@ -793,14 +793,17 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna)
|
||||
|
||||
rna_def_property_subdivision_common(srna, "subdivType");
|
||||
|
||||
/* see CCGSUBSURF_LEVEL_MAX for max limit */
|
||||
prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "levels");
|
||||
RNA_def_property_range(prop, 0, 11);
|
||||
RNA_def_property_ui_range(prop, 0, 6, 1, -1);
|
||||
RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, NULL, "renderLevels");
|
||||
RNA_def_property_range(prop, 0, 11);
|
||||
RNA_def_property_ui_range(prop, 0, 6, 1, -1);
|
||||
RNA_def_property_ui_text(prop, "Render Levels", "Number of subdivisions to perform when rendering");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user