Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * ***** BEGIN GPL LICENSE BLOCK ***** | 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or | 4 * This program is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU General Public License | 5 * modify it under the terms of the GNU General Public License |
6 * as published by the Free Software Foundation; either version 2 | 6 * as published by the Free Software Foundation; either version 2 |
7 * of the License, or (at your option) any later version. | 7 * of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "DNA_group_types.h" | 33 #include "DNA_group_types.h" |
34 #include "DNA_material_types.h" | 34 #include "DNA_material_types.h" |
35 #include "DNA_mesh_types.h" | 35 #include "DNA_mesh_types.h" |
36 #include "DNA_object_force.h" | 36 #include "DNA_object_force.h" |
37 #include "DNA_object_types.h" | 37 #include "DNA_object_types.h" |
38 #include "DNA_property_types.h" | 38 #include "DNA_property_types.h" |
39 #include "DNA_scene_types.h" | 39 #include "DNA_scene_types.h" |
40 #include "DNA_meta_types.h" | 40 #include "DNA_meta_types.h" |
41 | 41 |
42 #include "BLI_utildefines.h" | 42 #include "BLI_utildefines.h" |
43 #include "BLI_listbase.h" | |
43 | 44 |
44 #include "BKE_paint.h" | 45 #include "BKE_paint.h" |
45 #include "BKE_editmesh.h" | 46 #include "BKE_editmesh.h" |
46 #include "BKE_group.h" /* needed for BKE_group_object_exists() */ | 47 #include "BKE_group.h" /* needed for BKE_group_object_exists() */ |
47 #include "BKE_object.h" /* Needed for BKE_object_matrix_local_get() */ | 48 #include "BKE_object.h" /* Needed for BKE_object_matrix_local_get() */ |
48 #include "RNA_access.h" | 49 #include "RNA_access.h" |
49 #include "RNA_define.h" | 50 #include "RNA_define.h" |
50 #include "RNA_enum_types.h" | 51 #include "RNA_enum_types.h" |
51 | 52 |
52 #include "rna_internal.h" | 53 #include "rna_internal.h" |
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1438 DupliObject *dob = (DupliObject *)ptr->data; | 1439 DupliObject *dob = (DupliObject *)ptr->data; |
1439 return dob->persistent_id[0]; | 1440 return dob->persistent_id[0]; |
1440 } | 1441 } |
1441 | 1442 |
1442 int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr) | 1443 int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr) |
1443 { | 1444 { |
1444 SculptSession *ss = ((Object *)ptr->id.data)->sculpt; | 1445 SculptSession *ss = ((Object *)ptr->id.data)->sculpt; |
1445 return (ss && ss->bm); | 1446 return (ss && ss->bm); |
1446 } | 1447 } |
1447 | 1448 |
1449 static int lod_cmp(void *a, void *b) | |
1450 { | |
1451 LodLevel *loda = (LodLevel*)a; | |
1452 LodLevel *lodb = (LodLevel*)b; | |
1453 | |
1454 if (loda->distance < lodb->distance) return -1; | |
1455 return loda->distance > lodb->distance; | |
1456 } | |
1457 | |
1458 static void rna_Object_lod_distance_update(Main *bmain, Scene *scene, PointerRNA *ptr) | |
1459 { | |
1460 Object *ob = (Object *)ptr->id.data; | |
1461 LodLevel* lod = ptr->data; | |
1462 | |
1463 if (lod->distance < 0.0) lod->distance = 0.0; | |
1464 BLI_sortlist(&ob->lodlevels, lod_cmp); | |
brechtvl
2013/09/13 16:57:49
Could this code be moved in a BKE_object_lod_sort
Kupoman
2013/09/14 02:33:05
Moved most of this to object.c. All that is left i
| |
1465 } | |
1448 #else | 1466 #else |
1449 | 1467 |
1450 static int rna_matrix_dimsize_4x4[] = {4, 4}; | 1468 static int rna_matrix_dimsize_4x4[] = {4, 4}; |
1451 | 1469 |
1452 static void rna_def_vertex_group(BlenderRNA *brna) | 1470 static void rna_def_vertex_group(BlenderRNA *brna) |
1453 { | 1471 { |
1454 StructRNA *srna; | 1472 StructRNA *srna; |
1455 PropertyRNA *prop; | 1473 PropertyRNA *prop; |
1456 FunctionRNA *func; | 1474 FunctionRNA *func; |
1457 | 1475 |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1993 RNA_def_function_ui_description(func, "Delete vertex group from object") ; | 2011 RNA_def_function_ui_description(func, "Delete vertex group from object") ; |
1994 parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group t o remove"); | 2012 parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group t o remove"); |
1995 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPT R); | 2013 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPT R); |
1996 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); | 2014 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); |
1997 | 2015 |
1998 func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear"); | 2016 func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear"); |
1999 RNA_def_function_ui_description(func, "Delete all vertex groups from obj ect"); | 2017 RNA_def_function_ui_description(func, "Delete all vertex groups from obj ect"); |
2000 } | 2018 } |
2001 | 2019 |
2002 | 2020 |
2021 static void rna_def_object_lodlevel(BlenderRNA* brna) | |
2022 { | |
2023 StructRNA *srna; | |
2024 PropertyRNA *prop; | |
2025 | |
2026 srna = RNA_def_struct(brna, "LodLevel", NULL); | |
2027 RNA_def_struct_sdna(srna, "LodLevel"); | |
2028 | |
2029 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); | |
2030 RNA_def_property_float_sdna(prop, NULL, "distance"); | |
2031 RNA_def_property_ui_text(prop, "Distance", "Distance to begin using this level of detail"); | |
2032 RNA_def_property_update(prop, NC_LOD, "rna_Object_lod_distance_update"); | |
2033 | |
2034 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); | |
2035 RNA_def_property_pointer_sdna(prop, NULL, "source"); | |
2036 RNA_def_property_struct_type(prop, "Object"); | |
2037 RNA_def_property_flag(prop, PROP_EDITABLE); | |
2038 RNA_def_property_ui_text(prop, "Object", "Object to use for this level o f detail"); | |
2039 RNA_def_property_update(prop, NC_LOD, NULL); | |
2040 | |
2041 prop = RNA_def_property(srna, "use_mesh", PROP_BOOLEAN, PROP_NONE); | |
2042 RNA_def_property_boolean_sdna(prop, NULL, "use_mesh", 0); | |
2043 RNA_def_property_ui_text(prop, "Use Mesh", "Use the mesh from this objec t at this level of detail"); | |
2044 RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0); | |
2045 RNA_def_property_update(prop, NC_LOD, NULL); | |
2046 | |
2047 prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE); | |
2048 RNA_def_property_boolean_sdna(prop, NULL, "use_mat", 0); | |
2049 RNA_def_property_ui_text(prop, "Use Material", "Use the material from th is object at this level of detail"); | |
2050 RNA_def_property_ui_icon(prop, ICON_MATERIAL, 0); | |
2051 RNA_def_property_update(prop, NC_LOD, NULL); | |
2052 } | |
2053 | |
2054 | |
2003 static void rna_def_object(BlenderRNA *brna) | 2055 static void rna_def_object(BlenderRNA *brna) |
2004 { | 2056 { |
2005 StructRNA *srna; | 2057 StructRNA *srna; |
2006 PropertyRNA *prop; | 2058 PropertyRNA *prop; |
2007 | 2059 |
2008 static EnumPropertyItem up_items[] = { | 2060 static EnumPropertyItem up_items[] = { |
2009 {OB_POSX, "X", 0, "X", ""}, | 2061 {OB_POSX, "X", 0, "X", ""}, |
2010 {OB_POSY, "Y", 0, "Y", ""}, | 2062 {OB_POSY, "Y", 0, "Y", ""}, |
2011 {OB_POSZ, "Z", 0, "Z", ""}, | 2063 {OB_POSZ, "Z", 0, "Z", ""}, |
2012 {0, NULL, 0, NULL, NULL} | 2064 {0, NULL, 0, NULL, NULL} |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2653 "rna_Object_active_shape_key_index_range"); | 2705 "rna_Object_active_shape_key_index_range"); |
2654 RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index"); | 2706 RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index"); |
2655 RNA_def_property_update(prop, 0, "rna_Object_active_shape_update"); | 2707 RNA_def_property_update(prop, 0, "rna_Object_active_shape_update"); |
2656 | 2708 |
2657 /* sculpt */ | 2709 /* sculpt */ |
2658 prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOO LEAN, PROP_NONE); | 2710 prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOO LEAN, PROP_NONE); |
2659 RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sc ulpting_get", NULL); | 2711 RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sc ulpting_get", NULL); |
2660 RNA_def_property_clear_flag(prop, PROP_EDITABLE); | 2712 RNA_def_property_clear_flag(prop, PROP_EDITABLE); |
2661 RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL); | 2713 RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL); |
2662 | 2714 |
2715 /* Levels of Detail */ | |
2716 prop = RNA_def_property(srna, "lod_levels", PROP_COLLECTION, PROP_NONE); | |
2717 RNA_def_property_collection_sdna(prop, NULL, "lodlevels", NULL); | |
2718 RNA_def_property_struct_type(prop, "LodLevel"); | |
2719 RNA_def_property_ui_text(prop, "Level of Detail Levels", "A collection o f detail levels to automatically switch between"); | |
2720 RNA_def_property_update(prop, NC_LOD, NULL); | |
2721 | |
2663 RNA_api_object(srna); | 2722 RNA_api_object(srna); |
2664 } | 2723 } |
2665 | 2724 |
2666 static void rna_def_dupli_object(BlenderRNA *brna) | 2725 static void rna_def_dupli_object(BlenderRNA *brna) |
2667 { | 2726 { |
2668 StructRNA *srna; | 2727 StructRNA *srna; |
2669 PropertyRNA *prop; | 2728 PropertyRNA *prop; |
2670 | 2729 |
2671 srna = RNA_def_struct(brna, "DupliObject", NULL); | 2730 srna = RNA_def_struct(brna, "DupliObject", NULL); |
2672 RNA_def_struct_sdna(srna, "DupliObject"); | 2731 RNA_def_struct_sdna(srna, "DupliObject"); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2760 } | 2819 } |
2761 | 2820 |
2762 void RNA_def_object(BlenderRNA *brna) | 2821 void RNA_def_object(BlenderRNA *brna) |
2763 { | 2822 { |
2764 rna_def_object(brna); | 2823 rna_def_object(brna); |
2765 rna_def_object_game_settings(brna); | 2824 rna_def_object_game_settings(brna); |
2766 rna_def_object_base(brna); | 2825 rna_def_object_base(brna); |
2767 rna_def_vertex_group(brna); | 2826 rna_def_vertex_group(brna); |
2768 rna_def_material_slot(brna); | 2827 rna_def_material_slot(brna); |
2769 rna_def_dupli_object(brna); | 2828 rna_def_dupli_object(brna); |
2829 rna_def_object_lodlevel(brna); | |
2770 } | 2830 } |
2771 | 2831 |
2772 #endif | 2832 #endif |
OLD | NEW |