diff options
author | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-08-03 18:06:47 +0400 |
---|---|---|
committer | Arystanbek Dyussenov <arystan.d@gmail.com> | 2009-08-03 18:06:47 +0400 |
commit | 2065c5cf605ea6147cb4097cf4aca7ac003a1ba1 (patch) | |
tree | 19d0ff6a5eada1458c86390fe10e20c322a8c2fd /source/blender/makesrna | |
parent | 4086ca58e275816a49950f6ac0cbffa6cb36a8ad (diff) | |
parent | 28909178d96ff04c22091ccd992314617352e1f0 (diff) |
Merge with 2.5 -r 21756:22173.
Diffstat (limited to 'source/blender/makesrna')
44 files changed, 2893 insertions, 695 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 33bf1147748..1b3175d7f55 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -62,6 +62,15 @@ extern StructRNA RNA_BevelModifier; extern StructRNA RNA_BezierCurvePoint; extern StructRNA RNA_BlendTexture; extern StructRNA RNA_BlenderRNA; +extern StructRNA RNA_BoidRule; +extern StructRNA RNA_BoidRuleAverageSpeed; +extern StructRNA RNA_BoidRuleAvoid; +extern StructRNA RNA_BoidRuleAvoidCollision; +extern StructRNA RNA_BoidRuleFight; +extern StructRNA RNA_BoidRuleFollowLeader; +extern StructRNA RNA_BoidRuleGoal; +extern StructRNA RNA_BoidSettings; +extern StructRNA RNA_BoidState; extern StructRNA RNA_Bone; extern StructRNA RNA_BoneGroup; extern StructRNA RNA_BooleanModifier; @@ -143,6 +152,7 @@ extern StructRNA RNA_CompositorNodeValue; extern StructRNA RNA_CompositorNodeVecBlur; extern StructRNA RNA_CompositorNodeViewer; extern StructRNA RNA_CompositorNodeZcombine; +extern StructRNA RNA_ConsoleLine; extern StructRNA RNA_Constraint; extern StructRNA RNA_ConstraintTarget; extern StructRNA RNA_Context; @@ -171,23 +181,22 @@ extern StructRNA RNA_EnumProperty; extern StructRNA RNA_EnumPropertyItem; extern StructRNA RNA_EnvironmentMap; extern StructRNA RNA_EnvironmentMapTexture; +extern StructRNA RNA_Event; extern StructRNA RNA_ExplodeModifier; extern StructRNA RNA_ExpressionController; -extern StructRNA RNA_Event; extern StructRNA RNA_FCurve; extern StructRNA RNA_FCurveSample; -extern StructRNA RNA_FileSelectParams; extern StructRNA RNA_FModifier; extern StructRNA RNA_FModifierCycles; extern StructRNA RNA_FModifierEnvelope; extern StructRNA RNA_FModifierEnvelopeControlPoint; extern StructRNA RNA_FModifierFunctionGenerator; extern StructRNA RNA_FModifierGenerator; -extern StructRNA RNA_FModifierGenerator_PolyExpanded; extern StructRNA RNA_FModifierLimits; extern StructRNA RNA_FModifierNoise; extern StructRNA RNA_FModifierPython; extern StructRNA RNA_FieldSettings; +extern StructRNA RNA_FileSelectParams; extern StructRNA RNA_FloatProperty; extern StructRNA RNA_FloorConstraint; extern StructRNA RNA_FluidFluidSettings; @@ -212,6 +221,7 @@ extern StructRNA RNA_ID; extern StructRNA RNA_IDProperty; extern StructRNA RNA_IDPropertyGroup; extern StructRNA RNA_Image; +extern StructRNA RNA_ImagePaint; extern StructRNA RNA_ImageSequence; extern StructRNA RNA_ImageTexture; extern StructRNA RNA_ImageUser; @@ -222,7 +232,6 @@ extern StructRNA RNA_Key; extern StructRNA RNA_KeyboardSensor; extern StructRNA RNA_KeyingSet; extern StructRNA RNA_KeyingSetPath; -extern StructRNA RNA_ParticleTarget; extern StructRNA RNA_KinematicConstraint; extern StructRNA RNA_Lamp; extern StructRNA RNA_LampSkySettings; @@ -278,8 +287,8 @@ extern StructRNA RNA_MultiresModifier; extern StructRNA RNA_MusgraveTexture; extern StructRNA RNA_NandController; extern StructRNA RNA_NearSensor; -extern StructRNA RNA_NlaTrack; extern StructRNA RNA_NlaStrip; +extern StructRNA RNA_NlaTrack; extern StructRNA RNA_Node; extern StructRNA RNA_NodeTree; extern StructRNA RNA_NoiseTexture; @@ -304,6 +313,7 @@ extern StructRNA RNA_ParticleKey; extern StructRNA RNA_ParticleSettings; extern StructRNA RNA_ParticleSystem; extern StructRNA RNA_ParticleSystemModifier; +extern StructRNA RNA_ParticleTarget; extern StructRNA RNA_PluginSequence; extern StructRNA RNA_PluginTexture; extern StructRNA RNA_PointCache; @@ -315,17 +325,20 @@ extern StructRNA RNA_PropertySensor; extern StructRNA RNA_PythonConstraint; extern StructRNA RNA_PythonController; extern StructRNA RNA_RadarSensor; -extern StructRNA RNA_Radiosity; extern StructRNA RNA_RandomSensor; extern StructRNA RNA_RaySensor; extern StructRNA RNA_Region; +extern StructRNA RNA_RenderLayer; +extern StructRNA RNA_RenderPass; +extern StructRNA RNA_RenderResult; +extern StructRNA RNA_RenderValue; extern StructRNA RNA_RigidBodyJointConstraint; extern StructRNA RNA_Scene; extern StructRNA RNA_SceneGameData; extern StructRNA RNA_SceneRenderData; +extern StructRNA RNA_SceneRenderLayer; extern StructRNA RNA_SceneSequence; extern StructRNA RNA_Screen; -extern StructRNA RNA_ScriptLink; extern StructRNA RNA_Sculpt; extern StructRNA RNA_Sensor; extern StructRNA RNA_Sequence; @@ -365,9 +378,10 @@ extern StructRNA RNA_ShapeKeyPoint; extern StructRNA RNA_ShrinkwrapConstraint; extern StructRNA RNA_ShrinkwrapModifier; extern StructRNA RNA_SimpleDeformModifier; +extern StructRNA RNA_SmokeModifier; extern StructRNA RNA_SmoothModifier; -extern StructRNA RNA_SoftBodySettings; extern StructRNA RNA_SoftBodyModifier; +extern StructRNA RNA_SoftBodySettings; extern StructRNA RNA_Sound; extern StructRNA RNA_SoundSequence; extern StructRNA RNA_Space; @@ -375,13 +389,13 @@ extern StructRNA RNA_Space3DView; extern StructRNA RNA_SpaceButtonsWindow; extern StructRNA RNA_SpaceConsole; extern StructRNA RNA_SpaceDopeSheetEditor; +extern StructRNA RNA_SpaceFileBrowser; extern StructRNA RNA_SpaceGraphEditor; extern StructRNA RNA_SpaceImageEditor; extern StructRNA RNA_SpaceNLA; extern StructRNA RNA_SpaceOutliner; extern StructRNA RNA_SpaceSequenceEditor; extern StructRNA RNA_SpaceTextEditor; -extern StructRNA RNA_SpaceFileBrowser; extern StructRNA RNA_SpaceUVEditor; extern StructRNA RNA_SpeedControlSequence; extern StructRNA RNA_SpotLamp; @@ -434,6 +448,7 @@ extern StructRNA RNA_ThemeFileBrowser; extern StructRNA RNA_ThemeFontStyle; extern StructRNA RNA_ThemeGraphEditor; extern StructRNA RNA_ThemeImageEditor; +extern StructRNA RNA_ThemeLogicEditor; extern StructRNA RNA_ThemeNLAEditor; extern StructRNA RNA_ThemeNodeEditor; extern StructRNA RNA_ThemeOutliner; @@ -445,6 +460,7 @@ extern StructRNA RNA_ThemeUserInterface; extern StructRNA RNA_ThemeUserPreferences; extern StructRNA RNA_ThemeView3D; extern StructRNA RNA_ThemeWidgetColors; +extern StructRNA RNA_ThemeWidgetStateColors; extern StructRNA RNA_TimelineMarker; extern StructRNA RNA_ToolSettings; extern StructRNA RNA_TouchSensor; @@ -452,6 +468,7 @@ extern StructRNA RNA_TrackToConstraint; extern StructRNA RNA_TransformConstraint; extern StructRNA RNA_TransformSequence; extern StructRNA RNA_UILayout; +extern StructRNA RNA_UIListItem; extern StructRNA RNA_UVProjectModifier; extern StructRNA RNA_UnknownType; extern StructRNA RNA_UserPreferences; @@ -462,12 +479,13 @@ extern StructRNA RNA_UserPreferencesLanguage; extern StructRNA RNA_UserPreferencesSystem; extern StructRNA RNA_UserPreferencesView; extern StructRNA RNA_UserSolidLight; -extern StructRNA RNA_VPaint; +extern StructRNA RNA_VertexPaint; extern StructRNA RNA_VectorFont; extern StructRNA RNA_VertexGroup; extern StructRNA RNA_VertexGroupElement; extern StructRNA RNA_VoronoiTexture; extern StructRNA RNA_WaveModifier; +extern StructRNA RNA_Window; extern StructRNA RNA_WindowManager; extern StructRNA RNA_WipeSequence; extern StructRNA RNA_WoodTexture; @@ -700,6 +718,7 @@ int RNA_string_length(PointerRNA *ptr, const char *name); void RNA_string_set(PointerRNA *ptr, const char *name, const char *value); PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name); +void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value); void RNA_pointer_add(PointerRNA *ptr, const char *name); void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter); diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index f76423ea846..ae9eaba8646 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -170,6 +170,15 @@ void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item, int value); void RNA_enum_item_end(EnumPropertyItem **items, int *totitem); +/* Memory management */ + +void RNA_def_struct_duplicate_pointers(StructRNA *srna); +void RNA_def_struct_free_pointers(StructRNA *srna); +void RNA_def_func_duplicate_pointers(FunctionRNA *func); +void RNA_def_func_free_pointers(FunctionRNA *func); +void RNA_def_property_duplicate_pointers(PropertyRNA *prop); +void RNA_def_property_free_pointers(PropertyRNA *prop); + #ifdef __cplusplus } #endif diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 2592a1340ec..78e65e8fc06 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -41,6 +41,9 @@ extern EnumPropertyItem beztriple_interpolation_mode_items[]; extern EnumPropertyItem fmodifier_type_items[]; +extern EnumPropertyItem nla_mode_extend_items[]; +extern EnumPropertyItem nla_mode_blend_items[]; + extern EnumPropertyItem event_value_items[]; extern EnumPropertyItem event_type_items[]; diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 20d6674018b..3355e684358 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -85,6 +85,11 @@ typedef enum PropertyFlag { * for pointers and collections. */ PROP_EDITABLE = 1, + /* this property is editable even if it is lib linked, + * meaning it will get lost on reload, but it's useful + * for editing. */ + PROP_LIB_EXCEPTION = 65536, + /* animateable means the property can be driven by some * other input, be it animation curves, expressions, .. * properties are animateable by default except for pointers @@ -116,6 +121,7 @@ typedef enum PropertyFlag { PROP_IDPROPERTY = 1024, PROP_RAW_ACCESS = 8192, PROP_RAW_ARRAY = 16384, + PROP_FREE_POINTERS = 32768 } PropertyFlag; typedef struct CollectionPropertyIterator { @@ -201,7 +207,8 @@ typedef enum FunctionFlag { /* internal flags */ FUNC_BUILTIN = 128, FUNC_EXPORT = 256, - FUNC_RUNTIME = 512 + FUNC_RUNTIME = 512, + FUNC_FREE_POINTERS = 1024 } FunctionFlag; typedef void (*CallFunc)(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, ParameterList *parms); @@ -217,7 +224,8 @@ typedef enum StructFlag { /* internal flags */ STRUCT_RUNTIME = 4, - STRUCT_GENERATED = 8 + STRUCT_GENERATED = 8, + STRUCT_FREE_POINTERS = 16 } StructFlag; typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function); @@ -235,6 +243,19 @@ typedef struct StructRNA StructRNA; typedef struct BlenderRNA BlenderRNA; +/* Extending + * + * This struct must be embedded in *Type structs in + * order to make then definable through RNA. */ + +typedef struct ExtensionRNA { + void *data; + StructRNA *srna; + + int (*call)(PointerRNA *, FunctionRNA *, ParameterList *); + void (*free)(void *data); +} ExtensionRNA; + #ifdef __cplusplus } #endif diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index 89118850b20..80abd4fda61 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -8,6 +8,7 @@ objs += o incs = '#/intern/guardedalloc ../blenkernel ../blenlib ../makesdna intern .' incs += ' ../windowmanager ../editors/include ../imbuf' +incs += ' ../render/extern/include' defs = [] @@ -33,4 +34,7 @@ if env['WITH_BF_QUICKTIME']: if env['WITH_BF_LCMS']: defs.append('WITH_LCMS') +if env['WITH_BF_GAMEENGINE']: + defs.append('GAMEBLENDER=1') + env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core'], priority = [195] ) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 85505d546c4..2aa0fcc79ff 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -39,7 +39,7 @@ SET(SRC ../../../../intern/guardedalloc/intern/mallocn.c ../../../../intern/guardedalloc/intern/mmap_win.c) -INCLUDE_DIRECTORIES(../../../../intern/guardedalloc .. ../../makesdna ../../blenkernel ../../blenlib ../../windowmanager ../../editors/include ../../imbuf .) +INCLUDE_DIRECTORIES(../../../../intern/guardedalloc .. ../../makesdna ../../blenkernel ../../blenlib ../../windowmanager ../../editors/include ../../imbuf ../../render/extern/include .) FILE(GLOB INC_FILES ../*.h ../../makesdna/*.h) IF(WITH_OPENEXR) diff --git a/source/blender/makesrna/intern/Makefile b/source/blender/makesrna/intern/Makefile index 7f9bfbfea67..c7cc6e7a4bf 100644 --- a/source/blender/makesrna/intern/Makefile +++ b/source/blender/makesrna/intern/Makefile @@ -52,6 +52,7 @@ CPPFLAGS += -I../../imbuf CPPFLAGS += -I../../makesdna CPPFLAGS += -I../../windowmanager CPPFLAGS += -I../../editors/include +CPPFLAGS += -I../../render/extern/include CPPFLAGS += -I.. CPPFLAGS += -I. diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index c10b907d04e..6c8038bd509 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -32,6 +32,7 @@ defs = [] incs = '#/intern/guardedalloc ../../blenlib ../../blenkernel' incs += ' ../../imbuf ../../makesdna ../../makesrna' incs += ' ../../windowmanager ../../editors/include' +incs += ' ../../render/extern/include' if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') @@ -55,6 +56,9 @@ if env['WITH_BF_QUICKTIME']: if env['WITH_BF_LCMS']: defs.append('WITH_LCMS') +if env['WITH_BF_GAMEENGINE']: + defs.append('GAMEBLENDER=1') + makesrna_tool.Append(CPPDEFINES=defs) makesrna_tool.Append (CPPPATH = Split(incs)) diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 03d8edde4b3..b467c2d20c2 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1953,11 +1953,13 @@ RNAProcessItem PROCESS_ITEMS[]= { {"rna_particle.c", NULL, RNA_def_particle}, {"rna_pose.c", "rna_pose_api.c", RNA_def_pose}, {"rna_property.c", NULL, RNA_def_gameproperty}, + {"rna_render.c", NULL, RNA_def_render}, {"rna_scene.c", "rna_scene_api.c", RNA_def_scene}, {"rna_screen.c", NULL, RNA_def_screen}, - {"rna_scriptlink.c", NULL, RNA_def_scriptlink}, + {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, {"rna_sensor.c", NULL, RNA_def_sensor}, {"rna_sequence.c", NULL, RNA_def_sequence}, + {"rna_smoke.c", NULL, RNA_def_smoke}, {"rna_space.c", NULL, RNA_def_space}, {"rna_text.c", NULL, RNA_def_text}, {"rna_timeline.c", NULL, RNA_def_timeline_marker}, @@ -1965,7 +1967,6 @@ RNAProcessItem PROCESS_ITEMS[]= { {"rna_ui.c", "rna_ui_api.c", RNA_def_ui}, {"rna_userdef.c", NULL, RNA_def_userdef}, {"rna_vfont.c", NULL, RNA_def_vfont}, - {"rna_vpaint.c", NULL, RNA_def_vpaint}, {"rna_wm.c", "rna_wm_api.c", RNA_def_wm}, {"rna_world.c", NULL, RNA_def_world}, {NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 7d8bab8bee8..cf3d59f78a0 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -67,7 +67,6 @@ short RNA_type_to_ID_code(StructRNA *type) if(RNA_struct_is_a(type, &RNA_Curve)) return ID_CU; if(RNA_struct_is_a(type, &RNA_Group)) return ID_GR; if(RNA_struct_is_a(type, &RNA_Image)) return ID_IM; - //if(RNA_struct_is_a(type, &RNA_Ipo)) return case ID_IP; if(RNA_struct_is_a(type, &RNA_Key)) return ID_KE; if(RNA_struct_is_a(type, &RNA_Lamp)) return ID_LA; if(RNA_struct_is_a(type, &RNA_Library)) return ID_LI; @@ -100,7 +99,6 @@ StructRNA *ID_code_to_RNA_type(short idcode) case ID_CU: return &RNA_Curve; case ID_GR: return &RNA_Group; case ID_IM: return &RNA_Image; - //case ID_IP: return &RNA_Ipo; case ID_KE: return &RNA_Key; case ID_LA: return &RNA_Lamp; case ID_LI: return &RNA_Library; diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index c9bf97fd274..c141efc7ac6 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -752,7 +752,7 @@ int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) id= ptr->id.data; - return (flag & PROP_EDITABLE) && (!id || !id->lib); + return (flag & PROP_EDITABLE) && (!id || !id->lib || (flag & PROP_LIB_EXCEPTION)); } int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop) @@ -2524,6 +2524,18 @@ PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name) } } +void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value) +{ + PropertyRNA *prop= RNA_struct_find_property(ptr, name); + + if(prop) { + RNA_property_pointer_set(ptr, prop, ptr_value); + } + else { + printf("RNA_pointer_set: %s.%s not found.\n", ptr->type->identifier, name); + } +} + void RNA_pointer_add(PointerRNA *ptr, const char *name) { PropertyRNA *prop= RNA_struct_find_property(ptr, name); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 3469d716853..e334e2b5e90 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -26,6 +26,7 @@ #include "RNA_define.h" #include "RNA_types.h" +#include "RNA_enum_types.h" #include "rna_internal.h" @@ -37,6 +38,17 @@ #ifdef RNA_RUNTIME +static int rna_AnimData_action_editable(PointerRNA *ptr) +{ + AnimData *adt= (AnimData *)ptr->data; + + /* active action is only editable when it is not a tweaking strip */ + if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) + return 0; + else + return 1; +} + static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value) { KS_Path *ksp= (KS_Path *)ptr->data; @@ -187,9 +199,27 @@ void rna_def_animdata(BlenderRNA *brna) RNA_def_property_struct_type(prop, "NlaTrack"); RNA_def_property_ui_text(prop, "NLA Tracks", "NLA Tracks (i.e. Animation Layers)."); - /* Action */ + /* Active Action */ prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); - RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock."); + RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock."); + RNA_def_property_editable_func(prop, "rna_AnimData_action_editable"); + + /* Active Action Settings */ + prop= RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "act_extendmode"); + RNA_def_property_enum_items(prop, nla_mode_extend_items); + RNA_def_property_ui_text(prop, "Action Extrapolation", "Action to take for gaps past the Active Action's range (when evaluating with NLA)."); + + prop= RNA_def_property(srna, "action_blending", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "act_blendmode"); + RNA_def_property_enum_items(prop, nla_mode_blend_items); + RNA_def_property_ui_text(prop, "Action Blending", "Method used for combining Active Action's result with result of NLA stack."); + + prop= RNA_def_property(srna, "action_influence", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "act_influence"); + RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Action Influence", "Amount the Active Action contributes to the result of the NLA stack."); /* Drivers */ prop= RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE); @@ -197,7 +227,10 @@ void rna_def_animdata(BlenderRNA *brna) RNA_def_property_struct_type(prop, "FCurve"); RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this datablock."); - /* Settings */ + /* General Settings */ + prop= RNA_def_property(srna, "nla_enabled", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADT_NLA_EVAL_OFF); + RNA_def_property_ui_text(prop, "NLA Evaluation Enabled", "NLA stack is evaluated when evaluating this block."); } /* --- */ diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 480d280a39a..45a833e0b29 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -157,6 +157,19 @@ static void rna_EditBone_name_set(PointerRNA *ptr, const char *value) ED_armature_bone_rename(arm, oldname, newname); } +static void rna_Bone_name_set(PointerRNA *ptr, const char *value) +{ + bArmature *arm= (bArmature*)ptr->id.data; + Bone *bone= (Bone*)ptr->data; + char oldname[32], newname[32]; + + /* need to be on the stack */ + BLI_strncpy(newname, value, 32); + BLI_strncpy(oldname, bone->name, 32); + + ED_armature_bone_rename(arm, oldname, newname); +} + static void rna_EditBone_layer_get(PointerRNA *ptr, int values[16]) { EditBone *data= (EditBone*)(ptr->data); @@ -320,6 +333,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); if(editbone) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set"); + else RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); /* flags */ @@ -604,6 +618,7 @@ void rna_def_armature(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility."); RNA_def_property_boolean_funcs(prop, NULL, "rna_Armature_layer_set"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, NULL); + RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); /* layer protection */ prop= RNA_def_property(srna, "layer_protection", PROP_BOOLEAN, PROP_NONE); @@ -616,7 +631,7 @@ void rna_def_armature(BlenderRNA *brna) prop= RNA_def_property(srna, "rest_position", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_RESTPOS); RNA_def_property_ui_text(prop, "Rest Position", "Show Armature in Rest Position. No posing possible."); - RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); + RNA_def_property_update(prop, 0, "rna_Armature_update_data"); prop= RNA_def_property(srna, "draw_axes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWAXES); @@ -631,7 +646,7 @@ void rna_def_armature(BlenderRNA *brna) prop= RNA_def_property(srna, "delay_deform", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DELAYDEFORM); RNA_def_property_ui_text(prop, "Delay Deform", "Don't deform children when manipulating bones in Pose Mode"); - RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); + RNA_def_property_update(prop, 0, "rna_Armature_update_data"); prop= RNA_def_property(srna, "x_axis_mirror", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_MIRROR_EDIT); diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 8089d2e8b38..2bb4333365b 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -46,29 +46,32 @@ static void rna_Brush_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *p static PointerRNA rna_Brush_active_texture_get(PointerRNA *ptr) { - Brush *brush= (Brush*)ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, brush->mtex[(int)brush->texact]); + Brush *br= (Brush*)ptr->data; + Tex *tex; + + tex= (br->mtex[(int)br->texact])? br->mtex[(int)br->texact]->tex: NULL; + return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex); } -static void rna_Brush_active_texture_index_set(PointerRNA *ptr, int value) +static void rna_Brush_active_texture_set(PointerRNA *ptr, PointerRNA value) { - Brush *brush= (Brush*)ptr->data; - int act= brush->texact; - - if(value == act || value < 0 || value >= MAX_MTEX) - return; - - /* auto create/free mtex on activate/deactive, so we can edit - * the texture pointer in the buttons UI. */ - if(brush->mtex[act] && !brush->mtex[act]->tex) { - MEM_freeN(brush->mtex[act]); - brush->mtex[act]= NULL; + Brush *br= (Brush*)ptr->data; + int act= br->texact; + + if(br->mtex[act] && br->mtex[act]->tex) + id_us_min(&br->mtex[act]->tex->id); + + if(value.data) { + if(!br->mtex[act]) + br->mtex[act]= add_mtex(); + + br->mtex[act]->tex= value.data; + id_us_plus(&br->mtex[act]->tex->id); + } + else if(br->mtex[act]) { + MEM_freeN(br->mtex[act]); + br->mtex[act]= NULL; } - - brush->texact= value; - - if(!brush->mtex[value]) - brush->mtex[value]= add_mtex(); } static float rna_Brush_rotation_get(PointerRNA *ptr) @@ -179,7 +182,7 @@ void rna_def_brush(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TORUS); RNA_def_property_ui_text(prop, "Wrap", "Enable torus wrapping while painting."); - prop= RNA_def_property(srna, "alpha_pressure", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "opacity_pressure", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE); RNA_def_property_ui_text(prop, "Opacity Pressure", "Enable tablet pressure sensitivity for opacity."); @@ -224,7 +227,8 @@ void rna_def_brush(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve."); /* texture */ - rna_def_mtex_common(srna, "rna_Brush_mtex_begin", "rna_Brush_active_texture_get", "rna_Brush_active_texture_index_set", "TextureSlot"); + rna_def_mtex_common(srna, "rna_Brush_mtex_begin", "rna_Brush_active_texture_get", + "rna_Brush_active_texture_set", "TextureSlot"); /* clone tool */ prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index d84d6f159d8..d08e59c11dc 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -141,7 +141,21 @@ StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr) static char *rna_Constraint_path(PointerRNA *ptr) { - return BLI_sprintfN("constraints[%s]", ((bConstraint*)ptr->data)->name); + Object *ob= ptr->id.data; + bConstraint *con= ptr->data; + bPoseChannel *pchan= get_active_posechannel(ob); + ListBase *actlist= get_active_constraints(ob); + short inList = 0; + + /* check if constraint is in the given list */ + if (actlist) + inList= (BLI_findindex(actlist, con) != -1); + + /* if constraint is in the list, the list is for the active bone... */ + if ((inList) && (actlist != &ob->constraints) && (pchan)) + return BLI_sprintfN("pose.pose_channels[\"%s\"].constraints[\"%s\"]", pchan->name, con->name); + else + return BLI_sprintfN("constraints[\"%s\"]", con->name); } static void rna_Constraint_update(bContext *C, PointerRNA *ptr) @@ -906,6 +920,11 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Target", "Target Object"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); + + prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "subtarget"); + RNA_def_property_ui_text(prop, "Sub-Target", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); prop= RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "volmode"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 6f52c3c8588..76e17d835ba 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -39,6 +39,7 @@ #include "RNA_types.h" #include "BLI_ghash.h" +#include "BLI_string.h" #include "rna_internal.h" @@ -445,6 +446,7 @@ void RNA_define_verify_sdna(int verify) void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) { +#ifdef RNA_RUNTIME FunctionRNA *func, *nextfunc; PropertyRNA *prop, *nextprop; PropertyRNA *parm, *nextparm; @@ -452,6 +454,8 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) for(prop=srna->cont.properties.first; prop; prop=nextprop) { nextprop= prop->next; + RNA_def_property_free_pointers(prop); + if(prop->flag & PROP_RUNTIME) rna_freelinkN(&srna->cont.properties, prop); } @@ -462,17 +466,23 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) for(parm=func->cont.properties.first; parm; parm=nextparm) { nextparm= parm->next; + RNA_def_property_free_pointers(parm); + if(parm->flag & PROP_RUNTIME) rna_freelinkN(&func->cont.properties, parm); } - if(func->flag & FUNC_RUNTIME) { + RNA_def_func_free_pointers(func); + + if(func->flag & FUNC_RUNTIME) rna_freelinkN(&srna->functions, func); - } } + RNA_def_struct_free_pointers(srna); + if(srna->flag & STRUCT_RUNTIME) rna_freelinkN(&brna->structs, srna); +#endif } void RNA_free(BlenderRNA *brna) @@ -713,7 +723,7 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct break; if(!srnafrom) { - fprintf(stderr, "RNA_def_struct_nested: struct %s not found.\n", structname); + fprintf(stderr, "RNA_def_struct_nested: struct %s not found for %s.\n", structname, srna->identifier); DefRNA.error= 1; } @@ -2318,9 +2328,12 @@ void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item, int value) { - for(; item->identifier; item++) - if(item->value == value) + for(; item->identifier; item++) { + if(item->value == value) { RNA_enum_item_add(items, totitem, item); + break; // break on first match - does this break anything? (is quick hack to get object->parent_type working ok for armature/lattice) + } + } } void RNA_enum_item_end(EnumPropertyItem **items, int *totitem) @@ -2329,3 +2342,141 @@ void RNA_enum_item_end(EnumPropertyItem **items, int *totitem) RNA_enum_item_add(items, totitem, &empty); } +/* Memory management */ + +#ifdef RNA_RUNTIME +void RNA_def_struct_duplicate_pointers(StructRNA *srna) +{ + if(srna->identifier) srna->identifier= BLI_strdup(srna->identifier); + if(srna->name) srna->name= BLI_strdup(srna->name); + if(srna->description) srna->description= BLI_strdup(srna->description); + + srna->flag |= STRUCT_FREE_POINTERS; +} + +void RNA_def_struct_free_pointers(StructRNA *srna) +{ + if(srna->flag & STRUCT_FREE_POINTERS) { + if(srna->identifier) MEM_freeN((void*)srna->identifier); + if(srna->name) MEM_freeN((void*)srna->name); + if(srna->description) MEM_freeN((void*)srna->description); + } +} + +void RNA_def_func_duplicate_pointers(FunctionRNA *func) +{ + if(func->identifier) func->identifier= BLI_strdup(func->identifier); + if(func->description) func->description= BLI_strdup(func->description); + + func->flag |= FUNC_FREE_POINTERS; +} + +void RNA_def_func_free_pointers(FunctionRNA *func) +{ + if(func->flag & FUNC_FREE_POINTERS) { + if(func->identifier) MEM_freeN((void*)func->identifier); + if(func->description) MEM_freeN((void*)func->description); + } +} + +void RNA_def_property_duplicate_pointers(PropertyRNA *prop) +{ + EnumPropertyItem *earray; + float *farray; + int *iarray; + + if(prop->identifier) prop->identifier= BLI_strdup(prop->identifier); + if(prop->name) prop->name= BLI_strdup(prop->name); + if(prop->description) prop->description= BLI_strdup(prop->description); + + switch(prop->type) { + case PROP_BOOLEAN: { + BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; + + if(bprop->defaultarray) { + iarray= MEM_callocN(sizeof(int)*prop->arraylength, "RNA_def_property_store"); + memcpy(iarray, bprop->defaultarray, sizeof(int)*prop->arraylength); + bprop->defaultarray= iarray; + } + break; + } + case PROP_INT: { + IntPropertyRNA *iprop= (IntPropertyRNA*)prop; + + if(iprop->defaultarray) { + iarray= MEM_callocN(sizeof(int)*prop->arraylength, "RNA_def_property_store"); + memcpy(iarray, iprop->defaultarray, sizeof(int)*prop->arraylength); + iprop->defaultarray= iarray; + } + break; + } + case PROP_ENUM: { + EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; + + if(eprop->item) { + earray= MEM_callocN(sizeof(EnumPropertyItem)*(eprop->totitem+1), "RNA_def_property_store"), + memcpy(earray, eprop->item, sizeof(EnumPropertyItem)*(eprop->totitem+1)); + eprop->item= earray; + } + } + case PROP_FLOAT: { + FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; + + if(fprop->defaultarray) { + farray= MEM_callocN(sizeof(float)*prop->arraylength, "RNA_def_property_store"); + memcpy(farray, fprop->defaultarray, sizeof(float)*prop->arraylength); + fprop->defaultarray= farray; + } + break; + } + case PROP_STRING: { + StringPropertyRNA *sprop= (StringPropertyRNA*)prop; + if(sprop->defaultvalue) sprop->defaultvalue= BLI_strdup(sprop->defaultvalue); + break; + } + default: + break; + } + + prop->flag |= PROP_FREE_POINTERS; +} + +void RNA_def_property_free_pointers(PropertyRNA *prop) +{ + if(prop->flag & PROP_FREE_POINTERS) { + if(prop->identifier) MEM_freeN((void*)prop->identifier); + if(prop->name) MEM_freeN((void*)prop->name); + if(prop->description) MEM_freeN((void*)prop->description); + + switch(prop->type) { + case PROP_BOOLEAN: { + BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop; + if(bprop->defaultarray) MEM_freeN((void*)bprop->defaultarray); + break; + } + case PROP_INT: { + IntPropertyRNA *iprop= (IntPropertyRNA*)prop; + if(iprop->defaultarray) MEM_freeN((void*)iprop->defaultarray); + break; + } + case PROP_FLOAT: { + FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop; + if(fprop->defaultarray) MEM_freeN((void*)fprop->defaultarray); + break; + } + case PROP_ENUM: { + EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; + if(eprop->item) MEM_freeN((void*)eprop->item); + } + case PROP_STRING: { + StringPropertyRNA *sprop= (StringPropertyRNA*)prop; + if(sprop->defaultvalue) MEM_freeN((void*)sprop->defaultvalue); + break; + } + default: + break; + } + } +} +#endif + diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 5d8e3c375ba..8eb4fc9cde2 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -147,12 +147,14 @@ void RNA_def_object_force(struct BlenderRNA *brna); void RNA_def_packedfile(struct BlenderRNA *brna); void RNA_def_particle(struct BlenderRNA *brna); void RNA_def_pose(struct BlenderRNA *brna); +void RNA_def_render(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_scriptlink(struct BlenderRNA *brna); +void RNA_def_sculpt_paint(struct BlenderRNA *brna); void RNA_def_sensor(struct BlenderRNA *brna); void RNA_def_sequence(struct BlenderRNA *brna); +void RNA_def_smoke(struct BlenderRNA *brna); void RNA_def_space(struct BlenderRNA *brna); void RNA_def_text(struct BlenderRNA *brna); void RNA_def_texture(struct BlenderRNA *brna); @@ -161,7 +163,6 @@ void RNA_def_sound(struct BlenderRNA *brna); void RNA_def_ui(struct BlenderRNA *brna); void RNA_def_userdef(struct BlenderRNA *brna); void RNA_def_vfont(struct BlenderRNA *brna); -void RNA_def_vpaint(struct BlenderRNA *brna); void RNA_def_wm(struct BlenderRNA *brna); void RNA_def_world(struct BlenderRNA *brna); @@ -171,6 +172,7 @@ void rna_def_animdata_common(struct StructRNA *srna); void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable); void rna_def_mtex_common(struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname); +void rna_def_render_layer_common(struct StructRNA *srna, int scene); void rna_ID_name_get(struct PointerRNA *ptr, char *value); int rna_ID_name_length(struct PointerRNA *ptr); diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 7297ee8cb97..216a1d05079 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -47,6 +47,21 @@ #include "WM_api.h" #include "WM_types.h" +static void rna_ShapeKey_value_set(PointerRNA *ptr, float value) +{ + KeyBlock *data= (KeyBlock*)ptr->data; + CLAMP(value, data->slidermin, data->slidermax); + data->curval= value; +} + +static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max) +{ + KeyBlock *data= (KeyBlock*)ptr->data; + + *min= data->slidermin; + *max= data->slidermax; +} + static Key *rna_ShapeKey_find_key(ID *id) { switch(GS(id->name)) { @@ -345,6 +360,7 @@ static void rna_def_keyblock(BlenderRNA *brna) /* for now, this is editable directly, as users can set this even if they're not animating them (to test results) */ prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "curval"); + RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_value_set", "rna_ShapeKey_value_range"); RNA_def_property_ui_text(prop, "Value", "Value of shape key at the current frame."); RNA_def_property_update(prop, 0, "rna_Key_update_data"); @@ -380,6 +396,7 @@ static void rna_def_keyblock(BlenderRNA *brna) prop= RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "slidermax"); RNA_def_property_range(prop, -10.0f, 10.0f); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider."); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index bbe3b1dedb3..299bd37496b 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -64,30 +64,33 @@ static void rna_Lamp_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *pt static PointerRNA rna_Lamp_active_texture_get(PointerRNA *ptr) { Lamp *la= (Lamp*)ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, la->mtex[(int)la->texact]); + Tex *tex; + + tex= (la->mtex[(int)la->texact])? la->mtex[(int)la->texact]->tex: NULL; + return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex); } -static void rna_Lamp_active_texture_index_set(PointerRNA *ptr, int value) +static void rna_Lamp_active_texture_set(PointerRNA *ptr, PointerRNA value) { Lamp *la= (Lamp*)ptr->data; int act= la->texact; - if(value == act || value < 0 || value >= MAX_MTEX) - return; + if(la->mtex[act] && la->mtex[act]->tex) + id_us_min(&la->mtex[act]->tex->id); - /* auto create/free mtex on activate/deactive, so we can edit - * the texture pointer in the buttons UI. */ - if(la->mtex[act] && !la->mtex[act]->tex) { + if(value.data) { + if(!la->mtex[act]) { + la->mtex[act]= add_mtex(); + la->mtex[act]->texco= TEXCO_GLOB; + } + + la->mtex[act]->tex= value.data; + id_us_plus(&la->mtex[act]->tex->id); + } + else if(la->mtex[act]) { MEM_freeN(la->mtex[act]); la->mtex[act]= NULL; } - - la->texact= value; - - if(!la->mtex[value]) { - la->mtex[value]= add_mtex(); - la->mtex[value]->texco= TEXCO_GLOB; - } } static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr) @@ -141,10 +144,24 @@ static void rna_def_lamp_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "map_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_COL); RNA_def_property_ui_text(prop, "Color", "Lets the texture affect the basic color of the lamp."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_shadow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_SHAD); RNA_def_property_ui_text(prop, "Shadow", "Lets the texture affect the shadow color of the lamp."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Color Factor", "Amount texture affects color values."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "shadow_factor", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Shadow Factor", "Amount texture affects shadow."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); } static void rna_def_lamp_sky_settings(BlenderRNA *brna) @@ -335,13 +352,8 @@ static void rna_def_lamp(BlenderRNA *brna) RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL); /* textures */ - rna_def_mtex_common(srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get", "rna_Lamp_active_texture_index_set", "LampTextureSlot"); - - /* script link */ - prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "scriptlink"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this lamp."); + rna_def_mtex_common(srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get", + "rna_Lamp_active_texture_set", "LampTextureSlot"); } static void rna_def_lamp_falloff(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 133a3f50567..fb79ec88c4c 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -85,28 +85,31 @@ static void rna_Material_mtex_begin(CollectionPropertyIterator *iter, PointerRNA static PointerRNA rna_Material_active_texture_get(PointerRNA *ptr) { Material *ma= (Material*)ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, ma->mtex[(int)ma->texact]); + Tex *tex; + + tex= (ma->mtex[(int)ma->texact])? ma->mtex[(int)ma->texact]->tex: NULL; + return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex); } -static void rna_Material_active_texture_index_set(PointerRNA *ptr, int value) +static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value) { Material *ma= (Material*)ptr->data; int act= ma->texact; - if(value == act || value < 0 || value >= MAX_MTEX) - return; + if(ma->mtex[act] && ma->mtex[act]->tex) + id_us_min(&ma->mtex[act]->tex->id); - /* auto create/free mtex on activate/deactive, so we can edit - * the texture pointer in the buttons UI. */ - if(ma->mtex[act] && !ma->mtex[act]->tex) { + if(value.data) { + if(!ma->mtex[act]) + ma->mtex[act]= add_mtex(); + + ma->mtex[act]->tex= value.data; + id_us_plus(&ma->mtex[act]->tex->id); + } + else if(ma->mtex[act]) { MEM_freeN(ma->mtex[act]); ma->mtex[act]= NULL; } - - ma->texact= value; - - if(!ma->mtex[value]) - ma->mtex[value]= add_mtex(); } static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max) @@ -166,6 +169,28 @@ static void rna_MaterialTextureSlot_enabled_set(PointerRNA *ptr, int value) } } +static void rna_Material_use_diffuse_ramp_set(PointerRNA *ptr, int value) +{ + Material *ma= (Material*)ptr->data; + + if(value) ma->mode |= MA_RAMP_COL; + else ma->mode &= ~MA_RAMP_COL; + + if((ma->mode & MA_RAMP_COL) && ma->ramp_col == NULL) + ma->ramp_col= add_colorband(0); +} + +static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value) +{ + Material *ma= (Material*)ptr->data; + + if(value) ma->mode |= MA_RAMP_SPEC; + else ma->mode &= ~MA_RAMP_SPEC; + + if((ma->mode & MA_RAMP_SPEC) && ma->ramp_spec == NULL) + ma->ramp_spec= add_colorband(0); +} + #else static void rna_def_material_mtex(BlenderRNA *brna) @@ -231,99 +256,122 @@ static void rna_def_material_mtex(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "texco"); RNA_def_property_enum_items(prop, prop_texture_coordinates_items); RNA_def_property_ui_text(prop, "Texture Coordinates", ""); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "object"); 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 mapping with Object texture coordinates."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "uvname"); RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "from_dupli", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_DUPLI_MAPTO); - RNA_def_property_ui_text(prop, "From Dupli", "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent (only for UV and Orco texture coordinates)."); + RNA_def_property_ui_text(prop, "From Dupli", "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "from_original", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_OB_DUPLI_ORIG); RNA_def_property_ui_text(prop, "From Original", "Dupli's derive their object coordinates from the original objects transformation."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); - prop= RNA_def_property(srna, "map_color", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "map_colordiff", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COL); - RNA_def_property_ui_text(prop, "Color", "Causes the texture to affect basic color of the material"); + RNA_def_property_ui_text(prop, "Diffuse Color", "Causes the texture to affect basic color of the material"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_NORM); RNA_def_property_ui_text(prop, "Normal", "Causes the texture to affect the rendered normal"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_colorspec", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLSPEC); - RNA_def_property_ui_text(prop, "Specularity Color", "Causes the texture to affect the specularity color"); + RNA_def_property_ui_text(prop, "Specular Color", "Causes the texture to affect the specularity color"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_mirror", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLMIR); RNA_def_property_ui_text(prop, "Mirror", "Causes the texture to affect the mirror color"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); - prop= RNA_def_property(srna, "map_reflection", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "map_diffuse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REF); - RNA_def_property_ui_text(prop, "Reflection", "Causes the texture to affect the value of the materials reflectivity"); + RNA_def_property_ui_text(prop, "Diffuse", "Causes the texture to affect the value of the materials diffuse reflectivity"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); - prop= RNA_def_property(srna, "map_specularity", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "map_specular", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_SPEC); - RNA_def_property_ui_text(prop, "Specularity", "Causes the texture to affect the value of specularity"); + RNA_def_property_ui_text(prop, "Specular", "Causes the texture to affect the value of specular reflectivity"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_ambient", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_AMB); RNA_def_property_ui_text(prop, "Ambient", "Causes the texture to affect the value of ambient"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_hardness", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_HAR); RNA_def_property_ui_text(prop, "Hardness", "Causes the texture to affect the hardness value"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_raymir", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_RAYMIRR); RNA_def_property_ui_text(prop, "Ray-Mirror", "Causes the texture to affect the ray-mirror value"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ALPHA); RNA_def_property_ui_text(prop, "Alpha", "Causes the texture to affect the alpha value"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_emit", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMIT); RNA_def_property_ui_text(prop, "Emit", "Causes the texture to affect the emit value"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_translucency", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_TRANSLU); RNA_def_property_ui_text(prop, "Translucency", "Causes the texture to affect the translucency value"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_displacement", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_DISPLACE); RNA_def_property_ui_text(prop, "Displacement", "Let the texture displace the surface"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_warp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_WARP); RNA_def_property_ui_text(prop, "Warp", "Let the texture warp texture coordinates of next channels"); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "x_mapping", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "projx"); RNA_def_property_enum_items(prop, prop_x_mapping_items); RNA_def_property_ui_text(prop, "X Mapping", ""); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "y_mapping", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "projy"); RNA_def_property_enum_items(prop, prop_y_mapping_items); RNA_def_property_ui_text(prop, "Y Mapping", ""); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "z_mapping", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "projz"); RNA_def_property_enum_items(prop, prop_z_mapping_items); RNA_def_property_ui_text(prop, "Z Mapping", ""); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_mapping_items); RNA_def_property_ui_text(prop, "Mapping", ""); + RNA_def_property_update(prop, NC_TEXTURE, NULL); /* XXX: pmapto, pmaptoneg */ @@ -331,31 +379,130 @@ static void rna_def_material_mtex(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "normapspace"); RNA_def_property_enum_items(prop, prop_normal_map_space_items); RNA_def_property_ui_text(prop, "Normal Map Space", ""); + RNA_def_property_update(prop, NC_TEXTURE, NULL); /* XXX: MTex.which_output */ /* XXX: MTex.k */ - prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_VECTOR); + prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dispfac"); - RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); RNA_def_property_ui_text(prop, "Displacement Factor", "Amount texture displaces the surface."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); - prop= RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_VECTOR); + prop= RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "warpfac"); - RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Warp Factor", "Amount texture affects color values."); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Warp Factor", "Amount texture affects texture coordinates of next channels."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "colorspec_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Specular Color Factor", "Amount texture affects specular color."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "colordiff_factor", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Diffuse Color Factor", "Amount texture affects diffuse color."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "mirror_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Mirror Factor", "Amount texture affects mirror color."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Alpha Factor", "Amount texture affects alpha."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "diffuse_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Diffuse Factor", "Amount texture affects diffuse reflectivity."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Specular Factor", "Amount texture affects specular reflectivity."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "emit_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Emit Factor", "Amount texture affects emission."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "hardness_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Hardness Factor", "Amount texture affects hardness."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "raymir_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Ray Mirror Factor", "Amount texture affects ray mirror."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "translucency_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Translucency Factor", "Amount texture affects translucency."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "ambient_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Ambient Factor", "Amount texture affects ambient."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_MaterialTextureSlot_enabled_get", "rna_MaterialTextureSlot_enabled_set"); RNA_def_property_ui_text(prop, "Enabled", "Enable this material texture slot."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + prop= RNA_def_property(srna, "new_bump", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_NEW_BUMP); + RNA_def_property_ui_text(prop, "New Bump", "Use new, corrected bump mapping code (backwards compatibility option)."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); } static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; + + static EnumPropertyItem prop_ramp_blend_diffuse_items[] = { + {MA_RAMP_BLEND, "MIX", 0, "Mix", ""}, + {MA_RAMP_ADD, "ADD", 0, "Add", ""}, + {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""}, + {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""}, + {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""}, + {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""}, + {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""}, + {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""}, + {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""}, + {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""}, + {MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""}, + {MA_RAMP_BURN, "BURN", 0, "Burn", ""}, + {MA_RAMP_HUE, "HUE", 0, "Hue", ""}, + {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""}, + {MA_RAMP_VAL, "VALUE", 0, "Value", ""}, + {MA_RAMP_COLOR, "COLOR", 0, "Color", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_ramp_input_items[] = { + {MA_RAMP_IN_SHADER, "SHADER", 0, "Shader", ""}, + {MA_RAMP_IN_ENERGY, "ENERGY", 0, "Energy", ""}, + {MA_RAMP_IN_NOR, "NORMAL", 0, "Normal", ""}, + {MA_RAMP_IN_RESULT, "RESULT", 0, "Result", ""}, + {0, NULL, 0, NULL, NULL}}; prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "r"); @@ -381,15 +528,52 @@ static void rna_def_material_colors(StructRNA *srna) RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); /* Color bands */ + prop= RNA_def_property(srna, "use_diffuse_ramp", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_COL); + RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_diffuse_ramp_set"); + RNA_def_property_ui_text(prop, "Use Diffuse Ramp", "Toggle diffuse ramp operations."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + prop= RNA_def_property(srna, "diffuse_ramp", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ramp_col"); RNA_def_property_struct_type(prop, "ColorRamp"); RNA_def_property_ui_text(prop, "Diffuse Ramp", "Color ramp used to affect diffuse shading."); + prop= RNA_def_property(srna, "use_specular_ramp", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_SPEC); + RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_specular_ramp_set"); + RNA_def_property_ui_text(prop, "Use Specular Ramp", "Toggle specular ramp operations."); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + prop= RNA_def_property(srna, "specular_ramp", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ramp_spec"); RNA_def_property_struct_type(prop, "ColorRamp"); RNA_def_property_ui_text(prop, "Specular Ramp", "Color ramp used to affect specular shading."); + + prop= RNA_def_property(srna, "diffuse_ramp_blend", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "rampblend_col"); + RNA_def_property_enum_items(prop, prop_ramp_blend_diffuse_items); + RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", ""); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + + prop= RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "rampblend_spec"); + RNA_def_property_enum_items(prop, prop_ramp_blend_diffuse_items); + RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", ""); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW, NULL); + + prop= RNA_def_property(srna, "diffuse_ramp_input", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "rampin_col"); + RNA_def_property_enum_items(prop, prop_ramp_input_items); + RNA_def_property_ui_text(prop, "Diffuse Ramp Input", ""); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + + prop= RNA_def_property(srna, "specular_ramp_input", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "rampin_spec"); + RNA_def_property_enum_items(prop, prop_ramp_input_items); + RNA_def_property_ui_text(prop, "Specular Ramp Input", ""); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); + } static void rna_def_material_diffuse(StructRNA *srna) @@ -457,8 +641,8 @@ static void rna_def_material_raymirror(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_fadeto_mir_items[] = { - {MA_RAYMIR_FADETOSKY, "FADE_TO_SKY", 0, "Fade to Sky Color", ""}, - {MA_RAYMIR_FADETOMAT, "FADE_TO_MATERIAL", 0, "Fade to Material Color", ""}, + {MA_RAYMIR_FADETOSKY, "FADE_TO_SKY", 0, "Sky", ""}, + {MA_RAYMIR_FADETOMAT, "FADE_TO_MATERIAL", 0, "Material", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MaterialRaytraceMirror", NULL); @@ -784,13 +968,13 @@ static void rna_def_material_sss(BlenderRNA *brna) prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sss_colfac"); - RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); RNA_def_property_ui_text(prop, "Color Factor", "Blend factor for SSS colors."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sss_texfac"); - RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); RNA_def_property_ui_text(prop, "Texture Factor", "Texture scatting blend factor."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); @@ -816,7 +1000,7 @@ void rna_def_material_specularity(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem prop_spec_shader_items[] = { + static EnumPropertyItem prop_specular_shader_items[] = { {MA_SPEC_COOKTORR, "COOKTORR", 0, "CookTorr", ""}, {MA_SPEC_PHONG, "PHONG", 0, "Phong", ""}, {MA_SPEC_BLINN, "BLINN", 0, "Blinn", ""}, @@ -824,9 +1008,9 @@ void rna_def_material_specularity(StructRNA *srna) {MA_SPEC_WARDISO, "WARDISO", 0, "WardIso", ""}, {0, NULL, 0, NULL, NULL}}; - prop= RNA_def_property(srna, "spec_shader", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "specular_shader", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "spec_shader"); - RNA_def_property_enum_items(prop, prop_spec_shader_items); + RNA_def_property_enum_items(prop, prop_specular_shader_items); RNA_def_property_ui_text(prop, "Specular Shader Model", ""); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); @@ -946,7 +1130,8 @@ void RNA_def_material(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {MA_TYPE_SURFACE, "SURFACE", 0, "Surface", "Render object as a surface."}, - {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."}, + {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in ray tracing)."}, + // {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume."}, {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles."}, {0, NULL, 0, NULL, NULL}}; @@ -1032,9 +1217,9 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Shadeless", "Makes this material insensitive to light or shadow."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "wireframe", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_WIRE); - RNA_def_property_ui_text(prop, "Wireframe", "Render the edges of faces as wires (not supported in ray tracing)."); + prop= RNA_def_property(srna, "z_transparency", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZTRA); + RNA_def_property_ui_text(prop, "Z Transparency", "Enable alpha buffer for transparent faces."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); prop= RNA_def_property(srna, "vertex_color_light", PROP_BOOLEAN, PROP_NONE); @@ -1111,11 +1296,6 @@ void RNA_def_material(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TANGENT_V); RNA_def_property_ui_text(prop, "Tangent Shading", "Use the material's tangent vector instead of the normal for shading - for anisotropic shading effects"); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - - prop= RNA_def_property(srna, "z_transparency", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZTRA); - RNA_def_property_ui_text(prop, "ZTransp", "Z-buffer transparency"); - RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); /* nested structs */ prop= RNA_def_property(srna, "raytrace_mirror", PROP_POINTER, PROP_NEVER_NULL); @@ -1150,12 +1330,8 @@ void RNA_def_material(BlenderRNA *brna) /* common */ rna_def_animdata_common(srna); - rna_def_mtex_common(srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get", "rna_Material_active_texture_index_set", "MaterialTextureSlot"); - - prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "scriptlink"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this material."); + rna_def_mtex_common(srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get", + "rna_Material_active_texture_set", "MaterialTextureSlot"); rna_def_material_colors(srna); rna_def_material_diffuse(srna); @@ -1183,14 +1359,13 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures."); prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_struct_type(prop, structname); - RNA_def_property_pointer_funcs(prop, activeget, NULL, NULL); + RNA_def_property_struct_type(prop, "Texture"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL); RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed."); prop= RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "texact"); - RNA_def_property_int_funcs(prop, NULL, activeset, NULL); RNA_def_property_range(prop, 0, MAX_MTEX-1); RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot."); } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index eb0e3585212..dba5a0622c3 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -39,6 +39,7 @@ #include "DNA_scene_types.h" #include "BLI_editVert.h" +#include "BLI_arithb.h" #include "BKE_customdata.h" #include "BKE_depsgraph.h" @@ -113,6 +114,17 @@ static void rna_MEdge_crease_set(PointerRNA *ptr, float value) medge->crease= (char)(CLAMPIS(value*255.0f, 0, 255)); } +static void rna_MeshFace_normal_get(PointerRNA *ptr, float *values) +{ + Mesh *me= (Mesh*)ptr->id.data; + MFace *mface= (MFace*)ptr->data; + + if(mface->v4) + CalcNormFloat4(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, me->mvert[mface->v4].co, values); + else + CalcNormFloat(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, values); +} + /* notice red and blue are swapped */ static void rna_MeshColor_color1_get(PointerRNA *ptr, float *values) { @@ -213,26 +225,6 @@ static void rna_MeshFace_material_index_range(PointerRNA *ptr, int *min, int *ma *max= me->totcol-1; } -static void rna_MeshFace_normal_get(PointerRNA *ptr, float *value) -{ - float *vert[4]; - MFace *face = (MFace*)ptr->data; - Mesh *me= (Mesh*)ptr->id.data; - - vert[0] = me->mvert[face->v1].co; - vert[1] = me->mvert[face->v2].co; - vert[2] = me->mvert[face->v3].co; - - /* copied from MFace_getNormal (old python API) */ - if (face->v4) { - vert[3] = me->mvert[face->v4].co; - CalcNormFloat4(vert[0], vert[1], vert[2], vert[3], value); - } - else { - CalcNormFloat(vert[0], vert[1], vert[2], value); - } -} - static CustomData *rna_mesh_fdata(Mesh *me) { return (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata; @@ -923,9 +915,10 @@ static void rna_def_mface(BlenderRNA *brna) prop= RNA_def_property(srna, "normal", PROP_FLOAT, PROP_VECTOR); RNA_def_property_array(prop, 3); + RNA_def_property_range(prop, -1.0f, 1.0f); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_MeshFace_normal_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Normal", "Face normal"); + RNA_def_property_ui_text(prop, "Normal", "Face unit-space normal vector."); } static void rna_def_mtface(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index b2157340207..9a527948b0f 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -130,7 +130,7 @@ static void rna_Mesh_transform(Mesh *me, float *mat) MVert *mvert= me->mvert; for(i= 0; i < me->totvert; i++, mvert++) { - Mat4MulVecfl(mat, mvert->co); + Mat4MulVecfl((float (*)[4])mat, mvert->co); } } diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 5f95336af2d..df26e6b8121 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -17,7 +17,7 @@ * 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), Juho Vepsäläinen + * Contributor(s): Blender Foundation (2008), Juho Vepsalainen, Jiri Hnidek * * ***** END GPL LICENSE BLOCK ***** */ @@ -34,12 +34,29 @@ #ifdef RNA_RUNTIME +#include "DNA_scene_types.h" +#include "DNA_object_types.h" + +#include "BKE_depsgraph.h" + +#include "WM_types.h" +#include "WM_api.h" + static int rna_Meta_texspace_editable(PointerRNA *ptr) { MetaBall *mb= (MetaBall*)ptr->data; return (mb->texflag & AUTOSPACE)? 0: PROP_EDITABLE; } +static void rna_MetaBall_update_data(bContext *C, PointerRNA *ptr) +{ + Scene *scene= CTX_data_scene(C); + Object *obedit= CTX_data_edit_object(C); + + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); +} + #else void rna_def_metaelement(BlenderRNA *brna) @@ -47,11 +64,11 @@ void rna_def_metaelement(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; static EnumPropertyItem prop_type_items[] = { - {MB_BALL, "BALL", 0, "Ball", ""}, - {MB_TUBE, "TUBE", 0, "Tube", ""}, - {MB_PLANE, "PLANE", 0, "Plane", ""}, - {MB_ELIPSOID, "ELLIPSOID", 0, "Ellipsoid", ""}, // NOTE: typo at original definition! - {MB_CUBE, "CUBE", 0, "Cube", ""}, + {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""}, + {MB_TUBE, "TUBE", ICON_META_TUBE, "Tube", ""}, + {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""}, + {MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, // NOTE: typo at original definition! + {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "MetaElement", NULL); @@ -61,43 +78,61 @@ void rna_def_metaelement(BlenderRNA *brna) /* enums */ prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Type", "Metaball types."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); /* number values */ prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "x"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Location", ""); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ROTATION); RNA_def_property_float_sdna(prop, NULL, "quat"); RNA_def_property_ui_text(prop, "Rotation", ""); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_float_sdna(prop, NULL, "rad"); RNA_def_property_ui_text(prop, "Radius", ""); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); - prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "sizex", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "expx"); RNA_def_property_range(prop, 0.0f, 20.0f); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Size", "Size of element, use of components depends on element type."); + RNA_def_property_ui_text(prop, "Size X", "Size of element, use of components depends on element type."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); + + prop= RNA_def_property(srna, "sizey", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "expy"); + RNA_def_property_range(prop, 0.0f, 20.0f); + RNA_def_property_ui_text(prop, "Size Y", "Size of element, use of components depends on element type."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); + + prop= RNA_def_property(srna, "sizez", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "expz"); + RNA_def_property_range(prop, 0.0f, 20.0f); + RNA_def_property_ui_text(prop, "Size Z", "Size of element, use of components depends on element type."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "s"); RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_ui_text(prop, "Stiffness", "Stiffness defines how much of the element to fill."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); /* flags */ prop= RNA_def_property(srna, "negative", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_NEGATIVE); RNA_def_property_ui_text(prop, "Negative", "Set metaball as negative one."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_HIDE); RNA_def_property_ui_text(prop, "Hide", "Hide element."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); } void rna_def_metaball(BlenderRNA *brna) @@ -106,7 +141,7 @@ void rna_def_metaball(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_update_items[] = { {MB_UPDATE_ALWAYS, "UPDATE_ALWAYS", 0, "Always", "While editing, update metaball always."}, - {MB_UPDATE_HALFRES, "HALFRES", 0, "Half Resolution", "While editing, update metaball in half resolution."}, + {MB_UPDATE_HALFRES, "HALFRES", 0, "Half", "While editing, update metaball in half resolution."}, {MB_UPDATE_FAST, "FAST", 0, "Fast", "While editing, update metaball without polygonization."}, {MB_UPDATE_NEVER, "NEVER", 0, "Never", "While editing, don't update metaball at all."}, {0, NULL, 0, NULL, NULL}}; @@ -120,16 +155,22 @@ void rna_def_metaball(BlenderRNA *brna) RNA_def_property_struct_type(prop, "MetaElement"); RNA_def_property_ui_text(prop, "Elements", "Meta elements."); + prop= RNA_def_property(srna, "last_selected_element", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "lastelem"); + RNA_def_property_ui_text(prop, "Last selected element.", "Last selected element."); + /* enums */ prop= RNA_def_property(srna, "flag", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_update_items); RNA_def_property_ui_text(prop, "Update", "Metaball edit update behavior."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); /* number values */ prop= RNA_def_property(srna, "wire_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "wiresize"); RNA_def_property_range(prop, 0.050f, 1.0f); RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); prop= RNA_def_property(srna, "render_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rendersize"); @@ -140,6 +181,7 @@ void rna_def_metaball(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "thresh"); RNA_def_property_range(prop, 0.0f, 5.0f); RNA_def_property_ui_text(prop, "Threshold", "Influence of meta elements."); + RNA_def_property_update(prop, 0, "rna_MetaBall_update_data"); /* materials, textures */ rna_def_texmat_common(srna, "rna_Meta_texspace_editable"); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index b3dfc6a8dd6..80bc46bb2f0 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -34,9 +34,11 @@ #include "DNA_armature_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_object_force.h" #include "DNA_scene_types.h" #include "BKE_bmesh.h" /* For BevelModifierData */ +#include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */ #include "WM_types.h" @@ -65,6 +67,7 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""}, {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""}, {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""}, + {eModifierType_Smoke, "SMOKE", 0, "Smoke", ""}, {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""}, {eModifierType_Softbody, "SOFTBODY", ICON_MOD_SOFT, "Soft Body", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subsurf", ""}, @@ -151,6 +154,8 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_MultiresModifier; case eModifierType_Surface: return &RNA_SurfaceModifier; + case eModifierType_Smoke: + return &RNA_SmokeModifier; default: return &RNA_Modifier; } @@ -172,6 +177,23 @@ static void rna_Modifier_dependency_update(bContext *C, PointerRNA *ptr) DAG_scene_sort(CTX_data_scene(C)); } +static void rna_Smoke_set_type(bContext *C, PointerRNA *ptr) +{ + SmokeModifierData *smd= (SmokeModifierData *)ptr->data; + Object *ob= (Object*)ptr->id.data; + + smokeModifier_free(smd); // XXX TODO: completely free all 3 pointers + smokeModifier_createType(smd); // create regarding of selected type + // particle_system_slot_add_exec(C, NULL); + // particle_system_slot_remove_exec(C, NULL); + + if(smd->type == MOD_SMOKE_TYPE_DOMAIN) + ob->dt = OB_WIRE; + + // update dependancy since a domain - other type switch could have happened + rna_Modifier_dependency_update(C, ptr); +} + static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value) { ExplodeModifierData *emd= (ExplodeModifierData*)ptr->data; @@ -311,6 +333,11 @@ static void rna_CurveModifier_object_set(PointerRNA *ptr, PointerRNA value) modifier_object_set(&((CurveModifierData*)ptr->data)->object, OB_CURVE, value); } +static void rna_CastModifier_object_set(PointerRNA *ptr, PointerRNA value) +{ + modifier_object_set(&((CastModifierData*)ptr->data)->object, OB_MESH, value); +} + static void rna_ArmatureModifier_object_set(PointerRNA *ptr, PointerRNA value) { modifier_object_set(&((ArmatureModifierData*)ptr->data)->object, OB_ARMATURE, value); @@ -357,6 +384,12 @@ static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft); } +static PointerRNA rna_SoftBodyModifier_point_cache_get(PointerRNA *ptr) +{ + Object *ob= (Object*)ptr->id.data; + return rna_pointer_inherit_refine(ptr, &RNA_PointCache, ob->soft->pointcache); +} + static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; @@ -857,6 +890,11 @@ static void rna_def_modifier_softbody(BlenderRNA *brna) RNA_def_property_struct_type(prop, "SoftBodySettings"); RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL); RNA_def_property_ui_text(prop, "Soft Body Settings", ""); + + prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "PointCache"); + RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_point_cache_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Soft Body Point Cache", ""); } static void rna_def_modifier_boolean(BlenderRNA *brna) @@ -1203,6 +1241,12 @@ static void rna_def_modifier_cast(BlenderRNA *brna) RNA_def_property_enum_items(prop, prop_cast_type_items); RNA_def_property_ui_text(prop, "Cast Type", ""); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + + prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Object", "Control object: if available, its location determines the center of the effect"); + RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update"); prop= RNA_def_property(srna, "x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_X); @@ -1219,6 +1263,16 @@ static void rna_def_modifier_cast(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Z", ""); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + prop= RNA_def_property(srna, "from_radius", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_SIZE_FROM_RADIUS); + RNA_def_property_ui_text(prop, "From Radius", "Use radius as size of projection shape (0 = auto)"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + + prop= RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM); + RNA_def_property_ui_text(prop, "Use transform", "Use object transform to control projection shape"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update"); + prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fac"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); @@ -1445,6 +1499,41 @@ static void rna_def_modifier_cloth(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Point Cache", ""); } +static void rna_def_modifier_smoke(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_smoke_type_items[] = { + {0, "NONE", 0, "None", ""}, + {MOD_SMOKE_TYPE_DOMAIN, "TYPE_DOMAIN", 0, "Domain", ""}, + {MOD_SMOKE_TYPE_FLOW, "TYPE_FLOW", 0, "Flow", "Inflow/Outflow"}, + {MOD_SMOKE_TYPE_COLL, "TYPE_COLL", 0, "Collision", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "SmokeModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Smoke Modifier", "Smoke simulation modifier."); + RNA_def_struct_sdna(srna, "SmokeModifierData"); + + prop= RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "domain"); + RNA_def_property_ui_text(prop, "Domain Settings", ""); + + prop= RNA_def_property(srna, "flow_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "flow"); + RNA_def_property_ui_text(prop, "Flow Settings", ""); + + prop= RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "coll"); + RNA_def_property_ui_text(prop, "Collision Settings", ""); + + prop= RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, prop_smoke_type_items); + RNA_def_property_ui_text(prop, "Type", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_set_type"); +} + static void rna_def_modifier_collision(BlenderRNA *brna) { StructRNA *srna; @@ -1742,7 +1831,6 @@ static void rna_def_modifier_surface(BlenderRNA *brna) RNA_def_struct_sdna(srna, "SurfaceModifierData"); RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS); } - void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -1826,6 +1914,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_simpledeform(brna); rna_def_modifier_multires(brna); rna_def_modifier_surface(brna); + rna_def_modifier_smoke(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index bc636af6849..3b55da046b8 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -243,6 +243,19 @@ static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, int value) #else +/* enum defines exported for rna_animation.c */ +EnumPropertyItem nla_mode_blend_items[] = { + {NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace", "Result strip replaces the accumulated results by amount specified by influence."}, + {NLASTRIP_MODE_ADD, "ADD", 0, "Add", "Weighted result of strip is added to the accumlated results."}, + {NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract", "Weighted result of strip is removed from the accumlated results."}, + {NLASTRIP_MODE_MULTIPLY, "MULITPLY", 0, "Multiply", "Weighted result of strip is multiplied with the accumlated results."}, + {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem nla_mode_extend_items[] = { + {NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents."}, + {NLASTRIP_EXTEND_HOLD, "HOLD", 0, "Hold", "Hold the first frame if no previous strips in track, and always hold last frame."}, + {NLASTRIP_EXTEND_HOLD_FORWARD, "HOLD_FORWARD", 0, "Hold Forward", "Only hold last frame."}, + {0, NULL, 0, NULL, NULL}}; + void rna_def_nlastrip(BlenderRNA *brna) { StructRNA *srna; @@ -254,17 +267,6 @@ void rna_def_nlastrip(BlenderRNA *brna) {NLASTRIP_TYPE_TRANSITION, "TRANSITION", 0, "Transition", "NLA Strip 'transitions' between adjacent strips."}, {NLASTRIP_TYPE_META, "META", 0, "Meta", "NLA Strip acts as a container for adjacent strips."}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem prop_mode_blend_items[] = { - {NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace", "Result strip replaces the accumulated results by amount specified by influence."}, - {NLASTRIP_MODE_ADD, "ADD", 0, "Add", "Weighted result of strip is added to the accumlated results."}, - {NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract", "Weighted result of strip is removed from the accumlated results."}, - {NLASTRIP_MODE_MULTIPLY, "MULITPLY", 0, "Multiply", "Weighted result of strip is multiplied with the accumlated results."}, - {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem prop_mode_extend_items[] = { - {NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents."}, - {NLASTRIP_EXTEND_HOLD, "HOLD", 0, "Hold", "Hold the first frame if no previous strips in track, and always hold last frame."}, - {NLASTRIP_EXTEND_HOLD_FORWARD, "HOLD_FORWARD", 0, "Hold Forward", "Only hold last frame."}, - {0, NULL, 0, NULL, NULL}}; /* struct definition */ srna= RNA_def_struct(brna, "NlaStrip", NULL); @@ -286,12 +288,12 @@ void rna_def_nlastrip(BlenderRNA *brna) prop= RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "extendmode"); - RNA_def_property_enum_items(prop, prop_mode_extend_items); + RNA_def_property_enum_items(prop, nla_mode_extend_items); RNA_def_property_ui_text(prop, "Extrapolation", "Action to take for gaps past the strip extents."); prop= RNA_def_property(srna, "blending", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "blendmode"); - RNA_def_property_enum_items(prop, prop_mode_blend_items); + RNA_def_property_enum_items(prop, nla_mode_blend_items); RNA_def_property_ui_text(prop, "Blending", "Method used for combining strip's result with accumulated result."); /* Strip extents */ diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index ffa312f3a09..6fe254dcb68 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -44,7 +44,7 @@ static EnumPropertyItem parent_type_items[] = { {PAROBJECT, "OBJECT", 0, "Object", ""}, {PARCURVE, "CURVE", 0, "Curve", ""}, - //{PARKEY, "KEY", 0, "Key", ""}, + {PARKEY, "KEY", 0, "Key", ""}, {PARSKEL, "ARMATURE", 0, "Armature", ""}, {PARSKEL, "LATTICE", 0, "Lattice", ""}, // PARSKEL reuse will give issues {PARVERT1, "VERTEX", 0, "Vertex", ""}, @@ -199,9 +199,9 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *C, PointerRNA *p if(par->type == OB_CURVE) RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARCURVE); else if(par->type == OB_LATTICE) - RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARSKEL); + RNA_enum_items_add_value(&item, &totitem, &parent_type_items[4], PARSKEL); // special hack: prevents this overriding others else if(par->type == OB_ARMATURE) { - RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARSKEL); + RNA_enum_items_add_value(&item, &totitem, &parent_type_items[3], PARSKEL); // special hack: prevents this being overrided RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE); } else if(par->type == OB_MESH) { @@ -377,7 +377,17 @@ static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, in static PointerRNA rna_Object_active_material_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; - return rna_pointer_inherit_refine(ptr, &RNA_MaterialSlot, ob->mat+ob->actcol); + Material *ma; + + ma= (ob->totcol)? give_current_material(ob, ob->actcol): NULL; + return rna_pointer_inherit_refine(ptr, &RNA_Material, ma); +} + +static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value) +{ + Object *ob= (Object*)ptr->id.data; + + assign_material(ob, value.data, ob->actcol); } static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max) @@ -400,15 +410,6 @@ static void rna_Object_active_particle_system_index_set(struct PointerRNA *ptr, psys_set_current_num(ob, value); } -#if 0 -static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value) -{ - Object *ob= (Object*)ptr->id.data; - - assign_material(ob, value.data, ob->actcol); -} -#endif - static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; @@ -1037,9 +1038,11 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Materials", "Material slots in the object."); prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "MaterialSlot"); - RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL, NULL); + RNA_def_property_struct_type(prop, "Material"); + RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed."); + RNA_def_property_update(prop, NC_OBJECT|ND_SHADING, "rna_Object_update"); prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "actcol"); @@ -1325,12 +1328,6 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parents time offset value"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update"); - /* script link */ - - prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "scriptlink"); - RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this object."); - /* drawing */ prop= RNA_def_property(srna, "max_draw_type", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index bc031c4e5f2..881c2bdf549 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -49,6 +49,7 @@ #include "BKE_object.h" #include "BKE_mesh.h" #include "BKE_DerivedMesh.h" + #include "BKE_customdata.h" #include "BKE_anim.h" #include "BKE_depsgraph.h" diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 2ec8d9ea41e..e229afedc62 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -105,6 +105,7 @@ static void rna_Cache_toggle_disk_cache(bContext *C, PointerRNA *ptr) static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr) { + Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); PointCache *cache = (PointCache*)ptr->data; PTCacheID *pid = NULL, *pid2= NULL; @@ -119,33 +120,50 @@ static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr) BKE_ptcache_ids_from_object(&pidlist, ob); - for(pid=pidlist.first; pid; pid=pid->next) { - if(pid->cache==cache) - pid2 = pid; - else if(strcmp(cache->name, "") && strcmp(cache->name,pid->cache->name)==0) { - /*TODO: report "name exists" to user */ - strcpy(cache->name, cache->prev_name); - new_name = 0; + if(cache->flag & PTCACHE_EXTERNAL) { + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache==cache) + break; } + + if(!pid) + return; + + cache->flag |= (PTCACHE_BAKED|PTCACHE_DISK_CACHE|PTCACHE_SIMULATION_VALID); + cache->flag &= ~(PTCACHE_OUTDATED|PTCACHE_FRAMES_SKIPPED); + + BKE_ptcache_load_external(pid); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); } + else { + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache==cache) + pid2 = pid; + else if(strcmp(cache->name, "") && strcmp(cache->name,pid->cache->name)==0) { + /*TODO: report "name exists" to user */ + strcpy(cache->name, cache->prev_name); + new_name = 0; + } + } - if(new_name) { - if(pid2 && cache->flag & PTCACHE_DISK_CACHE) { - strcpy(name, cache->name); - strcpy(cache->name, cache->prev_name); + if(new_name) { + if(pid2 && cache->flag & PTCACHE_DISK_CACHE) { + strcpy(name, cache->name); + strcpy(cache->name, cache->prev_name); - cache->flag &= ~PTCACHE_DISK_CACHE; + cache->flag &= ~PTCACHE_DISK_CACHE; - BKE_ptcache_toggle_disk_cache(pid2); + BKE_ptcache_toggle_disk_cache(pid2); - strcpy(cache->name, name); + strcpy(cache->name, name); - cache->flag |= PTCACHE_DISK_CACHE; + cache->flag |= PTCACHE_DISK_CACHE; - BKE_ptcache_toggle_disk_cache(pid2); - } + BKE_ptcache_toggle_disk_cache(pid2); + } - strcpy(cache->prev_name, cache->name); + strcpy(cache->prev_name, cache->name); + } } BLI_freelistN(&pidlist); @@ -153,91 +171,91 @@ static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr) static int rna_SoftBodySettings_use_edges_get(PointerRNA *ptr) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); return (((data->softflag) & OB_SB_EDGES) != 0); } static void rna_SoftBodySettings_use_edges_set(PointerRNA *ptr, int value) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); if(value) data->softflag |= OB_SB_EDGES; else data->softflag &= ~OB_SB_EDGES; } static int rna_SoftBodySettings_use_goal_get(PointerRNA *ptr) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); return (((data->softflag) & OB_SB_GOAL) != 0); } static void rna_SoftBodySettings_use_goal_set(PointerRNA *ptr, int value) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); if(value) data->softflag |= OB_SB_GOAL; else data->softflag &= ~OB_SB_GOAL; } static int rna_SoftBodySettings_stiff_quads_get(PointerRNA *ptr) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); return (((data->softflag) & OB_SB_QUADS) != 0); } static void rna_SoftBodySettings_stiff_quads_set(PointerRNA *ptr, int value) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); if(value) data->softflag |= OB_SB_QUADS; else data->softflag &= ~OB_SB_QUADS; } static int rna_SoftBodySettings_self_collision_get(PointerRNA *ptr) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); return (((data->softflag) & OB_SB_SELF) != 0); } static void rna_SoftBodySettings_self_collision_set(PointerRNA *ptr, int value) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); if(value) data->softflag |= OB_SB_SELF; else data->softflag &= ~OB_SB_SELF; } static int rna_SoftBodySettings_new_aero_get(PointerRNA *ptr) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); return (((data->softflag) & OB_SB_AERO_ANGLE) != 0); } static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); if(value) data->softflag |= OB_SB_AERO_ANGLE; else data->softflag &= ~OB_SB_AERO_ANGLE; } static int rna_SoftBodySettings_face_collision_get(PointerRNA *ptr) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); return (((data->softflag) & OB_SB_FACECOLL) != 0); } static void rna_SoftBodySettings_face_collision_set(PointerRNA *ptr, int value) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); if(value) data->softflag |= OB_SB_FACECOLL; else data->softflag &= ~OB_SB_FACECOLL; } static int rna_SoftBodySettings_edge_collision_get(PointerRNA *ptr) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); return (((data->softflag) & OB_SB_EDGECOLL) != 0); } static void rna_SoftBodySettings_edge_collision_set(PointerRNA *ptr, int value) { - Object *data= (Object*)(ptr->data); + Object *data= (Object*)(ptr->id.data); if(value) data->softflag |= OB_SB_EDGECOLL; else data->softflag &= ~OB_SB_EDGECOLL; } @@ -365,11 +383,16 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops."); prop= RNA_def_property(srna, "step", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "step"); RNA_def_property_range(prop, 1, 20); RNA_def_property_ui_text(prop, "Cache Step", "Number of frames between cached frames."); RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change"); + prop= RNA_def_property(srna, "index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "index"); + RNA_def_property_range(prop, -1, 100); + RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files."); + RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); + /* flags */ prop= RNA_def_property(srna, "baked", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED); @@ -398,6 +421,11 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Name", "Cache name"); RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH); + RNA_def_property_string_sdna(prop, NULL, "path"); + RNA_def_property_ui_text(prop, "File Path", "Cache file path."); + RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); + prop= RNA_def_property(srna, "quick_cache", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_QUICK_CACHE); RNA_def_property_ui_text(prop, "Quick Cache", "Update simulation with cache steps"); @@ -407,6 +435,11 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "info"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status."); + + prop= RNA_def_property(srna, "external", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL); + RNA_def_property_ui_text(prop, "External", "Read cache from an external location"); + RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); } static void rna_def_collision(BlenderRNA *brna) @@ -682,10 +715,68 @@ static void rna_def_field(BlenderRNA *brna) static void rna_def_game_softbody(BlenderRNA *brna) { StructRNA *srna; + PropertyRNA *prop; srna= RNA_def_struct(brna, "GameSoftBodySettings", NULL); RNA_def_struct_sdna(srna, "BulletSoftBody"); RNA_def_struct_ui_text(srna, "Game Soft Body Settings", "Soft body simulation settings for an object in the game engine."); + + /* Floats */ + + prop= RNA_def_property(srna, "linstiff", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "linStiff"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Linear Stiffness", "Linear stiffness of the soft body links"); + + prop= RNA_def_property(srna, "dynamic_friction", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "kDF"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Friction", "Dynamic Friction"); + + prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "kMT"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Threshold", "Shape matching threshold"); + + prop= RNA_def_property(srna, "margin", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "margin"); + RNA_def_property_range(prop, 0.01f, 1.0f); + RNA_def_property_ui_text(prop, "Margin", "Collision margin for soft body. Small value makes the algorithm unstable"); + + prop= RNA_def_property(srna, "welding", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "welding"); + RNA_def_property_range(prop, 0.0f, 0.01f); + RNA_def_property_ui_text(prop, "Welding", "Welding threshold: distance between nearby vertices to be considered equal => set to 0.0 to disable welding test and speed up scene loading (ok if the mesh has no duplicates)"); + + /* Integers */ + + prop= RNA_def_property(srna, "position_iterations", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "piterations"); + RNA_def_property_range(prop, 0, 10); + RNA_def_property_ui_text(prop, "Position Iterations", "Position solver iterations"); + + prop= RNA_def_property(srna, "cluster_iterations", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "numclusteriterations"); + RNA_def_property_range(prop, 1, 128); + RNA_def_property_ui_text(prop, "Cluster Iterations", "Specify the number of cluster iterations"); + + /* Booleans */ + + prop= RNA_def_property(srna, "shape_match", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_BSB_SHAPE_MATCHING); + RNA_def_property_ui_text(prop, "Shape Match", "Enable soft body shape matching goal"); + + prop= RNA_def_property(srna, "bending_const", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_BSB_BENDING_CONSTRAINTS); + RNA_def_property_ui_text(prop, "Bending Const", "Enable bending constraints"); + + prop= RNA_def_property(srna, "enable_rs_collision", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_RS); + RNA_def_property_ui_text(prop, "Cluster Collision RS", "Enable cluster collision between soft and rigid body"); + + prop= RNA_def_property(srna, "enable_ss_collision", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_SS); + RNA_def_property_ui_text(prop, "Cluster Collision SS", "Enable cluster collision between soft and soft body"); } static void rna_def_softbody(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f07351f0a30..3ebdd61ca50 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -150,7 +150,6 @@ static void rna_Particle_target_reset(bContext *C, PointerRNA *ptr) ParticleTarget *pt = (ParticleTarget*)ptr->data; Object *ob = (Object*)ptr->id.data; ParticleSystem *kpsys=NULL, *psys=psys_get_current(ob); - int psys_num = BLI_findindex(&ob->particlesystem, psys); if(pt->ob==ob || pt->ob==NULL) { kpsys = BLI_findlink(&ob->particlesystem, pt->psys-1); @@ -616,33 +615,65 @@ static void rna_def_particle(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Stick Object", "Object that particle sticks to when dead"); -// ParticleKey state; /* normally current global coordinates or */ -// /* in sticky object space if dead & sticky */ -// -// ParticleKey prev_state; /* previous state */ + /* Particle State & Previous State */ + prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "state.co"); + RNA_def_property_ui_text(prop, "Particle Location", ""); + + prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "state.vel"); + RNA_def_property_ui_text(prop, "Particle Velocity", ""); + + prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "state.ave"); + RNA_def_property_ui_text(prop, "Angular Velocity", ""); + + prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ROTATION); + RNA_def_property_float_sdna(prop, NULL, "state.rot"); + RNA_def_property_ui_text(prop, "Rotation", ""); -// prop= RNA_def_property(srna, "hair", PROP_COLLECTION, PROP_NONE); -// RNA_def_property_collection_sdna(prop, NULL, "hair", "???totalHair???"); //don't know what the hair array size is -// RNA_def_property_struct_type(prop, "HairKey"); -// RNA_def_property_ui_text(prop, "Hair", ""); + prop= RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "prev_state.co"); + RNA_def_property_ui_text(prop, "Previous Particle Location", ""); + + prop= RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "prev_state.vel"); + RNA_def_property_ui_text(prop, "Previous Particle Velocity", ""); + + prop= RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "prev_state.ave"); + RNA_def_property_ui_text(prop, "Previous Angular Velocity", ""); + + prop= RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_ROTATION); + RNA_def_property_float_sdna(prop, NULL, "prev_state.rot"); + RNA_def_property_ui_text(prop, "Previous Rotation", ""); + + /* Hair & Keyed Keys */ + + prop= RNA_def_property(srna, "hair", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey"); + RNA_def_property_struct_type(prop, "ParticleHairKey"); + RNA_def_property_ui_text(prop, "Hair", ""); prop= RNA_def_property(srna, "keys", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey"); RNA_def_property_struct_type(prop, "ParticleKey"); RNA_def_property_ui_text(prop, "Keyed States", ""); - prop= RNA_def_property(srna, "random_rotation", PROP_FLOAT, PROP_NONE); + /* Random variables */ + + prop= RNA_def_property(srna, "random_rotation", PROP_FLOAT, PROP_ROTATION); RNA_def_property_float_sdna(prop, NULL, "r_rot"); // RNA_def_property_range(prop, lowerLimitf, upperLimitf); RNA_def_property_ui_text(prop, "Random Rotation", ""); - prop= RNA_def_property(srna, "random_a_velocity", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "random_a_velocity", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "r_ave"); // RNA_def_property_range(prop, lowerLimitf, upperLimitf); - RNA_def_property_ui_text(prop, "Random erm.. Velocity", "");//TODO: fix name + RNA_def_property_ui_text(prop, "Random Angular Velocity", ""); - prop= RNA_def_property(srna, "random_velocity", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "r_ve");//optional if prop names are the same + prop= RNA_def_property(srna, "random_velocity", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "r_ve"); // RNA_def_property_range(prop, lowerLimitf, upperLimitf); RNA_def_property_ui_text(prop, "Random Velocity", ""); @@ -650,9 +681,10 @@ static void rna_def_particle(BlenderRNA *brna) // float fuv[4], foffset; /* coordinates on face/edge number "num" and depth along*/ // /* face normal for volume emission */ - prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "birthtime", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "time"); // RNA_def_property_range(prop, lowerLimitf, upperLimitf); - RNA_def_property_ui_text(prop, "Time", ""); + RNA_def_property_ui_text(prop, "Birth Time", ""); prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_NONE); // RNA_def_property_range(prop, lowerLimitf, upperLimitf); @@ -663,11 +695,6 @@ static void rna_def_particle(BlenderRNA *brna) // RNA_def_property_range(prop, lowerLimitf, upperLimitf); RNA_def_property_ui_text(prop, "Die Time", ""); -// prop= RNA_def_property(srna, "banking_angle", PROP_FLOAT, PROP_NONE); -// RNA_def_property_float_sdna(prop, NULL, "bank"); -//// RNA_def_property_range(prop, lowerLimitf, upperLimitf); -// RNA_def_property_ui_text(prop, "Banking Angle", ""); - prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); // RNA_def_property_range(prop, lowerLimitf, upperLimitf); RNA_def_property_ui_text(prop, "Size", ""); @@ -1133,12 +1160,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 7); + RNA_def_property_ui_range(prop, 0, 10, 1, 0); RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ren_step"); RNA_def_property_range(prop, 0, 9); + RNA_def_property_ui_range(prop, 0, 20, 1, 0); RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)"); prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE); @@ -1206,7 +1235,8 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "bb_uv_split"); - RNA_def_property_range(prop, 1, 10); + RNA_def_property_range(prop, 1, 100); + RNA_def_property_ui_range(prop, 1, 10, 1, 0); RNA_def_property_ui_text(prop, "UV Split", "Amount of rows/columns to split uv coordinates for billboards"); prop= RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE); @@ -1234,7 +1264,8 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "bb_offset"); RNA_def_property_array(prop, 2); - RNA_def_property_range(prop, -1.0f, 1.0f); + RNA_def_property_range(prop, -100.0f, 100.0f); + RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3); RNA_def_property_ui_text(prop, "Billboard Offset", ""); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); @@ -1314,7 +1345,11 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "amount", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "totpart"); RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); - RNA_def_property_range(prop, 0, 100000); + /* This limit is for those freaks who have the machine power to handle it. */ + /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */ + /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */ + RNA_def_property_range(prop, 0, 10000000); + RNA_def_property_ui_range(prop, 0, 100000, 1, 0); RNA_def_property_ui_text(prop, "Amount", "Total number of particles."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); @@ -1328,7 +1363,8 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "grid_res"); RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); - RNA_def_property_range(prop, 1, 100); + RNA_def_property_range(prop, 1, 46); /* ~100k particles in a cube */ + RNA_def_property_ui_range(prop, 1, 215, 1, 0); /* ~10M particles in a cube */ RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); @@ -1341,7 +1377,8 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "obfac"); - RNA_def_property_range(prop, -1.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting speed"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); @@ -1353,7 +1390,8 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "partfac"); - RNA_def_property_range(prop, -10.0f, 10.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting speed."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); @@ -1401,13 +1439,15 @@ static void rna_def_particle_settings(BlenderRNA *brna) /* physical properties */ prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01f, 100.0f); + RNA_def_property_range(prop, 0.001f, 100000.0f); + RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Mass", "Specify the mass of the particles"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "size"); - RNA_def_property_range(prop, 0.01f, 100.0f); + RNA_def_property_range(prop, 0.001f, 100000.0f); + RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Size", "The size of the particles"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); @@ -1466,13 +1506,15 @@ static void rna_def_particle_settings(BlenderRNA *brna) /* children */ prop= RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "child_nbr");//optional if prop names are the same - RNA_def_property_range(prop, 0, MAX_PART_CHILDREN); + RNA_def_property_range(prop, 0, 100000); + RNA_def_property_ui_range(prop, 0, 1000, 1, 0); RNA_def_property_ui_text(prop, "Children Per Parent", "Amount of children/parent"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rendered_child_nbr", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr"); - RNA_def_property_range(prop, 0, MAX_PART_CHILDREN); + RNA_def_property_range(prop, 0, 100000); + RNA_def_property_ui_range(prop, 0, 10000, 1, 0); RNA_def_property_ui_text(prop, "Rendered Children", "Amount of children/parent for rendering."); prop= RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE); @@ -1483,7 +1525,8 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "childsize"); - RNA_def_property_range(prop, 0.01f, 100.0f); + RNA_def_property_range(prop, 0.001f, 100000.0f); + RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); @@ -1522,13 +1565,15 @@ static void rna_def_particle_settings(BlenderRNA *brna) /* kink */ prop= RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "kink_amp"); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, -100000.0f, 100000.0f); + RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "kink_freq"); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, -100000.0f, 100000.0f); + RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); @@ -1540,24 +1585,28 @@ static void rna_def_particle_settings(BlenderRNA *brna) /* rough */ prop= RNA_def_property(srna, "rough1", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough1_size", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.01f, 10.0f); + RNA_def_property_range(prop, 0.01f, 100000.0f); + RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough2", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rough2"); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "rough2_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rough2_size"); - RNA_def_property_range(prop, 0.01f, 10.0f); + RNA_def_property_range(prop, 0.01f, 100000.0f); + RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Size2", "Size of random rough."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); @@ -1569,7 +1618,8 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "rough_endpoint", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rough_end"); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child"); @@ -1600,13 +1650,15 @@ static void rna_def_particle_settings(BlenderRNA *brna) /* drawing stuff */ prop= RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Back", "Length of the line's tail"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); prop= RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL); - RNA_def_property_range(prop, 0.0f, 10.0f); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Head", "Length of the line's head"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); @@ -1624,14 +1676,16 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "trail_count"); - RNA_def_property_range(prop, 1.0f, 100.0f); + RNA_def_property_range(prop, 1, 100000); + RNA_def_property_ui_range(prop, 1, 100, 1, 0); RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); /* keyed particles */ prop= RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "keyed_loops"); - RNA_def_property_range(prop, 1.0f, 100.0f); + RNA_def_property_range(prop, 1.0f, 10000.0f); + RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); @@ -1674,61 +1728,71 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "eweight_all", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[0]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "All", "All effector's weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_spherical", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[1]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Spherical", "Spherical effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_vortex", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[2]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Vortex", "Vortex effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_magnetic", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[3]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Magnetic", "Magnetic effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_wind", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[4]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Wind", "Wind effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_curveguide", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[5]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Curve Guide", "Curve guide effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_texture", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[6]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Magnetic", "Texture effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_harmonic", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[7]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Harmonic", "Harmonic effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_charge", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[8]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Charge", "Charge effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "eweight_lennardjones", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "effector_weight[9]"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, -200.0f, 200.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Lennard-Jones", "Lennard-Jones effector weight."); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index ce803aae78a..48637829741 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -17,7 +17,7 @@ * 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), Roland Hess + * Contributor(s): Blender Foundation (2008), Roland Hess, Joshua Leung * * ***** END GPL LICENSE BLOCK ***** */ @@ -39,8 +39,12 @@ #ifdef RNA_RUNTIME +#include <string.h> + #include "BLI_arithb.h" +#include "DNA_userdef_types.h" + #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_idprop.h" @@ -54,6 +58,46 @@ static void rna_Pose_update(bContext *C, PointerRNA *ptr) DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA); } +static char *rna_PoseChannel_path(PointerRNA *ptr) +{ + return BLI_sprintfN("pose.pose_channels[\"%s\"]", ((bPoseChannel*)ptr->data)->name); +} + +static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value) +{ + bActionGroup *grp= ptr->data; + + /* if valid value, set the new enum value, then copy the relevant colours? */ + if ((value >= -1) && (value < 21)) + grp->customCol= value; + else + return; + + /* only do color copying if using a custom color (i.e. not default colour) */ + if (grp->customCol) { + if (grp->customCol > 0) { + /* copy theme colors on-to group's custom color in case user tries to edit color */ + bTheme *btheme= U.themes.first; + ThemeWireColor *col_set= &btheme->tarm[(grp->customCol - 1)]; + + memcpy(&grp->cs, col_set, sizeof(ThemeWireColor)); + } + else { + /* init custom colors with a generic multi-color rgb set, if not initialised already (for custom color set) */ + if (grp->cs.solid[0] == 0) { + /* define for setting colors in theme below */ + #define SETCOL(col, r, g, b, a) col[0]=r; col[1]=g; col[2]= b; col[3]= a; + + SETCOL(grp->cs.solid, 0xff, 0x00, 0x00, 255); + SETCOL(grp->cs.select, 0x81, 0xe6, 0x14, 255); + SETCOL(grp->cs.active, 0x18, 0xb6, 0xe0, 255); + + #undef SETCOL + } + } + } +} + IDProperty *rna_PoseChannel_idproperties(PointerRNA *ptr, int create) { bPoseChannel *pchan= ptr->data; @@ -189,23 +233,60 @@ void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *result, static void rna_def_bone_group(BlenderRNA *brna) { + static EnumPropertyItem prop_colorSets_items[] = { + {0, "DEFAULT", 0, "Default Colors", ""}, + {1, "THEME01", 0, "01 - Theme Color Set", ""}, + {2, "THEME02", 0, "02 - Theme Color Set", ""}, + {3, "THEME03", 0, "03 - Theme Color Set", ""}, + {4, "THEME04", 0, "04 - Theme Color Set", ""}, + {5, "THEME05", 0, "05 - Theme Color Set", ""}, + {6, "THEME06", 0, "06 - Theme Color Set", ""}, + {7, "THEME07", 0, "07 - Theme Color Set", ""}, + {8, "THEME08", 0, "08 - Theme Color Set", ""}, + {9, "THEME09", 0, "09 - Theme Color Set", ""}, + {10, "THEME10", 0, "10 - Theme Color Set", ""}, + {11, "THEME11", 0, "11 - Theme Color Set", ""}, + {12, "THEME12", 0, "12 - Theme Color Set", ""}, + {13, "THEME13", 0, "13 - Theme Color Set", ""}, + {14, "THEME14", 0, "14 - Theme Color Set", ""}, + {15, "THEME15", 0, "15 - Theme Color Set", ""}, + {16, "THEME16", 0, "16 - Theme Color Set", ""}, + {17, "THEME17", 0, "17 - Theme Color Set", ""}, + {18, "THEME18", 0, "18 - Theme Color Set", ""}, + {19, "THEME19", 0, "19 - Theme Color Set", ""}, + {20, "THEME20", 0, "20 - Theme Color Set", ""}, + {-1, "CUSTOM", 0, "Custom Color Set", ""}, + {0, NULL, 0, NULL, NULL}}; + StructRNA *srna; PropertyRNA *prop; - + + /* struct */ srna= RNA_def_struct(brna, "BoneGroup", NULL); RNA_def_struct_sdna(srna, "bActionGroup"); RNA_def_struct_ui_text(srna, "Bone Group", "Groups of Pose Channels (Bones)."); - + + /* name */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", ""); RNA_def_struct_name_property(srna, prop); // TODO: add some runtime-collections stuff to access grouped bones - // FIXME: this needs more work - probably a custom template? - prop= RNA_def_property(srna, "custom_color", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "customCol"); - RNA_def_property_ui_text(prop, "Custom Color", "Index of custom color set."); + /* color set + colors */ + prop= RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "customCol"); + RNA_def_property_enum_items(prop, prop_colorSets_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_BoneGroup_color_set_set", NULL); + RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use."); + RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); + + // TODO: editing the colors for this should result in changes to the color type... + prop= RNA_def_property(srna, "colors", PROP_POINTER, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "ThemeBoneColorSet"); + RNA_def_property_pointer_sdna(prop, NULL, "cs"); /* NOTE: the DNA data is not really a pointer, but this code works :) */ + RNA_def_property_ui_text(prop, "Colors", "Copy of the colors associated with the group's color set."); + RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); } static void rna_def_pose_channel(BlenderRNA *brna) @@ -221,6 +302,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) srna= RNA_def_struct(brna, "PoseChannel", NULL); RNA_def_struct_sdna(srna, "bPoseChannel"); RNA_def_struct_ui_text(srna, "Pose Channel", "Channel defining pose data for a bone in a Pose."); + RNA_def_struct_path_func(srna, "rna_PoseChannel_path"); RNA_def_struct_idproperties_func(srna, "rna_PoseChannel_idproperties"); prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); @@ -272,7 +354,6 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "selectflag", BONE_SELECTED); RNA_def_property_ui_text(prop, "Selected", ""); - /* XXX note: bone groups are stored internally as bActionGroups :) - Aligorith */ prop= RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "agrp_index"); RNA_def_property_ui_text(prop, "Bone Group Index", "Bone Group this pose channel belongs to (0=no group)."); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c new file mode 100644 index 00000000000..7268d560282 --- /dev/null +++ b/source/blender/makesrna/intern/rna_render.c @@ -0,0 +1,398 @@ +/** + * $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 (2009) + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdlib.h> + +#include "DNA_scene_types.h" + +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "WM_types.h" + +#include "RE_pipeline.h" + +#ifdef RNA_RUNTIME + +#include "MEM_guardedalloc.h" + +#include "RNA_access.h" + +#include "BKE_context.h" +#include "BKE_report.h" + +#include "WM_api.h" + +/* RenderEngine */ + +static RenderEngineType internal_render_type = { + NULL, NULL, "BLENDER_RENDER", "Blender Render", RE_INTERNAL, NULL, {NULL, NULL, NULL, NULL}}; +#if GAMEBLENDER == 1 +static RenderEngineType internal_game_type = { + NULL, NULL, "BLENDER_GAME", "Blender Game", RE_INTERNAL|RE_GAME, NULL, {NULL, NULL, NULL, NULL}}; +#endif + +ListBase R_engines = {NULL, NULL}; + +void RE_engines_init() +{ + BLI_addtail(&R_engines, &internal_render_type); +#if GAMEBLENDER == 1 + BLI_addtail(&R_engines, &internal_game_type); +#endif +} + +void RE_engines_exit() +{ + RenderEngineType *type, *next; + + for(type=R_engines.first; type; type=next) { + next= type->next; + + BLI_remlink(&R_engines, type); + + if(!(type->flag & RE_INTERNAL)) { + if(type->ext.free) + type->ext.free(type->ext.data); + + MEM_freeN(type); + } + } +} + +static void engine_render(RenderEngine *engine, struct Scene *scene) +{ + PointerRNA ptr; + ParameterList list; + FunctionRNA *func; + + RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); + func= RNA_struct_find_function(&ptr, "render"); + + RNA_parameter_list_create(&list, &ptr, func); + RNA_parameter_set_lookup(&list, "scene", &scene); + engine->type->ext.call(&ptr, func, &list); + + RNA_parameter_list_free(&list); +} + +static void rna_RenderEngine_unregister(const bContext *C, StructRNA *type) +{ + RenderEngineType *et= RNA_struct_blender_type_get(type); + + if(!et) + return; + + BLI_freelinkN(&R_engines, et); + RNA_struct_free(&BLENDER_RNA, type); +} + +static StructRNA *rna_RenderEngine_register(const bContext *C, ReportList *reports, void *data, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free) +{ + RenderEngineType *et, dummyet = {0}; + RenderEngine dummyengine= {0}; + PointerRNA dummyptr; + int have_function[1]; + + /* setup dummy engine & engine type to store static properties in */ + dummyengine.type= &dummyet; + RNA_pointer_create(NULL, &RNA_RenderEngine, &dummyengine, &dummyptr); + + /* validate the python class */ + if(validate(&dummyptr, data, have_function) != 0) + return NULL; + + /* check if we have registered this engine type before, and remove it */ + for(et=R_engines.first; et; et=et->next) { + if(strcmp(et->idname, dummyet.idname) == 0) { + if(et->ext.srna) + rna_RenderEngine_unregister(C, et->ext.srna); + break; + } + } + + /* create a new engine type */ + et= MEM_callocN(sizeof(RenderEngineType), "python buttons engine"); + memcpy(et, &dummyet, sizeof(dummyet)); + + et->ext.srna= RNA_def_struct(&BLENDER_RNA, et->idname, "RenderEngine"); + et->ext.data= data; + et->ext.call= call; + et->ext.free= free; + RNA_struct_blender_type_set(et->ext.srna, et); + + et->render= (have_function[0])? engine_render: NULL; + + BLI_addtail(&R_engines, et); + + return et->ext.srna; +} + +static StructRNA* rna_RenderEngine_refine(PointerRNA *ptr) +{ + RenderEngine *engine= (RenderEngine*)ptr->data; + return (engine->type && engine->type->ext.srna)? engine->type->ext.srna: &RNA_RenderEngine; +} + +static void rna_RenderResult_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + RenderResult *rr= (RenderResult*)ptr->data; + rna_iterator_listbase_begin(iter, &rr->layers, NULL); +} + +static void rna_RenderLayer_passes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + RenderLayer *rl= (RenderLayer*)ptr->data; + rna_iterator_listbase_begin(iter, &rl->passes, NULL); +} + +static float rna_RenderValue_value_get(PointerRNA *ptr) +{ + return *(float*)ptr->data; +} + +static void rna_RenderValue_value_set(PointerRNA *ptr, float value) +{ + *(float*)ptr->data= value; +} + +static void rna_RenderLayer_rect_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + RenderLayer *rl= (RenderLayer*)ptr->data; + rna_iterator_array_begin(iter, (void*)rl->rectf, sizeof(float), rl->rectx*rl->recty*4, 0, NULL); +} + +static int rna_RenderLayer_rect_length(PointerRNA *ptr) +{ + RenderLayer *rl= (RenderLayer*)ptr->data; + return rl->rectx*rl->recty*4; +} + +static void rna_RenderPass_rect_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + RenderPass *rpass= (RenderPass*)ptr->data; + rna_iterator_array_begin(iter, (void*)rpass->rect, sizeof(float), rpass->rectx*rpass->recty*rpass->channels, 0, NULL); +} + +static int rna_RenderPass_rect_length(PointerRNA *ptr) +{ + RenderPass *rpass= (RenderPass*)ptr->data; + return rpass->rectx*rpass->recty*rpass->channels; +} + + +#else // RNA_RUNTIME + +static void rna_def_render_engine(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + FunctionRNA *func; + + srna= RNA_def_struct(brna, "RenderEngine", NULL); + RNA_def_struct_sdna(srna, "RenderEngine"); + RNA_def_struct_ui_text(srna, "Render Engine", "Render engine."); + RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine"); + RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister"); + + /* render */ + func= RNA_def_function(srna, "render", NULL); + RNA_def_function_ui_description(func, "Render scene into an image."); + RNA_def_function_flag(func, FUNC_REGISTER); + RNA_def_pointer(func, "scene", "Scene", "", ""); + + func= RNA_def_function(srna, "begin_result", "RE_engine_begin_result"); + prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_pointer(func, "result", "RenderResult", "Result", ""); + RNA_def_function_return(func, prop); + + func= RNA_def_function(srna, "update_result", "RE_engine_update_result"); + prop= RNA_def_pointer(func, "result", "RenderResult", "Result", ""); + RNA_def_property_flag(prop, PROP_REQUIRED); + + func= RNA_def_function(srna, "end_result", "RE_engine_end_result"); + prop= RNA_def_pointer(func, "result", "RenderResult", "Result", ""); + RNA_def_property_flag(prop, PROP_REQUIRED); + + func= RNA_def_function(srna, "test_break", "RE_engine_test_break"); + prop= RNA_def_boolean(func, "do_break", 0, "Break", ""); + RNA_def_function_return(func, prop); + + func= RNA_def_function(srna, "update_stats", "RE_engine_update_stats"); + prop= RNA_def_string(func, "stats", "", 0, "Stats", ""); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_string(func, "info", "", 0, "Info", ""); + RNA_def_property_flag(prop, PROP_REQUIRED); + + /* registration */ + RNA_define_verify_sdna(0); + + prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "type->idname"); + RNA_def_property_flag(prop, PROP_REGISTER); + + prop= RNA_def_property(srna, "label", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "type->name"); + RNA_def_property_flag(prop, PROP_REGISTER); + + RNA_define_verify_sdna(1); +} + +static void rna_def_render_result(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "RenderResult", NULL); + RNA_def_struct_ui_text(srna, "Render Result", "Result of rendering, including all layers and passes."); + + RNA_define_verify_sdna(0); + + prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "rectx"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "recty"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "RenderLayer"); + RNA_def_property_collection_funcs(prop, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0); + + RNA_define_verify_sdna(1); +} + +static void rna_def_render_layer(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + FunctionRNA *func; + + srna= RNA_def_struct(brna, "RenderLayer", NULL); + RNA_def_struct_ui_text(srna, "Render Layer", ""); + + func= RNA_def_function(srna, "rect_from_file", "RE_layer_rect_from_file"); + RNA_def_function_ui_description(func, "Copies the pixels of this renderlayer from an image file."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller then the renderlayer"); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); + + RNA_define_verify_sdna(0); + + rna_def_render_layer_common(srna, 0); + + prop= RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "RenderPass"); + RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0); + + prop= RNA_def_property(srna, "rect", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "RenderValue"); + RNA_def_property_collection_funcs(prop, "rna_RenderLayer_rect_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_RenderLayer_rect_length", 0, 0, 0, 0); + + /* value */ + srna= RNA_def_struct(brna, "RenderValue", NULL); + RNA_def_struct_ui_text(srna, "Render Value", ""); + + prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_RenderValue_value_get", "rna_RenderValue_value_set", NULL); + + RNA_define_verify_sdna(1); +} + +static void rna_def_render_pass(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem pass_type_items[]= { + {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""}, + {SCE_PASS_Z, "Z", 0, "Z", ""}, + {SCE_PASS_RGBA, "COLOR", 0, "Color", ""}, + {SCE_PASS_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""}, + {SCE_PASS_SPEC, "SPECULAR", 0, "Specular", ""}, + {SCE_PASS_SHADOW, "SHADOW", 0, "Shadow", ""}, + {SCE_PASS_AO, "AO", 0, "AO", ""}, + {SCE_PASS_REFLECT, "REFLECTION", 0, "Reflection", ""}, + {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""}, + {SCE_PASS_VECTOR, "VECTOR", 0, "Vecotr", ""}, + {SCE_PASS_REFRACT, "REFRACTION", 0, "Refraction", ""}, + {SCE_PASS_INDEXOB, "OBJECT_INDEX", 0, "Object Index", ""}, + {SCE_PASS_UV, "UV", 0, "UV", ""}, + {SCE_PASS_MIST, "MIST", 0, "Mist", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "RenderPass", NULL); + RNA_def_struct_ui_text(srna, "Render Pass", ""); + + RNA_define_verify_sdna(0); + + prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "name"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_struct_name_property(srna, prop); + + prop= RNA_def_property(srna, "channel_id", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "chan_id"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop= RNA_def_property(srna, "channels", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "channels"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "passtype"); + RNA_def_property_enum_items(prop, pass_type_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop= RNA_def_property(srna, "rect", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "RenderValue"); + RNA_def_property_collection_funcs(prop, "rna_RenderPass_rect_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_RenderPass_rect_length", 0, 0, 0, 0); + + RNA_define_verify_sdna(1); +} + +void RNA_def_render(BlenderRNA *brna) +{ + rna_def_render_engine(brna); + rna_def_render_result(brna); + rna_def_render_layer(brna); + rna_def_render_pass(brna); +} + +#endif // RNA_RUNTIME + diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index aeaedd6f81d..385c7f5b2b1 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -432,6 +432,19 @@ static int rna_Property_registered_optional_get(PointerRNA *ptr) return prop->flag & PROP_REGISTER_OPTIONAL; } +static int rna_BoolProperty_default_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + rna_idproperty_check(&prop, ptr); + return ((BooleanPropertyRNA*)prop)->defaultvalue; +} + +static int rna_IntProperty_default_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + rna_idproperty_check(&prop, ptr); + return ((IntPropertyRNA*)prop)->defaultvalue; +} static int rna_IntProperty_hard_min_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -467,6 +480,12 @@ static int rna_IntProperty_step_get(PointerRNA *ptr) return ((IntPropertyRNA*)prop)->step; } +static float rna_FloatProperty_default_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + rna_idproperty_check(&prop, ptr); + return ((FloatPropertyRNA*)prop)->defaultvalue; +} static float rna_FloatProperty_hard_min_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -509,6 +528,19 @@ static int rna_FloatProperty_precision_get(PointerRNA *ptr) return ((FloatPropertyRNA*)prop)->precision; } +static void rna_StringProperty_default_get(PointerRNA *ptr, char *value) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + rna_idproperty_check(&prop, ptr); + strcpy(value, ((StringPropertyRNA*)prop)->defaultvalue); +} +static int rna_StringProperty_default_length(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + rna_idproperty_check(&prop, ptr); + return strlen(((StringPropertyRNA*)prop)->defaultvalue); +} + static int rna_StringProperty_max_length_get(PointerRNA *ptr) { PropertyRNA *prop= (PropertyRNA*)ptr->data; @@ -516,6 +548,28 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr) return ((StringPropertyRNA*)prop)->maxlength; } +static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + EnumPropertyRNA *eprop; + + rna_idproperty_check(&prop, ptr); + eprop= (EnumPropertyRNA*)prop; + + if(eprop->itemf==NULL || eprop->itemf==rna_EnumProperty_default_itemf) + return eprop->item; + + return eprop->itemf(C, ptr, free); +} + +/* XXX - not sore this is needed? */ +static int rna_EnumProperty_default_get(PointerRNA *ptr) +{ + PropertyRNA *prop= (PropertyRNA*)ptr->data; + rna_idproperty_check(&prop, ptr); + return ((EnumPropertyRNA*)prop)->defaultvalue; +} + static int rna_enum_check_separator(CollectionPropertyIterator *iter, void *data) { EnumPropertyItem *item= (EnumPropertyItem*)data; @@ -816,6 +870,31 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type) { PropertyRNA *prop; + prop= RNA_def_property(srna, "default", type, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Default", "Default value for this number"); + + switch(type) { + case PROP_BOOLEAN: + RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_get", NULL); + break; + case PROP_INT: + RNA_def_property_int_funcs(prop, "rna_IntProperty_default_get", NULL, NULL); + break; + case PROP_FLOAT: + RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_get", NULL, NULL); + break; + } + + +#if 0 // XXX - Variable length arrays + prop= RNA_def_property(srna, "default_array", type, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_default_array_get", NULL, NULL); + else RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_array_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Default", "Default value for this number"); +#endif + prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL); @@ -866,6 +945,11 @@ static void rna_def_string_property(StructRNA *srna) { PropertyRNA *prop; + prop= RNA_def_property(srna, "default", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_string_funcs(prop, "rna_StringProperty_default_get", "rna_StringProperty_default_length", NULL); + RNA_def_property_ui_text(prop, "Default", "string default value."); + prop= RNA_def_property(srna, "max_length", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_int_funcs(prop, "rna_StringProperty_max_length_get", NULL, NULL); @@ -876,6 +960,17 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna) { PropertyRNA *prop; + /* the itemf func is used instead, keep blender happy */ + static EnumPropertyItem default_dummy_items[] = { + {PROP_NONE, "DUMMY", 0, "Dummy", ""}, + {0, NULL, 0, NULL, NULL}}; + + prop= RNA_def_property(srna, "default", PROP_ENUM, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_enum_items(prop, default_dummy_items); + RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf"); + RNA_def_property_ui_text(prop, "Default", "Default value for this enum"); + prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "EnumPropertyItem"); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 41caf67b989..6e12ceb37db 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -60,6 +60,8 @@ EnumPropertyItem prop_mode_items[] ={ #include "BLI_threads.h" +#include "RE_pipeline.h" + PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal= iter->internal; @@ -109,10 +111,67 @@ static void rna_Scene_end_frame_set(PointerRNA *ptr, int value) data->r.efra= value; } +static int rna_Scene_use_preview_range_get(PointerRNA *ptr) +{ + Scene *data= (Scene*)ptr->data; + + /* this is simply overloaded to assume that preview-range + * start frame cannot be less than 1 when on, + * so psfra=0 means 'off' + */ + return (data->r.psfra != 0); +} + +static void rna_Scene_use_preview_range_set(PointerRNA *ptr, int value) +{ + Scene *data= (Scene*)ptr->data; + + /* if enable, copy range from render-range, otherwise just clear */ + if (value) { + data->r.psfra= data->r.sfra; + data->r.pefra= data->r.efra; + } + else + data->r.psfra= 0; +} + + +static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value) +{ + Scene *data= (Scene*)ptr->data; + + /* check if enabled already */ + if (data->r.psfra == 0) { + /* set end of preview range to end frame, then clamp as per normal */ + // TODO: or just refuse to set instead? + data->r.pefra= data->r.efra; + } + + /* now set normally */ + CLAMP(value, 1, data->r.pefra); + data->r.psfra= value; +} + +static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value) +{ + Scene *data= (Scene*)ptr->data; + + /* check if enabled already */ + if (data->r.psfra == 0) { + /* set start of preview range to start frame, then clamp as per normal */ + // TODO: or just refuse to set instead? + data->r.psfra= data->r.sfra; + } + + /* now set normally */ + CLAMP(value, data->r.psfra, MAXFRAME); + data->r.pefra= value; +} + static void rna_Scene_frame_update(bContext *C, PointerRNA *ptr) { //Scene *scene= ptr->id.data; - //update_for_newframe(); + //ED_update_for_newframe(C); } static int rna_SceneRenderData_threads_get(PointerRNA *ptr) @@ -163,6 +222,48 @@ static void rna_SceneRenderData_active_layer_index_range(PointerRNA *ptr, int *m *max= MAX2(0, *max); } +static void rna_SceneRenderData_engine_set(PointerRNA *ptr, int value) +{ + RenderData *rd= (RenderData*)ptr->data; + RenderEngineType *type= BLI_findlink(&R_engines, value); + + if(type) + BLI_strncpy(rd->engine, type->idname, sizeof(rd->engine)); +} + +static EnumPropertyItem *rna_SceneRenderData_engine_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + RenderEngineType *type; + EnumPropertyItem *item= NULL; + EnumPropertyItem tmp = {0, "", 0, "", ""}; + int a=0, totitem= 0; + + for(type=R_engines.first; type; type=type->next, a++) { + tmp.value= a; + tmp.identifier= type->idname; + tmp.name= type->name; + RNA_enum_item_add(&item, &totitem, &tmp); + } + + RNA_enum_item_end(&item, &totitem); + *free= 1; + + return item; +} + +static int rna_SceneRenderData_engine_get(PointerRNA *ptr) +{ + RenderData *rd= (RenderData*)ptr->data; + RenderEngineType *type; + int a= 0; + + for(type=R_engines.first; type; type=type->next, a++) + if(strcmp(type->idname, rd->engine) == 0) + return a; + + return 0; +} + static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) { Scene *scene= (Scene*)ptr->id.data; @@ -183,6 +284,23 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) } } +static int rna_SceneRenderData_multiple_engines_get(PointerRNA *ptr) +{ + return (BLI_countlist(&R_engines) > 1); +} + +static int rna_SceneRenderData_use_game_engine_get(PointerRNA *ptr) +{ + RenderData *rd= (RenderData*)ptr->data; + RenderEngineType *type; + + for(type=R_engines.first; type; type=type->next) + if(strcmp(type->idname, rd->engine) == 0) + return (type->flag & RE_GAME); + + return 0; +} + static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values) { SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data; @@ -205,53 +323,7 @@ static void rna_SceneRenderLayer_pass_update(bContext *C, PointerRNA *ptr) #else -void rna_def_sculpt(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna= RNA_def_struct(brna, "Sculpt", NULL); - RNA_def_struct_nested(brna, srna, "Scene"); - RNA_def_struct_ui_text(srna, "Sculpt", ""); - - prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Brush"); - RNA_def_property_ui_text(prop, "Brush", ""); - - prop= RNA_def_property(srna, "symmetry_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X); - RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis."); - - prop= RNA_def_property(srna, "symmetry_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y); - RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis."); - - prop= RNA_def_property(srna, "symmetry_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z); - RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis."); - - prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X); - RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices."); - - prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y); - RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices."); - - prop= RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z); - RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices."); - - prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DRAW_BRUSH); - RNA_def_property_ui_text(prop, "Show Brush", ""); - - prop= RNA_def_property(srna, "partial_redraw", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DRAW_FAST); - RNA_def_property_ui_text(prop, "Partial Redraw", "Optimize sculpting by only refreshing modified faces."); -} - -void rna_def_tool_settings(BlenderRNA *brna) +static void rna_def_tool_settings(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; @@ -290,14 +362,22 @@ void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_struct_type(prop, "Sculpt"); RNA_def_property_ui_text(prop, "Sculpt", ""); - prop= RNA_def_property(srna, "vpaint", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "VPaint"); + prop= RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "vpaint"); RNA_def_property_ui_text(prop, "Vertex Paint", ""); - prop= RNA_def_property(srna, "wpaint", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "VPaint"); + prop= RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "wpaint"); RNA_def_property_ui_text(prop, "Weight Paint", ""); + prop= RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "imapaint"); + RNA_def_property_ui_text(prop, "Image Paint", ""); + + prop= RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "particle"); + RNA_def_property_ui_text(prop, "Particle Edit", ""); + /* Transform */ prop= RNA_def_property(srna, "proportional_editing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "proportional", 0); @@ -361,197 +441,230 @@ void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "vgroup_weight"); RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups."); - - /* Sculpt */ - rna_def_sculpt(brna); } -void rna_def_scene_render_layer(BlenderRNA *brna) +void rna_def_render_layer_common(StructRNA *srna, int scene) { - StructRNA *srna; PropertyRNA *prop; - srna= RNA_def_struct(brna, "SceneRenderLayer", NULL); - RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer."); - prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + if(scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set"); + else RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "Name", "Render layer name."); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set"); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); RNA_def_struct_name_property(srna, prop); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "mat_override"); RNA_def_property_struct_type(prop, "Material"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Material Override", "Material to override all other materials in this render layer."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "light_override"); RNA_def_property_struct_type(prop, "Group"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Light Override", "Group to override all other lights in this render layer."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* layers */ prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "lay", 1); RNA_def_property_array(prop, 20); RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer."); - RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set"); + if(scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set"); + else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_layer_set"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "zmask_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1); RNA_def_property_array(prop, 20); RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers."); - RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_zmask_layer_set"); + if(scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_zmask_layer_set"); + else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_zmask_layer_set"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* layer options */ prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE); RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "zmask", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK); RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "zmask_negate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK); RNA_def_property_ui_text(prop, "Zmask Negate", "For Zmask, only render what is behind solid z values instead of in front."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "all_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z); RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "solid", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID); RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "halo", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO); RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "ztransp", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA); RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (On top of Solid and Halos)."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "sky", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY); RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "edge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE); RNA_def_property_ui_text(prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "strand", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND); RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* passes */ prop= RNA_def_property(srna, "pass_combined", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED); RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z); RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_vector", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR); RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_normal", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL); RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_uv", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV); RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_mist", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST); RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_object_index", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB); RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_color", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA); RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_diffuse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE); RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_specular", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC); RNA_def_property_ui_text(prop, "Specular", "Deliver specular pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_shadow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW); RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_ao", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO); RNA_def_property_ui_text(prop, "AO", "Deliver AO pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_reflection", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT); RNA_def_property_ui_text(prop, "Reflection", "Deliver ratraced reflection pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_refraction", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT); RNA_def_property_ui_text(prop, "Refraction", "Deliver ratraced refraction pass."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_specular_exclude", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC); RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_shadow_exclude", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW); RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_ao_exclude", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO); RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_reflection_exclude", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT); RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude ratraced reflection pass from combined."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop= RNA_def_property(srna, "pass_refraction_exclude", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT); RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude ratraced refraction pass from combined."); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); + else RNA_def_property_clear_flag(prop, PROP_EDITABLE); } void rna_def_scene_game_data(BlenderRNA *brna) @@ -764,7 +877,18 @@ void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "box radius", "Radius of the activity bubble, in Manhattan length. Objects outside the box are activity-culled"); RNA_def_property_update(prop, NC_SCENE, NULL); } -void rna_def_scene_render_data(BlenderRNA *brna) + +static void rna_def_scene_render_layer(BlenderRNA *brna) +{ + StructRNA *srna; + + srna= RNA_def_struct(brna, "SceneRenderLayer", NULL); + RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer."); + + rna_def_render_layer_common(srna, 1); +} + +static void rna_def_scene_render_data(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; @@ -950,6 +1074,10 @@ void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; #endif + static EnumPropertyItem engine_items[] = { + {0, "BLENDER_RENDER", 0, "Blender Render", ""}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "SceneRenderData", NULL); RNA_def_struct_sdna(srna, "RenderData"); RNA_def_struct_nested(brna, srna, "Scene"); @@ -1378,6 +1506,8 @@ void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "pic"); RNA_def_property_ui_text(prop, "Output Path", "Directory/name to save animations, # characters defines the position and length of frame numbers."); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + /* stamp */ prop= RNA_def_property(srna, "stamp_time", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME); @@ -1453,6 +1583,8 @@ void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_range(prop,0.0,1.0); RNA_def_property_ui_text(prop, "Stamp Background", "Color to use behind stamp text"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + /* layers */ prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "layers", NULL); @@ -1469,18 +1601,37 @@ void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_int_funcs(prop, "rna_SceneRenderData_active_layer_index_get", "rna_SceneRenderData_active_layer_index_set", "rna_SceneRenderData_active_layer_index_range"); RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array."); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + /* engine */ + prop= RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, engine_items); + RNA_def_property_enum_funcs(prop, "rna_SceneRenderData_engine_get", "rna_SceneRenderData_engine_set", "rna_SceneRenderData_engine_itemf"); + RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering."); + RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "multiple_engines", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_SceneRenderData_multiple_engines_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available."); + + prop= RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_SceneRenderData_use_game_engine_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine."); } void RNA_def_scene(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + + /* Struct definition */ srna= RNA_def_struct(brna, "Scene", "ID"); RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings."); RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA); RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); - + + /* Global Settings */ prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene."); @@ -1488,24 +1639,30 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "World", "World used for rendering the scene."); + RNA_def_property_update(prop, NC_WORLD, NULL); prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "cursor"); RNA_def_property_ui_text(prop, "Cursor Location", "3D cursor location."); RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4); - + RNA_def_property_update(prop, NC_WINDOW, NULL); + + /* Bases/Objects */ prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "base", NULL); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_ui_text(prop, "Objects", ""); RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0, 0, 0); + /* Layers */ prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "lay", 1); RNA_def_property_array(prop, 20); RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible when rendering the scene."); RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set"); - + + + /* Frame Range Stuff */ prop= RNA_def_property(srna, "current_frame", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); RNA_def_property_int_sdna(prop, NULL, "r.cfra"); @@ -1532,20 +1689,46 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "frame_step"); RNA_def_property_ui_text(prop, "Frame Step", "Number of frames to skip forward while rendering/playing back each frame"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - + + /* Preview Range (frame-range for UI playback) */ + prop=RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE); /* use_preview_range is not really a separate setting in SDNA */ + RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); + RNA_def_property_boolean_funcs(prop, "rna_Scene_use_preview_range_get", "rna_Scene_use_preview_range_set"); + RNA_def_property_ui_text(prop, "Use Preview Range", ""); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "preview_range_start_frame", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); + RNA_def_property_int_sdna(prop, NULL, "r.psfra"); + RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_start_frame_set", NULL); + RNA_def_property_ui_text(prop, "Preview Range Start Frame", ""); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "preview_range_end_frame", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); + RNA_def_property_int_sdna(prop, NULL, "r.pefra"); + RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_end_frame_set", NULL); + RNA_def_property_ui_text(prop, "Preview Range End Frame", ""); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + /* Stamp */ prop= RNA_def_property(srna, "stamp_note", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata"); RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping."); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - + + /* Nodes (Compositing) */ prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree."); + /* Sequencer */ prop= RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ed"); RNA_def_property_struct_type(prop, "SequenceEditor"); RNA_def_property_ui_text(prop, "Sequence Editor", ""); + /* Keying Sets */ + // TODO: hide the fact that active keyingset is an int? prop= RNA_def_property(srna, "keyingsets", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "keyingsets", NULL); RNA_def_property_struct_type(prop, "KeyingSet"); @@ -1554,17 +1737,20 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "active_keyingset", PROP_INT, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Active Keying Set", "Current Keying Set index."); - + + /* Tool Settings */ prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "toolsettings"); RNA_def_property_struct_type(prop, "ToolSettings"); RNA_def_property_ui_text(prop, "Tool Settings", ""); - + + /* Render Data */ prop= RNA_def_property(srna, "render_data", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "r"); RNA_def_property_struct_type(prop, "SceneRenderData"); RNA_def_property_ui_text(prop, "Render Data", ""); - + + /* Markers */ prop= RNA_def_property(srna, "timeline_markers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "markers", NULL); RNA_def_property_struct_type(prop, "TimelineMarker"); diff --git a/source/blender/makesrna/intern/rna_scriptlink.c b/source/blender/makesrna/intern/rna_scriptlink.c deleted file mode 100644 index b486cd4a874..00000000000 --- a/source/blender/makesrna/intern/rna_scriptlink.c +++ /dev/null @@ -1,48 +0,0 @@ -/** - * $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_scriptlink_types.h" - -#ifdef RNA_RUNTIME - -#else - -void RNA_def_scriptlink(BlenderRNA *brna) -{ - StructRNA *srna; - - srna= RNA_def_struct(brna, "ScriptLink", NULL); - RNA_def_struct_ui_text(srna, "Script Link", "Scripts linked to a datablock, to be executed on changes to the datablock."); - RNA_def_struct_ui_icon(srna, ICON_PYTHON); -} - -#endif - diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c new file mode 100644 index 00000000000..1e512d8f9bb --- /dev/null +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -0,0 +1,363 @@ +/** + * $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): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdlib.h> + +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "DNA_scene_types.h" + +#ifdef RNA_RUNTIME + +static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr) +{ + ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data; + ParticleBrushData *brush= NULL;; + + if(pset->brushtype != PE_BRUSH_NONE) + brush= &pset->brush[pset->brushtype]; + + return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush); +} + +static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr) +{ + return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL); +} + +#else + +static void rna_def_sculpt(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "Sculpt", NULL); + RNA_def_struct_ui_text(srna, "Sculpt", ""); + + prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Brush"); + RNA_def_property_ui_text(prop, "Brush", ""); + + prop= RNA_def_property(srna, "symmetry_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X); + RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis."); + + prop= RNA_def_property(srna, "symmetry_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y); + RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis."); + + prop= RNA_def_property(srna, "symmetry_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z); + RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis."); + + prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X); + RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices."); + + prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y); + RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices."); + + prop= RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z); + RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices."); + + prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DRAW_BRUSH); + RNA_def_property_ui_text(prop, "Show Brush", ""); + + prop= RNA_def_property(srna, "partial_redraw", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DRAW_FAST); + RNA_def_property_ui_text(prop, "Partial Redraw", "Optimize sculpting by only refreshing modified faces."); +} + +static void rna_def_vertex_paint(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + static EnumPropertyItem prop_mode_items[] = { + {0, "MIX", 0, "Mix", "Use mix blending mode while painting."}, + {1, "ADD", 0, "Add", "Use add blending mode while painting."}, + {2, "SUB", 0, "Subtract", "Use subtract blending mode while painting."}, + {3, "MUL", 0, "Multiply", "Use multiply blending mode while painting."}, + {4, "BLUR", 0, "Blur", "Blur the color with surrounding values"}, + {5, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting."}, + {6, "DARKEN", 0, "Darken", "Use darken blending mode while painting."}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "VertexPaint", NULL); + RNA_def_struct_sdna(srna, "VPaint"); + RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode."); + + prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Brush"); + RNA_def_property_ui_text(prop, "Brush", ""); + + prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_mode_items); + RNA_def_property_ui_text(prop, "Brush Mode", "Mode in which color is painted."); + + prop= RNA_def_property(srna, "all_faces", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA); + RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush."); + + prop= RNA_def_property(srna, "vertex_dist", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SOFT); + RNA_def_property_ui_text(prop, "Vertex Dist", "Use distances to vertices (instead of paint entire faces)."); + + prop= RNA_def_property(srna, "normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS); + RNA_def_property_ui_text(prop, "Normals", "Applies the vertex normal before painting."); + + prop= RNA_def_property(srna, "spray", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY); + RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse."); + + prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.1f, 5.0f); + RNA_def_property_ui_text(prop, "Gamma", "Vertex paint Gamma."); + + prop= RNA_def_property(srna, "mul", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.1f, 50.0f); + RNA_def_property_ui_text(prop, "Mul", "Vertex paint Mul."); +} + +static void rna_def_image_paint(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem tool_items[] = { + {PAINT_TOOL_DRAW, "DRAW", 0, "Draw", ""}, + {PAINT_TOOL_SOFTEN, "SOFTEN", 0, "Soften", ""}, + {PAINT_TOOL_SMEAR, "SMEAR", 0, "Smear", ""}, + {PAINT_TOOL_CLONE, "CLONE", 0, "Clone", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "ImagePaint", NULL); + RNA_def_struct_sdna(srna, "ImagePaintSettings"); + RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode."); + + prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "Brush"); + RNA_def_property_ui_text(prop, "Brush", ""); + + prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, tool_items); + RNA_def_property_ui_text(prop, "Tool", ""); + + /* booleans */ + + prop= RNA_def_property(srna, "show_brush_draw", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_DRAW_TOOL); + RNA_def_property_ui_text(prop, "Show Brush Draw", "Enables brush shape while drawing."); + + prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_DRAW_TOOL_DRAWING); + RNA_def_property_ui_text(prop, "Show Brush", "Enables brush shape while not drawing."); + + prop= RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE); + RNA_def_property_ui_text(prop, "Project Paint", "Use projection painting for improved consistency in the brush strokes."); + + prop= RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY); + RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)"); + + prop= RNA_def_property(srna, "use_backface_cull", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE); + RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)"); + + prop= RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT); + RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view"); + + prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_MASK); + RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV layer buttons"); + + prop= RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_MASK_INV); + RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer"); + + prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); + RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); + + /* integers */ + + prop= RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_UNSIGNED); + RNA_def_property_ui_range(prop, 0, 8, 0, 0); + RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)."); + + prop= RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED); + RNA_def_property_range(prop, 0, 90); + RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view acording to this angle."); +} + +static void rna_def_particle_edit(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem tool_items[] = { + {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush."}, + {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs."}, + {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs."}, + {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Assign weight to hairs."}, + {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs."}, + {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter."}, + {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up."}, + {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs."}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem select_mode_items[] = { + {SCE_SELECT_PATH, "PATH", ICON_EDGESEL, "Path", ""}, // XXX icon + {SCE_SELECT_POINT, "POINT", ICON_VERTEXSEL, "Point", ""}, // XXX icon + {SCE_SELECT_END, "END", ICON_FACESEL, "End", "E"}, // XXX icon + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem puff_mode[] = { + {0, "ADD", 0, "Add", "Make hairs more puffy."}, + {1, "SUB", 0, "Sub", "Make hairs less puffy."}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem length_mode[] = { + {0, "GROW", 0, "Grow", "Make hairs longer."}, + {1, "SHRINK", 0, "Shrink", "Make hairs shorter."}, + {0, NULL, 0, NULL, NULL}}; + + /* edit */ + + srna= RNA_def_struct(brna, "ParticleEdit", NULL); + RNA_def_struct_sdna(srna, "ParticleEditSettings"); + RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode."); + + prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "brushtype"); + RNA_def_property_enum_items(prop, tool_items); + RNA_def_property_ui_text(prop, "Tool", ""); + + prop= RNA_def_property(srna, "selection_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode"); + RNA_def_property_enum_items(prop, select_mode_items); + RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode."); + + prop= RNA_def_property(srna, "keep_lengths", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS); + RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant."); + + prop= RNA_def_property(srna, "keep_root", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST); + RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified."); + + prop= RNA_def_property(srna, "emitter_deflect", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER); + RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter."); + + prop= RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED); + RNA_def_property_float_sdna(prop, NULL, "emitterdist"); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3); + RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter."); + + prop= RNA_def_property(srna, "show_time", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_SHOW_TIME); + RNA_def_property_ui_text(prop, "Show Time", "Show time values of the baked keys."); + + prop= RNA_def_property(srna, "show_children", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_SHOW_CHILD); + RNA_def_property_ui_text(prop, "Show Children", "Show child particles."); + + prop= RNA_def_property(srna, "mirror_x", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_X_MIRROR); + RNA_def_property_ui_text(prop, "X-Axis Mirror", "Mirror operations over the X axis while editing."); + + prop= RNA_def_property(srna, "add_interpolate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED); + RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones."); + + prop= RNA_def_property(srna, "add_keys", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "totaddkey"); + RNA_def_property_range(prop, 2, INT_MAX); + RNA_def_property_ui_range(prop, 2, 20, 10, 3); + RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with."); + + prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ParticleBrush"); + RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Brush", ""); + + /* brush */ + + srna= RNA_def_struct(brna, "ParticleBrush", NULL); + RNA_def_struct_sdna(srna, "ParticleBrushData"); + RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush."); + + prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_ui_range(prop, 1, 100, 10, 3); + RNA_def_property_ui_text(prop, "Size", "Brush size."); + + prop= RNA_def_property(srna, "strength", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_ui_range(prop, 1, 100, 10, 3); + RNA_def_property_ui_text(prop, "Strength", "Brush strength."); + + prop= RNA_def_property(srna, "steps", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "step"); + RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_ui_range(prop, 1, 50, 10, 3); + RNA_def_property_ui_text(prop, "Steps", "Brush steps."); + + prop= RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "invert"); + RNA_def_property_enum_items(prop, puff_mode); + RNA_def_property_ui_text(prop, "Puff Mode", ""); + + prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "invert"); + RNA_def_property_enum_items(prop, length_mode); + RNA_def_property_ui_text(prop, "Length Mode", ""); + + /* dummy */ + prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "CurveMapping"); + RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Curve", ""); +} + +void RNA_def_sculpt_paint(BlenderRNA *brna) +{ + rna_def_sculpt(brna); + rna_def_vertex_paint(brna); + rna_def_image_paint(brna); + rna_def_particle_edit(brna); +} + +#endif + diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c new file mode 100644 index 00000000000..cedbc992dde --- /dev/null +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -0,0 +1,260 @@ +/** + * $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): Daniel Genrich + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdlib.h> +#include <limits.h> + +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "BKE_modifier.h" +#include "BKE_smoke.h" + +#include "DNA_modifier_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" +#include "DNA_smoke_types.h" + +#include "WM_types.h" + + +#ifdef RNA_RUNTIME + +#include "BKE_context.h" +#include "BKE_depsgraph.h" +#include "BKE_particle.h" + +#include "ED_object.h" + +static void rna_Smoke_update(bContext *C, PointerRNA *ptr) +{ + DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA); +} + +static void rna_Smoke_dependency_update(bContext *C, PointerRNA *ptr) +{ + rna_Smoke_update(C, ptr); + DAG_scene_sort(CTX_data_scene(C)); +} + +static void rna_Smoke_reset(bContext *C, PointerRNA *ptr) +{ + SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data; + + smokeModifier_reset(settings->smd); + + rna_Smoke_update(C, ptr); +} + +static void rna_Smoke_reset_dependancy(bContext *C, PointerRNA *ptr) +{ + SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data; + + smokeModifier_reset(settings->smd); + + rna_Smoke_dependency_update(C, ptr); +} + +static void rna_Smoke_redraw(bContext *C, PointerRNA *ptr) +{ + SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data; + + settings->flags |= MOD_SMOKE_VIEW_REDRAWNICE; +} + +static char *rna_SmokeDomainSettings_path(PointerRNA *ptr) +{ + SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data; + ModifierData *md= (ModifierData *)settings->smd; + + return BLI_sprintfN("modifiers[%s].domain_settings", md->name); +} + +static char *rna_SmokeFlowSettings_path(PointerRNA *ptr) +{ + SmokeFlowSettings *settings = (SmokeFlowSettings*)ptr->data; + ModifierData *md= (ModifierData *)settings->smd; + + return BLI_sprintfN("modifiers[%s].flow_settings", md->name); +} + +static char *rna_SmokeCollSettings_path(PointerRNA *ptr) +{ + SmokeCollSettings *settings = (SmokeCollSettings*)ptr->data; + ModifierData *md= (ModifierData *)settings->smd; + + return BLI_sprintfN("modifiers[%s].coll_settings", md->name); +} + +#else + +static void rna_def_smoke_domain_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem prop_noise_type_items[] = { + {MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""}, + /* {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""}, */ + /* {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */ + {0, NULL, 0, NULL, NULL}}; + + srna = RNA_def_struct(brna, "SmokeDomainSettings", NULL); + RNA_def_struct_ui_text(srna, "Domain Settings", "Smoke domain settings."); + RNA_def_struct_sdna(srna, "SmokeDomainSettings"); + RNA_def_struct_path_func(srna, "rna_SmokeDomainSettings_path"); + + prop= RNA_def_property(srna, "maxres", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxres"); + RNA_def_property_range(prop, 24, 512); + RNA_def_property_ui_range(prop, 24, 512, 2, 0); + RNA_def_property_ui_text(prop, "Max Res", "Maximal resolution used in the fluid domain."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); + + prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "omega"); + RNA_def_property_range(prop, 0.02, 1.0); + RNA_def_property_ui_range(prop, 0.02, 1.0, 0.02, 2); + RNA_def_property_ui_text(prop, "Color", "Smoke color (0 = black, 1 = white)."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Smoke_redraw"); + + prop= RNA_def_property(srna, "amplify", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "amplify"); + RNA_def_property_range(prop, 1, 10); + RNA_def_property_ui_range(prop, 1, 10, 1, 0); + RNA_def_property_ui_text(prop, "Amplification", "Enhance the resolution of smoke by this factor using noise."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); + + prop= RNA_def_property(srna, "highres", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGHRES); + RNA_def_property_ui_text(prop, "High res", "Show high resolution (using amplification)."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + + prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "noise"); + RNA_def_property_enum_items(prop, prop_noise_type_items); + RNA_def_property_ui_text(prop, "Noise Method", "Noise method which is used for creating the high resolution"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); + + prop= RNA_def_property(srna, "visibility", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "visibility"); + RNA_def_property_range(prop, 1, 15); + RNA_def_property_ui_range(prop, 1, 15, 1, 0); + RNA_def_property_ui_text(prop, "Display", "How much of the resolution should be shown during preview (every 2nd, 3rd, etc)."); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Smoke_redraw"); + + prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "alpha"); + RNA_def_property_range(prop, -5.0, 5.0); + RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); + RNA_def_property_ui_text(prop, "Gravity", "Higher value results in sinking smoke"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL); + + prop= RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "beta"); + RNA_def_property_range(prop, -5.0, 5.0); + RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); + RNA_def_property_ui_text(prop, "Heat", "Higher value results in faster rising smoke."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL); + + prop= RNA_def_property(srna, "coll_group", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "coll_group"); + RNA_def_property_struct_type(prop, "Group"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Collision Group", "Limit collisions to this group."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy"); + + prop= RNA_def_property(srna, "fluid_group", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "fluid_group"); + RNA_def_property_struct_type(prop, "Group"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Fluid Group", "Limit fluid objects to this group."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy"); + + prop= RNA_def_property(srna, "eff_group", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "eff_group"); + RNA_def_property_struct_type(prop, "Group"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this group."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy"); +} + +static void rna_def_smoke_flow_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SmokeFlowSettings", NULL); + RNA_def_struct_ui_text(srna, "Flow Settings", "Smoke flow settings."); + RNA_def_struct_sdna(srna, "SmokeFlowSettings"); + RNA_def_struct_path_func(srna, "rna_SmokeFlowSettings_path"); + + prop= RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "density"); + RNA_def_property_range(prop, 0.001, 1); + RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4); + RNA_def_property_ui_text(prop, "Density", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL); + + prop= RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "temp"); + RNA_def_property_range(prop, -10, 10); + RNA_def_property_ui_range(prop, -10, 10, 1, 1); + RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambientt temperature."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL); + + prop= RNA_def_property(srna, "psys", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "psys"); + RNA_def_property_struct_type(prop, "ParticleSystem"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object."); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy"); + + prop= RNA_def_property(srna, "outflow", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW); + RNA_def_property_ui_text(prop, "Outflow", "Deletes smoke from simulation"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL); +} + +static void rna_def_smoke_coll_settings(BlenderRNA *brna) +{ + StructRNA *srna; + + srna = RNA_def_struct(brna, "SmokeCollSettings", NULL); + RNA_def_struct_ui_text(srna, "Collision Settings", "Smoke collision settings."); + RNA_def_struct_sdna(srna, "SmokeCollSettings"); + RNA_def_struct_path_func(srna, "rna_SmokeCollSettings_path"); +} + +void RNA_def_smoke(BlenderRNA *brna) +{ + rna_def_smoke_domain_settings(brna); + rna_def_smoke_flow_settings(brna); + rna_def_smoke_coll_settings(brna); +} + +#endif + diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 461c46e09bf..793970dea49 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -239,6 +239,14 @@ StructRNA *rna_SpaceButtonsWindow_pin_id_typef(PointerRNA *ptr) return &RNA_ID; } +void rna_SpaceButtonsWindow_align_set(PointerRNA *ptr, int value) +{ + SpaceButs *sbuts= (SpaceButs*)(ptr->data); + + sbuts->align= value; + sbuts->re_align= 1; +} + /* Space Console */ static void rna_ConsoleLine_line_get(PointerRNA *ptr, char *value) { @@ -279,6 +287,22 @@ static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *m *max= ci->len; } +static void rna_View3D_display_background_image_set(PointerRNA *ptr, int value) +{ + View3D *vd= (View3D*)ptr->data; + + if(value) vd->flag |= V3D_DISPBGPIC; + else vd->flag &= ~V3D_DISPBGPIC; + + if((vd->flag & V3D_DISPBGPIC) && vd->bgpic == NULL) { + vd->bgpic= MEM_callocN(sizeof(BGpic), "bgpic"); + vd->bgpic->size= 5.0; + vd->bgpic->blend= 0.5; + vd->bgpic->iuser.fie_ima= 2; + vd->bgpic->iuser.ok= 1; + } +} + #else static void rna_def_space(BlenderRNA *brna) @@ -305,8 +329,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna) static EnumPropertyItem sticky_mode_items[] = { {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled."}, - {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "SHARED_LOCATION", "Select UVs that are at the same location and share a mesh vertex."}, - {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "SHARED_VERTEX", "Select UVs that share mesh vertex, irrespective if they are in the same location."}, + {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location", "Select UVs that are at the same location and share a mesh vertex."}, + {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex", "Select UVs that share mesh vertex, irrespective if they are in the same location."}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem dt_uv_items[] = { @@ -415,6 +439,7 @@ static void rna_def_space_outliner(BlenderRNA *brna) {10, "SEQUENCE", 0, "Sequence", ""}, {11, "DATABLOCKS", 0, "Datablocks", ""}, {12, "USER_PREFERENCES", 0, "User Preferences", ""}, + {13, "KEYMAPS", 0, "Key Maps", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SpaceOutliner", "Space"); @@ -446,29 +471,35 @@ static void rna_def_background_image(BlenderRNA *brna) prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "ima"); RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space."); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, NULL); prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "iuser"); RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed."); + RNA_def_property_update(prop, NC_WINDOW, NULL); prop= RNA_def_property(srna, "x_offset", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "xof"); RNA_def_property_ui_text(prop, "X Offset", "Offsets image horizontally from the view center"); + RNA_def_property_update(prop, NC_WINDOW, NULL); prop= RNA_def_property(srna, "y_offset", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "yof"); RNA_def_property_ui_text(prop, "Y Offset", "Offsets image vertically from the view center"); + RNA_def_property_update(prop, NC_WINDOW, NULL); prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_ui_text(prop, "Size", "Scaling factor for the background image."); RNA_def_property_range(prop, 0.0, FLT_MAX); + RNA_def_property_update(prop, NC_WINDOW, NULL); prop= RNA_def_property(srna, "transparency", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "blend"); RNA_def_property_ui_text(prop, "Transparency", "Amount to blend the image against the background color."); RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_update(prop, NC_WINDOW, NULL); } @@ -604,6 +635,7 @@ static void rna_def_space_3dview(BlenderRNA *brna) RNA_def_property_update(prop, NC_WINDOW, NULL); prop= RNA_def_property(srna, "display_background_image", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, NULL, "rna_View3D_display_background_image_set"); RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DISPBGPIC); RNA_def_property_ui_text(prop, "Display Background Image", "Display a reference image behind objects in the 3D View"); RNA_def_property_update(prop, NC_WINDOW, NULL); @@ -638,7 +670,18 @@ static void rna_def_space_3dview(BlenderRNA *brna) RNA_def_property_enum_items(prop, transform_orientation_items); RNA_def_property_ui_text(prop, "Transform Orientation", "The alignment of manipulator handles."); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, NULL); + + prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_LOCKED); + RNA_def_property_ui_text(prop, "Lock", "Lock View Rotation"); + prop= RNA_def_property(srna, "box_preview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_BOXVIEW); + RNA_def_property_ui_text(prop, "Box", ""); + + prop= RNA_def_property(srna, "box_clip", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, "RegionView3D", "viewlock", RV3D_BOXCLIP); + RNA_def_property_ui_text(prop, "Clip", ""); } static void rna_def_space_buttons(BlenderRNA *brna) @@ -658,28 +701,33 @@ static void rna_def_space_buttons(BlenderRNA *brna) {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, {BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"}, {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, - {BCONTEXT_GAME, "GAME", ICON_GAME, "Game", "Game"}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem panel_alignment_items[] = { - {1, "HORIZONTAL", 0, "Horizontal", ""}, - {2, "VERTICAL", 0, "Vertical", ""}, + static EnumPropertyItem align_items[] = { + {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""}, + {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SpaceButtonsWindow", "Space"); RNA_def_struct_sdna(srna, "SpaceButs"); RNA_def_struct_ui_text(srna, "Buttons Space", "Buttons Window space data"); - prop= RNA_def_property(srna, "buttons_context", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "mainb"); RNA_def_property_enum_items(prop, buttons_context_items); - RNA_def_property_ui_text(prop, "Buttons Context", "The type of active data to display and edit in the buttons window"); + RNA_def_property_ui_text(prop, "Context", "Type of active data to display and edit."); RNA_def_property_update(prop, NC_WINDOW, NULL); - prop= RNA_def_property(srna, "panel_alignment", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "align"); - RNA_def_property_enum_items(prop, panel_alignment_items); - RNA_def_property_ui_text(prop, "Panel Alignment", "Arrangement of the panels within the buttons window"); + RNA_def_property_enum_items(prop, align_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceButtonsWindow_align_set", NULL); + RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels."); + RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "brush_texture", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_BRUSH_TEX); + RNA_def_property_ui_text(prop, "Brush Texture", "Show brush textures."); RNA_def_property_update(prop, NC_WINDOW, NULL); /* pinned data */ @@ -1017,6 +1065,10 @@ static void rna_def_space_graph(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_NOHANDLES); RNA_def_property_ui_text(prop, "Show Handles", "Show handles of Bezier control points."); + prop= RNA_def_property(srna, "only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY); + RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes", "Only keyframes of selected F-Curves are visible and editable."); + /* editing */ prop= RNA_def_property(srna, "automerge_keyframes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL); @@ -1044,6 +1096,10 @@ static void rna_def_space_nla(BlenderRNA *brna) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NODRAWCFRANUM); RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line."); + prop= RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOSTRIPCURVES); + RNA_def_property_ui_text(prop, "Show Control Curves", "Show influence curves on strips."); + /* editing */ // TODO... autosnap, dopesheet? } @@ -1181,7 +1237,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna) prop= RNA_def_property(srna, "do_filter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER); RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files."); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); prop= RNA_def_property(srna, "hide_dot", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_HIDE_DOT); @@ -1198,49 +1254,49 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "filter", IMAGEFILE); RNA_def_property_ui_text(prop, "Filter Images", "Show image files."); RNA_def_property_ui_icon(prop, ICON_FILE_IMAGE, 0); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); prop= RNA_def_property(srna, "filter_blender", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter", BLENDERFILE); RNA_def_property_ui_text(prop, "Filter Blender", "Show .blend files."); RNA_def_property_ui_icon(prop, ICON_FILE_BLEND, 0); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); prop= RNA_def_property(srna, "filter_movie", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter", MOVIEFILE); RNA_def_property_ui_text(prop, "Filter Movies", "Show movie files."); RNA_def_property_ui_icon(prop, ICON_FILE_MOVIE, 0); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); prop= RNA_def_property(srna, "filter_script", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter", PYSCRIPTFILE); RNA_def_property_ui_text(prop, "Filter Script", "Show script files."); RNA_def_property_ui_icon(prop, ICON_FILE_SCRIPT, 0); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); prop= RNA_def_property(srna, "filter_font", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter", FTFONTFILE); RNA_def_property_ui_text(prop, "Filter Fonts", "Show font files."); RNA_def_property_ui_icon(prop, ICON_FILE_FONT, 0); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); prop= RNA_def_property(srna, "filter_sound", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter", SOUNDFILE); RNA_def_property_ui_text(prop, "Filter Sound", "Show sound files."); RNA_def_property_ui_icon(prop, ICON_FILE_SOUND, 0); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); prop= RNA_def_property(srna, "filter_text", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter", TEXTFILE); RNA_def_property_ui_text(prop, "Filter Text", "Show text files."); RNA_def_property_ui_icon(prop, ICON_FILE_BLANK, 0); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); prop= RNA_def_property(srna, "filter_folder", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "filter", FOLDERFILE); RNA_def_property_ui_text(prop, "Filter Folder", "Show folders."); RNA_def_property_ui_icon(prop, ICON_FILE_FOLDER, 0); - RNA_def_property_update(prop, NC_FILE | ND_PARAMS, NULL); + RNA_def_property_update(prop, NC_FILE | ND_FILELIST, NULL); } diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 9ba98d766cc..694f980e5e9 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -39,8 +39,18 @@ #include "WM_types.h" +static EnumPropertyItem texture_filter_items[] = { + {TXF_BOX, "BOX", 0, "Box", ""}, + {TXF_EWA, "EWA", 0, "EWA", ""}, + {TXF_FELINE, "FELINE", 0, "FELINE", ""}, + {TXF_AREA, "AREA", 0, "Area", ""}, + {TXF_SAT, "SAT", 0, "SAT (4x mem)", ""}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME +#include "BKE_texture.h" + StructRNA *rna_Texture_refine(struct PointerRNA *ptr) { Tex *tex= (Tex*)ptr->data; @@ -97,6 +107,46 @@ static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str) strcpy(str, ""); } +static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, int value) +{ + Tex *tex= (Tex*)ptr->data; + + if(value) tex->flag |= TEX_COLORBAND; + else tex->flag &= ~TEX_COLORBAND; + + if((tex->flag & TEX_COLORBAND) && tex->coba == NULL) + tex->coba= add_colorband(0); +} + +static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value) +{ + Tex *tex= (Tex*)ptr->data; + + if(value) tex->imaflag |= TEX_MIPMAP; + else tex->imaflag &= ~TEX_MIPMAP; + + if((tex->imaflag & TEX_MIPMAP) && tex->texfilter == TXF_SAT) + tex->texfilter = TXF_EWA; +} + +static EnumPropertyItem *rna_ImageTexture_filter_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + Tex *tex= (Tex*)ptr->data; + EnumPropertyItem *item= NULL; + int totitem= 0; + + RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_BOX); + RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_EWA); + RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_FELINE); + RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_AREA); + if(tex->imaflag & TEX_MIPMAP) + RNA_enum_items_add_value(&item, &totitem, texture_filter_items, TXF_SAT); + + *free= 1; + + return item; +} + #else static void rna_def_color_ramp_element(BlenderRNA *brna) @@ -277,25 +327,19 @@ static void rna_def_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "def_var"); - RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); RNA_def_property_ui_text(prop, "Default Value", "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard."); RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "variable_factor", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "varfac"); - RNA_def_property_range(prop, 0, 1); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); RNA_def_property_ui_text(prop, "Variable Factor", "Amount texture affects other values."); RNA_def_property_update(prop, NC_TEXTURE, NULL); - prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_VECTOR); - RNA_def_property_float_sdna(prop, NULL, "colfac"); - RNA_def_property_range(prop, 0, 1); - RNA_def_property_ui_text(prop, "Color Factor", "Amount texture affects color values."); - RNA_def_property_update(prop, NC_TEXTURE, NULL); - prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_VECTOR); RNA_def_property_float_sdna(prop, NULL, "norfac"); - RNA_def_property_range(prop, 0, 25); + RNA_def_property_ui_range(prop, 0, 5, 10, 3); RNA_def_property_ui_text(prop, "Normal Factor", "Amount texture affects normal values."); RNA_def_property_update(prop, NC_TEXTURE, NULL); } @@ -744,6 +788,7 @@ static void rna_def_texture_image(BlenderRNA *brna) prop= RNA_def_property(srna, "mipmap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP); + RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set"); RNA_def_property_ui_text(prop, "MIP Map", "Uses auto-generated MIP maps for the image"); RNA_def_property_update(prop, NC_TEXTURE, NULL); @@ -881,6 +926,26 @@ static void rna_def_texture_image(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Image", ""); RNA_def_property_update(prop, NC_TEXTURE, NULL); + + /* filtering */ + prop= RNA_def_property(srna, "filter", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "texfilter"); + RNA_def_property_enum_items(prop, texture_filter_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageTexture_filter_itemf"); + RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "filter_probes", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "afmax"); + RNA_def_property_range(prop, 1, 256); + RNA_def_property_ui_text(prop, "Filter Probes", "Maximum number of samples. Higher gives less blur at distant/oblique angles, but is also slower."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "afmax"); + RNA_def_property_range(prop, 1, 256); + RNA_def_property_ui_text(prop, "Filter Eccentricity", "Maximum eccentricity. Higher gives less blur at distant/oblique angles, but is also slower."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); } static void rna_def_texture_plugin(BlenderRNA *brna) @@ -1113,19 +1178,19 @@ static void rna_def_texture(BlenderRNA *brna) static EnumPropertyItem prop_type_items[] = { {0, "NONE", 0, "None", ""}, - {TEX_CLOUDS, "CLOUDS", 0, "Clouds", ""}, - {TEX_WOOD, "WOOD", 0, "Wood", ""}, - {TEX_MARBLE, "MARBLE", 0, "Marble", ""}, - {TEX_MAGIC, "MAGIC", 0, "Magic", ""}, - {TEX_BLEND, "BLEND", 0, "Blend", ""}, - {TEX_STUCCI, "STUCCI", 0, "Stucci", ""}, - {TEX_NOISE, "NOISE", 0, "Noise", ""}, - {TEX_IMAGE, "IMAGE", 0, "Image/Movie", ""}, - {TEX_PLUGIN, "PLUGIN", 0, "Plugin", ""}, - {TEX_ENVMAP, "ENVIRONMENT_MAP", 0, "Environment Map", ""}, - {TEX_MUSGRAVE, "MUSGRAVE", 0, "Musgrave", ""}, - {TEX_VORONOI, "VORONOI", 0, "Voronoi", ""}, - {TEX_DISTNOISE, "DISTORTED_NOISE", 0, "Distorted Noise", ""}, + {TEX_PLUGIN, "PLUGIN", ICON_CONSTRAINT, "Plugin", ""}, + {TEX_IMAGE, "IMAGE", ICON_RENDER_RESULT, "Image or Movie", ""}, + {TEX_ENVMAP, "ENVIRONMENT_MAP", ICON_RENDER_RESULT, "Environment Map", ""}, + {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", ""}, + {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", ""}, + {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", ""}, + {TEX_MAGIC, "MAGIC", ICON_TEXTURE, "Magic", ""}, + {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", ""}, + {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", ""}, + {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise", ""}, + {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", ""}, + {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", ""}, + {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE, "Distorted Noise", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Texture", "ID"); @@ -1135,9 +1200,17 @@ static void rna_def_texture(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_Texture_refine"); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + //RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_ui_text(prop, "Type", ""); RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_COLORBAND); + RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_color_ramp_set"); + RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "coba"); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 8a51a5f4142..590f85fedd7 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -81,12 +81,12 @@ static int panel_poll(const bContext *C, PanelType *pt) void *ret; int visible; - RNA_pointer_create(NULL, pt->py_srna, NULL, &ptr); /* dummy */ + RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ func= RNA_struct_find_function(&ptr, "poll"); RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); - pt->py_call(&ptr, func, &list); + pt->ext.call(&ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); visible= *(int*)ret; @@ -102,12 +102,12 @@ static void panel_draw(const bContext *C, Panel *pnl) ParameterList list; FunctionRNA *func; - RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->py_srna, pnl, &ptr); + RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); func= RNA_struct_find_function(&ptr, "draw"); RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); - pnl->type->py_call(&ptr, func, &list); + pnl->type->ext.call(&ptr, func, &list); RNA_parameter_list_free(&list); } @@ -118,12 +118,12 @@ static void panel_draw_header(const bContext *C, Panel *pnl) ParameterList list; FunctionRNA *func; - RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->py_srna, pnl, &ptr); + RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); func= RNA_struct_find_function(&ptr, "draw_header"); RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); - pnl->type->py_call(&ptr, func, &list); + pnl->type->ext.call(&ptr, func, &list); RNA_parameter_list_free(&list); } @@ -168,8 +168,8 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi /* check if we have registered this panel type before, and remove it */ for(pt=art->paneltypes.first; pt; pt=pt->next) { if(strcmp(pt->idname, dummypt.idname) == 0) { - if(pt->py_srna) - rna_Panel_unregister(C, pt->py_srna); + if(pt->ext.srna) + rna_Panel_unregister(C, pt->ext.srna); else BLI_freelinkN(&art->paneltypes, pt); break; @@ -180,11 +180,11 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi pt= MEM_callocN(sizeof(PanelType), "python buttons panel"); memcpy(pt, &dummypt, sizeof(dummypt)); - pt->py_srna= RNA_def_struct(&BLENDER_RNA, pt->idname, "Panel"); - pt->py_data= data; - pt->py_call= call; - pt->py_free= free; - RNA_struct_blender_type_set(pt->py_srna, pt); + pt->ext.srna= RNA_def_struct(&BLENDER_RNA, pt->idname, "Panel"); + pt->ext.data= data; + pt->ext.call= call; + pt->ext.free= free; + RNA_struct_blender_type_set(pt->ext.srna, pt); pt->poll= (have_function[0])? panel_poll: NULL; pt->draw= (have_function[1])? panel_draw: NULL; @@ -196,13 +196,13 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi if(C) WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); - return pt->py_srna; + return pt->ext.srna; } static StructRNA* rna_Panel_refine(PointerRNA *ptr) { Panel *hdr= (Panel*)ptr->data; - return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Panel; + return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Panel; } /* Header */ @@ -213,12 +213,12 @@ static void header_draw(const bContext *C, Header *hdr) ParameterList list; FunctionRNA *func; - RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->py_srna, hdr, &htr); + RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr); func= RNA_struct_find_function(&htr, "draw"); RNA_parameter_list_create(&list, &htr, func); RNA_parameter_set_lookup(&list, "context", &C); - hdr->type->py_call(&htr, func, &list); + hdr->type->ext.call(&htr, func, &list); RNA_parameter_list_free(&list); } @@ -263,8 +263,8 @@ static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, vo /* check if we have registered this header type before, and remove it */ for(ht=art->headertypes.first; ht; ht=ht->next) { if(strcmp(ht->idname, dummyht.idname) == 0) { - if(ht->py_srna) - rna_Header_unregister(C, ht->py_srna); + if(ht->ext.srna) + rna_Header_unregister(C, ht->ext.srna); break; } } @@ -273,11 +273,11 @@ static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, vo ht= MEM_callocN(sizeof(HeaderType), "python buttons header"); memcpy(ht, &dummyht, sizeof(dummyht)); - ht->py_srna= RNA_def_struct(&BLENDER_RNA, ht->idname, "Header"); - ht->py_data= data; - ht->py_call= call; - ht->py_free= free; - RNA_struct_blender_type_set(ht->py_srna, ht); + ht->ext.srna= RNA_def_struct(&BLENDER_RNA, ht->idname, "Header"); + ht->ext.data= data; + ht->ext.call= call; + ht->ext.free= free; + RNA_struct_blender_type_set(ht->ext.srna, ht); ht->draw= (have_function[0])? header_draw: NULL; @@ -287,13 +287,13 @@ static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, vo if(C) WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); - return ht->py_srna; + return ht->ext.srna; } static StructRNA* rna_Header_refine(PointerRNA *htr) { Header *hdr= (Header*)htr->data; - return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Header; + return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Header; } /* Menu */ @@ -306,12 +306,12 @@ static int menu_poll(const bContext *C, MenuType *pt) void *ret; int visible; - RNA_pointer_create(NULL, pt->py_srna, NULL, &ptr); /* dummy */ + RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ func= RNA_struct_find_function(&ptr, "poll"); RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); - pt->py_call(&ptr, func, &list); + pt->ext.call(&ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); visible= *(int*)ret; @@ -327,12 +327,12 @@ static void menu_draw(const bContext *C, Menu *hdr) ParameterList list; FunctionRNA *func; - RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->py_srna, hdr, &mtr); + RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &mtr); func= RNA_struct_find_function(&mtr, "draw"); RNA_parameter_list_create(&list, &mtr, func); RNA_parameter_set_lookup(&list, "context", &C); - hdr->type->py_call(&mtr, func, &list); + hdr->type->ext.call(&mtr, func, &list); RNA_parameter_list_free(&list); } @@ -377,8 +377,8 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void /* check if we have registered this menu type before, and remove it */ for(mt=art->menutypes.first; mt; mt=mt->next) { if(strcmp(mt->idname, dummymt.idname) == 0) { - if(mt->py_srna) - rna_Menu_unregister(C, mt->py_srna); + if(mt->ext.srna) + rna_Menu_unregister(C, mt->ext.srna); break; } } @@ -387,11 +387,11 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void mt= MEM_callocN(sizeof(MenuType), "python buttons menu"); memcpy(mt, &dummymt, sizeof(dummymt)); - mt->py_srna= RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu"); - mt->py_data= data; - mt->py_call= call; - mt->py_free= free; - RNA_struct_blender_type_set(mt->py_srna, mt); + mt->ext.srna= RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu"); + mt->ext.data= data; + mt->ext.call= call; + mt->ext.free= free; + RNA_struct_blender_type_set(mt->ext.srna, mt); mt->poll= (have_function[0])? menu_poll: NULL; mt->draw= (have_function[1])? menu_draw: NULL; @@ -402,13 +402,13 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void if(C) WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); - return mt->py_srna; + return mt->ext.srna; } static StructRNA* rna_Menu_refine(PointerRNA *mtr) { Menu *hdr= (Menu*)mtr->data; - return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Menu; + return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Menu; } static int rna_UILayout_active_get(PointerRNA *ptr) @@ -620,6 +620,9 @@ static void rna_def_panel(BlenderRNA *brna) prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "UILayout"); + prop= RNA_def_property(srna, "text", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "drawname"); + /* registration */ prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->idname"); @@ -647,8 +650,8 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_DEFAULT_CLOSED); RNA_def_property_flag(prop, PROP_REGISTER); - prop= RNA_def_property(srna, "no_header", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_NO_HEADER); + prop= RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", PNL_NO_HEADER); RNA_def_property_flag(prop, PROP_REGISTER); } diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 05255036992..67ade9998ed 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -256,6 +256,9 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_layers", "uiTemplateLayers"); api_ui_item_rna_common(func); + + func= RNA_def_function(srna, "template_triColorSet", "uiTemplateTriColorSet"); + api_ui_item_rna_common(func); func= RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); @@ -283,6 +286,11 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); + + func= RNA_def_function(srna, "template_texture_image", "uiTemplateTextureImage"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm= RNA_def_pointer(func, "texture", "Texture", "", ""); + RNA_def_property_flag(parm, PROP_REQUIRED); } #endif diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index f9aa27fcdbd..f1fd11a0094 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -101,11 +101,6 @@ static PointerRNA rna_UserDef_edit_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesEdit, ptr->data); } -static PointerRNA rna_UserDef_autosave_get(PointerRNA *ptr) -{ - return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesAutosave, ptr->data); -} - static PointerRNA rna_UserDef_language_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesLanguage, ptr->data); @@ -493,7 +488,7 @@ static void rna_def_userdef_theme_spaces_main(StructRNA *srna, int spacetype) } /* list/channels */ - if(ELEM4(spacetype, SPACE_IPO, SPACE_ACTION, SPACE_NLA, SPACE_NODE)) { + if(ELEM5(spacetype, SPACE_IPO, SPACE_ACTION, SPACE_NLA, SPACE_NODE, SPACE_FILE)) { prop= RNA_def_property(srna, "list", PROP_FLOAT, PROP_COLOR); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "List Back", ""); @@ -1721,8 +1716,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna) StructRNA *srna; static EnumPropertyItem auto_key_modes[] = { - {AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace Keys", ""}, - {AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace Keys", ""}, + {AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace", ""}, + {AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem new_interpolation_types[] = { @@ -1927,6 +1922,11 @@ static void rna_def_userdef_language(BlenderRNA *brna) RNA_def_property_range(prop, 48, 128); RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display."); RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "scrollback"); + RNA_def_property_range(prop, 32, 32768); + RNA_def_property_ui_text(prop, "Scrollback", "Maximum number of lines to store for the console buffer."); /* Language Selection */ @@ -1956,55 +1956,20 @@ static void rna_def_userdef_language(BlenderRNA *brna) RNA_def_property_update(prop, NC_WINDOW, NULL); } -static void rna_def_userdef_autosave(BlenderRNA *brna) -{ - PropertyRNA *prop; - StructRNA *srna; - - /* Autosave */ - - srna= RNA_def_struct(brna, "UserPreferencesAutosave", NULL); - RNA_def_struct_sdna(srna, "UserDef"); - RNA_def_struct_nested(brna, srna, "UserPreferences"); - RNA_def_struct_ui_text(srna, "Auto Save", "Automatic backup file settings."); - - prop= RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "versions"); - RNA_def_property_range(prop, 0, 32); - RNA_def_property_ui_text(prop, "Save Versions", "The number of old versions to maintain in the current directory, when manually saving."); - - prop= RNA_def_property(srna, "auto_save_temporary_files", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSAVE); - RNA_def_property_ui_text(prop, "Auto Save Temporary Files", "Automatic saving of temporary files."); - - prop= RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "savetime"); - RNA_def_property_range(prop, 1, 60); - RNA_def_property_ui_text(prop, "Auto Save Time", "The time (in minutes) to wait between automatic temporary saves."); - - prop= RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, 30); - RNA_def_property_ui_text(prop, "Recent Files", "Maximum number of recently opened files to remember."); - - prop= RNA_def_property(srna, "save_preview_images", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SAVE_PREVIEWS); - RNA_def_property_ui_text(prop, "Save Preview Images", "Enables automatic saving of preview images in the .blend file."); -} - static void rna_def_userdef_system(BlenderRNA *brna) { PropertyRNA *prop; StructRNA *srna; static EnumPropertyItem gl_texture_clamp_items[] = { - {0, "GL_CLAMP_OFF", 0, "GL Texture Clamp Off", ""}, - {8192, "GL_CLAMP_8192", 0, "GL Texture Clamp 8192", ""}, - {4096, "GL_CLAMP_4096", 0, "GL Texture Clamp 4096", ""}, - {2048, "GL_CLAMP_2048", 0, "GL Texture Clamp 2048", ""}, - {1024, "GL_CLAMP_1024", 0, "GL Texture Clamp 1024", ""}, - {512, "GL_CLAMP_512", 0, "GL Texture Clamp 512", ""}, - {256, "GL_CLAMP_256", 0, "GL Texture Clamp 256", ""}, - {128, "GL_CLAMP_128", 0, "GL Texture Clamp 128", ""}, + {0, "GL_CLAMP_OFF", 0, "Off", ""}, + {8192, "GL_CLAMP_8192", 0, "8192", ""}, + {4096, "GL_CLAMP_4096", 0, "4096", ""}, + {2048, "GL_CLAMP_2048", 0, "2048", ""}, + {1024, "GL_CLAMP_1024", 0, "1024", ""}, + {512, "GL_CLAMP_512", 0, "512", ""}, + {256, "GL_CLAMP_256", 0, "256", ""}, + {128, "GL_CLAMP_128", 0, "128", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem audio_mixing_samples_items[] = { @@ -2174,8 +2139,33 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop= RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "tempdir"); RNA_def_property_ui_text(prop, "Temporary Directory", "The directory for storing temporary save files."); + + /* Autosave */ + + prop= RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "versions"); + RNA_def_property_range(prop, 0, 32); + RNA_def_property_ui_text(prop, "Save Versions", "The number of old versions to maintain in the current directory, when manually saving."); + + prop= RNA_def_property(srna, "auto_save_temporary_files", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSAVE); + RNA_def_property_ui_text(prop, "Auto Save Temporary Files", "Automatic saving of temporary files."); + + prop= RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "savetime"); + RNA_def_property_range(prop, 1, 60); + RNA_def_property_ui_text(prop, "Auto Save Time", "The time (in minutes) to wait between automatic temporary saves."); + + prop= RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, 30); + RNA_def_property_ui_text(prop, "Recent Files", "Maximum number of recently opened files to remember."); + + prop= RNA_def_property(srna, "save_preview_images", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SAVE_PREVIEWS); + RNA_def_property_ui_text(prop, "Save Preview Images", "Enables automatic saving of preview images in the .blend file."); } + void RNA_def_userdef(BlenderRNA *brna) { StructRNA *srna; @@ -2185,10 +2175,9 @@ void RNA_def_userdef(BlenderRNA *brna) {0, "VIEW_CONTROLS", 0, "View", ""}, {1, "EDIT_METHODS", 0, "Editing", ""}, {2, "LANGUAGE_COLORS", 0, "Language", ""}, - {3, "AUTO_SAVE", 0, "Auto Save", ""}, - {4, "SYSTEM_OPENGL", 0, "System & OpenGL", ""}, - {5, "FILE_PATHS", 0, "File Paths", ""}, - {6, "THEMES", 0, "Themes", ""}, + {3, "SYSTEM_OPENGL", 0, "System", ""}, + {4, "FILE_PATHS", 0, "File", ""}, + {5, "THEMES", 0, "Themes", ""}, {0, NULL, 0, NULL, NULL}}; rna_def_userdef_dothemes(brna); @@ -2224,11 +2213,6 @@ void RNA_def_userdef(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_UserDef_edit_get", NULL, NULL); RNA_def_property_ui_text(prop, "Edit Methods", "Settings for interacting with Blender data."); - prop= RNA_def_property(srna, "autosave", PROP_POINTER, PROP_NEVER_NULL); - RNA_def_property_struct_type(prop, "UserPreferencesAutosave"); - RNA_def_property_pointer_funcs(prop, "rna_UserDef_autosave_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Auto Save", "Automatic backup file settings."); - prop= RNA_def_property(srna, "language", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "UserPreferencesLanguage"); RNA_def_property_pointer_funcs(prop, "rna_UserDef_language_get", NULL, NULL); @@ -2246,7 +2230,6 @@ void RNA_def_userdef(BlenderRNA *brna) rna_def_userdef_view(brna); rna_def_userdef_edit(brna); - rna_def_userdef_autosave(brna); rna_def_userdef_language(brna); rna_def_userdef_filepaths(brna); rna_def_userdef_system(brna); diff --git a/source/blender/makesrna/intern/rna_vpaint.c b/source/blender/makesrna/intern/rna_vpaint.c deleted file mode 100644 index bf6b70dab23..00000000000 --- a/source/blender/makesrna/intern/rna_vpaint.c +++ /dev/null @@ -1,90 +0,0 @@ -/** - * $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): Campbell Barton - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include <stdlib.h> - -#include "RNA_define.h" -#include "RNA_types.h" - -#include "rna_internal.h" - -#include "DNA_scene_types.h" - -#ifdef RNA_RUNTIME - -#else - -void RNA_def_vpaint(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - static EnumPropertyItem prop_mode_items[] = { - {0, "MIX", 0, "Mix", "Use mix blending mode while painting."}, - {1, "ADD", 0, "Add", "Use add blending mode while painting."}, - {2, "SUB", 0, "Subtract", "Use subtract blending mode while painting."}, - {3, "MUL", 0, "Multiply", "Use multiply blending mode while painting."}, - {4, "BLUR", 0, "Blur", "Blur the color with surrounding values"}, - {5, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting."}, - {6, "DARKEN", 0, "Darken", "Use darken blending mode while painting."}, - {0, NULL, 0, NULL, NULL}}; - - srna= RNA_def_struct(brna, "VPaint", NULL); - RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of the Vpaint tool."); - - prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "Brush"); - RNA_def_property_ui_text(prop, "Brush", ""); - - prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_mode_items); - RNA_def_property_ui_text(prop, "Brush Mode", "The Mode in which color is painted."); - - prop= RNA_def_property(srna, "all_faces", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA); - RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush."); - - prop= RNA_def_property(srna, "vertex_dist", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SOFT); - RNA_def_property_ui_text(prop, "Vertex Dist", "Use distances to vertices (instead of paint entire faces)."); - - prop= RNA_def_property(srna, "normals", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS); - RNA_def_property_ui_text(prop, "Normals", "Applies the vertex normal before painting."); - - prop= RNA_def_property(srna, "spray", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY); - RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse."); - - prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.1f, 5.0f); - RNA_def_property_ui_text(prop, "Gamma", "Vpaint Gamma."); - - prop= RNA_def_property(srna, "mul", PROP_FLOAT, PROP_NONE); - RNA_def_property_range(prop, 0.1f, 50.0f); - RNA_def_property_ui_text(prop, "Mul", "Vpaint Mul."); - -} - -#endif - diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 9c9c256e819..4a2154bc3cf 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -40,8 +40,28 @@ EnumPropertyItem event_value_items[] = { {KM_RELEASE, "RELEASE", 0, "Release", ""}, {0, NULL, 0, NULL, NULL}}; -/* not returned: CAPSLOCKKEY, UNKNOWNKEY, COMMANDKEY, GRLESSKEY */ +/* not returned: CAPSLOCKKEY, UNKNOWNKEY, GRLESSKEY */ EnumPropertyItem event_type_items[] = { + + {LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", ""}, + {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", ""}, + {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", ""}, + {ACTIONMOUSE, "ACTIONMOUSE", 0, "Action Mouse", ""}, + {SELECTMOUSE, "SELECTMOUSE", 0, "Select Mouse", ""}, + + {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", ""}, + + {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""}, + {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""}, + {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""}, + {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""}, + + {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", ""}, + {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", ""}, + {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", ""}, + {EVT_TWEAK_A, "EVT_TWEAK_A", 0, "Tweak Action", ""}, + {EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Tweak Select", ""}, + {AKEY, "A", 0, "A", ""}, {BKEY, "B", 0, "B", ""}, {CKEY, "C", 0, "C", ""}, @@ -86,6 +106,8 @@ EnumPropertyItem event_type_items[] = { {RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", ""}, {RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", ""}, {RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", ""}, + + {COMMANDKEY, "COMMAND", 0, "Command", ""}, {ESCKEY, "ESC", 0, "Esc", ""}, {TABKEY, "TAB", 0, "Tab", ""}, diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index b40f3de43ef..f23b893539d 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -66,31 +66,33 @@ static void rna_World_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *p static PointerRNA rna_World_active_texture_get(PointerRNA *ptr) { World *wo= (World*)ptr->data; + Tex *tex; - return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, wo->mtex[(int)wo->texact]); + tex= (wo->mtex[(int)wo->texact])? wo->mtex[(int)wo->texact]->tex: NULL; + return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex); } -static void rna_World_active_texture_index_set(PointerRNA *ptr, int value) +static void rna_World_active_texture_set(PointerRNA *ptr, PointerRNA value) { World *wo= (World*)ptr->data; int act= wo->texact; - if(value == act || value < 0 || value >= MAX_MTEX) - return; - - /* auto create/free mtex on activate/deactive, so we can edit - * the texture pointer in the buttons UI. */ - if(wo->mtex[act] && !wo->mtex[act]->tex) { + if(wo->mtex[act] && wo->mtex[act]->tex) + id_us_min(&wo->mtex[act]->tex->id); + + if(value.data) { + if(!wo->mtex[act]) { + wo->mtex[act]= add_mtex(); + wo->mtex[act]->texco= TEXCO_VIEW; + } + + wo->mtex[act]->tex= value.data; + id_us_plus(&wo->mtex[act]->tex->id); + } + else if(wo->mtex[act]) { MEM_freeN(wo->mtex[act]); wo->mtex[act]= NULL; } - - wo->texact= value; - - if(!wo->mtex[value]) { - wo->mtex[value]= add_mtex(); - wo->mtex[value]->texco= TEXCO_VIEW; - } } #else @@ -117,18 +119,22 @@ static void rna_def_world_mtex(BlenderRNA *brna) prop= RNA_def_property(srna, "map_blend", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_BLEND); RNA_def_property_ui_text(prop, "Blend", "Affect the color progression of the background."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_horizon", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_HORIZ); RNA_def_property_ui_text(prop, "Horizon", "Affect the color of the horizon."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_zenith_up", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENUP); RNA_def_property_ui_text(prop, "Zenith Up", "Affect the color of the zenith above."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "map_zenith_down", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENDOWN); RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); /* unused prop= RNA_def_property(srna, "map_mist", PROP_BOOLEAN, PROP_NONE); @@ -139,12 +145,38 @@ static void rna_def_world_mtex(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "texco"); RNA_def_property_enum_items(prop, texco_items); RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "object"); 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 mapping with Object texture coordinates."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "varfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Blend Factor", "Amount texture affects color progression of the background."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "horizon_factor", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Horizon Factor", "Amount texture affects color of the horizon."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "zenith_up_factor", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Zenith Up Factor", "Amount texture affects color of the zenith above."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); + + prop= RNA_def_property(srna, "zenith_down_factor", PROP_FLOAT, PROP_VECTOR); + RNA_def_property_float_sdna(prop, NULL, "colfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Zenith Down Factor", "Amount texture affects color of the zenith below."); + RNA_def_property_update(prop, NC_TEXTURE, NULL); } static void rna_def_ambient_occlusion(BlenderRNA *brna) @@ -188,7 +220,7 @@ static void rna_def_ambient_occlusion(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "aodist"); RNA_def_property_ui_text(prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect."); - prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "falloff_strength", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "aodistfac"); RNA_def_property_ui_text(prop, "Strength", "Distance attenuation factor, the higher, the 'shorter' the shadows."); @@ -377,7 +409,8 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA); rna_def_animdata_common(srna); - rna_def_mtex_common(srna, "rna_World_mtex_begin", "rna_World_active_texture_get", "rna_World_active_texture_index_set", "WorldTextureSlot"); + rna_def_mtex_common(srna, "rna_World_mtex_begin", "rna_World_active_texture_get", + "rna_World_active_texture_set", "WorldTextureSlot"); /* colors */ prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR); @@ -440,10 +473,6 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL); RNA_def_property_ui_text(prop, "Stars", "World stars settings."); - prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL); - RNA_def_property_pointer_sdna(prop, NULL, "scriptlink"); - RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this object."); - rna_def_ambient_occlusion(brna); rna_def_world_mist(brna); rna_def_world_stars(brna); |