forked from bartvdbraak/blender
RNA: add rna_space_api.c for space functions
This commit is contained in:
parent
5643c29fbe
commit
ae46e8a698
@ -117,6 +117,7 @@ set(APISRC
|
||||
rna_scene_api.c
|
||||
rna_sensor_api.c
|
||||
rna_sequencer_api.c
|
||||
rna_space_api.c
|
||||
rna_text_api.c
|
||||
rna_ui_api.c
|
||||
rna_wm_api.c
|
||||
|
@ -3276,7 +3276,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
|
||||
{"rna_sensor.c", "rna_sensor_api.c", RNA_def_sensor},
|
||||
{"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer},
|
||||
{"rna_smoke.c", NULL, RNA_def_smoke},
|
||||
{"rna_space.c", NULL, RNA_def_space},
|
||||
{"rna_space.c", "rna_space_api.c", RNA_def_space},
|
||||
{"rna_speaker.c", NULL, RNA_def_speaker},
|
||||
{"rna_test.c", NULL, RNA_def_test},
|
||||
{"rna_text.c", "rna_text_api.c", RNA_def_text},
|
||||
|
@ -284,6 +284,8 @@ void RNA_api_text(struct StructRNA *srna);
|
||||
void RNA_api_ui_layout(struct StructRNA *srna);
|
||||
void RNA_api_window(struct StructRNA *srna);
|
||||
void RNA_api_wm(struct StructRNA *srna);
|
||||
void RNA_api_space_node(struct StructRNA *srna);
|
||||
void RNA_api_region_view3d(struct StructRNA *srna);
|
||||
void RNA_api_sensor(struct StructRNA *srna);
|
||||
void RNA_api_controller(struct StructRNA *srna);
|
||||
void RNA_api_actuator(struct StructRNA *srna);
|
||||
|
@ -546,25 +546,6 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value
|
||||
ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist);
|
||||
}
|
||||
|
||||
/* api call */
|
||||
static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d)
|
||||
{
|
||||
bScreen *sc = (bScreen *)id;
|
||||
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
|
||||
area_region_from_regiondata(sc, rv3d, &sa, &ar);
|
||||
|
||||
if (sa && ar && sa->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d;
|
||||
|
||||
v3d = (View3D *)sa->spacedata.first;
|
||||
|
||||
ED_view3d_update_viewmat(sc->scene, v3d, ar, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static int rna_SpaceView3D_viewport_shade_get(PointerRNA *ptr)
|
||||
{
|
||||
Scene *scene = ((bScreen *)ptr->id.data)->scene;
|
||||
@ -2185,14 +2166,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Camera Offset", "View shift in camera view");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
|
||||
/* until we have real api call */
|
||||
{
|
||||
FunctionRNA *func;
|
||||
|
||||
func = RNA_def_function(srna, "update", "rna_RegionView3D_update");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_ui_description(func, "Recalculate the view matrices");
|
||||
}
|
||||
RNA_api_region_view3d(srna);
|
||||
}
|
||||
|
||||
static void rna_def_space_buttons(BlenderRNA *brna)
|
||||
@ -3348,8 +3322,7 @@ static void rna_def_space_node_path_api(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
static void rna_def_space_node(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop, *parm;
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *prop;
|
||||
|
||||
static EnumPropertyItem texture_type_items[] = {
|
||||
{SNODE_TEX_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit texture nodes from Object"},
|
||||
@ -3488,13 +3461,7 @@ static void rna_def_space_node(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Cursor Location", "Location for adding new nodes");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
|
||||
|
||||
func = RNA_def_function(srna, "cursor_location_from_region", "rna_SpaceNodeEditor_cursor_location_from_region");
|
||||
RNA_def_function_ui_description(func, "Set the cursor location using region coordinates");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
RNA_api_space_node(srna);
|
||||
}
|
||||
|
||||
static void rna_def_space_logic(BlenderRNA *brna)
|
||||
|
77
source/blender/makesrna/intern/rna_space_api.c
Normal file
77
source/blender/makesrna/intern/rna_space_api.c
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor(s): Blender Foundation (2008)
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/makesrna/intern/rna_space_api.c
|
||||
* \ingroup RNA
|
||||
*/
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
|
||||
#include "rna_internal.h"
|
||||
|
||||
#ifdef RNA_RUNTIME
|
||||
|
||||
static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d)
|
||||
{
|
||||
bScreen *sc = (bScreen *)id;
|
||||
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
|
||||
area_region_from_regiondata(sc, rv3d, &sa, &ar);
|
||||
|
||||
if (sa && ar && sa->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d;
|
||||
|
||||
v3d = (View3D *)sa->spacedata.first;
|
||||
|
||||
ED_view3d_update_viewmat(sc->scene, v3d, ar, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void RNA_api_region_view3d(StructRNA *srna)
|
||||
{
|
||||
FunctionRNA *func;
|
||||
|
||||
func = RNA_def_function(srna, "update", "rna_RegionView3D_update");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_ui_description(func, "Recalculate the view matrices");
|
||||
}
|
||||
|
||||
void RNA_api_space_node(StructRNA *srna)
|
||||
{
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
func = RNA_def_function(srna, "cursor_location_from_region", "rna_SpaceNodeEditor_cursor_location_from_region");
|
||||
RNA_def_function_ui_description(func, "Set the cursor location using region coordinates");
|
||||
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
|
||||
parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user