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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r--source/blender/makesrna/intern/rna_object.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 9c1d0c4cc2b..40bea3a6051 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -40,6 +40,7 @@
#include "DNA_meta_types.h"
#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
#include "BKE_paint.h"
#include "BKE_editmesh.h"
@@ -1471,6 +1472,11 @@ int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
return (ss && ss->bm);
}
+static void rna_Object_lod_distance_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+ BKE_object_lod_sort(ob);
+}
#else
static void rna_def_vertex_group(BlenderRNA *brna)
@@ -2030,6 +2036,41 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
}
+static void rna_def_object_lodlevel(BlenderRNA* brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LodLevel", NULL);
+ RNA_def_struct_sdna(srna, "LodLevel");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "distance");
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Distance", "Distance to begin using this level of detail");
+ RNA_def_property_update(prop, NC_OBJECT|ND_LOD, "rna_Object_lod_distance_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "source");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "Object to use for this level of detail");
+ RNA_def_property_update(prop, NC_OBJECT|ND_LOD, NULL);
+
+ prop = RNA_def_property(srna, "use_mesh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_MESH);
+ RNA_def_property_ui_text(prop, "Use Mesh", "Use the mesh from this object at this level of detail");
+ RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0);
+ RNA_def_property_update(prop, NC_OBJECT|ND_LOD, NULL);
+
+ prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_MAT);
+ RNA_def_property_ui_text(prop, "Use Material", "Use the material from this object at this level of detail");
+ RNA_def_property_ui_icon(prop, ICON_MATERIAL, 0);
+ RNA_def_property_update(prop, NC_OBJECT|ND_LOD, NULL);
+}
+
+
static void rna_def_object(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2690,6 +2731,13 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL);
+ /* Levels of Detail */
+ prop = RNA_def_property(srna, "lod_levels", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "lodlevels", NULL);
+ RNA_def_property_struct_type(prop, "LodLevel");
+ RNA_def_property_ui_text(prop, "Level of Detail Levels", "A collection of detail levels to automatically switch between");
+ RNA_def_property_update(prop, NC_OBJECT|ND_LOD, NULL);
+
RNA_api_object(srna);
}
@@ -2800,6 +2848,7 @@ void RNA_def_object(BlenderRNA *brna)
rna_def_material_slot(brna);
rna_def_dupli_object(brna);
RNA_define_animate_sdna(true);
+ rna_def_object_lodlevel(brna);
}
#endif