Blender  V2.93
rna_animation_api.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2009 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include <stdio.h>
25 #include <stdlib.h>
26 
27 #include "RNA_define.h"
28 #include "RNA_enum_types.h"
29 
30 #include "DNA_anim_types.h"
31 #include "DNA_object_types.h"
32 #include "DNA_scene_types.h"
33 
34 #include "rna_internal.h" /* own include */
35 
36 #ifdef RNA_RUNTIME
37 
38 # include "BKE_context.h"
39 # include "BKE_nla.h"
40 # include "BKE_report.h"
41 
42 # include "ED_keyframing.h"
43 
44 static void rna_KeyingSet_context_refresh(KeyingSet *ks, bContext *C, ReportList *reports)
45 {
46  /* TODO: enable access to providing a list of overrides (dsources)? */
48 
49  if (error != 0) {
50  switch (error) {
52  BKE_report(reports, RPT_ERROR, "Invalid context for keying set");
53  break;
54 
56  BKE_report(
57  reports, RPT_ERROR, "Incomplete built-in keying set, appears to be missing type info");
58  break;
59  }
60  }
61 }
62 
63 static float rna_AnimData_nla_tweak_strip_time_to_scene(AnimData *adt, float frame, bool invert)
64 {
66 }
67 
68 #else
69 
71 {
72  FunctionRNA *func;
73  /*PropertyRNA *parm; */
74 
75  /* validate relative Keying Set (used to ensure paths are ok for context) */
76  func = RNA_def_function(srna, "refresh", "rna_KeyingSet_context_refresh");
78  func,
79  "Refresh Keying Set to ensure that it is valid for the current context "
80  "(call before each use of one)");
82 }
83 
85 {
86  FunctionRNA *func;
87  PropertyRNA *parm;
88 
89  /* Convert between action time and scene time when tweaking a NLA strip. */
90  func = RNA_def_function(
91  srna, "nla_tweak_strip_time_to_scene", "rna_AnimData_nla_tweak_strip_time_to_scene");
93  "Convert a time value from the local time of the tweaked strip "
94  "to scene time, exactly as done by built-in key editing tools. "
95  "Returns the input time unchanged if not tweaking.");
96  parm = RNA_def_float(
97  func, "frame", 0.0, MINAFRAME, MAXFRAME, "", "Input time", MINAFRAME, MAXFRAME);
99  RNA_def_boolean(func, "invert", false, "Invert", "Convert scene time to action time");
100  parm = RNA_def_float(
101  func, "result", 0.0, MINAFRAME, MAXFRAME, "", "Converted time", MINAFRAME, MAXFRAME);
102  RNA_def_function_return(func, parm);
103 }
104 
105 #endif
@ NLATIME_CONVERT_MAP
Definition: BKE_nla.h:156
@ NLATIME_CONVERT_UNMAP
Definition: BKE_nla.h:153
float BKE_nla_tweakedit_remap(struct AnimData *adt, float cframe, short mode)
Definition: nla.c:582
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
Object is a sort of wrapper for general info.
#define MINAFRAME
#define MAXFRAME
eModifyKey_Returns
@ MODIFYKEY_MISSING_TYPEINFO
@ MODIFYKEY_INVALID_CONTEXT
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ FUNC_USE_REPORTS
Definition: RNA_types.h:578
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:577
#define C
Definition: RandGen.cpp:39
eModifyKey_Returns ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
Definition: keyingsets.c:936
static void error(const char *str)
Definition: meshlaplacian.c:65
void RNA_api_keyingset(StructRNA *srna)
void RNA_api_animdata(StructRNA *srna)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3825
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition: svm_invert.h:19