From 0d355a8a2ccaeb54a1f723fd5adacec76d08c921 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 15 Sep 2011 12:26:48 +0000 Subject: replace BLI_strncpy with BLI_strncpy_utf8 where input isnt ensured to be valid. also replace strcpy's which copy using "" with str[0]='\0' --- source/blender/makesrna/intern/rna_action.c | 2 +- source/blender/makesrna/intern/rna_animation.c | 2 +- source/blender/makesrna/intern/rna_armature.c | 4 ++-- source/blender/makesrna/intern/rna_constraint.c | 2 +- source/blender/makesrna/intern/rna_fcurve.c | 4 ++-- source/blender/makesrna/intern/rna_key.c | 2 +- source/blender/makesrna/intern/rna_mesh.c | 4 ++-- source/blender/makesrna/intern/rna_modifier.c | 2 +- source/blender/makesrna/intern/rna_nla.c | 2 +- source/blender/makesrna/intern/rna_nodetree.c | 2 +- source/blender/makesrna/intern/rna_object.c | 12 ++++++------ source/blender/makesrna/intern/rna_pose.c | 6 +++--- source/blender/makesrna/intern/rna_property.c | 2 +- source/blender/makesrna/intern/rna_scene.c | 6 +++--- source/blender/makesrna/intern/rna_sequencer.c | 2 +- source/blender/makesrna/intern/rna_text.c | 4 ++-- source/blender/makesrna/intern/rna_texture.c | 2 +- 17 files changed, 30 insertions(+), 30 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 815a9c92968..53e1bf7e6f6 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -137,7 +137,7 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= 1; marker->frame= 1; - BLI_strncpy(marker->name, name, sizeof(marker->name)); + BLI_strncpy_utf8(marker->name, name, sizeof(marker->name)); BLI_addtail(&act->markers, marker); return marker; } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 0395a54be8e..2f5f22c52d5 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -252,7 +252,7 @@ static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value) if (ksp->rna_path) strcpy(value, ksp->rna_path); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_ksPath_RnaPath_length(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index e2399b5b57c..4ed5d2a125a 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -253,7 +253,7 @@ static void rna_EditBone_name_set(PointerRNA *ptr, const char *value) char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)]; /* need to be on the stack */ - BLI_strncpy(newname, value, sizeof(ebone->name)); + BLI_strncpy_utf8(newname, value, sizeof(ebone->name)); BLI_strncpy(oldname, ebone->name, sizeof(ebone->name)); ED_armature_bone_rename(arm, oldname, newname); @@ -266,7 +266,7 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value) char oldname[sizeof(bone->name)], newname[sizeof(bone->name)]; /* need to be on the stack */ - BLI_strncpy(newname, value, sizeof(bone->name)); + BLI_strncpy_utf8(newname, value, sizeof(bone->name)); BLI_strncpy(oldname, bone->name, sizeof(bone->name)); ED_armature_bone_rename(arm, oldname, newname); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 22d9a19f933..fdbb4f09f93 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -170,7 +170,7 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(oldname, con->name, sizeof(con->name)); /* copy the new name into the name slot */ - BLI_strncpy(con->name, value, sizeof(con->name)); + BLI_strncpy_utf8(con->name, value, sizeof(con->name)); /* make sure name is unique */ if (ptr->id.data) { diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index e922a007249..c0c8ac6b88a 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -215,7 +215,7 @@ static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value) if (dtar->rna_path) strcpy(value, dtar->rna_path); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr) @@ -309,7 +309,7 @@ static void rna_FCurve_RnaPath_get(PointerRNA *ptr, char *value) if (fcu->rna_path) strcpy(value, fcu->rna_path); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_FCurve_RnaPath_length(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 3e65eb8665e..ad6f67cddaf 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -76,7 +76,7 @@ void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(oldname, kb->name, sizeof(kb->name)); /* copy the new name into the name slot */ - BLI_strncpy(kb->name, value, sizeof(kb->name)); + BLI_strncpy_utf8(kb->name, value, sizeof(kb->name)); /* make sure the name is truly unique */ if (ptr->id.data) { diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 80c98e8c428..b0554ea5b4f 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -690,7 +690,7 @@ static void rna_MeshTextureFaceLayer_name_set(PointerRNA *ptr, const char *value Mesh *me= (Mesh*)ptr->id.data; CustomData *fdata= rna_mesh_fdata(me); CustomDataLayer *cdl= (CustomDataLayer*)ptr->data; - BLI_strncpy(cdl->name, value, sizeof(cdl->name)); + BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name)); CustomData_set_layer_unique_name(fdata, cdl - fdata->layers); } @@ -802,7 +802,7 @@ static void rna_MeshColorLayer_name_set(PointerRNA *ptr, const char *value) Mesh *me= (Mesh*)ptr->id.data; CustomData *fdata= rna_mesh_fdata(me); CustomDataLayer *cdl= (CustomDataLayer*)ptr->data; - BLI_strncpy(cdl->name, value, sizeof(cdl->name)); + BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name)); CustomData_set_layer_unique_name(fdata, cdl - fdata->layers); } diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 464f676b7f6..b83f06c633c 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -211,7 +211,7 @@ void rna_Modifier_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(oldname, md->name, sizeof(md->name)); /* copy the new name into the name slot */ - BLI_strncpy(md->name, value, sizeof(md->name)); + BLI_strncpy_utf8(md->name, value, sizeof(md->name)); /* make sure the name is truly unique */ if (ptr->id.data) { diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index ef4adde6fb4..2a234dfaa61 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -59,7 +59,7 @@ static void rna_NlaStrip_name_set(PointerRNA *ptr, const char *value) NlaStrip *data= (NlaStrip *)ptr->data; /* copy the name first */ - BLI_strncpy(data->name, value, sizeof(data->name)); + BLI_strncpy_utf8(data->name, value, sizeof(data->name)); /* validate if there's enough info to do so */ if (ptr->id.data) { diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 0554e4d00ad..61947977fee 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -361,7 +361,7 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value) /* make a copy of the old name first */ BLI_strncpy(oldname, node->name, sizeof(node->name)); /* set new name */ - BLI_strncpy(node->name, value, sizeof(node->name)); + BLI_strncpy_utf8(node->name, value, sizeof(node->name)); nodeUniqueName(ntree, node); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index bb223ac95b4..e7b5529af02 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -466,7 +466,7 @@ void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value) { Object *ob= (Object *)ptr->id.data; bDeformGroup *dg= (bDeformGroup *)ptr->data; - BLI_strncpy(dg->name, value, sizeof(dg->name)); + BLI_strncpy_utf8(dg->name, value, sizeof(dg->name)); defgroup_unique_name(dg, ob); } @@ -512,7 +512,7 @@ void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index) dg= BLI_findlink(&ob->defbase, index-1); if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name)); - else BLI_strncpy(value, "", sizeof(dg->name)); + else value[0]= '\0'; } int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index) @@ -535,7 +535,7 @@ void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result Object *ob= (Object*)ptr->id.data; bDeformGroup *dg= defgroup_find_name(ob, value); if(dg) { - BLI_strncpy(result, value, maxlen); + BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */ return; } @@ -562,7 +562,7 @@ void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *resul } } - BLI_strncpy(result, "", maxlen); + result[0]= '\0'; } void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen) @@ -585,7 +585,7 @@ void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *res } } - BLI_strncpy(result, "", maxlen); + result[0]= '\0'; } static int rna_Object_active_material_index_get(PointerRNA *ptr) @@ -836,7 +836,7 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str) if(ma) strcpy(str, ma->id.name+2); else - strcpy(str, ""); + str[0]= '\0'; } static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 0dd8218d1b9..434634f6b10 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -222,7 +222,7 @@ static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value) char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)]; /* need to be on the stack */ - BLI_strncpy(newname, value, sizeof(pchan->name)); + BLI_strncpy_utf8(newname, value, sizeof(pchan->name)); BLI_strncpy(oldname, pchan->name, sizeof(pchan->name)); ED_armature_bone_rename(ob->data, oldname, newname); @@ -411,7 +411,7 @@ static void rna_pose_bgroup_name_index_get(PointerRNA *ptr, char *value, int ind grp= BLI_findlink(&pose->agroups, index-1); if(grp) BLI_strncpy(value, grp->name, sizeof(grp->name)); - else BLI_strncpy(value, "", sizeof(grp->name)); // XXX if invalid pointer, won't this crash? + else value[0]= '\0'; } static int rna_pose_bgroup_name_index_length(PointerRNA *ptr, int index) @@ -451,7 +451,7 @@ static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *r } } - BLI_strncpy(result, "", maxlen); + result[0]= '\0'; } #endif diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index 9fd5610a577..e2b886b8d38 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -88,7 +88,7 @@ static void rna_GameProperty_type_set(PointerRNA *ptr, int value) static void rna_GameProperty_name_set(PointerRNA *ptr, const char *value) { bProperty *prop= (bProperty*)(ptr->data); - BLI_strncpy(prop->name, value, sizeof(prop->name)); + BLI_strncpy_utf8(prop->name, value, sizeof(prop->name)); unique_property(NULL, prop, 1); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 197ddd2ba06..2377c88113a 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -737,7 +737,7 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) RenderEngineType *type= BLI_findlink(&R_engines, value); if(type) - BLI_strncpy(rd->engine, type->idname, sizeof(rd->engine)); + BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); } static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) @@ -810,7 +810,7 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) Scene *scene= (Scene*)ptr->id.data; SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data; - BLI_strncpy(rl->name, value, sizeof(rl->name)); + BLI_strncpy_utf8(rl->name, value, sizeof(rl->name)); if(scene->nodetree) { bNode *node; @@ -1011,7 +1011,7 @@ static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[]) TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= SELECT; marker->frame= 1; - BLI_strncpy(marker->name, name, sizeof(marker->name)); + BLI_strncpy_utf8(marker->name, name, sizeof(marker->name)); BLI_addtail(&scene->markers, marker); return marker; } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 627c2274965..79724adf91c 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -359,7 +359,7 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(oldname, seq->name+2, sizeof(seq->name)-2); /* copy the new name into the name slot */ - BLI_strncpy(seq->name+2, value, sizeof(seq->name)-2); + BLI_strncpy_utf8(seq->name+2, value, sizeof(seq->name)-2); /* make sure the name is unique */ seqbase_unique_name_recursive(&scene->ed->seqbase, seq); diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 959f9db851b..6a1e93fce41 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -53,7 +53,7 @@ static void rna_Text_filename_get(PointerRNA *ptr, char *value) if(text->name) strcpy(value, text->name); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_Text_filename_length(PointerRNA *ptr) @@ -88,7 +88,7 @@ static void rna_TextLine_body_get(PointerRNA *ptr, char *value) if(line->line) strcpy(value, line->line); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_TextLine_body_length(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 890be76c49a..608a7326d79 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -260,7 +260,7 @@ static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str) if(mtex->tex) strcpy(str, mtex->tex->id.name+2); else - strcpy(str, ""); + str[0]= '\0'; } static int rna_TextureSlot_output_node_get(PointerRNA *ptr) -- cgit v1.2.3 From e2818f1b926b779b1d59010aaa5c4e625c0877d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 15 Sep 2011 16:15:24 +0000 Subject: - include enum names and descriptions in sphinx generated documentation - add descriptions for operator bl_options --- source/blender/makesrna/intern/rna_wm.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 7ce1e1ab88f..a259f84ff1a 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -348,20 +348,20 @@ EnumPropertyItem keymap_modifiers_items[] = { {0, NULL, 0, NULL, NULL}}; EnumPropertyItem operator_flag_items[] = { - {OPTYPE_REGISTER, "REGISTER", 0, "Register", ""}, - {OPTYPE_UNDO, "UNDO", 0, "Undo", ""}, - {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", ""}, - {OPTYPE_MACRO, "MACRO", 0, "Macro", ""}, - {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", ""}, - {OPTYPE_PRESET, "PRESET", 0, "Preset", ""}, - {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", ""}, + {OPTYPE_REGISTER, "REGISTER", 0, "Register", "Display in the info window and support the redo toolbar panel"}, + {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"}, + {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"}, + {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"}, + {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", "Use so the operator grabs the mouse focus, enables wrapping when continuous grab is enabled"}, + {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"}, + {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem operator_return_items[] = { - {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", ""}, - {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", ""}, - {OPERATOR_FINISHED, "FINISHED", 0, "Finished", ""}, - {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", ""}, // used as a flag + {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"}, + {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"}, + {OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"}, + {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"}, // used as a flag {0, NULL, 0, NULL, NULL}}; /* flag/enum */ -- cgit v1.2.3 From 0abe1911d57b4d4a806a5de6f8cdf4f421abb7cf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 16 Sep 2011 06:47:01 +0000 Subject: - fix for access past the buffer size (paint / sculpt used some 2d vecs as 3d) - remove redundant NULL checks on old code where it would crash if the result was NULL later on. - add some missing NULL checks. --- source/blender/makesrna/intern/rna_texture_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c index 8c63d5da8fd..4941c75c400 100644 --- a/source/blender/makesrna/intern/rna_texture_api.c +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -68,7 +68,7 @@ void clear_envmap(struct EnvMap *env, bContext *C) } } -void texture_evaluate(struct Tex *tex, float value[3], float color_r[3]) +void texture_evaluate(struct Tex *tex, float value[3], float color_r[4]) { TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; multitex_ext(tex, value, NULL, NULL, 1, &texres); -- cgit v1.2.3 From e53c4dae546f9550d6a4e79ae87c3dee9ac7b650 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 17 Sep 2011 13:33:03 +0000 Subject: Recast/detour: fix some property enum identifiers to follow conventions. --- source/blender/makesrna/intern/rna_actuator.c | 6 +++--- source/blender/makesrna/intern/rna_scene.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 7356af05dcb..6aff68a9c09 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -1931,9 +1931,9 @@ static void rna_def_steering_actuator(BlenderRNA *brna) {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, {3, "Z", 0, "Z", ""}, - {4, "-X", 0, "-X", ""}, - {5, "-Y", 0, "-Y", ""}, - {6, "-Z", 0, "-Z", ""}, + {4, "NEG_X", 0, "-X", ""}, + {5, "NEG_Y", 0, "-Y", ""}, + {6, "NEG_Z", 0, "-Z", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SteeringActuator", "Actuator"); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2377c88113a..76d7c3153d8 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1811,8 +1811,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) static EnumPropertyItem obstacle_simulation_items[] = { {OBSTSIMULATION_NONE, "NONE", 0, "None", ""}, - {OBSTSIMULATION_TOI_rays, "RVO (rays)", 0, "RVO (rays)", ""}, - {OBSTSIMULATION_TOI_cells, "RVO (cells)", 0, "RVO (cells)", ""}, + {OBSTSIMULATION_TOI_rays, "RVO_RAYS", 0, "RVO (rays)", ""}, + {OBSTSIMULATION_TOI_cells, "RVO_CELLS", 0, "RVO (cells)", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SceneGameData", NULL); -- cgit v1.2.3 From 82e6547a3637136fd9e411e7531669bb96a141a3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 18 Sep 2011 11:47:17 +0000 Subject: patch [#28684] Image pack/unpack() implementation. from Bill Currie (taniwha) --- source/blender/makesrna/intern/rna_image_api.c | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 7327c7203b9..083e87dfd4e 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -37,6 +37,9 @@ #include #include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "DNA_packedFile_types.h" #include "BIF_gl.h" @@ -127,6 +130,38 @@ static void rna_Image_save(Image *image, ReportList *reports) } } +static void rna_Image_pack(Image *image, ReportList *reports, int as_png) +{ + ImBuf *ibuf = BKE_image_get_ibuf(image, NULL); + + if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) { + BKE_reportf(reports, RPT_ERROR, "Can't pack edited image from disk, only as internal PNG."); + } + else { + if(as_png) { + BKE_image_memorypack(image); + } + else { + image->packedfile= newPackedFile(reports, image->name); + } + } +} + +static void rna_Image_unpack(Image *image, ReportList *reports, int method) +{ + if (!image->packedfile) { + BKE_report(reports, RPT_ERROR, "Image not packed"); + } + else if (image->source==IMA_SRC_SEQUENCE || image->source==IMA_SRC_MOVIE) { + BKE_report(reports, RPT_ERROR, "Unpacking movies or image sequences not supported."); + return; + } + else { + /* reports its own error on failier */ + unpackImage (reports, image, method); + } +} + static void rna_Image_reload(Image *image) { BKE_image_signal(image, NULL, IMA_SIGNAL_RELOAD); @@ -211,6 +246,16 @@ void RNA_api_image(StructRNA *srna) RNA_def_function_ui_description(func, "Save image to its source path"); RNA_def_function_flag(func, FUNC_USE_REPORTS); + func= RNA_def_function(srna, "pack", "rna_Image_pack"); + RNA_def_function_ui_description(func, "Pack an image as embedded data into the .blend file."); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_boolean(func, "as_png", 0, "as_png", "Pack the image as PNG (needed for generated/dirty images)"); + + func= RNA_def_function(srna, "unpack", "rna_Image_unpack"); + RNA_def_function_ui_description(func, "Save an image packed in the .blend file to disk"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_enum(func, "method", unpack_method_items, PF_USE_LOCAL, "method", "How to unpack."); + func= RNA_def_function(srna, "reload", "rna_Image_reload"); RNA_def_function_ui_description(func, "Reload the image from its source path"); -- cgit v1.2.3 From 226ff0d4da13ac66991f1708251faa5dff3f7dea Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Sep 2011 09:47:58 +0000 Subject: Curve back/front fill changes: - Use enum instead of back/front flags combinations. - This flags behaves differently for 2d/3d curves so use different enums for them. - This commit shouldn't change existing files. --- source/blender/makesrna/intern/rna_curve.c | 33 ++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 3cf6feb005c..e3f86032213 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -74,6 +74,20 @@ EnumPropertyItem curve_type_items[] = { {CU_NURBS, "NURBS", 0, "Ease", ""}, {0, NULL, 0, NULL, NULL}}; +static const EnumPropertyItem curve3d_fill_mode_items[]= { + {0, "FULL", 0, "Full", ""}, + {CU_BACK, "BACK", 0, "Back", ""}, + {CU_FRONT, "FRONT", 0, "Front", ""}, + {CU_FRONT|CU_BACK, "HALF", 0, "Half", ""}, + {0, NULL, 0, NULL, NULL}}; + +static const EnumPropertyItem curve2d_fill_mode_items[]= { + {0, "NONE", 0, "None", ""}, + {CU_BACK, "BACK", 0, "Back", ""}, + {CU_FRONT, "FRONT", 0, "Front", ""}, + {CU_FRONT|CU_BACK, "BOTH", 0, "Both", ""}, + {0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "BLI_math.h" @@ -278,6 +292,12 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) } } +static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +{ + Curve *cu= (Curve*)ptr->id.data; + + return (cu->flag&CU_3D) ? curve3d_fill_mode_items : curve2d_fill_mode_items; +} static int rna_Nurb_length(PointerRNA *ptr) { @@ -1345,14 +1365,11 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - prop= RNA_def_property(srna, "use_fill_front", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FRONT); - RNA_def_property_ui_text(prop, "Front", "Draw filled front for extruded/beveled curves"); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - - prop= RNA_def_property(srna, "use_fill_back", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_BACK); - RNA_def_property_ui_text(prop, "Back", "Draw filled back for extruded/beveled curves"); + prop= RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); + RNA_def_property_enum_items(prop, curve3d_fill_mode_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Curve_fill_mode_itemf"); + RNA_def_property_ui_text(prop, "Fill Mode", "Mode of filling curve"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop= RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE); -- cgit v1.2.3