diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-30 18:55:14 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-30 18:55:14 +0300 |
commit | 42aa747ec036821e1cfe8bd3c314a8fb69ed56cd (patch) | |
tree | 17310cddec292b39aad44e0592e4cb922790d492 /source/blender | |
parent | 5464c2e4a8ef638b898f04e3bf0edade367fc0b6 (diff) |
RNA
* DNA_radio_types.h: done. (patch by Jorge Bernal). Also adds
some #defines in the radiosity DNA since it was using hardcoded
values.
* Added an "UnknownType" which has no properties, useful as a
placeholder for pointers that have no defined type yet.
* Sort a few lists in the code alphabetically.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesdna/DNA_radio_types.h | 12 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 95 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 15 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 13 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_radio.c | 139 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sensor.c | 2 | ||||
-rw-r--r-- | source/blender/radiosity/extern/include/radio_types.h | 4 | ||||
-rw-r--r-- | source/blender/radiosity/intern/source/raddisplay.c | 15 | ||||
-rw-r--r-- | source/blender/radiosity/intern/source/radio.c | 2 |
11 files changed, 235 insertions, 70 deletions
diff --git a/source/blender/makesdna/DNA_radio_types.h b/source/blender/makesdna/DNA_radio_types.h index e757024603b..4219bf59b93 100644 --- a/source/blender/makesdna/DNA_radio_types.h +++ b/source/blender/makesdna/DNA_radio_types.h @@ -46,5 +46,17 @@ typedef struct Radio { } Radio; + +/* **************** RADIOSITY ********************* */ + +/* draw type */ +#define RAD_WIREFRAME 0 +#define RAD_SOLID 1 +#define RAD_GOURAUD 2 + +/* flag */ +#define RAD_SHOWLIMITS 1 +#define RAD_SHOWZ 2 + #endif diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index a3c376c042e..712a6f5873d 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -35,69 +35,74 @@ struct Main; extern BlenderRNA BLENDER_RNA; +extern StructRNA RNA_ActuatorSensor; +extern StructRNA RNA_BooleanProperty; +extern StructRNA RNA_Camera; +extern StructRNA RNA_CollectionProperty; +extern StructRNA RNA_CollisionSensor; +extern StructRNA RNA_CurveMap; +extern StructRNA RNA_CurveMapPoint; +extern StructRNA RNA_CurveMapping; +extern StructRNA RNA_DelaySensor; +extern StructRNA RNA_EnumProperty; +extern StructRNA RNA_EnumPropertyItem; +extern StructRNA RNA_FloatProperty; +extern StructRNA RNA_Group; extern StructRNA RNA_ID; extern StructRNA RNA_IDProperty; extern StructRNA RNA_IDPropertyGroup; -extern StructRNA RNA_Main; -extern StructRNA RNA_CurveMapping; -extern StructRNA RNA_Mesh; -extern StructRNA RNA_MVert; -extern StructRNA RNA_MVertGroup; -extern StructRNA RNA_MEdge; -extern StructRNA RNA_MFace; -extern StructRNA RNA_MTFace; -extern StructRNA RNA_MTFaceLayer; -extern StructRNA RNA_MSticky; +extern StructRNA RNA_IntProperty; +extern StructRNA RNA_JoystickSensor; +extern StructRNA RNA_KeyboardSensor; +extern StructRNA RNA_Lamp; +extern StructRNA RNA_Library; extern StructRNA RNA_MCol; extern StructRNA RNA_MColLayer; +extern StructRNA RNA_MEdge; +extern StructRNA RNA_MFace; extern StructRNA RNA_MFloatProperty; extern StructRNA RNA_MFloatPropertyLayer; extern StructRNA RNA_MIntProperty; extern StructRNA RNA_MIntPropertyLayer; +extern StructRNA RNA_MMultires; +extern StructRNA RNA_MSticky; extern StructRNA RNA_MStringProperty; extern StructRNA RNA_MStringPropertyLayer; -extern StructRNA RNA_MMultires; -extern StructRNA RNA_Object; -extern StructRNA RNA_Struct; -extern StructRNA RNA_Property; -extern StructRNA RNA_BooleanProperty; -extern StructRNA RNA_IntProperty; -extern StructRNA RNA_FloatProperty; -extern StructRNA RNA_StringProperty; -extern StructRNA RNA_EnumProperty; -extern StructRNA RNA_EnumPropertyItem; -extern StructRNA RNA_PointerProperty; -extern StructRNA RNA_CollectionProperty; -extern StructRNA RNA_Scene; -extern StructRNA RNA_Lamp; +extern StructRNA RNA_MTFace; +extern StructRNA RNA_MTFaceLayer; +extern StructRNA RNA_MVert; +extern StructRNA RNA_MVertGroup; +extern StructRNA RNA_Main; extern StructRNA RNA_Material; -extern StructRNA RNA_NodeTree; +extern StructRNA RNA_Mesh; +extern StructRNA RNA_MessageSensor; +extern StructRNA RNA_MouseSensor; +extern StructRNA RNA_NearSensor; extern StructRNA RNA_Node; -extern StructRNA RNA_Screen; -extern StructRNA RNA_ScrVert; -extern StructRNA RNA_ScrEdge; -extern StructRNA RNA_ScrArea; -extern StructRNA RNA_Panel; -extern StructRNA RNA_Region; +extern StructRNA RNA_NodeTree; +extern StructRNA RNA_Object; extern StructRNA RNA_Operator; -extern StructRNA RNA_WindowManager; -extern StructRNA RNA_Sensor; -extern StructRNA RNA_TouchSensor; -extern StructRNA RNA_NearSensor; -extern StructRNA RNA_KeyboardSensor; +extern StructRNA RNA_Panel; +extern StructRNA RNA_PointerProperty; +extern StructRNA RNA_Property; extern StructRNA RNA_PropertySensor; -extern StructRNA RNA_MouseSensor; -extern StructRNA RNA_CollisionSensor; extern StructRNA RNA_RadarSensor; +extern StructRNA RNA_Radiosity; extern StructRNA RNA_RandomSensor; extern StructRNA RNA_RaySensor; -extern StructRNA RNA_MessageSensor; -extern StructRNA RNA_JoystickSensor; -extern StructRNA RNA_ActuatorSensor; -extern StructRNA RNA_DelaySensor; -extern StructRNA RNA_Controller; -extern StructRNA RNA_Camera; -extern StructRNA RNA_Group; +extern StructRNA RNA_Region; +extern StructRNA RNA_Scene; +extern StructRNA RNA_ScrArea; +extern StructRNA RNA_ScrEdge; +extern StructRNA RNA_ScrVert; +extern StructRNA RNA_Screen; +extern StructRNA RNA_Sensor; +extern StructRNA RNA_StringProperty; +extern StructRNA RNA_Struct; +extern StructRNA RNA_TouchSensor; +extern StructRNA RNA_UnknownType; +extern StructRNA RNA_WindowManager; + /* Pointer * * These functions will fill in RNA pointers, this can be done in three ways: diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index f233da5dbf0..576f68d7bf3 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -876,21 +876,22 @@ typedef struct RNAProcessItem { RNAProcessItem PROCESS_ITEMS[]= { {"rna_ID.c", RNA_def_ID}, - {"rna_main.c", RNA_def_main}, + {"rna_camera.c", RNA_def_camera}, {"rna_color.c", RNA_def_color}, + {"rna_controller.c", RNA_def_controller}, + {"rna_group.c", RNA_def_group}, + {"rna_lamp.c", RNA_def_lamp}, + {"rna_main.c", RNA_def_main}, + {"rna_material.c", RNA_def_material}, {"rna_mesh.c", RNA_def_mesh}, {"rna_nodetree.c", RNA_def_nodetree}, - {"rna_material.c", RNA_def_material}, {"rna_object.c", RNA_def_object}, + {"rna_radio.c", RNA_def_radio}, {"rna_rna.c", RNA_def_rna}, {"rna_scene.c", RNA_def_scene}, - {"rna_lamp.c", RNA_def_lamp}, {"rna_screen.c", RNA_def_screen}, - {"rna_wm.c", RNA_def_wm}, {"rna_sensor.c", RNA_def_sensor}, - {"rna_controller.c", RNA_def_controller}, - {"rna_camera.c", RNA_def_camera}, - {"rna_group.c", RNA_def_group}, + {"rna_wm.c", RNA_def_wm}, {NULL, NULL}}; static int rna_preprocess(char *basedirectory, FILE *f) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index df5340e5a44..2258888129e 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -185,6 +185,9 @@ static void rna_def_library(BlenderRNA *brna) } void RNA_def_ID(BlenderRNA *brna) { + /* simple built-in unknown type */ + RNA_def_struct(brna, "UnknownType", NULL, "Unknown Type"); + rna_def_ID(brna); rna_def_ID_properties(brna); rna_def_library(brna); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index cfce855fc8d..8bc52e2cdc6 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -81,21 +81,22 @@ extern BlenderDefRNA DefRNA; extern BlenderRNA BLENDER_RNA; void RNA_def_ID(struct BlenderRNA *brna); +void RNA_def_camera(struct BlenderRNA *brna); void RNA_def_color(struct BlenderRNA *brna); +void RNA_def_controller(struct BlenderRNA *brna); +void RNA_def_group(struct BlenderRNA *brna); void RNA_def_lamp(struct BlenderRNA *brna); void RNA_def_main(struct BlenderRNA *brna); +void RNA_def_material(struct BlenderRNA *brna); void RNA_def_mesh(struct BlenderRNA *brna); -void RNA_def_object(struct BlenderRNA *brna); void RNA_def_nodetree(struct BlenderRNA *brna); -void RNA_def_material(struct BlenderRNA *brna); +void RNA_def_object(struct BlenderRNA *brna); +void RNA_def_radio(struct BlenderRNA *brna); void RNA_def_rna(struct BlenderRNA *brna); void RNA_def_scene(struct BlenderRNA *brna); void RNA_def_screen(struct BlenderRNA *brna); -void RNA_def_wm(struct BlenderRNA *brna); void RNA_def_sensor(struct BlenderRNA *brna); -void RNA_def_controller(struct BlenderRNA *brna); -void RNA_def_camera(struct BlenderRNA *brna); -void RNA_def_group(struct BlenderRNA *brna); +void RNA_def_wm(struct BlenderRNA *brna); /* ID Properties */ diff --git a/source/blender/makesrna/intern/rna_radio.c b/source/blender/makesrna/intern/rna_radio.c new file mode 100644 index 00000000000..478dc2d2063 --- /dev/null +++ b/source/blender/makesrna/intern/rna_radio.c @@ -0,0 +1,139 @@ +/** + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Contributor(s): Blender Foundation (2008). + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdlib.h> + +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "DNA_radio_types.h" + +#ifdef RNA_RUNTIME + +#else + +void RNA_def_radio(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + static EnumPropertyItem prop_drawtype_items[] = { + {RAD_WIREFRAME, "WIREFRAME", "Wireframe", "Enables Wireframe draw mode"}, + {RAD_SOLID, "SOLID", "Solid", "Enables Solid draw mode"}, + {RAD_GOURAUD, "GOURAUD", "Gouraud", "Enables Gouraud draw mode"}, + {0, NULL, NULL, NULL}}; + + srna= RNA_def_struct(brna, "Radiosity", NULL, "Radiosity"); + RNA_def_struct_sdna(srna, "Radio"); + + /* Enums */ + prop= RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "drawtype", 0); + RNA_def_property_enum_items(prop, prop_drawtype_items); + RNA_def_property_ui_text(prop, "Draw Mode", "Radiosity draw modes."); + + /* Number values */ + prop= RNA_def_property(srna, "hemi_resolution", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "hemires"); + RNA_def_property_range(prop, 100, 1000); + RNA_def_property_ui_text(prop, "Hemi Resolution", "Sets the size of a hemicube."); + + prop= RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxiter"); + RNA_def_property_range(prop, 0, 10000); + RNA_def_property_ui_text(prop, "Max Iterations", "Limits the maximum number of radiosity rounds."); + + prop= RNA_def_property(srna, "multiplier", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "radfac"); + RNA_def_property_range(prop, 0.001f, 250.0f); + RNA_def_property_ui_text(prop, "Multiplier", "Multiplies the energy values."); + + prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "gamma"); + RNA_def_property_range(prop, 0.2f, 10.0f); + RNA_def_property_ui_text(prop, "Gamma", "Changes the contrast of the energy values."); + + prop= RNA_def_property(srna, "convergence", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "convergence"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Convergence", "Sets the lower threshold of unshot energy."); + + prop= RNA_def_property(srna, "element_max", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "elma"); + RNA_def_property_range(prop, 1, 500); + RNA_def_property_ui_text(prop, "Element Max", "Sets maximum size of an element"); + + prop= RNA_def_property(srna, "element_min", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "elmi"); + RNA_def_property_range(prop, 1, 100); + RNA_def_property_ui_text(prop, "Element Min", "Sets minimum size of an element"); + + prop= RNA_def_property(srna, "patch_max", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "pama"); + RNA_def_property_range(prop, 10, 1000); + RNA_def_property_ui_text(prop, "Patch Max", "Sets maximum size of a patch."); + + prop= RNA_def_property(srna, "patch_min", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "pami"); + RNA_def_property_range(prop, 10, 1000); + RNA_def_property_ui_text(prop, "Patch Min", "Sets minimum size of a patch."); + + prop= RNA_def_property(srna, "subshoot_patch", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "subshootp"); + RNA_def_property_range(prop, 0, 10); + RNA_def_property_ui_text(prop, "SubShoot Patch", "Sets the number of times the environment is tested to detect pathes."); + + prop= RNA_def_property(srna, "subshoot_element", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "subshoote"); + RNA_def_property_range(prop, 0, 10); + RNA_def_property_ui_text(prop, "SubShoot Element", "Sets the number of times the environment is tested to detect elements."); + + prop= RNA_def_property(srna, "max_elements", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxnode"); + RNA_def_property_range(prop, 1, 250000); + RNA_def_property_ui_text(prop, "Max Elements", "Sets the maximum allowed number of elements."); + + prop= RNA_def_property(srna, "max_subdiv_shoot", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxsublamp"); + RNA_def_property_range(prop, 1, 250); + RNA_def_property_ui_text(prop, "Max Subdiv Shoot", "Sets the maximum number of initial shoot patches that are evaluated"); + + prop= RNA_def_property(srna, "remove_doubles_limit", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "nodelim"); + RNA_def_property_range(prop, 0, 50); + RNA_def_property_ui_text(prop, "Remove Doubles Limit", "Sets the range for removing doubles"); + + /* flag */ + prop= RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", RAD_SHOWLIMITS); + RNA_def_property_ui_text(prop, "Show Limits", "Draws patch and element limits"); + + prop= RNA_def_property(srna, "show_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", RAD_SHOWZ); + RNA_def_property_ui_text(prop, "Show Z", "Draws limits differently"); +} + +#endif + diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 64b89bd777c..3ee0e78f65f 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -144,6 +144,11 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "NodeTree"); RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree."); + + prop= RNA_def_property(srna, "radiosity", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "radio"); + RNA_def_property_struct_type(prop, "Radiosity"); + RNA_def_property_ui_text(prop, "Radiosity", ""); } #endif diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 1ffc3def450..c4a64235f3d 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -67,6 +67,8 @@ static struct StructRNA* rna_Sensor_data_type(struct PointerRNA *ptr) return &RNA_ActuatorSensor; case SENS_DELAY: return &RNA_DelaySensor; + default: + return &RNA_UnknownType; } return NULL; diff --git a/source/blender/radiosity/extern/include/radio_types.h b/source/blender/radiosity/extern/include/radio_types.h index 342e122cf36..5a218ee71be 100644 --- a/source/blender/radiosity/extern/include/radio_types.h +++ b/source/blender/radiosity/extern/include/radio_types.h @@ -41,10 +41,6 @@ struct Render; struct CustomData; -#define DTWIRE 0 -#define DTGOUR 2 -#define DTSOLID 1 - #define PI M_PI #define RAD_MAXFACETAB 1024 #define RAD_NEXTFACE(a) if( ((a) & 1023)==0 ) face= RG.facebase[(a)>>10]; else face++; diff --git a/source/blender/radiosity/intern/source/raddisplay.c b/source/blender/radiosity/intern/source/raddisplay.c index 4b6b18dc91c..753c2a5b58b 100644 --- a/source/blender/radiosity/intern/source/raddisplay.c +++ b/source/blender/radiosity/intern/source/raddisplay.c @@ -46,6 +46,7 @@ #include "BLI_blenlib.h" +#include "DNA_radio_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" @@ -312,8 +313,8 @@ void drawlimits() /* center around cent */ short cox=0, coy=1; - if((RG.flag & 3)==2) coy= 2; - if((RG.flag & 3)==3) { + if((RG.flag & (RAD_SHOWLIMITS|RAD_SHOWZ))==RAD_SHOWZ) coy= 2; + if((RG.flag & (RAD_SHOWLIMITS|RAD_SHOWZ))==(RAD_SHOWLIMITS|RAD_SHOWZ)) { cox= 1; coy= 2; } @@ -392,7 +393,7 @@ void RAD_drawall(int depth_is_on) } if(RG.totface) { - if(RG.drawtype==DTGOUR) { + if(RG.drawtype==RAD_GOURAUD) { glShadeModel(GL_SMOOTH); for(a=0; a<RG.totface; a++) { RAD_NEXTFACE(a); @@ -400,7 +401,7 @@ void RAD_drawall(int depth_is_on) drawfaceGour(face); } } - else if(RG.drawtype==DTSOLID) { + else if(RG.drawtype==RAD_SOLID) { for(a=0; a<RG.totface; a++) { RAD_NEXTFACE(a); @@ -418,13 +419,13 @@ void RAD_drawall(int depth_is_on) } else { el= RG.elem; - if(RG.drawtype==DTGOUR) { + if(RG.drawtype==RAD_GOURAUD) { glShadeModel(GL_SMOOTH); for(a=RG.totelem; a>0; a--, el++) { drawnodeGour(*el); } } - else if(RG.drawtype==DTSOLID) { + else if(RG.drawtype==RAD_SOLID) { for(a=RG.totelem; a>0; a--, el++) { drawnodeSolid(*el); } @@ -439,7 +440,7 @@ void RAD_drawall(int depth_is_on) glShadeModel(GL_FLAT); if(RG.totpatch) { - if(RG.flag & 3) { + if(RG.flag & (RAD_SHOWLIMITS|RAD_SHOWZ)) { if(depth_is_on) glDisable(GL_DEPTH_TEST); drawlimits(); if(depth_is_on) glEnable(GL_DEPTH_TEST); diff --git a/source/blender/radiosity/intern/source/radio.c b/source/blender/radiosity/intern/source/radio.c index cd4234d5eaf..ec4a0eec490 100644 --- a/source/blender/radiosity/intern/source/radio.c +++ b/source/blender/radiosity/intern/source/radio.c @@ -258,7 +258,7 @@ void add_radio() rad->convergence= 0.1; rad->radfac= 30.0; rad->gamma= 2.0; - rad->drawtype= DTSOLID; + rad->drawtype= RAD_SOLID; rad->subshootp= 1; rad->subshoote= 2; rad->maxsublamp= 0; |